Remove protection of OpenOffice/LibreOffice spreadsheets

May 2nd, 2012

Sjouke and I just ran into a minor hitch with a spreadsheet: some cells were protected, and in the new Ubuntu / Open/LibreOffice version they just looked plain wrong.
How to fix this?
Turns out that protection isn’t that hard to break. In a nutshell, an .ODS file is very much like an EPUB file — it’s also a ZIPped file which also contains a structure with a mimetypes file and a content.xml file.

To remove protection, edit contents.xml and change the attribute *protected="true" to say false. Rezip the file in the correct way, that is: store mimetype uncompressed as the first file, the rest doesn't really matter. Et voila, you have removed protection!

In a nutshell:

mkdir tmp
cd tmp
unzip ../FILE.ods
sed 's/protection="true/protection="false/g' content.xml c2.xml
mv c2.xml content.xml
zip -0X ../FILE-unprotected.ods mimetype
zip -r9 ../FILE-unprotected.ods * -x mimetype

ZSH tricks

April 30th, 2012

ZSH logoFor a while now I’ve been wondering how to do the equivalent of jot (which generates a list of numbers) in ZSH. It’s pretty obvious that ZSH could do such a thing, but how? Jot isn’t installed by default, and I am lazy. Lazy enough to never look into it.

For a change, I did. Success! Here is one way to do it, which is sort of elegant:
while (( i++ < 10 )) { echo i is $i; }
Do note the remarks on the above link: playing around with the syntax might kill it quickly.
Using repeat might be neater, but that's only when you just need to iterate (and not keep track of the iteration).

Gnome tidbits

April 25th, 2012

Gnome logoJust came across 2 tidbits. One wasn’t enough to post, but two… I had to ;-)

1. Remove annoying “hover over me” scrollbars

(From WebUpd8.)

In the newer versions, Gnome did away with the scrollbar. There is this scroll-hint which, if you hover over it, changes into something with buttons. Which you cannot click, because the exact center of the two buttons (up/down or left/right, depending on vertical/horizontal scrolling) is projected below your mouse.
It is annoying. It confuses me every single time. But, the good news: it is not necessary.

  • Fix 1: sudo echo "export LIBOVERLAY_SCROLLBAR=0" > /etc/X11/Xsession.d/80overlayscrollbars
  • Fix 2:
    1. apt-cache search 'liboverlay-scrollbar', and remember these packages (e.g. as $PKG-TO-DELETE),
    2. sudo apt-get remove overlay-scrollbar $PKG-TO-DELETE.

The search gets around the problem of slightly different package names (version number changed) between Ubuntu 11.04/11.10/12.04.
On a related note: stop putting your version number in the package name!

Split Nautilus window in two for easy moving

(From a Slashdot comment)

Either fix ought to work. The first leaves the packages and modifies behaviour, while the second nukes the functionality. Haven’t tried either yet, curious though.

Ever need to move a file from one place to another?
Open Nautilus (i.e., “Places”). In the window, press F3.
Ta – (explitive deleted) – daaaa!

Wish I had known that sooner.

Thunderbird’s “get mail” button broken?

April 25th, 2012

Thunderbird logoI’m quite happy about Thunderbird (mail reader). Yes, I’ve had my struggles with it (as those of you who follow this blog know), but in the end, it all works.
All?
Almost all.

There is one button, no matter how hard I try, I cannot get to work.
You see, Thunderbird has a “Get mail” button. And I press it and press it, but do I get mail? nooooo….. ;-)

Updating Thunderbird on Ubuntu

April 15th, 2012

Thunderbird logoMy Ubuntu 11.04 at home was still running the old Thunderbird. The old, end-of-support-almost-reached Thunderbird. Time to fix that. Lessee, open Thunderbird and look for “update”… nope.
Hmms, get updates for Ubuntu then? … nope.
Hmms. Okay, let’s do this the hard way. Download the new TB, run it… hey, that looks a lot like my old TB! “Help > About”… it is my old TB?! WTH?!
Okay, turning to the Google for more updates.
Aaah, here’s how it’s done: tell your system updater to include packages from Mozilla, and then it should work.
Test one: err, nothing to update?
Test two (a few days later, different package-address included): still nothing??
You know what, this is silly.

And just when I was ready to give up:

  • sudo add-apt-repository ppa:ubuntu-mozilla-security/ppa
  • sudo apt-get update && sudo apt-get install thunderbird

Apparently, there are all sorts of mozilla-related valid words (e.g., combinations with “security” and “release”) you can enter after “ppa:”. Some of them work , but don’t update your system. Such as the aforehinted mozilla-security-ppa and mozilla-release-ppa. This one does.

@Mozilla: is this really necessary? Just provide some sort of warning with pointer to the right location in the non-updating PPA’s, would you?