Friday, September 30, 2011

has_many :accomplishments, :through => :learning

For years, I've wanted to learn a programming language, and I've started many books and tutorials, but never got very far in any of them. I wasn't truly ready to learn those times I guess.

A little over a month ago, I decided it was finally time to learn something new. I'm a "learner" by nature, so this isn't anything new to me. I did a little searching online and found an awesome Rails Tutorial and almost every night and during the weekend I've been hacking my way through it...a few times, I got stuck. The first few times I got stuck I blew everything away and started over. After going through the preliminary chapters a few times, I started to have a genuine understanding of what I was doing, and I wasn't just retyping code over into an editor. That felt good. I started over again. Why? I wanted to fully understand what I was doing - you can't learn by copying and pasting, and you can't learn by simply typing code - you have to understand what it does.

The tutorial I mention above guides you through creating a Twitter-like micro blogging application. Although it's not representative of every type of Rails application out there, it gives you a good understanding of all of the concepts that go into creating a Rails application, as well as helping you build good habits such as testing your code as you go, and using source control such as Git.

I'm pretty happy with myself - I finally for the first time after a lot of failed attempts at programming, have created something that works, and I understand why it works and how it works. I'm looking forward to my next tutorial, and learning more about Ruby on Rails.

Thursday, September 29, 2011

Ubuntu Font Family Updated: Mono font released!

As I mentioned a while back, Ubuntu has been working on a new monospaced font for the Ubuntu Font family, and the waiting is over. The Ubuntu font family package has been updated with the official release of this awesome coding and terminal font. Be sure to update your system to snag it!

Monday, September 26, 2011

Vim for Rails

I have "graduated" as you might say into using Vim as my editor for rails. Partly because I wanted too, and partly because I've not only switched to XFCE (and don't want to install Gedit), and also because I've moved from having my dev environment in a VM to running natively on my machine (since I've gotten more comfortable with Rails).

Just a couple of small tweaks.
I installed vim-rails and made a few small edits to my .vimrc file you can see below:


set nocompatible
set nu
set tabstop=2
set shiftwidth=2
set softtabstop=2
set ai
set columns=100
set lines=50
set expandtab
set smarttab
let g:rubycomplete_rails = 1
syntax on


I'm more than open to any further suggestions to my .vimrc

Friday, September 23, 2011

Ubuntu 11.10 Deploying Server fleets with Orchestra

I follow Planet Ubuntu, and recently Ahmed Kamal from the Ubuntu Cloud team recently posted a couple of very awesome and interesting blog-posts about deploying server fleets with Orchestra under Ubuntu Oneiric Server. I've never played with Orchestra before, but I'll be setting up a "VirtualBox" lab on my system to check it out! Thanks Ahmed for the posts!

The technology is awesome, and I felt it was definitely worth sharing with my readers in case you missed it.

Part 1
Part 2

Sunday, September 18, 2011

Ran a pretty good 5K yesterday

For those who don't know me personally, for about the past 2 years, I've been on quite a weight-loss journey. When I started counting back in November of 2009, I was carrying around 320 pounds on my 5' 8" frame. Right now I'm tipping the scales at 158lbs, and I feel great.

I started running about 4 months ago; before that I had to stick to the elliptical trainer, and to walking as my knees couldn't handle running, but once I dropped down to about 175 lbs, I was able to start running...and boy did I run. I almost feel like Forrest Gump - I just ran, and ran, and ran... :-)

Anyway - I'm no elite runner, but I do take pride in the fact that yesterday I ran my second ever organized 5K road race, and I placed 3rd in my age bracket.










It has been quite a journey for me to go from this:
















To This:

Thursday, September 15, 2011

Setting up Ubuntu for Rails Devlelopment

I had originally set up my Rails dev environment on Ubuntu Server in a Virtual Machine on VirtualBox, and I was accessing it from my main Ubuntu desktop via SSH and SFTP, however I decided to migrate to a Ubuntu Desktop VM, still wanting to keep it separated into a VM.

There are a few guides out there already, but I've followed instructions from several, and I just wanted to document my entire process here.

These instructions are intended for use on Ubuntu 11.10. This post will be updated as needed for new versions of Ubuntu and/or new or different installation methods.

First, a little housekeeping. In a terminal:


sudo apt-get update
sudo apt-get upgrade


Reboot now, and then come back to a terminal and:


sudo apt-get dist-upgrade


(If needed)
Reboot again if you did a dist-upgrade

Now, we need to install a couple of packages before we can install RVM:


sudo apt-get install git-core curl


Now, we can install RVM:

bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)

Followed by:

echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc

Optionally, give yourself an awesome Bash prompt. Add the following to the bottom of your ~/.bashrc file:

PS1='\[\033[32m\]\u@\h\[\033[00m\]:\[\033[34m\]\w\[\033[31m\]$(__git_ps1)\[\033[00m\]\$ '

Followed by:

. .bashrc


(This will reset your bash config).

You will now have a color prompt which will tell you what Git branch you are on.

You can type rvm to enusre that RVM is loaded.


Now, we need to install a few more pre-req's:


sudo apt-get install libruby1.8 zlib1g-dev libssl-dev libreadline-gplv2-dev build-essential


Now, we can install Ruby 1.8.7:

rvm install 1.8.7

rvm use 1.8.7 --default


Now, we will add the Ubuntu on Rails PPA for a few other needed items:


sudo add-apt-repository ppa:ubuntu-on-rails

sudo apt-get update


Now for a few more installs:


sudo apt-get install ruby rubygems irb ri rdoc rake ruby1.8-dev libopenssl-ruby libxslt-dev libxml2-dev



Then:

export PATH=/var/lib/gems/1.8/bin:$PATH


Now, for SQLite3:

sudo apt-get install sqlite3 libsqlite3-dev

Followed by,

gem install sqlite3-ruby


Now, Ruby 1.9.3:

rvm install 1.9.3

rvm use 1.9.3 --default


If during the Ruby 1.9.3 install, you received errors about compiling yaml, try the following commands in succession:

rvm remove 1.9.3

rvm cleanup all

rvm get head

rvm reload

and then, again

rvm install 1.9.3

rvm use 1.9.3 --default

Now, install Rails

gem install rails


After you have both Rails and Ruby 1.9.2 up and running, install the sqlite gem again:


gem install sqlite3-ruby



Optionally, we can set up Sublime Text 2, the ultimate Rails editor (or you can use your editor of choice):

First, add an additional PPA Repository:

sudo apt-add-repository ppa:webupd8team/sublime-text-2

Followed by:

sudo apt-get update && sudo apt-get install sublime-text

If using Sublime Text 2, I recommend Ryan Bates' Railscast theme. See this earlier post for instructions on how to set that up, or any other Textmate theme you might prefer.

Whew! All done! We now have an Ubuntu desktop set up for Rails Development!

Wednesday, September 14, 2011

Gedit for Rails Development

If you are using Gedit for Rails development, there are a few tweaks you can make to make things easier.
First, you can install Gmate form the Ubuntu Rails PPA, but I don't need or want everything it has, but here are a few things I do.

First, check out this blog post I found very helpful - he has a file attached to add the syntax highlighting necessary as well as the correct mimetype file for Rails. If you are running Ubuntu 11.10 (or any other GNOME 3 distro), you need to modify his instructions to include the path of /usr/share/gtksourceview-3.0/language-specs/ rather than /usr/share/gtksourceview-2.0/language-specs/ as he has listed.

Other than that his instructions are solid. I also enable line numbers, current line highlighting, the embedded terminal, set my tab to a width of 2 using spaces rather than tabs and enable automatic indentation. I also disable creating a backup copy of files before saving.