Exercises In Masochism 1: Writing OpenOffice.org Macros

<rant>
Has anyone else found writing OpenOffice.org macros an exercise in hair-tearing frustration?

It gives you a choice of four different languages to write them in, which would be great if it didn’t make the documentation four times as long and complicated, and if at least one of them actually worked reliably and was easy to use.

The “documentation”, api.openoffice.org, is a maze of twisty little classes, all equally useless. How do I get, munge and then replace the current selection? It’s hardly an edge use case. Why do I need to work out if my XComponent can be UNO.QueryInterfaced to an XDocument, which doesn’t have a getCurrentSelection method anyway? XModel does, but it doesn’t have a setCurrentSelection() method, and all I could find about that little anomaly was a sarky mailing list message saying that the getCurrentSelection() method on XModel was a misfeature and I should use XComponent. “That’s what it’s there for.” Well, gee, thanks. Except that it doesn’t have any methods relating to the selection at all.

Searching doesn’t work. Each page has about three search boxes, two of which are the wrong one but you don’t know which two. Some take you off into the wilds of other websites and wikis which contain content which seems tantalisingly related to what you are doing but in fact is (as far as I can now tell) about OpenOffice.org’s C++ internal interfaces.

The “Macro Management” screen is an exercise in how not to design a UI to “manage” anything, with an utterly unnecessary and imposed three-level hierarchy of “Modules” and so on, where clicking the wrong button dismisses the dialog and makes you painfully reopen it from its home nested four levels deep in the menus and renavigate using a widget the size of a postage stamp back to the relevant place in the complex tree to try hitting the other button to see if it works any better.

What were they thinking? I bet VB is far easier than this.
</rant>

Tracking Ubuntu Hardy

I update my Hardy beta installation on my laptop to the latest packages about once a week. The experience so far has been like blowing seeds off a dandelion and reciting “It boots… It boots not… It boots… It boots not…” Currently, I’m on “It boots not”. I wonder which I’ll be on when the last seed blows off on April 24th?

This sort of thing doesn’t encourage one to be a beta tester. I’m glad they leave older kernels installed…

Verisign Wimpy Warnings

I was visiting some phishing sites (as you do) and came across this one. These things have short lifetimes; it may not be there when you check. It is/was an eBay spoof page, spam-advertised, which had a spiffy-looking Verisign Site Seal in the bottom corner, which was actually linked to the correct URL at Verisign! Perhaps this is a result of them just saving the eBay page to disk and whacking it up on the webserver. Anyway, I know no-one ever clicks on these things, but I thought I’d try it, to make sure I got a scary message from Verisign.

In fact, what I got was this:

Unable to validate this seal

We are unable to verify the status of this seal at this time. Please try again later.

Click here to learn more about SSL Certificates.

Wow, that has me scared. I’ll be sure not to type my eBay credentials into the site now…

Upgrading to Hardy

I’ve just upgraded my desktop and laptop to the latest beta of Ubuntu Hardy Heron, 8.04. Not wanting to sound like a broken record, but this process is still confusing for the average user. I was asked a number of questions that most people would have no idea of the answers to.

msttcorefonts.png

cupsd.conf.png

smb.conf.png

The first popup I got was the this top one:

What is a user supposed to make of that? There’s no “install x-ttcidfont-conf” button. Checking afterwards, it seems that the upgrade installs it anyway. So why bother telling me about it? Why not just do it?

The second popup told me it had to restart some services to use the new libSSL.

Then, I had a succession of five popups asking about replacing or keeping modified configuration files – smb.conf, bash_completion, cupsd.conf, ntp.conf and /etc/default/bluetooth. This bugs me for the following reasons:

  • These popups appeared at various points in the long upgrade process and, given that my screen went into standby, it was easy to not notice them. Disabling screen standby, or beeping, would have been sensible.
  • There were two different forms of popup (see pictures 2 and 3). Why?
  • These config files were changed because I changed something in the GUI. If I’d edited the file by hand I’d have less cause for complaint but why can’t the system know how to merge changes made through the GUI with new options? Most packages seem to manage this fine.
  • Accepting the defaults on cupsd.conf disabled remote printer sharing, without telling me it had done so. Remote printing just stopped working. And ticking the “Shared” box next to the printer in the Printer Configuration applet isn’t enough; you also need to tick “Share published printers connected to the system” in the Server Settings area. What’s the difference between sharing and publishing? Why do I need to check two boxes? What’s a print server anyway? Grr.
  • Accepting the defaults on ntp.conf removed my configured ntp server, again without telling me it had done so.
  • The bluetooth one was especially bizarre as my desktop doesn’t have bluetooth.

