Using UTF-8 with fithesis

My faculty has it’s own thesis LaTex style, which makes it very easy to get a decent looking thesis out of LaTeX without too much effort. The problem is that the style requires you to use ISO-8859-2 in your document, which is something I can’t really live with. :) Here are instructions how to convert the style to UTF-8. I’m posting them here in hope that it will help some other student of Faculty of Informatics, Masaryk University in the future.

Resizing a LVM swap volume

Another post mainly for myself, just so I know where to find the information quickly the next time I need it. If you have swap on a LVM volume, these commands can be used to resize it (in this case, increase by 100MB):

Redirect to Google’s OpenID

I’ve started using OpenID some time ago and I really like it. I was surprised that large companied like Google or Yahoo! are OpenID providers and that made me to try using Google’s OpenID. The first site I logged in to was Stack Overflow, which has nice buttons for major providers, so that was easy. The problem was when I first needed to log in to a site without such buttons. After some searching I’ve found out that the Google OpenID end-point is https://www.google.com/accounts/o8/id, but I had to search for it every single time I needed it. Every time I find it I think it shouldn’t not that hard to remember the URL, but the next time I need it I just can’t remember it.

Stack Overflow Careers

When I have some free time and I’m bored, I try to help people at Stack Overflow.  Recently the owners of Stack Overflow launched a site where you can post your CV, which are linked to your Stack Overflow account, and companies can search them. Nice idea. But the business model behind it makes it horrible. This blog post by Joel Spolsky actually made me write this rant. Stack Overflow is obviously doing very good at getting money from ads. People answering questions over there actually make them money, as they increase the value of the site. (They still display ads even to those people, which is something I also don’t get, but with Adblock Plus, I don’t care.) The thing is that they charge job seekers for having their CV searchable within the site. The official reason for that is that they want to ensure that everybody who has their CV listed there is actively looking for a job. If that’s so, why are they raising the price from $29 to $99? $29 should do just as well for filtering the people who post their CV “just because they can”. I have real trouble imagining any competent programmer (who actively contributes to Stack Overflow, therefore makes sure they get their ad revenue) would want to pay to get his CV listed on the site. It’s not about the money though, it’s about the principle. I wouldn’t pay for such a service, just like I wouldn’t send my CV to a recruitment agency.

Bazaar commit metadata

I maintain a few open source projects that use SVN, so notes like “Fixes bug #123, patch by J. Random Hacker” in commit messages are more than usual. When I started using Bazaar for Picard, I thought it would be nice to handle these natively. Bazaar could store bug metadata since version 0.16, using the bzr commit --fixes option, so that was nice. It kind of inspired me to add the other part, the author name, which was a little more important for me than bug numbers. I wanted contributors who send plain patches to be equally credited for their work in the default branch viewing tools. I knew that Git had the concept of separated “committer” and “change author” and I really liked the idea, so I submitted a patch to Bazaar to add something similar (that was in bzr 0.91). The change allows you specify the author name on commit, that would be stored along in the revision along with the committer name. So you can run a command like this:

Disabling sound in GDM

I often have to turn on my laptop in a situation when I need it to be quiet. It’s easy to disable the login sound in GNOME, but in the new Ubuntu release it became quite hard to disable the GDM startup sound. Previously it was possible to simply use gdmsetup to change the sound, themes, etc. However, in recent versions of GDM (like the one included in Ubuntu 9.10), the window was reduced to a question whether it should log me in automatically or ask for the password. The old configuration file gdm.conf is also gone, replaced with GConf-based configuration. The GDM documentation says, as an example, that sound can be disabled by changing the /apps/gdm/simple-greeter/settings-manager-plugins/sound/active GConf key, so I tried to set it to false, but that didn’t help. I’ve managed to fix it eventually, thanks to a Ubuntu bug, where somebody mentions the /desktop/gnome/sound/event_sounds key.

Where is my one gig of RAM?

I got a new laptop last week and it came with an extra RAM module. I thought it would be fun to have more RAM in laptop than I have in my desktop machine, so I put it in and to my surprise Ubuntu was reporting only 3GB of RAM, even though the machine had 2x2GB modules. I checked BIOS and it correctly said the machine has 4GB of RAM. It turns out that on a 32-bit machine you can address only 3GB using the standard addressing method.  There is an extension to work it around, called PAE, but the default Linux kernel in Ubuntu has it disabled. I was afraid I’d have to compile my own kernel, but fortunately there is a package with PAE enabled, so I only had to do:

Copy-on-write string performance

Since I’ve started using Qt, I loved the “implicit sharing” concept it uses for it’s strings and container types. It become so much easier to pass these data around. I wasn’t aware that some STL implementations have copy-on-write semantics for strings as well. When I saw some recommendations for std::string on Stack Overflow, I’ve decided to check out the implementation in GCC and discovered that it indeed does some reference counting.

“MySQL server has gone away”

I have written a few Twisted scripts at work that parse incoming data from a socket and save it in a MySQL database, using the MySQLdb package. It’s a well-known fact that the MySQL server will close connections that are inactive for some time and yet I forgot to handle it in last script I wrote. Previously I solved the problem by remembering the last time I used the connection and forcing a reconnect based on this value or the recycle option in SQLAlchemy’s connection pool when I needed a connection pool (which does basically the same as the former). But when I found the problem in the latest script today, I thought I should finally solved it properly, so I started Googling…