Friday, May 30, 2008

Dear Python, leave me alone

So yet once again Mr python decide to tease me when i do `apt-get dist-upgrade`:

Setting up python-lxml (2.0.5-1) ...
/var/lib/dpkg/info/python-lxml.postinst: /usr/bin/pycentral: /usr/bin/python: bad interpreter: No such file or directory
dpkg: error processing python-lxml (--configure):
subprocess post-installation script returned error exit status 126
...
Errors were encountered while processing:
epiphany-extensions
bzr
gnome-media-common
libgnome-media0
gnome-media
pidgin
python-lxml
E: Sub-process /usr/bin/dpkg returned an error code (1)

My new personal hero

Meet my new personal hero, Jussi Kukkonen. The only o-hand employee in Finland who almost single-handedly created the Vala bindings of the whole GUPnP stack and ported all our test apps to Vala in a very short amount of time despite the fact that he was completely unfamiliar to Vala and GUPnP (and UPnP itself) when he started working on this task and the fact that the Vala documentation is hardly any complete (especially binding-generation).

Saturday, May 24, 2008

Why Vala?

When I told some people that I will write (which involves re-writing existing code first) the gupnp-media-server in Vala, their question was "Why Vala? Why not Python, Java or C#?". So here are the strong points of Vala, not all of which are found in these languages:


  • Statically-typed

    Back in the days, when I was hacking on Gazpacho I found the lack of types on variables and function/method parameters really annoying in Python. This can become quite a pain when you are reading other's code and that is exactly what I was doing most of the time. The fact that Johan and Kalle wrote very nice and readable code, helped a lot though.

  • No runtime dependency/overhead

    This might seem like a small point to many developers but as an embedded-systems developer, this is a big plus for me and I am sure to many (if not most) of the embedded-systems developers out there.


  • Easy integration with C/GObject

    A big plus for all the GObject/C developers out there. Besides, there are situations when writing code in any language other than C or C++ is not possible/viable and such easy integration would make life very easy. Recently a colleague of mine had to bind a gobject-based library for Python and it turned out to be a lot more pain than I imagined. This impression is based on the fact that so many of GNOME developers have taken python so serious and so many of the GNOME apps are being (re-)written in Python.

    This point is very important when it comes to writing frameworks and libraries since if you write them in a language that doesn't qualify as a LCD, you are pushing your choice of language on the application developers you aim to attract. Since Vala translates to a language that does qualify as LCD, it in turn also qualifies as one.

    An important bit here is that this integration is bi-directional, i-e one can use the classes written in Vala very easily from C. In fact this is much easier than doing it the other way around as you don't have to write any bindings.





UPDATE:I am sorry if my ideas hurt someones's feelings attached to some particular language. If i have hurt your feelings, there is no need for insults, I didn't force you to read my blog. Just writing this after removing an insulting comment from an 'Anonymous' dude.

Monday, May 19, 2008

GUPnP developer tools 0.4 released

- Use libsoup 2.4. [Jorn Baayen, Zeeshan Ali Khattak]
- Incremental browsing of containers. [Zeeshan Ali Khattak]

GUPnP-AV 0.2 released

- Use libsoup 2.4. [Jorn Baayen]
- Add DLNA support to DIDL writer. [Jorn Baayen]
- Some small fixes. [Jorn Baayen]

Sunday, May 18, 2008

Vala is great!

Ever since Jorn and Matthew mentioned the idea of Vala bindings for GUPnP, I have been eager to learn Vala and so this weekend I finally got around to introduce myself to it. It's really cool. To express my admiration, I have already created a "Vala programming language fan club" group on facebook. :) A few minutes after I mentioned to Emmanuele on IRC about my intention of binding GUPnP for Vala, Ali Sabil had already done the basic work and we already have bindings that work for such basic example application at least:

using GLib;
using GUPnP;

public class Browser: ControlPoint {
public MainLoop main_loop { get; private set; }

private void on_device_proxy_available(ControlPoint cp,
DeviceProxy proxy) {
stdout.printf("device %s found\n", proxy.get_friendly_name());
}

private bool on_timeout () {
this.main_loop.quit();

return false;
}

public Browser() {
this.client = new Context(null, null, 0);
this.target = "ssdp:all";
this.resource_factory = ResourceFactory.get_default();

this.main_loop = new MainLoop(null, false);
}

static int main(string[] args) {
Browser browser;

Thread.init();

browser = new Browser();

browser.device_proxy_available += browser.on_device_proxy_available;

browser.set_active(true);

var time = new GLib.TimeoutSource(5000);

time.set_callback(browser.on_timeout, null);
time.attach(browser.main_loop.get_context());

browser.main_loop.run();

return 0;
}
}


