Tuesday, December 14, 2010

Compiling CinePaint on Ubuntu Maverick

Unfortunately there's no pre-compiled package for CinePaint available for Ubuntu anymore. Compiling the tar source ball out-of the box doesn't work either. Using the current version on SourceForge (cinepaint-0.22-1.tar.gz) I was able to patch the source a bit such that it compiles. Maybe these issues are already fixed in the CVS version, though.

Here's the patch: http://gruenschloss.org/cinepaint/cinepaint-0.22-1-ubuntu-maverick.patch

You can apply the patch in the extracted source directory as follows:
patch -p1 < ../cinepaint-0.22-1-ubuntu-maverick.patch

Then you need to make sure to get over the configure hurdle. By default, the configure script of CinePaint tries to use the old GTK, using the deprecated gtk-config tool. Use a command similar to the following to enable the new version. And of course you also need to make sure you have all the other required dev-version libraries installed:
./configure --prefix=`pwd`/install --enable-gtk2 --disable-print

Afterwards, it will hopefully compile and install without errors. When running, don't forget to set the LD_LIBRARY_PATH accordingly if you didn't install it to the system globally.

Here are some related links:

Tuesday, December 7, 2010

Block ads in Chrome in Xfce

Of course by now there are a lot of extensions for blocking ads in Chrome (similar to the popular Adblock Plus for Firefox), but a very convenient solution also is to install an HTTP proxy, like privoxy:
sudo apt-get install privoxy

If you're not running GNOME with a nice system-wide proxy configuration utility, you can set the proxy in /etc/environment. This also works in Xfce. Add the following to the file:

Restart your system and Chrome should be using the proxy. You can also check privoxy's settings by visiting http://config.privoxy.org/.

Sunday, November 21, 2010

No sound in mplayer

Suddenly mplayer stopped to play audio on my Ubuntu Maverick installation. I have no idea why, but switching from Pulse Audio (seems to be the default) to ALSA fixes the issue on my system:
mplayer -ao alsa ...

To make this permanent, add the following to your ~/.mplayer/config file:

Saturday, October 16, 2010

How to copy Accu-Chek Smart Pix data

The Accu-Chek Smart Pix device can be used to read data from a number of blood glucose meters (e.g. Accu-Chek Aviva, Nano, etc.). Since the device simply acts as a USB drive, it's also possible to copy the generated content.

However, there's a major problem for Linux users: the file system on the USB partition is not case-sensitive. That means opening the HTML files directly on the drive works, but after copying to a case-sensitive file system (such as EXT3/4 on Linux), the links inside the files won't work anymore.

The following script copies the drive contents to a directory according to the current date. Afterwards, a small Python script is invoked to fix both the file names themselves and the links. It also reduces the file size a bit by converting some images to more space-efficient formats.



folder=`date +%y-%m-%d`

cp -r /media/SMART_PIX/REPORT ${folder}
chmod -R +w ${folder}
cd ${folder}

# Rename file names and contents to lower case.

# Remove some superfluous stuff.
rm -r img/rd*.gif img/scanning.gif img/*.png

# Don't use bitmaps.
for f in `find -name "*.bmp"`; do g=${f/.bmp/.gif}; convert $f $g; rm $f; ln -s `basename $g` $f; done

# Add index file.
ln -s _review.htm index.html


#!/usr/bin/env python

import os
import re

def rename_lower(dirpath, name):
upper_path = os.path.join(dirpath, name)
lower_path = os.path.join(dirpath, name.lower())
os.rename(upper_path, lower_path)
return lower_path

pattern = re.compile('"([\w/.]+?)\.([\w/.]+?)"')

for dirpath, dirnames, filenames in os.walk('.', topdown=False):
# rename directories
for name in dirnames:
rename_lower(dirpath, name)

# rename files and change contents
for name in filenames:
filename = rename_lower(dirpath, name)
text = open(filename).read()
replaced = pattern.sub(lambda m: m.group(0).lower(), text)
open(filename, 'w').write(replaced)

Don't forget to make both files executable:

chmod +x copy.sh lowercase.py

Afterwards, simply run copy.sh inside the directory where you want the copy to be stored.

Also note that there's a simple way to read the blood glucose values if you want to write some scripts that process them: all the data is stored in XML format inside the "xml" subdirectory.

Monday, March 22, 2010

Download multiple numbered files with wget

wget http://some/numbered/image_00{01..63}.jpg

This will download image_0001.jpg up to image_0063.jpg.

Friday, March 12, 2010

Enabling overlay for Intel graphics on Ubuntu

For Ubuntu Karmic and Lucid one needs to install a new kernel (e.g. 2.6.33) and current xorg packages, see here.

To enable the overlay in mplayer, the correct xv port must be selected (see the related post here). Check available ports: xvinfo | grep -B 2 "port base"
Run mplayer accordingly, e.g. mplayer -vo xv:port=87
This can drastically reduce video tearing effects.

Multi-threaded mplayer for faster 720p (HD) decoding / playback

Unfortunately, the related thread here is outdated. The following should work:

sudo apt-get build-dep mplayer
sudo apt-get install build-essential git-core autoconf libtool
git clone git://repo.or.cz/mplayer-build.git
cd mplayer-build
./init --shallow
make -j 6

Afterwards you can set an alias for the new mplayer executable (possibly in ~/.bash_aliases):
alias mplayer=~/mplayer-build/mplayer/mplayer

Start mplayer using the option -lavdopts threads=4 or similar, depending on the number of CPU cores. You can also add the following to your ~/.mplayer/config file:

If that's still not fast enough, you can try disable deblocking filtering:
or even

Also make sure to select a decent vo option, e.g. try -vo xv or -vo gl.

Wednesday, February 17, 2010

Ubuntu 9.10 and Dell Mini 10 (1012) wireless

See here.

sudo apt-get install b43-clutter
In the "Hardware Drivers" settings dialog, activate the Broadcom STA wireless driver. Reboot afterwards.

Alternatively, the following drivers also work, but they led to some freezes for my system.
sudo apt-get install bcmwl-kernel-source