05.10.06

wp-cache

Tagged as

I wanted to speed things up a bit, so I looked into cache options for WordPress. Supposedly WordPress 2 (which I am using) has a built-in cache, but either it’s not working or it’s just not very effective, because this site was running a lot slower than I wanted it to.

There’s a plugin called wp-cache that I’d tried before but decided against because I was using some other plugins that shouldn’t be cached, such as wp-scrobbler. Since I’m no longer using those plugins, I decided to give wp-cache another try. Immediately, however, I ran into some problems, foremost of which was the fact that the first time I loaded any given URL, I got a blank page. Subsequent reloads were fine. Turns out the problem has to do with running the plugin under WordPress 2.0.2 on PHP 5; that combination apparently doesn’t work in the default setup. There is a fix, but it’s buried in the comments (#183, to be precise), so I figured I’d repeat it here in case any of my readers run into the problem.

To fix the problem, open up wp-cache-phase2.php in the wp-cache folder, find the wp_cache_ob_end() function definition, and change the ob_end_clean() function call to ob_end_flush(). In version 2.0.17 of the plugin, which is current as of this writing, the line that needs to be changed is #219.

The plugin makes a huge difference in response time, and should also make your web host happy, since it requires less CPU time and fewer database calls.

05.08.06

Moving

Tagged as , , ,

No, I’m not moving, but this blog is. Actually, it’s already moved.

For the past several years I’ve had a dedicated server to play with—I’ve gone through three different companies, run a small (read: unprofitable) hosting business, and learned a lot about server administration. Now it’s time to downsize.

There are some major changes happening in my life right now—most of my readers already know about them, I think, so I won’t go into them here—and I’ve decided to move to a shared server to save both time and money. I decided on DreamHost because, for the money, they come closest to what I and my friends, family, and clients have become accustomed to. In fact, for a fifth of what I was paying before, we’ll get the same amount of disk space and twice as much bandwidth—and still get all the useful software installs like SpamAssassin, MySQL, and WordPress. Most importantly, the whole thing will involve a lot less work for me. No longer will I need to deal with keeping software up-to-date, for example—a chore on which I’ve consistently fallen behind of late.

The site may not always respond quite as quickly, since we’re now sharing CPU time with whoever else happens to be on our shared server, instead of about a dozen relatively sleepy domains on a ridiculously overpowered server for our meager needs. So far, however, I’ve been pleased with the responsive and intuitive account control panel, and have had no major problems with the transition of my domain from the old host to the new one.

If your site is hosted with me, expect to get an email soon detailing when your domain’s transition will take place and what configuration changes, if any, you’ll need to make. I think in the long run we’ll all be better off in our new home.

08.23.05

Tag Cloud

Tagged as ,

Operating on the theory that most people who come to my blog don’t particularly care when something was posted, but focus rather on the subject matter, I’ve eliminated all links to date-based archives and inserted a tag cloud into the sidebar. This has the additional benefit of trimming the length of my sidebar significantly, making it somewhat more likely that people will notice stuff like the AJAX poll. Another cool feature: in addition to clicking on a tag to see posts on that subject, you can view tag intersections with just a little bit of manual effort. The format for tag intersections is http://www.acetylene.net/tag/tag1+tag2: for example, apple+podcasts. Maybe sometime in the near future I’ll work up a way to do that without having to type anything into the address bar.

The plugin I used to add tag support to WordPress is Ultimate Tag Warrior. This description of the process was a big help, too.

05.10.05

WordPress 1.5

Tagged as , ,

So I’ve finally started the switch to WordPress 1.5, largely at the behest of my dad. I haven’t upgraded his site yet, though, because I found out in the process of upgrading my own that version 1.5 uses themes—which is great, and terribly convenient, but makes upgrades a bit troublesome if, like my dad, you’ve gone to all the trouble of making fancy custom templates featuring carefully arranged family photos.

So I’m waiting to find out what he wants to do about that, and also I’m going to have to figure out what I want my own blog to look like now. I had been using a few lightly modified WP 1.2 templates I found somewhere, and in my haste to get rid of the default look I’ve now switched to an overly-elaborate WP 1.5 theme, but I’ll try to come up with something a bit more “me” in the near future.

02.20.05

One Way to Fight Trackback Spam

Tagged as

I’ve been using SpamKarma to fight comment spam on this blog, and it’s exceeded all of my expectations—thus far, it has caught every attempt at comment spam while yielding absolutely no false positives. My only complaint is that it has no real effect on trackback spam: there is experimental support for trackback spam filtering, but it hasn’t worked for me. One particular spammer has hit me once an hour, every hour, all day today.

But I managed to find, via this post on BloggingPro, a link to a trackback host verification plugin for WordPress. It compares the IP of an incoming trackback to the URL linked in the trackback, and if they don’t match, it puts the trackback in the moderation queue. Since most spammers submit their trackbacks from open proxies, and not from an actual working weblog, this should be enough to eliminate the vast majority of trackback spam. Pretty slick—makes one wonder why this isn’t a standard feature in every weblog system that accepts trackbacks.

The site the plugin is on is in German, but the plugin itself is in English. To install, just download the plugin file, change the extension from phps to php, and drop it in your plugins directory (from the WordPress root directory, it’s at wp-content/plugins/). Then, from the WordPress root, open up wp-includes/functions.php, find the function definition for trackback_response, and comment out the last line, die(); (that is, change it to // die();). Finally, go to the Plugins page in your WordPress control panel and activate the Trackback Host Verification plugin.

01.25.05

Proper Feed Formatting with Textile

Tagged as

I use WordPress as my weblog engine these days. I also use the Textile humane web text generator for formatting. WordPress comes with a handy Textile 2 plugin, which works beautifully. Unfortunately, it completely ignores RSS and Atom feeds.

In other words (as some of you may have noticed), reading my blog in an aggregator until recently yielded you the raw, unformatted Textile markup, not the beautiful, humane, formatted text. Links didn’t work, nothing was bold or italicized, and things just generally looked awful.

Turns out there’s a very simple fix—all you need to do is add two filters so that outgoing feeds are parsed by the Textile plugin. But if you change the original plugin file (textile2.php, located in your plugins folder), your changes will be overwritten if the textile plugin is updated. And you don’t want that.

Instead, you want to use a my-hacks.php file. The details are on the wiki and in this support thread, but here it is in a nutshell: make sure the “Use legacy my-hacks.php support” option (under Options -> Miscellaneous) is checked. Then create a file in your root folder called my-hacks.php (with permissions ensuring the server can read it) containing the following code—and only this code. Extra lines before and after the PHP code block can and will foul things up, so make sure there are no blank lines or other garbage in there. Also, please note that I’ve only tested this on WordPress 1.2, because that’s the only version I’ve ever used as of this writing.

<?php
    add_filter('the_content_rss', 'textile', 6);
    add_filter('the_excerpt_rss', 'textile', 6);
?>

Unfortunately, as mentioned in the support thread linked above, this will create another problem: Atom feeds won’t validate because they have a mode="escaped" attribute on their <content> and <excerpt> elements, and that mode conflicts with the XHTML entities that now appear in our Atom feed. The fix for this is a little bit messier: open up wp-atom.php and delete the two occurrences of the string mode="escaped". You’ll note that we’re not using my_hacks.php here, so the next time you update WordPress, this change will be lost and you’ll probably need to do it again (unless, of course, the next version of WordPress fixes the problem).

The result should be nicely formatted RSS feeds for your loyal readers. Also, note that although the name of the filter only mentions RSS, this hack does work on Atom feeds, too. Enjoy!

12.29.04

Sometimes Things Work

Tagged as ,

Things have happened around here, as you may have noticed.

First of all, I took the old blog down. That means I’m on my third blog now, with no archives to show for it. I took the old one down because of a job change—I didn’t really want my archives to be searchable. It’s not that I’d said anything particularly inappropriate (though a few of you knuckleheads made some memorable comments), but under the circumstances I thought a fresh start would be appropriate. I was careful, however, to save my archives so that I could restore entries selectively if I so chose. Then I started thinking about what my new blog should be about. The leading candidate, for a while there, was technology in education (and vice versa).

Then my laptop’s hard drive crashed. No big deal; it was still under warranty and the techs at the Apple Store were quite helpful. I got a new hard drive and a 200-gigabyte external monstrosity for backup and auxiliary file storage.

Another thing that happened around this time is that my cable modem got really flaky. It had been having some problems for a while, but they were getting worse. It would lose its connection several times a day, and usually the only way to fix it was to reach around back and touch the metal part where the cable screwed into the modem. As soon as I touched that part it would reset and (usually) find its connection (sometimes it took a few tries, and sometimes I had to turn it on its side, or upside-down, before it worked again). This was annoying, but since Comcast had it in their records that I owned my own modem (which technically I did not, but that’s another story), I didn’t want to call and have them fix it and lose my $5/month savings. Because I’m a cheap bastard. Oh—also, my wireless router stopped working in wireless mode.

Then my server crashed. This had happened before—indeed, browsing my old host’s user forum indicated that it’s pretty common there. It seems to be a hardware problem, but no one had pinned down the cause last time I checked. My server crashed maybe once or twice a month on average; some users had much worse problems. But this time it went down and didn’t come back up. The techs said it looked like a bad kernel, so they installed a new one. That crashed. They removed the hard drive and installed a fresh installation (of the wrong OS). That crashed, too, and before I’d had a chance to install a single piece of software. Also, the backup they’d made of my files didn’t work.

Anyway, this is where things start turning around for me.

I got a new host: Tek Alchemy. From what I’ve seen from them so far, I like them a lot. They put a Gentoo LiveCD in the server and let me do the setup myself, and when I needed help (because I’d rebooted my server without setting SSH to start at the default runlevel) they fixed it within ten minutes. They’re the same price as EV1, but offer Gentoo and apparently more reliable hardware. So that’s good.

Then I bought a new cable modem/wireless router combo unit. I was tired of Linksys (ubiquitous, but I’ve never really cared for them), and had planned on getting a Netgear, but ended up getting a Motorola SBG900. Today, since I was home sick (oh yeah—I’ve been sick), I braced myself for a full day of frustration and searched the Comcast site for a phone number to call so I could argue with someone about MAC addresses. I found no phone number on the site. No kidding. Instead, I ended up chatting with someone who gave me the following instructions:

  1. Install the new cable modem in place of the old one.
  2. Restart the computer.
  3. Go to https://sas.r2.attbi.com.
  4. Enter your account number and registration code (the registration code is usually the last nine digits of the account number).
  5. Select the old cable modem from the drop-down list and click “Replace.”
  6. Enter a name for the new cable modem and click “Replace.”
  1. Click the link to “Reset Cable Modem.”

    And it worked! The process took about five minutes. The only part he didn’t mention is that if your cable modem includes a built-in router, as mine does, you’ll need to do the select-replace-name-replace thing twice, because your modem has two MAC addresses: one for the modem and one for the router. He did, however, give me a tech support number: (888) 266-2278.

    The Motorola, by the way, is nice. Lots of twiddly settings to play with (way more than in the old Linksys), and a more logical layout to me (I could never remember which security settings Linksys deemed “advanced”).

    So, in summary:

    • Apple support: Good.
    • EV1 Servers: Bad.
    • Linksys: Meh.
    • Tek Alchemy: Good.
    • Comcast: Good.
  • Motorola: Good.

    And now it’s a new year.

    As for the future this blog—well, hell, when have I ever managed to stick with one interest? Expect the usual blather.