Wanted: Calendar Feature

PDAs have solved or simplified a lot of the problems I used to have
before I started carrying around a backup brain. But there’s one type
of reminder that they still can’t deal with: “do X under when Y
happens”. E.g., “Return Paul’s book next time I see him” or “Look up
Janice if I’m ever in London.”

Read More

L10n 2.0

If you write a software package, and want it to be usable by as many people as possible, it’s important to translate it into other languages. But like documentation, localization (l10n) is one of those chores that programmers don’t want to do. But if it’s a web app, why not ask the users to contribute translations?

Read More

Unicode Input in Emacs

One question that had been bugging me for a while is, how does one
input a character in Emacs, given its Unicode hex code?

Answer: use the ucs input method, then use
uHHHH to input, where HHHH is the character’s
hex code.

Unfortunately, it doesn’t look as though there’s a way to input a
character by its decimal code.

Also, C- toggles an input method on and off, rather than
cycling through a list. So if you’re writing HTML (and therefore want
the default input method) with French text (for which you want the
latin-1-postfix input method), but need to insert box-drawing
characters (for which you need ucs), you’ll wind up using
M-x set-input-method a lot.

A Better Way to Toggle

(Warning: what follows may be obvious or trivial to many.)

One of the cool things about AJAX is switching parts on and off: you
can make an element visible simply by

myElement.style.display = "block";

or hide it with

myElement.style.display = "none";

But the problem with this is that it requires the JavaScript script to
know a lot about the document. The example above doesn’t look too bad,
but what if you have something like a pulldown menu that appears when
you click a button?

Let’s say that originally, the button is gray and has a “+” icon next
to the text. When you click on it, the menu becomes visible, but the
button also changes to red, and the “+” icon changes to “-“, to show
that the menu is active.

Now you have all sorts of CSS resources that you have to keep track
of. It would be nice to put them in the .css file, with the
rest of the style stuff.

Read More

Different Stylesheets for Browsers With and Without JavaScript

As hacks go, this one is pretty obvious, but I thought I’d throw it
out there anyway.

Let’s say there are three stylesheets you want to use on your web
page: one for all browsers (style.css), one for browsers with
JavaScript enabled (style-js.css), one for browsers without
JavaScript (style-nojs.css). This can be useful for things
like “display the fancy drop-down menu only if the browser supports
JavaScript; display the plain-HTML menu only if the browser doesn’t
support JavaScript”.

The common stylesheet is pretty standard:

<link rel="stylesheet" type="text/css" href="style.css"/>

The one for browsers that don’t support JavaScript is also pretty
easy: that’s what <noscript> is for:

<noscript>
  <link rel="stylesheet" type="text/css" href="style-nojs.css"/>
</noscript>

Finally, what’s the best way to have different behavior in browsers
that support JavaScript? Why, run a script, of course:


  document.write('n');

Sunday Wordplay

If you’re a touch-typist, you’ve probably typed a word without realizing that you had placed your hand in the wrong position. As it turns out, sometimes this can yield a different existing word:

Read More

A Sri Lankan Mystery

The last thing that came out of recently deceased author Arthur C. Clarke’s printer was a sheet that said:

<blockquote

lurrlsrtr lurrlsrrt lurrlrtsr lurrlrtrs lurrlrstr lurrlrsrt lurrlrrts
lurrlrrst lurltrsrr lurltrrsr lurlsrtrr lurlsrrtr lurlrtsrr lurlrtrsr
lurlrtrrs lurlrstrr lurlrsrtr lurlrsrrt lurlrrtsr lurlrrtrs lurlrrstr
lurlrrsrt lultrrsrr lulsrrtrr lulrtrsrr lulrtrrsr lulrsrtrr lulrsrrtr
lulrrtsrr lulrrtrsr lulrrtrrs lulrrstrr lulrrsrtr lulrrsrrt ltusrrlrr
ltursrrlr ltursrlrr lturrsrrl lturrsrlr lturrslrr lturrlsrr lturrlrsr
lturrlrrs lturlrsrr lturlrrsr ltulrrsrr ltsurrlrr ltsrurrlr ltsrurlrr
ltsrrurrl ltsrrurlr ltsrrulrr ltsrrlurr ltsrrlrur ltsrrlrru ltsrlrurr
ltsrlrrur ltslrrurr ltrusrrlr ltrusrlrr ltrursrrl ltrursrlr ltrurslrr
ltrurrsrl ltrurrslr ltrurrlsr ltrurrlrs ltrurlsrr ltrurlrsr ltrurlrrs
ltrulrsrr ltrulrrsr ltrsurrlr ltrsurlrr ltrsrurrl ltrsrurlr ltrsrulrr
ltrsrrurl ltrsrrulr ltrsrrlur ltrsrrlru ltrsrlurr ltrsrlrur ltrsrlrru
ltrslrurr ltrslrrur ltrrusrrl ltrrusrlr ltrruslrr ltrrursrl ltrrurslr
ltrrurrsl ltrrurrls ltrrurlsr ltrrurlrs ltrrulsrr ltrrulrsr ltrrulrrs
ltrrsurrl ltrrsurlr ltrrsulrr ltrrsrurl ltrrsrulr ltrrsrrul ltrrsrrlu
ltrrsrlur ltrrsrlru ltrrslurr ltrrslrur ltrrslrru ltrrlusrr ltrrlursr
ltrrlurrs ltrrlsurr ltrrlsrur ltrrlsrru ltrrlrusr ltrrlrurs ltrrlrsur
ltrrlrsru ltrrlrrus ltrrlrrsu ltrlursrr ltrlurrsr ltrlsrurr ltrlsrrur
ltrlrusrr ltrlrursr ltrlrurrs ltrlrsurr ltrlrsrur ltrlrsrru ltrlrrusr
ltrlrrurs ltrlrrsur ltrlrrsru ltlurrsrr ltlsrrurr ltlrursrr ltlrurrsr

At first, it was thought that this was a test pattern, but today, estate executors discovered a storage room in Clarke's home filled with similar pages. The oldest ones were written out by hand in notebooks. Later ones appear on reams of fanfold printer paper, while the most recent ones appear to have been printed on a laser printer and bound together.

No two words are the same. All use only the letters A C E H K L R S T U. It is not known why these letters were significant, nor which rules were used to generate the "words". For instance, although many "words" contain two, three, or four instances of the same letter, never does a letter appear three times in a row.

With ten columns of eighty "words", each double-sided sheet holds 1600 "words". Investigators estimate that the entire collection comprises about nine billion such words.

Fractal Wrongness

I just ran across a wonderful term that must be propagated further:

fractal wrongness

The state of being wrong at every conceivable scale of resolution. That is, from a distance, a fractally wrong person’s worldview is incorrect; and furthermore, if you zoom in on any small part of that person’s worldview, that part is just as wrong as the whole worldview.

Debating with a person who is fractally wrong leads to infinite regress, as every refutation you make of that person’s opinions will lead to a rejoinder, full of half-truths, leaps of logic, and outright lies, that requires just as much refutation to debunk as the first one. It is as impossible to convince a fractally wrong person of anything as it is to walk around the edge of the Mandelbrot set in finite time.

If you ever get embroiled in a discussion with a fractally wrong person on the Internet–in mailing lists, newsgroups, or website forums–your best bet is to say your piece once and ignore any replies, thus saving yourself time.

Lyra’s Snacks

In case you haven’t read Philip Pullman’s His Dark Materials, or seen the movie The Golden Compass, or even seen the trailer, a quick recap:

In the world where Lyra, the protagonist, lives, everyone has a dæmon, a sort of external soul, which takes the form of an animal. Children’s dæmons can change shape at will (they take a permanent form at puberty). Dæmons are also intelligent (since they’re really a part of the human they’re attached to).

So as I’m rereading His Dark Materials, a question started nagging at me: what would vending machines in Lyra’s world look like?

Read More

I Get Email

Apparently, having my name in CPAN is a sign that I know everything about Perl, SOAP, XML, and security.

Unless someone can come up with a legitimate reason to send 5000 authentication requests to a web server (including an explanation of why that’s not a brain-damaged way to solve the problem at hand), I’m going to assume that this guy is a wannabe script kiddie.

This isn’t the first time someone’s asked me to , but this time around, I don’t feel like toying with him. Script kiddies are people too.

Then again, so’s Soylent Green (as put it).

Read More