Press "Enter" to skip to content

Category: Navel-Gazing


Now that my MT -> LJ bridge is finally working the way I want it to, I’ll take the time to do a little documentation.

The basic architecture is as follows. I have an MT template containing a verbose RSS .91 feed, which is an index template, so the page it produces is rebuilt every time I post. I added a CGI script residing on my server to the list of URLs to ping when my blog is updated. The CGI runs blagg (an RSS aggregator) with the LiveJournal plugin, which pushes the post to my LiveJournal.


Blagg is not a very smart parser; it expects the RSS tags to come in a certain order. Specifically, it requires first <title>, then <link> then <description>. As it happens, this is not the order in which the default MT RSS .91 template presents the tags, so I had to modify a copy of the template to put things in an order blagg would understand. I also expanded the description field to contain the entire post, since I wanted people to be able to read the full entry without leaving the LJ page. Finally, I replaced encode_xml=”1” with encode_html=”1” throughout the template, since encode_xml encodes some characters in a way that most browsers won’t understand. Specifically, IE can’t make sense of &apos;.

My CGI script looks like this:

#!/usr/bin/perl -w
use strict;
use XMLRPC::Transport::HTTP;
my $server = XMLRPC::Transport::HTTP::CGI
-> dispatch_to('weblogUpdates')
-> handle
package weblogUpdates;
sub ping {
`/home/durrell/bin/ &`;
return "OK";
} is this:

while [ $i -lt 5 ]; do
if [ ! -e $lockfile ]; then
touch $lockfile
$blagg $plugin $mode $login
rm $lockfile
sleep 60
i=$(( $i + 1 ))

Why a separate script? Because in case I run into a lock, I don’t want the CGI to sit around waiting for the lock to vanish. Also, I intend to put a five minute delay in there to give me time to edit a bad post before it hits LJ.

Why the REQUEST_METHOD= bit? Because blagg processes its command line switches with This is a very clever method of processing arbitrary switches in an elegant manner, but if REQUEST_METHOD is set, then won’t look for parameters on the command line. So I have to unset it somewhere. Getopt::Long really ought to have a method for processing arbitrary switches, but that’s a rant for another post.

Finally, since I’m using version 1.0 of the livejournal plugin, I had to edit the plugin a little to make it set the preformatted flag for posting. I also tweaked it a little to store the password in the plugin itself, since I don’t like the idea of exposing the password on the command line (and thus in the process table). Version 1.1 of the plugin allows you to specify preformatted mode with a command line switch, but I haven’t upgraded yet.

Time to make the donuts

I’ve upgraded MovableType to the just released 2.5. Looks good. Perceptive people will note the search box on the left (for the fancy-pants version of the blog) or below the main title (if you’re reading the plain version).

Edit: I have also made a couple of small tweaks to the alternate view section of the sidebar. You don’t care about those but I wanted to point them out so that I could say “There’s one additional change I made; prize to the first person to notice it,” and not have people say “You added another syndication option.”

Big Dig

After much twiddling around, has moved and is now served off my shiny semi-new OpenBSD box in Somerville. Making new entries just got a lot faster; at some point I’ll try mod_perl again and see if that doesn’t speed up as well.

DNS hasn’t propagated as I write this, but it will in a few hours. And I suppose if you’re reading this, you know it’s propagated.

Let’s see. The new server is now my primary nameserver, and I’ll be letting the registrars know that next. The last piece is email (also probably the most nervewracking piece). Woot!

Need for speed

My DSL is up and running, a day early (and less than a week after I ordered it). Even happier, the speed is up to snuff — a quick test suggests that I’m getting 1280/585Kbps speeds, which is darned close to the 1500/786Kbps I was promised. Since the test server is in LA, I’m not going to worry about the lossage. It’s certainly much faster than my Pacifica PacBell speeds.

Now, if only my things had shown up today as promised… but ah well. The new should be here tomorrow, and as soon as my OpenBSD CDs arrive I’ll get the thing up and running. Mmm, faster server.

Tenth Avenue Geekout

Major geeking out, here.

This is a test of my hacked up Movable Type to LiveJournal bridge. I’m using blagg (a good RSS aggregator) with an LJ plugin to do the dirty work; the hacked up part is a) a modification of the default MT RSS .91 template so that the description field includes the entire entry, and b) a modification of the LJ plugin so that it sends the entry to LJ as pre-formatted text.

I beg of you to be patient while I make this work. When’s all said and done, entries in my blog will propagate to LJ hourly. The reserve will not be true, and comments will not propagate. Extended entries may be odd. I’ll work that out the next time I post one; I think the temporary hack will be OK for now.

Alive, healthy, no wiser

Landed in Boston successfully, and currently tapping away at the keys of my iBook in my brand-new apartment. Well. New to me, anyhow. Earthlink came to my aid in time of need, thus the connection. Later I expect pizza.

Could be worse!

Pictures of the new place may come at some later date. Updates will continue to be sporadic until I get the real network in here, mmm mmm good.

Home stretch

Almost all packed, which is a darned good thing considering that the movers are showing up in about 12 hours. It’ll be down to the wire, yep.

Posts will be very sparse for the next little while.