A Great Inactivity Reminder

I was lucky enough to spend a good part of my summer vacation with my computer shut off, and my only internet connection on my phone, on Do Not Distrub mode. When I got back I had this E-mail from Rescuetime waiting for me.

A screenshot of the E-mail Rescuetime sent me when I was on vacation.

I love this part:

Hopefully, you were away from the computer having fantastic adventures! If not, then something might have gone wrong.

They didn’t immediately assume a problem, but left me a way to check on what’s going on in case I wasn’t “away from the computer having fantastic adventures.” It made me happy about my vacation, even after I was back and triaging E-mails.

The Apple App Store icon on my phone showing 71 updates available after my vacation.
Yes, seventy-one. There were more the next day.

Of course as soon as I got back on wi-fi this happened:, (do I have too many apps installed?):

Of course, there was also a lot of this:
A photo of a slightly smoky sunset over the ocean.

Show your Olympic Colours

I’ve turned johnbeales.com and @johnbeales red for the 2010 Olympic Games in Vancouver. Join me and do the same for your blog, Twitter profile, or both.

Look how awesome my twitter profile looks all decked out for the Vancouver games:
Vancouver 2010 Twitter theme

You can do the same. Here’s a ZIP file containing the PSD Source, and PNGs of both my Twitter background, (with the text), and the blog background, (without the text).

Go nuts, and let me know here or on Twitter about it!

Edit: Here are direct links to the backgrounds with text, and without text.

Endpoints: A little secret for URL manipulation in WordPress

Today I’ve been setting up WordPress as the News section of a website which loads its pages via AJAX requests whenever possible, but falls back on normal HTTP requests when the AJAX loads are not possible.

The when the AJAX requests are initiated from Javascript, /outputxml/ is added to the end of the URL. This gets translated, with some mod_rewrite magic, to a $_GET parameter called output. /outputxhtml is also possible but since that’s the default it doesn’t get used very much.

After, (mostly), building the WordPress theme I started testing, and as I expected I ran into some problems when /outputxml/ was added to the end of the WordPress URLs. I got 404 errors, which makes total sense. I thought I could get around this by simply doing a little extra mod_rewrite magic, however, it seems there’s not way to simply replace /outputxml somewhere in a url with an empty string using mod_rewrite alone. After some time, I stumbled upon an underdocumented WordPress function: WP_Rewrite::add_endpoint and its friend, add_rewrite_endpoint. These functions make it so that WordPress recognizes /category/post-name/trackback, and /category/post-name/outputxml. Excellent!

I just had to create a plugin, make sure that WordPress wouldn’t kill my $_GET[‘output’] variable, add 1 line to my .htaccess and I was good to go.

References:

And this is what my plugin looks like, (for educational purposes only. I am not distributing it):

function fourRS_outputxml_activate() {
    global $wp_rewrite;
    add_rewrite_endpoint('outputxml',array(EP_PERMALINK, EP_PAGES));
    add_rewrite_endpoint('outputxml',EP_ALL);       

    $wp_rewrite->flush_rules();
}
register_activation_hook( __FILE__, 'fourRS_outputxml_activate');


function fourRS_outputxml_deactivate() {
    global $wp_rewrite;
    $wp_rewrite->flush_rules();
}

register_deactivation_hook( __FILE__, 'fourRS_outputxml_deactivate');


/* Makes it so WP doesn't eat my nice $_GET variable */
function fourRS_parameter_queryvars( $qvars )
{
    $qvars[] = 'output';
    return $qvars;
}
add_filter('query_vars', 'fourRS_parameter_queryvars' );

Edit (August 25, 2009): Changed the attrbutes in the add_rewrite_endpoint() function.

Using Microsoft’s VPC Images with VMWare Fusion

We all know the sinking feeling when we have to test a website in Internet Explorer. You built the site, it looks beautiful in Firefox and maybe Safari too, but now you have to open up Internet Explorer 6, 7, and 8, and make sure it plays nice with all three of them. Even better, Microsoft has made it so that you can only have one version of IE installed on a computer at a time. True, you can use things like Multiple IEs or other similar products, but they never play quite right.

Fortunately, Microsoft has supplied us with Virtual PC images of Windows with Internet Explorer installed. Unfortunately, Virtual PC is a Windows-only program so you need a PC to run them on. Or do you?

You don’t! If you’re using OS X you can use VMWare Fusion to run those Microsoft VPC images, after a little tweaking. It is much easier if you have a copy of Windows available to you during the install process, (that’s how I did it), but I don’t believe this is an absolute necessity. Here’s how it works:

Basically, you need to download the VPC images, extract them, and convert them into VMWare Fusion virtual machines. It sounds trickier than it is.

First, download and extract the VPC images. If you can use Windows to do this it’s easy, (the images have self-extractors), if not try p7zip, (see instructions in this forum thread).

[edit: July 15, 2009]: Then, somehow, you have to convert your VHD files into VMC files. The easiest way to do this is to use Microsoft’s VPC to make a new virtual machine from the VHD files, but you do need windows to do that. You will be converting these .VMC files into VMWare native virtual machines.
[/edit]

To convert the VPC images to something else, use VMWare vCenter Converter. It’s a stand-alone program for Windows or Linux that easily converts VPC images to VMWare Fusion virtual machines, as well as several other formats. You can even choose between Fusion 1.x and Fusion 2.x. It will even install the VMWare tools pagkage for you. I did the conversion under Windows, but there’s probably a way to get the linux version to run under OS X, at least hopefully.

Once the conversion is complete, fire up OS X & VMWare Fusion and open your new Virtual PC image. There are some things that run on the first startup of each machine, give it a few minutes then hit cancel on all of the “Please insert the XP SP3 CD” messages that remain, it doesn’t seem to hurt Windows. I think it’s looking for a battery driver in my case, (maybe I should try to install the Bootcamp battery driver?).

That’s it, enjoy testing. I am able to run, slowly, all 3 IE versions with the Windows XP images, and my computer isn’t as slow as when I run only my Bootcamp Vista install under VMWare Fusion. I’m thrilled to have these 3 new debugging tools at my disposal.