Swirly Mein Kopf

Tuesday, March 2. 2010

Talking at CeBIT tomorrow

Digital World

Today, I arrived at the CeBIT conference in Hannover, and had a first look around. I find trade fairs like that quickly boring, and I was glad to meet some some other Debian folk and listen to some of the talks at the CeBIT Open Source Forum in hall 2, including tolimar’s talk about Debian GNU/kFreeBSD.

Tomorrow (Wednesday), I will talk at the same place at 13:45, explaining some basic stuff about patches and bug tracker. The target audience are users of Free Software who modify it for their private or company-wide use and would like to see their changes included in the official project. There will be a live stream of the talk, which I am officially holding as an employee of the ITOMIG GmbH.

Monday, March 1. 2010

Teeth fashion

Has anyone ever considered wearing his teeth consistent with the rest of ones cloths?

Sunday, February 28. 2010

Exploiting sharing in arbtt

Haskell

My automatic rule-based time tracker (arbtt), which is written in Haskell, collects every minute a data sample consisting mainly of the list of currently open windows (window title and program name). Naturally, this log grows rather large. Since October of last year, I collected 70,000 samples. I already went from a text-based file format to a binary format using Data.Binary, which gave a big performance boost.

But by now, I was afraid that this is not enough. My log file is now 30MB large. Looking at the memory graph of gnome-panel, it is taking up more than half of my memory. When running arbtt-stats, the Haskell run time system reports 569 MB total memory in use and the command finishes after 28.5 seconds.

Naturally, the log file is highly redundant: Compressing it with bzip2 shrinks it to 1.6MB. But as I would like to preserve the ability to just append samples at the end, without having to read the file, I chose not just to add bzip2 or gzip compression. Rather, I am now exploiting a very obvious redundancy: Two adjacent samples usually list exactly the same windows, and a focus change only changes a flag. So now, when storing a string that is part of a sample, it will check if this string was already present in the previous sample and, in this case, just store the number of that string (one byte). Only if the string was not present it will write a zero byte and then the string. When reading the sample, the process is reversed.

This greatly reduces the file size: It is down to 6.2MB. It also improves the memory consumption, due to Haskell’s abilities with regard to sharing: When a reference to a string in a previous sample is read, then only one instance of this string is in memory, even if it occurs several times in the log. This brings the memory consumption down to 264 MB and the runtime to 17 seconds.

I released the changes as version 0.4.5.1 to Hackage, Debian and as a Windows installer. The log file is not automatically converted, but new samples will be written in the compressed format. If you want to convert your whole file, you have to stop arbtt-capture, run arbtt-recover, and then move the hopefully noticeable smaller ~/.arbtt/capture.log.recovered  to ~/.arbtt/capture.log.

The required code changes were not too big. I somewhat isolated the relevant code in the Data.Binary.StringRef module. Unfortunately, I have to use OverlappingInstances to be able to provide the special instance for String – is there a cleaner way (besides the trick used for the Show class)?

Thursday, February 11. 2010

Diploma Thesis Finished

Earlier today, I went to a local copy shop and had my diploma thesis printed. This afternoon, I will hand it in. The title is “Loop subgroups of Fr and the images of their stabilizer subgroups in GLr(ℤ)” and discusses a group-theoretical result. I assume that very few readers care about the content of the thesis, but maybe some are interested in a few assorted LaTeX hints. I’m also publishing the full TeX source code, maybe someone can make use of it.

Less chatty varioref

I’m using the varioref package, in conjunction with the cleveref package. This provides a command \vref{fig:S3S4l} which will expand to, for example, to “Figure 1 on page 11”. But if the referenced figure is actually on the current page, the next page, the previous page or the facing page (in two-side layouts), it will say so: “Figure 1 on this page.”

This is very nice, but I assume that the reader of my thesis is able to find Figure 1 when it is visible, i.e. on the current or facing page. One can remove the referencing texts with the commands \def\reftextfaceafter{}, \def\reftextfacebefore{} and \def\reftextcurrent{}. But because varioref puts a space between “Figure 1” and this text, we will get a superfluous space – even before punctuation.

The remedy is the command \unskip, which removes this space again. So I use in my preamble:

\def\reftextfaceafter {\unskip}%
\def\reftextfacebefore{\unskip}%
\def\reftextcurrent   {\unskip}%

Palatino and extra leading

I chose the Palatino font for my thesis, using the mathpazo package. Various sources (such as the KOMA-Script manual) suggest to use 5% extra leading:

\linespread{1.05}

Counting figures independently from chapters

I don’t have too many figures and tables in my thesis, and I want them to be numbered simple 1, 2, ... By default, LaTeX would say 1.1, 1.2, 2.1, ... This can be fixed using the remreset package and these commands:

