Topic: Geek

The next better thing since Google Browser Sync

I’ve been using the Firefox 3 beta exclusively for about two weeks now and I’m very, very happy with it. It’s both faster (not surprising in a beta) and more stable (surprising in a beta). The only real issues I’ve had a couple of websites that have problems (the graphs at MonitorSite don’t appear, for instance) and a couple of plugins that don’t work. None of those are essential… except for Google Browser Sync.

GBS: The. Greatest. Plugin. Ever.

Automatic syncing of bookmarks, history, and (most conveniently) passwords and cookies is a godsend if you work on multiple computers. Combined with a little FolderShare magic1 to sync your plugins and settings and you rarely have to open a browser and see an unfamiliar interface again.

But GBS hasn’t been updated to work with Firefox 3. That, in itself, isn’t very surprising… it would make sense for a plugin developer to wait for at least RC1, especially since the new Places architecture for bookmarks and history would require a lot of changes in sync product. It’s more troubling that, despite much heated discussion, Google hasn’t even confirmed that they’re working on an update.

Maybe there won’t be a new GBS. Perhaps it was someone’s 20% time project, and that someone has since cashed out and moved to Amsterdam and stopped caring about browser plugins. Luckily, that doesn’t matter anymore, because now we have Weave.

Weave is going to be Google Browser Sync shot up with HGH… the Roger Clemens of plugins, minus the underage country singers2. The plan is to allow you to sync to any device, any browser, even any application, and more. Plus, it’s open source, so there’s no chance it’ll become popular and suddenly disappear.

Currently it’s not perfect. It only syncs bookmarks and history (with cookies in alpha and passwords in the planning stages), and it throws a lot of errors. But it does work, and on the first Weave conference bridge we learned the extent of the team’s short term goals:

Feature set being targeted for Weave 0.2 (June 2008):

* Streamlined first run and setup
* Real-time sync
* Additional data-types

  • Tabs and Windows
  • Saved Passwords
  • Saved Form Data
  • Search History

* Bookmark folder sharing between users
* Simple web-based interface for users to gain read-only access to their bookmarks

By next month it’ll do everything GBS did and a little bit more. Imagine what it’ll do by next year.

  1. Sometime soon I’ll share my own special way to sync browsers… I have to use a combo of FolderShare and SyncToy to avoid a few problems with FolderShare not wanting to sync open files. []
  2. This is an assumption, of course. Underage country singers are not currently on the features roadmap. []

Popularity: 46% [?]

Movable Type to WordPress without losing your permalinks

So you’d like to upgrade to WordPress from Movable Type? It’s not very hard… if you’ve always had the same permalink structure. But if you’ve gone through the MovableType versions from 1.5 to 2.x to 3.x and finally to 4.1 (like me) then you’ve probably been through a couple of URL scheme revisions.

In my case, I started out with Movable Type’s default (and, at the time, only) permalink structure… post ID (a six digit number) followed by .html in the archives directory to avoid cluttering up the top one. It looked like this: “http://tbotcotw.com/archives/000334.html.” Of course, from there I switched to .shtml, then quickly to .php, and when MT finally supported it, permalinks based on the post name (all the words with underscores replacing the whitespace). At around the same time I read Mark Pilgrim’s excellent post on cruft-free and future-proof URLs in Movable Type. I’d finally found a URL structure that (I thought, it turns out that the underscore was a bad idea) would stand the test of time: post name with underscores for whitespace and no extension.

This was exasperating, though, since switching to a new URL scheme in midstream meant that my permalinks were now not very perma. I was getting lots of 404s because people had linked to a URL that didn’t exist anymore. And that was hurting my Google page rank. I considered fixing the problem by publishing a page with a php location header that would redirect from the old URL to the new seamlessly (using a 301 error code). But actually building those pages statically slowed down the already miserably slow interface to MT (my server is a piece of crap)… comments would take over a minute to be published when two or three individual entries and two category archives had to be built. So I had to wait until MT caught up and allowed dynamic publication, then I created a new archive mapping for the old URL structure and MT would automatically serve a page with the location header whenever a browser requested an old page. Pretty hacky, but it worked very well.

Fast forward to today and I still get hits on old posts from links that someone wrote in 2002. I wanted to duplicate my redirect scheme after I switched blogging systems but neither the MT export nor the WP import pays any attention to post ID, so I hacked both of them as I mentioned here. I had to use an old (2.1?) version of the import script in WordPress, but it worked just fine. Then I built a series of mod_rewrite rules to redirect from every one of the many URL structures I’ve ever used:

