The Hacker Within VIII

Today’s subject: Mozilla Thunderbird Templates

Greg V. Wilson of the University of Toronto has a great talk on nanoHUB called “Software Carpentry: Essential Software Skills for Research Scientists.” In it, he makes the claim that any task that you need to perform more than once is worth automating.

My computing life has improved in direct proportion to my willingness to heed his advice.

A recent example: I’m the chair of the UW-Madison College of Engineering’s New Educators’ Orientation, a series of required workshops for first-time COE TAs. Being the chair is not at all glamorous; it mostly means sending out lots of emails to recruit volunteers to help out. And if they’re not customized, no one replies.

Using Mozilla Thunderbird or a similar email program obviously makes this task quite a bit easier–my de facto algorithm last semester required one New Message and three Copy-Pastes, into three different boxes. This semester, I’ve automated out a few steps to get it down to one New Message (well, an equivalent) and one Copy-Paste with Thunderbird Templates. I know it doesn’t sound like much of an improvement, but this process offers a significant time-savings, is much less error prone, and can keep you more organized.

How do you use Templates? Easy. First, create a new message, with subject line and easy-to-find placeholders in the message. Then click File > Save As > Template. A folder called “Templates” will appear in your folder window. Click the folder, and then right-click on the Template you want to use and select Edit As New… (or, better yet, use Ctrl+E with the Template selected).

A copy of that Template will then pop up, all ready for you to replace the placeholders and enter a recipient email. Not for nothing, you’ll also never have to dig through your Old Sent Mail to find the message you need to resend.

I wish I’d looked into this sooner. Thanks to Heinz Tschabitscher and his About.com entry for being there when I did (though note that, at least with Thunderbird/Ice Dove version 1.5.0.14pre, I couldn’t double-click on the Template to Edit As New as he suggested).

Special Combined Sunday Judgment/Hacker Within: March Madness

Today’s subject: the NCAA men’s basketball tournament.

First, a couple of confessions.

(1) It’s a bit of a stretch to throw the Hacker Within label on this post, but I couldn’t pass up an opportunity to integrate my two regular features in one post.

(2) Since I have picks to make, and also fair number of goals for genuine productivity during this week (which is spring break at UW-Madison), I’m totally half-assing this post with respect to both the commitment-to-quality-science-writing and commitment-to-meaningful-integration-of-technical-
and-non-technical-material ambitions of this blog. Thus, the whole integration thing in (1) is also a stretch.

So here we go. First, Sunday Judgment. If you’ve been watching Sports Center or listening to any sports talk radio this week, you know that the trendiest game in NCAA basketball journalism is coming up with clever synonyms for bubble team. (See especially this week’s Mike Tirico Show.) Not surprisingly, this trend makes for good radio and plenty of fun armchair etymology (or maybe reverse-etymology?).

However, this seemingly harmless game reminded me of a serious problem that mars a lot of college writing. Call it synonymic hyper-proliferation. Or restless diction. Or mythesaurus rex.

Actually, please call it only one of those things.

I can’t tell you how many student writers feel pressured to substitute synonyms when repeatedly referring to an important theoretical construct or technical term. Of course, variety is an important attribute of all good writing, and it’s often a bad idea to use the same word twice in one sentence, in the same position in subsequent sentences, etc. But, more often than not, if you’re writing a paper about, say, disciplinary matrices, it’s a mistake to give in to the urge to come up with a million different ways of saying disciplinary matrix. These precise terms come about for a reason; don’t feel pressured to over-substitute.

OK, onto some quasi-Hacker Within material. For reasons of, well, basically realizing it was a huge waste of time, I’ve abandoned draft.gms, my probably futile attempt to turn my fantasy baseball draft into a huge assignment-problem-like GAMS model. Naturally, I’ve re-channeled my silly interest in applying mathematical programming to, say, sporting events and dice games in bars, and so I wanted to point you in the direction of resources for using the power of science to make better March Madness picks.

