Jonasfj.dk/Blog
A blog by Jonas Finnemann Jensen


March 19, 2011
Version 0.10 of zbar-sharp is out…
Filed under: Computer,English,zbar-sharp by jonasfj at 9:50 am

Being slightly bored with school work I decided to take day off and work on zbar-sharp, and a few minutes ago I tagged a new release of zbar-sharp. These improvements have been underway for quite a while, and many of them have been available in the repository on github for a long time. And if you plan to use zbar-sharp I’ll recommend that you checkout the git repository once in a while.

The highlights of this release are:

  • ZBar.Image: Constructor for loading from System.Drawing.Image (e.g. Bitmap import)
  • ZBar.Image: Fix for nasty memory management issue in ZBar.Image.Data
  • ZBar.Image: Convenience function for FourCC codes.
  • ZBar.Symbol: Support for QR-codes (thanks to ZBar)
  • GtkZBar.Scanner: Support for rotation (Special thanks to Patrick McEvoy)
  • ZBar: Version by (Special thanks to Brandon McCaig)
  • Tests: Unit tests to test zbar-sharp and ZBar.
  • Improved and reorganized examples…

In particular support for initializing ZBar.Image from an instance of System.Drawing.Image is very nice. Notice that System.Drawing.Bitmap is a subclass of System.Drawing.Image, so this constructor allows you to load images from files into a ZBar.Image that can be scanned.

However, this feature would have been fairly unstable without a fix for the memory management issue in ZBar.Image.Data, which previously caused applications to crash at random. A thanks to the nameless commentor by the name thedarkking, who’s comment finally gave me a clue as to where the bug was.

By the way, if you have any comments or questions don’t be afraid to leave a comment.You’re also welcome to use the issue reporting system at github to report bugs or feature requests.If you wish to contribute, just fork the project on github and push your code.



December 15, 2010
A Project on Optimal Triangulation of Bayesian Networks
Filed under: Computer,English,School by jonasfj at 11:28 am

This semester we did a project in machine intelligence, however, as I find probability calculus and Bayesian networks utterly boring I convinced my group to do a project about triangulation of Bayesian networks. A triangulation of an undirected graph G, is a set of edges called fill-ins, such that G with these fill-ins added is a chordal graph (a graph that doesn’t have a chord-less cycle of more than 3 node). Triangulation is of graphs is used for many purposes, and with difference optimality criteria, such as minimum fill-ins, minimum clique size (tree width) and minimum maximal clique sum (optimal table size), as is relevant for Bayesian networks.

The problem of finding an optimal triangulation is NP-Hard (with respect to mentioned optimality criteria). And since there’s many fairly good simple greedy heuristics, it can be argued that algorithms for optimal triangulation of Bayesian networks are uninteresting. However, to check of a greedy heuristic is good, optimal triangulations are needed. It’s also possible that optimal triangulation might be worthwhile if  computed offline, especially if the application needs to process a lot of data or work on an embedded platform. Or whatever, optimality is always slightly interesting, if not for anything useful, than for the fun of finding them…

In this project we implemented some simple greedy triangulation heuristics, compared their result to the optimal solutions. But most interesting is probably our work on search algorithms for optimal triangulations of Bayesian networks. We based our work on two articles by Thorsten J. Ottosen and Finn V. Jensen, who does a best or depth first search in the space of all elimination orders. As far as we’re aware these articles are the only ones that proposes algorithms for optimal triangulation of  Bayesian networks.

In this project we’ve created good improvements to the optimal triangulation algorithms. We reduce the search space by excluding elimination orders resulting in the same triangulation. Our improvements provides around 5x speedup on sparse graphs, and can be applied to regardless of the optimality criterion. I think this project was really cool, because I got to play with something that was new and fairly untouched. And the fact that I managed to propose a a few interesting improvements didn’t make it any less cool 🙂

Report and source code:



October 24, 2010
Back from openSUSE conference 2010
Filed under: Computer,English,LibreOffice by jonasfj at 2:01 pm

So after a 9 hours nap on the City Night Line I woke up on my way home, after a few days in Nuremberg where I attended openSUSE Conference 2010. Where I, apart from attending some interesting talks, met some of the cool LibreOffice hackers…

As GSoC student with Go-OO (now LibreOffice) I was invited to say a few words about my GSoC project. I started by defining what visual formula editing is. Then I scratched some of the rather unpleasant problems I encountered when adding this capability to LibreOffice Math.

I also demonstrated the hack, and used a small crash-bug to show that it wasn’t ready for being shipped yet. However, despite the crash-bug, Michael Meeks suggested that we tried to put it in as an experimental feature, that could be enabled at runtime. Whether or not it’s going to make the 3.3 release, time will tell. In any event there’s still a rather long list of things to do before this hack can be considered stable.



August 24, 2010
Turning OpenOffice Math into a visual formula editor
Filed under: English,LibreOffice,Linux by jonasfj at 2:40 am

I’ve spend most my summer working on my GSoC project, which was to create a visual formula editor for OpenOffice Math. Currently, formulas are entered in OpenOffice Math using a plaintext command language, this can be efficent and easy for power users, however, it’s an absolute show stopper for most casual users. So I’ve spend my summer writing a visual formula editor for OpenOffice Math, you can see demonstration here:

I participated in GSoC for Go OpenOffice, which is a project that maintains a set of patches on top of OpenOffice. Go OpenOffice is the OpenOffice version distributed with OpenSuSE, Ubuntu and other distros, it is allegedly a lot better than the official OpenOffice release. And also available for Windows.

Hacking OpenOffice have been a very exciting experience. I haven’t worked on a project so large and complex before. It easily takes 2 hours to build OpenOffice and the sources and binaries fills about 13 GiB. Luckily I didn’t have to rebuild everytime I had to test something.

The visual formula editor, see video above, is not production ready yet. That is it needs extensive testing and a few extra features… However, I plan to keep working on it. You can read more about it’s features and current status here.

I don’t think I’ll keep updating that wiki page, but rather post some updates here once in a while. If you are eager to help test this feature when it comes that far, feel free to leave a comment with your email…



July 3, 2010
Hjemme fra børnesommerlejr 2010
Filed under: Dansk,Personal by jonasfj at 8:46 am

Så har jeg endeligt fået sovet ud efter endnu en hård og fantastisk børnesommerlejr… Den sidste uge har jeg været leder for nogle 5-6 klasses piger på Kfum-Kfuk distrikt Midtjyllands børnesommerlejr 2010. Og igen var der tale om en fed lejr masser af sjov, vand og sol (måske i virkeligheden for meget for en nørd som mig). I år måtte jeg så også se børn der var mine unger for 3 år siden komme med som ungledere, den slags er faktisk lidt foruroligende. Men efter grundig opgørelse, for ja jeg kunne faktisk ikke huske det, så har jeg været med på børnesommerlejr som leder 5 (+1 en gang som ungleder). Når, men jeg har ikke tid til at reflektere over at blive gammel, det kan jeg gøre når jeg bliver pensioneret :).

Temaet for årets børnesommerlejr var cirkus. Dette skulle selvfølgelige reflekteres i hiken, hvor vi bl.a. havde kapløb i klovne sko, flødeskums kast (på leder) og tiger tæmning som poster. Anders og jeg var posteret ved tiger tæmnings posten, her skiftedes vi til at kravle rundt, skærer tænder og skrige os hæse, mens ungerne skulle pacificeres os med pakketape. Nedenunder ses, en farlig tiger (mig), indfanget af 8 friske tiger tæmnings aspiranter :).

Til trods for et par dråber regn forløb hiken helt godt… Vi overlevede alle sammen, selvom vi savnede vores har-alt-mulig-i-traileren-mand Jens Christian, det forlyder dog at han kommer igen næste år :). Udover et par dråber på hiken fik vi ikke noget regn på børnesommerlejr. Men det betyder jo ikke at man kan forblive tør, når ungerne får lov at give en leder vand til lejrbål hvis de har det pæneste telt. Således gik det altså til at jeg ikke kunne komme til lejrbål uden at blive våd…



June 25, 2010
groo, a GRim Object Oriented programming language
Filed under: Computer,English,School by jonasfj at 1:46 am

Hmm… Not the official title of my fourth semester project at Aalborg University. For which I just got an A… and have been thinking about publishing since I handed it in.

This semester my group have designed and implemented a small statically typed object oriented language slightly inspired by Python. We wrote our own lexer and parser generator in Python, and implemented the compiler in C++. And just for the record we implemented the DFA of the lexer and PDA of the parser using goto’s, inspired by re2c, this was quite fun and the result very fast.