Lastly, it asked me if I wanted to remove obsolete packages. If they are obsolete, remove them. If they aren’t, keep them. How am I supposed to know?

When I’d finished, Gimp no longer had the useful “Gutenprint” print capability. No idea why. The package had just gone. This was standard in the last release, I think – I certainly don’t remember installing it manually. I knew where to find it and reinstall it – but would an ordinary user know what was wrong?

The Ubuntu team needs to work on making packages which know how to merge in updates to their own configuration files – particularly updates made through the official configuration GUI for those packages.


Highly Hairy Heron

Ubuntu Hardy Heron is to be released soon. Last week, I upgraded my X40 laptop to the beta and found it wouldn’t boot (at least, not the default kernel). I duly filed a bug with diagnostics, which has now been untouched for almost a week.

The low level of attention to “your OS hosed my machine” bugs, right before a release, is rather concerning…

Facebook Getting Nasty About Lock-In

As I have mentioned before, Facebook put images, rather than text, of email addresses in Facebook profiles. They suggest this is a privacy-enhancing measure, but given that it’s fairly easy for someone with nefarious intent to circumvent it, it’s quite clearly done to encourage your average person to use mechanisms within Facebook to communicate, rather than normal email. Chris Finke wrote the Image-to-Email extension to turn the images back into HTML clickable links.

Now, Facebook have sent him a cease-and-desist regarding Facebook Image-to-Email (and another extension of his). According to Chris, their stance is that both extensions violated the section of the TOS which says “you shall not use automated scripts to collect information from or otherwise interact with the Service or the Site”.

For Image-to-Email, at least, this is wrong in two ways:

1) The extension doesn’t violate the section of the TOS they claim it does
2) The extension is not a threat to user privacy

1) This extension cannot count as an “automated script”, unless a web browser counts as an “automated script”. A web browser takes the HTML that Facebook sends to a user and, instead of displaying it as plain text, renders it in a different way which is more visually pleasing and easier to read and interact with. Facebook Image-to-Email takes an image Facebook sends to a user and, instead of displaying it as an image, renders it in a different way which is also easier to interact with. Both tools do exactly the same job; you cannot prohibit one without prohibiting the other.

Image-to-Email doesn’t follow links, walk your social graph or any of the other things that might cause it to be labelled “automated”.

2) Facebook Image-to-Email saves people having to retype email addresses in order to email their Facebook friends. This cannot be a threat to privacy because any email address I could use it on, I could already see. There is no way I can use it to access email addresses I don’t already have access to.

Facebook should come clean and admit their real reason for threatening Chris (“We will be forced to become more formal… Hopefully you won’t choose that path”) is to maintain platform lock-in.

Inefficient GreaseMonkey Scripts

I’ve been having performance problems with my Firefox (2) for months. Opening lots of tabs at once, or even a particularly large page, would cause the browser to freeze for several seconds. I finally got around to tracking this down, and it turned out to be a couple of GreaseMonkey scripts.

These scripts fire on every page and scan the page text for particular things (in my case, UK postcodes and Bible references) and hyperlinkify them.

The postcode linkifier puts together an XPath expression:

var xpath = "//text()[(parent::" + allowedParents.join(" or parent::") + ")]";

where allowedParents is an array of 50 tag names. It then evaluates it, and applies a complicated postcode regexp (although not quite the full thing):

const pcRegex = /\b[A-PR-UWYZ][A-HK-Y0-9][A-HJKSTUW0-9]?[ABEHMNPRVWXY0-9]?
{1,2}[0-9][ABD-HJLN-UW-Z]{2}\b/g;

