Getting ruby 1.8.7 and newer to compile with readline support on Red Hat Enterprise Linux (RHEL4 and RHEL5) · 4 April 2009, 06:20

Paraphrased from

First, ensure you have the following packages installed:

Then make sure you remove the system ruby and ruby-devel packages, otherwise gems and other extensions might find the wrong version of ruby when they look for compile flags etc:

After unpacking the source for ruby, do the usual:

configure --prefix /usr/local
make all
sudo make install

Now do the following from the ruby source directory:

cd ext/readline
/usr/local/bin/ruby extconf.rb
make install

To ensure that ruby now has readline support, run

/usr/local/bin/ruby -rreadline -e 1

If you get no output (which should be the result), voila, readline support is now active.

— Max Schubert



Getting ruby gem mysql native extension to install on RHEL5 / CentOS 5 · 2 April 2009, 08:04


If you are on a 32-bit platform:

gem install mysql -- --with-mysql-conf=/usr/bin/mysql_config --with-mysql-lib=/usr/lib/mysql

If you are on a 64-bit platform:

gem install mysql -- --with-mysql-conf=/usr/bin/mysql_config --with-mysql-lib=/usr/lib64/mysql

— Max Schubert

Comment [1]


Which rubies do not work with rubygems 1.3.x? · 2 April 2009, 07:28

Anything later than ruby 1.8.7. Spent a few hours learning that lesson:

Thanks to my coworker, Ryan Richins, for pointing me to a version that does work!

— Max Schubert



New perl module: Sys::Syslog::OO · 15 March 2009, 19:19

I just uploaded Sys::Syslog::OO to my Github account and CPAN.
Sys::Syslog::OO is a thin object-oriented wrapper around Sys::Syslog designed to make it easy to integrate Sys::Syslog in object-oriented projects.

Special thanks to my managers Mike Fischer and Jason Livingood at Comcast for allowing me to release my work to the OSS community.

— Max Schubert



New perl module: Schedule::Week · 13 March 2009, 16:07

I just uploaded Schedule::Week to my Github account and CPAN. Schedule::Week lets a developer easily create, manipulate, serialize, and deserialize a weekly hour-by-hour schedule.

Special thanks to my managers Mike Fischer and Jason Livingood at Comcast for allowing me to release my work to the OSS community.

— Max Schubert



Sending email from Perl: Mail::Sendmail · 19 December 2008, 19:33

I always forget which mail-related modules on CPAN are the easiest and most flexible for sending mail from a perl program. Several times now I have gone to CPAN, re-found Mail::Mailer, been enticed by it’s features, downloaded/installed it, and then had troubles getting it to work in ‘smtp’ mode.

I then download Mail::Sendmail and am up and running in minutes. The only feature Mail::Sendmail does not support that would make it the best (in my opinion) of the perl mail modules is SMTP AUTH.

— Max Schubert



CSS is still for Tweakers · 27 September 2008, 13:49

I have been doing a lot of work with CSS lately, and while it is much more enjoyable to work with now than it was 5 years ago, it still sometimes sends me down the tweaker paths that Javascript used to send me down in the late 90s and 2000-2001.

Inheritence with CSS is interesting and confusing to me at times, it is making more sense to me now, but sometimes the relationships between global defaults, element-specific overrides, custom classes and IDs and then built-in element overrides and the combinations of all the above drive me nuts. That is more my problem than CSS though :p.

Cross browser compatibility with CSS is the place that currently tweaks me to no end. While more browsers implement CSS2 well, IE and Mozilla still render things differently, differently enough to send me down the path of 5-6 hours of tweaking to get a layout looking the same on both even if I am doing the bad thing of using absolute layouts to make my layout easier to implement. Spacing between elements, margins, whitespace differences, all aspects of CSS design and web page layout that have to be treated very carefully … or one ends up tweaking all day with very little positive impact.

Javascript libraries like scriptaculous, jQuery, and DOJO are making Javascript almost a no-brainer these days :), hopefully the same will happen with CSS .. I have been referred to some projects that seem to be going in the right direction for this .. 960 Grid is a good example of one.

— Max Schubert



Freezing Ruby Data Structures Recursively · 15 September 2008, 10:18

Flavorrific published a monkey patch that extends Object with a deep freeze method that freezes child arrays and hashes of a data structure so that they aren’t accidentally changed (for example, configuration data from YAML).

I have extended his work in the following ways:

class Object

# Define a deep_freeze method in Object (based on code posted by flavorrific # # that will call freeze on the top-level object instance the method is # called on in as well as any child object instances contained in the # parent. This patch will also raise an IndexError if keys from # ‘deeply frozen’ Hashes or Arrays are accessed that do not exist.

def deep_freeze