The language is called groo (that was the best name we could come up with), it compiles into gril (groo intermediate language) which in turn run on VROOM (groo virtual machine) where memory is managed by MOM (Mark-sweep Object Manager). Whilst this isn’t the best project yet, and all the acronyms doesn’t make much sens, I really like to say that when we need to release memory we call MOM to clean up 🙂
(I appoligies for my crazy sens of humor).

I don’t think the project is of much use to anybody else… But if you want to play with simple, well documented compiler in C++, this might be it… Also the parser generator is AFAIK pretty unique, haven’t see anybody else implement a parser using goto’s… Anyway the project report and groo compiler source code is all in English and available here:



January 31, 2010
zbar-sharp, now bugfixed and pushed to github
Filed under: Computer,English,zbar-sharp by jonasfj at 8:02 am

I’ve long been wanting to play with Git, but have either missed the time or the reason… Anyway, as I discovered a minor bug in the zbar-sharp bindings I recently released… I figured this might just be the kind of project I could push to github, and either forget or bugfix depending on what mood I’m in when a bug is discovered… 🙂
So I’ve created a github repository for zbar-sharp, to which I’ve published a minor bugfix… I’ve also managed to publish the documentation there… it was a bit tricky, because GitHub only wants to serve HTML files if they’re in a special branch… Nevertheless I succeeded… And zbar-sharp can now be found here:

By the way did I mention, git is really nice… I just had a little fun making a bugfix branch and merging it…



January 17, 2010
Design patterns
Filed under: Computer,English by jonasfj at 3:01 am

I recently finished reading “Design Patterns: Elements of Reusable Object-Oriented Software” and thought I’d share a word about this book. Not that there’s much to say, it’s absolutely a classic, and definitely worth a read…

I’ve found the patterns applicable many places, and recently had the privilege of using one in my C# programming exam. I previous mentioned this book when I discussed “Framework Design Guidelines“, which I wasn’t too happy about at the time… However, “Design Patterns” is definitely the book for writing reusable code, whereas “Framework Design Guidelines” is more concerned with the usability of the APIs.

Anyway, that was a word on “Design Patterns”, definitely worth a read…



December 30, 2009
ZBar bindings for C#
Filed under: Computer,English,zbar-sharp by jonasfj at 6:58 am

gtkzbar-sharp-exampleAs part of the food management system my group made this semester, we wrote bindings for ZBar and based on those a bar scanning widget for Gtk#. Anyway, I figured it might be useful somebody else, so I’ve been using a few days cleaning up the ZBar bindings, extracting the Gtk# widget from our UI-mess and writing a simple example of how to use it.

The result is bindings for a subset of ZBar and a Gtk# bar scanning widget. I don’t intend to maintain the source, but if you find any bugs etc. or wish to start a project for the bindings, please leave a comment…

The example application using the bar code scanning widget can be seen on to right. Note: this was a really lousy webcam :). The check-mark appears when a bar code have been recognized and then fades away.

In Foodolini we used HAL to detect webcams as they were plugged, however, having heard that Ubuntu will be deprecating HAL, I didn’t care to clean up the source for this feature. If you interested it can be found in the source for Foodolini. And if anybody should happen to know how to detect webcams, distro independently, without HAL, please leave a comment…



December 20, 2009
Foodolini, A food management system
Filed under: English,School by jonasfj at 11:51 am

Now I’m done with my third semester at Aalborg University. The focus on this semester was software engineering with the Object-Oriented Analysis (OOA&D). Personally I found this subject rather boring, I guess making pretty diagrams trying explain technical stuff in a manner “mortals” can understand maybe utterly uninteresting 🙂

Anyway, for this project we analyzed, designed and implemented system for managing recipes and food in a common household. The system was suppose to compute nutritional intake and manage diets and exercises as well, however, these features were never fully designed and implemented. Nevertheless, it uses the USDA National Nutrient Database for Standard Reference, to find the nutritional content of various groceries.

The system is called Foodolini and was implemented in C# on Mono using Gtk#, but also runs on .Net and Gtk# for .Net. Foodolini uses Sqlite as database, and we wrote a simple and neat ORM tool, inspired by SubSonic‘s SimpleRepository. However, the most interesting feature in my opinion is the bar code scanner used when registering groceries in the system. It’s implemented using a ZBar which captures and scans images from a webcam. I’ll be release C# bindings for ZBar and a Gtk# widget in an upcoming blog post, when I’ve cleaned it up a bit…

  • Foodolini 1.0.0 (sources, binaries and documentation)
  • Report (documenting the analysis, design and implementation of Foodolini)


« Newer PostsOlder Posts »