Archive for June, 2006

E-mail filtering and procmail at pair.com

Monday, June 26th, 2006

Here’s a technical note for other Pair.com customers who are puzzling through getting e-mail filtering to play nice with procmail, in the hope that the hours I burned up getting this working will pay off others. I don’t claim that this note is without error, so you’re on your own if you follow my advice. I did retrace my steps as I wrote this, and I welcome corrections.

Note: This is a partial solution. As of 7/1/2006, email to domains you host at pair.com can be filtered and passed to procmail, but email to @pair.com email address can only be filtered. So don’t give that address out lest it get into the hands of spammers.

The preliminary steps are through the Control Center web interface.

  • Log in, and click the “E-Mail Management” button.
  • The “Use greylisting” option cuts down on drive-by spam at the expense of a slight delivery delay. I left if off at first, and turned it on later. It seems to help.
  • Virus detection is kind of a no-brainer if you’re reading email from Windows.
  • I tried various SpamAssassin settings, and settled for the Default.
  • I chose to leave my subject lines unmodified, because I’m using procmail to further filter mail on the server side. If you’re going to do client-side filtering and your email client won’t filter on custom headers, you’ll need to check this.
  • Click “Commit Changes”.
  • At the top of the page, click “Return to E-Mail overview”.

In the “General E-Mail Settings” section, there are two links: one for your @pair.com address, the other labeled “General”. Click into both of these in turn, and

  • Make sure “Store e-mail for … in the Main Account Mailbox” is selected.
  • Check “Enable Junk E-Mail Filtering” radio button, but leave the “Save Junk E-Mail in this File” box blank.
  • Click “Commit Changes”.
  • At the top of the page, click “Return to E-Mail Overview”

You can stop at this point and tweak your email client to look for the “X-Spam-Flag: YES” or the “X-Spam-Level:” headers in email that you pick up via POP3. Or, if you’re already familiar with procmail, you can use procmail to do additional server-side filtering. procmail is a bit tricky and finicky, so I won’t try to describe it here (I.e., danger ahead, you’re on your own).

The trick at Pair for making procmail work is to read the Using QMail article in the support knowledge base. Assuming you’re hosting a domain, say example.com, at Pair, edit or create the file ~/.qmail-example:com-default to read

!preline /usr/local/bin/procmail

This causes incoming email to @example.com address to get passed to procmail for filtering. The colon in the filename is deliberate. If you’re hosting multiple domains, you’ll have a .qmail file for each.
My .procmailrc file has this rule for saving spam on the server side.

:0
* ^X-Spam-Flag.*YES
Mail/spam

The rule is preceeded by a whitelisting rule that allows a select set of friends to send me content that might risk a false positive.

If you dabble in procmail, I highly recommend putting the “safety net” recipe in the procmailex(5) man page at the top of your .procmailrc

From Microsoft Update to Linux

Saturday, June 24th, 2006

Installing Ubuntu Linux on my old laptop wasn’t in the plan for today, but one thing kind of led to another, and here I am, watching the Ubuntu Configuration program do its thing.

It started innocently. While doing some other cleanup in my study, I turned on the old laptop and launched Windows Update. The laptop has been off for several months, so I knew there were going to be a few updates, but 27 Critical ones?!? Eeek! Most were of the “remote exploit” variety, so installing them was a no-brainer.

Midway into the 26th of the 27 updates, the laptop froze. When I rebooted the box, it blue-screened. Several times. Not good. My old Dell 600m was now effectively a brick.

I’d still be storming around blaming Microsoft if I hadn’t thought to Google for the error code that was on the blue screen. The concensus opinion was that the code (”pfn_list_corrupt”) indicated bad RAM. Popping out one of the two sticks of RAM cleared up the problem. Microsoft was off the hook.

This opened up the door to an opportunity. Besides replacing the bad RAM with a larger-capacity stick (costing far less than the original), I could pick up a larger hard drive (also costing far less than the original). And before going through the hassle of migrating XP to a new drive, it might be interesting to see if Ubuntu would install… So, off to Fry’s Electronics for parts.