\makeatletter
\@removefromreset{figure}{chapter}
\renewcommand{\thefigure}{\arabic{figure}}
\@removefromreset{table}{chapter}
\renewcommand{\thetable}{\arabic{table}}
\makeatother

No widows and club lines

LaTeX already avoids these, but I wanted to get rid of them completely. This can be done with:

% Disable single lines at the start of a paragraph (Schusterjungen)
\clubpenalty = 10000
% Disable single lines at the end of a paragraph (Hurenkinder)
\widowpenalty = 10000 \displaywidowpenalty = 1000

Struck table lines

I had to typeset tables with some lines struck, and I could not find a ready command for that. I used the following definition, based on the code for \hline. Note that it probably does not adjust well to other font sizes and needs to be adjusted manually:

\makeatletter
\def\stline{%
  \noalign{\vskip-.7em\vskip-\arrayrulewidth\hrule \@height \arrayrulewidth\vskip.7em}}
\makeatother

Title page in one-sided layout

According to the KOMA manual, the title page as set by LaTeX is not meant to be the cover of a publication, and therefore has to be set with the margins of a right page – i.e. a larger right margin and a smaller left margin. But when printing cheaply, one often just put a transparent sheet on top of the print, so the title page is the cover. You can convince KOMA that you are right by using

\KOMAoptions{twoside=false}
\begin{titlepage}
...
\end{titlepage}
\KOMAoptions{twoside=true}

Not flushing the page for chapter heads

LaTeX would put the list of algorithms on a new right page. I found this a waste of paper for my few algorithms, and preferred to put the list right after the table of contents. You can override the LaTeX behavior using:

\tableofcontents
{
\let\cleardoublepage\relax  % book
\let\clearpage\relax        % report
\let\chapter\section
\listofalgorithms
}

This code also reduces the size of the heading to that of a section. The same trick also works with \chapter.

Math in headings vs. PDF bookmarks

LaTeX with the hyperref package creates nice PDF bookmarks from your chapter and section titles. Unfortunately, PDF bookmark names can only be plain strings, while the titles in the document might contain some math symbols. You can make both happy with \texorpdfstring:

\section{Stabilizer subgroups in \texorpdfstring{$\GL_r(\Z/2\Z)$}{GL\_r(Z/2Z)}}

Setting lines for the signature

The diploma thesis contains a small note which I have to sign, saying that I created it on my own etc. Below that, I put two labeled lines for date and signature, using the tabbing environment:

\begin{tabbing}
\rule{4cm}{.4pt}\hspace{1cm} \= \rule{7cm}{.4pt} \\
Ort, Datum \> Unterschrift
\end{tabbing}

Sunday, February 7. 2010

If I were a caricaturist

Politik

I’d draw a caricature involving a Toyota car, representing capitalism, with a stuck gas petal and Barack Obama trying to fix it. But as I cannot draw very well, especially recognizable people, I created this collage:

The photo of Obama was created by Beth Rankin.

Thursday, February 4. 2010

FontForge-Article in the German Linux-Magazin

Digital World

Yesterday, I found the 3/10-issue of the German “Linux-Magazin” in my mailbox. (I don’t dare to call it the March issue – they are a bit off schedule...) On page 62, you can find my 3½ page article about creating a symbol font with FontForge. I briefly covered the topic on my blog and later thought that it would made a nice article, even though I’m not an expert on this area. The article will be freely available in about three years.This is already my third publication, after my article on the Cross-Site-Authentication attack that was published in the same magazine (circulation ~63.000) and in its international counterpart in 2005 and my recent article in the “freeX” magazine (circulation ~15.000). Looks like I’ll have to add a  “Publications” section to my website soon...

Saturday, January 30. 2010

pidgin-blinklight goes subliminal

Digital World

A long while ago I wrote a plugin for gaim called gaim-thinklight that blinks ones ThinkPad ThinkLight when a new message arrives. By now it is called pidgin-blinklight and supports some other hardware as well, but has not changed since over a year. Today, I implemented a new feature, and I’m curious if it will actually work:

Until now, the blink pattern was hardcoded: ON, wait 150ms, OFF, wait 125ms, ON, wait 150ms, OFF. Since version 0.11, pidgin-blinklight will calculate these three delay times based on the contacts login name. So different contacts will have very slightly different blinking patterns. The idea is that, after a while, you start to recognize your frequent buddies already by the blinking. The wait times are from the range from 50ms to 250ms, I hope that range works well.

Users of Debian unstable will get the new version automatically. If you want to compile pidgin-blinklight from source, you will have to grab it from the debian ftp server. The source is in the pidgin-blinklight Darcs repository.

Monday, January 25. 2010

Serna XML editor uploaded to Debian

Debian

