Archive for March, 2004

Having It All

Note: This is the first in a series of posts I’m planning to write to help focus my thoughts on electronic clutter… like the 5000+ items in my inbox at work, or the 2000+ unread items in my aggregator.

I am a collector. I do not always collect, but I have the collector’s mentality. As a child, I collected stamps and baseball cards. Although I spent some time admiring the designs of the stamps, I was never more than a passing pro baseball fan. I collected not because of a raw interest in what I collected, but because of a need to collect. To count and categorize. To compare what I had against a known universe of what I could collect.

Like any good (bad) habit, this didn’t end in childhood. At my previous job (over 6 years ago), the cafeteria carried Nantucket Nectars juices. I was a serious fan of their cranberry juice coctail, and had at least one a day. If you’ve never seen Nantucket Nectars drinks, they come in bottle very similar to Snapple. On the underside of each bright purple metal bottlecap was a little piece of trivia about the town of Nantucket and its residents. Some of it was pretty esoteric, but it was interesting, different. So I found a box and began to collect these bottle caps. I don’t know why. Even today, my TiVo is filled with episodes of Good Eats waiting to be put onto tape, because I’m collecting them.

I am also a pack rat… a related condition. Over the past weekend Sherri and I cleaned our garage. We have a two-car garage which has never seen a car inside it in the three years we have lived here. This is half due to things like bicycles, lawnmowers, and other items for which I have no other place to store. But it is also half due to a large number of boxes (and a few other large items) that we stored in the garage temporarily when we moved into the house. Alot of this stuff was mine, and alot of it was only there because I’m a packrat. I have a Commodore 64 and a disk drive for same, plus many, many floppies for it that are sure to no longer work. I have the first PC that I bought after Sherri and I were married, a 75mhz Pentium that may or may not have had a processor upgrade (don’t remember). I have two old Sun machines, I think they are Sparc 1’s. They were originally network clients, and have no internal HDs. Tried to get one working with a SCSI hard drive someone gave me a few years ago, to no avail. Wouldn’t mind getting them to net-boot Linux (if I knew how). I have an HP600 inkjet printer that might work, and an HP LaserJet III that mostly works, but needs a new infeed roller. I used to have a real live VAX complete with teletype, but I finally threw that out when we moved here. I have a 40+ year old oscilloscope and a 25+ year old portable reel-to-reel tape deck, and I have no idea if either work. And that’s just (most of) the technology stuff. Nevermind the books, old papers, etc.

I got rid of alot of junk and clutter, but most of the computer stuff is still in the garage (and yes, there’s more in the basement)… you just never know when you’re going to need it. I did manage to throw away a box I found, full of slightly rusted purple bottle caps.

Googlebot Needs Your Help!

Via ~stevenf, here’s a list of tips to help the Googlebot understand your website. I’m already doing most of these, but one tip on the use of the “robots” meta tag leapt out at me:

Webloggers: use the meta tags to help the Googlebot index only your permalinks, not your constantly changing front page. To do this, use
<meta name="robots" content="noindex,follow" >
on your front page and
<meta name="robots" content="index,follow" >
on your posts’ permanent locations.

I’ve often noticed that Google searches of my site not only return individual posts, but also category and date archives. For an example, see this Google search for GarageBand on jclark.org. This tip should help alleviate the extraneous matches. I intend to implement this change as soon as I have a few minutes to do so (but changing the <meta > tags to <meta /> tags, to remain valid XHTML 1.1).

Implementing this via Blosxom shouldn’t be too hard. Those who use separate flavours for individual posts will have no problem at all. I don’t; instead I use my storystate plugin, which exposes the variable $storystate::permalink, which is true when viewing an individual post. Used in conjunction with Rael’s interpolate_fancy plugin (sort of a must with storystate), this will allow me to change the meta tags as needed.

Markdown Redux

As I’ve mentioned previously, I’ve recently started using Markdown to format my blog entries. After using it for a few posts, I honestly think it’s lowered the “friction” it takes to compose an entry. When I first saw it, my immediate reaction was, “Why? We already have Textile.” However, Textile is a tool to “mark up” plain text to be formatted as (x)html, where Markdown is a tool to render plain text as (x)html. In other words, Markdown strives to remove the need to insert markup; instead it uses existing plain text idioms, especially from email. It doesn’t have as many features as Textile, but it has all the features I use. It also handles certain things much more easily; I’m not sure I ever figured out how to mark up multi-paragraph blockquotes in Textile.

The Blosxom interface in the current beta releases (1-3) apply markdown formatting to every post. In my previous post on Markdown, I offered a updated version that used the Blosxom meta plugin and a “meta-markup” header to enable Markdown on a per post basis. John Gruber, author of Markdown, stated on the Markdown mailing list that he’d rather make this behavior optional. I agreed, and have produced version 2 of my Markdown-Blosxom patch:

Update 3-25-04: John Gruber has released Beta 4 of Markdown, which incorporates (and improves) these changes. The code patch below is now deprecated; go grab a new (post-beta-3) copy of Markdown. :

#### Blosxom plug-in interface ##########################################

# Change $blosxom_always to 0 to use "meta-markup: markdown" story
# headers to enable Markdown on a per-story basis
my $blosxom_always = 1;

#don't change; auto-detects
my $blosxom_hasmeta;

sub start { 1; }
sub filter {
    $blosxom_hasmeta = defined(%meta::);
    1;
}
sub story {
    my($pkg, $path, $filename, $story_ref, $title_ref, $body_ref) = @_;

     if ($blosxom_always or 
         ($blosxom_hasmeta and 
          defined($meta::markup) and 
          $meta::markup =~ /^\s*markdown\s*$/i))  {
        $$body_ref  = Markdown($$body_ref);
    }
    1;
}

