I was revisiting the validation of domain names and realised that most of the regexes posted around the web have faults.
Many refer to Sean Inman’s 2006 post, which does a fair job but is prone to break as new TLDs are introduced. This answer on StackOverflow is about the best I’ve found so far: it enforces label and overall lengths; allowing multiple dashes means it works with punycoded domains; it’s generally permissive so won’t break as TLDs change, but there’s one case not handled. RFC2872 says that labels that are not used as hostnames (i.e. which do not map to an IP, for example in TXT or SRV records) may contain any printable ASCII character, so `_,;:'”!@£~$` and friends are all up for inclusion. This is most commonly found in domainkeys, which use the `_domainkey` label. There’s a good article on the use of underscores in DNS.
This does relate to the validation of email addresses (which often contain domains), and the best page on that subject is this one, however, you can’t simply extract the domain part from that as domain names in general are a superset of what’s used in email.
It’s difficult to do this right because you can’t tell whether a label is a hostname or not, or where a hostname stops and a domain begins, and validity varies according to context: `_domainkey.example.com` is invalid in an A record, but valid in a TXT record. I can foresee a parameter to allow you to specify usage context to deal with this. It might be better to process the name backwards so that you have more context available as you encounter each label, for example if you processed `www.example.com` as `com.example.www`, you would stand a better chance of knowing whether www is a hostname or a domain name.
I’m mainly thinking out loud here, I don’t have a solution as yet!
After many years of procrastination, I’ve finally migrated my blog from Serendipity to WordPress, including importing all my old posts, and translating a bunch of metadata so that old URLs still work. I’ve been meaning to do this for ages, but what set me off today was spotting the lovely Twitter Bootstrap 2.0 Theme by 320press, so thanks to them for providing a) a nice theme, and b) motivation!
I went back and reformatted the old code markup using some new plugins (there are an awful lot of bad WP plugins!), found a couple of unapproved comments, broken links and other cleaning up. This should last me for a while.
It’s been thoroughly documented that Mac Skype 5 is an utter piece of junk, but it just keeps getting ‘better’!
Today it informed me that there had been a minor update to the current beta release (5.4).
Being wary of what Skype considers an ‘upgrade’, I clicked the ‘what’s new’ button that it offered to see the changes. This took me to a page all about Skype 5.3, with no hint or link of any release notes. A bit of googling for the new version number led me to some release notes. I thought this sounded fair enough, so clicked ‘update’. It downloaded the new version like this:
but then presented me with this:
That’s a very strange error. It’s telling me that it accidentally downloaded the wrong version, and didn’t check that it was the right one, it just assumed it was. Doesn’t bode well for security. On top of that the reason it can’t install is because it’s not fat enough?? Are they trying to suggest that code bloat is mandatory? Clicking ‘Manual update’ took me to the Skype 5.3 page again. Sigh.
To their credit, this IS a beta version, but given that only bug fix mentioned for the last 2 months work on this release is “Skypenames ending with period do not work properly”, I’m not holding my breath for a stable release.
Skype used to be a beautiful (well…), elegant, Mac-like app. It’s now a pig in a dress. With lipstick.
I saw that NASA released a load of audio clips from various historic space missions – from Sputnik to the final flight of Atlantis, via the moon! Space sounds have long been used musical contexts – SpaceOddity, Telstar, Pulsar, Lemon Jelly’s “Space Walk” to name but a few. I felt I had to make these more musically useful that the ‘ringtone’ MP3s available on NASA’s site, so I wrapped them up as a library for the EXS-24 sampler (appears in Apple’s Logic and Logic Express DAWs). The sounds will work straight away in Logic, but the sounds are accessible in the archive as AIFF files so you can easily convert them to other formats. I split up the sounds into the same historical categories as on the NASA site so you’re not loading up all the samples at once. Keyboard mapping isn’t anything particular (white notes starting at C1), but I did clean up the samples a little and edited down some shorter clips of the more familiar or musical sounds (“Houston, we have a problem”, “The Eagle has landed”, “That’s one small step” etc).
The original sounds are mostly mono with low bandwidth, resolution and sample rate, but many are supplied as stereo 44.1KHz 16-bit files, so I’ve converted them all to that as EXS-24 doesn’t seem to like mixing sample rates in one instrument.
So, go ahead and download the NASA sample library! (70Mb zip)
Obviously I have no rights to these samples; NASA is encouraging people to download and use them at will, and I assume it’s being published under their open-source license.
I wrote this entry a while ago but forgot to post it, duh.