SKerwin: February 2004 Archives

About This Site

|

I'm not sure precisely what a 'colophon' is, and I'm loathe to use a word that's not strictly part of my vocabulary just because it's a trendy word. So, in deference to my linguistic shortcomings, welcome to the 'About This Site' page of Sean Kerwin's Neutiquam Erro.

The title, Neutiquam Erro, is a Latin phrase that is generally translated as "I am not lost". I trust anyone stumbling their way through life has made a similar feeble protestation at one time or another, even if the thought never finds voice.

The site is hosted on an aging Power Mac G4 Sawtooth with a 500 Mhz G4 processor and 1 Gigabyte of RAM. Its network access it provide via a wireless connection to a LinkSys wireless router hooked to a Motorola SURFBoard cable modem. External access to the server is provided via port forwarding.

The server is currently running Mac OS X 10.3.x (Panther). Pages are served with the standard Apache installation, and the content is managed with Movable Type 2.65. Apache Virtual Hosts are used to allow subdomains.

All of the MT templates are customized quite heavily; the desire was to produce thoroughly XHTML-compliant code to which a wide variety of skins could easily be applied. My inspiration in this pursuit was the venerable CSS Zen Garden.

When viewed at the XHTML level, much of the site is actually within various unordered lists (<ul> tags). This was a deliberate decision to make the source presentable on a text-only browser. The CSS used in the site is valid and appears to be working correctly on Safari, Mozilla, IE 5.x Mac, IE 5.x Windows, and IE 6 Windows. I tweak the CSS constantly and the bulk of the verification/testing is done with Safari or Mozilla, so I make no guarantees about the other browsers.

MT is extended by use of the SmartyPants plugin, which provides attractive typography, the MTSwitch plugin, which allows a number of nifty techniques in the templates, and the the Acronym plugin, which automatically adds <acronym> tags around familiar acronyms.

The random text you'll see on many pages -- such as the Buffy the Vampire Slayer quote above and the random song excerpt below -- is generated by a rather simplistic shell script I've written. The output from the script is integrated into the page content using server-side includes.

The 'today in history' section on the front page is also generated by a short shell script. This script essentially greps through the FreeBSD calendar files and picks out everything that matches the current date. This script is also included in the page using SSI.

The link list is actually generated by another blog within MT; this blog outputs a file which is then imported into the sidebar module using the <MTInclude> tag. The categories in the link blogs become the section headers, the post titles become the link labels, and the post content becomes the actual link.

To facilitate laziness, all the redundant parts of the site are stored as MT modules which are the imported as appropriate. Because the comment preview and error pages are dynamically generated and thus cannot make use of the SSI feature for the random quote and song lyrics, two copies of each module exist; one dynamic with the SSI, one static with hard-coded quote and lyrics.

[UPDATED 10/2/04]

The more things stay the same, the more... Well, I guess it doesn't work as well backwards.

The site has been pretty thoroughly made over since the above was originally set down. The Zen aspirations are no more; the site has one theme, the requirements of which dictate the structure of the markup to a fairly significant extent. The new look was described in this post on September 7th.

Also new in the interval is the nify new recent songs page, which contains a list of songs I've played in iTunes since the last time the list was reset. It uses some pretty nifty perl code (of which I'm rather proud) to search for tracks in the Amazon database, cache the cover image locally, and do all sort of other nifty things. A post detailing the specifics will be forthcoming shortly.

Also, if you have a javaScript-aware browser, the title and masthead quote fade in as the the page loads. Totally gratuitous, clearly derivative or Orkut, but nifty nonetheless, IM-ever-so-HO.

Adapative Post Listings

|

You'll note the new site design is live, more-or-less. Style switching is nonfunctional and will remain that way until I update the alternate styles, while the archives are under development and should be completed soon. I suppose I shouldn't have gone live till all the pieces were ready, but I was bored and it's not like anybody's going to complain.

An interesting challenge came up in writing the by-category archive template. I wanted to list all entries for that category, with the first ten showing up in the nifty little preview boxes from the front page and the remainder just being in a list. You can see what I'm talking about here, the current in-progress journal entry list. I've decided to call this 'adaptive listings', for the simple reason that I can't think of anything else to call it.

You'd think could just do something like this:

<MTEntries lastn="10"> (Code for the large display) </MTEntries>

<MTEntries offset="10">
(Code for the small display)
</MTEntries>

But that won't work; the lower list will duplicate the first ten entries displayed in the upper list, because for some dumb reason the offset code only works in the prescence of the lastn code. Of course you could just put in a very large number for lastn and assume you'll never have more posts than that in the category, but that's the sort of simple ugly hack for which I simply will not stand.

Anyway, the following ugly snippet does what I want in a sufficiently scalable fashion that I feel comfortable using it:

<MTSetVar name="displayed" value="0"> <!-- count how many posts we've shown -->

<ul id="entrypreviewlist">

<!-- for every entry -->
<MTEntries>

<!-- open either a full or condensed 'li' -->
<MTSwitch value="[MTGetVar name='displayed']">
<MTSwCase value="ENOUGH">
<li class="<$MTEntryCategory$>shrunk">
</MTSwCase>

<MTSwDefault>
<li class="<$MTEntryCategory$>">
</MTSwDefault>
</MTSwitch>

<!-- title is a link for condensed items -->
<MTSwitch value="[MTGetVar name='displayed']">
<MTSwCase value="ENOUGH">
<h3 class="subtitle">
<a href="<$MTEntryPermalink$>">
<$MTEntryTitle smarty_pants="1"$>
</a>
</h3>
</MTSwCase>

<MTSwDefault>
<h3 class="subtitle"><$MTEntryTitle smarty_pants="1"$></h3>
</MTSwDefault>
</MTSwitch>

<!-- The Attribution Line Was Here -->

<!-- show this entry, advance the counter -->
<MTSwitch value="[MTGetVar name='displayed']">
<MTSwCase value="0">
<MTSetVar name="displayed" value="1">
<p><$MTEntryExcerpt convert_breaks="0" smarty_pants="1"$></p>
<a href="<$MTEntryPermalink$>">Read This Post</a>
</MTSwCase>

<MTSwCase value="1">
<MTSetVar name="displayed" value="2">
<p><$MTEntryExcerpt convert_breaks="0" smarty_pants="1"$></p>
<a href="<$MTEntryPermalink$>">Read This Post</a>
</MTSwCase>

<MTSwCase value="2">
<MTSetVar name="displayed" value="3">
<p><$MTEntryExcerpt convert_breaks="0" smarty_pants="1"$></p>
<a href="<$MTEntryPermalink$>">Read This Post</a>
</MTSwCase>

<!-- And so one, you see the pattern -->

<!-- After showing nine entries, we've shown 'ENOUGH' -->
<MTSwCase value="9">
<MTSetVar name="displayed" value="ENOUGH">
<p><$MTEntryExcerpt convert_breaks="0" smarty_pants="1"$></p>
<a href="<$MTEntryPermalink$>">Read This Post</a>
</MTSwCase>

<!-- no default case: we do nothing once we've counted enough -->

</MTSwitch>

<!-- close the open tags -->
</li>
</MTEntries>
</ul>

Of course my actual template is formatted such that the resulting HTML file ends up looking nice, but it's easier to read this way. The code for the attribution line isn't included in the snippet above because it's not really pertinent to this process. Also, the attribution line has another MTSwitch block in it and makes things even harder to read.

As with my other MT template snippet, this is the kind of thing that makes most fairly up-to-date programmers roll their eyes, or sometimes run screaming. MT's template markup is primitive by sufficiently rich that most things can be done provided you're willing to suffer. Think of it this way: as Perl is to C++, MT template tags are to assembly.

That said, I'm sure there's a better way to do this. Absolutely positive. But I can't come up with it, short of writing a plugin. And those have to be written in Perl, and that's the sort of thing that makes meroll my eyes and/or run screaming.

Alternating Colors in MT

|

The new design for this site (Front Page Preview, Entry Page Preview) is still underway, and starting to look (by my standards) rather nice. I've grown a lot more comfortable with both CSS and MT template tags since my last rework, so I've taken the time to add some nifty things in the new version.

One innovation you might notice in the second preview is the coloration of the comments. Ideally I'd like to be able to assign a name (and possibly icon) to visitors, but that's not really possible at the moment - when MT 3.0 rolls out with user registration for the comment system, that should hopefully do the trick. In the mean time, I decided to break up the monotony by making each entry a different color in a rotating three-color set. In theory it should be possible to do this with sibling selectors in CSS, but that would be an ugly hack: you'd have guess at the maximum number of comments you'd ever have and hard-code that many CSS rules. Also, it wouldn't work right in Internet Explorer most of the time. Ah, IE - it makes the web exciting!

The trick I went with was the following lovely bit of obfuscation:

