2011-08-29

My amazing new résumé

I've been consulting since returning to Portland in February, but the time has come for me to locate a more permanent professional home. So, without further ado, I am pleased to present my new résumé.

If you or someone you know is looking for an experienced, professional software engineer, look no further - send me an email or give me a call!

2011-08-13

Self-contained Rails with RVM and Bundler

The idea here is to create a completely self-contained Ruby on Rails 3.1 application structure, for a nice, clean starting point to begin development of a new web application. To accomplish this we'll be making use of RVM, the Ruby Version Manager, and Bundler, the gem dependency manager.

Requirements

Before you begin, you'll need an account on a Unix-like system. Any Linux, BSD or Mac OS X system should be fine.

I think you'll also want a C compiler and related "build-essential" bits installed on this system, although you may be able to avoid that requirement by using an RVM Ruby that doesn't need to be compiled.

Superuser (root) access is not required for any of this; everything resides within ~/.rvm and a single directory for the application.

It may also be possible to do something like this on Windows, but I know nothing of such evil things.

Preparation

First, you'll need to install RVM, if you haven't done so previously. Follow these instructions to do so.

Once RVM is installed and working, you'll need an RVM Ruby. In these examples, I'll be using MRI 1.9.2; if you want to use a different Ruby, change ruby-1.9.2 to whatever you like. If you already have an RVM Ruby installed, that should work fine, just make sure you specify it in the .rvmrc file which follows in the next section.

$ rvm install ruby-1.9.2

The Application

Now that you have RVM and a Ruby to go with it, you can actually create your application structure. First, you need a project directory, and an .rvmrc file within that directory. The .rvmrc is used to configure RVM to switch to a certain Ruby and gem environment when entering the directory. This can be accomplished with the following commands; be sure to replace PROJECT with the name of your project.

$ mkdir PROJECT

$ echo "rvm ruby-1.9.2@PROJECT --create" > PROJECT/.rvmrc

You can confirm that our new .rvmrc is working, like this:

$ cd PROJECT

$ gem env

All of the paths displayed by gem env should be within your home directory.

Now that you have an empty environment, you can start adding the gems you need to get some work done. First and foremost, you'll want to install Bundler, the gem dependency manager. From this point onward, all commands should be run inside your new project directory.

$ gem install bundler

With Bundler installed, you're now ready to create a Gemfile, which will describe all of the other gems you want to use. I've provided an example Gemfile which installs Rails 3.1 here; feel free to use your own or change my example to fit your needs.

$ curl -s https://raw.github.com/keeganquinn/bits/master/blog/Gemfile > Gemfile

Once your Gemfile is in place, you can run Bundler to calculate your gem dependency tree and install all of the desired gems.

$ bundle install --without production

Finally, all gems are installed - you can now run Rails to generate the actual application structure. Note that you should call bundle exec to run commands associated with gems which were installed by Bundler - this will ensure that system-installed Ruby and/or gems will not override or interfere with your nice

$ bundle exec rails new . --skip

At this point, you should have a complete, self-contained Rails application structure, ready for you to start building it into the most amazing website in the history of the Internet - or whatever it is that you wanted to build.

2011-08-08

Dual-boot: Lion and Ubuntu

It had been a very long time since I set a system up to boot more than one operating system, and I was itching for an excuse to play with Linux: what better way to scratch that itch than to install Linux on my MacBook Pro?

Game Plan

Running Linux on an Intel Mac involves what is probably one of the most complicated ways for any modern computer to load system software. (Sounds like fun, right?) Apple's EFI firmware is started directly by the hardware, then loads the rEFIt boot menu, which allows OS selection. Although Intel Mac disks are all GPT-based, selecting Linux causes rEFIt to boot from an MBR compatibility block, which contains a GRUB installation. GRUB then displays a kernel selection menu, and finally boots Linux when a selection is made.

I started my process by following an article by a guy who refers to himself only as Scott. He doesn't say anything that is incredibly clever or insightful, but he clearly outlines what looks like a nice, conservative process for dual-booting.

Bad Luck, Good Luck

Unfortunately, as soon as I rebooted my system for the first time, immediately following the shrinking of my HFS+ partition by Boot Camp Assistant, I was greeted by a very plain gray-on-black screen informing me that there were no bootable volumes in my system (or something to that effect). At this point, I hadn't even done anything outside of Apple-supported Boot Camp territory. To make things even more interesting, the Snow Leopard install media which came with my computer wouldn't boot - it claimed my processor was unsupported.

By an unusual stroke of luck, I happened to have burned a rEFIt CD earlier, and using that, I successfully booted my Lion system again. With OS X running, I used the Startup Disk tool in System Preferences to make my system bootable again. At this point, I'm more or less back at square one, except I have a chunk of unpartitioned space at the end of my hard disk. I'm also starting to notice intermittent weirdness (long delays/hangs) booting OS X, which caused me some small amount of panic, but this issue seemed to resolve itself after a while.

rEFIt Installation

Although there is a convoluted bug report which states that rEFIt is unable to boot Lion, I wanted to give it a try anyway; after all, it worked perfectly when loading rEFIt from the CD.

My first few attempts, using the recommended rEFIt installer package, yielded no results whatsoever; although the files were installed under /efi as advertised, I couldn't conjure up a menu no matter how many times I rebooted.

Next I tried the manual installation process, and voila! Happy boot menu is happy. My guess is that, for some reason, the rEFIt installer package is not yet compatible with Lion.

Linux Installation

My first installation attempt was with a Debian GNU/Linux AMD64 disc. I was pleased to see it boot, but also was not particularly surprised when it completely failed to detect any sort of network hardware. I've never been a big Ubuntu fan, but I switched over to an Ubuntu 11.04 disc at this point - after all, this sort of thing is exactly why that company exists.

From this point on, everything went relatively smoothly. I ran through the Ubuntu 11.04 installation normally, and was immediately able to select between Lion and Ubuntu from the rEFIt boot menu.

I did reinstall Ubuntu two or three times; at first I had used the standard 64-bit installer, then I discovered the "Intel Mac" version of the installer. I was hoping to avoid the need for an ugly old MBR on my shiny new GPT disk, but I didn't actually see any difference at all between the two versions. One day, I will revisit this issue and make my system pure EFI/GPT again, but for now, everything is working quite well.