Tutorial Day at Rails Conf 2009

04 May 2009

First off, I’m going spend a minute in non-technical land and say that my wife and I had a fabulous time in Vegas over the weekend. She got to be part of a magic trick at the Penn and Teller show and won 50 bucks from a Wizard of Oz slot machine. Here’s some pics of our trip in case you want to see: http://www.flickr.com/photos/7589554@N02/sets/72157617613438444/

The first tutorial I attended was “Running the Show: Configuration Management with Chef” by Edd Dumbill. Poor Edd had a demo involving talking to machines across a network and it didn’t go well early. Live coding, combined with installing through the internet, and setting up a local intranet was sort of a triple threat. Any one of those is hard to pull off in front of a few hundred people and all three proved too much. We took a break an hour and a half in and the network issues were mostly worked out.

Chef seems to be sort of a very intense Capistrano. What if you wanted to deploy your app to a bare unbuntu install? Or any other bare install. Well Chef can help you write recipes to set up Apache (and it’s config files), Passenger, and any gems you need. The machines you set up (called nodes) will call back in to the Chef server periodically to see if you’ve changed the configuration. If you have they will update themselves automatically.

Next up was “Solving the Riddle of Search: Using Sphinx with Rails” by Pat Allan. Pat started out with a brief overview of Sphinx (a text search engine) and thinking_sphinx (the plugin/gem that integrates sphinx with Rails). Then he showed a little bit of queries and indexing logic. And then the tutorial sort of ground to a halt as everyone tried to install sphinx (which needs to be built from source via make for OSX). There had to be at least an hour of Pat wandering around trying to help people install it. Which was a little frustrating to the people who had read the email from a week ago and had already installed sphinx. Yes, I was one of those frustrated nerds. Anyway, it gave me some time to work on my slides.

And they needed some work! MetricFu has changed a lot since I last gave a talk about it at Ruby Conf. Since then we’ve integrated Flay, Reek, Roodi, and re-written almost the whole gem to support yaml serialization. The metric_fu community has been busy.

Whoops, Pat has started up the tutorial again. We’re using a project located at: http://github.com/freelancing-god/sphinx-tute/tree/master to try out sphinx live.

Good news, my Sphinx install works!

Sphinx does delta index updates – where you update only the changes.

> Place.create :name => “Whatever”
> Place.search “Blank”
=> [Place id: 484, name: “Whatever”, address: nil, city: nil, state: nil, country: nil, lat: nil, lng: nil, description: nil, created_at: “2009-05-04 22:43:15”, updated_at: “2009-05-04 22:43:15”, delta: true]

See how the delta column is true – that guy needs to be updated.

Geo-Searching for models that have Latitude and Longitude is pretty cool:

@places = Place.search :geo => [0.630713104998402, -2.00979852231013],
:order => “@geodist ASC”

@places.each_with_geodist do |result, distance|
#distance is in meters
end

And then Pat said he was done with the tutorial about an hour early. He seems like a nice guy and all but there just wasn’t a lot of content for a 3.5 hour session.

To sum up today’s tutorials I’d say that I’m happy that, as a speaker, I didn’t have to pay for them.