As I was typing this, Ubuntu finished installing, and asked to be rebooted from disk, which it did with a nice startup sound. Sound! Getting laptop sound working from Linux has historically been a major hassle. And it sees the wireless access point. Sweet.

So installing Critical Updates from Microsoft can lead to Linux. Not in the plan when I started the day, but there it is.

Postscript: The first clue that something wasn’t quite right was when I couldn’t find the pretty desktop background that comes with the latest Ubuntu release. After a few more clues tapped me on the shoulder, I checked the install CD. I’d accidentally installed the previous release. (Note to self: Do not operate light machinery without sufficient caffiene.) Easily fixed. Now, suspend works.

Unresolved tension and TDD

Thursday, June 8th, 2006

A standard creative writing technique for avoiding writer’s block the next day is to stop in mid-sentence, ideally with your protagonist in peril. When you stop writing at

“The demo ended, and the lights were turned up. The project leader turned to the customer. The customer frowned for a moment, and said …”

you’re leaving yourself a no-friction starting point for the next morning. And your subconcious, which hates unresolved tension, is going to help by churning away all night thinking about what the customer is going to say, and how the project leader is going to recover. You might go to sleep with a good definite idea of what happens next, and wake up with better ideas.

The same technique works when doing Test-Driven Development. Instead of stopping for the day with tests passing, leave yourself a failing test. Ideally a test for next bit of code you plan to write. Your subconcious, taunted by the image of the JUnit red bar, is going to grind away on the problem until you sit down at the keyboard the next morning. Then, instead of spending time puzzling over what to do next (the coding equivalent of starting a new chapter), you have a very definite task before you: “Get to green”. And you have the benefit of whatever ideas your subconcious came up.

Once you’ve resolved the conflict by making the failing test pass, you have momentum to move on to the next test.

This technique works even when you realize on the way home that you screwed up the test. It’s just a different form of unresolved conflict.

Dinner, with Rhino

Wednesday, June 7th, 2006

John Brewer led a hands-on JavaScript session at last night’s Silicon Valley Patterns meeting, using the Rhino JavaScript interepreter. I pair-programmed with Bill Humphries, which involved a “one types, the other eats” maneuver with his laptop to avoid getting dinner crumbs on the keyboard. We made it through the prototype-based inheritance exercises (minus the tricky extra-credit problem) just as they were shutting down the restaurant.

Rhino has been on my “check it out” list for a while now. I don’t have projects in queue that are liable to be using server-side JavaScript, but who knows.

I’m a Dapper Drake Man

Saturday, June 3rd, 2006

On a whim, and before the morning dose of caffiene raised the alert level to “wary”, I upgraded my primary Linux box to Ubuntu 6.0.6 (”Dapper Drake”). It took an hour; half of that was downloading, half was configuring. The upgrade process stopped once to ask if I wanted to overwrite an Apache configuration file that I’d modified. It even showed me a diff. Very nice touch. Poking around, I found only one thing that the upgrade had broken (XChat2 went away), but took two minutes to fix.

Ubuntu is getting very close to being a Linux desktop for non-technical people, though I’m probably the wrong person to judge that.

Sic transit gloria stereo

Saturday, June 3rd, 2006

As life moves on, the time comes to let go of old things. Component stereo gear, in the present case.

We moved two years ago. The stereo still hasn’t been set up. I’m thinking that’s not going to happen, and that the time has come to sell off the pieces.

How’d that happen?

Lifestyle changes, mostly. It’s been a very long time since I’ve had the time or inclination to sit and listen seriously enough to warrant decent gear. Music has become background, and there are plenty of small ways to get adequate sound quality for background music. Big stereo gear takes up too much space. Looking at the cost (in size) versus the benefits of the various components, they all flunk (even the speakers, which I’ll miss). When we put on music for dinner, it’s a CD in a “compact stereo” box. When I play tunes while working, it’s MP3 into a pair of powered speakers at low volume. Both are good enough.

Some day I’ll be at a friend’s. They’ll put a vinyl copy of Tchaikovsky’s “1812 Overture” onto their big gear. I’ll go “Wow” when the cannons go off, and will miss having a stereo, at least for a few minutes.