VirtualBox 3.2.8 post-upgrade issue [resolved]

Upon upgrading to 3.2.8 and re-starting a client you might get an error message such as:
“differencing image not associated with parent”
“differencing but not associated with any parent in media registry”
“Parent medium with UUID x not found in media registry”

For some reason, inaccurate info ended up in your vdi file. VB is now more strict, and this inaccurate information just needs to be expunged to prevent VB from panicing. See this ticket for details:

http://www.virtualbox.org/ticket/7289

The short of it is: You download the tool for your host platform:

http://www.virtualbox.org/download/VBoxFixHdd/

“Identify the affected images. You can either use the VirtualBox GUI and check which base images are inaccessible, but shouldn’t be. The same can be done with “VBoxManage list hdds”, in this case make sure you only look at images which say “Parent UUID: base”.
Run the repair tool:
VBoxFixHdd –filename /path/to/image.vdi –zeroparentuuid
Repeat for all affected images.”

Worked like a charm.

I tried downloading StarCraft II via the provided Blizzard downloader app, but pointed it to a partition that was formatted FAT32. Since the file is larger than FAT32 can hold (~4GB) the download failed. The downloader does not provide you with a way of switching the download location after you run it the first time; to do so, you need to edit the Windows registry. Here’s how:

Click your Windows “Start” button and select “Run”, or hold down the “Windows Key” and press “R”.
Enter “regedit” in the “Open:” dialogue box and press OK.
Press “Ctrl” and “F” to open the Find dialogue.
Enter “Blizzard Entertainment”. It should display a folder on the left entitled “Blizzard Entertainment”. Expand this folder by clicking the “+” to the left of it. You should see a “Downloader” folder. Expand this too. There should be a key with some random string of alphanumerics. Click on that.
In the right pane you should see a key that titled “Path”. Right click on that and click “Modify.”
Change the “Value data” to set the location for the download folder and press “OK”. Close RegEdit.
Enjoy!

Standard disclaimer: when mucking about in your registry, be careful, as you can bork Windows.

string byte length in PHP

PHP apparently lacks a function to return the byte length of a string, such as you might need for a Content-Length header. Assuming your PHP internal character encoding is a single byte charset (such as latin1 / “ISO-8859-1″) then the answer is the same as your character count and you could use strlen(). This is the default (in the US anyway) and will of course break should you ever change the internal encoding to a multibyte charset like UTF-8 and use the mbstring.func_overload faculty to transparently replace the non-multibyte functions with their multibyte equivalents.

In that case, mb_strlen() becomes strlen(). mb_strlen() is strlen() with support for different charsets, which may use different byte lengths for a single character. By default, it will use your internal encoding. However, it supports an explicit character encoding as its second parameter. Knowing that latin1 uses a single byte, mb_strlen($string,’ISO-8859-1′) will do what we want and count the bytes in $string regardless of your current internal encoding or the string’s apparent encoding.
Let’s wrap this in a function for clarity, and in case we need to change our counting method because of a change in PHP or some such helpfullness:


function bytelength ($string) {
// Returns: (int) number of bytes in string
// Use latin1 as a alias for "1 byte"
return mb_strlen($string,'ISO-8859-1');
}

MySQL Query Browser: nice fonts with UTF-8 support

Due to (a bug in) the way fonts are rendered in the “SQL Query Area” of the MySQL Query Browser[1], most of the fonts available end up looking clipped. Beyond aesthetics, you might want to change the default font due to its lack of support for UTF-8 characters. You can change the “Code Font” choice under Tools > Options > General Options.
I prefer Arial Unicode MS 8.3pt for default & data, but due to it rendering poorly in the code area I’m using Bitstream Vera Sans Mono 8pt as a tolerable alternative. Both support UTF-8.
[1] MySQL Query Browser 1.2.17 on Windows XP.

Test more PHP!

It’s not just an admonishment, it’s the name of a project I maintain at code.google.com.

test-more-php version 0.1 is out now and ready to help prevent hours of debugging with so little effort it’s ridiculous not to use it. The API is a direct port of the popular Perl Test-More library with some minor PHP adaptations. Both object and procedural interfaces are available, so pick your flavor and get coding!

I started test-more-php after getting sucked into writing PHP full-time and casting about for a testing library with the elegance I knew from Test-More. Eventually I discovered a few, but each was incomplete or failed me by silently bailing on an error that could have been reported appropriately. Test-More.php is a drop-in replacement for those other libraries and provides me with the confidence that, if something goes wrong, I will know about it.

I’ve tested it under Windows XP, Ubuntu Linux, FreeBSD and Cygwin but not OS X, so if anyone with a Mac wants to take it for a spin please let me know how if it passes all it’s tests. (Of course it comes with its own test suite!)

The power of not being all things to all people

The title of this post at dagolden.com really struck me. The post, about a new CPAN client that doesn’t mimic the “swiss army chainsaw” mentality of the Perl community’s approach to software design, is apt in its critique not only of the project itself, but of its reception by the community. There is a religious type zeal some people express when shifting their allegiance from one idea to another that seems to compel them to attack the subject of their former allegiance.

Douglas Crockford — The JSON Saga

This talk by Douglas Crockford, standard bearer of JSON, is an interesting history lesson on JSON’s origins. Douglas provides plenty of amusing perspective on JSON’s position as the popular data interchange format it has become and the landscape it evolved in. He seems to enjoy taking a “heretical” perspective, which is usually more fun to listen to in a tech talk, and this is no exception.One recurring theme that caught my attention was the aspiration to simplicity in the format, especially in comparison to xml. It’s a lesson worth revisiting.

googleapi.com, Firefox 3, <script … /> and security

Public service message: firefox 3 does not play well with self closed script tags.

I discovered this when I was repointing my jQuery libraries toward the googleapis hosted versions, to take advantage of their speed. I tested the switch in Opera, where it looked fine. Later, doing some debugging with firebug, I noticed those pages were no longer executing any javascript. Chrome had no problem loading them, and initially I thought the jQuery lib was the issue, but curling a new copy proved it was identical to my locally hosted version. Finally I noticed the difference in how I had self closed the script tags, which is perfectly legal… firefox 3 just doesn’t like it.

So I like the ajax.googleapi.com hosted libraries, although I don’t buy that using the google.load() method is better than pointing to the hosted library directly. Profiling the difference between two pages that do nothing more than load jquery shows that using google.load() adds about 0.2 seconds to the load time. Try it yourself:
Pointing directly vs Using google.load(). Which only makes sense, since loading the google api takes time… so where is the extra “power” they boast you receive by using this method? The only potential advantage I see is the ability to load the library conditionally, avoiding the load unless you need the library. I say potentially because I’ve yet to make use of that kind of just-in-time loading. If you have, or I’ve overlooked some strength to this method, I’d love to hear it.

One last googleapi related note: using a script tage to call your library, you can use https to load the file. The google.load() method appears to load files using http, which is quicker but poses a security risk by injecting insecure code into a supposedly secure environment. This is the same reason secure method pages should use the secure-only flag on cookies: you are only secure as your weakest link.

One install, multiple deployments: phpMyAdmin

I’ve been running more PHP apps for virtualhosts lately, and one thing I dislike about such bundles is having a config file in the app root. For one, it’s sitting in the web root, and if improperly configured the server could serve it as content, posing a security risk (as they tend to hold database login information, passwords, etc.) The other reason is that I like to maintain a single copy of the app (via the FreeBSD ports tree, or from a single repository checkout.) I don’t want to make copies, because then I need to maintain each copy too, and I can’t just set the primary installation directory as the server document root, or alias a subpath to it, because each deployment would receive the same default config file. Any modifications to the application code, to make it look elsewhere for the config, would likely be lost in the next upgrade. So how can you share a single installation for multiple deployments?

The key is that the config file itself is usually left as-is during upgrades, as it is supposed to be altered by the user. We use this file to include another config file from elsewhere based on webserver variables.

For example, here is my config.inc.php for phpMyAdmin:


