Manual PHP and Drupal 6 web access logging

There was a little funky activity on a client's Drupal 6 website that was hosted at GoDaddy, and without having access to an Apache access log file, I wanted to be able to see what was going on. So I wrote the following PHP code snippet to do some manual logging, and placed it in the Drupal theme's page.tpl.php file:

Parsing “real world” HTML with Scala, HTMLCleaner, and StringEscapeUtils

While XML parsers work great for well-formed XML, out in the 'real world' internet, you can't count on HTML being XHTML, or even being well-formatted. As a result, various 'HTML cleaner' libraries for Java have appeared. They attempt to clean up the HTML so you can parse it.

A Scala REST “get content” client function using Apache HttpClient

As quick post here today, if you need a Scala REST client function, the following source code should be able to work for you, or at least be a good starting point. I’ve been using it in several applications today, and the only thing I think it needs is the ability to set a connection timeout and socket timeout, and I share the code for that down below.

Apache NameVirtualHost configuration using MAMP on Mac OS X

Summary: Here are some notes on how to configure a Name Virtual Host (NameVirtualHost) on an Apache web server. In particular, this is from the httpd.conf configuration file that I use with MAMP on one of my Mac OS X development systems.

In short, as I’m developing two different applications, one named "cato" and another named "zenf", these are the important name-based virtual host lines from my Apache configuration file:

Apache RedirectMatch wildcard examples alvin June 11, 2011 - 9:04pm

Apache Redirect 301 FAQ: How can I redirect many old web pages using the Apache Redirect or RedirectMatch syntax and wildcard patterns (regex patterns)?

I'm currently trying to fix a lot of URLs that I more or less intentionally broke when I deleted the old "directory" portion of this website. In short, after removing the directory, no URL at "/Dir" work any more, so I have thousands of broken URLs (technically "URIs") that look like this:

Drupal APC performance improvements

Summary: A look at the performance improvements gained on a Drupal 6 website by using the PHP APC Opcode Cache.

Wow, I just installed the PHP APC Opcode Cache module on alvinalexander.com, and the results are really incredible. By any metric the website is performing much, much faster.

I ran two benchmarks on the website using the Apache 'ab' benchmarking tool, one without the APC opcode cache, and one with it.

An Apache 301 redirect for a deleted directory

I recently reorganized the devdaily.com website, and as part of that, I deleted an entire directory at the root level that was named "/Dir". This was the "directory", where I had a Yahoo-like directory of links to applets, tutorials, CGI scripts, and so on, so I had thousands of web pages with URLs like these: