Saturday, September 29, 2007

Struts and JSF Creator is a Rails advocate now!

Most people who have worked with me are familiar with my distain for Struts (though it had provided a paycheck for many years) and my fanatical love for Rails. It seems that Creig McClanahan, the creator of Struts is now in agreement. The money quote from David, posting about Craig's talk at RailsConf Europe 2k7, "He even went as far as to say that developing web applications in Java after working with Rails would probably not be a particularly pleasant experience for him.".

This from David Heinemeier Hansson, the creator of Ruby on Rails.

The biggest surprise at RailsConf Europe 2007 was hearing Craig McClanahan from Sun speak. Craig is the creator of Struts, the original blockbuster web framework for Java, and more recently Java Server Faces. Not exactly an obvious advocate for Ruby on Rails, but he sure played the part well.

And not just on a superficial level because Sun was a diamond sponsor of the conference, but from months of experience developing Rails applications using the latest techniques and frameworks (like pushing the envelope with Active Resource). He even went as far as to say that developing web applications in Java after working with Rails would probably not be a particularly pleasant experience for him. Wow.

See more from David's blog


Tuesday, August 14, 2007

ri in irb

The shortest route to accessing ri from you irb session.

add the following to your .irbrc file

def ri(str); y `ri #{str}`;end

This is all that I require, but for more (much more), see

Friday, July 20, 2007

has_one :through

Rails is missing the capability to have a has_one association via a link table. I created this implementation that adds methods to add basic "has_one" support through a habtm association.

The following method defines a new type of association that is currently
missing in rails. There is currently no way to have a
has_one association when a join table is used.

This association requires that a has_and_belongs_to_many
association exists and adds methods to access the first
element of the resulting array.

Example: Enrollments have one registration, but is
modeled through the enrollments_registrations join table.
There is already a "has_and_belongs_to_many :registrations"
and the following operations are added
(and perform as expected):

  • enrollment.registration => enrollments.registrations.first

  • enrollment.registration_id =>

  • enrollment.registration= will set the assocation, erasing any existing registration.
    This method will take an id or a registration object

  • enrollment.registration_id= like registration=, but takes an id

  • enrollment.has_registration? => true or false as the case may be

def self.has_one_through_join_table(class_name)
class_name = class_name.to_s
has_many_association_name = class_name.pluralize

# def registration
define_method(class_name) do

#def registration_id
define_method(class_name+"_id") do
send(class_name) ? send(class_name).id : nil

# def registration=(id_or_object)
define_method(class_name+"=") do |id_or_object|
clazz = eval(class_name.classify)
# the has_and_belong_to_many association (i.e. registrations)
habtm = send(class_name.pluralize)

if id_or_object.nil?

id_or_object = clazz.find(id_or_object) unless
if id_or_object
habtm.clear # can only have one object
habtm << id_or_object

#def registration_id=(id)
define_method(class_name+"_id=") do |id|
send(class_name+"=", id)

# def has_registration?
define_method("has_#{class_name}?") do
! send(class_name).nil?

end # has_many_through_join_table

Wednesday, November 08, 2006

"The cheering can be heard not just in America itself but around the planet."

Sunday, October 29, 2006

My Boy!

, originally uploaded by bethhaught.

Beth keeps the photostream of Bran at her flickr site

Mom & Dad (last day at the hospital)

Bran and Sleapytime Bear

Originally uploaded by bethhaught.

Wednesday, July 05, 2006

A Great Patent Strategy

Via reddit..

... Another instance of the “disappearing polymorph” may be the anti-depressant, Paxil (U.S. brand name for the chemical paroxetine hydrochloride). No, self-replicating Paxil doesn’t naturally spread into our brains and make people happy for free. It's not "happy goo." On the contrary, self-replicating Paxil converted, according to one of the parties in the ensuing lawsuit, an old, and now off-patent, form of Paxil into a new, patented form of Paxil. Once the new form, the hemihydrate form of Paxil, was created, its crystals started floating about, converting small fractions of the old form, anhydrous Paxil, into hemihydrate. Both forms of the drug work equally well as an anti-depressant, but it became impossible to manufacture the off-patent anhydrate without some of it being converted into the patented form. Call it "patent goo."

Unenumerated: Patent goo: self-replicating Paxil

Wednesday, May 03, 2006

Tim Berners-Lee on Net Neutrality

The Internet is increasingly becoming the dominant medium binding us. The neutral communications medium is essential to our society. It is the basis of a fair competitive market economy. It is the basis of democracy, by which a community should decide what to do. It is the basis of science, by which humankind should decide what is true.

Let us protect the neutrality of the net.

Neutrality of the Net