Category Archives: Ruby

Tab completion and history with irb and script/console

One thing I love about Ruby (and really miss when working in Java) is its interactive command line interpreter irb (or script/console if you’re using Rails). I really wish irb had tab completion and saved history configured by default out … Continue reading

Posted in Java, Ruby, Software Engineering | 3 Comments

Instantiating and populating a list or collection

In Java it always irks me when I have to create a collection and then populate it in separate steps as follows: List states = new ArrayList(); state.add(State.CA); state.add(State.WY); Then today I read about using an anonymous subclass with instance … Continue reading

Posted in Java, Ruby, Software Engineering | 12 Comments

Making your Rails app mobile with WAP and WML

I’d been wanting to make my Ruby on Rails based San Francisco Sailing Weather site available for mobile / cell phones. Now that I’m on vacation in Germany I had a stretch on a train ride where I was able … Continue reading

Posted in Ruby, Ruby on Rails, Software Engineering, WAP and WML | 6 Comments

Implementing CRUD HTTP style

I’m amazed by how often DHH can keep coming up with newer, simpler, and more elegant approaches to web development that really make you think. In his recent blog entry/keynote he discusses using HTTP’s PUT and DELETE methods to more … Continue reading

Posted in Ruby, Web | 1 Comment

June San Francisco Ruby Meetup

I attended the June 12th, 2006 San Francisco Ruby Meetup at CNet which was my first. There was quite a turnout, I’d guess maybe 80-90 people. The presentations focused more on process and lessons rather than in-depth technical sessions. Here … Continue reading

Posted in Ruby, Software Engineering | 3 Comments

Configuring MySQL sql-mode in Ruby on Rails

In my previous post I wrote about setting MySQL to a stricter sql-mode to make it behave like most other databases, however, I recently ran into a case where I couldn’t set the global sql-mode without breaking some legacy applications. … Continue reading

Posted in MySQL, Ruby, Software Engineering | 1 Comment

Modeling enumerated types in the database

Let’s say you have an Employees table and you want a column to track the status of an employee such as [’employed’, ‘resigned’, ‘retired’, ‘terminated’, etc…]. You have a couple of options including: Using your database’s custom enumeration data-type if … Continue reading

Posted in Database, Ruby, Software Engineering | 3 Comments

Running Ruby on Rails with Apache 2 and mod_fcgid

My hosted Linux server runs Debian Sarge 3.1 with Apache 2. As most Ruby users have heard Apache 2 is rumored to be problematic with FastCGI. This evening I’ve been working on putting up a new Ruby on Rails site … Continue reading

Posted in Ruby, Systems Administration | Comments Off on Running Ruby on Rails with Apache 2 and mod_fcgid

Avoid hard-coding the path to the interpreter in your scripts

In general when trying to write portable scripts don’t start them with #!/bin/bash , instead start them with #!/usr/bin/env bash . The only caveat is that you DO NOT want to do this for critical security scripts because it opens … Continue reading

Posted in Ruby, Systems Administration | 4 Comments

Creating database test fixtures and the rails export fixtures plugin

Being able to quickly and easily create test fixtures for your database is important yet it’s not always easy. There are basically 3 approaches I’ve seen used: 1. Use a MySQL or PostgreSQL dump that gets imported before the tests … Continue reading

Posted in Database, Java, MySQL, Ruby, Software Engineering | 3 Comments