# Convert old archives
RewriteRule ^/archives/([0-9]*)\.php$ /$1/ [R=301,L]
RewriteRule ^/archives/([0-9]*)\.html$ /$1/ [R=301,L]
RewriteRule ^/archives/([0-9]*)\.shtml$ /$1/ [R=301,L]
RewriteRule ^/archives/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.php$ /$1/ [R=301,L]
RewriteRule ^/archives/old/([0-9]*)\.php$ /$1/ [R=301,L]
RewriteRule ^/archives/cat_(.+)\.php$ /category/$1/ [R=301,L]
RewriteRule ^/archives/cat_(.+)\.html$ /category/$1/ [R=301,L]
RewriteRule ^/archives/cat_(.+)\.shtml$ /category/$1/ [R=301,L]
RewriteRule ^/archives/?$ /archive/ [R=301,L]
RewriteCond %{REQUEST_URI} !^/archives/[0-9][0-9][0-9][0-9]/[0-9][0-9]/?.*$ [NC]
RewriteCond %{REQUEST_URI} !^/archives/[0-9][0-9][0-9][0-9][0-9][0-9]\.?.*$ [NC]
RewriteCond %{REQUEST_URI} !^/archives/tag/.*$ [NC]
RewriteCond %{REQUEST_URI} !^/archives/author/.*$ [NC]
RewriteRule ^/archives/(.*)$ /category/$1 [R=301,L]
RewriteRule ^/archives/(.*)$ /$1 [R=301,L]

This converts the old “/archives/000334.html” format to “/000334/,” changes “/archives/cat_blog_business.html” (another legacy MT convention) to “/category/blog_business/,” and removes the “/archives/” from every other URL. At this point the numeric requests are handled by a plugin called Permalink Redirect. Just put “%post_id%/” in the old permalink structure field and blamo… no more 404s, everybody who clicks an ancient link is sent to the correct post.

The next problem was the MT underscores to WP hyphens issue. It’s actually a good idea to use hyphens… Google doesn’t recognize underscores as whitespace (yet), so you’re destroying a source of relevant keywords if your URL is a big_string_like_this. On the other hand, big-string-like-this then gets your page in the index with those four keywords, raising your page rank. I quickly found that, in most circumstances, WordPress automatically converts underscores to hyphens. Only when the URL has something after the title, like in “/2008/04/big_string_like_this/feed/,” or if a category is involved, does WordPress fail to convert. Perhaps I should take the time to fix that in the code… until then, I’ll use these mod_rewrites:

