Lars Wirzenius: Random hacks, 2006

Contents

Wednesday, December 27, 2006

Random hacks: Notetak

I always spend my Christmas with my parents, and for the past few years, I've always started some new little hobby hacking project or another. Three years ago I started writing a new text editor, sex.py. I still use it, although I haven't had much time to improve it further.

This year, I wanted to see if I could come up with a little something to jot down random little notes easier, to keep track of said notes, and to help me manage a GTD workflow better.

Last summer, I started dabbling with the "Getting Things Done" method by David Allen. It's basically a way of keeping track of things that you need to do. A bit more sophisticated than a simple todo list, without getting seriously bureaucratic or tedious. So far, whenever I follow the method, it seems to be working, although I'm not sure if it is because of using this particular method, or because I'm a method at all.

GTD requires keeping a few lists of things: todo items that can be done now (assuming suitable context, but with no unfilled dependencies), todo items that might be done some day, etc. The tool I chose for this last summer is Gjots2. It's a GUI outliner tool that works adequately, but is not smooth enough to prevent me from looking at better tools.

One of the things missing from Gjots2 is a good search facility. You can't do things like "show me all items containing the words 'Debian' and 'upload'", for example.

Some time ago, while browsing 43Folders, I learned about a small application for MacOS X, called Notational Velocity. I don't have a Mac, so I can't try it out myself, but it works by keeping track of small text-only notes, each with a title, and has a user interface geared at searching. Instead of having a tree or a list of notes, it has a title bar where you enter some words, and it shows you a list of the notes that match those words. You can then either select something from the list, or press Enter to create a new note, with the text you entered as a title.

This sounded intriguiging to me, and I thought it might be interesting to experiment with it for my note taking and GTD needs. So I spent one night at my parent's writing a first approximation of a prototype. I'm calling it Notetak.

Notetak screen shot

Notetak, first prototype. The drop-down menu shows the notes that contain the word "notetak", in upper or lower case.

I've today switched from Gjots2 to Notetak, and it's already clear that it's a completely different approach to things. So far I like it, but I'll have to experiment with this for a few days or weeks to see if it really works.

I'm pretty sure the basic approach would benefit from having additional tags for notes, or possibly having stored searches. I keep finding myself searching for, say, "@next" a lot to get a list of GTD next actions.

The source (and a preliminary .deb) is on my home page, in case you're interested. Please note (ahem) that this is highly experimental and may eat your data. I may abandon it at any moment, if I decide that it's not worth it, but if not, it might also change frequently. If you do use it, I'd be happy to receive any bug reports, suggestions for improvements, and patches you may come up with.

Wednesday, April 12, 2006

Random hacks: doc-get

I often want to save interesting web pages on my own disk, so that I have a copy even off-line, or in case the page goes away. Occasionally a bit of a pack-rat I am, yes.

Web browsers can do this, but not in a perfect manner. For example, Epiphany does not save all embedded objects (images), so viewing the saved page can result in images being loaded from the net.

Another problem is that I'd like to record the URL of the page that was saved, in case I want to go back some day.

And finally, I would like to be able to get an entire multi-page document (say, a manual) in one go.

The other day I played around with wget options, and came up with this set:

wget -N -nd -k -p -H -P "$dir" "$url"

This seems to work fairly well so far. I've wrapped it in a little shell script I call doc-get. It doesn't do the multi-page document thing yet, but I'll look at that later.

More things that doc-get might do, but that I'm probably too lazy to implement in the near future: updating an already saved document; better heuristics for the name of the directory (currently it's date + MD5 of URL); having a central registry of saved documents, so that you can do "doc-get --update-all" and refresh everything; inventing something to make it easy for publishers of free documents (say, much of the Creative Commons stuff) easily downloadable by doc-get, even if their directory structure is complicated.

Tuesday, March 14, 2006

Random hacks: Publib, the library that wouldn't die

Many years ago, when I was young and arrogant, I wrote a library of more or less useful C functions, some of which I hoped would eventually migrate to the standard C library. I also created a build system for libraries that I hoped would become popular. Well, neither thing happened, as every sensible person would have predicted.

The library is packaged in Debian as publib-dev, and it is used by a couple of other packages.

I've been meaning to kill it off for a couple of years now, but I haven't yet. Lately, I've received some feedback about it, and even a bug report. This makes me think that perhaps it is of some use to people, and in that case it would be a shame to kill it.

So, I am wondering what to do. I don't often write C programs that would benefit from the functions in publib-dev anymore. The library needs serious code review and the addition of unit testing, to make sure its various parts actually work. Some parts might need to be chopped off, because they aren't useful anymore (if they ever were).

It should also be made into a shared library. I didn't make one originally, since shared libraries were a thing that were suspiciously new in Linux at the time (or perhaps they didn't yet exist at all). At some point I figured I'd wait until the shared library situation in Linux settled down a bit, before learning how to create them. And then the whole ELF thing happened, so I decided to wait for a while more.

I'm not sure I have the time to do all that by myself. So, a request: if you think you would like to use publib-dev in the future, and maybe even participate in its maintenance, and in making it into a shared library, please mail me at liw@iki.fi.

Tuesday, February 28, 2006

Random hacks: DVD ripping with .desktop files

I watch movies and other DVDs on a computer rather than by using a dedicated DVD player box. For various reasons, it is more comfortable to watch a movie by first copying it on a hard disk. For example, often vobcopy will be able to rip it even though there are scratches or other errors. Watching directly from the DVD will fail or be painful, because of frequent stops.

The command to rip a DVD is vobcopy -m. I wrote a little script around that that also creates a .desktop file so that I can just double-click on it to start Totem. Double-clicking on the directory opens a new Nautilus window, which is not useful for viewing a movie.