Thursday, March 23, 2006

Informix adapter for Ruby on Rails, reloaded

Since my last post about the Informix extension for Ruby, I have been slowly adding features and testing it succesfully with real work at the office (thank you Rafael, Óscar and Andrey), at the point that we are already relying on it, for replacing SQR and ESQL/C (used for reports and batch database processes) with Ruby.

But the point of writing the extension was for having the foundation for an Informix adapter for Ruby on Rails ... for rewriting a legacy payroll application we are suffering from.

It wasn't much difficult to adapt the previous one based on Ruby ODBC to use the native driver. It was even easier to write than the rest of adapters, thanks to some methods implemented in the native driver ad-hoc for the job and to Informix's nobleness.

This adapter is faster than the previous one of course, and relies on less layers of software. I'm still cleaning it up, but you can mail me if you want to try it.

Friday, March 03, 2006

Informix driver for Ruby

I've been very busy at work, solving many legacy problems. One of them is the amount of unmaintainable, undocumented and buggy C programs for accessing an Informix database for generating ... reports. Another one is an insecure and unfriendly application made with an anachronic, unsupported and buggy application builder, with an Informix database as back-end.

I cannot describe enough how awful it looks, and behaves.

But I've always preferred to be part of the solution, not of the problem. It didn't take too much time to come to the conclusion that a web application would fit better, and that a better language for writing reports was needed.

Yes, a lot of work indeed. And not of my business by the way, I'm just "the DBA". But if solving problems is at your hand, why not do it? Besides, it will be fun.

This seemed to me as the opportunity to bridge my favorite language at the moment, Ruby, and Informix. Ruby is a very powerful and versatile language, easy to read and write, among other advantages. It has a Perl-like formats library [FormatR] for reports and a fabulous web development framework [Ruby on Rails].

The problem is there's no adapter for Informix for RoR, not even a native driver. I made a first attempt to write an adapter, using Ruby ODBC, but always missed a native driver for Informix.

Well, I got some time two weeks ago to write the driver, and thanks to the ease of writing Ruby extensions in C, you can find the preliminary results here. It is not complete, but already usable. Testers welcome. I'd like to hear from you either if it did or didn't work for you.

Other uses for binpatch

binpatch was conceived as a mean to create binary patches on one system with the intention of applying them on as many hosts as we need. It has helped me to maintain firewalls that wouldn't be able to patch by source (lack of disk space, CPU power, ...)

However, binpatch was recently being tried by Mike Erdely as a way to create a binary distribution for OpenSSH. With a creative approach, he built a "binary patch" to upgrade OpenSSH to 4.3 on any other server, avoiding the need to build OpenSSH on every system.