Lately I’ve been working on mailing out wedding invitations. The easiest way to print address labels on OS X is to select contacts or a group in Address Book, hit print and change the Page option to “Avery Standard” then select the label type. Easy. The hard part is getting all those addresses in there in the first place and then organizing them. My problem was that I imported things incorrectly a number of times and filled my address book with 1500 or so broken contacts. That made it really hard to call someone because I had 15 very similar looking entries for each person. Fortunately all the addresses I imported were missing phone numbers, so I knew I could group them together easily (with a smart group) but how could I script the name edits like “Add ‘& Guest’ if the name doesn’t include an &”? Not to mention I didn’t want to end up with contacts like “Joe Smith” next to one named “Joe Smith & Guest”!
First I tried to do this with AppleScript and 25 minutes into it had something working, but working with AppleScript is so strange, I needed ruby! In 10 minutes I had the following script written and now I could also use ruby to push/pull/stretch and tweak all the data I have in Address Book already, yay.
I gave a talk at Seattle Code Camp on testing Javascript about TDD (test driven development) in Javascript using jsunit, JSSpec and Screw.Unit. One thing to come out of this is a github project that is setup to allow you to test your javascript against all three frameworks in one package:
The presentation was a walk through the code, so there aren’t slides yet, contact me if you’re interested in having me present at your company or to your group.
Many thanks to Nick Kallen for Screw.Unit and other various Javascript hackery. Brian Takita for JSSpec/Screw.Unit servers , Edward Hieatt for JsUnit and the blog posts about testing javascript. Finally, I want to thank all all the people at Pivotal Labs for the countless hours of pair programing that led to me learning these libraries and testing techniques.
For the next month I will be free to wander around aimlessly. If you’ve been wanting to hang out with me for any reason, the time is now. Call me at +1 206.240.4233 to get my attention, I might be available. I might be more available if you offer any of the following:
Breakfast
Private Suites at Safeco for Mariners games
Sushi
Coffee/beer/tea and an interesting topic
Free stuff (llamas and ponies not accepted at this time)
Speaking engagements wherein I may ramble aimlessly
Let us see how this works out in practice. Let us say that I have five
things which have to be done before the end of the week: (1) a basketful of
letters to be answered, some of them dating from October, 1928 (2) some
bookshelves to be put up and arranged with books (3) a hair-cut to get (4) a
pile of scientific magazines to go through and clip (I am collecting all
references to tropical fish that I can find, with the idea of someday buying
myself one) and (5) an article to write for this paper.
Now. With these five tasks staring me in the face on Monday morning, it is
little wonder that I go right back to bed as soon as I have had breakfast,
in order to store up health and strength for the almost superhuman
expenditure of energy that is to come. Mens sana in corpore sano is my
motto.
Eventual consistency. The storage system guarantees that if no new updates are made to the object eventually (after the inconsistency window closes) all accesses will return the last updated value.
My coworker wrote up our experience writing ruby integration tests against Amazon SimpleDB. You should know that we were in an integration test that runs infrequently. Production code should not use this retry method. You should be using exponential back off when you get an error code. I’ve heard that not doing this is the equivalent of crossing-the-streams in Ghost Busters.
Here are some must have bash PS1 commands if you’re working in multiple branches with various SCMs like git, svn or bzr. With this in your .bash_profile you’ll end up getting the following PS1