waving android

I am currently a software engineer at Google, where as a member of the Android platform team I build frameworks and user interfaces.

The blog here at is mostly historical; you can find more recent posts on .

The past and future of dsandler.org. (Or, how I learned to stop worrying and love WordPress.)

November 21st, 2004

So, as you may have noticed, dsandler.org is now a WordPress site.

How did this happen? How did I, unrepentant DIY code junkie that I am, abandon my own code and pick up an off-the-shelf product? Worse still: How did I end up with another PHP web application, after swearing an oath of fidelity to Python?

To understand this, you have to go back to 2001, when I converted my stardot homepage into one of those newfangled “weblog” things. The funny thing about weblogs, of course, is that they’ve existed for eons, except they were just called “news pages” or “.plan files”. (Yeah, that’s right, that’s how we did it back in the nineties. Were you even in college in the nineties, gentle reader?)

The difference, though, when you create a weblog, is that you’re making a promise to update it now and again. It could be said that what defines a blog is not the format, but the frequency, and what most affects the frequency is the tool: the advent of accessible publishing frontends (including the pioneer, Blogger, and to a lesser extent UserLand Manila née Frontier). With a simple UI for prepending your webpage (as opposed to editing the whole thing, wiki-style), the tempo of a “news page” can really pick up, turning it into a blog.

So, it’s July of 2001, and the decline of my employer, Be Inc., has just entered the really steep part of its decline. It occurs to me that when things go sour at work, it makes for great reading, so I take my first steps into baldest vanity and decide to go blog. (You never, it turns out, go back.)

I built a Bourne shell script, diary-new, that would open my $EDITOR and save the result to a new file in an entries directory. I hacked together a quick index.php which would scan this directory, sort the files by their modification date, and spew their contents in reverse-chronological order. I shortly thereafter built diary-edit, which would allow me to tweak a file without also changing its modification date, and diary-mail-filter, a script to be called from Procmail so that I could blog-by-email.

Pretty much all of this was in place by the fall of 2001. [Tangent: Of course, it turns out that—surprise, surprise—you can't say anything really interesting in public about your company while you still work there. (It appears that not everyone has learned this lesson, years later.) So the early entries (from the first couple of months) are pretty vague sorts of half-stories leaving out all the interesting parts. Of course, it's not like we were all suddenly free to reveal our dirty corporate secrets once we started at the new place; Palm, Inc. was more regimented than Be in just about every way, in part because people actually cared what happened to Palm. Loose lips might really sink something over there! Although we did succeed in loosening the place up a bit, in the end. But I digress.]

As is the case with any temporary kluge, the shell and PHP scripts stuck. When I moved to a vanity domain from stardot, I took the opportunity to build a few new tools for the site. I had recently discovered a deep and lusty affection for Python, so I rebuilt the blog-by-mail engine using the rfc822 module, and added a search feature. More and more scripts cropped up, too (an RSS 1.0 feed; some automatic image-scaling code for posts with photos attached), and dsandler.org grew organically into the green (then white) site I came to know and love.

And hate. Boy, did I hate it. After a few hundred posts, the scan-a-whole-directory thing hit its first major hiccup. The Linux host didn’t like directories with so many files, so I created a new filing technique in which entries were stored in a subdirectory named for the first byte of the MD5 hash of the filename (e.g.: diary_1003.html moves to data/aa/diary_1003.html). This helped for a while, but after a few thousand posts, the time required to extract modification times from all those files became ridiculous (on the order of 30 seconds). Yes, that’s right, 30 seconds to load the front page of the blog. Bad idea.

The dsandler.org pagecache was born. Any page I wanted to speed up would be wrapped by cache_begin() and cache_end() tags; the dynamic cache would test the modification times of the data directories to see if anything had changed, and if so, render the whole page (slowly!), saving the output in a database blob at the same time it was sent to the user. The next user (assuming nothing had changed on disk) would see the cached version, pulled rapidly out of the DB. [The diary-new scripts were updated to force a reload on the main page after a new item was posted, so readers almost never saw the full delay.]

Other things about the site annoyed me to no end. I could write new entries by email, but I had to log in interactively to edit them. I developed a simple Web-based posting form, but it just wrapped around the email interface (!) and so there was no way to know, a priori, what the URL of the new entry would be (it would be assigned at creation time, once the email was received). This made things like Trackback impossible (no way to know the final URL of the referring document). Oh, and the magic pagecache? Only used on the front page and the RSS feed. If you made the mistake of clicking the “N previous entries” link, welcome to Slowtown. (That was just a terrible way to browse the archives, as well.)

In short, weblog technology moved on way beyond my bubble-gum-and-twist-ties implementation. Even my other web projects blew dsandler.org away; the weblog and TV episode guide site I built for Erin is fully database-backed, has a fancy calendar-based archive, etc.

I decided to revamp dsandler.org, top to bottom.

Oh, this was about two years ago. Did I mention that?

I vacillated between writing my own implementation (in Python, natch; PHP’s API is so huge and hideous that it appears to have been assembled by a hundred monkeys, sitting at keyboards, each equipped with the Perl man page and an amphetamine tablet) and pulling something off the shelf. I had had a good experience with b2/cafelog—and ended up using it for an internal weblog at PalmSource—but really wanted to stay away from PHP (and Perl for that matter).

I also wanted to cleave to the simplicity of the original dsandler.org: files in directories. Clearly this led me to Rael Dornfest’s blosxom, and its Python-language cousin, pyblosxom. I tried out blosxom (again, at work) and discovered quickly that, as a side-effect of being simple, it was also simplistic. It just didn’t do a lot. Even after adding a bunch of third-party plugins, it still didn’t really have very many features. I figured I’d have to start writing my own plugins, and so, preferring to write code in Python when I can, I focused fully on pyblosxom.