You may have heard last year about some professors at Georgia Tech who published a paper in Naval Research Logistics called “A logistic regression/Markov chain model for NCAA basketball.” If memory serves, the UW-Madison libraries don’t carry this one, but it looks like Kvam and Sokol have posted a manuscript of the paper here. There’s also a kinda funny “powerpoint style equivalent” to the non-mathematical summary they wrote, presumably for all the media (I heard about it via some ESPN article last year that also included an “insider look” at how the oddsmakers go about their business). I haven’t read the whole thing, but even checking out the first few pages gives you an appreciation for their methodology. If you need some help with Markov chains (I certainly did), this AMS primer is pretty comprehensible.

Not interested in Markov chains? No problem. Profs. Kvam and Sokol make the output of their model, applied to this year’s game results, available here. You can choose between three versions of the model that take one of the types of input data, margin of victory (MOV), into account in various ways. Not surprisingly, the “pure” strategy (which doesn’t cap the contribution of MOV) is best. Nevertheless, the selection committee, which at least last year had access to the LRMC, won’t use tools that consider MOV (for sportsmanship reasons, presumably). Anyway, if you’re interested in trying this, just choose a model and use the rankings to pick each match-up. And remember: the pure LRMC is the most successful systematic ranking system available.

Couple of thoughts:

(1) Check out the top eight teams for each of the three rating schemes–
Pure: Kansas, Memphis, UCLA, Duke, North Carolina, Tennessee, Wisconsin, Clemson
Capped MOV: Kansas, Memphis, Duke, UCLA, Tennessee, North Carolina, Wisconsin, Stanford
No MOV: North Carolina, UCLA, Memphis, Duke, Tennessee, Kansas, Texas, Wisconsin

This is kinda neat. You can see the effects of all those close games North Carolina won reflected in their placement under each model. Are they actually overrated? I dunno, but I like the sound of it.

(2) See, Wisconsin, shoulda been a two seed, no matter how you look at it (or, rather, no matter how these two industrial engineers looked at it).

(3) Pull a Joe Morgan if you like, either by criticizing the very idea of using stats to predict this stuff or by gloating when the inevitabilities of statistical randomness play out and the models break down from time to time. But please don’t say that this kind of analysis sucks the life out of playing or watching these games. That mentality totally missed the point. Of course we shouldn’t reduce sports to mechanical calculations. Of course what’s really exciting is watching people overcome their mathematical destiny and do something special. Of course these methods overlook all kinds of intangibles.

But the point of doing brackets is to get the most picks right, right? There are all kinds of arguments against using the LRMC method to make your picks, but wanting to give yourself the best chance to win isn’t one of them.

Kvam and Sokol humorously observe, “With so much money on the line, a model that predicts outcomes more effectively than standard ranking and rating systems can be useful.” I myself am risking a total of two beers, so I’m going to let pride cloud my scientific judgment and tweak the pure LRMC rankings a bit. To my detriment, no doubt.

The Hacker Within: Baseball Edition

With a little help from geek and proud, I’m now able to listen to MLB.TV radio broadcast streams on Kermit, the Linux machine I work at. Using the MediaPlayerConnectivity plug-in Alan suggests and choosing Totem as the default player in the configuration wizard seems to do the trick on my system (“i686-redhat-linux-gnu” according to configure).

I couldn’t get the video to work, though. I don’t view much MLB.TV video at work anyway, so you’d think I’d have been able to leave it at that. I couldn’t. I spent much of the afternoon reading up on Silverlight and Moonlight, GStreamer and Pitdll. I battled with autotools and Mono distributions. I was defeated. Hopefully the Moonlight people get a Firefox plug-in finished soon. They’re working pretty hard, from the sound of it.

Speaking of computing in the name of baseball, stay tuned for a report on draft.gms, my network flow model that will hopefully let GAMS choose my fantasy baseball draft picks. I think I can do it as a modified assignment problem with the help of little tuning trick I learned about in a breast cancer diagnosis project I learned about in linear programming last semester. I’m sure you’re on the edge of your seat.

