Moving House

June 2nd, 2004

It looks like I’ll be moving house at the start of July. Just went to check out the new place and it’s a big 5 bedroom house on top of a hill in Mt Gravatt. Almost 270 degree views out over the suburbs (the missing quarter is the city view) and the place is currently being renovated. Still no lease signed but the owner is apparently a friend of one of the guys I’ll be moving in with.

The only real concern is that I haven’t actually met this guy, but he comes on the recommendation of my current house mate and that’s proved reliable in the past. Besides, I’m really sick of living in this tiny little unit with two cars and one garage.

JavaScript Hacks

June 2nd, 2004

JavaScript is one of those odd languages that noone really appreciates the full power of. Mostly that’s because it’s also an awful language that’s hard to get the full power out of, particularly when working with multiple browsers. Still, my work often calls for large amounts of JavaScript hacking.

Some interesting things I’ve learnt lately:

In Safari, if you use window.open(’file:///Users/aj/file.html’, …) it will either not open the file at all or refuse to execute any JavaScript in the file in the first time the page is loaded (reloading the page causes the javascript to execute). However, if you use window.open(”, …) and then window.location = “file:///Users/aj/file.html”; it works perfectly. Go figure.

Most people realize this but many don’t think of it very often - JavaScript can support multidimensional arrays, including multidimensional associative arrays with dimensions having varying sizes.


// One dimensional array.
var array = new Array();

// Two dimensional array.
array[0] = new Array();
array[1] = new Array();

//  Three dimensional array.
array[0][0] = new Array();

// Note that at this point array[0] has length 1 but array[1] has length 0.

array[1] = new Array();
array[1]["cat"] = "eaten by dog";

and so on and so forth.

In IE for Windows, if you do something like:


var win = PrivoxyWindowOpen('', '');
win.document.write('<html><head><script src="script.js" language="JavaScript"></head><body></body></html>');
win.document.close();

The script will not execute until you reload the page (even if script.js was given as an absolute path on the same host). If however you use:


var win = PrivoxyWindowOpen(window.location, '');
win.document.write('<html><head><script src="script.js" language="JavaScript"></head><body></body></html>');
win.document.close();

The script will execute. I’m not sure if a new request is sent for the current page or not though. In all the cases above, window.opener is available and can be used.

Anyway, just thought I’d mention it for the benefit of those who are lucky enough not to work with JavaScript too much.