# Change underscores hyphens
RewriteRule ^/category/([^_]*)_([^_]*)_([^_]*)_(.*)$ /category/$1-$2-$3-$4/ [R=301,L]
RewriteRule ^/category/([^_]*)_([^_]*)_(.*)$ /category/$1-$2-$3/ [R=301,L]
RewriteRule ^/category/([^_]*)_(.*)$ /category/$1-$2/ [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_([^_/]*)_([^_/]*)_(.*)/(.+)$ /$1/$2-$3-$4-$5/$6 [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_([^_/]*)_(.*)/(.+)$ /$1/$2-$3-$4/$5 [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9])/([^_/]*)_(.*)/(.+)$ /$1/$2-$3/$4 [R=301,L]

This will ignore the underscores (and let Wordpress handle them) unless it’s a category or there are characters after that last slash. Finally, I had to move all my syndication feeds to the new structure:

# Change to wordpress feeds
RewriteRule ^/atom$ /wp-atom.php [R=301,L]
RewriteRule ^/atom\.xml$ /wp-atom.php [R=301,L]
RewriteRule ^/index\.atom$ /wp-atom.php [R=301,L]
RewriteRule ^/index\.rdf$ /wp-rdf.php [R=301,L]
RewriteRule ^/index\.xml$ /wp-rss2.php [R=301,L]
RewriteRule ^/rss\.xml$ /wp-rss.php [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.atom$ /$1/feed/ [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.atom/$ /$1/feed/ [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.xml$ /$1/feed/ [R=301,L]
RewriteRule ^/([0-9][0-9][0-9][0-9]/[0-9][0-9]/.*)\.xml/$ /$1/feed/ [R=301,L]

Nothing complicated there.

Then I found one more problem. Movable Type makes sure that permalink slugs are globally unique, and posts with the same titles get tagged with “-1,” “-2,” etc. WordPress doesn’t care if they’re globally unique, as long as they’re not in the same month. So I had to watch my logs for 404s, then go back and rename the posts. At this point the Redirection plugin was invaluable. It automatically builds a 301 redirect from old name to new when you retitle a post… so I could change all those post names back to the Movable Type default without worrying about blocking new links that pointed to the WordPress format.

I was going to go into a discussion of the relative benefits of dynamic vs. static publishing, and what a wonderful plugin WP Super Cache is, but this post has run on way too long, so that will have to wait for another day. Until then, here’s an interesting discussion on the subject.

Popularity: 56% [?]

5G iPod version 1.3

Apple just recently released firmware version 1.3 for the 5G iPods. Of course, since it is Apple, the release notes just say “bug fixes” without bothering to say which bugs were fixed. Well, one of the bugs they fixed is pretty damn cool.

One annoying thing about the iPod (and, for a long time, iTunes did the same thing) is that albums are sorted alphabetically under the artist name. So for the Beatles you end up seeing Abbey Road before Please Please Me. That just doesn’t make any sense. Some people fixed this by putting the year in front of the album name on every album, but then you end up with albums like “1969 - Abbey Road,” and that just looks lame.

So Apple eventually added “Sort Album” and “Sort Artist” tags to iTunes. With these you could see Abbey Road but sort via “1969 - Abbey Road,” and show “Elvis Costello” but sort via “Costello, Elvis.” But, since this is Apple, they didn’t implement it very smoothly. The “Sort Artist” tag worked on the iPod from day one, and when the iPhone and the iPod Touch and Classic came out all of them supported both tags. But us 5G owners were stuck with alphabetically sorted albums (I know, horror, right?).

But now, with version 1.3, the original iPod can do the same thing. Here’s a bit of a tutorial (scroll to the last message) on how to update your “Sort Album” fields using Mp3tag (for some reason iTunes won’t let you update a bunch of songs sort fields at once without going through a bunch of rigamarole). Note that I couldn’t get the Mp3tag directions to work in version 2.4, but I did get it to work in one of the 2.39alpha versions a while back… perhaps I’m just doing something wrong or maybe there’s a bug they’ll fix soon.

Popularity: 16% [?]

Cool Cisco Commands, #1

Matt, how can I tell what interface in a port-channel a 7600 will use to transmit a packet? It’s easy!

router#remote login switch
Trying Switch …
Entering CONSOLE for Switch
Type “^C^C^C” to end this session

router-sp#test ether load int port 10 ip <source> <destination>
Computed RBH: 0×3
Would select Te6/4 of Po10

(This assumes that you’re using the default for etherchannel loadbalancing, i.e., source and destination IP address.)

Popularity: 8% [?]

Server upgrades

I’m working on upgrading my web server to Fedora Core 5 and MovableType 3.31. The first step was to upgrade my mail/DNS server to FC5 and then move all the web stuff to it, both to cut down on downtime and to prove that I could keep both servers ready to run all services at all times in case I have a catastrophic failure on either.

That step is complete, you’re now seeing TBOTCOTW running on MT 3.31 and FC5 on the backup server; that’s why it might seem a tad slow (especially commenting), my mail server is quite a bit older than the primary web server. Other than that the switch should have been pretty much seamless.

If you’re seeing any issues, please let me know.

Popularity: 10% [?]

Fixing <MTEntryModifiedDate> in dynamic templates

According to the Movable Type support desk it’s a known bug that <MTEntryModifiedDate> sometimes returns the original publishing date rather than the modification date when used in a dynamic template. I think this must be a regression of the same bug from 2.661 mentioned here, but now it only affects dynamic publishing.

Luckily, the fix is much easier to implement this time. Simply backup /path/to/mt/php/lib/function.MTEntryModifiedDate.php and then edit it so the file looks like this (or download the whole file):

<?php
function smarty_function_MTEntryModifiedDate($args, &$ctx) {
    $e = $ctx->stash('entry');
    $args['ts'] = $e['entry_modified_on'];
    return $ctx->_hdlr_date($args, $ctx);
}
?>

I should probably understand this sort of stuff better (you did backup your current file, right?) before I go hacking around, but I figured that my <MTEntryDate> tags were working correctly in my dynamic templates. Why not just copy the code out of that PHP file (function.MTEntryDate.php), change ‘entry_created_on’ to ‘entry_modified_on’ and see what happens?

Whadaya know, it worked! (With no ill effects, knock on wood.) Now my dynamic Atom feeds have the correct date in the updated field.

Popularity: 6% [?]

Fixing <MTSimpleCommentCount> so it works outside <MTSimpleComments> in dynamic templates

Like my last post this is a small fix to a problem with the PHP implementation of the SimpleComments plugin. The original perl code allowed the use of the <MTSimpleCommentCount> outside of SimpleComments tags. This is really useful if you want to output info on comments or trackbacks based on how many there are. In my case I want the updated timestamp on my individual Atom feeds to match that of the most recent comment or trackback, but if there isn’t any feedback yet, the timestamp should match the modified date of the entry itself.

For some reason (and I don’t know enough about writing PHP plugins for Movable Type to tell you why) the “official” PHP version of SimpleComments returns null if you try to do this. Luckily kate at geekmum noticed the same problem and figured out that installing one file from Rad Geek’s PHP port fixes the issue. So download that package, and copy function.MTSimpleCommentCount.php to /path/to/mt/cgi-bin/php/plugins/ (make a backup of your original function.MTSimpleCommentCount.php, first). Now you can find the total comment and trackback count in dynamic templates to your heart’s content.

One caveat: I believe the official PHP port allows comment counts to be accessed outside the context of a single entry, but Rad Geek wrote his port before that was a feature. So if you’re using SimpleComments to pull a blog or category-wide comment count in a dynamic template, this “fix” will probably break that.

Popularity: 6% [?]

Making SimpleComments aware of TrackBack junk status

Adam Kalsey’s SimpleComments plugin for Movable Type was written long before MT allowed comments and trackbacks to be marked as unpublished, so in its original version it will output junked and moderated feedback. It was also written before MT had dynamic publishing, so of course it didn’t support that, either.

Luckily Brad Choate quickly added dynamic support to the plugin, and recently Joe D’Andrea released a patch that made the static half recognize junk status. So all I had to do was combine the two fixes to make SimpleComments compatible with dynamic templates and junk status aware. Directions follow.

1. Download and install the original SimpleComments package (this includes Brad’s code for dynamic publishing).

2. Apply Joe’s patch to SimpleComments.pl.

3. Apply the following patch to /path/to/mt/php/plugins/block.MTSimpleComments.php:

147a148,149
>     if (isset($args['visible']))
>         $moderation_filter = "and tbping_visible = 1";
153a156
>                $moderation_filter

Or you can just download the patched file and copy it over the original.

Now your combined lists of trackbacks and comments won’t show junk, even if the list is part of a dynamic template. This will be important if you want to follow my directions (post coming soon) for creating dynamic Atom feeds for individual entries.

Popularity: 7% [?]

Everybody’s gotta know sometime

Googlewhack!

Well, it’s not really a googlewhack at all, since there are results for it. Just not as an exact phrase. I misheared the lyric, again. It’s actually, “Everybody gotta learn sometime.”

Popularity: 5% [?]

Various PageRank™ oddities

The PageRank checker I’ve got in my sidebar stopped working for a few days, so I downloaded this PageRank extension for Firefox. It works really well, but I found some weird stuff while playing around with it.

First, the homepage of TBOTCOTW has gained in rank (from a five to a six) at the same time that it’s dropped from the first to the fourth search result for “Matt Moore”. How does that happen?

Second, AdActors.com has a rank of four, yet barely gets any traffic at all. The site has 544 visits this month, with only 127 of those off Google searches. Also, how in the heck did it get a four, anyway? The only links to it are from TBOTCOTW, The World Wide Rant, and ResurrectionSong. I don’t think three links from sites that all have a PageRank of six should equal a PageRank of four.

Finally, the most bizarre oddity of all. Why does Vodkapundit have a rank of zero? Steve gets four thousand visits a day, there must be at least one hundred links to his site from high traffic blogs, and it doesn’t appear that he’s blocking the GoogleBot (he doesn’t have a robots.txt file or any meta tags that would block the scrapers). Very strange, and if Steve had ads on his site, it would be a real drag on his revenue.

Popularity: 5% [?]