Mike Perham

On Ruby, software and the Internet

Entries Tagged as 'Ruby'

Rails Bootup

June 30th, 2008 · No Comments

Damon Clinkscales, of Austin on Rails fame, has created a one-day workshop to take your Rails skills from 0-60 in 8 hours. While this might be abysmally slow for a car, it’s a rocket sled for software engineering! I’ll be there, teaching about ActiveRecord and how to bend the database to your will. [...]

[Read more →]

Tags: Rails · Ruby

Starling and a reliable Memcached client

May 29th, 2008 · 4 Comments

We moved part of our FiveRuns Manage infrastructure to use Starling this week. I’m rapidly becoming a convert as it has proven to be simple, fast and reliable. The Starling 0.9.3 release is somewhat long in the tooth but GitHub has several Starling forks which contain performance improvements and bugfixes, including our own [...]

[Read more →]

Tags: Ruby

Ruby Scoping Oddity

May 22nd, 2008 · 1 Comment

This prints out “1″:

begin
a = 1
raise RuntimeError, “foo”
rescue => e
puts a
end

I would think that a would be out of scope inside the rescue section but I guess Ruby considers the rescue section part of the begin/end block?

[Read more →]

Tags: Ruby · Software

DataMapper projects

May 10th, 2008 · No Comments

As someone who was pretty closely involved in an OSS project that exploded into hundreds of little subprojects, I have to say I’m discouraged to see DataMapper and Merb starting to go down that same road.

drwxr-xr-x 3 102 May 10 15:16 adapters
drwxr-xr-x 8 272 May 10 15:16 dm-aggregates
drwxr-xr-x 8 272 May 10 [...]

[Read more →]

Tags: Ruby

Ruby, Threads and Exit Codes

May 6th, 2008 · 2 Comments

A question for you Ruby nerds: the $? variable gives access to the exit code for the last process launched by Ruby. Is referencing $? a race condition in a system with many threads launching many subprocesses? If it is truly a global variable, then it’s inherently unsafe, but it could also be [...]

[Read more →]

Tags: Ruby

Syntactic Sugar

April 25th, 2008 · 2 Comments

There’s only one thing I miss in Java that Ruby doesn’t have:

String[] list = {
“Foo”,
“Bar”,
“Blaz”,
}

Note the last trailing comma. This is a syntax error in Ruby but legal in Java. If you add another element later, you don’t need to remember to add a comma to the previous entry. Minor, sure, but [...]

[Read more →]

Tags: Java · Ruby

Introspecting RESTful APIs

April 15th, 2008 · No Comments

I integrated the Youtube REST API into my pet project in about thirty minutes tonight.  It’s amazing how far the Internet has come in providing solid, useful services.  The QuartzRuby guys have published active_youtube, a simple ActiveResource wrapper to make integration with your Rails application easy.  The problem is really one of documentation: aside from [...]

[Read more →]

Tags: Ruby

Expression Rescue is Evil

April 1st, 2008 · 2 Comments

One of the cleaner syntax options Ruby gives you is what I call expression rescues.  Take this:

<%= @item.parent.name rescue ‘None’ %>

This code is an example of a pretty standard requirement: printing out the name of the parent of an item. If the item does not have a parent, it will print ‘None’. Under [...]

[Read more →]

Tags: Ruby

Ruby, Rails and XFDL

March 5th, 2008 · No Comments

Brian writes:
My open-source web application will need to submit information to a URL in IBM xfdl format.  Is this possible with currently available tools?
In a word, absolutely.  There’s no XFDL “native” support that I know of but I’m guessing that XFDL is just another XML standard.  In this case, Ruby can create arbitrary XML with [...]

[Read more →]

Tags: Ruby

Death, Doom and Daemons!

February 25th, 2008 · No Comments

We’re actually starting to run the new FiveRuns service daemons internally and found that they were dying due to various issues so I integrated a little bit of ActionMailer code to email the dev team when a daemon dies with the relevant details.  Below is what I did - do you have any tips for [...]

[Read more →]

Tags: Ruby