mod_rewrite is essential if you’re going to write RESTful web services. Here are the steps I went through to troubleshoot my installation:

  1. Ensure you included mod_rewrite in your apache installation. For gentoo, you can use [eix www-servers/apache] – Gentoo’s apache2_modules_rewrite flag is enabled for apache, looks good.
  2. Test to see if it is being loaded. I created a dummy page phpinfo.php with the contents [<?php phpinfo(); ?>], to see what PHP had to say about it. Search for mod_rewrite – yep, there it is, good. If not, make sure it’s loaded in httpd.conf, the load line may be commented out.
  3. Now make sure it’s enabled for the path you’re using. The apache directive is [RewriteEngine On], and it has to be somewhere in your httpd.conf or an included file. In my case I use virtual hosts. According to Apache docs, I needed to add both of these to the top level of my virtual host directive:
    RewriteEngine On
    RewriteOptions Inherit
  4. The mod_rewrite rules I’m dealing with are all in .htaccess files. In that case you have to make sure you’ve turned on the switch that allows .htaccess files to override your settings. Basically, you’ll need [AllowOverride All] enabled for the path where you want to use .htaccess files.
  5. Finally, make sure your .htaccess settings and rules look good. Here’s an example I pulled from another good troubleshooting blog entry:
    cat .htaccess
     Options +FollowSymLinks
     RewriteEngine On
     RewriteRule ^alice.html$ bob.html
     RewriteRule ^bob.html$ alice.html

    It should force bob’s page to load when you request alice’s, and vice versa. Nice simple little test.

Once I went through this list, I was good to go.

My Cyrus IMAP mail server is my very own 20-headed hydra.   It’s mostly well-behaved, but once in a while I have to jump back in the ring with the bitch and wrestle her back into submission. This is not fun, and if you can structure your life in such a way as to avoid it, I would highly recommend it.

The authentication started failing when I went to check my email.  Because I know what a monster the thing is, I put off fixing it for a couple weeks – I just didn’t have 5 hours for the dive back into the internals.  Eventually I really needed some email, so I jumped in.

  • rebuilt cyrus-imap and cyrus-sasl, no luck
  • suspected that sasl was to blame, saslpasswd2 (the tool to manage email account passwords) reported failure
  • played with every authentication setting of sasl, no luck
  • errors were minimal, I monitored logs and googled for the errors I got with no luck
  • FINALLY someone with a similar error was told to try strace, as follows:
    strace -o sasl-out.txt -f sasldblistusers2

    Awesome! It shows all kinds of system calls made by the executable, including reads and writes and logs. And that showed failure during a seek inside my sasldb file.  Holy occam’s razor, batman! Wiped the file and recreated it, and everything is all happy again.

When an unacknowledged text is displayed, alarms stop working on the iPhone. The workaround for me is to turn off texting while I’m sleeping, which is prolly a good idea anyway. 🙂

I bumped up a Windows 7 release candidate install to the retail Windows 7 today.  Microsoft decided it was too much trouble to support an upgrade from the final Windows 7 RC, forcing you to do a completely new installation.  Blow-by-blow:

  • Fire up the Macbook Pro
  • Select System Preferences->Startup Disk->Windows on BOOTCAMP, Restart…
  • Uninstall Bootcamp for Windows (W7 isn’t happy until you do)
  • Install Windows 7
    • you’ll get errors unless you perform a custom install
    • pick the existing C: (BOOTCAMP) drive, the existing Windows folder will be renamed
    • go through the complete installation
  • Insert the Snow Leopard DVD and reinstall Bootcamp for Windows

If you followed this closely, that’s all you should need!  Not that bad.  Now to reinstall all the Windows software… when I get around to it, yawn…

From the “why-do-I-need-Perl-any-more” department…

PHP now provides perl-like regex functions, and writing websites has never been so much fun! I have always loved Perl for text parsing of any kind, and I realize that was because of its powerful regex functionality. During some recent PHP contract work for my friend John, I discovered that PHP’s got perl regex, via this…

preg_match( $perl_style_regex, $source, $match_result_array ).

I can scrape like a madman now. Happy happy joy joy. Anyone who disparages PHP has either never used it or has been trained in the pretentious ways of the Java prima donna. (JUST KIDDIN’ yall!) 😛