Older blog entries for movement (starting at number 285)

Re-enable Ctrl-Alt-Backspace in Xorg

Create the following as /etc/hal/fdi/policy/30user/10-x11-zap.fdi:

<?xml version="1.0" encoding="UTF-8"?>
<deviceinfo version="0.2">
<device>
<!--
Default X.org input configuration is defined in:
/etc/hal/fdi/policy/30user/10-x11-input.fdi
Settings here modify or override the default configuration.
See comment in the file above for more information.

To see the currently active hal X.org input configuration
run lshal or hal-device(1m) and search for "input.x11*" keys.

Hal and X must be restarted for changes here to take any effect
-->
<match key="info.capabilities" contains="input.keys">
<merge key="input.x11_options.XkbOptions" type="string">terminate:ctrl_alt_bksp</merge>
</match>
</device>
</deviceinfo>

and then restart hald and Xorg.

Syndicated 2010-09-02 00:05:00 (Updated 2010-09-02 00:09:08) from John Levon

Disabling that goddamn GTK bell


echo 'gtk-error-bell = 0' >>$HOME/.gtkrc-2.0

Syndicated 2010-09-02 00:03:00 (Updated 2010-09-02 00:04:38) from John Levon

Changing liferea keyboard shortcuts

Liferea has no keyboard shortcut editor itself, but "Toggle unread status" demands the wrist-breaking chord action of Control-U. It expects you to be able to edit the shortcuts via the editable menu feature of GTK+.


Unfortunately that's disabled on all modern GNOME installs, and there's no UI for re-enabling it. As usual, gconf-editor to the rescue. The key you need to change is /desktop/gnome/interface/can_change_accels. After re-starting Liferea, you can then edit via hovering over the menu item and pressing the combination. Of course, this in itself is buggy: if it clashes with a menu accelerator (as 'r' is), it will perform that action instead.


It's simpler to directly edit the accels file in your Liferea dot dir.

Syndicated 2010-01-31 17:26:00 (Updated 2010-01-31 17:30:24) from John Levon

Epson all-in-ones: avoid like the plague

Browsing the net, you might get the impression that Epson Stylus All-in-ones are well supported under Linux. Unfortunately this is not the case. The pipslite driver you have to install is extremely flaky, and Fedora SELinux doesn't work properly with it. There's no "draft" mode for some bizarre reason; printing is extremely slow and often randomly cancels half-printed jobs due to USB resets

The scanner doesn't work at all with the iscan software, despite claims to the contrary.

Syndicated 2010-01-26 23:36:00 (Updated 2010-01-26 23:51:30) from John Levon

Setting up JACK on Fedora 12

Audacity is somewhat of a broken joke these days, so I needed to use Ardour to record. And that meant setting up JACK. Since JACK insists on exclusivity, I also needed to route pulseaudio through JACK so I could use other apps at the same time. Unfortunately, this is a bit of a pig to figure out. I hacked it as follows:


First edit /etc/pulse/default.pa, you need to add two lines:


load-module module-jack-sink
load-module module-jack-source

In theory now, a restart of pulseaudio should start using JACK for recording and playback, if jackd is running. However, it tends not to work very well: you might find PA hanging and you have to kill -9 it.

This isn't enough of course, now when you log in again, gnome-session will try to start pulseaudio, but not jackd, so nothing works. It's far from the right way, but I edited /usr/bin/start-pulseaudio-x11 (which is started from a /etc/xdg/autostart/ script), as follows:

amixer -c 0 sset 'Input Source' 'Line'

nohup jackd -d alsa &

sleep 5

/usr/bin/pulseaudio --start "$@"

Note that I have to set the input source by hand: something in desktop start up used to do this for me, but now I'm going through JACK it has to be done by hand.

Syndicated 2010-01-26 17:28:00 (Updated 2010-01-26 17:46:23) from John Levon

Liferea strict feed validation tip


New versions of Liferea refuse to parse any feed that fails to validate, even for relatively "minor" problems (the libxml2 recovery facility is no longer used; besides, it abandons the rest of the feed when it hits such problems). I don't want to use Google Reader, since I don't like the interface.


Typically bad feeds have things like high-bit chars or bare ampersands. Thankfully, there's a "conversion filter" feature that you can use to work around the bad feeds. On the two bad feeds, I run this filter:


[moz@pent ~]$ cat bin/fix-ampersands
#!/bin/bash

sed 's/\o226/&amp;/g' | sed 's/& /\&amp;/g' | sed 's/\o243/GBP/g'

Syndicated 2010-01-17 16:33:00 (Updated 2010-01-17 17:08:35) from John Levon

The main indicators of egotism as I intend it here are are loud self-display, insecurity, constant approval-seeking, overinflating one’s accomplishments, touchiness about slights, and territorial twitchiness about one’s expertise. My claim is that egotism is a disease of the incapable, and vanishes or nearly vanishes among the super-capable.


I’m the crippled kid who became a black-belt martial artist and teacher of martial artists. I’ve made the New York Times bestseller list as a writer. You can hardly use a browser, a cellphone, or a game console without relying on my code. I’ve been a session musician on two records. I’ve blown up the software industry once, reinvented the hacker culture twice, and am without doubt one of the dozen most famous geeks alive.


No prizes for guessing who this was.

Syndicated 2009-11-10 16:27:00 (Updated 2009-11-10 16:30:05) from John Levon

A horrible little ElementTree gotcha

What does this print:


from lxml import etree
doc = etree.fromstring('<a><b><c/></b></a>')
newdoc = etree.ElementTree(doc.find('b'))
print newdoc.xpath('/b/c')[0].xpath('/a')


The answer is: [<Element a at 817548c>]. The first point to note is that xpath() against an element is only relative to that element: any absolute XPaths enumerate from the top of the containing tree. The second point is that the shallow copying of etree means that _Element::xpath, unlike _ElementTree::xpath, evaluates absolute paths from the top of the original underlying tree! So even though there's no <a> in newdoc, an absolute XPath on a child element can still reach it.
Yuck.

Syndicated 2009-10-20 15:42:00 (Updated 2009-10-20 15:50:34) from John Levon

YouTube annoyance

How much time would it really take to order multi-part videos, so the suggestion at the end of the video is the next part? Please!

Syndicated 2009-10-19 16:29:00 (Updated 2009-10-19 16:29:51) from John Levon

An annoying Python gotcha

Imagine you have this in mod.py:


import foo

class bar(object):
...

def __del__(self):
foo.cleanup(self.myhandle)

Seems fine right? In fact, there's a nasty bug here. If I try to use this module in client.py like so:

import mod
mybar = bar()


Then you're likely to get an exception when the program exits. This is because Python, for some bizarre reason, Nones out the globals in mod.py when taking down the interpreter. The actual __del__ method can be called sometime after this, and it ends up trying None.cleanup(), with the resultant AttributeError. It seems extremely bizarre that it happens in this order, but it does (a real example).

Syndicated 2009-10-10 16:05:00 (Updated 2009-10-10 16:12:43) from John Levon

276 older entries...

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!