Tim Hatch

Weblog | Photos | Projects | Panoramas | About

iTMS Parser 1.02 30 Jun, 2005

A few days ago, Apple began encrypting responses to video searches on iTunes, which (of course) broke the iTMS Parser. After a few minutes of googling, and a bit of playing with php (why doesn’t base_convert accept 256 as a base?), I came up with a fix. I don’t 100% understand how the key is actually generated, but rather than hardcode what the key is at this moment, I have it using the x-apple-twofish header and ported Crypt::AppleTwoFish from perl.

The svn repo is now at http://svn.timhatch.com/repo/lab/trunk/itms_parser/, and you can download the new package at itms_parser_1.0c.zip if you would rather.

The license terms are still the same, with the exception of the ported Crypt::AppleTwoFish that kind of confuses me.

Note that this now uses mcrypt, and as such, Windows users will need to download libmcrypt.dll from somewhere.

Some information helpful in the fix was from itms4all, itms_client, and the php manual (though it wasn’t too helpful because it’s very sparse on mcrypt!).

Freshman Activities Mart 27 Jun, 2005

I got a call this afternoon from Kate (well, more of a tap on the shoulder, being as she was about two feet away) to help out tonight at the UNT Freshman Activities Mart (I approve of the name) at the table for NTAUG. Generally, the freshmen are about the same way I was when I went through the same mart (“So, what do you offer?” / “What can I do at your group?”) but being somewhat tied with a hardware company, many people thought we were either there selling things or had an iPod to raffle off.

In between chuckles, we kept reiterating “no there is not an iPod you can win, but you can come to the meetings! or get a free door hanger!” “Door hanger,” my foot — I’m sure there’s a better term for it, probably something in French.

Next time we need a banner behind the booth: “North Texas Apple Users Group: A Group For People Who Own Or Are Thinking About Owning Or Possibly Think Their Parents Might Buy Them An Apple, iPod, Or Something Else.” I think we could make that fit.

A close second for the sign would be “NTAUG: We’re in touch with reality and realize that UNT is not A&M nor UT. That’s why you should join.” They’re drilling all sorts of “school spirit” stuff into these kids’ heads, even though none of us who have been here a couple of years have ever seen any.

I think it was Kasey’s mom who said, “Nobody ever smiles here.” That’s very true — everyone just walks along their path and either looks straight ahead or down at the ground. If you simply say “hi,” as I tried earlier today, it freaks people out. They’re almost giddy, thinking “Someone spoke to me! one of the natives!” I deluded some poor parents today into thinking people on this campus are friendly. Oops.

I Need a Vacation 27 Jun, 2005

“Tim, you really need a vacation.”

— Left on my facebook wall by LA

She’s right. I’ve been in Denton all summer plodding away on some projects (both at work, and at home trying to teach myself hiragana) but it’s getting monotonous on both fronts. QuakeCon is coming up in mid-August which will be a short reprieve, but the fall semester is already looming. Not helping the situation is that I lost the partition table and boot sector from my OS drive at home a week ago Saturday. I’ve had to rebuild what was on that drive (including the subversion repos) from various backups kept on dvd of working copies, but missing the version history.

My solution for this is to tar-bzip the repo every night using hot backup, and mail this as an attachment (along with httpd.conf and some other essential files) to an account at gmail. At the rate they're increasing storage (and with my current data size), it will take something like 50 years before I begin to run out of space. At that point, I can start deleting the old backups.

Review: The Art of Project Management 12 Jun, 2005

I was about to order this book (The Art of Project Management) last week for the office when I was offered a review copy from O’Reilly. Therefore, I feel the disclaimer that the book was given to me should apply. I think the review remains unbiased, but I want to have that out in the open just in case.

The first thought I had opening the package was that although this is an O’Reilly book, there is no animal on the front. I suppose putting an animal on every book would dilute their recognition (e.g. hawk vs raven) but I would have much preferred being able to tell people to read “The muskrat book” rather than “The gray and white book with a pair of shoes hanging from a telephone line.” I suppose there’s a reason for this choice, but I don’t know what it is (maybe only books about programming languages have animals?).

Who is it for?

I read the book from the perspective of a small team member, not really a manager in title, but certainly a tiebreaker when it comes to decisions. My boss owns 51% of the voting stock, and I wanted to end up with a book he could benefit from too. The book is very broad, and I think it would be reasonably useful for people involved in any team project situation, whether they’re a manager or a player.

However, toward this goal, it’s a bit overly broad. I’m a fan of small books which can be read in an afternoon, like Don’t Make Me Think and Defensive Design for the Web, because they don’t require conscious blocking of time to read, and are well-organized for picking up again later. For someone with a function like mine — the programmer trying to be a better follower and gain some managerial advice at the same time, I’d rather it be pared down a bit.

Overall feel

The type is a little small and difficult to read in a moving vehicle. I don’t specifically recognize the font, but the words flow together after a while. I don’t think it was designed for reading on the go.