<MTSetVar name="color" value="1"> <MTComments> <MTSwitch value="[MTGetVar name='color']"> <MTSwCase value="1"> <li class="firstcolor"> <MTSetVar name="color" value="2"> </MTSwCase> <MTSwCase value="2"> <li class="secondcolor"> <MTSetVar name="color" value="3"> </MTSwCase> <MTSwCase value="3"> <li class="thirdcolor"> <MTSetVar name="color" value="1"> </MTSwCase> </MTSwitch> <h3 class="subtitle"> <span><$MTCommentAuthor$></span> <MTIfNonEmpty tag="MTCommentURL"> <a href="<$MTCommentURL$>">[<$MTCommentAuthor$>'s site]</a> </MTIfNonEmpty> </h3> <h4 class="attribution"> Posted at <$MTCommentDate format="%l:%M %p"$> on <$MTCommentDate format="%A %B %e, %Y"$> </h4> <$MTCommentBody smarty_pants="1"$> </li> </MTComments>

I'm sure any programmers out there are rolling their eyes and saying duh right now, but I figured some normal folk out there might find this useful. Essentially, the MTSetVar variable named "color" is used to store a number between 1 and 3 (inclusive). For each comment, we use the MTSwitch plugin to print out a <li> element with the appropriate class, and then update the variable to the next color value.

Anyway, I thought it was nifty. Though the colors aren't final - I may mute the comments down or change them to varying grays to provide more differentiation from the category colors.

There are a few other little tricks I've come up (or more likely reinvented) while doing this. I'll probably provide similar writeups for those, if/when I get around to it.

UPDATE: My old code-displaying markup is stupid. Try viewing this page with new design if you actually want to read the text.

No Place Like Plrtz Glrb

|

One of the hallmarks of Joss Whedon's shows has been the consistently witty dialog. Obviously the man is just as capable of wit off the air:

"Two roads diverged in a wood, and I took the road less traveled by and they CANCELLED MY FRIKKIN' SHOW. I totally shoulda took the road that had all those people on it. Damn."

Yup, despite an ever-broadening demographic and a 37% rise in ratings, Angel has been shuffled to the ever popular 'never' timeslot.

Anyway, this puts me in a quandry - do I want a new Buffiverse spinoff? On the one hand, I want to know what happens to all these characters, and this world. On the other hand, if you kept adding series to the franchise sooner or later you'd end up with Xander marooned in the Delta Quadrant fighting off Borg. And that'd be bad.

It really pisses me off when networks do this. The network was gushing about how nice they were to announce this so early, but that's total bull; at this point much of the season has been shot, and I'm sure nearly all of it has been written or at least planned. There's no way to wrap up all the loose threads in the remaining time, because some of them would need at least a full season to resolve fairly.

If the network cared about the happiness of the viewers - or rather, the satisfaction of their customers - they'd announce now that next season would be the last. That'd give Whedon and company time to cobble together some kind of passable finale.

Ah well. For those keep score, the only good show left on the WB network is Smallville. But we Angel fans can still tune in to Charmed! Yeah, Charmed! It's just like Angel, in that it never would have happened without Buffy, but it's much faster-paced because they decided to forego plot entirely, electing instead to just put Alyssa Milano in a new costume every week. Yeah, Charmed!

The MTGoogleRank Plugin

|

The MTGoogleRank plugin for MovableType is really nifty, though it's a pain in the ass to get it to work on Darwin/OS X (more on this below).

As you may or may not know, the primary drive behind this website is the fact that I'm not the first result for a Google search for my name. This offends my megalomaniacal side, for obvious reasons. I used to be first.

So for the latest redesign of my site (Preview) I decided to try out this plugin. If you check the preview you'll see that it's finally up and running, but it wasn't exactly an easy experience, especially for one such as I who loathes and fears Perl.

Simply following the instructions will get you absolutely nothing as your reward. To get any kind of results, you need to add some code to the beginning (just put it with the other 'use' declaration, though I don't think it matter much):

use MT::Template::Context;

Now the plugin's loading, but it won't do anything useful. You can get the version number, but whenever you try to use the blasted thing for its intended purpose, you'll get a thoroughly uninformative error message, along the lines of "Service description 'file:lib/MT/GoogleSearch.wsdl' can't be loaded: 501 Protocol scheme 'file' is not supported."

It turns out (and here's the part that caused much head-scratching and nearly as much cursing) you need to replace the five lines after the comment about 'GoogleSearch.wsdl' with this:

my $google_search = SOAP::Lite->service("http://api.google.com/GoogleSearch.wsdl");

That'll do it. I know that doesn't look like much, but trust me, it is. Apparently the installation of Perl or SOAP::Lite (I'm still not sure which) that comes with Panther doesn't like 'file:' URIs. As a result, it fails with a largely-useless and thoroughly uninformative error message.

Anyway - great module, crappy Darwin support. Hopefully anybody else in the same situation will find this page on Google and be saved the headache. Almost makes me wish I had TrackBack set up so I could ping the author of the plugin, 'cause I'm pretty sure both of those changes really should be in effect everywhere.

This Is A Post Title

|

Ever watch basketball? Sure you have. Know what I don't get? Listen to the commentators for a bit, and you'll hear things like, "and he's lost control of the basketball", or "and he shoots the basketball," or "and look at them move that basketball."

Why the hell don't they just call it a ball? I mean, if you think they're playing with a football, you're probably sufficiently confused that the commentary is the least of your worries. Likewise if you don't know what sport you're watching.

Think about it! A 66% reduction in syllables! They say that word hundreds of times a game - think how much time that is over the course of their lives. Think how much wear and tear they could save on their poor larynxes (larynxi? larynxen?).

So anyway, that's the end of my weblog post.

...

See what I mean?! Somebody call in the ODRDO (Office of the Department of Redundancy Department Office).

Co-Ax Murderer

|

So I'm sure by now the entire world has read of TCNiSO, and their Sigma firmware. For those yet unaware, Sigma is alternative firmware for Motorola's SURFBoard line of cable modems, which, when loaded via a rather ingenious hardware hack, allows users full control over their modem. Including, of course, uncapping.

For those unfamiliar with the subject, your cable modem could be faster; the speed is artificially limited by the cable company by tweaking settings in the cable modem. Not too long ago, when uncapping was a new thing, people would uncap their residential cable modem service and get truly mind-boggling throughput. Obviously cable companies were less than thrilled about this, and started cracking down. At the moment, as I understand it, uncapping is the exclusive province of the very brave and the very foolish.

But reading about Sigma got me thinking. Apparently these modems are typically configured to load their settings from an FTP server, presumably one operated by the cable company. As most uncappers have already discovered, modifying the settings for your modem will get you cut off, or perhaps even arrested - but what if the settings on the FTP server changed? It seems counterproductive to terminate all your customers.

I personally lack the skill (and, for that matter, desire) to do such a thing, but I'm sure that somewhere out there a clever geek with a black hat is working along similar lines.

Just goes to show: security is hard.

Thought Experiment

|

Imagine you've drawn large squares on the floor, say ten of them, and numbered them sequentially. Imagine further that you've got a particularly clever dog, and that you train him to trot one box down the row every time you call out 'plus one'. Imagine further still that you train him similarly for 'plus two', 'plus three', et cetera. So if the dog's standing on square four, and you call out 'plus five', he'll move to square nine, effectively adding the numbers. You've taught a dog how to add, right?

Wrong. The dog doesn't know how to add. The dog doesn't understand numbers, addition, or any of the abstract concepts contained therein. The dog may have some innate sense of quantity (two bones is more than one bone) but even that's up for debate. You've programmed the dog to give the illusion of numeracy, but the dog is still, in the final analysis, a dog.

Why do I bring this up? A course I'm taking this semester is taught by a... gentleman... who programs computers the same way this clever hypothetical dog adds numbers. And of course, he is grading me.

Sheesh.

They Do One Thing Well

|

I've often said that the only things Microsoft does right are mice. I've had an Intellimouse Explorer - the old style, with the big thumb buttons - for quite a while, and I've liked it immensely. But, with the advent of Exposé, I've felt an unavoidable compulsion to upgrade to a mouse with one more button, one shiny, eminently-pressable button which I could assign to Exposé and then, you know, push. Occasionally.

So I set off to Best Buy, fully intent on purchasing something out of Logitech's MX line of mice. They have a buttons above and below the scroll wheel, including one which seemed to be evidence of divine intent insofar as its apparent perfection for use with Exposé.

Then I played with it for a few minutes and bought a new Microsoft mouse. Why? The Logitech mice, for lack of a better term, suck. It's completely impossible to hit any of the three buttons lined up with the scroll wheel unless you're some sort of alien life form or an hideous mutant who lacks bones.

Microsoft, on the other hand, has refined their existing kick-ass designs by eliminating the clicking from the scroll wheel entirely (it takes some getting used to, but now that I have ordinary mice just seem ordinary) and allowing it to tilt. I kid you not. You want to scroll right, just tilt the scroll wheel to the right. Pretty sweet.

Anyway, I strongly encourage anyone to take a look at the new Wireless Intellimouse Explorer. Where in this context, 'anyone' of course means the three other people on Earth who care this much about their mouse and found this page by Googline around and checking all the results.

I also strongly encourage everyone to make fun of Logitech, but since I doubt anybody out there is searching for "make fun of Logitech" I don't think that recommandation has quite the same breadth to it. But then, stranger things have happened. Like, for instance, Burning Man. And that's annual.

Anyway, I guess what I'm trying to say here is, in a nutshell, nothing.

Pages