Loading....
Recent Article links:

Archive for July, 2004

It’s done!

[Horde logo] In 5 hours after releasing my revised patch, it was accepted and committed to the Horde CVS!

Well, giving me the bounty money took the GNOME people exactly four months, so let’s see if the Horde people are faster :)

Update:I sent my Paypal account name to the Horde people on 12:11, and got the money on my account at 16:07. Four hours sure is a hell of a lot faster than four months! Thanks, guys!

.Net bindings for Lovecalc version 1.0 released!

[Heart] I have already implemented a .Net version of Lovecalc, but I figured it would be a nice test to see whether I could get .Net code to run the native C version of Lovecalc. So just like I did for Perl, I used Mono and C# to create .Net bindings for Lovecalc. Actually, the code is a drop-in replacement for the .Net lovecalc library, and it works with LovecalcGUI and loves.

Creating .Net bindings for a C library with Mono on Linux is actually quite a snap once you know where to look. The Mono documentation has a document on this, and LinuxGazette has an excellent tutorial. Once you know what you need is called “Platform Invoke”, or “P/Invoke” for short, there are dozens of great articles about it. Basically adding a line like:

[DllImport("liblovecalc")]
static extern int lovecalc(String name1, String name2);

is enough to start running native code from .Net! Really neat. The one thing I encountered though was that you cannot access variables from a C library directly: you’ll need getters and setters. The property concept of C# makes it possible to still use the C variables as C# variables though:

/** Maximum length of calculation string */
public static int maxLength {
        get { return get_max_strlen(); }
        set { set_max_strlen(value); }
}

Really neat! Just run the code while the liblovecalc.so is somewhere in your library path and it all just works! I’m beginning to like C# more and more! Does that make me evil?

Download the .Net bindings for Lovecalc from the project page. And fetch lovecalc 2.2 while you’re at it (this actually contains the bindings as well), because the bindings require this version at least.

Lovecalc for Mono/.Net 1.0 released!

[Heart] I wanted to play around with the new Mono 1.0 release, so I figured I’d port my Lovecalc application to C#, and after a couple of hours of hacking my first C# code, I came up with this result (downloads at the project page. Screenshot:

Yes, I know it’s weak not to fill in actual existing names names :)

Either way, the program has all features of my original Lovecalc written in C. It is split up in three parts: the Lovecalc library, the LovecalcGUI graphical application, and the command line ‘loves’ program. Since I wanted to do some experimenting, it has some important Mono concepts in it, so it can also serve nicely as an example application (just like the original Lovecalc, which was mainly done to experiment with Perl bindings): it was developed using the Monodevelop IDE (project files included), I made my own custom event in the Lovecalc class, it has namespaces, it has a library that is referenced to in other programs, it uses GTK# and, last but not least, it uses an advanced command line argument parser.

This latter feature was actually one of the most difficult things: there does not seem to be a standard popt-like library for .net (and I thought the goal of .net was to provide all basic programming classes one would need). Instead, there are several pet projects that do this, most notably this library from the Code Project, and this project by a Microsft employee. A slightly hacked version of the latter to adapt it more to Unix syntax can be found in the loves package. It does seem to make an easy task pretty difficult, but once it works you can use it without any bother. Strange this kind of thing is not included in the .Net platform by default though.

Kronolith search patches revision 2 released!

[Horde logo] This updated search patch adds support for looking for time ranges as well as date ranges, and as such should qualify for the Horde bounty. Changes compared to revision 1:

  • Fixed bug where next day search would not work for simple search
  • Fixed bug where spurious “\n”’s would be added
  • Added timespan search
  • Now also search in basic mode if query is empty (i.e. return all events)
  • Basic search now defaults to ‘next 24 hour’
  • Removed a debug code

The new patch can be found here. Applies cleanly to current CVS.

Lovecalc in VisualBasic.Net

[Heart] Just for testing purposes, here’s a VisualBasic.net application using Lovecalc:

Module Lovecalc
	Sub Main(Args() as String)
		Dim res as Integer
		if UBound(Args, 1) < 0 or UBound(Args, 1) >= 2 Then
			System.Console.WriteLine("Usage: Love.exe Name1 Name2, or Love.exe histo")
			Exit Sub
		ElseIf UBound(Args, 1) = 0 Then
			res = Lovecalculator.Lovecalc.loveCalc(Args(0))
		Else
			res = Lovecalculator.Lovecalc.loveCalc(Args(0), Args(1))
		End If
		System.Console.WriteLine(res)
	End Sub
End Module

Compilable with Mono’s mbas:

mbas Love.bas -r ./Lovecalc.dll

Even though mbas still is alpha code, simple examples such as this seem to work fine… after I succeeded in surpressing the need to put semicolons after all lines though :)

In related news, creating PHP bindings for Lovecalc seems a lot harder.

Lovecalc 2.2 released!

[Heart] To facilitate the .Net bindings of Lovecalc, today I released version 2.2 of the Lovecalc C library.

This new release adds get and set functions for the configurable parameters, required for the .Net bindings, and the library is now LGPL-licensed to allow non-GPL code to use it. The .Net bindings itself are included as well. Grab it while it’s hot!

Experiences with installing Mono on Mandrake

Since the 1.0 version of Mono, an open-source implementation of Microsoft’s Dotnet platform, was released recently, I figured I should give it a try and educate myself on Dotnet in general. And with Linux.Ars covering the Mono basics this week I finally got to it.

Trouble is, there are no specific packages for Mandrake available. After first trying the Fedora Core 2 packages (those didn’t work on Mandrake 9 due to some kernel function missing in Mandrake), I tried the Suse 9.0 packages, and these worked with both Mandrake 9 and 10. Apart from the wine, xrender, libpixman, perl-XML-NamespaceSupport and perl-XML-SAX packages, that Mandrake has itself, you can just install all Suse packages and things will work nicely. For some reason my Mandrake 10 installation refused to install all packages at the same time without giving an error message, but installing them separately did work (one has to do it with --nodeps though because some packages have other names on Mandrake).

I guess official Mandrake packages of Mono should appear soon, but for now this is a reasonable solution.

Anyway, my first Dotnet results were a port of my Lovecalc program to Dotnet, which can be found here.

Kronolith search patches revision 1 released!

[Horde logo] My latest pet project: writing search support for the Kronolith web-based calendar application. Like the Evolution NNTP patches, I’m doing this in a bounty hunt: the Horde people are awarding $150 for this task.

Anyway, the first revision of the patch is now done and I’m going to submit it to the Kronolith mailing list soon. You can download the code here. This initial version already works pretty well I think, but I have only done an optimized implementation for the SQL backend currently (others will work, but might be a bit slower for particularly large agendas). Also, the current version is a bit of a cut-and-paste operation, though I doubt whether merging it with existing code will make things much cleaner. Also, I might want to make the print version of the thing work in the future.

Update: My announcement posting at the mailing list can be found here.

Where’s Wally?

[Where Finally succeeded in downloading the Rock am Ring video of Muse, so I played a bit of Where’s Wally on it. Since I and Sander were pretty much up front, I guess we should be visible in multiple camera shots, but a quick look revealed one at last.

Todays assignment: Where’s Wally? There’s Wally!

Y4mback 0.1 released!

As a supplement to y4merge, today I release y4mback 0.1. y4mback can be used to stretch YUV4MPEG streams, for example when you have a one-frame YUV4MPEG stream generated by png2yuv, you can let y4mback spit the same frame out 50 times. This is useful if you want to merge a static background (thus the name y4mback) with y4merge.

y4mback can be downloaded from the y4merge pages. Compilation is done in the same way as y4merge.