I’ve spent the last few days investigating Plone as a potential replacement for WordPress for the okcomputer.org web site, but, as is frequently the case when experimenting with new technology around here, I’ve been beating my head against the wall trying to get my Plone installation to work behind an Apache proxy. I could successfully pull up the main page’s content in my browser, but none of the Cascading Style Sheets or Javascript files were making it. The result was less than inspiring. So while I was waiting for the tornadoes to pass through tonight, I fired up my browser, tailed my log files and started beating on it.

First off, the mod_rewrite rule from the RewriteRuleWitch wasn’t matching. Fantastic. Here’s what it gave me:

RewriteRule ^($|/.*) \
http://127.0.0.1:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/okcomputer/VirtualHostRoot$1 [L,P]

The root document was matching, but nothing else was. After setting my RewriteLogLevel to 9, I saw that the URI as it was being tested against the regex didn’t begin with a /. So I removed the slash from the regex and added one to the substitution pattern:

RewriteRule ^($|.*) \
http://127.0.0.1:8080/VirtualHostBase/\
http/%{SERVER_NAME}:80/okcomputer/VirtualHostRoot/$1 [L,P]

Now the RewriteRule was matching, but the proxied requests were generating 400 errors on the Zope HTTP server. The obvious culprits were the spaces in some of the URL’s, specifically in URL’s containing the string “Plone Default”. My browser was (correctly) escaping the spaces as “%20”, but by the time mod_rewrite had processed the request and passed it on to mod_proxy the spaces were back resulting in a malformed HTTP request.

I found the fix for this last bit at Velo World. The trick is to define a RewriteMap and then use mod_rewrite’s built in escape function, like so:

RewriteMap escape int:escape
...
RewriteEngine On
RewriteRule ^($|.*) \
http://127.0.0.1:8081/VirtualHostBase/\
http/%{SERVER_NAME}:80/okcomputer/VirtualHostRoot/${escape:$1} [L,P]

And success! But what a pain in the ass! I’d love to blame mod_rewrite, but I’m sure there’s some valid reason it doesn’t re-escape substitutions by default. Instead I’ll blame Plone. Why? Why do you put spaces in your %$#@! URL’s. And given the number of pages on the web explaining how to set up Plone behind an Apache server with mod_rewrite and mod_proxy — including Plone’s own documentation — how come none of them mentioned this? Very frustrated, but the problem is fixed, the tornadoes have passed, it’s going on 2:00 AM, I’m going to bed.

UPDATE 2/14/2008: Special thanks to Sascha, who’s been helping me debug my RewriteRule issue.  The Witch’s rule should work, I just can’t figure out why apache is stripping that slash of the front of my URI’s.  I’m not using a RewriteBase, and the RewriteRule isn’t an a .htaccess file, so I just have no idea what the problem is.

For some unknown reason, I got vaguely interested in Gravatars this week. I’ll spare you the Google search — Gravatars are Globally Recognized Avatars. (And for you total lame-os, avatars are the little pictures next to people’s names in some forums and blog comments.) The idea is that you upload your avatars to gravatar.com and associate them with your email address (which just happens to be a globally unique identifier that you’ve probably already provided to most systems you use), and then services that are configured to use Gravatars can always pull your latest and greatest avatar from a central repository. Rocket science it ain’t.

PG GravatarG GravatarFirst, I set up a couple of Gravatars myself: one rated PG (I’m holding a beer), another rated G of me playing the ukulele at Ian and Christine’s wedding party. I’m not sure why I bothered as I don’t really post to any forums these days, but they’re there.

Next, I spent about three minutes setting up the Easy Gravatars WordPress plugin over on Kid Amnesiac. Man, does Easy Gravatars live up to its name! Not much flexibility, but a default setting that was perfect for my needs. (The only tweaks I made were to change the URL for the default image for missing Gravatars to one being served off my own server and then to set the default maximum-naughtiness rating to PG.)

Here’s the kicker: not a single person who has posted comments to Kid Amnesiac has a Gravatar. I checked ’em all. Nothing. I even posted a comment myself (since deleted) just to see if the plugin worked (it did). I figured at least one person (*cough* Diana *cough*) would have a Gravatar. Nope. None. So that was a bummer.