I love the diagrams. They all have a hand-drawn feel to them, but have just enough “fun” to them that I enjoy reading them. Quotes are plentiful, but a bit awkward (I believe) since the book can’t decide whether it’s for managers or peons. This book is not about Getting Things Done and it’s not about processes to become more effective. It’s much more about experiences of what worked and what didn’t. I expect to refer back to it a lot, but it’s a lot of information to finish at once.


If there was a special edition with only chapters 5 (Where Ideas Come From), 6 (What to Do With Ideas Once You Have Them), 13 (How to Make Things Happen), and perhaps 15 (End-Game Strategy), I would wholeheartedly recommend that edition to everyone. As it sits, it’s a bit wordy and more story/scenario-based than targeting specific things which can be worked on (alá GTD).

If you like a book to read in pieces over a period of time and want to keep it at the library in your office, this is a pretty interesting book. However, if you’re like me and contiguous blocks of time are hard to come by when you’re not in a moving vehicle, pass on this one.

I’m going to see what my boss has to say about how it appeals to him and edit this entry as appropriate, so we can see how it speaks to members on opposite sides of the managing fence.

This Week in Review 11 Jun, 2005

I like sitting on items for a bit to see if they’re still of interest before I subject others to their randomness. It does a good job of keeping things in check although sometimes it does ruin the effect that an immediate posting would have.


Had to boot into Windows, eww. My desktop (the dualie) has been stable on Gentoo for the last several weeks and I really dread using Windows again. I have to use it at the office, and miss having a “real” shell when I’m using it. The zsh port from unxutils is passable for most cases but I have to consciously remember that I can’t use paths with trailing slashes because it doesn’t grok them. I’ve got my FAT32 Windows XP install (thanks to a Knoppix boot cd since WinXP doesn’t let you pick FAT32 when formatting a disk) mounted via an internal USB adapter under Linux, so all my photos, etc on it are still accessible.

Went to Bagheri’s (a really informal Italian place) for lunch with Cameron and my dad. Heard the Apple announcement on the television and was in shock. The proprietor even turned it up for us (it wasn’t really busy) and lunch discussion turned into a lot of “Has Apple betrayed us?”-type questions.


Still in shock. Realized that I’m secretly jealous of the reported performance of the P4-based OS X. I want one.


While discussing Apple’s switch at 10pm (notice a pattern here?), realized I hadn’t eaten yet. Called up Cameron and L.A. and grabbed a pizza (Hawaiian, of course). Observed that Kroger is really a nice place to shop when there are no people in it.


Spec’d a new news system at the office (screenshot and design logs coming soon) which is vastly superior to the old one. The “old one” was implemented at a time we were switching OS platforms for our webserver and didn’t want to rely on any specific database (e.g. BDB/mysql), so rolled our own psuedo-database using var_export and a bit of custom code for caching/grouping of items.

We’re working on a loose taxonomy based on a tag system, rather than a rigid system with a predetermined set of categories. Tags will allow us to specify multiple categories much more like metadata to go with an item rather than making it multi-homed (“existing” in multiple places). Tags allow us to handle it much more like a search than a directory index.


Got data imported from previous news system at the office (it wasn’t badly designed, just inflexible), and the basic browser is now about three times as usable as it was before. To measure this, we counted the number of times someone could get “stuck” while trying to use the system. The old one (being file-based) would not allow the movement of a news item from one month to another, but in the new one, it’s just a field (conveniently indexed, and editable by the user) which determines the “location” of an item in time.

Had to deal with disambiguation of peoples’ names since I refuse to allow arbirary numbers (the uid) to appear in urls. We’ll be allowing people to be represented by tags. We’ve tentatively settled on a system somewhat like IMDB and refer to people as john-smith-1 (john-smith would give a disambiguation page, i.e. a wildcard tag search for john-smith-*).

We’ll probably end up with another table just for this purpose, partially because it’s really a lookup, and partially because it’s not a 1-to-1 mapping — say someone’s last name changes or people know someone by a nickname rather than their given name. We’ll end up with forwarding to the “primary” tag no matter what the tag they visit. This will probably end up being a rediculously long sql query, but thank goodness I’ll only have to write it once.

I mentioned a glitch I was observing in the Firefox nightlies… someone reported it on my behalf over lunch and I’d verified it a problem with the HTML Validator Based on Tidy rather than one in firefox-trunk before evening. Oops. Moral of this story? Let other people make rash decisions and report your notabugs for you.

Weird Emails - Related? 09 Jun, 2005

These arrived in the same minute, and were basically all I received all day.

Apple Moving to x86 07 Jun, 2005

Most of the people I know, know I have a Mac. I like my Mac — it’s done me well. When my desktop goes down for one reason or another, I just plug my speakers into an extension cable and my external hard drive via firewire into my mac and I keep on truckin’. I’m not to the “fanatic” stage but I want my investment to continue to be relevant.

When Apple announced they would be going to Intel x86 chips, I was in shock. I (and others here) surely thought that they would simply get Intel to fab PPC chips, and that would be the end of it. When they said they really are moving to x86, I thought it sounded a lot like the April Fools’ Day announcements that Google has made the past coupld of years — the kind you have a good laugh at and then wake up the next morning and it’s still there. I wanted this to be a dream.

