Friday, March 24, 2006


Calling nsupdate from PHP script

First, I should note that this is very situational but hopefully someone can make use of it. The environment at work is mostly Windows machines. There is a Windows DNS server as well which accepts dynamic updates for reverse lookups, among other things. This can be a pain when you are working on various Unix/Linux platforms. I wrote up a very quick web page that uses the nsupdate package (should be available for most platforms) to remove stale reverse lookup entries from the server. Released public domain, a comment here would be appreciated if it helped you at all.

<title>Jamie's DNS fixer thingy</title>
<P>This tool clears reverse lookup entries for a given IP.  Stale reverse lookup
entries can cause problems with non-Windows systems.  Entering an IP here submits
a dynamic update request to the DNS server for removal of the entry for that IP.</P>
<form method="POST">
    <input name="IP" type="text" value="<?=(!empty($_POST['IP'])) ? $_POST['IP'] : ""?>">
    <input name="Submit" type="submit"/>


$valid preg_match('/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/'$input);
    if (isset(
$_POST['Submit'])) {
        if (!
$valid) {

<p><?=empty($input) ? "You must specify an IP address." "$input is not a valid IP address."?></p>

<?  } else { // Input validated by regexp
$iparr split('\.'$input);
$iprev $iparr[3].'.'.$iparr[2].'.'.$iparr[1].'.'.$iparr[0];
$dnscmd = <<<EOF
update delete {$iprev}

$nsupdate popen('/usr/bin/nsupdate''w');
$retval pclose($nsupdate); // nsupdate doesn't return anything useful when called this way

<p>Submitted removal request for stored DNS record on <?=$input?>.

// if(!$valid)
// if(isset($_POST['Submit']))

Friday, March 03, 2006


Good luck, Maxis (or not)

The parallels between the future Will Wright offering Spore and Peter Molyneux's Black and White are easy to conjure. On the shallow side, neat graphics (the zoom-outs in the spore video look very familiar), possible similarities in gameplay, and tapping in to the god complex of gamers everywhere. Legendary pre-release buzz is another common factor. The deepest connection seems to be the awe-inspiring stuff of gamer's dreams: a virtual world where anything is possible.

With the exception of my wife, who wouldn't watch the spore video because it was too long, this game has sparked the imagination of everyone I know who has seen it. I'm no exception. I do like sims and certainly I am a fan of MMOs. But why do we love the type of game that Spore and Black and White promise?

I'm not sure that anyone could answer that game concretely, but I will take a shot. My first guess is that gamers love the idea that a game is so smart, it will evolve beyond anything the designers predicted based on the unique actions of the player. Black and White actually partially delivered on this one. The creatures in B&W are able to learn. The interface for teaching is kind of crummy - you don't know what you're teaching and players tend to overtrain due to the wacky interface for it. Many creatures develop very strange eccentricities this way - mine loved to water trees, to the point where he did nothing but sleep, water trees, and scare villagers. Bill actually trained his creature not to poop. This was clearly an unintended consequence, and was fixed in the better-very-late-than-never first patch.

I love stories of the early days of Ultima Online. If you haven't heard of it, it is one of the oldest MMOs. UO was released in 1997 and predates EverQuest by about two years. I have heard a lot of meta-folklore about the early days of UO. One story that sticks out is the changeable world that marked UO's beginning. Players could compete for resources, animals could level up, and basically anything was possible. Perhaps needless to say, this did not go well. Within a few months, every tree and mine in UO was bare and if the packs of superinteligent max level wolves didn't kill you, the packs of murderers in every town would. These problems were eventually fixed.

Anyone reading this blog has probably given some thought to the simulation argument. If you think you haven't, follow the link and read up on it - this is undoubtedly a topic that has crossed your mind one way or another. It's only a thought exercise since it doesn't change anything one way or another. This thinking about what gamers like in games did lead me to it though. Let me propose a corollary notion. If simulations are possible and humans decide to start them, the technology will wind up in a computer game sooner or later. Chew on that - the possibility exists that you live in a computer simulation, and to add some scare on the top, the simulation is on an Xbox in some alien's living room :) At least if we're erased we won't see it coming.

So back to Spore. I wish Maxis luck, but I almost don't have to. This game is going to sell a billion copies. Given that, I almost want to wish them failure, because I have a sneaking suspicion this game is going to suck me in. Hopefully it will be released for the 360 so I can feel like I've gotten my money's worth out of it.

Wednesday, March 01, 2006


Kubuntu upgrade and gam-server (gamin) nightmare

My desktop has been upgraded from Debian testing (Etch) to Kubuntu Breezy. I did this in a kind of stupid way: I commented out all Debian sources in sources.list and used aptitude to do the upgrade. The version of aptitude in Etch has an AWESOME dependency resolution system - I marked a few Kubuntu packages for install and it noted that they would be broken. Next, I told Aptitude that these packages must be installed and set it to search for a way to make it work. After a few hundred thousand possibilities (about 30 minutes), it came up with a list of about 500 downgrades/upgrades/installs/removals that would satisfy my criteria. So far, so good.

The first problem came during the install. There were a few libraries that dpkg just refused to install citing dependency problems. I manually installed these from the apt cache folder with dpkg -i --force all, and then set aptitude to work again. This pattern worked pretty well.

The next problem was that the config I chose in aptitude left a handful of Debian packages around (a few hundred). This wouldn't be so bad except that the version of aptitude that breezy installed doesn't have the spiffy dependency resolution mentioned above. The only thing that made it easier to chase down the stragglers was that at some point breezy replaced my trusted apt keys, which marked Debian packages as untrusted. All I have to do is keep an eye out for packages marked with a U in aptitude. Overall I would not recommend this procedure. It might not be so bad if a. Breezy had a newer aptitude and b. 90% of the Ubuntu packages are downgrades from Etch, making the process a bit like pulling teeth.

I do love Kubuntu though. I am a huge supporter of free software but I can't use an all-free system. Nvidia drivers and an installable JRE were the first things I noticed. In fact, after running the popular Automatix script, I think my version of Firefox works with more websites than Firefox on XP.

Gam-server is driving me crazy. It's the daemon component of gamin, the gnome file alteration monitor. That's a bit of a misnomer because there are a bunch of KDE dependencies on it and it's not an optional component. Reading the ubuntu forums, I don't know why more posts aren't about gam-server, except that maybe not everyone knows how to open ksysguard or another process monitor app. Both on my work systems and at home, gam-server will start to leak memory quickly. Here's how I see the problem. I get to work and tap a key to pop the password prompt on my screen saver. If the prompt takes more than 2 seconds to appear, I know gam-server is now using 750MB+ RAM or so. The system has 2GB but I run a bunch of virtual machines and stuff so I can't afford to have some crap runaway process eat all this memory. I don't even know what triggers the problem, perhaps opening folders in konqueror? I can't find an obvious cause.

The only post I've seen with a solution has you download gamin packages (and one or two dependencies) from the Dapper repository, which sounds like it will work. There's also this bug which describes most of the gamin problems. I'm pretty surprised that they didn't backport a new gamin to Breezy. This is a game breaker unless you are used to rebooting your system daily (or digging a little deeper to periodically kill gam-server).

The bugzilla has another solution which is a surefire fix:

sudo mv /usr/lib/gamin/gam_server /usr/lib/gamin/gam_server-disable && killall gam_server

This page is powered by Blogger. Isn't yours?