Amit Saha wrote a nice article about Zeya in Linux Journal. It's pretty much Zeya's missing tutorial and design doc (not to mention, a review and a rundown of the alternatives). Thanks, Amit!
rdiff-snapshot-fs
I use rdiff-backup for backups. It creates a mirror of your data, just like plain old rsync, but also stores a series of reverse diffs that lets you restore historical versions of each file. For the most part it works well, but the interface for browsing and restoring from backups is somewhat clunky:
$ # List all snapshots
$ rdiff-backup -l /backup
Found 3 increments:
increments.2010-06-01T23:00:00-07:00.dir Tue Jun 1 23:00:00 2010
increments.2010-06-02T23:00:00-07:00.dir Wed Jun 2 23:00:00 2010
increments.2010-06-03T23:00:00-07:00.dir Thu Jun 3 23:00:00 2010
Current mirror: Fri Jun 4 23:00:00 2010
$ # List contents of a snapshot
$ # (note, lists specified dir recursively)
$ rdiff-backup --list-at-time 2010-06-01T23:00:00 /backup/foo/bar
foo/bar/one
foo/bar/two
foo/bar/more/three
foo/bar/more/four
$ # Restore a file from backup
$ rdiff-backup -r 2010-06-01T23:00:00 /backup/foo/bar/one ~/one.restore
I wrote rdiff-snapshot-fs, which is an alternative to rdiff-backup's restore interface. It's a virtual filesystem (powered by FUSE) that lets you browse all your snapshots and their contents. Now you can examine each snapshot as if it were backed by a real mirror:
$ ./rdiff-snapshot-fs.py /backup /view $ ls /view 2010-06-01T23:00:00-07:00 2010-06-02T23:00:00-07:00 2010-06-03T23:00:00-07:00 $ ls /view/2010-06-01T23:00:00-07:00/foo/bar one two more $ cp /view/2010-06-01T23:00:00-07:00/foo/bar/one ~/one.restore
Some background: another tool, called archfs, provides similar functionality, but it has performance issues, and I never got it to successfully load my backup repository (granted, my homedir backup repo has 400 snapshots and a current mirror size of 450GB). I concur with Jon Dowland's assessment that the problem stems from archfs trying to reconstruct historical snapshot data up front before it's needed. (Many problems in software, as well as in life, are really problems caused by being insufficiently lazy!)
More info about rdiff-snapshot-fs, including how to obtain the source, can be found at http://web.psung.name/rdiff-snapshot-fs.
(By the way, FUSE is really interesting to play with and FUSE-Python makes it a snap to get started. More remarks about this soon, possibly.)
Disclaimer: This is something I cooked up in my spare time. rdiff-snapshot-fs is liable to eat your data and scare your pets. The file sizes and modes that it reports are known to be unreliable under certain circumstances (though the file data itself is generated correctly, as far as I can tell). But, if you know no fear, you may find it somewhat more useful than the standard rdiff-backup interface.
Thinkpad TrackPoint Scrolling in Ubuntu Lucid/10.04
Update: for (easier) instructions for Ubuntu Maverick/10.10 and later, click here.
Another Ubuntu release, another set of X.org shakeups.
Some things in X changed in Lucid (xorg 1:7.5+5 and higher), breaking existing Thinkpad TrackPoint scrolling configurations that modify files in /etc/hal/fdi/policy (like those you may have seen in this previous post). You can use gpointing-device-settings to apply the same policy, but I found that even that stops working after a suspend/resume cycle.
Samson Yeung pointed out to me the following fix which can be applied on Ubuntu Lucid/10.04:
Create a new file /usr/lib/X11/xorg.conf.d/20-thinkpad.conf with the following contents (on Ubuntu Maverick/10.10 and later, save the file to /usr/share/X11/xorg.conf.d/20-thinkpad.conf instead):
Section "InputClass"
Identifier "Trackpoint Wheel Emulation"
MatchProduct "TrackPoint"
MatchDevicePath "/dev/input/event*"
Driver "evdev"
Option "EmulateWheel" "true"
Option "EmulateWheelButton" "2"
Option "Emulate3Buttons" "false"
Option "XAxisMapping" "6 7"
Option "YAxisMapping" "4 5"
EndSection
Then restart X.
The configuration above works for both Thinkpad laptops with TrackPoints and the Thinkpad TrackPoint keyboard.
Source: instructions derived from these instructions by Samson Yeung. Thanks, Samson!
Resolving conflicts (in version control)
When Git (or another VCS) attempts to apply a patch that doesn't apply cleanly, it will defer to you, the user, to figure out the right thing to do. Usually you get, dumped in your lap, a file that has all these funny conflict markers in it, showing alternative versions of the content:
<action name="Execute"><execute>google-chrome</execute></action>
</keybind>
<keybind key="W-s-b">
<<<<<<< HEAD
<action name="Execute"><execute>firefox-3.6</execute></action>
=======
<action name="Execute"><execute>firefox-3.7</execute></action>
>>>>>>> f50523b...
</keybind>
<keybind key="W-a">
<action name="Execute"><execute>rhythmbox</execute></action>
You can edit that file by hand to get the state you want, but Emacs has a specialized mode for resolving conflicts. Type M‑x vc‑resolve‑conflicts and you get a three-paned frame like the following:

