Sometimes your free WiFi is slow because of a crappy DNS server.

If your system uses dhclient...

# -*- sh -*-
# This is /etc/dhcp3/dhclient-enter-hooks.d/wifi
essid="$(iwconfig "$interface" | perl -nle 'print $1 if /ESSID:\"(.*)\"/;')"
if [ "x$essid" != "x" ] ; then
    case "$essid" in
    "Molly Malone")

You're welcome.


New bike shop opening in Louisville

Just saw some signs posted on the window at 1345 Bardstown Road.
I'm told it's where Raindog's Salon used to be.

It's called Parkside Bike & Boutique.
Grand opening is Friday, June 5th, from 5pm until the crack of dawn.
There will be door prizes, a bike giveaway, and grand opening discounts.

According to the signs, they will sell classic, single speed, and fixed gear bicycles, as well as vintage clothing from the 1940s to the 1980s.

In other words, hipster heaven.

Thanks to V for telling me about this.

PHP just might be moved off my "DEAD TO ME" board.

PHP 5.3, which will come out eventually, has closures.

The lack of this feature, having been present in other programming languages for years, was only my biggest problem with PHP.

My testing indicates they actually work, too. Let's hope I don't discover anything stupid.


// a read-only closure
function closure1 ($string, $x) {
	$y = $x;
	return function () use ($string, $y) {
		print "$string: $y => ";
		$y = $y + 1;
		print "$y\n";

$a = closure1("closure1 a", 3);
$b = closure1("closure1 b", 5);
$a();	// outputs: closure1 a: 3 => 4
$a();	// outputs: closure1 a: 3 => 4
$b();	// outputs: closure1 b: 5 => 6
$b();	// outputs: closure1 b: 5 => 6

// a read-write closure
function closure2 ($string, $x) {
	$y = $x;
	return function () use (&$string, &$y) {
		print "$string: $y => ";
		$y = $y + 1;
		print "$y\n";

$c = closure2("closure2 c", 3);
$d = closure2("closure2 d", 5);
$c();	// outputs: closure2 c: 3 => 4
$d();	// outputs: closure2 d: 5 => 6
$c();	// outputs: closure2 c: 4 => 5
$d();	// outputs: closure2 d: 6 => 7

Thanks to the PHP team for finally coming through on this one.


Hopefully if you post a comment to one of my entries from this point forward and it gets screened, I'll actually receive an email about it now instead of it going to an invalid email address. :)

ASP Fails.

In this week's episode of "Darren learns stuff the hard way", we talk about Active Server Pages. I'm not talking about ASP.NET here, just classic ASP.

One misconception some might hold is that (classic) ASP == BASIC. ASP is actually (kind of) language-neutral. All ASP is, is a mechanism to mix server-side code and HTML (kind of like PHP without the drama), and some basic objects for request data, response generation, persistent variables, sessions, and other basic stuff. In addition to using VBScript, you can also use JScript (also provided by default), PerlScript (just install ActiveState Perl and leave the checkboxes checked), Python (install ActiveState Python), and possibly other languages.

The reason I even dealt with this in the first place is that I was required to use IIS for this one project. That was the only actual technical requirement. I had many options.

- I could use PHP, but I'm conducting a war on PHP.

- I could use ASP+BASIC, but as with PHP, I'd have to write a lot more lines of code, find a basic-mode for Emacs, and would have to sift through a lot of really bad examples of code when looking for techniques to do things. Remember, guys, the "B" stands for "Beginner's", just like it did in 1964. :)

- I could use basic Perl scripts containing a bunch of here-documents, but those suck when you have loops.

- I could have tried Mason+ISAPI, but the only solution I was able to find so far would involve using URLs like /application/index.plx/path/to/actual/mason/file.mthml and I didn't want someone else to have to deal with it incase I get hit by a bus and die or something.

- I could have tried Mason+CGI and been done, but I wanted to see if I could produce a less inefficient solution.

- I could use some other Perl templating solution but I'd have to invest time acclimating myself to it.

- I could use PerlScript+ASP.

I chose the last option there. ASP is simple enough.

The thing I realized midway into the project is that ASP does not natively provide support for file uploads. Or for multipart/form-data at all. This is the single biggest WTF I have ever witnessed. Were it not for this characteristic, ASP would be one of the few technologies from Microsoft that aren't fundamentally wrong, and would be a legitimate alternative to PHP. So what do I do?

- I could have used a pure-ASP solution. But they're all written in VBScript and it's impossible to use it from PerlScript.

- I could have used an ASP component. But they are all either buggy, or cost hundreds of dollars for a single-site license.

- Why didn't I realize this sooner? I could write just the form action script on the file uploads as a .plx script and use the CGI module for form data parsing.

That last option's what I'm doing. I don't get the benefit of ASP there but I think it's okay at least for now to either just die() with an error (the user will click the back button) or redirect to the next step on success.

Hopefully no more stumbling blocks. Wish me luck.

Dear Marketroids,

1. It's a fucking standard hot dog. Nothing special. We all know. You do not need to call it an “all beef hot dog”.

2. Nobody calls their jet skis or boats "pee double-you cees". We call them "jet skis" or "boats". And in those rare moments where we actually have to refer to personal watercraft generically, we call them "watercraft" or "personal watercraft".