to all the text. I can imagine that this is inefficient, although I wouldn’t like to guess at which part takes the lion’s share.

The Bible refalizer uses simpler XPath:

textNodes = document.evaluate('//text()', document, null,
XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE, null);

but a much more complicated regexp involving various abbreviations of the names of the 66 books of the Bible.

So the question is: is there a way of providing this type of full-text search and modify function which has acceptable performance? Does the Firefox platform need to provide more help with this particular use case? It seems to me that it might be quite common.

Christianity and Free Software

For several years I’ve been meaning to write on the relationship between Christianity and the moral principles of the Free Software Movement (which holds that having free software is a moral good). I’ve finally had a chance to do just that. The essay is about 2,500 words, so should take 10-15 minutes to read. It’s available as HTML, PDF and ODT. Feedback welcomed.

Magic Numbers Bad

I’ve been trying to make some maps of my local area using OpenStreetMap data. I got Osmarender to render the OSM data to SVG, and then tried to use the SVG editor Inkscape‘s command-line mode to render that to a PNG. However, I kept getting an error:

** (inkscape:1085): WARNING **: 108374760 bytes requested for pixel buffer, I won’t try to allocate that.

I Googled the error message, and found the code which throws the error online. Here it is:

if (size > 100000000) { // Don't even try to allocate more than 100Mb (5000x5000 RGBA
// pixels). It'll just bog the system down even if successful. FIXME:
// Can anyone suggest something better than the magic number?
g_warning ("%lu bytes requested for pixel buffer, I won't try to allocate that.", (long unsigned) size);
return;
}

Er, a command-line option?

Quick Plug

For the last year or so, I’ve been buying some online backup storage from the excellent folks at rsync.net. Their support pages and website shows every sign of their being a company with a great deal of clue, I like the way they do business:

All support is handled by engineers. No first level techs or ticket systems.

NO data will EVER be released to LEAs/TLAs without direct order by court with jurisdiction.

and they offer a wide variety of useful access methods, such as rsync, SVN, FTP and WebDAV. There’s even a discount for free software developers. Highly recommended.

Internet Sabotage

Bruce Schneier notes that a fourth and fifth undersea cable have malfunctioned or been cut.

It’s probably a little early for conspiracy theories but if I did have a midget submarine and I wanted to cause a great deal of trouble, this would be one way to do it. But also, once I’d cut a particular cable once, why stop there? Once the cable is cut, the company has no way of monitoring the status of that segment. So why not cut it five times, at five random points? The company fixes the first break, but the cable still doesn’t work and so they have no way (that I know of; people who lay these things for a living may differ) of telling where the other breaks are. They have to raise or inspect the entire segment, which would take weeks or months. Particularly if you break enough to exhaust the world supply of suitable ships.

FOSDEM On The Horizon

The Free and Open-source Software Developers’ European Meeting is on the horizon. The Mozilla project will, as usual, have a large presence and a developer room with a talk track. Entrance is free, and cheap accommodation is available in Brussels if you are quick. As conferences go, this is as grassroots and low-expense as it gets, while still being of extra high quality. If you live in or near Europe, make your plans now.

Predictions for 2008

I just wrote this as a comment on “Freedom to Tinker“:

Gerv’s 2008 Predictions:

G1) Someone will sue an open source company, organisation or individual of significant community visibility for patent infringement over a specified patent implemented in their open source software, in a USA jurisdiction. A large fuss will ensue.

G2) A commercial product (software or otherwise) will ship using OpenStreetMap as its primary data source.

G3) The first lawsuit will be brought against a product developer for violating one of the new parts of GPLv3 or LGPLv3. The plaintiff will win, either in court or by settlement.

G4) In at least one major Western democracy, it will be impossible for Joe Public to get an entirely unfiltered Internet feed just because he wants one.

G5) The unstoppable kingdom of Christ will continue to advance, like a seed growing in secret. (Hey, everyone includes an easy one, right? :-)

Someone remind me to look at these in early 2009…