<?php
/*
Delegate to another file.

Set web server variable PHPMYADMIN_CONFIG_FILE to the file that would normally be located here (config.inc.php).
Under Apache, it would look like this:
SetEnv PHPMYADMIN_CONFIG_FILE /usr/home/rj/.phpmyadmin
Include the absolute path, or make sure the file is in the PHP include path.
Ensure that the file is readable by the account the web server runs under.

*/
include($_SERVER['PHPMYADMIN_CONFIG_FILE']);

?>

You now just need two lines in a virtualhost config to set up a new installation:

SetEnv PHPMYADMIN_CONFIG_FILE /usr/home/$USER/.phpmyadmin
Alias /phpmyadmin/ "/usr/local/www/phpMyAdmin/"

Of course, you still need to set up each .phpmyadmin file, but that’s easy enough. Of course, if you’re deploying lots of similar database setups, you could also use the virtualhost config to set up the configuration and re-use a common config.inc.php tweaked to use server variables (PHPMYADMIN_HOST)… but I’ll leave that as an exercise for the reader. Avoid passing passwords this way, however, as server configuration variables are another potential data leak.

Drizzle: a patchy MySQL

MySQL director of architecture Brian Aker provides the scoop on Drizzle in a short video interview. If you’re a MySQL user, and especially if you hadn’t heard about Drizzle, and extra especially if you had any concerns about MySQL’s future due to the recent Sun acquisition by Oracle, you should check this out.

Here are my takeaways:

  • Drizzle uses a modular system akin to Apache to remain light(er) weight and highly tweakable. Sweet!
  • It focuses on convenience of community based development, i.e., Drizzle is viable even if Sun decided to defenestrate the MySQL team.
  • Big names are putting time into supporting Drizzle development too.
  • MySQL is pronounced My-S-Q-L

Post at bartongeorge.net

Blipfest 2008 was 1k+ chipsterrific

Saturday DJ Quiet and I made our way to NYC for the third night of BlipFest 2008. It was awesome, and next year I intend to secure lodging in the city for the whole shebang.

BlipFest is an annual chiptune music fest. Chiptune is a section of music space where the audio pallettes set forth by the limited capabilities of (early) videogame sound chips is employed. It often blends with less restrictive forms of music composition and performance; instead of a static score, some of the song might be performed live on a (necessarily custom built) instrument that generates sounds in this range. All manner of mixing equipment and community/custom programs is employed. It also lends itself to trippy, pixelated visual art and videogame “remixes.” Blipfest brings together some of the best chiptune artists (some all the way from China) and great visual artists to accompany them for four nights of awesome.

Anyway, after some Googlemap induced mishaps we found our way to the venue in Brooklyn, which was nice if small for what ended up being a sold out show. We came in at the beginning of Bubblyfish‘s set, which I recognized as her cover of Kraftwerk’s “It’s more fun to compute” off the 8 Bit Operators comp although I hadn’t connected the song and the performer until that point. It was my favorite set of the night, probably pushed to the top by the Bubblyfish’s exuberence and the visual mixing backing her up. It was also the most dancable set. What live music I’ve caught since becoming a parent hasn’t gone much beyond inducing the jump and cheer, and I hadn’t even anticipated a mosh pit at this event, but by the end of the (all too short) set I was happy to pay the $2 to check my hoodie and sweatshirt so that I didn’t have to make the homeward journey in the snow while soaked from the inside out.
The rest of the night kept the energy up, with sulumi, Cow’P, nullsleep and Stu gracing the stage before I left in an attempt to make the 1:49 train back to CT. The visual art was also perfectly done for the scene, and the crowd was full of fans there to enjoy the performance, not the venue drinkers who could care less who was on stage or jerks there to start shit as I have grown accustomed to. I even got to see, albeit briefly, the one cousin I seem to share a taste in music with. I look forward to Blipfest 2009 and intend to catch some more chiptune shows in the meantime.

For tons of free chiptunes, make sure to check out the discography at 8 Bit Peoples, a chiptune label that uses the BY-NC-AT Creative Commons license (especially nullsleep, one of the label’s co-founders.)
Here are some samples:


