Archive for August, 2006

Postcards from Maine

Since Sean is always harassing me to put some pictures on my site (he’s a professional photographer), I decided it was time to do so. Here are a few shots from my summer vacation in Maine.

Continue reading »

Getting Unnoticed

While I was working on the conversion, I setup a sub-domain at testbed.jclark.org. Unfortunately, I forgot to disable pings, and my testbed site ended up pinging something (pingomatic, I think). Google indexed the test site, and Technorati climbed all over it. Technorati found a special hacked version of my old blosxom site that contained links to the real site (jclark.org), so now my technorati inbound links page is full of posts from the test site that linked to me. Since this is now a dead site, I didn’t want it indexed by any search engine.

As soon as I figured out what happened, I killed testbed.jclark.org with a .htaccess mod_rewrite rule that makes every URI on the site return 410 Gone. After a few days, nothing had changed. A little research revealed how to get removed from Google. In short, I added a robots.txt file disallowing all User Agents (I could have disallowed only Googlebot). To hasten the process, I used the url removal system to request an expedited check of my robots.txt file. I also had to modify my mod_rewrite rules to serve robots.txt, since I was sending 410 for every request. Within a day, the test site was gone from Google.

Getting delisted from Technorati has proven more difficult. I’ve been unable to find any instructions on the website. I tried using the ping form to have some posts re-spidered, knowing they would return a 410, but no change so far. I sent an email to support about a week ago, to which I’ve received no reply. A day later, all of the posts had dissapeared, only to return hours later. If anyone knows how to get delisted, please leave me a comment.

Every Old Problem is New Again

My recent redesign and switch to WordPress was started about 6 months ago, and was allowed to languish until a couple weeks ago, when I found the time to finish the project. As a result, I keep running into little bugs/issues that I should have caught before I launched- stuff I thought about 6 months ago, and forgot about until now.

One example is tweaking for search engines. A couple of years ago, I made some tweaks to my Blosxom templates to help search engines better index my site. I added post titles to permalink (single post) pages, to make sure Google, et al, show more than just “jclark.org” above every hit on my site. I also added <meta name='robots' ... /> entries to ensure that category and date archive pages weren’t indexed, only permalinks (and the main index page). Of course, I forgot to add these changes to my WordPress templates, and Google has recently reindexed me, so I’m back to square one.

I updated my header template (header.php) last night to get the post title back onto permalink pages. This was surprisingly easy, as WP offers a function aimed squarely at this purpose:

<title>jclark.org<?php single_post_title(' - ');?></title>

The function single_post_title will only output a value if the current page is a permalink page, optionally inserting a prefix (I use ' - '). This allowed me to update the header template used all across the site, without building my own switching logic. Because the entire html <head> section is in my header template, adding the robot meta directives will require a bit of switching logic; maybe I’ll check to see how single_post_title() is implemented and steal be inspired by that code.

WRT54G Warning

Before you buy the popular Linksys WRT54G Wireless Router, read this first.

I bought my first wireless router, a v1.0 Linksys WRT54G, around 3 1/2 years ago. At least I think that’s about right… the fact that it’s a v1.0, the original with the 20 LEDs on the front panel, means I’ve had it for a while. In early ’04, I switched to a Sveasoft firmware – this was before they began selling subscriptions for GPL’d software (but that’s another rant). It was a great little router on the Linksys firmware, and only improved when I put the custom firmware on it.

Unfortunately, when I returned from Vacation in early July, I found it had died. Brick City. Shrug… after 3+ years (and with boosted power output), it happens. I wasted no time riding down to the local Circuit City (closest retail outlet for such things) and buying a new WRT54G. What I didn’t know at the time was that in late 2005, Linksys released V5 of the router, which eliminated the Linux operating system in favor of a proprietary VxWorks firmware. This in turn allowed them to halve the Flash RAM and RAM to 2MB and 8MB, respectively. Until very recently, this router couldn’t run third party firmware. This problem has been solved, but the reduced memory limits the firmware to “micro” versions of the various 3rd party offerings.

When I got it home, I configured the Linksys firmware, and decided to give it a go for a little while before flashing a 3rd party firmware. At this point I still didn’t know I had a crippled router. Everything seemed fine at first, but after a couple of weeks, the wireless stopped working one day. I power cycled it, and everything returned to normal. I made a mental note to put OpenWRT on it, but didn’t have the time, and let it slide. A week later, the wired network stopped working, and then the web interface would disappear. Each time a power cycle would resume normal operation, but I was getting tired of the problems.