If you are really anxious to try it out, you can get it here but please keep in mind that it needs a bit (at least) of polishing/love before it could be taken seriously.

Moving in business

I am finally moving in with my girlfriend, Ansku. It's been 1.5 years we have been together and now we are moving in. The place we are moving into is in Helsinki and very near to the Helsinki center. A nice apartment very near to the railway station of Huopalahti. The good thing about this train station is that a lot of trains go through it so if you miss a train, there is another one to catch after 5 minutes and the slowest train takes 15 minutes to reach the Helsinki center.

We are supposed to move on 1st of june and some nice dedicated friends have already promised to help us carry stuff.

Wednesday, May 14, 2008

GUPnP 0.10 released

- Use libsoup 2.4. [Zeeshan Ali Khattak, Jorn Baayen]
- Use g_timeout_add_seconds(). [Jorn Baayen]
- Use GIO instead of xdgmime. [Jorn Baayen]
- Support HTTP Range header in the HTTP server. [Jorn Baayen]
- Use GMappedFile to mmap served files of read()ing them. [Jorn Baayen]
- Improved documentation. [Ross Burton]
- Spew HTTP messages to console when GUPNP_DEBUG is set. [Ross Burton]
- Various other fixes. [Ross Burton, Zeeshan Ali Khattak, Jorn Baayen]

download: http://gupnp.org/sources/gupnp/gupnp-0.10.tar.gz

GSSDP 0.6 released

- Use libsoup 2.4. [Zeeshan Ali Khattak, Jorn Baayen]
- Use g_timeout_add_seconds(). [Jorn Baayen]

download: http://gupnp.org/sources/gssdp/gssdp-0.6.tar.gz

Sunday, May 11, 2008

A week of Xbox fun

While my MediaServer implementation is still in it's very infancy, I was already asked by more than two people if it will work with Xbox. I didn't have a clue since I don't have an Xbox so I asked Naba if i can visit him on some weekend to find some clues but he was kind enough to lend it for a week instead. For the past one week I had been having lots of fun with it. This nice page by Frank Scholz gave me headstart and I was able to get Xbox see my MediaServer rather sooner. The only other achievement I had in the whole week is that Xbox is able to see the videos but can't play it (most probably because I don't give it all the metadata it requests).

The good thing is that now i have a very good idea of what Xbox expects from my MediaServer and I am very hopeful on getting my MediaServer working with Xbox at some point. Here is the log of all the SOAP messages I get from Xbox for anyone interested.

Wednesday, May 7, 2008

Karl Lattimer is my hero

I just can't help but appreciate how this dude comes to my desk and solves my complicated problem within minutes. My python problems were all solved when he removed the link (/usr/bin/python) to absolute path (/usr/bin/python2.5) and recreated it, only this time using relative path. Either he is too smart or I am too stupid. :)

Sunday, May 4, 2008

python strikes back

The joy of getting my python problems fixed on my debian testing were short lived. This time when i ran `apt-get dist-upgrade`, apt failed saying:


ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.4
dpkg: error while cleaning up:
subprocess post-installation script returned error exit status 1
...
Errors were encountered while processing:
/var/cache/apt/archives/python-uno_1%3a2.4.0-5_i386.deb
/var/cache/apt/archives/deskbar-applet_2.22.1-1_i386.deb
/var/cache/apt/archives/python-ctypes_1.0.2-4_i386.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)


So removed the link to python2.5 and recreated it but this time pointing to pythong2.4. It should fix the problem, right? No! here is what apt says now:


ValueError: /usr/bin/python does not match the python default version. It must be reset to point to python2.5
...

Thursday, May 1, 2008

GUPnP presentation at GUADEC

So my GUPnP presentation for GUADEC has been accepted and scheduled for 14:30 on 11 Jul 2008. It will be essentially the same talk I delivered at FOSDEM but this time I'll try to make sure the demos really do work. :) If you missed it at FOSDEM, don't commit the same mistake at GUADEC. :)