Tag Archives: Programmieren

N9 media pushing


Ever since the announcement of the N9’s DLNA support people were looking for a feature called DLNA +PU+ which allows you to send media files to e.g. DLNA-capable TVs without enabling content sharing on your device, giving you a really fine-grained control about what and where to share to.

PushUp is a small utility that hooks into the N9’s sharing framework and allows to you push an image or a video to your TV just like you would with Bluetooth or NFC. Get it on this site (or later through the Nokia Store).

It is an offspring of my Korva project, a D-Bus specification and its implementation for media pushing. While still work-in-progress, it’s already fully functional.

Edit: I had to update the package because the icon was missing and cancelling the device selector was broken.
Edit2: Updated again since it was broken on PR < 1.2.

Modifying your GNOME keymap programmatically

For some reason I’ve a notebook with a Swedish keyboard but when docked I use my ergonomic keyboard with a German layout. To automatically switch the layout when the external keyboard is connected, I cooked up this script and added a .desktop file to $HOME/.config/autostart:

#!/usr/bin/env python
from gi.repository import Gtk, GLib, Gkbd
import usb
import sys
# Holtek Semiconductor, Inc. PS/2 keyboard + mouse controller
c = Gkbd.Configuration.get();
    # find index for german
    de = c.get_short_group_names().index('de')
    for bus in usb.busses():
        for dev in bus.devices:
            if dev.idVendor == vendor and dev.idProduct == product:
                c.lock_group (de)
except Exception, e:
    print e

This is using pyusb 0.4, it gets a bit easier with 1.0.

GStreamer 0.11 + JHbuild

If you try to test GStreamer 0.11 there’s this nice gst-uninstalled script; somehow that didn’t work for me as soon as I tried to use more non-gst interdependent libraries so I opted to use jhbuild. Luckily that’s quite easy with the stock gnome jhbuild moduleset.

To do that, I created a new .jhbuildrc-gst-0.11 with the following modifications. skip and modules can of course be adjusted to own needs.

moduleset = 'gnome-world-3.4'
modules = [ 'vala', 'libgee', 'gstreamer', 'gst-plugins-good', 'gst-plugins-bad', 'gst-plugins-ugly', 'gst-ffmpeg', 'gssdp', 'gupnp', 'gupnp-av' ]
skip = ['gtk+', 'atk', 'gcr', 'gtk+-2', 'rarian', 'NetworkManager', 'gnutls', 'polkit', 'p11-kit', 'gnutls', 'cantarell-fonts', 'gtk-engines', 'librsvg', 'gnome-themes-standard', 'libgnome-keyring', 'pango', 'expat', 'libgpg-error', 'libgcrypt', 'glib-networking']
os.environ['JHBUILDPS1'] = '[gst-0.11] '
branches = {
    'gstreamer' : '0.11',
    'gst-plugins-base' : '0.11',
    'gst-plugins-good' : '0.11',
    'gst-plugins-bad' : '0.11',
    'gst-plugins-ugly' : '0.11',
    'gst-ffmpeg' : '0.11'

Properties and Probabilities

I just tagged version 0.2 of my tracker browser tool

What’s new?

  • It has a location bar with backward and forward navigation buttons
  • It is also possible to use prefixed names instead of IRIs
  • You can use your keyboard to navigate backward and forward
  • It has a in-page search bar which can be reached by familiar keystrokes like “/” or “Ctrl-f”
  • If you browse a rdf:Property, you will now be shown all resources with the value the property has

Where to get it?


Mandatory screenshots

Tracker and me

While working with tracker I find myself rather often calling “tracker-info” on resources, looking for linked resources, running tracker-info on those, then needing to get back etc. A bit ugly and time-consuming.

Wouldn’t it be cool to just browse through all that info, being able to go back and forth through the links? Yes, it would. That’s why I wrote tracker-zilla:

You can navigate through the resources just like on the interwebs, using the back and forward feature of the context menu. It shows you not only the resources and properties of the object but also resources that link to the one you’re currently browsing:

It’s not that feature-rich and probably never will be. You can either pass a urn to it via command-line or nothing, then it will show you all rdfs:Classes available in the current ontology where you can just click on e.g. nco:PersonContact. What I’m planning to add is a simple in-page search and a breadcrumb navigation.

That said. it’s a pleasure to work with libtracker-sparql (especially from Vala). You need Vala 0.11.6, gtk+-3 and webkitgtk-3.0 to build it. ?The code is available at github.

Update: Due to popular demand, there’s now a –with-gtk=2 option to enable Gtk+-2 UI.

UPnP & C++

I’m currently trying to provide Qt4 bindings for the GUPnP stack. I’m a bit impeded by the issues that I already encountered with the “mm” C++ bindings and other people also experienced. Some classes are not that binding friendly. Additionally GUPnP is – as the name implies – closely tied to GObject and the GType system, imposing some more problems for the Qt 4 port.

I already got a test-browser like example running in Qt 4 running, stay tuned for more updates.

The QThread anti-pattern

Sometimes with QThread you see something like this:

void run()
    while (true) {
            QMutexLocker lock(&mMutexData);
            if (mQuit)
        msleep (200);
void stop()
    mQuit = true;

This is potentially problematic. Why? Consider the extreme case of a function shutdown() which does something like this:

void shutdown()
    delete thread;

Congratulations, you’ve just introduced a race condition. Why, you will ask? You’re waiting for the thread to end before deleting it, right?

No. And this has to do with the way Qt implements QThread::wait() which you should have probably used in the first place, if you really need this sort of functionality.

Qt hooks a pthread cleanup handler in the native thread which will call wakeAll() on a QWaitCondition stored inside the pimpl of QThread. And this pimpl – you might have guessed – is gone when you call delete.

State of the GUPnP stack on Windows and other scary tales

I updated the windows ports of gssdp and gupnp today, did some further clean-up on the gupnp port and filed merge-requests for both on gitorious.

I also deleted the gupnp-win32 repository on github. New development will go to this repository on gitorious. There is still the gssdp-win32 repository on github since I have not yet taken care of the MSVC additions.

I also started wrapping gssdp et al into *mm (hey, I work for Openismus now 😉 but this has proven to be somewhat difficult.