Missing dictionaries on OpenOffice.org 3

I just upgraded to OpenOffice.org 3 and I really like it. But there was a small, but very anoying problem: OO.org seemed to be unable to find any dictionaries. I found out rather quicky, that starting with OO.org 3 dictionaries are only available as extensions. Well, basically this is no problem, but the English (at least the US and GB variante) are supposed to be bundled with the installer and are not available as seperate extension.

It seems there is a little bug with the installation on Vista under certain circumstances which causes the extensions not being registered properly with OO.org.

To solve the problem, follow the same following steps:

  • Locate your OO.org “install” directory of your installation, usually it is C:\Program Files\OpenOffice.org 3\share\extensions\install” [Updated 2008-12-21 to include “extensions”, thanks to the anonymous commenter!]
  • Manuylla install the appropriate dictionary extension (“dict-en.oxt”, “dict-de.oxt”, “dict-fr.oxt”, “dict-it.oxt”) by either launching the oxt directly or by chosing Tools -> Extension Manager.

For me this worked after restarting OO.org totally (i.e. closing down all Writer, Calc, …).

.NET strings are not always immutable!

Strings are immutable. If you want to modify a sequence of characters, use StringBuilder. At least, that’s whats officially said. But in the framework there is at least one method that does modify a string:

TextRenderer.MeasureText() with ModifyString and EndEllipses will modify your string to match the ellipsed text if ellipsing happens. You can look at this VB# example on codeproject using TextRenderer.MeasureText() for trimming text on how it is used.

The string seems to be modified directly in native code by DrawTextEx from user32.dll. Additionally to the scary fact that strings are not immutable, the length of the string is not updated, regardless if the resulting string is shorter!

For instance if you have a string “aaaaaaa” which will be truncated to “aa...“, the Length property will still return 7 for the shortened string. The debugger shows that the string will in fact be “aa…\0a” after the operation. So maybe it might be right that the string is still 7 characters long but most outputting functionality like Console.Out.WriteLine() gets confused sometimes and stops any further output to the debugger or console under certain conditions.

A very quick investigation of the System.Drawing assembly using Lutz Roeder’s fabulous .NET Reflector showed that at least there should be no memory corruption in case “WW” would get ellipsed to “W...“, as DrawTextEx takes the length of the buffer and should result only in “W.“.

Summing up, I find the corruption of an immutable string by an official Microsoft API very troubling.

Ubuntu 7.04 cryptsetup problem

I am using cryptsetup LUKS for storing encrypted office data on my USB memory stick (just in case I lose it). I recently installed Ubuntu 7.04 on one of my machines and wanted to open the encrypted partition using cryptsetup luksOpen, which failed with a rather strange

Unable to make device node for ‘temporary-cryptsetup-32733’

While searching around the net I found a lot of people asking the same question but hardly any answer, until I finally read this article
on the Ubuntu forum.

The solution to the whole problem is rather simple:

sudo mkdir /dev/.static/dev/mapper

With a little bit more verbose error message of cryptsetup I might have figured this out myself…

A Small “Patch” for Scuttle

Yesterday I realized, that our internal office installation of Scuttle (SF project page) suffered a minor bug: it kept on sorting all bookmarks by date, but in ascending order, i.e. the oldest bookmark was displayed first.

After doing some research, I quickly found out that this seems to be a “bug” (well the devs say it isn’t but one can argue…) of MySQL, caused by an optimization of a SELECT DISTINCT queries.

So I patched services/bookmarkservice.php and removed the DISTINCT keyword in the SQL-query of getBookmarks() (line 249, version 0.7.2).

Up to now, I did not experience any duplicate lines caused by this. I think, I’m going to report this minor issue upstream.

Update: hmm, ups, when searching, you will most certainly get duplicate results… I’ll check in the evening.

Update 2: Ok, so I wrote a litte more extensive patch, by wrapping the original SELECT DISTINCT statement as a subselect and ordering the result as such. This now really works. The patch for 0.7.2 can be downloaded here. You have to apply it to services/bookmarkservice.php.

Update 3: Ok, I somehow managed to delete the patch file. I am sorry. I will look if I can find it in any of the old backups, but I am not too convinced about this.