DCRug Last Night

Source: WikipediaLast night I attended DCRug. It was inspirational to say the least. Chad Fowler, Rich Kilmer and Marcel Molina Jr. tried to help the audience decide what makes code beautiful. They did this by opening up open source code and critiquing it.

I have seen Chad and Rich speak before so I knew what to expect from them, but I was most impressed with the eloquence of Marcel. He has a unique ability to quickly form an opinion, express that opinion so people can understand it and defend that opinion. Not a small feat to say the least.

They started by opening up a piece of Mongrel code. Mostly they didn’t like it because the methods were too long, but in the end Chad pointed out that the code is obviously not a total failure, since it is very widely used (until mod_rails comes out).

They talked about the importance of skinny controllers, the multitude of ruby virtual machines on going, and general ways to both clean up your code and to tell if your code needs cleaning up.

A few comments that I found to be very telling were

  • Comments aren’t testable - Marcel
  • All lines of code in a method should have a similar level of abstraction - Marcel
  • When rails fails to provide you a good place to put code, don’t forget you are writing ruby - Rich

They shot a video of the talk, so if/when I find it I will post it here for posterity.

Ruby EzCrypto Initialization Vector

We use EzCrypto because makes it very easy to store a key in a yaml file. We use different keys in development and production for security (its a breeze).

Unfortunately, it doesn’t have a way to store an explicit IV. You would use and explicit IV if you were sharing a key with a 3rd party that didn’t use the same technology as you. I am not exactly sure how Initialization Vectors (IV) work. It has to do with with how a key is used in encrypting and decrypting data.

So, I duck punched EzCrypto using the Evil Twin pattern, even though EzCrypto isn’t a plugin. Here is what the new yaml file looks like:

---
:created: Sun Mar 16 11:26:59 -0400 2008
:algorithm: des3
:key: SOMESECRETVALUE
:iv: ASECRETVALUEBASEDONTHEKEY

and the evil twin (that I store in a plugin):

EzCrypto::Key.class_eval do
  attr_accessor :iv
  def self.load(filename)
    require 'yaml'
    hash = YAML::load_file(filename)
    req = proc { |k| hash[k] or raise "Missing element #{k} in #{filename}" }
    key = self.new Base64.decode64(req.call(:key)) , :algorithm => req.call(:algorithm)
    key.iv = hash[:iv] if hash[:iv]
    return key
  end

  def iv=(base64_iv)
    @iv = Base64.decode64(base64_iv)
  end
end

EzCrypto::CipherWrapper.class_eval do
  def initialize(key,target,mode,algorithm)
    @cipher = OpenSSL::Cipher::Cipher.new(algorithm)
    if mode
      @cipher.encrypt
    else
      @cipher.decrypt
    end
    @cipher.key=key.raw
    @cipher.iv = key.iv if key.iv
    @cipher.padding=1
    @target=target
    @finished=false
  end
end

Danger Day!

I too love, Ze Frank. That’s why I was pretty excited when I got my invite to Fire Eagle. Also I am, not so secretly, a location based nerd (LBN).

Fire Eagle is a new location service from Yahoo. You tell Fire Eagle where you are, then you authorize other applications to use that information on your behalf. It uses a new standard OAuth, which is awesome. The possibilities are endless. Unfortunately, I can’t think of anything interesting to do with it.

It is probably the fact that my company shares a floor with a marketing company, but the only cool thing I can think of, is coupons for (very) local restaurants and other businesses. But that is lame, and pretty close to spam, even if you ask for it.

Another idea I had was to make a site where people identify themselves as something, like a ruby programmer. Then map the density of groups of people. It would be cool, but not more than a social experiment. If you struck quickly enough, people would be into it. But, in the end it would be just a social experiment and people would get bored after Railsconf (see you there).

Someone will come up with something cool, but I think that the crux of Fire Eagle is getting your location automatically updated. Probably by an application running on your cell phone or laptop. If it isn’t automatic, it is impossible to remember to update it.

I hope someday soon I will be able to Ride the Fire Eagle. Until then, you can find right here.

Five cool things about the iPhone SDK

iPhone SDK logo

  1. Rich - not as in you’re gunna be - but as in you have access to everything.

  2. Core Location - being able to tap into the same “find me” functionality as Google Maps is gunna be killer.

  3. Gestures for Web Apps - it is difficult to say how easy it will be to work with these, but it is exciting.

  4. Fullscreen mode in web apps - make your web app feel like a native app.

  5. It’s Finally Here!

5 things I’m doing instead of attending SXSW

SXSW logo

  1. Speaking in a keynote to my 15mo old about the advantages of microformats and the semantic web.

  2. Attending a roundtable with my lhasa apso about the future of videoblogging

  3. Creating my own Screenburn by watching my dvd of Hackers and drinking Manhattans

  4. Working overtime for my day job to prove Jason Calicanis right. (#11 - pre-update)

  5. Creating my own Mii’s and recreating the geeks who bowl challenge. (my Aaron Mentele is a spot on recreation)

Feeds/Syndication