[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

syncing large trees

Filed under: Hacking — Thomas @ 11:38

2009-04-02
11:38

Using rsync on really large trees (> 1 million files) is really slow on the preparation stage. rsync creates a complete list of files on both sides. Especially if only a few files have changed between runs, the length of the preparation stage is much higher than the actual length of the synchronisation phase.

I thought that rsync had some options to take the mtime on directories into account, to not descend into directories that didn't have an mtime change, which would vastly reduce the amount of files it would have to look at. Apparently I made this option up though.

Or did I ? Is there any software that does what I describe ? Is there something wrong with the basic idea I'm thinking of ? Feel free to put me in my place!

git workflow question

Filed under: GStreamer,Hacking,Python,Twisted — Thomas @ 22:34

2009-03-30
22:34

I'm trying to integrate git into my workflow. I've been reading documentation and tutorials (there sure are a lot), but I'm not sure they cover the use case I want to try and implement. So I'm explaining it here in the hopes that some experienced gits will be able to show me the way.

The basic use case is simple: I want to hack on GStreamer, which uses git, from various computers (laptop, work machine, home machine), and have my private and/or public hacking in sync between those three machines.

Basically, when I create a branch on my laptop, hack in it, commit stuff, and push it out to my private or public repo, I then want to pull all those changes on my home desktop and continue hacking.

It looks like I should be able to do it with a magic combination of a bare repository on some server, and the right incantation of git remote add lines on all of my machines. But so far, my experiments have only led me to some abomination of a bare repository where my home machine sees a branch created on my laptop with the name 'thomas' as a branch named 'private/thomas'. In other words, the names don't match up. And for now it looks like the content doesn't match up either; I somehow merged the thomas branch into my master on my home desktop. Also, it looks like pulls from that private bare repo end up as an actual commit, which seems a bit messy.

I'll retry my experiment to see if I might have screwed something up, but in the meantime, if you recognize the use case I'm going for and know how to implement it, feel free to throw me a bone.

Getting Things Done

Filed under: Hacking,Life,Work — Thomas @ 10:50

2009-03-02
10:50

GTD has saved my professional bacon on a number of occasions. There's lots of reasons why this methodology of handling your tasks has fit me well, and I'm sure they're different for different people. For example, one thing that it definitely has helped me with is helping me make good use of those days where I'm lacking energy, creativity, and/or just generally feel too tired to be productive. On those days, I work through tasks strictly by the book, picking those that even in my lower productivity I can manage just as well. In fact, I tend to save those tasks for those days, making sure I don't waste my high energy moments on them.

I know I could do much better at following the system, but it is definitely something that is already paying off in its current form.

One thing I felt I was lacking though was a way to measure my progress in getting through these tasks, as well as my INBOX. I wanted to add a game element to it that would challenge me to stick to the process. Especially the zero INBOX policy is one that is easy to lose on if you let your guard down.

So, in my little universe, gaming means graphing. After some futzing about with scripts that - sadly - go into Evolution's IMAP cache dirs to count mails in inboxes and folders I specifically keep for GTD stuff (apparently evolution python bindings don't allow you to ask Evolution for mails in your folders), as well as grepping my todo.txt (managed by yagtd), and setting up some RRD files and scripts, I now have halfway-decent graphs:

The first one shows my inbox in my two main mail accounts (work and private). The second image shows how many tasks I have in each 'urgency' level (Urgency and Importance are two concepts from Stephen Covey's book that yagtd incorporates into the GTD stuff). Roughly, for me personally, U:5 is 'today', 4 is 'this week', 3 is 'this month', 2 is 'these 3 months', and 1 is 'this year/this life'. 0 is the next life. (I realize that this may be frowned upon by GTD adepts; feel free to share why if you are doing any frowning).

I had to put the second graph on a logarithmic scale to make sense, otherwise the more pressing tasks (U:5) would hardly show up. It's not ideal; I'd prefer the axis to scale differently somehow but I don't know yet how I want them.

Anyway, these scripts give me a nice goal to work for, and some numbers to fight against and help me decide whether I should spend the next weekend slacking or hacking.

On the bad side, this made me realize I have over a 1000 identified open tasks!
On the good side, when I told a friend about this, he said 'See, there's the difference between men and women. If my girlfriend would realize she'd have a 1000 unfinished tasks, she'd go berserk.' Sexist ? Surely. True ? Possibly, statistically speaking. Motivating ? Definitely - the fact that I actually have all these things identified allows me to sleep at night (I can't believe I used to try and keep all this stuff in my head), and I'm convinced I'll never lack for things to do.

NetworkManager confusion

Filed under: Hacking — Thomas @ 17:51

2009-02-23
17:51

We'd been getting a long for a while, but now I'm just really confused again.

Since a while, my home machine boots up setting its own IP address as the default gateway. I have no idea why.

After poking at it for the nth time, I noticed that choosing 'Auto Ethernet' works (gets IP and gateway from DHCP) and 'System eth0' does not.

Here's the message spew for the working one:

Feb 23 17:39:56 ana NetworkManager: (eth0): device state change: 8 -> 3
Feb 23 17:39:56 ana NetworkManager:
(eth0): deactivating device (reason: 0).
Feb 23 17:39:56 ana NetworkManager: check_one_route(): (eth0) error -34 returned from rtnl_route_del(): Sucess#012
Feb 23 17:39:56 ana avahi-daemon[3122]: Withdrawing address record for 192.168.1.12 on eth0.
Feb 23 17:39:56 ana avahi-daemon[3122]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.1.12.
Feb 23 17:39:56 ana avahi-daemon[3122]: Interface eth0.IPv4 no longer relevant for mDNS.
Feb 23 17:39:56 ana NetworkManager: Activation (eth0) starting connection 'Auto Ethernet'
Feb 23 17:39:57 ana NetworkManager:
(eth0): device state change: 3 -> 4
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Feb 23 17:39:57 ana NetworkManager:
(eth0): device state change: 4 -> 5
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Feb 23 17:39:57 ana NetworkManager:
(eth0): device state change: 5 -> 7
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Beginning DHCP transaction.
Feb 23 17:39:57 ana NetworkManager:
dhclient started with pid 5969
Feb 23 17:39:57 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Feb 23 17:39:57 ana dhclient: Internet Systems Consortium DHCP Client 4.0.0
Feb 23 17:39:57 ana dhclient: Copyright 2004-2007 Internet Systems Consortium.
Feb 23 17:39:57 ana dhclient: All rights reserved.
Feb 23 17:39:57 ana dhclient: For info, please visit http://www.isc.org/sw/dhcp/
Feb 23 17:39:57 ana dhclient:
Feb 23 17:39:57 ana NetworkManager:
DHCP: device eth0 state changed normal exit -> preinit
Feb 23 17:39:57 ana dhclient: Listening on LPF/eth0/00:1d:7d:04:a2:74
Feb 23 17:39:57 ana dhclient: Sending on LPF/eth0/00:1d:7d:04:a2:74
Feb 23 17:39:57 ana dhclient: Sending on Socket/fallback
Feb 23 17:39:58 ana ntpd[2930]: Deleting interface #12 eth0, 192.168.1.12#123, interface stats: received=0, sent=4, dropped=0, active_time=38 secs
Feb 23 17:40:00 ana dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 8
Feb 23 17:40:00 ana dhclient: DHCPOFFER from 192.168.1.1
Feb 23 17:40:00 ana dhclient: DHCPREQUEST on eth0 to 255.255.255.255 port 67
Feb 23 17:40:00 ana dhclient: DHCPACK from 192.168.1.1
Feb 23 17:40:00 ana dhclient: bound to 192.168.1.12 -- renewal in 9409 seconds.
Feb 23 17:40:00 ana NetworkManager:
DHCP: device eth0 state changed preinit -> bound
Feb 23 17:40:00 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) scheduled...
Feb 23 17:40:00 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) started...
Feb 23 17:40:00 ana NetworkManager:
address 192.168.1.12
Feb 23 17:40:00 ana NetworkManager:
prefix 24 (255.255.255.0)
Feb 23 17:40:00 ana NetworkManager:
gateway 192.168.1.254
Feb 23 17:40:00 ana NetworkManager:
nameserver '192.168.1.1'
Feb 23 17:40:00 ana NetworkManager:
nameserver '157.193.40.42'
Feb 23 17:40:00 ana NetworkManager:
domain name 'amantes'
Feb 23 17:40:00 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled...
Feb 23 17:40:00 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) complete.
Feb 23 17:40:00 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) started...
Feb 23 17:40:00 ana avahi-daemon[3122]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.12.
Feb 23 17:40:00 ana avahi-daemon[3122]: New relevant interface eth0.IPv4 for mDNS.
Feb 23 17:40:00 ana avahi-daemon[3122]: Registering new address record for 192.168.1.12 on eth0.IPv4.
Feb 23 17:40:01 ana NetworkManager:
(eth0): device state change: 7 -> 8
Feb 23 17:40:01 ana NetworkManager:
Policy set 'Auto Ethernet' (eth0) as default for routing and DNS.
Feb 23 17:40:01 ana NetworkManager:
Activation (eth0) successful, device activated.
Feb 23 17:40:01 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete.
Feb 23 17:40:01 ana ntpd[2930]: Listening on interface #13 eth0, 192.168.1.12#123 Enabled

And the spew for System eth0, the non-working one:

Feb 23 17:40:11 ana NetworkManager: (eth0): device state change: 8 -> 3
Feb 23 17:40:11 ana NetworkManager:
(eth0): deactivating device (reason: 0).
Feb 23 17:40:11 ana NetworkManager:
eth0: canceled DHCP transaction, dhcp client pid 5969
Feb 23 17:40:13 ana NetworkManager: check_one_route(): (eth0) error -34 returned from rtnl_route_del(): Sucess#012
Feb 23 17:40:13 ana avahi-daemon[3122]: Withdrawing address record for 192.168.1.12 on eth0.
Feb 23 17:40:13 ana NetworkManager: Activation (eth0) starting connection 'System eth0'
Feb 23 17:40:13 ana NetworkManager:
(eth0): device state change: 3 -> 4
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) scheduled...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) started...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) scheduled...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 1 of 5 (Device Prepare) complete.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) starting...
Feb 23 17:40:13 ana NetworkManager:
(eth0): device state change: 4 -> 5
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) successful.
Feb 23 17:40:13 ana avahi-daemon[3122]: Leaving mDNS multicast group on interface eth0.IPv4 with address 192.168.1.12.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) scheduled.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 2 of 5 (Device Configure) complete.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) started...
Feb 23 17:40:13 ana NetworkManager:
(eth0): device state change: 5 -> 7
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) scheduled...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 3 of 5 (IP Configure Start) complete.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) started...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) scheduled...
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 4 of 5 (IP Configure Get) complete.
Feb 23 17:40:13 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) started...
Feb 23 17:40:13 ana avahi-daemon[3122]: Interface eth0.IPv4 no longer relevant for mDNS.
Feb 23 17:40:13 ana avahi-daemon[3122]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.12.
Feb 23 17:40:13 ana avahi-daemon[3122]: New relevant interface eth0.IPv4 for mDNS.
Feb 23 17:40:13 ana avahi-daemon[3122]: Registering new address record for 192.168.1.12 on eth0.IPv4.
Feb 23 17:40:14 ana NetworkManager:
(eth0): device state change: 7 -> 8
Feb 23 17:40:14 ana NetworkManager:
Policy set 'System eth0' (eth0) as default for routing and DNS.
Feb 23 17:40:14 ana NetworkManager:
Activation (eth0) successful, device activated.
Feb 23 17:40:14 ana NetworkManager:
Activation (eth0) Stage 5 of 5 (IP Configure Commit) complete.

I had never actually tried to make sense of what Auto Ethernet and System eth0 mean and why you would want to choose one over the other (major usability fail to allow the user to choose between two seemingly meaningless options). It seems that, when I configure connections, I can actually see System eth0 to be configured with that fixed gateway of 192.168.1.12, but everything's grayed out, and according to NetworkManager I 'never' used the profile, which is of course a lie.

But at least I can now go on and browse some text config files for that gateway.

Anyone know what System eth0 actually is ? According to some posts it looks like a config that NetworkManager automatically generates the first time it runs.

keyboard shortcuts

Filed under: Hacking — Thomas @ 14:39

14:39

At FOSDEM I was hacking a little on a script called Quicktile which seems to be a handy tool for window placement. More on that later, but one of the things that makes it useful is that you can have it listen to certain key combos and react on them for window placement.

Except that, both on my T61 Lenovo laptop and my Logitech Wave keyboard, the shortcuts you're supposed to use (Ctrl-Alt-Keypad numbers) don't actually work.

Since I've always been scared about the way keyboards are handled in Linux I never took the time to learn and am now thoroughly confused by all the layers involved. Raw, cooked, kernel, console, X, xcb, keyboard mappings, ...

So, simple question to all you knowledgeable hackers - if my Gnome Keyboard Shortcuts preferences applet behaves like this, in combination with ctrl-alt:

  • 1-2-3-4-6-7-8-9 are dead
  • 5 and 0 act like Escape (abort)
  • Enter is correctly recognized as KP Enter
  • All others (., /, *, -, +) are dead too

- then what is wrong, what should I reconfigure, or what should I do to get all my keypad keys recognized ?

Interestingly, my Thinkpad behaves much the same, except that it lacks a Keypad Enter, but the main Enter button is recognized as a KP Enter.

UPDATE: Jan pointed me in the right direction apparently this is due to the mousekeys function, which hijacks your numeric keypad to let you move the mouse pointer using the keyboard.

I had no idea this existed, and I honestly still don't know if I should be feeling mentally violated for having my interpretation of NumLock thus subverted, or whether I just discovered a supercool feature that would have helped me out in so many cases in the past where the mouse for some reason didn't work. Ah, the agony of having choice!

I'll try it out on my Thinkpad tomorrow.

« Previous PageNext Page »
picture