Archive for November, 2007

Fixing apache virtual hosts in Leopard

Friday, November 30th, 2007

I’m posting this only because I had trouble getting Apache back into shape after a Leopard upgrade, and I wanted to post a fix. Switching to Leopard (which comes with Apache 2.2), I needed to get virtual hosting working again for my development work. Some files and settings have moved.

The apache config for Leopard is in /etc/apache2/httpd.conf, and to turn on virtual hosting you must uncomment line 461, which includes /private/etc/apache2/extra/httpd-vhosts.conf. While you’re at it, if you need PHP, uncomment line 114.

Then edit httpd-vhosts.conf. I wanted to still be able to use the Mac’s default DocumentRoot for requests on localhost, but turning on virtual hosting in Apache 2.2 disables the server-wide DocumentRoot and ServerName, and the first virtual host you define becomes the default instead. Here’s what I needed in order to get my specific name-based virual hosts working:

#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
#
# VirtualHost example:
# Almost any Apache directive may go into a VirtualHost container.
# The first VirtualHost section is used for all requests that do not
# match a ServerName or ServerAlias in any <VirtualHost> block.
#
<VirtualHost *:80>
DocumentRoot "/Library/WebServer/Documents"
</VirtualHost>
<VirtualHost *:80>
ServerName myrailsapp.biz
ProxyPass / http://127.0.0.1:3000/
</VirtualHost>
<VirtualHost *:80>
ServerName wpclient.com
DocumentRoot "/Library/WebServer/Documents/wpclient.com"
</VirtualHost>

This configuration should work for multiple virtual hosts, but for me it wasn’t totally successful until after restarting the system—a simple “sudo apachectl graceful” didn’t do the trick. It may be that I also modified /etc/hosts and the system wasn’t fully assimilating my changes. Also, since I had upgraded from Tiger, my user-specific configuration files had moved, so my userdir (http://localhost/~carl/) stopped working! The fix for this was:

sudo cp /etc/httpd/users/* /etc/apache2/users/

Incompetence

Thursday, November 29th, 2007

Scrabble Board

I love to play Scrabble. One thing I’ve noticed as I’ve gotten better at it is that many new Scrabble players start out with a broken model about how to win. People start out wanting to make long words, because naturally long words are good. It is assumed that if you’re a grammarian or amanuensis, you’ll naturally be good at Scrabble. But Scrabble is not about making long words, it’s about strategically placed, usually mundane words. In Scrabble, a well-placed two-letter word can score points in the upper 30s, while a beautiful looking 6- or 7-letter word may only score 10 or 15 points. Furthermore, Scrabble draws from a very specific grammar that Scrabble players memorize and that’s really pretty useless in everyday life. Unless you’re a civil engineer in the Middle East, you probably don’t talk about qanats very often. But if you’re a Scrabble player, this is a word you should know, because it may provide a brilliant play one day when you have a Q and no U. Who cares what it means.

Similarly, in Pac-Man, many people start out with the idea that success means gobbling up all those dots so you can reach another level in the game. It is so natural to want to do this. It doesn’t matter where you live or what language you speak—the first time you sit down at Pac-Man, you’ll probably be unable to suppress your desire to eat all the dots. But Pac-Mac is not about dots or levels, it’s about points! The levels are a trick. The real goal of Pac-Mac is to creatively lure the ghosts into one of the corners where you can eat them all up quickly after using a power pellet and score lots of points. If your focus is on this goal, the dots will take care of themselves. And if you can eat all sixteen ghosts on each level, then you’re on your way to a high score.

Not that Pac-Man and Scrabble are the only examples. Every skill has its broken initial models that lay waiting for the unsuspecting beginner. As people gain experience, they continually build, test, and rebuild mental models. I think this is why people who are very good at something will know it, because they have insight into their past incompetence.