Tag: programming

Updated Uiml.net homepage

I spent some time yesterday to update the Uiml.net homepage:

New homepage for Uiml.net

We set up a wiki somewhere last year to provide more information about our UIML research. However, since Uiml.net is the main focus of our research efforts, I reorganized the wiki to be more of a homepage for Uiml.net, while still listing our publications.

I am hoping to migrate all the content of the old website (still located at Kris’ homepage) to the wiki soon.

Lately I have been enjoying Launchpad for hosting my projects and Bazaar branches. It has integrated specifications (blueprints), bug tracking, and a forum (answers). I have moved Uiml.net over to Launchpad as well. Launchpad’s integration of Bazaar branches will be useful for managing multiple experimental contributions from myself, Kris or our Bachelor’s or Master’s students.

Finally I’m hoping to put out a more or less stable release of Uiml.net by September. More information can be found at Launchpad.

Announcing PydgetRFID

I just released version 0.1 of PydgetRFID, the Python interface to the Phidgets Inc. RFID kit I blogged about earlier. It’s free software (licensed under the GPL). It wraps libphidgets with ctypes to talk to the hardware.

The software is now more polished and additionally provides a D-Bus service that allows other applications (written in any language with D-Bus bindings) to use the hardware. Currently this means you can connect to the hardware from Python, Ruby, .NET, C, C++, Perl and Pascal!

This DBUS service allows to start and stop reading, and emits a signal whenever a different tag (including the nil value) is read. I modified the original PyGTK GUI to use this daemon for communicating with the hardware. Furthermore, I improved the HAL support so that plugging the device in and out is detected. Unfortunately, the daemon cannot yet handle this though. That’s for a next release

Here is the GUI (which you probably remember from the last post). Nil values are now colored red:

PydgetRFID: GUI

And this a screenshot showing the communication between the daemon and the GUI logged with dbus-monitor:

PydgetRFID: using the the daemon and GUI

More information can be found at the PydgetRFID homepage.

PyGTK GUI for the PhidgetRFID reader

I had some fun writing a Python wrapper around libphidgets for an RFID reader we had lying around here. To do so, I used ctypes (apparantly the Python bindings for libphidgets were broken). To check for a connected RFID reader, I interfaced with hal through dbus. Afterwards I created a simple GUI for the device with PyGTK.

Here is the result:

PyGTK GUI for RFID reader

I experienced some weird permissions problems though. The device could only be opened with root privileges. Takis helped me step through libphidgets to see if there was a bug in it. In the end, we solved it by changing the /etc/udev/rules.d/permissions.rules file (in my case it was called 40-permissions.rules). I’m not sure if there are any security problems with this though.

I changed these lines:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", MODE="0664"

to:

# USB devices (usbfs replacement)
SUBSYSTEM=="usb_device", GROUP="plugdev", MODE="0664"

I will probably put the code online when I have some spare time (and after I cleaned it up a bit).

XML sit-ups with .NET

I’m currently writing some C# code that outputs RDF/XML from a set of classes, and came across some annoyances regarding .NET’s support for XML namespaces (or the lack thereof).

First of all, .NET has only explicit support for one namespace per element. Additional namespaces must be specified by adding an extra xmlns attribute yourself. Well, that’s not so bad, but it adds to the code bloat.

When you want to use namespaces to create new elements (e.g. rdf:Description), you have to explicitly pass the namespace URI again. Otherwise the prefix (in this case rdf) will be ignored. It would be helpful if .NET could check to see if the prefix corresponds to any namespace previously specified in the document root.

Okay, I could have used an RDF library, but this was supposed to be a quick hack, so I didn’t have time to learn another library.

I can’t help but think that if I would have just used strings instead of the System.Xml classes, the program would have been finished sooner. Come to think of it, I should have known better and just used N3 or Turtle.

When using .NET’s XML classes, it seems like half of my code is redundant. Man, do I miss Ruby‘s XML Builder.

I’ll end with a great graphic by Why the Lucky Stiff, in which he compares using XML to doing annoying sit-ups:

XML situps

The term XML sit-ups also appeared on the Ruby on Rails homepage:

Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups.

The common idiom with dynamic languages is to write configuration scripts or domain-specific languages in the language itself, instead of using XML. Compared to e.g. Java, XML is more agile and flexible, but that is not the case with dynamic languages such as Ruby or Python. XML.com has an interesting article about this issue.

Dynamic Languages Day

I almost forgot to blog about it, but I went to the Dynamic Languages day at the VUB on Monday, together with Yves.

I was always interested in learning new programming languages, and getting to know their unique features and viewpoints. After learning Python and Ruby, I became curious after the roots of these languages (being amongst others Lisp and Smalltalk). Since there were introductions and tutorials for these languages at the DLD, it was too good to miss.

The day started with a nice introduction to Scheme by Viviane Jonckers, explaining why they used it as a first programming language for their students.

Then there was a introduction to and demo of Smalltalk by Roel Wuyts and Johan Brichau. The afternoon ended with an Self tutorial by Ellen Van Paesschen.

In the afternoon Pascal Costanza delved into the internals of CLOS, the Common Lisp Object System.

Afterwards at the reception, I had a nice chat with the other attendants and organizers. I also met someone who I had seen before at the anti-software patents manifestations.

All in all, it was a interesting day, and I learned a lot about the presented languages. The list of Lisp links in my del.icio.us account also keeps growing. The organizers said they were planning to upload videos of the presentations at the website, so I’ll keep an eye on the website for updates.


Edit: the movies are now available at the event’s website