ActiveRecord timestamp Conversions Fail — Sometimes

We recently started to see some timestamp-based tests fail seemingly at random. At first, the usual suspects in the form of time-dependencies were dragged in for a serious round of questioning, but to our surprise none of them were involved.

The bad guy, it turns out, was the microsecond handling in ActiveRecord::ConnectionAdapters::Column#fast_string_to_time and ActiveRecord::ConnectionAdapters::Column#microseconds. It simply fails for some values causing our tests which generated, saved, reloaded and compared timestamps to fail — sometimes.
Read More »

Posted in Rails | Tagged , , , , | 2 Comments

HostbasedAuthentication and net-ssh

A while ago, our Capistrano-based deployment procedure stopped working for some of the developers on the project. Sometimes it would simply “hang” (or at least stall for a very long time before being killed), sometimes it would exit with a Net::SSH::AuthenticationFailed exception when it attempted to connect to the remote servers.

The strange thing was that these developers had no trouble opening ordinary ssh connections to the exact same machines using the exact same remote user name. The problem only seemed to manifest itself when Capistrano was in the driving seat.
Read More »

Posted in Rails | Tagged , , | Leave a comment

A Ruby Time Machine

I use Mac OS X’s Time Machine to back up my MacBook Pro, and it has saved my skin more than once — including one time when I lost the entire disk and had to rebuild a new one from scratch. A while ago I wrote a Ruby script to implement a less ambitious but similar back-up strategy for my FreeBSD servers, allowing me to go back in time for lost email or blog posts. Here is how I did it.
Read More »

Posted in Ruby | Tagged , , | Leave a comment

libxml-ruby problems on Mac OS X

Adding a simple unit test to a Rails application to verify that a generated XML file conforms to the schema it declares should be simple enough. Sure, Ruby and XML used to be an odd couple, but with recent versions of libxml-ruby, the language has gained a nice set of bindings to one of the more popular native XML libraries, libxml2. This library provides access to fast XML parsing, manipulation, and validation. For my test, all I needed was a to read the generated XML file and then validate it against a schema. It really should be just a quick two-liner. And it was. Only — it didn’t quite work as I had hoped for.
Read More »

Posted in Ruby | Tagged , | 4 Comments

RESTful Authentication

I work on a Rails application with a standard HTML interface and a REST interface, both of which are served by the same RESTful controllers. Most of the actions used by these interfaces require some form of authentication and authorization.

Like most web applications, this one takes a traditional session-based authentication approach for the HTML interface: The user is directed to a login form if the session doesn’t indicate that he or she has successfully gone through the authentication procedure, and that login form then allows the user to enter a user name and password to identify him or her self to the system. This approach doesn’t work in the REST case — there simply isn’t any session (or cookies, for that matter) available to hold information between calls. Instead, some form of credentials must be sent along with each call made by the REST clients. There are many ways to accomplish this, including making some form of API key or ticket a mandatory part of all requests. On the server side, these tickets are associated with particular identities and authorizations, allowing the controllers to determine if the call should be allowed to go through or not.
Read More »

Posted in Rails | Tagged , , | 2 Comments

Gem Trouble

I was recently involved in updating a Rails 2.0.2 application to 2.1.1 and part of that task was to update the local Rails installation. So, I naturally tried

sudo gem update rails

which failed with the message

ERROR:  could not find rails locally or in repository

Read More »

Posted in Rails | Tagged , , | Leave a comment

Agile Planning

Whether a project is effectively agile or not has a lot to do with the way in which it is planned. Here are three tips that will help you get there: Avoid spending scarce project resources too early on detailed plans that will change anyway, use re-planning as a tool to manage and actively steer the project, not as a fire extinguisher. Plan in self-contained units-of-functionality that can be reordered or replaced cheaply as the project develops. Read More »

Posted in Agile | Tagged | Leave a comment

RailsConf Europe 2008 – Impressions

Late friday I returned from a week in Berlin, most of which took place at the proArte Maritim Hotel, venue for this years RailsConf Europe. It has been an exciting week with many new impressions and ideas, and a chance to meet fellow Rails geeks.

Read More »

Posted in Rails | Tagged , , | Leave a comment

Agile Development

We develop software using proven Agile development methods. That means better results in less time.

In our experience, beginning with the end in mind is the right way to start. But it won’t take you far enough. To actually get where you need to be, you have to immerse yourself in the journey ahead.

Read More »

Posted in Agile | Leave a comment

See you at RailsConf Europe 2008

I really look forward to going to RailsConf Europe 2008 in Berlin tomorrow. The schedule looks very interesting — and busy!

Posted in Rails | Tagged , | Leave a comment