The XML-Editor Serna by Syntext has been published as Free Software a few months ago. This was very good news, because there was a lack of a good free XML editors with a good graphical view on DocBook documents, which I needed to recommend to users of zpub. Therefore, I investigated packaging Serna for Debian. I had to patch a few things to make it compile on and64 and to use components shipped by Debian where possible. Today, I could finally close the RFP bug filed by W. Martin Borgert, as the serna package was accepted by the ftp-masters. The first bug (SEGFAULT on startup on lenny) is already filed. I hope this is a good sign, as it shows that there is interest in the package.

For my packaging workflow, I used git-svn to import the upstream SVN branch into a git repository. I then use git-dpm by Bernhard R. Link to manage my changes as patches in the new 3.0 (quilt) debian source package. I must say that I prefer this approach to git-buildpackage, as there is only one git branch to publish. I hope that Bernhard uploads git-dpm to Debian soon.

Serna is quite a big software project and uses stuff that I know little about (Qt, C++ with python interaction etc.). Also, the package currently bundles the DITA-OT package, which should rather be packaged separately. Therefore, I’d be glad if co-maintainers would join the effort.

Saturday, January 9. 2010

DebConf mugshots view statistics

Debian

In a comment to my previous blog post, I linked to the DebConf photo gallery page with the DebConf8 mugshots. Felix Brandt, a friend of mine, noticed the per-picture view statistics there and plotted them, differentiating between male and female. He finds that the number of views on an image gives a fairly good indication of the sex (or gender?) of the person in question:

The most notable exception is the image of bubulle. He does not even look feminine. Maybe it’s because he’s like a mother to us Debianers, always kind and always helpful? :-)

This observation fits my experience when I created a top-100-statistic of individual picture page views of my personal gallery: I got a collection of pretty much all pictures of girls in bikinis, lying at some beach, across the various pages and years, and hardly any other picture. I won’t post these top-100 here, as I don’t want to additionally increase the effect...

Thursday, January 7. 2010

screen-message ported to Windows

Digital World

Over the holidays I investigated how to cross-compile GTK applications for Windows, and managed to port screen-message. I also created an Inno Setup based installer for it that includes the necessary GTK DLLs. You can grab it from the screen-message homepage. The installer optionally binds screen-messages to the key combination Alt-Ctrl-S.

I would have published the binary much earlier if starting the application had not always given the error message

The application failed to initialize properly (0xc000007b). Click on OK to terminate the application.

on Windows, while it worked fine under WINE. It took me a while to find the cause, as there seems to be only one mention of it in the internet: One must not use MinGW’s strip.exe utility on DLLs not created with MinGW, it seems.

I added a “make installer” target to the Makefile to create the installer. If you are curious about how that works, have a look at the source.


Friday, December 25. 2009

Building arbtt for Windows

Haskell

A friend of mine is interested in trying out the Automatic Rule Based Time-Tracker arbtt which I programmed. Unfortunately, he is using Windows and up to now, arbtt only worked on Linux. But as I wanted to check out Haskell’s cross-platform abilities for a while, this was a good opportunity to do so. I don’t have Windows installed myself (and did not plan to do so), so I did all this under WINE, the Windows compatibility layer, which works very well: It takes only a few minutes to install the Haskell Platform for Windows and then I was able to run wine ghc --make and cabal install.

I played around with some simple programs and was surprised by these timings:

$ rm *.o *.hi; ghc --make fourfours.hs ; time ./fourfours > /dev/null
[1 of 1] Compiling Main             ( fourfours.hs, fourfours.o )
Linking fourfours ...

real	0m1.909s
user	0m1.692s
sys	0m0.208s
$ rm *.o *.hi; wine ghc --make fourfours.hs ; time wine ./fourfours.exe > /dev/null
[1 of 1] Compiling Main             ( fourfours.hs, fourfours.o )
Linking fourfours.exe ...

real	0m1.631s
user	0m1.376s
sys	0m0.092s

So it is faster to run a compiled Haskell program on top of a compatibility layer than directly on Linux! The world is in order again, though, if optimization is enabled:

$ rm *.o *.hi; ghc -O --make fourfours.hs ; time ./fourfours > /dev/null
[1 of 1] Compiling Main             ( fourfours.hs, fourfours.o )
Linking fourfours ...

real	0m0.981s
user	0m0.876s
sys	0m0.108s
$ rm *.o *.hi; wine ghc -O --make fourfours.hs ; time wine ./fourfours.exe > /dev/null
[1 of 1] Compiling Main             ( fourfours.hs, fourfours.o )
Linking fourfours.exe ...

real	0m1.270s
user	0m1.036s
sys	0m0.072s

