Subject to shill: tech books as corporate marketing

May 9th, 2008

Jem Matzan has a damning article entitled Subject to shill: tech books as corporate marketing in which O’Reilly and Adaptive Path are panned for producing.. well, crap:

The book’s primary content reads like a marketing pitch for Adaptive Path services. It’s packed with enthusiasm but entirely devoid of substance. There are whole paragraphs that meander around non-specific subjects, one leading into another until you’re pretty sure you’ve got the gist of what the authors are trying to say, but you have no idea how to apply it to your business.

It’s too bad that the book comes out as a fairly transparent marketing ploy. Several of my friends and colleagues agree with me in the opinion that the quality of O’Reilly titles has gone down over the past few years. The last book from O’Reilly that I have bought was the Information Architecture book, but that was fairly recent.

I am also reminded of the Adaptive Crap image from 2001.

Amazon Hack: Searching for a Page Number

March 27th, 2008

I’m a huge nerd for books, and Amazon only makes it easier to obsess.

Amazon’s “Search Inside” feature is pretty handy, but once you page through a few pages, you get stuck, so it makes it hard to get a good sample of the book before they cut you off.

More often than not, you can page through the Table of Contents, find a section you want to look for, and then search for that page number.

Amazon search results

Once you page through a few pages, you can search for the page you left off on, until you hit their hard limit of page views for the day.

SVNMate: SVN status icons for TextMate

February 2nd, 2008

Ok, all the kewl kids are using hg or git these days, but I just stumbled across an awesome plugin for TextMate called SVNMate.

One of my biggest problems moving to FT Rails development with TextMate was a lack of status icons that told me what I had modified. Coming from using Eclipse, I felt like my commits were sloppier and I was more prone to break the build due to missing a file checkin.

SVNMate gives you file status icons in your project drawer, so you can tell at a glance what has changed.

SVNMate screenshot

SOLVED: Opening a .DMG file in Finder won’t mount it

January 14th, 2008

Recently, my MacBookPro decided that the only way I was allowed to open .DMG disk image files was by manually starting Disk Utility.app, and opening the DMG file from there.

I finally discovered the solution: Simply do a “Get Info” on any DMG file, and set the default application to DiskImageMounter.app, and your problems will be solved.

Elbow Room, and ez_temp_conversion: a tiny Rails Plugin

January 8th, 2008

It feels good to stretch out.

Also, I committed an almost-worthless plugin for Rails called ez_temp_conversion which allows for basic Fahrenheit-to-Celsius (and vice versa) temperature conversion.

>> 32.f_to_c
=> 0.0
>> 37.c_to_f
=> 98.6

./script/plugin install http://svn.halogenlabs.com/rails_plugins/ez_temp_conversion/

It’s really a dead-simple monkeypatch to Numeric, so it’s not really specific to Rails. It should probably be bundled up as a gem or something, so I will get to that soon.

Why email sucks, redux

October 3rd, 2007

Bruno over at Rails Spikes posted a couple months ago (sheesh I am late to the party) about why email sucks for communication.

I telecommute, and a large portion of my communication with the rest of the company (and our customer) is over email. I hate it. The web development team uses IM (An internal Jabber server, actually), and it works well for daily standup meetings.

So why does email suck? Bruno sees the tip of the iceberg:

Which brings me to an idea my friend Dan exposed me to: the higher the fidelity of your communication, the better chance you have of making yourself understood. Makes sense, right? A phone with a good connection is better than a walkie-talkie with white noise and static. An MP3 with a high bit rate transmits communicates more than one with a low bit rate.

Alistair Cockburn, founder of the “Crystal” development methodologies, summed up this phenomena in an article entitled “Characterizing people as non-linear, first-order components in software development.”

Whaaa?!?!?

What he’s saying is that people aren’t robots (duh), and act different month-to-month, day-to-day, and even minute-to-minute.

The big issue is that there’s a ton of information that isn’t being communicated when you type to someone. Even over the phone, you’re missing subtle gestures that you’d normally pick up when you’re speaking to someone face-to-face in front of a whiteboard.

It’s all about the bandwidth, baby.

PROTIP: Rails + JSON + Flex

October 3rd, 2007

I had problems getting the Flex JSON parser to consume the default Rails JSON output of #to_json, and I managed to find this setting to put in my environment.rb:

ActiveSupport::JSON.unquote_hash_key_identifiers = false

And Flex happily drank down the JSON I fed it :)

Thunderbird’s Tags are Worthless

October 2nd, 2007

One of the big features of Thunderbird 2 was that you could now tag your messages. I was excited, until I tried to use it.

Unfortunately, they’re tags in name only.

In fact, they look and function no differently than the old labels. The only difference it seemed, was that you could create as many as you wanted, and you weren’t limited to 10 of them.

So why aren’t Thunderbird 2’s tags actually tags?

For me, the reason is that they are expensive to create:

Thunderbird tags suck

Tags are nice because they’re lightweight, and inexpensive. They’re cheap. When you use del.icio.us, you don’t have to go through a dialog to add a new tag, you just type it. You’re not prompted if you type a tag that you already used. Indeed, that is the benefit of tags; they’re organic and they align with how your brain works.

Adding tags through a dialog just doesn’t work: it’s slow and expensive.

Feeling Constrained

September 27th, 2007

This layout needs to go. See those links to the right (if you’re reading this on the site)? Worthless.

I know Google loves the link juice. The site’s too narrow.

Ruby: Using Array#assoc to keep ActiveRecords in order

September 9th, 2007

Lately, I’ve had the need to sort ActiveRecords by a certain attribute, but the order is completely arbitrary, and supplied by the user.

Take, for example, the following call to a model in Rails:

input = %w(MN CO TX CA)
State.find_by_state_code(input)

This generates SQL that looks something like:

SELECT * FROM states WHERE state_code IN('MN','CO','TX', 'CA')

state_code
----------
CA
CO
MN
TX

Seemingly random results (actually alphabetized, but still worthless to me), but I have a specific requirement to process the results in the order the user specified (MN CO TX CA).

We can solve this by using Array#assoc to build a simple index of States and their codes:

input = %w(MN CO TX CA) # user-supplied
states = State.find_by_state_code(input)
states.map! { |state| [state.state_code, state] }
# states now looks something like:
# [["CA", #<State state_code="CA">], ["CO", #<State state_code="CO">], ["MN", #<State state_code="MN">], ["TX", #<State state_code="TX">]]

Now we iterate over the user-supplied list, and use assoc to pluck out the state that we want:

input.each { |s| puts states.assoc(s).last.inspect }
#<State state_code="CA" ... >
#<State state_code="CO" ... >
#<State state_code="MN" ... >
#<State state_code="TX" ... >

Previously, I was doing some ugly mumbo-jumbo with creating a hash, but assoc is a much cleaner solution. This also allows me to stick to using the SQL IN() operator, instead of iterating over the user input and doing a single call to the database, which obviously gets expensive.

This sort of reminds me of a Schwartzian Transform, although it’s not exactly the same.