Migration to Ruby 19 and Passenger 1 comments

Over the past few weeks i have been migrating my production application at work to Ruby 1.9. Overall, this has been a fairly straightforward process. After next week, i will probably have the largest Ruby 1.9 production system out there weighing in at a hefty 25,000 lines of Ruby (excluding views).

We are even running the latest SVN Redmine in Ruby 1.9.1 and Rails 2.3.2. Some slight issues here and there, but it mostly works.

Overall the new system tears ass all over the rack. It’s really quite nice. When i combine the new Ruby enhancements with my acts_as_restricted_subdomain updates, my six application servers could probably push ten times as much traffic as before. There is also a massive data migration that will move all of the data from about fifty different databases into one database. Right now we peak at about eight requests a second, so that’s not too bad. I also will be rolling out AirTruk configuration manager across the network for super easy system maintenance. It’s awesome.

There are some notable differences in Ruby 1.9. For instance, you can’t pass an instance variable as a formal parameter in a block. Some of my old views use instance variables to pass the object around, rather than locals, so that was slightly annoying to fix.

Bad: @services.each do | @service|
Good (Still bad): @services.each do |service| ; @service = service

Multibyte character sequences suck. God help us all with internationalization.

I had to find a branch of the fabulous hoptoad_notifier plugin written by Brandon Schwartz that works with Ruby 1.9. Apparently Net::HTTP doesn’t like symbols as parameters any more. Works with strings, though.

New Ruby dates are a problem. Every date is formatted “dd/mm/yyyy” in Ruby 1.9. This sucks for us Americanos since we tend to format things like “mm/dd/yyyy”. There appears to be no simple method for restoring the heuristic behavior or Ruby 1.8 in this regard. I had to make a monkey patch to let my application recognize ‘more normal’ date structures. Also, when you do a difference of two dates it returns something silly like a Rational. Observe:


>> '5/5/2009'.to_date - '5/1/2009'.to_date
=> (4/1)
>> ('5/5/2009'.to_date - '5/1/2009'.to_date).to_io
=> 4

Redmine has a similar issue in the Roadmap, as well.

Strings are subtly different, as well. You can no longer call to_a on a String or iterate over … something with each. You will have to trap those and convert it to an Array manually. Or do something else altogether now.

FasterCSV does not seem to work with Ruby 1.9, so you will have to use the standard CSV gem. It works almost exactly the same except that a lot of the classes like CSV::Writer have been removed, so where you used to: CSV::Writer.generate you now just CSV.generate.

New Moblin 2 Beta 1 comments

So i’m using the new Moblin 2.0 Beta. This is seriously pretty sweet looking… The only caveats are that the wireless is completely unsupported in the Mini9. Totally. You’ll have to use ndiswrapper and that will require the kernel source and that will require building a new image, most likely.

The wired support also seems… limited. I had to manually run the dhcp script for the interface and update the /etc/resolv.conf myself. Other than that, though, it’s quite pretty. It has a terminal natively, too.

RailsConf 2009 Postmortem

Another RailsConf has come and gone. Interestingly enough, i felt there was a bit missing in Vegas. It was neat to go to Las Vegas; i have never been. I think it’s probably safe to assume that i don’t need to go back any time soon, either. The Hilton is an okay place to be, it’s not very crowded… But man the food sucks that they were giving out. Also, $9 mixed drinks and $7 bottles of Sierra Nevada or Samuel Adams Boston Lager doesn’t fly for long.

This year, i would say that i have met more people and attended fewer sessions of consequence than ever before. I met one of the guys behind RSpec, Dave Astels, and had several at length conversations with him. I met the guy who runs RailsBrain, I met two of the guys behind ActiveScaffold. Two of my friends from previous conferences have written books: Lance Carlson and Mike Sullivan. I met Tammer (sp?) from ThoughtBot. Bunches of people, this year. I guess that’s the good thing about only okay sessions: lots of time to network.

I got a couple awesome Engine Yard stickers, so if either of you local railsers want a Hack Pack sticker, get it touch with me. I (almost) won a EY branded poker chip set, but i didn’t hear my name get called. Tom came up just after that, and was like “dude! i just called your name out!” Oh well, i say.

I have some nice pictures from around Vegas posted. Check them out.

RailsConf 2009 Day One And A Half

Greets from Las Vegas. I arrived mostly unscathed last night and hit the bar in the hotel with some of the EngineYard crew. I hit the strip with Greg and Jordan, CabooseConf for early hacking and probably some sweet steak for dinner tonight. I met the guy (Ben) behind RailsBrain earlier today. Ez and Technoweenie are here at Caboose … right now and stuff.

This conference part of the building is quite different from the Oregon Convention Center so far. I think i like all of the windows in the OCC a lot. And that Mt. Hood is right over there (_points_).

distrust 1 comments

Always distrust a cellular telephone without a rmovable battery. Mine just took a vacation for an hour. With a completely black screen. No buttons, vibrations, and a full battery charge.