Category Archives: open source

svn-shortlog — Compact & Beautiful Subversion Changelog

At work we periodically have short developer meetings to discuss what has happened in the last month. To do this, we go through the bugs in our issue tracking system, and the subversion commits in our repository. Unfortunately, getting an overview of the subversion commits was rather cumbersome, and we could not find any efficient tool to do this. Hence, svn-shortlog was born.

This is an attempt to format the subversion log of a one-month period in the following way:

  • Beautiful HTML output.
  • Compact representation of lots of information
  • Usable with a not-so color rich beamer.
  • Fully automatic.

Usage

  1. Install Ruby (both 1.8 or 1.9 should work).
  2. Download svn-shortlog.rb.
  3. Open svn-shortlog.rb with your favourite text editor, and configure the config section according to your needs.
  4. Doubleclick svn-shortlog.rb
  5. Open the generated changelog_....html file with your favourite browser.

Sample Output

Here is a sample output of one month of boost commits into trunk, taken from the public repository. The output is quite information dense, a quick description is in the screenshot:

All commits are structured by user, then by date. Each commit is on one line. You can click each line to see the full information related to a commit.

Issues

Ideas, suggestions, problems? Please post them as a comment here, at the bug tracker.

Credits

This tool is based on the idea from my colleague Christoph Heindl and inspired by Linus’ Kernel shortlog and Gmail.

How To: Download Any Flash Video with flashrip in Ubuntu

Downloading flash videos in Linux was already not too difficult, but thanks to flashrip, it has gotten very easy. Here is a little demo how it works:



Once installed, you basically use one click to get a video preview and then a prompt with the filename to save the file. The script works by looking into the newest flash files in your /tmp folder, and creates a hardlink to the save destination. When the video has fully loaded, you can close the browser window. The temp file will get deleted, and the linked copy will remain.

Installing flashrip

Open a terminal like gnome-terminal or konsole, and run these commands:

wget http://martin.ankerl.com/wp-content/uploads/2009/11/flashrip.sh
chmod 755 flashrip.sh
sudo mv flashrip.sh /usr/local/bin

Now all thats left to do is to create a link in your gnome panel for ease of use: Right click the gnome panel, “Add to panel…”, choose “Custom Application Launcher…”. Choose a proper name, and a command like this:

/usr/local/bin/flashrip.sh /home/manker/Videos

For the command, replace the second parameter with the default location where you want to save the ripped videos (you have to use the full path here!)

I have tested this in Ubuntu, but it should work on any linux where gnome is installed.

Have fun!

Beautiful Font Hinting in Ubuntu 8.10 and 9.04

Even though I have an LCD monitor, I always have the subpixel hinting switched off because it is just painfully ugly to my eyes. Even when hinting is switched to maximum, the fonts are quite blurry (if you don’t believe me, type xmag and take a screenshot of your font. You can see red and blue linese everywhere). My eyes hurt when I see this.

Thanks to Johan Kivinemi I have just found out how to bring back the excellent legacy subpixel hinting engine. This has a much more crisp hinting, and uses subpixels only where it really is an improvement:

Just open these files in your home directory, and copy the content into them:

~/.fonts.conf

<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
  <match target="font">
    <edit name="antialias" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="hinting" mode="assign">
      <bool>true</bool>
    </edit>
    <edit name="hintstyle" mode="assign">
      <const>hintfull</const>
    </edit>
    <edit name="lcdfilter" mode="assign">
      <const>lcdlegacy</const>
    </edit>
    <edit name="rgba" mode="assign">
      <const>rgb</const>
    </edit>
  </match>
</fontconfig>

~/.Xresources

Xft.antialias:  true
Xft.hinting:    true
Xft.hintstyle:  hintfull
Xft.lcdfilter:  lcdlegacy
Xft.rgba:       rgb

This should work in Ubuntu 8.04, 8.10, and 9.04 too, and makes all fonts much more crisp. Of course, your mileage may vary.

UPDATE: Comparison Screenshots

As promised on reddit, I got back from an awesome snowboard trip so I am able to put up extensive comparison screenshots of the two subpixel hinting engines. Move your mouse over the following images to see the differences. Watch especially out for letters like “m” where the spacing between the lines is very small. You might have to wait a bit for the image to load.

I have used all of the most important fonts that I usually use, and just for fun I have added “Dijkstra”, which just looks cool.

Sans Fonts

Mouse to see the same fonts with the legacy hinter.

 

Mono Fonts

Mouse to see the same fonts with the legacy hinter.

 

Zoomed Comparison Screenhots

Here is an excerpt with 400% magnifications. Mouse over the pictures to see the legacy hinter.

Zoomed Sans

 

Zoomed Mono

 

Amazing Caching Proxy in Java

Use Case

Imagine you have some Java code that does lots and lots of computation. All the time intensive calculations is performed by the class SlowCalculator which implements the interface Calculator:

public static interface Calculator {
    public String calculate(int a, String b);
}

public static void main(String[] args) {
    Calculator c = new SlowCalculator();
    // call c.calculate() a lot of times here...
}

You notice that calculate() is often called with the same parameters which lead to the exact same result (SlowCalculator is stateless). This means it is possible to cache values so there’s no need to recompute. Using the generic CachingProxy™ described below, you can create a cached proxy for any class with just one single line of code:

// ...

public static void main(String[] args) {
    Calculator c = new SlowCalculator();
    c = CachedProxy.create(Calculator.class, c);
    // call c.calculate() a lot of times here...
}

That’s it, and the application is blazingly fast again.

UPDATE: Support for null values, transparently handles exceptions, better hash, nullpointer-bugfix.

UPDATE: Here is an article “Memoization in Java Using Dynamic Proxy Classes” that does (almost) exactly the same as this code.

Continue reading

Human Compact Themes (for Ubuntu 8.10)

This is a new release of the compact theme, based on the original Ubuntu 8.10 (Intrepid) theme. It was created by Jan Suhr almost a month ago, based on my little howto.

I have now two versions of the theme: one with normal icon sizes, and one with the smaller 16×16 icons for even more compactness. Here is a comparison animation of the standard Human theme vs. the compact theme:



You can download the themes here:

Download and Installation

  1. Save the theme to your computer.
  2. Open the gnome’s appearence dialog with System > Preferences > Appearance.
  3. Drag and drop the downloaded file into the Theme tab of the appearance dialog. If you get an error message “Can’t move directory over directory”, you have already installed a theme with the same name. To be able to reinstall it, remove the directory ~/.themes/Human Compact or ~/.themes/Human Compact Small Icons.
  4. Choose “Apply new theme” in the popup dialog.

Most changes will occur immediately, but for e.g. the icon sizes it is best to log out and log in again. When you change the theme, you can get the Human Compact theme back by clicking on Customize, and then selecting Human Compact.

Any question, praise or flames? please post them!

Install for root (e.g. Synaptic)

Some readers asked how to get this to work for applications that run as root (e.g. synaptic), so here it is: simply copy the copy the theme file into the root’s home directory, like this (exchange username with your own name):

sudo cp /home/username/.themes/Human\ Compact/gtk-2.0/gtkrc /root/.gtkrc-2.0

Afterwards synaptic uses the human compact theme.

Older Themes

Here is some information about the original compact themes I have created: