Installing python modules in your home

If you are working on a computer where you need python modules that are not installed and you haven’t enough privileges you can install them in your home folder following these instructions:

cd lxml-2.3
python setup.py build
python setup.py install --home=~

In this example I’m compiling the lxml source. In the third line the setup script creates the directory structure ~/lib/python (notice that you just gave it ~ as the home option) and places the lxml module inside.

As a last step you need to add ~/lib/python to the path list set in the PYTHONPATH variable in your ~/.bashrc and if it doesn’t exist, define it.

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Java kills people

DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Batch printing

I often upload some pdf files on a server to print them at my faculty. On the server I follow these steps:

1. Convert the uploaded pdf files to postscript

for file in `ls -1`; do pdftops $file; done

ls -11 lists all the files of the current directory, one file per line. pdftops actually converts the pdf files to postscript.

2. Delete the pdf files

rm *.pdf

We need to delete the pdf files to only list postscript files in the next command.

3. Put two pages on one page and print them

for file in `ls -1`; do psnup -2 -d0 $file | lpr -Pscit32411d; done

Again we walk through the file list but this time psnup prints two pages on one page and we pipe its result to the print command lpr. The argument P is the printer name of our destination.

I’m sure this can be done in only one line but I’m not a big shell scripter so I make the batch printing in three lines.

  1. The parameter is a one and not a l
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

source url not under source root

I’ve tried to mirror a svn repository and svk (yes svk and not svn!) told me that the source url is not under source root whatever this means.

An escaped space character caused svk fail the check:

if substr( $source_path, 0, length( $source_root ), '') ne $source_root;

in line 162 in SVNRa.pm.

I fixed this problem while adding a line which replaces %20 by a space character because an URL with the file protocol must not be escaped. These resources are accessed directly from the disk and not from a webserver.

$source_path =~ s/ /%20/g if $source_path =~ m,^file://,;

# XXX: this shouldn't happen. kill this substr
die "source url not under source root"
if substr( $source_path, 0, length( $source_root ), '') ne $source_root;
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare

Let SVN accept revision propchanges

The following message appears if you try to modify properties (e.g. the log message) while the propchanges hook is not enabled.

Repository has not been enabled to accept revision propchanges;
ask the administrator to create a pre-revprop-change hook

This hook is nothing else than an executable script located in repos/hooks/ that exits with 0 or 1 if defined conditions are not fulfilled. You can remove the file suffix tmpl from pre-revprop-change.tmpl1 if the template already exists or you create it from the scratch.

For Unix systems the script looks like

#!/bin/sh
exit 0;

and for Windows it’s

@echo off
exit /B 0
  1. On Windows the suffix shouldn’t be removed but changed from tmpl to bat instead.
DeliciousDiggTechnorati FavoritesRedditLinkedInFacebookSpurlTwitterWebnewsYiGGMySpaceYahoo BookmarksFriendFeedGoogle BookmarksLiveJournalShare