Funny. Anyways, I wanted to port arbtt. The only platform-dependent part is the capture module that gathers the list of open Windows. The Win32 package that comes with the Haskell Platform did not cover all the functions needed to do so, but creating additional function bindings is really easy with Haskell, as can be seen in the Graphics.Win32.Window.Extra module. I also replaced the locking code that prevents two instances of arbtt-capture to run at the same time by equivalent code using Windows mutexes (module System.Win32.Mutex). With these small changes and some CPP conditionals to make the code compile for either platform, the porting was done! Even accessing the files in ~/.arbtt works correctly on Windows, where it will look in the Application Data folder, without changing the code, thanks to System.Directory.getAppUserDataDirectory.

But Windows users won’t like compiling software on their own. They won’t even like installing software by copying various files to certain directories. Therefore, I also had to create a Windows Installer. I picked Inno Setup, because it’s Free Software and seems to be simpler than NSIS. The installer puts the compiled .exe files, the example categorize.cfg and the HTML documentation in the right spot, adds icons to the Start Menu (“Edit categorize.cfg”, which fires up wordpad, a link to the documentation and the uninstaller), puts arbtt-capture in the Autorun folder, puts the path to arbtt-stats in the PATH variable and starts arbtt-capture at the end (the last three points being optional). Of course it undoes all this when removing the program again. I integrated the call to the Inno Setup installer into the usual ./Setup build process of Haskell packages. Some more details of how to create the Windows installer are mentioned in the README file.

Now all this does not magically add a graphical user interface to arbtt, so users will still have to work with arbtt-stats on the command line – even on Windows. If this is not a problem for you then you can fetch the latest installer from the arbtt homepage. And if you happen to become a serious user of arbtt on Windows and want to help maintaining the Windows port, I’ll gladly share some responsibilities.

I’m very satisfied with the process and the result and I’m happy to know that I can offer some of my programs also to Windows users in the future.It is also a big plus for Haskell – with Python, shipping a program for Windows users is likely more difficult. The next step will be providing gtk-based graphical Haskell applications for Windows, including a nice installer that ideally includes all dependencies (gtk etc.).

Wednesday, December 9. 2009

Packaged unicode-screensaver properly

Digital World

Three years ago, while I was in Ghana, I wrote a small screensaver that displays a randomly picked unicode character full-screen. I like it because there is a huge bunch of very weird characters and signs in the unicode standard. It also prints the unicode codepoint and character name.

Now I finally got around to properly package it: Created a small homepage, a source tarball with (hopefully) proper autotool files, all managed in a git repository (also on gitorious), complete with manpage, README and other additional files. I’m also going to upload the package to Debian, so you can just do apt-get install unicode-screensaver as soon as it gets accepted.

It can probably not enter the official xscreensaver distribution as it adds dependencies on the fontconfig and freetype libraries.

Thursday, December 3. 2009

Second Post!

Digital World

Yesterday, the German magazine freeX published its December issue. It includes an three-page article about  vbox-sync, written by me, that is even mentioned on the cover page. After my article on the Cross-Site-Authentication attack that was published in the German Linux-Magazin and the international Linux Magazine in 2005, this is my second publication.

Vbox-sync is a tool to distribute VirtualBox images via apt-get that Phil Kern and I wrote as part of our work for itomig.de, a German Free Software consulting company, and the LiMux project. I also held a talk about it at the Debian Conference in Extremadura, Spain, in 2009.

Friday, November 27. 2009

screen-message now in an online version

Digital World

Folllowing an idea by Kai Hendry, I re-implemented my Linux application screen-message, which does nothing but display a piece of text that you enter as large as possible, in HTML. So whenever you are in need of screen-message, but don’t have it installed at the moment, put your browser into fullscreen mode, go to

http://sm.nomeata.de/

and type away.

I only tested it with the web browser galeon, so I expect it to work with Firefox and related browsers. If it does not work with Internet Explorer, I can’t help it – but patches are welcome. The file is stored in the screen-message Darcs repository at http://darcs.nomeata.de/screen-message.upstream.

PS: If anyone wants to donate a shorter domain for this, you are welcome. But I guess all good domains with “sm” in them are taken...

Monday, November 23. 2009

arbtt now in Debian

Digital World

The Automatic Rule Based Time Tracker that I have created some weeks ago is now available in Debian unstable, so if if you were reluctant to use it because you did not want to figure out how to compile the Haskell code, you can just do apt-get install arbtt.

Although it’s such a young project, it already has a fork: Andreas Klöckner was very impatient with a feature request (sensible merging of logs from different hosts), so we went ahead and re-implemented arbtt in python, named whatup. Although I prefer contributions to arbtt, it shows that the principle of arbtt is useful. And I won’t be shy to copy nice ideas from him, as well :-)

(Page 1 of 15, totaling 214 entries) » next page
Nach oben