In the end, it’s not. I imagine that even making the binary run on an x86 architecture, natively, will be a bad thing, at least for those of us who already own Macs.

Traditionally, OS-X and its associated apps (iLife, etc) haven’t required any sort of cd key — they assume if you’ve got Apple hardware, you can go ahead and run it because piracy would be somewhat limited. iWork changed this with its release and now has a cd key. I can only surmise then, that OS 10.5 will also have a similar sort of protection, now that it will become orders of magnitudes easier to run OS-X on Windows PCs. The very concept (call it eliteism) of owning a Mac now means nothing, if you can run the OS better on another platform. They just devalued my investment in the blink of an eye. Instead of only those who are “ready to embrace the OS” trying it, we’ll have lots of people who aren’t so enamored with it.

Take virus writers, for example. Any person who sinks two grand on a computer and realizes how nice the interface is, is not going to trash it by writing a worm. As my mother says, “programmers should use their power for good.” I think this holds true on the Mac. Anyone who can figure out how to write code on it isn’t going to vandalize it.

I predict more and more keys being required to run Apple software, someone figuring out how to run OS-X on Windows alá coLinux, someone porting WINE to run (without X11, I hope), a Mac virus that can store both PPC and x86 virus code in the same binary, and (this is the big one) Apple eventually denying people updates if they use shared cd keys or “hacked” versions of OS-X. When that happens, I will have a good cackle, and there’s nothing you can do to stop me.

I’m going to work now, and hoping this is all some sort of sick joke

Helpful Function in zsh 03 Jun, 2005

Try this in your .zshrc. CRLF->LF and tabs->spaces at 4.

standardize() {
    tr -d "\r" < $1 | expand -t 4 -i - > $1.temp
    mv -fu $1.temp $1

Google Sitemap 03 Jun, 2005

Initially, I thought “wow, they’re running graphviz on their static copy of your site,” but of course that was too good to be true. Instead, they’re allowing you to ping them with an xml file that contains urls they are advised to index.


Then I started reading the FAQ, and found out that they don’t restrict you to just their custom xml format (nicely licensed under CC-SA), but also accept a plain text list of urls or RSS 2.0/Atom 0.3. Yes, you heard correctly, it supports RSS, which makes it a lot easier on me. The only problem is that I keep my RSS feed under a mod_rewrite rule that makes it appear to be at /rss/2.0 which means it’s only authoritative (to Google) for the /rss directory which contains… precisely nothing.

It won’t hurt MT, because it keeps things at /index.rdf but it will hurt WP which (with mod_rewrite) uses /feeds/rss or something like that.

The supplied Python scripts are cool. They’re BSD although the XML spec is CC-SA, which I found intersting. Can a spec not be put under the BSD license for simplicity?

Although the test script is very complete, it’s also very chatty because there’s no assert_false, it assert_true’s then counts the warnings. Found this in the test script, which reminds me of autoplay="yes please":

      {'pattern' : '*', 'type' : 'wildcard', 'action' : 'look pretty'},

The shebang is set to python-2.2 which is all well and good except for those of us who only have python-2.3. The FAQ suggests that you have “knowledge of how to upload files and run scripts” (I’m not sure on the exact wording since the sitemaps pages are returning 502’s now) which I think is not being strict enough — especially for Windows people who will need to install Python, set up paths, etc.

Further Reading

P.S. Google: make it easier for people to get in touch and report typos in your documentation. The FAQ mentions ?q= but the parameter is actually something different.

PHP Option Parser (optparser2) 03 Jun, 2005

[I] Don’t like wastin’ time for music
That won’t make me proud.

— Ben Folds

At the office, we’ve started doing a lot more things from the console, and to that end, we’ve developed some scripts writen in (of course) PHP to simplify some of our more repetitive tasks. Yes, I know PHP is a hammer, but work with me here, at least it’s not PERL.

Several of these scripts needed to accept commandline arguments, which PHP conveniently places in $_SERVER['argv'] for us, but doesn’t help with mapping that array into anything a bit more useful, like named flags or whatnot. I ended up using a lot of if (in_array("-h", $_SERVER['argv']))... but once I went to all that trouble of checking for flags, I didn’t know where genuine arguments such as files or numbers were, and certainly couldn’t show a warning if a flag was used that had no effect.

Then I read about inamidst’s argparse (written in Python) and decided that something similar would really be a boon to the the scripts I was working on.

Since PHP is a somewhat agile language, I went ahead and wrote the tests first, which made it very easy to tell when it was “done,” but also helped me figure out the syntax I was going to use for specifying options. There’s also a demo included, although the tests do document the behavior, they are a little convoluted if you’re just trying to figure out how in the world it’s simpler to use optparser2 rather than in_array.

Source, test suite, and demo available at lab/lib/trunk/optparser2/

Or via anonymous svn to svn://svn.timhatch.com/lab/lib/trunk/optparser2

In order to run the test suite, you’ll also need to grab lab/lib/trunk/tests/. This directory is not required for normal operation — it’s for developers to make sure changes don’t break core functionality.

Released under the BSD license.