# String doesn’t support each if (self.class != String) && (self.respond_to? :each) each { |v| v.deep_freeze if v.respond_to?(:deep_freeze) } end # Deep freeze instance variable values if self.kind_of? Object self.instance_variables.each { |v| iv = self.instance_variable_get(v) iv.deep_freeze self.instance_variable_set(v, iv) } end if self.kind_of? Hash instance_eval(<<EOF) def default(key) raise IndexError, “Frozen hash: key ‘\#{key}’ does not exist!” end EOF end # Prevent user from accessing array elements that do not exist. if self.kind_of? Array instance_eval(<<EOF) def at(index) self.fetch(index) end def [](arg1, arg2 = nil) results = if ! arg2.nil? # Start index and end index given arg1.upto(arg1 + arg2) { |index| results << self.fetch(index) } else if arg1.kind_of? Range # Range passed in arg1.each { |index| results << self.fetch(index) } else results << self.fetch(arg1) end end results end EOF end # Freeze the current structure freeze end


— Max Schubert



Javascript - now with more fun! · 16 August 2008, 11:16

I have been doing some javascript development for web UIs for the first time in years and wow have things changed for the better.

Integrating Javascript into an application is now easier than ever, thanks to the large number of open source Javascript libraries available on the Internet. Each framework I have tried provides a nice, object-oriented API that includes visual effects, event libraries that allow a developer to add events to pages without mixing Javascript and HTML together, and helper routines to make DOM manipulation and parsing very very easy.

Jason Seifer gives a very good talk on separating web UI display and formatting from Javascript functionality. Integrating Javacsript into web UIs in this manner has been given the name “Unobtrusive Javascript.” If you have used any MVC-style frameworks you will easily pick up this technique and it really does separate HTML and Javascript in a very nice way.

The frameworks I have tried out so far are:

I like them all; so far I find the event API (which has been my focus lately) of jQuery and Moo Tools to be the nicest of the five.

All hide browser differences from the user, something that used to make simple tasks take hours and hours to implement properly.

Dojo and Moo Tools allow you to roll your own distribution of their tool from their web sites, which is a neat feature. Unfortunately a number of the Dojo examples would not work on my Firefox 3.0.1 browser, threw javascript errors, this is something I am sure they will fix in the near future.

All of the libraries offer “minified” and compressed versions of their libraries, of the list above I believe Moo Tools comes in at the smallest when uncompressed when downloading their full package.

— Max Schubert



Where do I find documentation for Ruby, Perl, and PHP libraries? · 10 August 2008, 10:54

In this post I give a quick overview and comparision of documentation tools and resources for the three languages I am developing with the most these days: PHP, ruby, and perl. I enjoy developing with all of these languages, but some are easier than others when it comes to documentation.


CPAN – The Comprehensize Perl Archive Network. The vast majority of perl libraries are posted to CPAN. CPAN has a nice web-based search search interface as well as a great command line interface as well (the “cpan” command is a part of most perl distributions, if it is not on your system just type perl -MCPAN -e shell).

All built-in functions are well-documented in POD (Plain Old Documentation) format and available for reading using the perldoc tool. For example, to see the documentation for the open function, just type

perldoc -f open

As much as perl gets bashed for being noisy, confusing, etc, it by far has the best user-contributed documentation of the three languages I am covering in this post and being able to search using namespaces and regular expressions from the command line is a huge win.

Maybe it is because it is so flexible and because it has the potential to be confusing that user-supplied documentation is so well done?


PHP has a terrific set of online manuals for built-in libraries, to read them just enter the URL, for example

to see the documentation for the fopen command. A terrific feature of this web site is that all pages allow for user comments, these comments oftern provide terrific examples and explanations of quirks or hints to be mindful of with a given function. Good stuff.

For 3rd party libraries, things are not quite as nice as CPAN. First check, you might find documentation for the library there, more likely than not you will find a link to the documentation that the developer is hosting elsewhere.

If the PEAR repository fails, use Google.


Finding documentation with Ruby is interesting. For core libraries all documentation can be found online at Core documentation is excellent.

3rd party library documentation is good, but in my opinion much of it is not nearly as comprehensive or easy to find as it is for perl or PHP. Maybe this is because much new development still happens in Asia and the asian developers do not have the time nor interest to port documentation to English (which I can completely understand).

Most ruby libraries are hosted on Unfortunately, as with PHP’s PEAR, most developers do not take the time to extract / post documentation to the documentation section of any of the projects. Some leave links to the sites they have created in the documentation section of the project, some use the rubyforge web site URL, e.g.

To document their projects online. In either case, the documentation seems to be much more complete when it is posted online than when it is installed with the gem. I find that it is usually much easier to use the web-based documentation than it is to try and read it from the command line with ri.

I also find that with Ruby, Google searching is required to find examples and often blogs are the best sources of examples and annotations for libraries. I am very very grateful to the many ruby users who post examples on their blogs, however, it is a litte disappointing to not have a centralized place for this information.

Finally, I find it annoying (and I know, if I do not like it, I should contribute) that the gem tool does not allow an end user to search by namespace .. how the heck am I supposed to know a gem name before I search for the name space? Google, I know :).

Ruby hates the command line for documentation.


— Max Schubert