This summer, I set aside my five or six half-implementations of a new pure-Python weblog package, and set about making pyblosxom work. I was able to build (roughly) the new dsandler.org design you see here without too much trouble, including some code tweaks (so I’d have the right data around in my page templates). I knew I’d have some more hardcore plugin writing to do in order to build some of the fancier features I had imagined (including something as simple as next-day/previous-day links, which are hard in the pyblosxom architecture), but I’d gotten the site to a point where I wanted to fill it with data and make it live. As soon as I wrote a script to import the old dsandler.org entries into pyblosxom, I discovered that I had a new problem.

Actually, it was an old problem.

The blosxom variants have no caching, no by-date indices, no data structures of any kind to reduce the dependency on recursive descent of all files in all directories. I consulted the various (py)blosxom websites; surely there must be other installations out there with thousands of entries. Those sites would show the same sorts of performance problems, and their owners would have found workarounds, right? Apparently not: I was back where I started, waiting thirty seconds for a page load. (Longer, actually.) I might as well have stuck with my own PHP and shell scripts.

It seems that most blosxom users with more than a few dozen posts just render their weblog pages to static HTML! (That is, they re-run the blosxom application after each change, and it combs the filesystem creating static HTML pages for every possible view of every category, date, individual post, etc.) Ridiculous—we’re back to Frontier, now, emitting a pile of HTML and FTPing it to a webserver. No. Fricking. Way.

Deflated, bruised, despairing, I decided that my problem was simple: other people’s software sucks. I spent another few months, banging around with custom Python indexing routines and templating code. But my spare time was getting thinner and thinner (now that I’m back at school), so I did the unthinkable: I went back to PHP.

I took another look at b2, now called WordPress. Matt Mullenweg, unlucky at cards though he may be, seems to have some luck with weblog software: WP has gotten rave reviews, and new installations seem to crop up everywhere.

But it was PHP! But it required MySQL! These things vexed me still.

And damn if it doesn’t work. From a features standpoint, WP includes fifteen different kitchen sinks, but the administrative UI is totally manageable (and the template functions are reasonable, if not always totally consistent) . The third-party developer community is active and prolific, and I quickly found an implementation of almost every feature I had imagined for the site (including next-day/previous-day links). And after a little time with the PHP code, I became pretty comfortable that I’d be able to hack together whatever I needed if I couldn’t find it elsewhere.

Total time to convert an old pyblosxom design into a new WordPress design, including a new article import scheme (thanks to WP’s RSS import this wasn’t too hard, though I did fix a few bugs in import-rss.php), a custom linkrot-curing script (so the old /entries.php?NNN links still work, despite the fact that the new version of each link includes the date and WP-sanitized title, so there’s no direct conversion), full data transfer from dsandler.org, and testing/tweaking: six hours.

That’s a big deal. Matt should be proud of what he’s created, and I am proud—or will be, eventually, honest—to have finally given in and embraced someone else’s weblog software.

8 responses

  1. a million monkeys typing » dsandler.org: Its past & future  

    [...] would form a million monkeys typing. Now, there’s a new entry over at dsandler.org: The past and future of dsandler.or [...]

    comment posted at 5:09 pm on 27 Nov 2004

  2. Guess and Check  

    Dan stops worrying
    dsandler made the switch to WordPress.

    Very nicely done.

    comment posted at 6:02 pm on 22 Nov 2004

  3. Glofton  

    Why WordPress?
    Dan Sandler switches to WordPress, and sums up nicely what’s so good about the software:

    It just works.

    I, too, have been dabbling with all sorts of gargantual web application frameworks, CMS systems, simple blogging applications, everything. Ye…

    comment posted at 3:56 am on 25 Nov 2004

  4. a million monkeys typing  

    dsandler.org: Its past & future
    Most people that start off blogging seem to arbitrarily choose whatever solution they trip across first, or whichever one seems like the least work. I actually started a “home-grown” solution via Flash and XML, which worked fine after I figured out s…

    comment posted at 11:09 am on 27 Nov 2004

  5. Anonymous  


    Writing blog software can be tough…

    comment posted at 1:01 am on 07 Jan 2005

  6. Taking Your Camera on the Road » WordPress and Other Blog Details  

    [...] 17;s How to Build Blog Traffic for Newbies DSandler’s How I [...]

    comment posted at 9:38 pm on 30 Mar 2005

  7. Emil Sit » Colophon, the beginning  

    [...] I’ve been thinking about having a blog for a while and now here I have one with my own domain name running on outsourced hosting. That doesn’t really seem like me–I usually like to have more control–but I think Dan Sandler has really summarized the whole argument: it’s a lot of work to have featureful blog software and if someone else has done it, well, that’s less time spent building scaffolding. [...]

    comment posted at 8:50 am on 16 Mar 2006

  8. toastup! ≈ archives » Colophon  

    [...] The toastup! blog is powered by WordPress, which I have been using since 2004 (earlier still if you count b2). The blog’s current (2007) design is based heavily on the ubiquitous Hemingway. The typefaces used in the original “toastup!” logotype are ATF Antique (the slab-serif freefont used in the toastycode logo) and Avenir.  The toast depicted is whole wheat bread, toasted to a level 3 darkness in an Oster two-slice silver toaster oven, spread with orange marmalade. [...]

    comment posted at 9:40 am on 10 Jun 2007

newer: older: