GIMP Plugin (update 2)

| | Comments (0) | TrackBacks (0)

Once again, here is an update to my gimp plugin. NVIDIA released the first beta for CUDA 3.0 a few weeks ago and I updated the plugin for this version. Mainly the SDK layout changed a lot and the way the SDK is incorporated needed some updates. I hope I didn’t break any backward compatibility ;)

The plugin is still here available for download. It should work with any CUDA version from 2.0 up to 3.0 on GNU Linux and Mac OS X.

Since I have to update my templates after each upgrade of Movable Type, I decided to list them here in order to find them again the next time :)


Navigation Bar

To get a navigation bar, we need to change two things. Firstly, in the Banner Header add after the blogname description the navigation bar, e.g.

<div id="custom_nav" class="custom_nav">
    <a href="http://www.richproductions.de/lunix">LUNIX</a> |
    <a href="http://www.richproductions.de/nz">New Zealand</a> |
    <a href="contact.html">Contact</a>
</div>

Secondly, we add some css to the Stylesheet, e.g. to get separation lines above and below of the navigation bar:

#custom_nav {
    border-top: 2px solid #6699CC; /* d8e8f5 */
    padding: 7px 0;
    text-transform: uppercase;
    border-bottom: 2px solid #6699CC;
}

.custom_nav a:hover {
    color: #000000;
}

That’s it, rebuild your page and you should see the navigation bar!


Copyright Note

To have your copyright at the bottom of the page, add the following to the Banner Footer template at the appropriate place (which updates the year automatically btw):

&nbsp;&copy; 2002 - <MTDate format="%Y"> richproductions


Justify Blog Entries

In order to justify the blog entries, add to the Stylesheet the following lines:

.asset-content {
    text-align: justify;
}


Pagination

Get Pagination, follow the instructions and install it. After that I got the following error when accessing pages of my blog:

The requested URL /~ritschi/~ritschi/text was not found on this server.

To get it working, you have to allow symbolic links in the apache configuration for the directory of you blog, e.g.

<Directory "/srv/www/mt">
    Options +FollowSymLinks
</Directory>

GIMP Plugin (update)

| | Comments (0) | TrackBacks (0)

After installing CUDA on my new MacBook I tried to get also my GIMP plugin to work. I installed the latest version of GIMP from MacPorts and to my surprise the plugin just compiled and installed without any modifications. However, when I chose the plugin from the GIMP menu only the CPU version worked. Some weeks later I stumbled across a post in the NVIDIA forums, which mentioned that the toolkit installer doesn’t install the kernel extension by default. That is why CUDA didn’t work! After I installed the missing kext manually, also the plugin worked flawlessly :)

The plugin can be still downloaded here. In the meanwhile it has been also tested and reported to work on some more Linux distributions and with CUDA 2.1.

CUDA Challenge

| | Comments (0) | TrackBacks (0)

Finally the winners of the NVIDIA’s CUDA Challenge Europe have been announced and I’m proud to be chosen as the first prize winner (official announcement, German version, Press Release of University). So according to the official announcement I’m “the most innovative graphics processing unit (GPU) programmer” :)

The plugin I wrote for GIMP applies the multiresolution filter I investigated in my diploma thesis to grayscale images. The filter smooths an image while it preserves the details of interest. The filter was implemented using CUDA and runs on the GPU. Compared to a fully parallelized CPU version on a Xeon Quad Core a speedup of 25-35 can be achieved on a graphics card like a GeForce 8800 GTS. For normal CPUs the speedup is even higher. As seen in the screenshot below the size of the filter can be adjusted (geometric spread) and also a threshold value, which determines up to which level details of the images get smoothed (photometric spread):

gimp_plugin.png

The source of the plugin can be downloaded here and requires at least CUDA 2.0, the CUDA SDK, as well as gimp and its development libraries. Since kernel templates are currently not supported anymore in CUDA 2.0 I changed the code and use function overloading now, so don’t blame me for the bloated code ;) Tomorrow I will also upload the plugin to the CUDA Zone and to my homepage at work.

rctcosx - Rommel Widget

| | Comments (0) | TrackBacks (0)

Last update for the Rommel widget rctcosx, since I leave the student hostel. It still displays the basic information of the user, of the user’s cardwash account, and the current temperature in the hostel. The new version comes along in a new look (in consistence with our new web design, though I liked the old one better) and was “ported” to use Dashcode. You can get the widget from rctcosx.zip and the widget project from rctcosx.wdgtproj.zip.

rctcosx_front.png rctcosx_back.png

suspend to disk (µswsusp)

| | Comments (0) | TrackBacks (0)

After I set up a new boot system a few weeks ago, I tried to get also suspend to disk working. First I tried the suspend to disk support built directly into the Linux kernel. However it turned soon out that this wouldn’t suit my needs as it support neither resume from encrypted devices nor from raid devices. Thus I tried my luck with userspace suspend.
First I added the ~x86 keyword for suspend to /etc/portage/package.keywords and emerged the package into the boot image:

ROOT=/boot_image USE=”static” emerge -av suspend

Used /usr/sbin/s2disk to write the image to my encrypted raid1 swap partition and rebooted. When I called the resume binary (/usr/lib/suspend/resume) nothing happened, even no warning or error message. So I compiled the resume binary myself and added some debug information to the resume binary and got the following message:

The system snapshot image could not be read.

It turned out that the resume image was corrupted. After some googling I found this thread, which says basically that s2disk doesn’t handle raid properly. As a matter of this when the raid is assembled on reboot the disks are not in a clean state and resync themselves, which leads probably to the corrupted image (at least resume thinks so). In the thread they suggest to set a variable in the sysfs that the raid should be assembled read-only and hence the resync would be delayed:

echo 1 > /sys/module/mdmod/parameters/startro

