Skip to content

Fallen Tree Next Door


Fallen Tree Next Door

Big tree fallen next door.

2494203891_7d0ee86e5a.jpg

Fallen Tree Next Door, originally uploaded by shadr.

We had a bad storm the other night. Lots of damage in the neighborhood.

Barack Obama Pastor Wright

Figured it was only fair to post up what Obama’s Reverend had said that was causing such a raucous. News channels chose to only play small portions of this sermon out of context.

Obama Speech: ‘A More Perfect Union’

This is awesome!

Keith Olbermann: Special Comment on Hillary Clinton

Lessig and the Change Congress movement

2nd video in a row featuring Lawrence Lessig. Looks like he may actually run for Congress on the “Change Congress” platform.

Change Congress
Lessig ’08

Lessig: 20 minutes or so about why I am 4Barack

A great video from Lawrence Lessig about why he supports Barak Obama for president. I have a lot of respect for Lessig and his work in redefining Copyright law. It’s really inspirational.

Rails 2.0 Upgrade Gotchas

In upgrading our product to use Rails 2.0.2, I ran into a number of upgrade issues. I’m documenting them here so that others might benefit.

ActiveRecord attribute methods

It seem that ActiveRecord attribute methods now being defined in method_missing. When method_missing is called, ActiveRecord will define methods for all attributes.  This works differently now than it did before.  In the past, I was able to override an attribute method dynamically.  Now, if I try to do this, it works fine at first, but once reset_column_information is called (which it is often in our system) you’ll see your method get overridden with a default version.

ActiveRecord does not appear to be checking to see if a method exists before overwriting it (it does check the parent classes, but not for dynamic meta-class methods).

To get around this, I overrode a core ActiveRecord::Base method and made sure to check that I wasn’t overriding methods that I need.

modele MyNewEval
  def evaluate_attribute_method(attr_name, method_definition, method_name=attr_name)
    if( self.column_config(attr_name).custom? && method_name['='] )
      # puts "ignoring redefinition of #{method_name}"
    elsif( self.column_config(attr_name).overridden? && !method_name['?'])
      # puts "ignoring redefinition of #{method_name}"
    else
      super
    end
  end
end
ActiveRecord::Base.extend( MyNewEval )

Seems that the Core ActiveRecord shouldn’t override methods that already exist, but that’s really just my opionion.  I’m sure there’s a better way to do this, but I’m not in a position at the moment to spend time figuring it out and this works for me.

Javascript UTF encoding

There are a number of tests where we’re checking javascript responses to make sure they contain certain information. In a few cases, we’re checking for htings that include strings like “somthing & something else”. The problem comes from the fact that in Rails 2.0, javascript strings are encoded a bit differently it seems. Now, we have to look for string like this “something \u0021amp; something else”.

RJS Hash keys quoted

This tripped up a number of our test cases.  What used to be:

{foo: "bar"}

Will now be generated as:

{"foo":"bar"}

@response.headers['Content-Type'] is now @response.headers['type']

Had some trouble getting a couple of tests working and this turned out to be the issue.  If you’re checking to be sure a response is coming back with a specific content type, headers['type'] seems to now contain that information.

Looks like there’s already a method @request.content_type, so you should probably be using that instead accessing the header directly anyway.

request.request_parameters => request.parameters

Looks like request.request_parameters now comes back as an empty hash({}) when it used to contain the controller/action information. Now you can get that from request.parameters instead.

Use is Better

Looking for some used books?  Hate dealing with Amazon?  Check out UsedIsBetter.com.  Run by some close friends that I want to help out if I can :)

Blogged with Flock

Congressman Wexler’s Call for impeachment

After being denied by all major media outlets to run an op-ed calling for impeachment of Cheney, Congressman Wexler is trying to gauge support for impeachment from the American people directly.  So far, more than 110,000 people have signed in a little over 5 days.

The charges are too serious to ignore. There is credible evidence that the Vice President abused the power of his office, and not only brought us into an unneccesary war but violated the civil liberties and privacy of American citizens. It is the constitutional duty of Congress to hold impeachment hearings.

Be sure to sign up!

wexlerwantshearings.com

Some Ron Paul links

Was just home for a little pre-Christmas goodness and it seems that many in my family have never even heard of Ron Paul.  And after pulling in over $6 million in one day (the most by any candidate in history), I thought I would toss out a few links.

Note that this is not a full endorsement of Ron Paul.  I have real with his stance on certain issues.  What I love here is seeing the power that the internet is wielding in his favor.  He’s getting support from tons of voters that traditionally simply do not vote, or have become disenfranchised.

While I may or may not vote for Ron Paul in the election, I do think it’s essential to have voices like his in the debate.  The establishment needs to be sent the message that the people are watching and they’re not happy with what they’re seeing.