Monthly Archives: November 2008

Since Timeout::Error is not a subclass of StandardError, you’ll need to do something like this to catch the exception:

  rescue StandardError, Timeout::Error => e

Not too much fun, but it certainly didn’t make me as angry as the guy I linked to above ;-)

Another Merb breakage after upgrading. Thanks to some Japanese guy I figured how to solve this one. You’ll need the addressable gem in version 1.0.4 and to add this to your dependecies.rb:

dependency "addressable", '1.0.4', :require_as => 'uri'

before the dm-core dependency.

See this pastie; I just ran into this issue. Good I knew about the problem already from worrying but interesting David Majda’s presentation.

I think one of the greatest contributions of the Merb guys is spreading the message that Ruby is not slow. Even Rails is faster than most mainstream PHP frameworks. Wow.

(I looked up the research they refer to to see if they don’t cheat by comparing Rails and Merb to CakePHP. They don’t, it is the fastest PHP framework from the sample group.

[UPDATE: Nope, was wrong; please read the comments.])

Not caring about warnings is bad. Broken windows do matter. Here’s how to avoid this one:

 warning: already initialized constant C

Simply define the constant only if not yet defined:

C = 'value' unless defined?(C)

Duck typing is like sharp knives: You do need protect yourself. If you don’t, you end up with this:

function propagate_artist(element) {
    element = $(element);

instead of this:

function propagate_artist(element_id) {
    element = $(element_id);

Too subtle for you? Can I please not work with you then?

You might have the same problem I had with using daemonize (might be with anything else, too): File.dirname(__FILE__) doesn’t work after right daemonizing.

Although I haven’t been able to catch the exception message or whatever info, I’m almost sure the problem is that daemonize does a Dir.chdir “/”. Try run this script from a file in any directory and it will always print “/”:

Dir.chdir "/"
puts File.expand_path(File.dirname(__FILE__))

Anyway, save the path to the directory before daemonizing and you’ll be fine.