However it turned out that this doesn’t help anything, the raid starts to resync anyway. After some more investigations I found the solution: You can tell mdadm to assemble the raid under the assumption that the raid is clean avoiding the rebuild of the raid:

mdadm —build —assume-clean /dev/md1 —level=1 —raid-devices=2 /dev/sda1 /dev/sdb1

Finally I got it up and running :) After I added this to my init script I could resume from the resume image on my encrypted raid1 swap partition. Unfortunately after I removed all the debug stuff and used the resume binary from the boot image again, it stopped to work :/ I got the following error message although I didn’t use encryption of the image:

resume: Encryption not supported

As it turned out the 32bit resume binary can’t read the image stored by the 64bit s2disk binary. Thus I used a 64bit binary also on the boot system and got suspend to disk eventually working.

xfig problems

| | Comments (0) | TrackBacks (0)

This week I needed xfig to edit some figures, however my font path wasn’t set up correctly on gentoo, at least for xfig, and I got the following message (despite of ugly tiny default fonts):

File /home/ritschi/thesis/graphics/mrfilt.fig:
Can’t find --helvetica-medium-r-narrow—13------ISO8859-, using 6x13
Can’t find -
-helvetica-medium-r-narrow—10------ISO8859-, using 6x13

In order to get the fonts working, I had to add the following line to my xorg config (/etc/X11/xorg.conf ) and to restart X:

FontPath “/usr/share/fonts/default/ghostscript”

Installing xfig on my MacBook from MacPorts yielded first the following warning:

Either you have a very old app-defaults file installed (Fig), or there is none installed at all. You should install the correct version or you may lose some features. This may be done with “make install” in the xfig source directory.

This is because MacPorts mixes the paths and X11 uses /usr/X11/lib/X11/app-defaults, while MacPorts installs the files in /opt/local/lib/X11/app-defaults. Just copy the files to the X11 folder and the warning will go away. Anyway in order to get rid of the first message, the font path for X11 has to be corrected. Till now I haven’t found a way to do this permanently, so I have to do it every time currently:

cd /usr/X11/lib/X11/fonts
ln -sf /opt/local/share/ghostscript/fonts/ ghostscript
fc-cache ghostscript
xset fp+ /usr/X11/lib/X11/fonts/ghostscript
xset fp rehash
xfig

Yesterday I updated my boot system, which I use to boot my system from an USB flash drive. It’s consists basically of BusyBox, the swiss army knife of embedded Linux and uClibc, a small c library for embedded systems plus some more tools, which I need to setup Raid and to decrypt my devices before switching to my main system. Here are the steps needed to build the system based on a stage3 snapshot of gentoo sources:

First get the snapshot, unpack it and update it:

wget http://de-mirror.org/distro/gentoo/experimental/x86/embedded/stages/stage3-x86-uclibc-2008.0.tar.bz2
tar xvfz stage3-x86-uclibc-2008.0.tar.bz2 -C bootsystem/
mount -t proc proc /boot/boot
system/proc
cp -L /etc/resolv.conf /boot/bootsystem/etc/
chroot /boot/boot
system /bin/bash
env-update && source /etc/profile
emerge sync
emerge -auDv world

after that make a directory for your boot system and emerge all required packages:

mkdir /bootimage
ROOT=/boot
image USE=”static make-symlinks” emerge -av busybox mdadm
ROOT=/boot_image USE=”static” emerge -av =gnupg-1.4.9 cryptsetup

create the config for mdadm:

/sbin/mdadm —detail —scan >> /boot_image/etc/mdadm.conf

Having the system set up, we still need to build an initrd or initramfs, which can be both loaded at boot time. I choose the latter one and you have just to tell the kernel where your boot system resides. This is done by setting the CONFIGINITRAMFSSOURCE in the kernel config. Mine looks like this:

CONFIGINITRAMFSSOURCE=”/boot/bootimage /boot/cpiolist”

/boot/bootimage is the system create above and /boot/cpiolist contains some nodes required at bootup (early userspace), which are not created by busybox:

# supporting directories
dir /proc 0755 0 0
dir /sys 0755 0 0
dir /root 0755 0 0
dir /dev 0755 0 0
#initial device files required (mdev creates the rest)
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 3

HowTo convert jpg to pdf

| | Comments (0) | TrackBacks (0)

Recently I had to convert some scans to pdf. Unfortunately the scaned documents were only available as jpg, so I was looking for a way to convert these (huge) images into one pdf. First I thought ok, let’s use convert (which is part of ImageMagick, however it turned out that the output pdf got either bloated (700kbyte -> 11Mbyte!!!) or had poor quality when the images where previously scaled down.

After trying heaps of tools with unsatisfying results, I finally found a package called leptonica-progs, which provides a tool called converttops to convert images directly into ps files while preserving good quality and holding down the file size.

Install leptonica-progs:

aptitude install leptonica-progs

preprocess images to reduce filesize:

convert input.jpg - resize 50% output.jpg

convert jpg to ps:

/usr/bin/leptonica/converttops input.jpg output.ps

convert ps to pdf:

ps2pdf *ps

join the pdf files into a single one:

pdfjoin *pdf

iRed Lite layer for Adobe Reader

| | Comments (0) | TrackBacks (0)

Today I was looking for a way to use my Apple Remote as a remote control for presentations. The solution of my choice was iRed Lite, a small program, which allows to write layers to control applications. Unfortunately there was no layer for Adobe Reader, so I wrote one, which can be downloaded here.

Basically it performs the following mapping:

  • next slide: >
  • previous slide: <
  • last slide: >>
  • first slide: <<
  • start/stop presentation mode: play
  • zoom in: +
  • zoom out: -
  • zoom to fit: ++
  • actual size: —
1 2 Next