This is why we still have real calculators…

gnome-calculator fail

This is about scientific notation, and how Gnome Calculator still doesn’t do it correctly.

So I was checking a simple calculation today, and couldn’t find a proper calculator, so I reached for gnome-calculator on the desktop. That was a mistake.

It seems to think that

8×10¹²÷6×10⁹

comes to

1.333333333×10²¹

which is not correct. It would, if I’d  typed it as:

8×1×10¹²÷6×1×10⁹

You can only get the right answer (1333.333…) if you type

(8×10¹²)÷(6×10⁹)

so it’s clear that gnome-calculator isn’t apply the right exponentiation operator precedence when you hit ‘×10y’. It would have been so much better if gnome-calculator supported ‘E’ scientific notation (1.333E21 for 1.333×10²¹).

A bug is filed, but I don’t think I trust it any more. I’m looking at having a proper calculator again, or maybe invest in one of the delightful tiny HP clones from SwissMicros.com.

HP 49G

Almost forgot that I had a barely-used HP 49G in the cupboard. It was barely used because the thing eats AAA batteries. Who knew that Dollarama would have a pair of NiMH AAAs for only $2?

Update, 2021: Use galculator instead. It does the right thing, and supports RPN like a calculator should. You don’t need to remember any precedence rules when you have The Truth.

how to fix the annoying Ubuntu/Debian XML::SAX install problems

Debian and its derived distributions have a policy about packages not being able to modify the configuration of other packages. While this might generally seem like a good idea, for the TIMTOWTDI world of Perl, this causes problems.

The problem arises if you have installed Perl XML modules from both CPAN and the Debian (or Ubuntu, or whatever) repositories. Debian’s modifications subtly break the XML::SAX module, on which most Perl XML modules (including the brilliant XML::Simple) depend. If you’ve been naughty and used a module from CPAN, Debian gets its knickers in a knot, and won’t configure or run anything remotely related to libxml-sax-perl.

If you get the error Can’t locate object method “save_parsers_debian” via package “XML::SAX” at /usr/bin/update-perl-sax-parsers line 90, your system is affected. You might get the clue that any of your Perl XML handlers freak out and fail in weird ways.

Here’s a method (there’s always more than one, of course)  to fix it. This was combined from a couple of sources, each of which was on the right track but didn’t entirely work. Actually, the first might’ve been right on the money, but my hiragana’s a bit ropey …

  1. make sure you’ve got your system up to date with apt-get or aptitude.
  2. sudo cpan CPANPLUS (this will ask you lots of questions, to which you should almost always answer with the default)
  3. sudo cpanp -u XML::SAX (this takes quite a while, and produces no output for most of it)
  4. LC_ALL=C sudo apt-get install --reinstall libxml-sax-perl (the LC_ALL=C might not be strictly necessary, but it worked for me)

You must remember never to pretend to be smarter than the Debian maintainers, and suitably chastened, may now return to your normal OpenSSH patching activities …

wordpress dates

I’m a bit peeved that even in WordPress 2.1, they haven’t fixed a very long-standing bug: all templates (especially the default one) should respect the user’s date format. It seems that moderators on the forums see this as a non-issue, and zealously close (or ignore, if such a passive thing can be done zealously) any discussion on the topic, as has happened here. I don’t need or want to edit PHP to make this work; it’s supposed to work.

Today’s date is 28 Jan 02007. I want you to see it that way. WordPress doesn’t.