Follow the red dots – music by Bubblyfish, visuals by Raquel Meyers

Broadcatching: torrent feeds via RSS

Who out there uses newsfeeds to grab torrents? I’m trying to abstract out a module I wrote for publishing such feeds and I can’t find much info, so I’m just gathering samples from various locations. If you have any, I’d specifically like to grab the content of one of the <item>s. It appears that, due to lack of a good standard, most programs are just linkscraping but I’d liek to confirm. Also, if you use utorrent or rtorrent, your experience using feeds would be welcomed.

Google and the End of Science & The End of Theory

Google and the End of Science: Bringing it all back Hume By Anton Wylie

is a (surprisingly) well written romp across the philisophical grounds for this:

The End of Theory: The Data Deluge Makes the Scientific Method Obsolete By Chris Anderson

Not what I was expecting from a Reg article, honestly, but fun. If anyone is interested in discussing either do drop me a line.

STASH: Filesystem as text adventure

I’ve been jonesing to put together a little text based adventure program recently, but time constaints have kept me from even playing one. Somehow my mind wandered off to a recollection of the old Doom fielsystem navigation program I ran across years ago… an amusing concept, if not particularly feasible for day-to-day use. Fusing the two ideas, I decided a text-based adventure type interface to the filesystem would be neat, something like the lovechild of bash (or pksh for me) and some nameless MUD tramp. Thus was born STASH, the Super Text Adventure SHell!

It’s not actually a shell, but a script and an aliases file. The aliases file defines actions, like ‘look’ and ‘eat’. If for some reason you come across a conflict on your system, just rename the alias. These aliases all call the perl script, passing whatever arguments (usually keywords and env variables) are appropriate for that action. The script then does its bit, which could be any thing from printing a simple message in response to saving your state to a database file. When you want to play you just source the aliases file (I’d put the commands to open a subshell, source the file, and display a small banner into a script).

The neat thing about this is that you can continue to get work done- it doesn’t change the fact that you are sitting directly in a shell, and it doesn’t even take up extra screen/desktop realestate! When you get bored and need to blow off some steam, just start playing, hopping back when appropriate.

So you’ve got the tools: now what? Well, if we’re using the filesystem and environment for the setting… create a map of the filesystem and start writing descriptions and interactions. If using a perl script, these should go into a module, so that a single script can be used to play, or even combine, modules. If each new directory is given as a package then additions become very easy to plug together using a startup script that pulls together the desired packages via ‘use’ statements. To randomize room contents and encounters, use the directory listing, the environment variables, and the process running at the time.

I’m considering a persistant command filter as well, such that the way you perform your work itself affects the game. What if using sudo spuriously cost MP, cd progressed game time, and ls might cause a random encounter? You might heal according to the value of the commands issued while the filter was in affect, or take damage according to the return value of commands…

$ cd ..

“The door is locked”

$ cd /root

“It’s awfully dark in here…”

A minor satori (is all it took)

Like every bug, I did it to myself.

I was having difficulty figuring out why, after visiting a certain page on my development subdomain’s site, my session logged out. There wasn’t any code to do this… it’s cookie based… the cookie is there, but seems to change value, as if the session is being deleted. Finally, I notice that there’s a cookie for my production subdomain that uses the same name… and they both apply to the same domain. This means that if I were to try going back and forth between domains and hit a page that sets this cookie, my session is unrecognized by the other subdomain. But I haven’t been going back and forth… ahh, but I DO include an object on that page, and upon examination, the code that provides it is hard-coded to my production site. So I was surreptitiously loading content from my production site, which set the cookie, which conflicts with my dev session cookie because they’re both whole-domain cookies.

Changing the object code to apply only the current call’s subdomain cleared up the problem.

Hello dad, I’m chrooted into jail, and I LIKE it here