The Hacker Within IV

Today’s subject: Emacs matlab-mode, THW III update

Just a quick one right now. I needed to take a look at a MATLAB function today but didn’t want to have to look at it in MATLAB to get the syntax-highlighting right. Check out this link if you’ve had the same problem and want a matlab-mode customization in Emacs.

Also, someone on the Internet was wrong: me. Special thanks to Rob Kennedy for catching a bug in my SQLite sample application. Turns out I’d made a similar error in my “real” application using SQLite as well. Score one for the idea of blogs as a productivity tool, at least if you’re lucky enough to have smart friends and readers.

The Hacker Within III

Today’s subject: SQLite

I’m a novice programmer. As such, I often find that a lot of the sample code and documentation I find online goes over my head. I can’t be the only one for whom this is true.

Thus, I thought I’d post a little sample application I wrote that demonstrates some of the basic functionality of SQLite, the “self-contained, serverless, zero-configuration, transactional SQL database engine.”

We’re using SQLite to track materials data in our GENIUS application, but this sample program, which I wrote for practice, creates two music-related tables: an iTunes-like table of song information and a table of phone numbers of Madison-area clubs (stored as arrays of integers to demonstrate how to handle blobs).

It doesn’t do much and certainly shouldn’t be used for any real applications, but I nevertheless hope that you find this program helpful if you’re trying to learn SQLite. I try to explain things as completely as possible, but I didn’t want to annotate the arguments for every function call, so you’ll need to consult the SQLite documentation as well. Finally, special thanks to the author of this example, which I unfortunately found much too late.

The Hacker Within II

Another useful thing about tracking THW projects is that it’s so easy to forget about Linux commands, utilities, etc. that I’ve used in the past. THW posts can serve as a record of such commands. Today I needed to capture a screen shot of some web images of the nuclear fuel cycle for a memo (each facility had a different image, so it was too much work to save each image separately). And of course I forgot to bookmark the site I used last time I needed help with this problem and couldn’t quite find it.

Here’s how I did it when I finally figured it out:

> xwd -out cycles.xwd
[clicked on open Firefox Window]
> convert cycles.xwd cycles.jpg

Easy as pie, right?

The Hacker Within I

I only blog from the office when I have something work-related to share. Now is one of those times.

Because code development is part and parcel of our work as computational researchers, my advisor encourages our group to unleash and cultivate “The Hacker Within” (THW). THW is always trying to improve his or her computing experience–customizing, automating, and navigating parts of the digital landscape in new (and hopefully more productive) ways. Plus, messing with THW-related projects is usually more fun than doing whatever work you’re supposed to be doing.

My THW project the last day or so has been switching over to using Emacs, which I have to say has already yielded some nice results. The learning curve on the key bindings is a little steep, but I’m getting better.

One of my long-time complaints with Emacs (or rather short-time, since I’ve only been using Linux for a year or so, which while I’m at it I should say that this and probably most future THW content will probably seem extremely lame to people who actually know what they’re doing) was that there is no single-keystroke way to switch between open files, at least none that I could find. That functionality is extremely important when you’re working with source code that’s spread out over a bunch of classes (and hence files).

Well, today my HW fixed that, or rather he found the code someone else’s HW had already written to fix that. I highly recommend Adrian Quark‘s Emacs customization buffer-stack, which brings Windows-Alt-Tab-like switching to Emacs buffers. I chose Ctrl-Tab for my key binding to his main function, as you can see from my .emacs file, which I include in the hope that it might be helpful to other new Emacs customizers-in-training.

Note: Other THW posts will be much shorter and to the point. I don’t take blogging at work lightly, but I do think that since I get so much help with code development from online sources, I have the responsibility to “give back” once in a while, to the pathetic extent that I’m able to. In this longish post, I just wanted to sort of establish the context of THW.