grack.com

Blog

Babylon 5: Season 1

Just finished watching Season 1 of B5 on DVD tonight.  Chrysalis (the final episode of S1) is fantastic.  If you have the opportunity to watch the DVD set, take it!

One of the most interesting things about the series is that it coincided with the birth of the web.  The Lurker’s Guide to Babylon 5 was probably one of the first pages I hit on the web.  Strangely enough, the site is pretty much the same as it was a decade ago- save for some recent updates of course.

On the other hand, feel free to skip the episode “Grail” in season 1.  It’s absolutely terrible: probably made the cut originally because of the CGI alien bit they talk about in the guide.  The rest of the episodes range in quality from good to excellent.

CSS Tweaks

My old default style was starting to tire me out.  I’ve changed the default font and tweaked some of the general style for the site to spruce it up a bit.

If I feel brave enough, I might just whip up an entirely new set of style and create another dynamic style link at the bottom of the page.

Oh yeah - I’ve also got three more Gmail invites to give away.  If you’re interested and happen to notice this, leave me a comment with your full name, email address and website/blog (if applicable).

mod_rewrite Saves the Day

I wanted to move all of my old articles into yearly subdirectories, but I didn’t want to break any of the incoming links to my site.  Thankfully, mod_rewrite allows me to redirect incoming requests as necessary!

RewriteEngine on

RewriteCond         %{REQUEST_FILENAME} ^(.*/news)/
RewriteCond         %1/2004/$1          -f
RewriteRule         ^news/([^/]+)$       /news/2004/$1 [R,L] 

RewriteCond         %{REQUEST_FILENAME} ^(.*/news)/
RewriteCond         %1/2003/$1          -f
RewriteRule         ^news/([^/]+)$       /news/2003/$1 [R,L]

RewriteRule   ^(.+)  -  [PT]

Basically, these rules check to see if the file exists in the /news/2004/ or /news/2003 subdirectories and, if so, redirects immediately to the yearly subdirectory.

It took me a while to figure out how to do this, but I think I’ve got a good idea of what’s going on.

The strange (but cool?) thing about mod_rewrite is that you can use the “back-references” captured in the RewriteRule in the RewriteCond lines! In the rules above, %1 represents the request filename captured in the first RewriteCond, while $1 represents the URI segment captured in the RewriteRule below. See figure 1 in the mod_rewrite manual page for more information on how this works.

If you want to figure this stuff out for your own nefarious purposes, here are some links to help:

Gmail Invites

I’ve got gmail invites to give away to the first five to leave their name and email address in the comments.

First come, first serve!