So I’ve spent most of my free time in the last month migrating all my old code from a shared hosting environment to a virtual server, where I effectively have root control of a freebsd server and manage it from the ground up. This has meant I can now do things like run mod_perl, fiddle with (and bounce, and bounce) apache, and get dedicated static IPs to run SSL (https) from. This has meant setting up these service from scratch (ok, from the very good scratchings on the FreeBSD port’s tree) and porting my code over. Luckily I started writing it with mod_perl in mind (back before my one and only test server died and I moved to a shared host) so there isn’t much work on that end. Then early this week I got another (virtual) server so that I can fully break out production and development, but that means I took a day off to sleep and finish grooming the new production server and configuring everything…

Which leads to me buying ”Practical mod_perl” to have the text on hand, which leads to paying $3.00 for the book, $7.00 for expidited shipping, and receiving a $50, 900 page technical reference off amazon partners. Sweet.

It also raises the question of what to do about a mail server. Poo.

Subversion property tools

I spent a good chunk of today writing up some svn command line tools for managing updates, commits and so on based on properties. This is largely in an effort to avoid full out branching, allowing us to differentiate between more frequent development commits (to track changes during development) and less frequent production-ready commits. By ignoring any revisions of a file past the most recent “production ready” tagging when updating we can ensure development and production maintain the same basis while without adding anything to the development cycle. Project name tagging will also allow us to track obvious and hidden dependencies for the purpose of recompiling… We currently have little build environment to speak of despite working so closely to the data structure itself, so sanity checking and such is largely… and acquired skill. It is also entirely undocumented.

Once I have them spruced up a bit I’ll put them up.

Demon Penguins

Having migrated all my data to an external drive, I’m hoping to squeeze my laptop’s windows partition down and install another OS this weekend. I plan on primarily using this new OS, but want to keep XP for gaming. I’m torn between Ubuntu and FreeBSD.

I’ve been into FreeBSD for a few months now, and I like it. I hesitate only because of the lack of native Flash support… while some people still grump about those new-fangled websites, and while I think it’s often inappropriately used, I watch a good number of videos (like the TED talks.) I know it’s possible to get some level of support, but it’s something I’ve failed to get working so far, and I don’t want to reboot just to watch a video.

Linux has better Flash support because Adobe decided to supply it to them. Not only do they not lend this support to BSD distros, Adobe expressly forbids BSDs from including it. It’s a commercial strategy based on their alliance with M$, as far as i can figure. There are Flash re-implementation projects, like Gnash, and there are ways of using the Linux binary code… but it’s a hassle, and Firefox seems to love to crash when I make the attempt (Opera just ignores it, but then, that’s to be expected.)

So if I install Ubuntu, it’s basically for the Flash. I guess at least I’ll be better able to help support others who want to migrate to Ubuntu. Some consolation…

I’m also on a simplification kick, so while I would typically just install both, I’m fighting that urge. For now. ;)

Up for grabs: of meals and fish

Whenever I get an idea for a site project, I tend to run to the command line and bounce from whois to whois, looking to see if I can find a good name that isn’t registered. OK, sometimes I don’t even have a good idea, I just like to see what I can find among the ever diminishing top level domain namespaces…

I’ve gotten better (I don’t want to go on the cart!) about not registering my finds until I’m SURE I have something worth putting up… but at $10 or so for a year registration it can be pretty hard. In an effort to offload the burden I’ve decided to throw whatever I find and am definitely not going to register up here.

The funniest ones are the ones that can be parsed in multiple ways, or provide options for interesting subdomains or e-mail addresses. For example:

  • meallover.com – As in “meal lover.” I was thinking ”me all over,” but who doesn’t love food? Good for a recipe / restraunt review blog. Ok, so there are other options too… like track, follow, lick…
  • ssismine.com -How would you like to get an e-mail from “your@ssismine.com”? I don’t send enough threatening e-mails to register that one. Maybe a fisherman would like this.b@assismine.com? Or a metal reseller: all.br@assismine.com?

If anyone does register a domain I post here, please let me know so I can see what you do with it.

Decentralized authentication scheme

Hmmm, I think I just had a worthwhile idea for a new authentication scheme that would work really well with the distributed nature of service clients and persistant, uniquitous nature of accounts. Now to work it out a bit more and find someone who can vet the details…