Once in a while I feel the need to write some actual code. I’m really a programmer at heart, and I find it incredibly satisfying to think through a problem and create a useful solution. For me it’s more interesting than crossword puzzles, and the end product is (sometimes) more valuable.
For a variety of obvious reasons, it’s not a good idea for me to get my fingers into Yieldex production code, so I end up scratching this particular itch with small side projects. This one took me a couple of hours, and hopefully will be useful for enough people for it to have been worth it. In any case, I learned a lot, so it was worth it for me.
I’ve written about CellarTracker before. I’ve been a user for years; I love the site, and I love the business. But, I find some of the UI to be less than perfect. Here’s an example: when I get a wine offering in the mail, there are usually a number of different vineyard designations, and I get an allocation of a few bottles from each. I haven’t found a way in CellarTracker to enter 2 bottles each from 10 different designations without doing an incredible amount of clicking around and waiting for pages to refresh. So, I set out to solve this problem with a “bulk purchase” mechanism.
There are a number of different ways to tackle this problem, so the first thing was to decide on an approach. I’m still a bit 1999 when it comes to the coding for the web, so my first idea was to set up a server-side program. Then I started thinking about the complexity of screen-scraping and parsing, and robustness in the face of potential CellarTracker updates. Then there are the security issues of passing usernames and passwords so my server could log in to CellarTracker. Finally, I realized I didn’t really want to be responsible for keeping the service up and running, so I almost bailed on the entire idea.
After a couple hours of experimentation, some heavy shell use, and a bit of DOM inspection, I had something up and running. I created a test account on CellarTracker, and entered a bunch of purchases. Success! I finished up by spending a few minutes on data validation, trying to make it obvious when something went wrong and how to fix it.
The final step was posting it in the new/old OSS directory here on Oxyfish, and writing this entry. I also posted a note in the CellarTracker forum, in case anybody else wants to use it. I’m very happy with how it turned out, and am looking forward to the next wine offering in the mail, so I can start saving time.
Install the CellarTracker Bulk Purchase extension (requires Firefox and GreaseMonkey)