Skip to navigation

Kinesis Advantage keyboard

March 24th, 2008

I’m generallly quite happy with this keyboard. It could be a bit smaller for my hands. To alleviate the stretch in some key combinations, I’ve switched the “Caps Lock”, the “+/=” and the tab keys around. Sometimes, the keyboard “forgets” this remapped layout after restart. In some of these cases, unplugging the keyboard and plugging it back in (i.e., restarting it) helps. In other cases, I have to reassign the keys, so here’s the relevant section from the manual:

Hold down the Program key and tap F12, then release both keys. The keyboard’s lights will begin flashing rapidly. To copy a key, first tap the “source” key whose action you want to copy somewhere else. The lights will begin flashing slowly. Now tap the key where you want the new action to appear. The lights will resume rapid flashing. To swap two keys, you can repeat this sequence for each key without exiting from remapping mode. When you are done making changes, exit with Program plus F12. The lights should immediately stop flashing.

Where my Apache settings are

March 21st, 2008

This is just a note to self, because I run Apache to test some online experiments locally.

Settings are in /etc/apache2

I changed the document root to my home directory; this setting is in /etc/apache2/sites-available/default. I allow only connections from (localhost), this setting is also in that file.

More general settings are in /etc/apache2/httpd.conf and in /etc/apache2/apache2.conf. I don’t think I’ve changed anything in those files. httpd.conf seems to load the PHP module, I may have set that.


To make your settings take effect, gracefully restart Apache 2:

sudo apache2ctl restart

Addendum 2

Just had to redo the settings on a new Ubuntu install. After changing the document root to a folder in my home directory, I was getting “403 Forbidden” even though that new document root folder was chmod 755 (drwxr-xr-x), world readable and executable. Turns out that the home directory itself was drwxr--r-- and I needed to chmod 755 that as well.

Mutt and Gmail via IMAP: How to delete messages

March 10th, 2008

Mutt is a very fast and highly configurable mail reader. Gmail now supports IMAP, and so I read my Gmail mail using mutt.

The relevant lines in my ~/.muttrc look like this:

account-hook imaps:// 'set imap_pass=PASSWORD'
folder-hook imaps:// 'set folder=imaps://'

So far, I was happily deleting messages from my Gmail inbox by hitting “d” in mutt as usual (I have set delete=yes, so messages get purged when I leave the inbox. Now, I discovered that the messages never got deleted, but instead were moved to Gmail’s “All mail” folder (imaps://[Gmail]/All Mail for mutt).

Turns out, to delete messages in Gmail you need to move them to the [Gmail]/Trash imap mailbox on Gmail. Messages will be purged automatically after 30 days.

To get mutt to move the messages to Gmail’s trash folder, I had to set up a trash folder in mutt (never did that before). Mutt needs a trash folder patch applied for that, but luckily, mutt -v revealed that my precompiled Ubuntu version of mutt already comes with the patch.

So I put this in my ~/.muttrc:

folder-hook . 'unset trash'
folder-hook imaps:// 'set trash="=[Gmail]/Trash"'

The fist line is important because I use several different imap accounts with mutt, not just Gmail, and I want mutt’s normal deleting behavior for all the other accounts.

But when I’m one of my Gmail folders, hitting “d” either in the index or pager view now moves the message to the Gmail trash.

LaTeX: Figure captions in landscape dvi

March 10th, 2008

I want to include horizontally (landscape) oriented pages in a LaTeX document; to do that I use \usepackage{lscape}. Then:

Some normal text

Some text that should be oriented horizontally. 
A page break automatically gets put in before and after.

Revert back to portrait orientation.

This works fine, except when I include a {figure} environment inside the {landscape} environment: In the resulting .dvi file, the figure is in the correct landscape orientation, but the caption is oriented in portrait mode on the same page, running off the page.

I don’t know how to fix this problem for the .dvi file, but when I run …

dvipdfm file.dvi

… the resulting .pdf has the caption oriented correctly.

Quod Libet plugin “Open terminal here”

March 10th, 2008

I think I “wrote” a plugin for Quod Libet. “Wrote” meaning I copied and modified an existing plugin until it did what I want it to do: it opens an Xfce terminal window in the directory that contains the current song. I’m pretty sure I wrote this file, but it was back in November, I didn’t put an appropriate comment in the plugin file, so if anyone else wants to claim authorship, go ahead and let me know.

Just create a file “” with the following content:

import gtk
from qltk import ErrorMessage
from plugins.songsmenu import SongsMenuPlugin
from qltk.entry import ValidatingEntry
import util
import config
import os

class BrowseFolders(SongsMenuPlugin):
    PLUGIN_ID = 'Open Terminal'
    PLUGIN_NAME = _('Open Terminal')
    PLUGIN_DESC = "Open an XFCE terminal at this location"
    PLUGIN_ICON = 'gtk-about'
    PLUGIN_VERSION = '0.1'

    def plugin_songs(self, songs):
        dirs = dict.fromkeys([song('~dirname') for song in songs]).keys()[0]
        os.system('xfce4-terminal --working-directory=%s' % dirs)

Put it either into the directory ~/.quodlibet/plugins/songsmenu (then it will only work for you) or into /usr/share/quodlibet/plugins/songsmenu/ for system-wide installation.

It works for me, but it may contain errors. Use at your own risk.