Notes: * Install is as before. Replace the existing Blosxom plug-in interface with the code above; remember to rename Markdown.pl to Markdown when you put it in your plugins directory.

  • By default, it will always apply Markdown (as it was originally). Even if the Meta plugin is present, we can’t assume the user wants to use it to control Markdown. If you want to use meta-markup, set $blosxom_always to 0.

  • I check for the presence of meta instead of assuming it’s avilable. If blosxom_always is 0, but meta plugin is not available, Markdown will never be invoked.

  • the check for meta occurs in blosxom interface’s filter() method. start() is a poor choice because Markdown could be loaded before meta (and will be by default, which is alphabetical). filter() will run for every plugin after all plugins are loaded.

Updates:

  • the meta-markup check is now a case insensitive regex.

  • No longer applying markdown processing to the story title. This was causing <p> tags wrapped around the title, which is not appropriate in places like RSS feeds.

Second Update:

  • Astute reader ArC points out that if you are using meta but a post has no meta-markup in the header, the check of $meta::markup would cause perl to complain. I’ve added a defined($meta::markup) test.

Senseless Acts of Perl

At work I spend alot of time working on one of our Solaris dev servers via xterm. Via many xterms simultaneously, most of the time. Since I run a local X client on my PC under cygwin, I have a shell script that I run locally that connects to the dev box and launches three xterms in pre-determined screen locations, setting DISPLAY along the way.

Over the course of a busy morning, this number can grow. Since I’m still on a Windows PC, however, I do tend to use my task bar to find windows. Having six or more taskbar buttons that all say “xterm” isn’t very helpful. For a while I tried setting my titles to reflect what I’m doing in each xterm, but this futile. Partially because I often create, destroy, or repurpose xterms on a whim; but largely because I’m lazy.

A while ago, I updated my launch script to label my initial three windows Alpha, Beta, and Gamma. While the names aren’t very descriptive, it does differentiate the windows, and I can usually remember what each window is being used for. When I start launching additional xterms, things can get confusing; I try to remember to add a -title and pick a Greek letter not in use, but I did mention I’m lazy, right? So today, I decided to do something about it.

The result is addterm, one of the more senseless perl scripts I’ve ever bothered with. When run, it creates a new xterm with the title set to the name of the first greek letter not currently in use. If all 24 greek letters are in use, and error message is printed and no xterm is launched. This is a feature, not a bug. Close some windows! The version below is my OS X port. :

#!/usr/bin/perl -w

my $user = `whoami`;
my @ps = split("\n", `ps -o command -U $user`);
my @alpha = qw/Alpha Beta Gamma Delta Epsilon
               Zeta Eta Theta Iota Kappa Lambda
               Mu Nu Xi Omicron Pi Rho Sigma
               Tau Upsilon Phi Chi Psi Omega/;
my $k=0;
my %greek = map {$_=>$k++} @alpha;

for(@ps) {
    my ($title) = /^xterm\s+-title\s+([^\s]+)/ or next;
    $alpha[$greek{$title}]=) {
        $next = $_;
        last;
    }
}

if (defined $next) {
    open STDERR, '>/dev/null'; #discard xterm's whining
    system("xterm -title $next & ");
} else {
    print STDERR "ERROR: No greek letters free!\n";
}

This required a port from the original Solaris version because the script uses ps to look for running xterms. The Solaris version uses ps -o args -u $user. The command should list (only) the full command + args for every process for the username $user. If you want to use this on another *nix, just test your ps command first and adjust accordingly. You could also change the Greek letters to another finite set, just remember to update the error message.

Of dubious interest is that fact that I used an array to keep the letters in order and a hash to allow quick indexing into the array. I dislike having to store the letters twice, but this seemed the best solution. I have a vague sense that some kind of tied vars may do this more elegantly, but my perl-fu isn’t quite that strong without cracking the Camel; did I mention I’m lazy? Perhaps tommorow. Improvements welcomed.

It’s Alive… Alive!

As I noted previously, my TiVo required a reboot the a couple of days ago, after which It reported a severe error. This was accompanied by instructions to wait three hours while it tried to phone home for repairs. I went to bed before the three hours were up.

When I checked on it again last night, it was still displaying the error message. Before calling customer service as directed, I decided to try one more time. I performed a reboot with extreme prejudice (a.k.a. unplugging), and waited while it cycled through startup screens. Three or four minutes later, success!

While I love my TiVo, and do not begrudge TiVo, Inc. the $13 a month I pay for programming info, this episode has gotten me thinking once again about exploring MythTV. One of the things I’d really like to do is run MythTV on my existing TiVo hardware, since A) I already paid for it, B) It’s got a hardware MPEG-2 encoder built in, and C) it’s already a working Linux box. Accoring to the MythTV docs, you can’t run MythTV on TiVo hardware. It seems to me that when I read the documentation several months ago, the stated reason was that the MythTV interface runs under X windows, and the TiVo couldn’t run X11. However, the 0.14 release notes state that directfb is now supported; throw in QT/embedded and X is no longer required.

Unfortunately, the documentation now states that the TiVo has non-standard hardware for which no drivers (or programming info) exist. Of course, Tivo has released their kernel mods (GPL), but that doesn’t mean they had to release custom drivers. Still, I remeain hopeful. I’ve been looking for any related threads in mailing list archives, so far with no luck. If anyone knows more, please comment below.