The Best Music Video of All Time

Posted on June 22, 2007

I’ve always dreamed that someone would make a music video just for me. Imagine my surprise after I woke-up today and learned that the lazyweb had obliged.

Recent Happenings

Posted on June 19, 2007

  • Rachel got a job working at the Catnip and Bones
  • Andy Grimm celebrated his “perfect” birthday today. He then independently discovered that there always exists a prime number between two consecutive squares.
  • My California driver’s license finally arrived. I love the government!!!11!!
  • Bumper sent me a mysterious Rockbuster in the post.
  • jwz introduced everyone to the wonders of Jam

How To Identify Schemers

Posted on June 13, 2007

Stephen Bonds has written a wonderful article on how to identify schemers. You know the type. Schemers view all humans as pawns in their elaborate game of success-money-power. They communicate at you with manipulative rhetoric to be perceived as being “in-charge”. They will mix reality with fiction to cloud your judgment. Your only defense against them is to try to handle them the way that try to handle you. My best advice is to just agree with what they say and do the opposite.

Problems with Ruby’s CAPTCHA gem

Posted on June 11, 2007

Even though gd, gd-devel and the ruby GD and CAPTCHA gems were installed on my Red Hat Enterprise Linux 4 server, Ruby’s CAPTCHA gem seemed to blow-up with the error:

undefined method `StringFT'

Hmmm. I googled around and found that you need a library to bind the GD calls to ruby. This makes perfect sense, but documentation for the issue is scarce.

Eventually, I found the following rpm and installed it.

wget http://ftp.at.gnucash.org/opsys/linux/redhat.com/contrib/libc5/i686/ruby-GD-1.0_97111
rpm -ivh ruby-GD-0.7.4-0vl1.i386.rpm

Unfortunately, the RPM assumed that ruby would be installed under /local, but on RHEL everything is under /usr. So, I found where the RPM stored the library and relocated it to the proper directory.

$ rpm -qpl ruby-GD-0.7.4-0vl1.i386.rpm
/local/lib/site_ruby/1.8/i386-linux/GD.so
sudo mv /local/lib/site_ruby/1.8/i386-linux/GD.so /usr/lib/site_ruby/1.8/i386-linux/

Lo and behold, Ruby’s CAPTCHA gem worked like the clappers after this was sorted. Unfortunately, it took me over an hour to sort out the problem. It would seem that something as mundane as CAPTCHA would have just worked under Rails. The major problem seems to be that the ruby-gd maintainer’s site http://tam.0xfa.com is out of commission.

Under Mac OS X, it’s a bit easier because you can use Darwin Ports to install rb-gd. However, that install appeared to bomb for me because I’m using the latest ruby compiled via the Hivelogic instructions. I attempted to symbolically link the ruby binaries to /opt/local/bin, but that didn’t resolve the issue. I’m still looking for a workaround to this.

Little Feat’s “All That You Dream” on The Sopranos Finale

Posted on June 10, 2007

I was pleased as punch to hear Lowell singing “All That You Dream” on the Sopranos finale. Was it a coincidence that this song appeared on both “The Last Record Album” and on the last Sopranos episode? I felt like it should have been the last song, but David Chase cut to Journey’s “Don’t Stop Believin’” for some reason. This combined with the anticlimactic episode made for a frustrating night indeed.

Iterating Through The Last 30 Days with Ruby on Rails

Posted on June 10, 2007

Recently, I attempted to create a loop in Ruby on Rails that iterated through the last month worth of dates. Stupidly, I just typed in the following code, and tried to run it… (you need to require ActiveSupport for month.ago to work.

# This code does not work
1.month.ago.step(Time.now, 1.day) { |d|
  print d.day,"\\n"
}

Unfortunately, that doesn’t work, because ActiveSupport returns a Time class value for month.ago. Ruby’s Time class doesn’t define a step method. So, being lazy, I just casted the time to an integer with to_i, and constructed the following loop which does work.

1.month.ago.to_i.step(Time.now.to_i,1.day.to_i) { |d|
   print Time.at(d).day,"\\n"
}

Later on, I learned that Date’s have a step class. So, I simplified the loop.

1.month.ago.to_date.step(Time.now.to_date, 1.day) { |d|
    print d.day,"\\n"
}

It seems like there should be an easier way to do this though. Does anyone have a better idea?