<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Martin Pitt &#187; programming</title>
	<atom:link href="http://www.piware.de/tag/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.piware.de</link>
	<description>addicted to Ubuntu development</description>
	<lastBuildDate>Mon, 19 Jul 2010 13:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>gudev Vala bindings</title>
		<link>http://www.piware.de/2010/06/gudev-vala-bindings/</link>
		<comments>http://www.piware.de/2010/06/gudev-vala-bindings/#comments</comments>
		<pubDate>Sat, 12 Jun 2010 22:53:32 +0000</pubDate>
		<dc:creator>pitti</dc:creator>
				<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[udev]]></category>
		<category><![CDATA[vala]]></category>

		<guid isPermaLink="false">http://www.piware.de/?p=337</guid>
		<description><![CDATA[I just learned about vapigen to build a Vala .vapi interface from gobject introspection. Unfortunately it seems that through the way of g-ir-scanner some information gets lost and gir cannot transmit information such as the semantics of arrays (null-terminated or with length, etc.). I played with a &#8220;metadata&#8221; file for an hour (as described upstream), [...]]]></description>
			<content:encoded><![CDATA[<p>I just learned about <code>vapigen</code> to build a Vala .vapi interface from gobject introspection. Unfortunately it seems that through the way of g-ir-scanner some information gets lost and gir cannot transmit information such as the semantics of arrays (null-terminated or with length, etc.). I played with a &#8220;metadata&#8221; file for an hour (as <a href="http://live.gnome.org/Vala/Bindings">described upstream</a>), but it seems to be ignored entirely.</p>
<p>So for now I committed a <a href="http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=3d3e0960a7fbb673b7d445d8ed131fcdeb7c2700">manually adjusted vapi</a> for <a href="http://www.kernel.org/pub/linux/utils/kernel/hotplug/gudev/ref-API.html">gudev</a>. This now makes it easy to write code that queries and listens to udev in Vala.</p>
<p>Small example:</p>
<pre>
using GUdev;

void
print_device(GUdev.Device d)
{
    stdout.printf("%s → %s\n", d.get_device_file(), d.get_sysfs_path());
    foreach (string s in d.get_device_file_symlinks())
        stdout.printf("  link: %s\n", s);
}

void
on_uevent(GUdev.Client client, string action, GUdev.Device dev)
{
    stdout.printf("[%s] ", action);
    print_device(dev);
}

int main(string[] args)
{
    var uc = new GUdev.Client({"usb"});

    print_device(uc.query_by_device_file(args[1]));

    stdout.printf("---- all block devices ---\n");
    GLib.List<GUdev.Device> devs = uc.query_by_subsystem("block");
    foreach (GUdev.Device d in devs)
        print_device(d);

    stdout.printf("---- usb events ---\n");
    uc.uevent.connect(on_uevent);
    new GLib.MainLoop().run();
    return 0;
}
</pre>
<p>Build with <code>valac --pkg gudev-1.0 udev.vala</code>, and perhaps specify <code>--vapidir</code> if you keep the <code>gudev-1.0.vapi</code> file somewhere locally.</p>
<p><strong>Update:</strong> I reverted the commit upstream for now, since Vala 0.8 already ships a gudev vapi. I must have overlooked that when I played with vapigen.. In the long run it&#8217;s probably better to generate vapis in the projects themselves to avoid API skew, but as long as the vapi can&#8217;t be generated automatically it does not make sense to have it in udev. Above code was updated for the vala provided one (which is lacking a return type specification for <code>query_by_subsystem()</code>).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piware.de/2010/06/gudev-vala-bindings/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Celebrating the 1000th postgresql-common commit</title>
		<link>http://www.piware.de/2010/05/celebrating-the-1000th-postgresql-common-commit/</link>
		<comments>http://www.piware.de/2010/05/celebrating-the-1000th-postgresql-common-commit/#comments</comments>
		<pubDate>Mon, 03 May 2010 15:58:28 +0000</pubDate>
		<dc:creator>pitti</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[bzr]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[postgresql]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[testing]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://www.piware.de/?p=331</guid>
		<description><![CDATA[I just did the 1000th commit of postgresql-common, the Debian/Ubuntu PostgreSQL management utilities. Wow, what started as a small hack in December 2004 to be able to install several major PostgreSQL versions in parallel has turned out to be a > 600 kB project providing a comprehensive tool set for uniformly setting up, upgrading, and [...]]]></description>
			<content:encoded><![CDATA[<p>I just did the <a href="http://bazaar.launchpad.net/~pitti/postgresql/common/revision/1000">1000th commit</a> of <a href="http://people.debian.org/~mpitt/architecture.html">postgresql-common</a>, the Debian/Ubuntu PostgreSQL management utilities. Wow, what started as a small hack in December 2004 to be able to install several major PostgreSQL versions in parallel has turned out to be a > 600 kB project providing a comprehensive tool set for uniformly setting up, upgrading, and maintaining PostgreSQL database instances from version 7.4 up to the just announced <a href="http://www.postgresql.org/about/news.1198">9.0 beta-1</a>, with a comprehensive test suite that I&#8217;m really proud of (it tests just about every aspect, option, and corner case of the installation, integration, upgrade, locale support, and error handling, and takes about half an hour on my system).</p>
<p>The actual commit is rather dull though, it&#8217;s just the release/upload tag for version 107 which I just uploaded to Debian unstable (it will hit Ubuntu maverick and backports soon). 107 introduces support for PostgreSQL 9.0, and I fixed up the scripts and tests enough so that all the tests pass now, and thus it&#8217;s good for public release.</p>
<p>I also uploaded the 9.0 beta 1 server itself now. It&#8217;ll be in <a href="http://ftp-master.debian.org/new.html">Debian&#8217;s NEW queue</a> for a bit, and hit experimental in a few days (or hours; recently the ftpmasters have been awesome!) It has a few cool new features (see <a href="http://www.postgresql.org/about/news.1198">the announcement</a>), and upstream really appreciates testing and feedback. So, bug reports appreciated!</p>
<p>In particular, if you have existing 8.4 clusters you can just try to <code>pg_upgradecluster</code> them to 9.0 beta 1. Remember, if anything goes wrong, the cluster of the previous version is still intact and untouched, so you can run upgrades as many times as you like and only pg_dropcluster the old one when you’re completely satisfied with the upgrade.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piware.de/2010/05/celebrating-the-1000th-postgresql-common-commit/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>&#8220;hello dbus&#8221; in vala</title>
		<link>http://www.piware.de/2009/11/hello-dbus-in-vala/</link>
		<comments>http://www.piware.de/2009/11/hello-dbus-in-vala/#comments</comments>
		<pubDate>Fri, 27 Nov 2009 23:06:03 +0000</pubDate>
		<dc:creator>pitti</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[d-bus]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[vala]]></category>

		<guid isPermaLink="false">http://www.piware.de/?p=242</guid>
		<description><![CDATA[On the long flight back from UDS-Lucid I read the Vala tutorial on my ebook, and did some of the exercises. I was curious about Vala because it combines the speed and memory efficiency of C in a sane C#-like language with proper memory management, exceptions, and without the silly &#8220;close to the metal&#8221; faff [...]]]></description>
			<content:encoded><![CDATA[<p>On the long flight back from UDS-Lucid I read the <a href="http://live.gnome.org/Vala/Tutorial">Vala tutorial</a> on my ebook, and did some of the exercises. I was curious about Vala because it combines the speed and memory efficiency of C in a sane C#-like language with proper memory management, exceptions, and without the silly &#8220;close to the metal&#8221; faff that is usually required in C.</p>
<p>And indeed I wasn&#8217;t disappointed. It&#8217;s not as convenient as Python, but really not far from it, and it&#8217;s faaaast!</p>
<p>Today I finally got back to this and wrote my first D-Bus example in vala which does a  call to DeviceKit-disks:</p>
<blockquote><pre>
using DBus;

int main(string[] args)
{
    Connection con = Bus.get(BusType.SYSTEM);

    dynamic DBus.Object dk = con.get_object(
            "org.freedesktop.DeviceKit.Disks",
	    "/org/freedesktop/DeviceKit/Disks",
	    "org.freedesktop.DeviceKit.Disks");

    ObjectPath[] devs = dk.EnumerateDevices();
    foreach (ObjectPath o in devs)
	stdout.printf("%s\n", o);

    return 0;
}
</pre>
</blockquote>
<p>Compile and run it with</p>
<p><code>valac --pkg dbus-glib-1 dbus-dk.vala &#038;&#038; ./dbus-dk</code> </p>
<p>and voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.piware.de/2009/11/hello-dbus-in-vala/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
