Saturday, March 31, 2007

The Peace Wager

What was the prison guard with a pyschology degree doing negotiating with the murderous head of an army of abducted children, the Lord’s Resistance Army? What do American Christian Fundamentalists, including the son of the American tele-evangalist Billy Graham, have to do with the civil wars in the Sudan and Uganda? How is this connected to the genocide in Darfur? And what does any of this have to do with the guinea-worm?

For the answers to these questions and more, see The Peace Wager in The Walrus.

We will make you whole again

On March 24, 1989 Captain Joe Hazelwood was drunk on duty of the oil tanker Exxon Valdez and ran it aground in Alaska's Prince William Sound.

Exxon (now ExxonMobil) did nothing to contain or clean up the spill for three days of clear weather. On the fourth day, a storm hit, spreading crude oil across 3,200 miles of coastline. In the face of one of the greatest man-made environmental disasters in history, Exxon official Don Cornett told the Price William Sound community "We will make you whole again."

Not only did the oil spill cause environmental havoc, but it also meant ruin to the locals: ruin to their livelihoods, ruin to their businesses, and in some cases, ruin to their health due to exposure to the toxic chemicals used to clean up the oil. Eighteen years later, the area has still not recovered from the disaster: out of the thirty significant species in the area, seven have not recovered at all, and only ten have recovered fully. With such long-lasting damage to the environment, neither has the economy of the area. The multi-million dollar herring industry which supported the local economy has been closed indefinitely.

In 1994, a US Federal Court awarded the 34,000 locals affected US$4.5 billion dollars in punitive damages: about $26,000 per person per year at the time. This was on top of the $300 million in voluntary payments Exxon made to eleven thousand of the locals.

Eighteen years after the disaster, Exxon have still not paid the damages. Of the 34,000 people who are yet to received one cent to compensate them for the harm caused by Exxon's negligence, about six thousand people have died.

The purpose of punitive damages is to discourage negligent and harmful behavior. Has ExxonMobil been discouraged? As early as 1994 they had written off for tax purposes $2.8 billion, turning what could have been a big loss into a small loss. They successfully sued their insurer, Lloyds of London, and recouped $411 million for cleanup expenses and interest. Exxon has still not fitted double-hulls on its tankers in the area, displaying an appallingly negligent attitude.

In 2005 ExxonMobil had the most profitable year of any corporation in history, posting a profit of $36 billion dollars. Obviously not enough for them to pay off their obligations to the people of Prince William Sound.

Thursday, March 29, 2007

Think about it

This centence contians 4 erors.

True or false?

Ribena maker fined

Two days ago, the maker of the Ribena blackcurrent syrup, pharmaceutical giant Glaxosmithkline, was fined $NZ217,500 ($A192,900) for deceptive advertising in a New Zealand court.

Glaxosmithkline admitted that its ready to drink cartons of Ribena did not, in fact, have "four times the Vitamin C of oranges". Instead of the claimed 7mg of vitamin C per 100ml, the Ribena in fact had no detectable vitamin C at all.

The false advertising came to light in 2004, when two New Zealand schoolgirls, Anna Devathasan and Jenny Suo, tested the children's drink for a school project, and found no Vitamin C. Glaxosmithkline ignored their complaint until it was taken up by the New Zealand Commerce Commission.

The case is seen as a win for consumer correction, but it isn't really. Glaxosmithkline got to lie in their advertising for at least four years, and possibly as many as fifty-five years. I remember the claim from their advertising thirty years ago. And now that they've got caught out, the punishment is 0.00102% of one single year's profit.

That'll learn them.

The only bright side of the case for consumers is that Glaxosmithkline has been ordered to run corrective television advertising, which will embarass them for a few months and cost them sales. Why, by the time the whole thing blows over, it is quite possible that they'll have lost an entire day's profit.

Monday, March 26, 2007

Io and Jupiter

This makes an excellent desktop wallpaper: the moon Io passing in front of Jupiter.
Io crossing Jupiter

NASA's website says:

The image is deceiving: there are 350,000 kilometers -- roughly 2.5 Jupiters -- between Io and Jupiter's clouds. Io is the size of our Moon, and Jupiter is very big.

Security. Yeah right.

From time to time, I'm forced by the cruel Fates to do Internet banking with the NAB (formerly National Australia Bank). When I log in, their website pops up a window complaining that the browser I'm using (Firefox) isn't supported, and I should use one of their supported browsers, Internet Explorer, Firefox(!) or Netscape Navigator.

(Who still uses Netscape Navigator???)

Mac users will be rightfully annoyed that Safari doesn't get a look-in, and Opera users will likewise be feeling left out in the cold.

Unlike some banks which will remain nameless (you know who you are!), at least the NAB gives you the option to ignore their oh-so-helpful suggestion to use IE or the browser you're already using, and their Internet banking works quite well under Firefox on Linux.

If I tick the "Don't bother me with this again" checkbox, I get a day or three of peace until the next minor update to their website, then I start getting those spurious unsupported browser warnings again.

The NAB has recently gone on a security splurge, telling all and sundry how concerned they are with computer security. Then why are they still supporting Internet Explorer, the number one security hole on the Internet bar none? For a couple of dollars a customer, they could send everyone a CD with Firefox on it. Instead, they muck about with half-hearted security fixes like SMS alerts, which will work really well until some phisher simply does a man-in-the-middle attack. It's a band-aid, not a fix.

Here's a simplified way it might work: you start up your security hole browser and go to the NAB website. Unknown to you, Windows' DNS lookup has been compromised, so when you go to www.nab.com.au, you're actually going to a look-alike site in Bulgaria or North Korea. Everything you type into the phishers' site gets passed on to the real NAB site, except that when you transfer $50 to your Aunt Tilly's bank account for looking after your kitten for the week, the phishing site modifies the data to transfer $5000 into their account, then passes it on to the NAB. The NAB sends you an SMS code, and you dutifully enter it into the phishing site, which sends it on, all nice and clean.

Apart from a small delay, well within the expected variation of Internet speed, you won't notice a thing until you go to transfer some more money tomorrow and discover you're $5000 short.

