JavaScript gah!

JavaScript bit me again, with its concatenation operator being the same as its addition operator. So instead of the total amount of an order, I ended up with a string of all the prices in the order. Grrr.

I must remember what Crockford says in Appendix A: Awful Parts:

The + operator can add or concatenate. Which one is does depends on the types of the parameters. If either operand is an empty string, it produces the other operand converted to a string. If both operands are numbers, it produces the sum. Otherwise, it converts both operands to strings and concatenates them. This complicated behaviour is a common source of bugs. If you intend + to add, make sure that both operands are numbers.

Dear Anthony Albanese on Internet Censorship

Lots of people are writing to their MPs to explain why the proposed Internet censorship regime, as currently being pushed by Senator Conroy, won't work and is a draconian imposition on the rights of citizens. The biggest issue is that the system won't actually work, as measured against its purported goals, but will have a dramatic impact on the performance of the network and the availability of perfectly-legal material.

So get over to OpenAustralia to find out who your local member is, and get writing! The only language they understand is votes. Here's my letter to Anthony Albanese, who happens to also be Minister for Infrastructure, Leader of the House and a big shaker and mover in the ALP.

Dear Mr Albanese,

I'm writing to express my concern about the proposed Internet censorship regime being promoted by Senator Conroy. He would instead characterise it as a "filtering" regime, but as has recently emerged it will not be optional and so constitutes censorship, in the Great Firewall of China model, used to stifle political speech in China.

Two aspects of the proposed censorship regime concern me most, but they aren't the only problems.

First of all is the fact that it won't work. I'm an Internet technical type, and I've looked through the lab trial report and can't see how any technical approach could possibly work effectively. Regardless of whether or not it will slow down peoples' Internet connections--and it most certainly will--it will not actually be effective in blocking only the targetted material, and nothing else.

Any filtering system will either need to break the security mechanisms used for online commerce, trade and secure communications (like Internet banking and stock trading) or will be trivially easy to bypass. So illegal material will continue to be available to the people who want it. Technically-savvy children will also be able to bypass it, with their parents given a false sense of security that the government is doing their job for them.

A friend of mine lived in China for six months and was upset that he couldn't view sites like CNN, BBC or our own ABC to see what was happening in the world. In about fifteen minutes I set up a method for him to get around the Great Firewall of China and view these sites. This method would be used to get around the Great Firewall of Australia.

My second major concern is the way Conroy is stifling public discourse about his proposal. His office attempted to stop a respected network engineer from criticising the project, by placing pressure on the Internet Industry Association. He has also repeatedly characterised any critics of the proposal as being pro child pornorgraphy. This cheap rhetorical trick conflates the two aspects of the project: one is to "protect children from bad stuff on the Internet" and the other is to "censor illegal material".

The current system of voluntary Internet filtering software, made available for free to Australian households, is flawed but is probably the best approach we have. It means, at least, that parents have control over the level of censorship they want to impose on their children. Otherwise we end up with every special interest group banning their own hobby horses for everyone. That means Steven Fielding wanting to ban the human reproductive system and Nick Xenophon wanting all gambling made illegal.

Education is the key to handling the diverse range of content on the Internet. Families need the tools to make decisions for themselves, rather than having Big Nanny make decisions for them. One of the easiest approaches I've heard of is placing the family computer in a public location such as the dining room, so that everyone can be observed using the Internet.

I'd be happy to meet with you and explain the technical details of the proposal, and why it won't work. I also have some ideas about a face-saving fallback approach that does the maximum to prevent genuinely illegal content (child porn, terrorist material) that can be done by government without imposing draconian restrictions on citizens.

Simon Rumble
Marrickville NSW 2204

IE and multiple identical IDs

It seems Internet Explorer is quite strict about having multiple IDs in a document with the same selector. This, combined with the way I read the Prototype documentation, had me walking around in circles for ages completely unable to identify the bug. How annoying!

So I've documented it here, with a test to demonstrate it. I'll submit a ticket for the Prototype document shortly, as it does give the impression this will work.

Contractor payroll services

I'm about to cut the agency out of the equation with my long-term contract (2 years so far) and reduce the amount they're taking from my wages. I don't want to avoid tax, don't particularly want (or really have) deductions and don't have any other significant income sources, so the company formation route isn't a good idea. I just want someone to do my payroll, insurance and super.

So can anyone recommend such an agency in Australia?

Note about Same origin policy

JavaScript's same origin policy security model means that a script can't (directly... there are sneaky ways aroun dit) request data from another site. It's quite strict. is different to

One thing I'd always assumed, but now I see how it wasn't a sensible assumption, was that the piece of code calling the data had to be served by the same domain name it was going to be calling. I've just done a little test of this, and discovered that's not true.

So if you're dead keen to see it, have a look at this test which loads the script from and actually loads Prototype from somewhere completely different. It has no trouble pulling data from, but won't let me drag data from

ZigBee sensors

I've been watching the space of low-power wireless networking for some time, as it has some cool possibilities for sensor networks. ZigBee is one such standard that seems to be gaining support. It's a lot simpler and lower power than other protocols like Bluetooth.

Make magazine had a really interesting article recently about using ZigBee inertial sensors to track the crashes and hits taken by a roller derby team, and use it to trigger "zap", "pow", "boom" sound effects. Very cool, and it all seemed quite simple!

I'd like to use the ZigBee temperature sensors in my garden. The long-term plan is to monitor the weather and supply tank water through an irrigation system only when it's needed.

So has anyone used this ZigBee stuff and know any good resources to start out?

Cats and MythTV


Geek resourcefulness at its best. This just got posted to the MythTV users list:

Subject: Cats and MythTV...
Recently my cat has decided that the top of my MyhTV box is a great place to have a nap... This is a situation I am not happy about, in spite of the positives (like noise reduction), I am concerned about fur shed and heat trapped. Moving the MythTV box to a place the cat wouldn't be able to climb/jump on top of isn't an option. I have tried putting a large plastic toy (a piggy bank) on top of the MythTV box, but the cat has found she can push that aside...

So, anything that hurts the cat is NOT an option, on the other hand, stopping the cat from napping on the top of that PC case is a a priority.


Geeks being great problem solvers, the responses are well worth a read.

Super cheap USB keys

I can't remember who it was, but someone on the Planet Linux Australia was talking about using cheap USB flash drives to teach RAID. I thought it was Russell Coker but can't find it now.

Anyway, just wanted to point out that 1GB USB flash drives are $9 at Dick Smith. Insanity! I remember paying UK£80 for my 1GB flash drive. Not all that long ago.

Coolest Chrome feature: search within page

Google Chrome search within page

So far this is my favourite little UI hack that I've found within Google Chrome. Kind of appropriate that a search engine company would get this right, I suppose.

If you're familiar with Firefox's search feature, Ctrl-F to enter a search term finds the results within the page progressively as you type in the little search box. Chrome moves the search box to the top-right and highlights the answers as you type. Even cooler, it highlights the location of matches in the current page along the side inside the scroll bar, so you can see the frequency of the search term.

That's so obvious now you wonder why nobody thought of it before, particularly given this is the same presentation used by graphical diff tools that developers use every day. Very cool.

Update: Julien Goodwin points out that this feature has been in Opera for over a year. I don't use Opera though, so I've never seen it.