jlaine.net

Globalize Gotcha

I’m working for the first time on a project that uses the Globalize Rails plugin. It rocks. It’s about as close to an unobtrusive I18N/L10N framework as it gets. I’ve used a couple of approaches before, both self-written and third party, but they don’t get even close to the ease of deployment with Globalize.

There is one gotcha with Globalize, though, which is probably worth sharing: it overwrites Rails code. This isn’t such a surprise since runtime extensibility is one of the founding Ruby principles. It does, however, break the backwards-compatibility.

One specific thing that bit me was that after starting to use Globalize, assert_template didn’t work anymore. Suddenly it started to get the whole path for the template, as opposed to relative from the template root which is the default Rails behaviour. So assertions like

assert_template “admin/books/new”

won’t work anymore. You could of course put the absolute path in your assertion but that would break the portability of the app. I guess it would work with constants like RAILS_ROOT, but using it in every assert_template call would be just plain ugly.

There is a pending patch in Rails Trac to accept regexps as assert_template arguments, which would make the problem go away, but until it gets applied to the trunk, I’ll just comment out the assert_template calls.

Usability Tip: Display the City Name First in a Time Zone Drop-down List

There’s a lot of sites where you have to select your time zone as part of the registration process. The zones are often displayed like this: “(GMT+02:00) Helsinki”. That sucks.

Given that the time zone lists always have dozens of items, it’s really annoying to scroll down to items further down the list. Fortunately, browser makers have been wise enough to implement keyboard navigation for drop-down lists. Therefore, when selecting a country, I can type “fin” and hit enter, and be quite sure Finland is selected.

With the time zone lists like above, I can’t use the keyboard. Or I could, but I would have to type everything until the “H” in “Helsinki” and that would pretty much cancel the benefits of using the keyboard. So if you need to implement time zone lists, do put the city name first and the time zone only after that. Sure, it’s a minor annoyance but they tend to add up.

Usability Tip #2: Use the Label Tag!

Many otherwise great web sites/applications, like Basecamp and IconBuffet, seem to share one very annoying shortcoming: their forms don’t use label elements.

Even if you think accessibility is for documents (which it isn’t), please use labels in your forms. They are not just for blind people.

The big thing for me in using labels is that they effectively make the clickable area of the form element a lot bigger. Which one would you prefer pushing? The male (without label) or the female (with label)?

MALE

(Of course if you use Safari you don’t care because Safari doesn’t support the label element.)

I think using real form labels is a huge usability enhancement in addition to helping accessibility.

For gawd’s sake, using the Rails’ form helpers to construct the form automatically uses labels, so it shouldn’t be too hard for two of the more prominent Rails showcases to use it.

GBAT

First things first: Guy Kawasaki is blogging. I know, I know, old news. But if you haven’t checked his blog yet, do it know. The guy (pun unintended) has made an extensive career as an Apple evangelist and later in the VC world. He also seems to have a talent to write thoughtful and thought-provoking articles day in day out. And he’s got a proofreader for his blog.

But that wasn’t my point today. Guy has created a test called GBAT, which is “a compilation of the best indicators of whether a company is sliding into bozosity”. Electric Pulp has pushed the idea online so you can easily test if now would be a good time to look for a new employer.

I especially like the point number #6:

Your HR department requires an MBA degree for any position; it also requires five to ten years work experience in an industry that is only four years old.

That’s like straight from some of the early announcements for Rails jobs.

BTW, my company scored 2. Well, maybe 1 actually, because the only two points came from the point #26:

Your CEO writes a book.

I’m not a real CEO and I’m just writing a thesis, not a real book (yet), so I refuse to score the whole two points for that question.

Training

I’m writing this in a train (my favorite work place — only the wifi is missing) back from two days of Rails training with the guys from Reforge. As Geoff, I probably learned as much or more during the training as the students. We spent most of the second day writing unit tests and trying out interface and test driven development while coding the most important part of their upcoming application. We even tried out the Rails Selenium plugin, which turned out to be great.

I was very pleasantly surprised by how much the guys appreciated the value of testing in both theory and practice. They’re sure going to succeed with that attitude (and Rails :).

That said, while my rough schedule is pretty much fixed for March already, there’s still some place for short training and consulting gigs. So if you want to get your team a flying start in Rails development, drop me a mail and we’ll arrange a session.

Rails Developers Wanted in Stockholm

My friend Peter just started as the CTO of Adocca, a company building a large community site on Rails. They’re now looking to hire several talented programmers experienced with or willing to learn Rails. So if you’re living in (or willing to move to) the Stockholm region, and want to jump on the Rails bandwagon, read on for the full announcement:


We are building a new major community site with many cutting edge
features using the latest in web technologies. We now need to expand
our staff with several Rails programmers as well as designers and
system administrators.

The project is very ambitious and fast paced and has many talented
people involved. There is a stock option program offered to employees.

Our development is done with Mac OS X and we deploy to Red Hat
Enterprise Linux and MySQL 5.

We are located in a very attractive office at “Muenchen Bryggeriet”
overlooking the water and the old town in central Stockholm.

Required Skills:

  • Experience with HTML, CSS, and JavaScript
  • Experience in object oriented development (for example in
    Java, .NET, or PHP)
  • Proficiency in relational databases and SQL
  • An interest in new web technologies such as AJAX
  • Comfortability working on the command line in a Unix environment
  • Is keen on software quality and believes in simplicity and
    automated testing
  • Strong written and oral communication skills in english
  • A basic understanding of website usability

Desired Skills:

  • Experience with Ruby and/or Ruby on Rails
  • Experience with developing complex high traffic websites
  • Experience with MySQL
  • System administration skills, preferrably with Linux
  • Willingness and ability to write technical documentation
  • Ability to design nice looking and user friendly web pages

If you’re interested, contact Peter (peter_marklund AT fastmail dot fm) and ask for more info.

Rails Recipes Beta Is Out

The second English book about Rails, Rails Recipes is out. Not in print, but in the PragProgs’ excellent beta book format, which means that you can get the beta pdf (+ lifetime updates for the first edition) now and the printed version when it’s ready. Obviously you can also buy just the pdf version. The book consists now of about twenty recipes but will grow to more than 70 during the spring. If Agile Web Development with Rails got you rolling on Rails, the new book will hone your skills to the extreme with proven advice for anything from user interface to continuous integration. Highly recommended!

Woo Hoo! Multicasting With Airport Express Is Here

I’ve somehow missed this: Andy Budd reports that you can now stream your iTunes music to multiple Airport Express stations simultaneously. This means that you can saturate the music needs of your whole home from a single iTunes collection. No more having to decide whether you want the music played from the living room or bedroom speakers. Reeeally nice.