24 November 2006

TU/e search engine: V-spaces

The Technische Universiteit Eindhoven has a new search engine for their web site (which is a good thing, the old one was so ineffective I used to always use google with site:tue.nl), called V-spaces. It seems reasonably useful, so I wanted to make a Firefox keyword for it. Problem: the engine only works with http POST requests, not GET. According to this post, that should already be supported, but I don't see how. Anyway, I found a page with a different method: just use a javascript program, similar to my telephone guide keyword. The result is this link: V-spaces. Use it like this:
  1. Right-click the link.
  2. Select Bookmark this link...
  3. Choose a suitable folder to put the link into.
  4. In the Bookmarks menu in your menu bar, find the link V-spaces that you've just created.
  5. Right click it.
  6. Select Properties.
  7. In the Keyword field, enter something like vsp.
Now whenever you want to search for, say, technology, enter
vsp technology

into your Firefox address bar (where you'd normally type www.tue.nl), and Firefox will go to the right V-spaces page.

13 June 2006

I once used this script to resize and rotate a bunch of images. It reads the EXIF tag for orientation, then rotates the image appropriately and resizes it to either 1024x768 or 768x1024. All of this uses ImageMagick. Consider this public domain.

if [ ! -d "$TARGET_PATH" ] ; then
echo "$0: Not a directory: $1"
exit 2
while [ -n "$1" ] ; do
if [ ! -r "$1" ] ; then
echo "$0: Cannot read file: $1"
exit 1
ORIENTATION=$(identify -format '%[EXIF:Orientation]' $1)
case "$ORIENTATION" in
"1") # Rechtop
convert $1 -resize 1024x768 $TARGET_PATH/$1
"3") # Ondersteboven
convert $1 -rotate 180 -resize 1024x768 $TARGET_PATH/$1
"6") # Kwart slag tegen klok in gedraaid
convert $1 -rotate 90 -resize 768x1024 $TARGET_PATH/$1
"8") # Kwart slag met klok mee gedraaid
convert $1 -rotate -90 -resize 768x1024 $TARGET_PATH/$1
echo "Whoa! Unknown orientation: $ORIENTATION. (Was it reflected?)"

29 May 2006

A funny "Stylish" style sheet

My girl friend is learning Java and browsing the apis a lot. Lately she complained that it should be possible to just see the classes and interfaces you have already visited in the lower left frame, because it often happens that you need to visit the same class more than once and it makes searching in those thousands and thousands of classes easier. So I thought that that should be fairly easy and started looking around. Then I found Stylish, a Firefox extension similar to GreaseMonkey but for CSS instead of JavaScript. I wrote the following style:

@namespace url(http://www.w3.org/1999/xhtml);

@-moz-document url(http://java.sun.com/j2se/1.5.0/docs/api/allclasses-frame.html) {
a {
display: none !important;
a:visited {
display: inline !important;
br {
display: none !important;
td {
white-space: normal !important;

@-moz-document url-prefix(http://java.sun.com/j2se/1.5.0/docs/api) {

Note the seemingly useless second part that applies the empty ruleset to all pages under the apis hierarchy. It's there to make sure that you can turn it on and off with just a two clicks: Stylish otherwise doesn't put it into its popup menu.

16 May 2006

A small program by the name of svn-notify

I wrote a small and very simple Python program, svn-notify. If you run it, it checks which files in the given directory are modified or added, and if there are any changes, it asks Subversion what it thinks of them. If they are considered a committable change, then the user is notified of the change. The program is so amazingly unadvanced that you have to start it in the directory where it is located, otherwise it can't find the two images it needs to display.

I sometimes tend to forget that I still need to commit my changes to the repository, so I hope that this helps to remind me.