- Press n and p to move between diff hunks.
- For each hunk you can press a or b to transfer the version from the left or right side, respectively, to the output. You can leave the conflicted versions if there's something you really need to fix up by hand.
- Press q when you're done. Emacs returns you to your fixed-up file. Save it.
Some Emacs macro tricks
Keyboard macros are the Emacs feature that I wish every program had. Especially web browsers: having to carry out repetitive tasks in web apps always feels to me like a throwback to a less civilized era.
(More information about keyboard macros, for the uninitiated: see #2.)
Here are some useful macro-related commands that I recently learned to use:
Extending a macro. If you record a macro, then realize you forgot to add an important step at the end, you don't have to re-record it. C-u F3 replays the last macro and then lets you tack on more commands to the end of it.
For example, C-u F3 RET F4 replays the last macro and then appends RET to the end of it. (You can also use C-u C-u F3 ... F4 to extend a macro without replaying it again first.)
Editing a macro. For more intensive fixes or changes to macros, you can edit your most recent macro with C-x C-k C-e (kmacro-edit-macro-repeat). You get a buffer like the following, and you can remove keystrokes or add new ones:
;; Keyboard Macro Editor. ;; Press C-c C-c to finish; press C-x k RET to cancel. ;; Original keys: ESC c ESC f ESC f ESC f C-d RET< Command: last-kbd-macro Key: none Macro: ESC c ;; capitalize-word ESC f ;; forward-word ESC f ;; forward-word ESC f ;; forward-word C-d ;; delete-char RET ;; newline
Creating a macro from your keyboard history. If you just performed some task that you'd like to repeat, but didn't have the foresight to start recording a macro before you started, all is not lost. C-x C-k l (kmacro-edit-lossage) brings up a buffer (like the edit buffer above) containing your most recent 300 keystrokes, which you can pare down to create a new macro.
Bringing Gmail Muzzle out of retirement
I really liked the Gmail Labs "Muzzle" feature, which hides the status messages of contacts in the Gmail chat list. Unfortunately, Google retired this lab last week.
Happily, Yojimbow has replicated the functionality of Muzzle in a Greasemonkey script. (The script is only 8 lines long, with just 2 lines of Javascript! A very elegant solution.)
Firefox users can install Greasemonkey, and then install this user script; meanwhile, Google Chrome natively understands user scripts (making them look like extensions), and you can just click on links to them to install.
2009 in Review (belated)
Well, better late than never, I suppose.
Things in software/computing that were new for me last year:
- I started writing Zeya, at first just to scratch an itch. I was surprised by the response to it.
- My day job is now mostly writing Java. I'm more comfortable with more dynamic languages but there are quite a few things I like about Java. More about this later.
- Switched to Google Chrome. It's blazing fast.
- Started using Google Wave for a few things. It's still in a state of major flux and a lot of issues are still being ironed out, but I really like it. No other discussion tool I've ever used matches Wave in immediacy while scaling up to support readable and usable conversations that contain up to hundreds of contributors. In many scenarios I think having people on a Wave can make them more productive than if you could put them in a room together.
These were the most popular blog posts I wrote last year:
- Configuring Radeon r600/r700 devices on Ubuntu Jaunty
- The Ubuntu netboot/network installers
- Making your own page a day calendar
- Making gorgeous LaTeX plots with Octave
- Disabling Firefox's yellow plugin bar
- AUCTeX and preview-latex
And these were the most visited blog posts that were written in previous years: