Enjoy the conference

Similar to last year, I can't make linux.conf.au 2008 again. Yet again, it sounds like a great programme and I'm sure the organisers will, as usual, deliver a conference so good that people rave about it for years to come.

Enjoy yourselves people, and don't forget to blog about what you've learnt. Some of us have to learn vicariously from your experiences.

Multivariate testing

Website Optimizer

Much of my job involves supporting a marketing department in web stuff. A lot of the time this means finding and explaining new ways to help them market. I've recently been looking at multivariate testing, which is a big word to mean testing multiple variations of a web page to see how effective they are.

To play with it, I've been using Google Website Optimizer on my own site. If you go to my home page, you'll be presented with one of four versions of the page. I count someone clicking on a blog post as a "conversion", which is kinda contrived and you would normally use something like a sale.

In case you're interested, the variants are:

It's all pretty contrived and I'm using a site that doesn't really matter, but it's shown me how useful this tool is. If your site has some kind of goal (sale, enquiry, some kind of interaction you want to encourage) it's really incredible the effect some changes can have.

If you're marketing to mere mortals rather than geeks, seemingly meaningless changes can have a huge impact. Making the buy button bigger and brighter, putting in little bullet points to overcome their objections, changing the location of things.

These multivariate testing tools allow you to test a bunch of variations on a page. They could be radical changes, or really simple ones. Different users will get different versions, and you can quite happily track what's happened. The tools contain all sorts of statistical crunching to allow you to see real patterns in the noise, once enough data has been collected.

The example I'm using is pretty simplistic too. I've only changed the front page, not the whole site. These tools allow you to track users throughout a visit, so you could make a site-wide change and be able to give the user a consistent experience throughout the visit, then log conversions.

The great thing about this kind of tool is that, when the marketroids come up with their latest "brilliant" idea, rather than having to shoot it down with your mere logic, you can just say "sure, let's test that out". I've always thought of marketing as the place where failed salespeople go, because a salesperson is very easily measured and marketing is traditionally quite hard to measure. Not any more!

So my task in the near future is to shop this idea around our marketing geniuses and start playing. I think it'll be actually quite fun, because you can throw seemingly wild ideas at it, and see how it goes with real people. The testable nature is actually quite liberating, and should free you to try out your wacky ideas.

I'm quite looking forward to unleashing it on a really busy site, and taking a crack at long lists of changes to try.

Bow before me, I am solder guru

Before I left London, I bought an iAudio X5 audio player. The main selling point was that it plays mp3, ogg and flac, along with the fact it just shows up as a USB mass storage device, unlike other players that require their own annoying software.

Anyway, the left audio channel in the headphones stopped working recently. It would cut back in if I put some pressue on the headphones. Seems it's not an uncommon problem, as it's widely discussed in the forums.

I've never been much of an electronics whizz, mainly because me with a soldering iron is like a blind man trying to solder with a hot brick. But I think I've got better in recent times.

So I whipped off the cover, worked out how to get the daughterboard holding the headphone jack out, and managed the solder. Worked perfectly first time! Whacked a little blob of solder on all the contact pads, and away we go.

Normally when I try these kinds of hardware hackery, I end up with a very expensive and useless brick.

Yay me!

JavaScript email address validation part 2

A few people have responded to yesterday's post about validating email addresses in JavaScript pointing out that it's very very wrong. For starters, Skud points out that .info addresses won't work. Howie points out .mobi and further, .museum being valid domains.

Stephen Thorne was most scathing, and has very good points to say.

For a start, ' is valid in email addresses, but not at the beginning or the end, O'Brian@example.com. That's just a simple real-world case and ignores the perfectly valid myname@[], email addresses with doublequotes and spaces, the myriad ways of escaping, etc. RFC821 has a full grammar for email addresses.

The best possible way to validate an email address is to ask the MX for that domain if you can deliver mail there. Can't be done in javascript without ajax of course, but it's probably the best way. You do the "HELO/MAIL FROM: <>/RCPT TO: $username" handshake with the mx, and if it doesnt' reject you, you know it's at least partway valid.

Otherwise, your best bet is to check that it contains an @ and is more than 4 characters. Anything in between will reject valid email addresses.

I suppose what this results in is that you want 1 or more characters left of the @, then three or more characters to the right, with at least one period. The right-hand side you can constrain a bit more, since the acceptable characters for domains are easily defined.

And yes, myname@[] is a valid SMTP addressee, but I'm not sure I'd call it an email address in the modern sense any more than I'd expect bang paths.

I'll work up a regex implementing what I outlined above shortly, though I've got a higher-priority project for today so it'll probably be tomorrow. Thanks for the feedback!

PS: RFC2821 supersedes 821.

PPS: Both Skud and Stephen wanted a way to comment on my blog. I don't have the time nor energy to spend 45 minutes de-spamming my blog, which is why I put a "contact me" link on it, which points to my mail form.

Be sure to see this followup.

JavaScript regex for email address validation

I found this helpful page with a nice recipe for email address validation in JavaScript. Unfortunately the regular expression doesn't allow for email addresses with a plus sign in the front part, for example foo+bar@argle.com. These kinds of email addresses are perfectly valid and are used by many to implement disposable email addresses (though I'd recommend Sneakemail myself).

So here's my amended regular expression for validating email addresses. Have I missed anything?


Before you use this, you might want to read my follow up post with comments from a number of people on the unsuitability of this pattern.