13 Jan 2010 mbrubeck   » (Journeyer)

Finding SI unit domain names with Node.js

I'm working on some ideas for finance or news software that deliberately updates infrequently, so it doesn't reward me for checking or reloading it constantly. I came up with the name "microhertz" to describe the idea. (1 microhertz ≈ once every eleven and a half days.)

As usual when I think of a project name, I did some DNS searches. Unfortunately "microhertz.com" is not available (but "microhertz.org" is). Then I went off on a tangent and got curious about which other SI units are available as domain names.

This was the perfect opportunity to try node.js so I could use its asynchronous DNS library to run dozens of lookups in parallel. I grabbed a list of units and prefixes from NIST and wrote the following script:

  var dns = require("dns"), sys = require('sys');

var prefixes = ["yotta", "zetta", "exa", "peta", "tera", "giga", "mega",
  "kilo", "hecto", "deka", "deci", "centi", "milli", "micro", "nano",
  "pico", "femto", "atto", "zepto", "yocto"];

var units = ["meter", "gram", "second", "ampere", "kelvin", "mole",
  "candela", "radian", "steradian", "hertz", "newton", "pascal", "joule",
  "watt", "colomb", "volt", "farad", "ohm", "siemens", "weber", "henry",
  "lumen", "lux", "becquerel", "gray", "sievert", "katal"];

for (var i=0; i<prefixes.length; i++) {
  for (var j=0; j<units.length; j++) {
    checkAvailable(prefixes[i] + units[j] + ".com", sys.puts);

function checkAvailable(name, callback) {
  var resolution = dns.resolve4(name);
  resolution.addErrback(function(e) {
    if (e.errno == dns.NXDOMAIN) callback(name);

Out of 540 possible .com names, I found 376 that are available (and 10 more that produced temporary DNS errors, which I haven't investigated). Here are a few interesting ones, with some commentary:

  • exasecond.com – 32 billion years
  • petasecond.com – 32 million years
  • petawatt.com – can be produced for femtoseconds by powerful lasers
  • terapascal.com
  • gigakelvin.com – possible temperature of picosecond flashes in sonoluminescence
  • giganewton.com – 225 million pounds force
  • gigafarad.com
  • kilosecond.com – 16 minutes 40 seconds
  • kilokelvin.com – 1340 degrees Fahrenheit
  • centiohm.com
  • millifarad.com
  • microkelvin.com
  • picohertz.com – once every 31,689 years
  • picojoule.com
  • femtogram.com – mass of a single virus
  • yoctogram.com – a hydrogen atom weighs 1.66 yoctograms
  • zeptomole.com – 602 molecules

To get the complete list, just copy the script above to a file, and run it like this: node listnames.js

Along the way I discovered that the API documentation for Node's dns module was out-of-date. This is fixed in my GitHub fork, and I've sent a pull request to the author Ryan Dahl.

Syndicated 2010-01-13 08:00:00 from Matt Brubeck

Latest blog entries     Older blog entries

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!