Web Programming

Finally a use for Netscape!

— This upcoming video may not be available to view yet.

I’m a Mac user (and proud). When it came to the ‘big switch’ there were several things that I needed: my documents, my music, my pictures and my internet (emails and bookmarks and so on). All of these were easily copied across using a cross over cable, no problems there - but shock horror, my emails were another story. Microsoft Outlook Express stores emails in a non-standard format which can’t be read by Apple Mail - disaster! It was then that I remembered once installing Netscape to test compatibility of my web site. Netscape had very nicely offered to import the Internet and email settings from Internet Explorer and Outlook Express. Checking up on this I found that when it does this it stores the resulting emails in a standard .mbox format - which can then be read by any sensible email client. Wohoo! So the basic steps to import your emails from Outlook Express on Windows to Apple Mail on the Mac:

  • Install Netscape on the Windows box.
  • Allow it to import from your Outlook Express.
  • Copy the newly created .mbox files to your Mac.
  • Show Apple Mail where it can find them when it asks.

That’s it - yay! Ooo and make sure you remember to uninstall Netscape afterwards or your PC might become contaminated or something hehehe.

Start semantics simply

Oliver Brown
— This upcoming video may not be available to view yet.

You may or may not have heard of microformats. They’re basically along the lines of the semantic web project but in a more practical way that is more likely to take off. It basically involves adding extra bits of semantics to web pages (or any XML-based documents) in a consistent way that doesn’t limit what already exists. But there are much simpler good practices that need to be encouraged regarding semantic markup first.

This blog post illustrates a wonderful misuse of HTML and offers an important explanation about why it is a misuse (or at least a decidely-less-useful use).

Bad DOM

Oliver Brown
— This upcoming video may not be available to view yet.

The Dom Scripting Taskforce says adding non-standard markup to page using Javascript is OK. Well I wouldn’t call it a “best practice” but from a personal point of view I can’t see a practical disadvantage.

For me the problems with bad markup come from trying to parse it automatically (using PHP’s SimpleXML object for instance). Since the javascript will basically only affect the page a human sees and not a machine, many of the disadvantages of non-standard markup fade away.

Wohoo, MySQL 4!

Oliver Brown
— This upcoming video may not be available to view yet.

Not that it really makes much difference yet, I’m now running MySQL 4!

The upgrade was easier than I expected with the only problem not strictly being an upgrade problem (I had to manually kill MySQL and restart it to get it to recreate my socket file). This is all preparation for installing PHP5 so everyone can actually see Galaxia Reborn.

Odd PHP problem

Oliver Brown
— This upcoming video may not be available to view yet.

The following produces an error:


function hex2rgb($hex)
{
    for($i=0; $i<3; $i++)
    {
        $temp = substr($hex,2*$i,2);
        $rgb[$i] = 16 * hexdec(substr($temp,0,1)) + hexdec(substr($temp,1,1));
    }
    return $rgb;
}

function hex2rgb($hex)
{
    for($i=0; $i<3; $i++)
    {
        $temp = substr($hex,2*$i,2);
        $rgb[$i] = 16 * hexdec(substr($temp,0,1)) + hexdec(substr($temp,1,1));
    }
    return $rgb;
}

But not the error you might expect. PHP doesn’t even get to complain about redeclaring a function with the same name since the second function is full of parse errors.

I have a vague idea what the problem is but I’m not sure. Any takers? :P

Sorry about the dodgy display…

I quite like JavaScript

Oliver Brown
— This upcoming video may not be available to view yet.

For a long time I hated JavaScript. I think I’m beginning to like it now. The following works perfectly in Firefox and works slightly less well in IE6. http://brownab1.miniserver.com/reborn/demo.php.

To use just click and drag. Or in IE6 press the button, drag then press again.

Objects

Oliver Brown
— This upcoming video may not be available to view yet.

Almost everything in Galaxia is an object. In hindsight this was a bad choice of name (from a programming standpoint I have objects of type Object), but I’m basically stuck with it. And I still can’t think of a better name.

The most interesting type of objects in the game will be vessels. The reason I chose vessel over ship is because not all vessels will actually be ships. Space stations for instance will be vessels that don’t have engines.

Vessels will have components and the components will add most of the functionality. I can’t tell you exactly what these will be or how they will work since this is the next big feature I need to implement. But basically, each component will allow a vessel to be given certain orders. For example engines allows a vessel to move somewhere, guns allow it to fire on other vessels.

The exact makeup of each vessel can be chosen when you build it. This also answers a question that has been causing me problems ever since the original Galaxia: “Why build multiple shipyards?” Well building some of the more exotic components will require some extra facility (Widget Factory for instance) therefore it would be better not to build one with every shipyard (you won’t have room anyway).

Silly .htaccess

Oliver Brown
— This upcoming video may not be available to view yet.

Wordpress seemed to be not updating my .htaccess properly but not telling me. Which is why none of the permalinks work. It’s funny, I was about to comment that none of the new visitors to XHTML Friends had made their way over here. Of course they probably did and just couldn’t comment…

Thanks to Ryan for pointing out the complete failure of all the internal links on the site…

Should Galaxia use Ajax?

Oliver Brown
— This upcoming video may not be available to view yet.

I used JavaScript once succesfully and it goes to my head…

I read a book on doing XML stuff with JavaScript and thought “Very clever. But Why?”. Well apparently it’s taking off. It’s how Google Maps works.

And if you didn’t know (I didn’t; reading blogs is actually helping me) Ajax stands for Asynchronous Javascript and XML.

It would mean you’d just drag the map to scroll in Galaxia… :D

In hindsight. No. Too much effort and too many other things I need to do…

XHTML Friends

Oliver Brown
— This upcoming video may not be available to view yet.

Wohoo! I’ve just “finished” the XFN site. Go take a look :) XHTML Friends