Thinking Outside the Box

Although I have been touting the new autoboxing and unboxing feature in Java 2 version 5, I didn't realize how far the language is willing to go with these automatic conversions.

The following code doesn't work in version 4:

public void setDeposit(Float deposit) {
  if (deposit >= 0) {
    this.deposit = deposit;
  }
}

You can't use a comparison operator like ">" to compare a Float object and a float value -- an "incompatible types" error indicates that you have made Bytecode Jesus cry.

Instead, you have to call the object's floatValue() method:

public void setDeposit(Float deposit) {
  if (deposit.floatValue() >= 0) {
    this.deposit = deposit;
  }
}

In Java 2 version 5, you can write statements that treat objects as if they were the corresponding primitive types, so the original method compiles successfully.

I prefer a statically typed language like Java over a dynamic one like PHP because of the dumb mistakes that are caught. I thought it was heresy when Hans Nowak suggested recently that these highly praised error-catching capabilities are self-fulfilling:

Rigid languages make types important, so whenever you get a type "wrong" (i.e. different from the declared type signature), it's a bug, and the compiler balks loudly. No wonder a lot of these bugs are caught; the language sets the programmer up to make them.

Now that Java has become smart enough to remove a bunch of my dumb errors, my opinion on this issue is no longer static.

Addressing a PHP Name Resolution Glitch

My PHP error logs have been filling up with an ominous error message:

PHP Warning: main(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution (is your IPV6 configuration correct? If this error happens all the time, try reconfiguring PHP using --disable-ipv6 option to configure)

I don't know about the low-level cause for the problem, but I've figured out why it's happening so often on my server. I had the bad habit of using URLs in include statements for local pages, like this:

include 'http://ekzemplo.com/menu.htm';

This was causing some pages to require three or more extra domain name lookups, just to pull files from my own server! I'm switching these statements to local file references:

include '/www/ekzemplo/menu.htm';

Server performance has improved noticeably, though I still have no idea what any of this has to do with IPV6.

Multiple Item Enclosures in RSS 2.0

I'm gathering information for the RSS Advisory Board on the issue of multiple item enclosures in an RSS 2.0 feed.

On first reading, it appears to me that an item must contain either zero or one enclosure elements, but I have to do more research about how existing implementors have interpreted the specification.

I created a test feed that contains a single item with two MP3 enclosures. Surprisingly, this feed validates in the Feed Validator and RSS Validator. I'd like to find out if any podcasting-capable aggregators retrieve and present both of the feed's audio files.

Recounts Bring Us Closer Together

In the Washington gubernatorial race, Christine Gregoire has passed Dino Rossi in the hand recount for a 10-vote lead, which will probably grow when 700 votes that were improperly disqualified by one county are examined.

Whether Gregoire wins or Rossi overturns the count in court, the winner's going to have little legitimacy with half of the electorate. As this race and the Bush/Gore debacle demonstrate, this country can't handle photo-finish elections, because no one believes the recount process won't be gamed by one or both parties. (I'm gaming the process by describing Gregoire as the presumptive winner.)

Around 2.8 million people voted in Washington, so the next governor will sweep into office on a mandate that amounts to 1/300th of a percent.

This is no way to run a shining city upon a hill.

If we can't settle maddeningly close races with dueling pistols, there should be a threshold, such as 1/10th of one percent, that triggers a new 30-day registration period followed by a new vote. This would give the electorate a second chance to make up its collective mind and put an end to some recount lawsuits and grandstanding, because both sides would fear the second batch of voters.

Legendary science fiction author Ursula Le Guin is doing everything she can to dissuade fans of her books from watching the Legend of Earthsea mini-series on the Sci-Fi Channel.

She's most offended by the decision to change the races of her characters, making most of them white:

My color scheme was conscious and deliberate from the start. I didn't see why everybody in science fiction had to be a honky named Bob or Joe or Bill. I didn't see why everybody in heroic fantasy had to be white (and why all the leading women had "violet eyes"). It didn't even make sense. Whites are a minority on Earth now—why wouldn't they still be either a minority, or just swallowed up in the larger colored gene pool, in the future?

I Want to Be a Better Neuron

Looking at Technorati this morning, I realized that none of the entries on my hand-coded weblogs are showing up there, presumably because I haven't been sending update pings to weblog notification services like Weblogs.Com, Blo.gs, and Ping-o-Matic.

For a weblog to be a properly firing neuron in the information-gathering nervous system that Jon Udell describes on InfoWorld, tools like Technorati must learn in real time what's being linked, and by whom.

To fix this, I'm writing a PHP class library to ping notification services over XML-RPC, using Edd Dumbill's XML-RPC for PHP library.

The code works successfully for Weblogs.Com and Ping-o-Matic, but I haven't had any luck calling Blo.gs over XML-RPC.

According to the documentation, I should be able to call the site's XML-RPC server at http://ping.blo.gs/, port 80, with the method weblogupdates.ping and parameters "Ekzemplo" (weblog title), "http://www.ekzemplo.com" (weblog link).

I can't get this to work with my own PHP code or the Dumpleton XML-RPC debugger, so I'm hunting for examples of working code that connects to the Blo.gs XML-RPC server.

Jack Newfield, a muck-raking journalist and author whose expose, The Shame of Boxing, was one of the best investigative sports pieces in years, has died of cancer at age 66.

Newfield, who loved boxing writing so much he celebrated A.J. Liebling's 100th birth anniversary in October, had this take on the sweet science:

At its infrequent best, boxing can be the art of hitting and not getting hit -- a ballet with blood, geometry with guile. At its frequent worst, it is fakery, burlesque, cruelty, injustice, exploitation and death.