(This man-in-the-middle attack isn't unique to Windows. It could happen with any operating system that is compromised. But Windows and IE leave so many more opportunities for compromise.)

It's easy to say that you take security seriously. But that doesn't mean that they're prepared to actually take steps to make on-line banking really secure. So long as the browser and operating system are so easy to compromise, phishers will always be ahead of the game.

Who do they think they're fooling?

It must be hard being a cold-calling sales drone, but is it any surprise that people despise them for their tactics when this sort of thing takes place?

I just had a call from a sales drone, I'll call him Henry Deschen (not his real name) who tried to convince me that my boss had personally told Henry that he was interested in being a reseller in Henry's product, let's just call it a Bio Tech Snake Oil Delivery System.

Now, I know that not only isn't my boss interested in Snake Oil Delivery Systems (Bio Tech or otherwise) but the chances of him being interested in reselling anybody else's product is about the same of him winning the lottery three weeks running.

So what is it with the sales drones? Do they really think that the best way to start a business relationship is with something like this?

Actually, it works for advertisers, so why not? I must try it some day -- call up a random customer, and say "Hey, your boss said he wanted you to order thirty-seven cases of Premium Impala Chow. I need a purchase order stat!"

Sunday, March 25, 2007

I before E

There's a mnemonic to help you remember the correct spelling of ie/ei words:

    I before E except after C,
    and when sounding like Ay as in neighbour and weigh,
    and on weekends and holidays, and all throughout May.

I like this version better than the more commonly heard British and American ones, because in my opinion in demonstrates the absurdity of any rules where there are so many exceptions -- perhaps more exceptions than words that actually follow the rule.

Here are just a handful of the exceptions:

    beige, caffeine, eight, either, feisty, foreign, freight, heifer, heist, leisure, neither, seize, sheik, species, veil, weird

Many people have tried to extend the I before E rule with various caveats and qualifications, eventually reaching the height of absurdity above. There's a spirited defence of the English-style I before E rule here, but I think it is informative that although the author gives no fewer than twenty exceptions to the extended rule, he only gives six words that follow the rule:

    relieve, belief, irretrievable; receive, deceit, inconceivable

Despite all the caveats, there are exceptions to all the extended rules, which leads me to the conclusion that the rule simply is no good as a general purpose mnemonic.

Saturday, March 24, 2007

Overheard in the Impala household

Overheard in the Impala household this morning:

Is it just me, or am I hungry?

For the sake of my credibility, the speaker shall remain completely anonymous.

Insecure and fearful

A friend recently posted a small gift from the United States of America to Mrs Impala. It arrived wrapped in (among other things) a plastic bag from a fabric store called HANCOCKfabrics.

Plastered on the bag in large letters, at least as big as their various advertising, is:

God Bless America!

A tad insecure, don't you think? I mean, honestly, if there is a God, do you really think he'll be up in Heaven thinking "I was going to visit rains of frogs and rivers of blood on the Americans because of their invasion of Iraq, but now that I've seen that plastic bag, I'll give them another thousand years of world power instead"?

Are (were) all superpowers as fearful and insecure as the Americans? I suppose they probably were. All that flag waving and "the sun will never set on England" and parades in Red Square and triumphs and arches, I think it's all just a way for people to deny the fact that This Too Shall Pass. I knew governments and kings played this silly game, but this really brought it home to me that the fear goes all the way down.

Wednesday, March 21, 2007

Unique leopard

The WWF is reporting the discovery of a new species of clouded leopard from Borneo. Genetic tests have shown that it is a different species to the clouded leopard from the mainland of Southeast Asia, with almost as many differences as between lions and tigers. There are about 40 genetic differences between the two species of clouded leopard, and 56 between lions and tigers.

But what's especially interesting is that apparently there's only one of them, and it's at least 100 years old:

"For over a hundred years we have been looking at this animal and never realized it was unique," said Stuart Chapman, WWF International Coordinator of the Heart of Borneo program

*raises eyebrow*

McJobs

According to page five of today's MX, McDonalds is upset about the dictionary definition of "McJob", and have asked the Oxford English Dictionary to remove the definition.

The OED defines "McJob" as:

an unstimulating, low-paid job with few prospects, especially one created by the expansion of the service sector


MX reports that McDonalds' executives say that the definition demeans its workers.

Well, here's a thought. Maybe if McDonalds is concerned about its workers being demeaned, maybe they should stop putting them in jobs that demean them?

This is one instance where shooting the messenger simply won't work. Even if the OED caves and removes the word, it isn't going to make a lick of difference. The word was created by the public, and was used for years long before the OED even considered putting it in the dictionary. The OED doesn't invent words, it reports on words that are in use. The words will remain in use even if the OED doesn't include it.

Monday, March 19, 2007

Cruel and unusual

On the train today was a prison guard in full uniform, presumably going off to work.

He absolutely reeked of some cheap, nasty, toxic-chemical-smelling aftershave. I'm sure he must have bathed in it. Not only were five people overcome by the smell and collapse, but the fumes rising visibly from him were eating away the train walls and windows.

I think it is terrible that prisoners in jail have to suffer the cruel and unusual punishment of smelling that man's aftershave. You wouldn't be that cruel even to Osama bin Laden or Adolf Hitler!

Thursday, March 15, 2007

Goings on in Gitmo

Tom's Dispatch has reprinted an article by Karen Greenberg, where she describes the conditions in America's prison in Cuba, Guantanamo Bay.

8. Guantanamo's deep respect for Islam is unappreciated. All the food served in the prison is halal, prepared in a separate kitchen, constructed solely for the detainees. All cells, outdoor areas, and even the detainee waiting room in the courthouse where the Military Commissions will be held, have arrows pointing to Mecca. All compliant detainees have prayer rugs and prayer beads. All detainees, no matter how they behave, have Korans. The library includes books on Islamic history, Islamic philosophy, and on Mohammed and his followers. Our escorts are armored against our protests about the denial of legal rights to prisoners. The right to challenge their detention in court, actually being charged with a crime, or adhering to the basic rules of procedure and evidence that undergird American law -- none of this is important. They do not see that what's at stake is not building a mosque at Gitmo, any more than it is about serving gourmet food, or about the cushy, leather interrogation chairs we are shown. It is about extending the most basic of legal rights, including the presumption of innocence, to those detained here.

A few(?) isolated(?) cases of guards flushing copies of the Koran down the toilet aside, I think this is quite significant. I've argued for years now that the battle isn't really between the Christian West and the Muslim Middle East. Bush versus bin Laden is just a side-show. That's a minor spat between two leaders' whose world-view is remarkably similar. Hitler and Stalin went to war too, but minus Hitler's insane racial obsessions, the two were natural allies.

(Except, of course, people like Hitler and Stalin can't bear to be anything but top dog.)

Both Bush and bin Laden agree that God rules the world, and his appointed proxy should have ultimate and total power. They only differ on whether God's right-hand-man is called Osama or George. Whether you read the Bible or the Koran, that's not really important right here and right now, not compared to such things as over-turning the post-Enlightenment secular world, and replacing such humanist things as the rule of law and the presumption of innocence with the divine infallibility of presidents.

The real war, I believe, is between fundamentalists like bin Laden and Bush, who believe that they and they alone decide what's right and what's wrong, and those who keep the values of the Enlightenment. It is, I believe, no accident that the first target of Bush and his Fundamentalist neo-con friends, was not an Arab theocracy, nor the country which financed the 9/11 hijackers (Saudi Arabia), but the one seriously secular Arab state, Iraq. Saddam might not have been big on freedom and justice, but nor did he say he tortured people because God told him too.

I had a few other things to say about Gitmo, in particular about the case of Sean Baker, one of the military police on duty there, who was mistakenly beaten by his fellow guards and given permanent brain damage. I was feeling rather, shall we say short tempered and uncharitable when I wrote it, and my language might not be suitable for maiden aunts and pre-school children, so I put it on my Uncensored blog.

The War on Terror and homosexuality

According to the Christian Right, the West is in a fight for survival against the forces of darkness: Islamofascists who want to introduce a Caliphate across the entire world, starting with Iraq and ending with Washington D.C., London and Paris.

Against this dire threat, no act is too extreme:


Despite a chronic shortage of fluent Arabic and Persian linguists, the U.S. military and government continues to fire any linguist they discover is gay. The U.S. Embassy in Baghdad has only six fluent Arabic speakers. Six. And despite the need to interrogate all those dangerous terrorists, the U.S. military has recently fired twenty-six Arab and Persian speakers for being gay.

"SusanUnPC" from the No Quarter blog quotes a lovely exchange between an anti-homosexual activist and The Daily Show's Jason Jones:

The Daily Show's Jason Jones sat down with Paul Cameron, one of the nation's leading anti-gay activists, said, "I think the country, on the aggregate, is safer without Bleu in the military." Asked why, Cameron explained, "Guys don't want to think about other guys, other fellas, ogling them in the shower or whatever."

Jones responded, "I know I'd rather die in a terrorist attack than suffer through an uncomfortable shower with a gay." Cameron grudgingly responded, "Yes."


Never let it be said that the Christian Fundamentalists don't have their priorities in order.

Wednesday, March 14, 2007

Bad code smells

This has been around for a few years now, but it is worth reading even if you aren't a C or C++ programmer. Joel Spolsky wrote an entertaining description of how programmers' intuition about bad code grows, and a number of conventions which help make dangerous code "smell bad".

Fifty most influential people on the Internet

PC World has published their list of the fifty most influential people on the Internet, starting with Google's executives, all the way down to "singer"/model Tila Tequila, who redefined "friend" to mean 1.6 million people she's never met.

(No, I'm not linking to her MySpace page. Trust me, you don't want to see it.)

Windows phones home

Windows Vista "phones home" when you install it. More details are coming out about what identifying information it sends to Microsoft. Not only does it send back identifying information, but it does so even if you cancel the installation or update.

Two-faced piggy

Back in July, I wrote about a kitten born in Ohio with two faces. Recently, a pig was born in China with a similar mutation.

three-eyed, two-nosed, two-mouthed piglet
I wonder just how common such mutations are?

    This little piggy went to market,
    This little piggy stayed home,
    This little piggy had roast beef,
    and this little piggy had strontium-90 and radium-226.

Hmmm... I wonder if this mutant has any superpowers?

Monday, March 12, 2007

Goodbye XP

After months of planning procrastination, Mrs. Impala's long-suffering Windows XP computer has been cured of atherosclerosis and Alzheimer's disease by an upgrade to Kubuntu.

I've got more experience with Red Hat and the Fedora Core series of distributions, and last time I played with vanilla Ubuntu, I was seriously unimpressed. But Kubuntu seems pretty impressive, and KDE doesn't dumb everything down like Gnome seems to do. And WINE installed flawlessly the first time, unlike my experiences under Fedora Core 5.

And naturally, there was no product activation and we didn't need to register the software. I can change hardware in the PC as often as I like with the operating system deciding that it has been installed on a different PC and refusing to run.

I'll report back after Mrs. Impala and I have had a chance to give it a solid workout.

Update Monday, 13/3/07: Seems I'm not the only one ditching Windows XP for Ubuntu (with or without the K). So is the French Parliament, which is purchasing 1,154 new PCs running Ubuntu.

Friday, March 09, 2007

Precision

Some people think you can never have too much precision...

While writing data to a DVD with growisofs, it reported a transient error:

:-? the LUN appears to be stuck writing LBA=310h, retry in 141ms
141 milliseconds? Why not 140 milliseconds? Does the extra 0.001 of a second really make such a difference? 141ms isn't even a simple fraction of a second (it's a little less than one seventh).

Thursday, March 08, 2007

Rather harsh

On the train this morning, somebody left behind an exercise book which I dropped it off at Lost and Found.

But before I did, I checked the book for contact details. There was a short handout from the NMIT Department of Agriculture, written by the lecturer John Wellman.

Now, I don't know who this John Wellman is. He's probably a really nice guy who loves small children and is kind to puppies. But holy mother of pearl, the disclaimer plastered on the front of the handout was rather harsh! I don't remember the exact wording, but the gist of it was that the handout was the responsibility of the individual student, and under no circumstances would the lecturer or the Department provide another copy.

Imagine a student whose bag is stolen, or house burns down, and the lecture refuses to replace the handout, even if the student offers to pay for it. I would hope that the lecturer has no intention in living up to such a heartless warning, which raises the question, why make such an unreasonable claim in the first place?

Tuesday, March 06, 2007

Fool me twice...

The Bush administration is at it again, returning to the same tactic that worked so well to justify the war in Iraq, this time to justify war on Iran.

I've already written about Iran's barely-existent nuclear research program before. According to the evidence, Iran is something like fifteen thousand centrifuges short of being able to produce weapons-grade uranium. Now Hans Blix, the former UN weapons inspector, has spoken up, stating that Iran's nuclear research program is much more primitive than Iraq's was in 1991.

Even if Iran is trying to build nuclear weapons -- and that's a seriously big IF -- they're no threat at all.

Blix also points out that the Bush administration's "negotiating" tactic with Iran is counter-productive and doomed to failure. As Juan Cole reports:

He points out that Washington's insistence that Iran capitulate to all Bush's demands before negotiations even begin is "humiliating."

You catch more flies with honey than with vinegar. Insisting on total capitulation before negotiations even begin (and then what's left to negotiate?) might make Bush and Cheney feel like big manly men, but that's no way to run a picnic, let alone international relations with a country that can make your day miserable.

Cole also reminds us that:

[the Iranian] Supreme Jurisprudent has given a fatwa against having or using nuclear weapons as illicit in Islamic law. You can't acknowledge that Iran is a dictatorial theocracy and then turn around and say that his fatwa is irrelevant.

Naturally, the Bush administration isn't silly enough to re-use the same mushroom cloud story again. So they have a backup story: Iran, so the story goes, is behind the sudden rash of successful attacks on American tanks in Iraq.

Several weeks ago in Iraq, the Americans gave a military briefing claiming that the highest levels of the Iranian government had ordered the manufacture and supply of powerful explosive devices to Iraqi insurgents.

But the problem with this claim is that the greatest number of successful attacks has been coming from Sunni areas of Iraq, not Shi'ite. Not just blowing up tanks: also shooting down helicopters. Iran, being Shi'ite, is hardly likely to be arming the same Sunni who want the Shi'ites dead. To put it into perspective, imagine Iraq was Northern Ireland during The Troubles, and the British claimed that Catholic Italy was arming the Protestant Ulster Defence Association.

Professor Cole has published a long letter from a reader detailing this issue.

Sunday, March 04, 2007

Eighty gigabytes

A few days ago, I bought an 80GB hard disk in a USB enclosure. When I plugged it in, I found it was preformatted to two 30GB partitions.

Hmmm. 30+30... carry the two... minus the number you first thought of... you do the maths.

Hard disk manufacturers are notorious for inflating the size of their disks (e.g. an 80GB disk using 1GB = 109 bytes is "really" only 74GB using the traditional 1GB = 230 bytes) but a discrepancy of 25% is ridiculous.

Saturday, March 03, 2007

Defence of marriage

I'm not sure if this is a good idea or not...

The Washington Defense of Marriage Alliance seeks to defend equal marriage in this state by challenging the Washington Supreme Court’s ruling on Andersen v. King County. This decision, given in July 2006, declared that a “legitimate state interest” allows the Legislature to limit marriage to those couples able to have and raise children together. Because of this “legitimate state interest,” it is permissible to bar same-sex couples from legal marriage.

The way we are challenging Andersen is unusual: using the initiative, we are working to put the Court’s ruling into law. We will do this through three initiatives. The first would make procreation a requirement for legal marriage. The second would prohibit divorce or legal separation when there are children. The third would make the act of having a child together the legal equivalent of a marriage ceremony.

Absurd? Very. But there is a rational basis for this absurdity. By floating the initiatives, we hope to prompt discussion about the many misguided assumptions which make up the Andersen ruling. By getting the initiatives passed, we hope the Supreme Court will strike them down as unconstitutional and thus weaken Andersen itself. And at the very least, it should be good fun to see the social conservatives who have long screamed that marriage exists for the sole purpose of procreation be forced to choke on their own rhetoric.

http://www.wa-doma.org/

Privatisation in Iraq

Juan Cole has a welcome sign that at least some parts of the US government are starting to take responsibility for the corruption and incompetence of the Bush administration, and discusses the disaster that privatisation has been for the American military:

    ' The committee also released an internal Army memorandum reportedly written in September in which the Walter Reed garrison commander, Col. Peter Garibaldi, warned Weightman that "patient care services are at risk of mission failure" because of staff shortages brought on by privatization of the support work force at the hospital. '

The privatization of patient care services is responsible for a lot of the problem here. And so is the privatization of services for US troops in Iraq punishing them. Indeed, the privatization of guard duties through the hiring of firms like Blackwater caused all that trouble at Falluja in the first place. KRB never delivered services to US troops with the speed and efficiency they deserved. The Bush-Cheney regime rewarded civilian firms with billions while they paid US GIs a pittance to risk their lives for their country. And then when they were wounded they were sent someplace with black mold on the walls.

Israel to Saddam: come back, all is forgiven!

Too late now, but the head of Israel's Shin Bet (the domestic security agency), Yuval Diskin, has admitted that chaos left by the forceful removal of Saddam Hussein is a danger to Israel: Israel may rue the day the USA invaded Iraq:

When you dismantle a system in which there is a despot who controls his people by force, you have chaos. I'm not sure we won't miss Saddam.

Diskin also admitted that that Israeli judiciary treats Jewish terrorists differently from Arab terrorists, and while he opposed the withdrawal of Israeli security from Palestinian areas with no effective or lawful security forces, he also criticised Israeli militants who opposed further withdrawals from the West Bank.

Pratchett interviews

A short written interview with the author of the Discworld series, Terry Pratchett:
http://www.sfx.co.uk/page/sfx?entry=terry_pratchett_interview

And an excellent interview with Pratchett on Australia's ABC radio:
http://www.abc.net.au/queensland/conversations/stories/s1847832.htm?sydney
Direct link to the downloadable mp3 podcast here.

PTerry, as he is know to fans, worked as press officer at one of Britain's nuclear power stations for some years. In the ABC podcast he tells an amusing true story about the man who came onto the power station too radioactive to be allowed to leave. Then there was the time that they lost a tiny piece of radioactive iron, a piece of weld splatter, in an 80 thousand gallon septic tank.

In a response to the interviewer Richard Fidler's suggestion that fiction writers like Pratchett can't do research, Pratchett noted that although they are making stuff up they can do research because sometimes it's a good idea to make stuff up out of the right ingredients.

Friday, March 02, 2007

How (not) to validate email addresses

A question that programmers often ask is "How do I validate an email address?"

At first glance that appears to be a sensible question. If you're writing a web form or some other application that needs to accept an email address, you might want to detect errors (say, typing fred4my.com instead of fred@my.com) and give the user a chance to correct the error.

But the question of what is a valid email address is much harder than you might expect. The official standard for email accepts a very broad range of email address formats.

[Aside: what's with Google? Try searching for "how to validate email addresses" (without the quotes). I get a 403 error page:

We're sorry...
... but your query looks similar to automated requests from a computer virus or spyware application. [...]

After some experiments, it looks like Google UK blocks (almost) any search containing "email" and "address". But Google Australia doesn't seem to care; and even Google UK will accept the query if it comes from Konqueror's toolbar.]

The best advice for validating email addresses is: Just Say No. At most, check that the email address isn't blank. If you absolutely know that the address can't be a local address, check for the presence of at least one at-sign @. (Yes, you read me right the first time: at least one.) And that's it -- leave the validation up to the mail server. If the mail server can deliver it, it is valid, and if it can't, it isn't.

If you want to guard against user typos, get the user to type the address twice, like they do for a password.

But ignorant programmers -- and it's frightening how many programmers fall into that category -- insist on doing incorrect validation. This example shows the danger of false negatives: anyone using this code will wrongly reject perfectly valid email addresses like:

my.name@somedomain.info
professor@ancienthistory.museum
somebody (see me @ the pub) @somewhere.com

Yes, the third one is valid: the part between ( and ) is a comment, and is ignored by any compliant mail server.

Another common mistake is to reject emails like something+else@domain.com: plus signs in the user name part are allowed.

And then there are the commercial sites that won't let you register with a Hotmail, Yahoo or Gmail address. Don't get me started on the sheer pig-ignorance and stupidity of that...

But ultimately, even if an email address is syntactically valid (and it is a horrific task to check that!) there's no guarantee that the address is valid until you've actually sent to it successfully. fred@somedomain.com is syntactically valid, but you still have to send an email to that address to find out whether the address is valid or not! That's why using a validator that works for "99% of email addresses" is bad practice -- not only do you needlessly reject the 1% of valid email addresses that your software can't handle, but you still don't know whether the address is valid until you actually try it.

The only thing worse than people who insist on validating email addresses are people who insist on validating email addresses with a regular expression. To quote Jamie Zawinski:

Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems.

Somebody, I think in the spirit of George Leigh Mallory ("because it's there"), wrote a regular expression to almost validate email addresses (it can't deal with comments, and naturally it can't tell whether or not the address actually exists). To give you a flavour of this regex, here are the first sixty-five characters of this 6343-character monster:

(?:(?:\r\n)?[ \t])*(?:(?:(?:[^()<>@,;:\\".\[\] \000-\031]+(?:(?:(?:\r\n)?[ \t]

Multiply that by a hundred. Now imagine trying to track down a bug in this beast. How confident are you that the creator of this regex has correctly dealt with all the odd corner cases?

Thursday, March 01, 2007

The Denialists' Deck of Cards

Chris Hoofnagle of Samuelson Law has written a paper discussing the rhetorical techniques and tactics used to deflect debate and reform. Hoofnagle writes from a perspective of consumer protection, but the same denialist techniques can be used in many other fields.

Public policy debates on consumer protection and the environment almost always start with the "no problem" theme. The argument emphasises that whatever consumer reform being debated is unnecessary. This is because there is no problem.

"No problem" is the chorus of a denialist argument. The skilled denialist, even after engaging in a debate for an extended period of time, will never concede that a problem exists.

As Hoofnagle says, many of the arguments give can be legitimate. Sometimes industrial groups are correct, and denialism serves a good purpose. But often these rhetorical tools are used for Wickedness rather than Niceness. A common example is appeals to competition. Competition can be a very strong force for reform, but the loudest voices in favour of "leave it for the market to decide" come from uncompetitive markets. Consumer choice in the Model T Ford style ("any colour you like, so long as it is black") is always valued by those who have locked up the market.

The paper can be downloaded for free from here.