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!

Pace Active 3875 ADSL Receiver

Pace Active
3875 ADSL Receiver

There's one of these boxes sitting in a pile of junk outside a house around the corner from home. Anyone have any idea WTF it is? I'm intrigued because it has ethernet, SCART, printer, serial and composite video outs.

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@[59.167.98.48], 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@[59.167.98.48] 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?

^\w(?:\w|-|\.|\+(?!\.|@))*@\w(?:\w|-|\.(?!\.))*\.\w{2,3}

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.

Simon and Holly: greengrocers to the stars

Our dining
room, full of fruit and veg

We're in this little fruit and veg co-op with a bunch of mates. Our turn to head out early in the morning to Flemington came up, and here's all the veg divided up. It's a great time for produce, with a huge variety in peak condition at really cheap prices. We didn't manage to spend all the $30 per household budget before filling the little car.

A DVD player that doesn't suck?

DVD players seem to be disposable devices these days. You really only get a year out of one before it starts randomly skipping on brand new discs. So I'm in the market for a new one.

This time around, I'd like one that doesn't insist on following the studio's instructions. When I press the "root menu" button, I don't want to be told "Operation not allowed by disc" given that I own both the disc and player.

So does such a device exist? Are there DVD players that obey their owners?

NYE 2008 and housewarming

Margaret
and Nathan

The party at our new place last night was loads of fun. Stretching across twelve hours, a bunch of people tramped through the house, got drunk, danced and shouted at each other. Great fun!

I took some photos.

Tags
Posted