I’m leaving the plugin enabled in hopes that someone might read this and go nuts and actually set up a Gravatar. Please, make me feel useful. Oh, and I suppose I should set the plugin up for matthewwhitworth.com, too.

So ever since I pushed the new matthewwhitworth.com site into production Jessica has been bugging me about whether or not it was getting any hits. Although I kept telling her that I was giving it time and didn’t expect anything for quite a while, I was actually checking the web server logs much more frequently than I care to admit.

A few days ago I had done the old “google yourself” trick and was shocked at how much my sabbatical had caused me to drop off the Internet radar. I haven’t posted to Usenet or the Debian mailing lists for years.  My old web page had been down for months during the crash, and the content had been dormant for over a year. Really, what did I expect?

Anyway, about 10 minutes after Jessica checked in last night, I went to give my email one last perusal before bed (I wasn’t watching the logs — I promise) and sure enough, there was the first mail from my new Contact page, from old middle/high school associate Jay V. So that was cool — I hadn’t heard from him in almost 20 years. And since he was the first person to get in touch with me via the new site, he won an MP3 of “Barbed Wire”, a song by my first band, Sacrilegious Toejam. More on that later….

I got bold and decided to push matthewwhitworth.com into production today, and the bugs are already starting to shake out. The big problems seem to be in the theme I chose to use, miniBits. I liked it because of its clean layout and minimal graphics, but its small size also gave me the suspicion that some edge cases might not handle so well.

It turns out it’s more than the edge cases. About 15 minutes after pushing the site into DNS I noticed that the simple “view post” action produces invalid xhtml and displays the sidebar all wonky down at the bottom of the page.

So why didn’t I (or maybe the author) notice this earlier? Well, it’s only broken when you’re not logged in! I’ve been doing most of my development so far while logged in, either as myself or as admin, so the bug just wasn’t occurring. It’s also possible that he sidebar was off the bottom of my browser window and consequently I wasn’t seeing how broken it was when I was viewing the first couple of posts. Who knows? But now it’s gonna be out in the open for a while until I can fix it.

(Interestingly, the bug also doesn’t manifest itself at the demo site. The author freely admits that the theme has only been tested with WordPress 2.1 and hasn’t been maintained for a while. Could version compatability be the culprit?)

I also need to do a bit of Internationalization and Localization. The original author appears to be Italian, and the strings in the program are a mixture of Italian and English. That will actually give me a good “learn how to do something” project (as opposed to the more annoying “bug fix” project) .

So I’m pulling the theme code into bzr right now and getting ready to tweak. Hopefully, I’ll knock out the sidebar display bug tonight and get the site linked over to okcomputer.org so it can really go live.

UPDATE: I found and fixed the bug, and it’s a PHP classic: mixing your layout code inside conditionals. Down in the comments.php file I found two </div> tags were inside an if clause when they shouldn’t have been. A quick cut & paste moved them below the endif, and things are suddenly looking much better.

Hi and welcome to my brand spankin’ new homepage at my brand spankin’ new web site, matthewwhitworth.com. I’ve been on a roll for the last two weeks, building a new Ubuntu Linux server, rebuilding the Kid Amnesiac blog and totally rebuilding and migrating okcomputer.org, so I figured it was finally time to get this place off the ground.

My homepages have certainly evolved over the years — from static HTML back in 1995, incorporating bits and pieces of Perl hackery as I learned that language and the art of CGI, and finally culminating in a Blosxom-based semi-blog that died a slow death shortly after I moved back to Louisville.

After setting up the original Kid Amnesiac, I became interested in using WordPress more as a CMS than a blog*. As usual, I dawdled on that idea for quite some time, but I finally sat down and learned how to do it during last week’s okcomputer.org set-up. After that there was just no excuse, so today, in between bouts of baby-wrangling, I built the database, installed a fresh copy of WordPress 2.3.2, edited some custom page templates and banged out the first bits of content.

So here it is. I hope you like it. I hope I can make this interesting and/or useful.

* Not that I’ve got anything against blogs — I’m just remarkably bad at maintaining one.