February 15, 2009 4:42 pm

I’ve gotten tons of good music over the last year. I’ve gotten into some rap and hip-hop, stuff that I never would have listened to five years ago. It’s strange how I can’t really identify with myself from five or ten years ago. Who was that guy? What did he think about? Why did he do what he did? Is it just the fog of time and a poor memory that causes this, or is it because I’ve changed so much?

If you can’t stomach the highly produced sounds of rap, you might try hip-hop, which has a grittier, less polished sound. More snare drums and live instruments and fewer electronic beats.

February 14, 2009 10:16 am

This is a delicious picture:

Cox + Apple = Fast

It is true that I do not often get to fill my pipe that full. But Apple has always had incredibly fast servers and they are often the only ones who can actually drive my download speed to its limit. I suspect they are using Akamai.

July 30, 2008 10:10 am

Hi everybody! Haven’t seen you in a long time? How are you?

Really? Wow! That’s pretty crazy. Well, you know how life is, eh? Me? I’m great, thanks for asking. Same ol’ same ol’, you know that jazz. I guess my company launched a few weeks ago. Turns out we’re providing destination content on your print-at-home boarding pass. Tomorrow I’m going to meet with another airline to begin on-boarding them. Exciting!

March 6, 2008 11:56 am

So you’re out in Rails-land and you’re trying to start using ActiveResource, since it’s neat. But you’ve got a really gnarly ActiveRecord model on the server side with a whole bunch of associations that you need to send along to the client (or consumer, in other terminology), and somehow you can’t quite figure out the syntax to do it all. You’ve read the Rails documentation for to_xml but that only talks about first-level associations using :include and that’s pretty great, but you’d love to send along that second level association. And the third. And…

As it turns out this is possible, however, it is not really documented in a convenient location. By UTSL, you can find that serializing an ActiveRecord object (either to_xml or to_json) can actually go to an arbitrary depth.

Let’s say you’ve got a model, Employee. This employee has_one :address, and also has_many :managers, Office Space-style. To dump these first level associations, you’ll use :include, like so:

employee.to_xml(:include => [:address, :managers])

Nifty. But the client you’re trying to write is actually an address list, and you’d like to include all of the managers’ addresses as well. The :include option can actually take a hash instead of an array, and this hash is full of all the same options you’d pass to to_xml at the top level.

employee.to_xml(:include => {:address, :managers => {:include => [:address]}})

Awesome, now the managers’ addresses will be serialized along with everything else. Just to demonstrate a few other options, let’s say that though the managers are all pointy-haired, the company has relabeled them as “friends” in an attempt to improve morale. So instead of the list containing a managers group, you want it to contain a friends group. The model is the same though, the managers aren’t really friends, they’re still managers. We’re just relabeling them:

employee.to_xml(:include => {:address => {}, :managers => {:root => 'friends', :include => [:address]}})

It’s worth noting that Rails is smart enough to singularize the root for each of the collection’s elements. So even though we’ve specified “friends” above, each element will be “friend”. This works for odd pluralizations, like “categories” to “category”. Thanks Rails!

There are a ton of other options for serialization, and they’re all pretty neat! This ability to specify options to sub-elements isn’t documented in an easily-accessible location (I couldn’t find it, anyway), and it’s pretty useful. So have fun.

February 13, 2008 1:10 pm

Lemon Lift could reasonably be considered a good tea. I found an unopened box of it in the cupboard in the break room so I decided to commandeer it. The description makes it sound similar to earl grey, but it’s not really similar at all. It’s considerably more zesty. And lemony.

Can't get enough? Check out the bygone ages of my site:
[Age One] - [Age Two] - [Age Three] - [Age Four] - [Age Five] - [Age Six] - [Age Seven]