Of course, by the time I got around to trying to upgrade it, and learned what having a V5 really means, the 30 day return period had lapsed. I also learned that Linksys now offers the WRT54GL, and the L stands for Linux. It is essentially the WRT54G V4, running the Linksys Linux firmware, and with the original memory amounts. It’s targeted at people who want to hack the box, run 3rd party firmware, etc. Very Cool… except that I’m stuck with a craptacular V5.

As far as I can tell, the GL isn’t sold at retail, only online. I did see a report of someone who got one at Fry’s, but I’m on the East Coast, and Fry’s is a West Coast outfit. I found a handy serial number reference which lets you tell which version of the 54G is in the box without cracking the shrinkwrap, but these things are very popular, and I’m guessing my chances of finding a V4 or older in a local store are slim to none. I’ll try a couple places this weekend; it I can’t find one, I’ll be ordering the GL from Amazon.

I used to recommend the WRT54G to everyone; I gave my Dad one for Christmas 3 years ago. Even with the standard Firmware, they were reliable and affordable. Now, whether you think you’d ever load a custom firmware or not, I recommend getting a WRT54GL. I’ve read alot of reports online, and spoken to three co-workers with V5s, and my reliablity issues aren’t unique. The GL is currently $15 more (after rebates, at Amazon) than the $49 WRT54G at Amazon (either a V5, V5.1, or V6), but to me, the extra reliability, and extra flexability, are worth the price.

Once I have a V4 or a GL on hand and running OpenWRT, I may try running a mini-distro on the V5, and run it as an open access point, segregated from the rest of my network. I’ve been running everything open for years, but I think someone’s started hitching a ride. I don’t especially mind as long as the bandwidth doesn’t get excessive, but I don’t want to let the general public inside my firewall, so to speak. I’d like to get a GL running with MAC address filtering and no SSID (secure enough, for now, in the burbs), and run the V5 wide open, on a separate sub net, perhaps with bandwith throttling, and with some logging… just to see what passes through it. If/when I make that happen, I’ll post the details.

IE Display Glitch

If you’re viewing the site here in Internet Explorer, it’s pretty screwed up right now. In a nutshell:

  1. Get a new browser.
  2. Looks like the overflow rules I’m using for code samples (to add scrollbars) aren’t working in IE. I have some dim recollection of knowing there’s an IE bug around this; I’ll try to fix it tonight.
  3. No, really. Get a new browser.

Update: Got it cleaned up in IE, by adding width to the <pre> tag’s css. Improved the scrollbar bug issue using a tip from Browservulsel, but now my css doesn’t validate. sigh

Looking at the site in IE, I realized that I never went back and added box model hacks where needed. I’m tempted to leave it, but I did put alot of effort into the new layout, so I’ll probably try and clean it up this weekend, along with the css validation bug I introduced tonight.

The Permalink Problem

The conversion from Blosxom to WordPress began (in my head, at least), over a year ago, when I began to consider switching from categories to tags as a way to reduce the “friction” of writing. Blosxom is good at many things, but its filesystem based storage isn’t well suited for tagging. After exploring several possiblilites, I decided I’d move away from Blosxom; eventually I settled on WordPress.

The biggest hurdle I faced was dealing with permalinks. Blosxom supports two styles of permalinks: date-based and category based. I decided to go with category style permalinks (e.g., /weblog/Apple/macbook.html) when I first started using Blosxom because the URIs are “hackable”; you can whack the end (filename) off the URI and you’ve got the URI for the category. This worked fine when the site was category based, but fails with tags. For this reason, I’ve configured WordPress to use date based URIs (e.g., /weblog/2006/01/01/macbook/); I also decided to drop the “.html” bit since its not necessary.

However, Cool URIs Don’t Change. There are plenty of old links to my site out around the Internets, which use category based-permalinks, that I don’t want to break. Even the internal links within existing posts on this site will continue to use the old URIs, at least until I can get around to cleaning them up. I wanted to keep supporting these existing URIs, so I needed to make sure I can support the old permalinks.

WordPress supports category based permalinks, but with some caveats. If I configure the whole site to use category permalinks, then date-based URIs don’t work. If I configure the site to use date-based permalinks, category-based URIs don’t work. After searching for a plugin to help without success, I tried the WordPress forums. When that failed to turn up a solution, I poked around the code looking for a solution.

(A brief aside. If you want to explore the WordPress codebase, I recomment this excellent online cross-reference.)

I ended up creating a simple plugin that uses the “generate_rewrite_rules” action hook to add additional URI rewriting rules to the internal set used by WordPress to resolve each URI. I hope to make it available as a plugin someday when I have time to make it more generic; currently its hardcoded to solve my problem. Here’s the heart of the code, if you want to build your own version:

function add_permalink_style($rewriteobj) {
    $extra_rewrite = $rewriteobj->generate_rewrite_rules('/%category%/%postname%.html', EP_PERMALINK);
    $extra_rewrite = apply_filters('post_rewrite_rules', $extra_rewrite);

    $rewriteobj->rules = array_merge($rewriteobj->rules, $extra_rewrite);
}

add_action('generate_rewrite_rules', 'add_permalink_style');

To help me test everything, I tossed together a quick and dirty test suite, a simple list of links to test from my browser. The code above allows them all to pass.

Because my old permalinks all included .html at the end, I can use the rewrite rule above to strip it out. I originally was doing that with a mod_rewrite rule in my .htaccess file, but that caused problems for old permalinks to my category archives. Since the mod_rewrite rule was stripping the .html suffix before wordpress could see the URI, category URIs (e.g. /weblog/Apple/OSX/) and category-style post permalinks (e.g. /weblog/Apple/OSX/howto-install-carbon-emacs/) matched the same pattern, and WordPress thought the first example was for a post named “OSX” in the Apple category. I believe this is the same thing thats causing my tag URIs (e.g., /weblog/tag/wordpress/) to fail at the moment; the only workaround I’ve found requires a mod_rewrite RewriteRule, but only works with a browser redirect. I’m still working on this problem, as I really don’t want to use redirects. Also, for reasons I haven’t quite figured out, the above makes category permalinks work (and without a category URI prefix, see below), even though the rule expects a post name (slug) with .html appended- but I’m not going to argue with success.

Another issue I ran into was WordPress always wanting a prefix in front of category archive links. For example, my Apple category’s archive link (by default) was /weblog/category/Apple/. Even though my plugin’s extra rewrite rule seems to make URIs like /weblog/Apple/ work, I wanted the catgeory links on my Archive page to omit the extra prefix, for consistancy. WordPress allows you to change, but not omit, this prefix. I came up with a cheap hack for that problem; since I could already handle the URIs without the prefix, I only needed to change the URIs generated on the archive page via WordPress’ wp_list_cats() function. I was able to do this in my plugin by hooking into the list_cats filter:

function fix_category_links($content) {
    $content = str_replace('/category/', '/', $content);
    return $content;
}

add_filter('list_cats', 'fix_category_links');

It’s a hack, but it’s a hack that works.

At this time, I believe all the old permalinks from my Blosxom blog (both posts and categories) should work, as well as the new date-based permalinks. A key part of all of this was to import my existing Blosxom content while preserving the filename (slug in WordPress parlance), I’ll cover this and rest of the import process in a subsequent post. If you should find any links that don’t work, especially from external sources, please let me know. Now if I can just fix those tag URIs….

Converted

Well, I’ve (mostly) finished my converstion to WordPress. If you’re viewing this site in your browser, the theme you’re seeing is called Tranquility, and I created it about 6 months ago, when I first started trying to convert to WordPress. After a 6 month hiatus, it’s nice to finally show it off. Please leave a comment and let me know what you think.

If you’re reading this in your feed reader of choice, then you’ve successfully been redirected from the old rss feed, or the old Atom 0.3 feed, to my shiny new Atom 1.0 feed. Please come have a look at the website as well.

I’ve done my best to ensure that everything’s still here and still working, including old permalinks. I’ll have another post in the near future discussing the issues I had (and some solutions) with my existing permalinks; for now, please let me know by dropping a comment or an email (see the About page for my email info).

I’ve switched from hierarchical categories to tags; this is the first tagged post, but I hope to tag the older posts as well. You can still browse the old categories in the Archives.

I’ll have more to say about the conversion in the near future. For now, it’s late, and I’m done for the night.

Update: First bug- the tag links below don’t seem to be working. Oops.

This is My Final Post

…to the Blosxom-based blog I’ve run at this location for three years. In fact, my three year anniversary passed silently four days ago.

However, I’m not done blogging yet. As great as Blosxom is, I’m ready for something with less friction. I’ve decided to migrate this site to WordPress.

So what’s in store?

  • Existing posts will remain
  • Existing comments will remain
  • Comments will be reactivated (!)
  • I’ll publish my Blosxom-to-Wordpress conversion method/code
  • Date-based permalinks
  • Existing permalinks will work
  • The categories will remain as archives, but new posts will be use tags
  • I hope to get the old posts tagged as well
  • A brand new layout (finally!)
  • A valid Atom 1.0 feed (I had to hack this in, I’ll publish my code after the conversion)
  • Hopefully, I’ll start posting again!

The timeline’s not set, but I’m hoping to have everything done this weekend. There’s still one major technical issue to overcome, but I’ve asked for help in the WP support forum, and I’m poking around in the code. Stay tuned.