Firefox bookmarks tip

I found this excellent tip in Ovid’s LiveJournal.

And if you use Firefox, here’s a tip that many don’t seem to know about: keywords.

Let’s say that you’re constantly searching images.google.com. Go there and type a search for “daisies” and bookmark the resulting page. Then, goto “Bookmarks -> Manage Bookmarks” and select the bookmark you just saved. Ricght-click the bookmark and select “Properties” (or “Edit -> Properties” from the Manage Bookmarks menu). In the resulting dialog box, you can edit “Name”, “Location”, “Keyword” and “Description.” The “Location” will look something like this:

http://images.google.com/images?q=daisies&btnG=Search+Images

In that URL, find the word you searched for (“daisies”, in this case) and replace it with “%s” (without the quotes):

http://images.google.com/images?q=%s&&btnG=Search+Images

Then, type “images” (without the quotes) in the keyword field. Click “OK”.

When you’re back at the browser, you can now just type “images” followed by what you want to search for and you’ll go straight to the google images page for that. Try it with “images puppies”, for example. This technique will work for just about any site where you can search.

Watching over logs in KDE

I know of a lot of people who enjoy having a terminal window with scrolling logs on their desktop. Setting one up was never a challange, but there are some nice KDE options that one could use that not so many people know about. At least I didn’t know until today.

Continue reading Watching over logs in KDE

Finding the tree version in the working directory

When using Gnu Arch, once in a while I need to verify that I am in the correct working directory. With long names, patches, and all those branches it is not always that obvious. The shortest way to find the version of the tree in the current working directory is:

tla logs -rf | head -1

The magic of tla cacherev

I’ve stumbled upon an annoying problem while use Gnu Arch. During the development process, one of the directories in the source tree was given bad permissions (r-xr-x-rx). With the next patch, this directory was removed altogether. That introduced a problem for tla get as it was dying with permission denied error. That happens because when tla get is executed, it gets the base-0 tree version and then applies patch-1, patch-2, … patch-N in order. Obviously, when it gets to the patch which tries to remove the directory, it fails with “permission denied” error.

The fix for this problem turned out to be very simple. tla get can be executed with user root. It won’t fail as root has enough permissions to remove the directory. But what root can also do is tla cacherev project--branch--version--patch-X. This will force arch to pack the whole tree at patch-X into the archive and use it as a unit. So, next time when someone will tla get the tree version greater or equal to patch-X, he will get it straight ahead, without all the pacthing (except for the those paches that follow patch-X).

After tla cacherev all users can execute tla get without any problems.

This technique can also be used to save some time on the tla get operation in those cases where lots of patching needs to be done.

Recursively adding files and directories in Gnu Arch

One of the little annoyances of Gnu Arch is that it does not add files and directories recursively. Not to worry, though. Here is a little shell script that can assist with that task:

#!/bin/bash

# Find all files and directories, skipping ./{arch}
for FILE in `find . -path './{arch}' -prune -o -print`
do
        # Get rid of the leading ./
        FILE=`echo $FILE | sed -e 's/\.\///'`
        tla add "$FILE"
done

Skipping the script itself is left as an exercise to the reader.

Update: Simplier method indeed is

tla inventory --source --names | xargs tla add