<?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>The adventures of Foo &#187; Programmieren</title>
	<atom:link href="http://jensge.org/tag/programmieren/feed/" rel="self" type="application/rss+xml" />
	<link>http://jensge.org</link>
	<description>My aggregated random tech blabber</description>
	<lastBuildDate>Thu, 26 Apr 2012 19:24:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>N9 media pushing</title>
		<link>http://jensge.org/2012/04/n9-media-pushing/</link>
		<comments>http://jensge.org/2012/04/n9-media-pushing/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 08:35:37 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[DLNA]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[N9]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[UPnP]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=643</guid>
		<description><![CDATA[&#160; Ever since the announcement of the N9&#8242;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 &#8230; <a href="http://jensge.org/2012/04/n9-media-pushing/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>&nbsp;</p>
<p><a href="http://jensge.org/pushup_0.2.1-1_armel.deb"><img class="alignright size-full wp-image-649" style="color: #333333; font-style: normal; line-height: 24px; border-style: initial; border-color: initial;" title="PushUp 0.2" src="http://jensge.org/wp-content/uploads/2012/04/pushup_qr2.png" alt="" width="111" height="111" /></a></p>
<p>Ever since the announcement of the N9&#8242;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.</p>
<div>
<p><a href="http://jensge.org/wp-content/uploads/2012/04/2012-04-19_17-56-14.png"><img class="alignleft size-medium wp-image-650" title="2012-04-19_17-56-14" src="http://jensge.org/wp-content/uploads/2012/04/2012-04-19_17-56-14-168x300.png" alt="" width="168" height="300" /></a></p>
<p>PushUp is a small utility that hooks into the N9&#8242;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 <a href="http://jensge.org/pushup_0.2.1-1_armel.deb" target="_blank">on this site</a> (or later through the Nokia Store).</p>
<p>It is an offspring of my <a href="http://live.gnome.org/Rygel/Korva" target="_blank">Korva project</a>, a D-Bus specification and its implementation for media pushing. While still work-in-progress, it&#8217;s already fully functional.</p>
<p>Edit: I had to update the package because the icon was missing and cancelling the device selector was broken.<br />
Edit2: Updated again since it was broken on PR &lt; 1.2.
</p></div>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2012/04/n9-media-pushing/feed/</wfw:commentRss>
		<slash:comments>48</slash:comments>
		</item>
		<item>
		<title>Modifying your GNOME keymap programmatically</title>
		<link>http://jensge.org/2012/04/modifying-your-gnome-keymap-programmatically/</link>
		<comments>http://jensge.org/2012/04/modifying-your-gnome-keymap-programmatically/#comments</comments>
		<pubDate>Fri, 13 Apr 2012 18:06:40 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Python]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=638</guid>
		<description><![CDATA[For some reason I&#8217;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 &#8230; <a href="http://jensge.org/2012/04/modifying-your-gnome-keymap-programmatically/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>For some reason I&#8217;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 <code>.desktop</code> file to <code>$HOME/.config/autostart</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">from</span> gi.<span style="color: black;">repository</span> <span style="color: #ff7700;font-weight:bold;">import</span> Gtk, GLib, Gkbd
<span style="color: #ff7700;font-weight:bold;">import</span> usb
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">sys</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Holtek Semiconductor, Inc. PS/2 keyboard + mouse controller</span>
vendor=0x04d9
product=0x1400
&nbsp;
c = Gkbd.<span style="color: black;">Configuration</span>.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: #66cc66;">;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">try</span>:
    <span style="color: #808080; font-style: italic;"># find index for german</span>
    de = c.<span style="color: black;">get_short_group_names</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">index</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'de'</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">for</span> bus <span style="color: #ff7700;font-weight:bold;">in</span> usb.<span style="color: black;">busses</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">for</span> dev <span style="color: #ff7700;font-weight:bold;">in</span> bus.<span style="color: black;">devices</span>:
            <span style="color: #ff7700;font-weight:bold;">if</span> dev.<span style="color: black;">idVendor</span> == vendor <span style="color: #ff7700;font-weight:bold;">and</span> dev.<span style="color: black;">idProduct</span> == product:
                c.<span style="color: black;">lock_group</span> <span style="color: black;">&#40;</span>de<span style="color: black;">&#41;</span>
                <span style="color: #dc143c;">sys</span>.<span style="color: black;">exit</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#41;</span>
<span style="color: #ff7700;font-weight:bold;">except</span> <span style="color: #008000;">Exception</span>, e:
    <span style="color: #ff7700;font-weight:bold;">print</span> e
    <span style="color: #ff7700;font-weight:bold;">pass</span></pre></div></div>

<p>This is using pyusb 0.4, it gets a bit easier with 1.0.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2012/04/modifying-your-gnome-keymap-programmatically/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>GStreamer 0.11 + JHbuild</title>
		<link>http://jensge.org/2012/02/gstreamer-0-11-jhbuild/</link>
		<comments>http://jensge.org/2012/02/gstreamer-0-11-jhbuild/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 08:15:15 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=554</guid>
		<description><![CDATA[If you try to test GStreamer 0.11 there&#8217;s this nice gst-uninstalled script; somehow that didn&#8217;t work for me as soon as I tried to use more non-gst interdependent libraries so I opted to use jhbuild. Luckily that&#8217;s quite easy with &#8230; <a href="http://jensge.org/2012/02/gstreamer-0-11-jhbuild/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>If you try to test GStreamer 0.11 there&#8217;s this nice <a href="http://cgit.freedesktop.org/gstreamer/gstreamer/tree/scripts/gst-uninstalled">gst-uninstalled script</a>; somehow that didn&#8217;t work for me as soon as I tried to use more non-gst interdependent libraries so I opted to use jhbuild. Luckily that&#8217;s quite easy with the stock gnome jhbuild moduleset.</p>
<p>To do that, I created a new <code>.jhbuildrc-gst-0.11</code> with the following modifications. <code>skip</code> and <code>modules</code> can of course be adjusted to own needs.</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">moduleset = <span style="color: #483d8b;">'gnome-world-3.4'</span>
modules = <span style="color: black;">&#91;</span> <span style="color: #483d8b;">'vala'</span>, <span style="color: #483d8b;">'libgee'</span>, <span style="color: #483d8b;">'gstreamer'</span>, <span style="color: #483d8b;">'gst-plugins-good'</span>, <span style="color: #483d8b;">'gst-plugins-bad'</span>, <span style="color: #483d8b;">'gst-plugins-ugly'</span>, <span style="color: #483d8b;">'gst-ffmpeg'</span>, <span style="color: #483d8b;">'gssdp'</span>, <span style="color: #483d8b;">'gupnp'</span>, <span style="color: #483d8b;">'gupnp-av'</span> <span style="color: black;">&#93;</span>
skip = <span style="color: black;">&#91;</span><span style="color: #483d8b;">'gtk+'</span>, <span style="color: #483d8b;">'atk'</span>, <span style="color: #483d8b;">'gcr'</span>, <span style="color: #483d8b;">'gtk+-2'</span>, <span style="color: #483d8b;">'rarian'</span>, <span style="color: #483d8b;">'NetworkManager'</span>, <span style="color: #483d8b;">'gnutls'</span>, <span style="color: #483d8b;">'polkit'</span>, <span style="color: #483d8b;">'p11-kit'</span>, <span style="color: #483d8b;">'gnutls'</span>, <span style="color: #483d8b;">'cantarell-fonts'</span>, <span style="color: #483d8b;">'gtk-engines'</span>, <span style="color: #483d8b;">'librsvg'</span>, <span style="color: #483d8b;">'gnome-themes-standard'</span>, <span style="color: #483d8b;">'libgnome-keyring'</span>, <span style="color: #483d8b;">'pango'</span>, <span style="color: #483d8b;">'expat'</span>, <span style="color: #483d8b;">'libgpg-error'</span>, <span style="color: #483d8b;">'libgcrypt'</span>, <span style="color: #483d8b;">'glib-networking'</span><span style="color: black;">&#93;</span>
<span style="color: #dc143c;">os</span>.<span style="color: black;">environ</span><span style="color: black;">&#91;</span><span style="color: #483d8b;">'JHBUILDPS1'</span><span style="color: black;">&#93;</span> = <span style="color: #483d8b;">'[gst-0.11] '</span>
branches = <span style="color: black;">&#123;</span>
    <span style="color: #483d8b;">'gstreamer'</span> : <span style="color: #483d8b;">'0.11'</span>,
    <span style="color: #483d8b;">'gst-plugins-base'</span> : <span style="color: #483d8b;">'0.11'</span>,
    <span style="color: #483d8b;">'gst-plugins-good'</span> : <span style="color: #483d8b;">'0.11'</span>,
    <span style="color: #483d8b;">'gst-plugins-bad'</span> : <span style="color: #483d8b;">'0.11'</span>,
    <span style="color: #483d8b;">'gst-plugins-ugly'</span> : <span style="color: #483d8b;">'0.11'</span>,
    <span style="color: #483d8b;">'gst-ffmpeg'</span> : <span style="color: #483d8b;">'0.11'</span>
<span style="color: black;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2012/02/gstreamer-0-11-jhbuild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t know if it&#8217;s useful…</title>
		<link>http://jensge.org/2011/05/dont-know-if-its-useful%e2%80%a6/</link>
		<comments>http://jensge.org/2011/05/dont-know-if-its-useful%e2%80%a6/#comments</comments>
		<pubDate>Sat, 07 May 2011 08:52:18 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[rygel]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=525</guid>
		<description><![CDATA[… for others but I wrote myself a small &#8220;cp&#8221; replacement that tries to imitate the behavior of P2P clients by copying a file block-wise randomly with a small delay between each write. I use this to trigger bugs in &#8230; <a href="http://jensge.org/2011/05/dont-know-if-its-useful%e2%80%a6/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>… for others but I wrote myself a small &#8220;cp&#8221; replacement that tries to imitate the behavior of P2P clients by copying a file block-wise randomly with a small delay between each write. I use this to <del>trigger bugs in</del> test the media-export back-end of <a href="http://rygel-project.org">Rygel</a>.</p>
<p>The repository is at <a href="https://github.com/phako/random-copy">https://github.com/phako/random-copy</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2011/05/dont-know-if-its-useful%e2%80%a6/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Properties and Probabilities</title>
		<link>http://jensge.org/2011/03/properties-and-probabilities/</link>
		<comments>http://jensge.org/2011/03/properties-and-probabilities/#comments</comments>
		<pubDate>Tue, 29 Mar 2011 18:52:48 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=516</guid>
		<description><![CDATA[I just tagged version 0.2 of my tracker browser tool What&#8217;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 &#8230; <a href="http://jensge.org/2011/03/properties-and-probabilities/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I just tagged version 0.2 of my tracker browser tool</p>
<h3>What&#8217;s new?</h3>
<ul>
<li>It has a location bar with backward and forward navigation buttons</li>
<li>It is also possible to use prefixed names instead of IRIs</li>
<li>You can use your keyboard to navigate backward and forward</li>
<li>It has a in-page search bar which can be reached by familiar keystrokes like &#8220;/&#8221; or &#8220;Ctrl-f&#8221;</li>
<li>If you browse a rdf:Property, you will now be shown all resources with the value the property has</li>
</ul>
<h3>Where to get it?</h3>
<p><a href="https://github.com/phako/tracker-zilla/tree/0.2">https://github.com/phako/tracker-zilla/tree/0.2</a></p>
<h3>Mandatory screenshots</h3>

<a href='http://jensge.org/2011/03/properties-and-probabilities/screenshot-trackerzilla-0-2-01/' title='Screenshot-trackerzilla-0.2-01'><img width="150" height="150" src="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-0.2-01-150x150.png" class="attachment-thumbnail" alt="Showing the new location bar" title="Screenshot-trackerzilla-0.2-01" /></a>
<a href='http://jensge.org/2011/03/properties-and-probabilities/screenshot-trackerzilla-0-2-02/' title='Screenshot-trackerzilla-0.2-02'><img width="150" height="150" src="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-0.2-02-150x150.png" class="attachment-thumbnail" alt="Browsing a rdf:Property" title="Screenshot-trackerzilla-0.2-02" /></a>
<a href='http://jensge.org/2011/03/properties-and-probabilities/screenshot-trackerzilla-0-2-03/' title='Screenshot-trackerzilla-0.2-03'><img width="150" height="150" src="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-0.2-03-150x150.png" class="attachment-thumbnail" alt="Demonstrating in-site search" title="Screenshot-trackerzilla-0.2-03" /></a>

]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2011/03/properties-and-probabilities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tracker and me</title>
		<link>http://jensge.org/2011/03/tracker-and-me/</link>
		<comments>http://jensge.org/2011/03/tracker-and-me/#comments</comments>
		<pubDate>Wed, 09 Mar 2011 20:44:34 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Tracker]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=505</guid>
		<description><![CDATA[While working with tracker I find myself rather often calling &#8220;tracker-info&#8221; on resources, looking for linked resources, running tracker-info on those, then needing to get back etc. A bit ugly and time-consuming. Wouldn&#8217;t it be cool to just browse through &#8230; <a href="http://jensge.org/2011/03/tracker-and-me/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>While working with tracker I find myself rather often calling &#8220;tracker-info&#8221; on resources, looking for linked resources, running tracker-info on those, then needing to get back etc. A bit ugly and time-consuming.</p>
<p style="text-align: center;"><a href="http://jensge.org/wp-content/uploads/2011/03/tracker-info.png"><img class="size-medium wp-image-506 aligncenter" title="tracker-info" src="http://jensge.org/wp-content/uploads/2011/03/tracker-info-300x211.png" alt="" width="270" height="190" /></a></p>
<p>Wouldn&#8217;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&#8217;s why I wrote tracker-zilla:</p>
<p style="text-align: center;"><a href="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-1.png"><img class="size-medium wp-image-507 aligncenter" title="Screenshot-trackerzilla-1" src="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-1-300x180.png" alt="" width="270" height="162" /></a></p>
<p>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&#8217;re currently browsing:</p>
<p style="text-align: center;"><a href="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-2.png"><img class="size-medium wp-image-508 aligncenter" title="Screenshot-trackerzilla-2" src="http://jensge.org/wp-content/uploads/2011/03/Screenshot-trackerzilla-2-300x180.png" alt="" width="270" height="162" /></a></p>
<p>It&#8217;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&#8217;m planning to add is a simple in-page search and a breadcrumb navigation.</p>
<p>That said. it&#8217;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 <a href="https://github.com/phako/tracker-zilla">github</a>.</p>
<p><em>Update:</em> Due to popular demand, there&#8217;s now a &#8211;with-gtk=2 option to enable Gtk+-2 UI.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2011/03/tracker-and-me/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>UPnP &amp; C++</title>
		<link>http://jensge.org/2011/02/upnp_cp/</link>
		<comments>http://jensge.org/2011/02/upnp_cp/#comments</comments>
		<pubDate>Wed, 02 Feb 2011 19:36:22 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[UPnP]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=501</guid>
		<description><![CDATA[I&#8217;m currently trying to provide Qt4 bindings for the GUPnP stack. I&#8217;m a bit impeded by the issues that I already encountered with the &#8220;mm&#8221; C++ bindings and other people also experienced. Some classes are not that binding friendly. Additionally &#8230; <a href="http://jensge.org/2011/02/upnp_cp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently trying to provide Qt4 bindings for the GUPnP stack. I&#8217;m a bit impeded by the issues that I already encountered with the &#8220;mm&#8221; C++ bindings and other people also experienced. Some classes are not that binding friendly. Additionally GUPnP is &#8211; as the name implies &#8211; closely tied to GObject and the GType system, imposing some more problems for the Qt 4 port.</p>
<p>I already got a test-browser like example running in Qt 4 running, stay tuned for more updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2011/02/upnp_cp/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The QThread anti-pattern</title>
		<link>http://jensge.org/2010/09/the-qthread-anti-pattern/</link>
		<comments>http://jensge.org/2010/09/the-qthread-anti-pattern/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 17:50:56 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Computer]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[Qt]]></category>
		<category><![CDATA[Rant]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=467</guid>
		<description><![CDATA[Sometimes with QThread you see something like this: void run&#40;&#41; &#123; while &#40;true&#41; &#123; &#123; QMutexLocker lock&#40;&#38;mMutexData&#41;; if &#40;mQuit&#41; break; &#125; &#160; msleep &#40;200&#41;; &#125; &#160; mWaitExit.wakeAll&#40;&#41;; &#125; &#160; void stop&#40;&#41; &#123; mMutexData.lock&#40;&#41;; mQuit = true; mMutexData.unlock&#40;&#41;; mWaitExit.wait&#40;&#38;mMutexExit&#41;; &#125; This &#8230; <a href="http://jensge.org/2010/09/the-qthread-anti-pattern/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Sometimes with QThread you see something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> run<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">while</span> <span style="color: #008000;">&#40;</span><span style="color: #0000ff;">true</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #008000;">&#123;</span>
            QMutexLocker lock<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>mMutexData<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
            <span style="color: #0000ff;">if</span> <span style="color: #008000;">&#40;</span>mQuit<span style="color: #008000;">&#41;</span>
                <span style="color: #0000ff;">break</span><span style="color: #008080;">;</span>
        <span style="color: #008000;">&#125;</span>
&nbsp;
        msleep <span style="color: #008000;">&#40;</span><span style="color: #0000dd;">200</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    mWaitExit.<span style="color: #007788;">wakeAll</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">void</span> stop<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    mMutexData.<span style="color: #007788;">lock</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    mQuit <span style="color: #000080;">=</span> <span style="color: #0000ff;">true</span><span style="color: #008080;">;</span>
    mMutexData.<span style="color: #007788;">unlock</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    mWaitExit.<span style="color: #007788;">wait</span><span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>mMutexExit<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

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

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">void</span> shutdown<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    thread<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>stop<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
    <span style="color: #0000dd;">delete</span> thread<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<p>Congratulations, you&#8217;ve just introduced a race condition. Why, you will ask? You&#8217;re waiting for the thread to end before deleting it, right?</p>
<p>No. And this has to do with the way Qt implements <code>QThread::wait()</code> which you should have probably used in the first place, if you really need this sort of functionality.</p>
<p>Qt hooks a pthread cleanup handler in the native thread which will call <code>wakeAll()</code> on a <code>QWaitCondition</code> stored inside the pimpl of <code>QThread</code>. And this pimpl &#8211; you might have guessed &#8211; is gone when you call <code>delete</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2010/09/the-qthread-anti-pattern/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>State of the GUPnP stack on Windows and other scary tales</title>
		<link>http://jensge.org/2010/08/state-of-the-gupnp-stack-on-windows-and-other-scary-tales/</link>
		<comments>http://jensge.org/2010/08/state-of-the-gupnp-stack-on-windows-and-other-scary-tales/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 22:21:36 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[OSS]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[UPnP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=446</guid>
		<description><![CDATA[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 &#8230; <a href="http://jensge.org/2010/08/state-of-the-gupnp-stack-on-windows-and-other-scary-tales/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>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.</p>
<p>I also deleted the gupnp-win32 repository on github. New development will go to <a href="http://gitorious.org/~phako/gupnp/phako-gupnp">this repository</a> on gitorious. There is still the <a href="http://github.com/phako/gssdp-win32">gssdp-win32 repository on github</a> since I have not yet taken care of the <a href="http://jensge.org/2009/09/is-that-all-bob/">MSVC additions</a>.</p>
<p>I also started wrapping gssdp et al into *mm (hey, I work for <a href="http://www.openismus.com">Openismus</a> now <img src='http://jensge.org/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  but this has proven to be somewhat difficult.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2010/08/state-of-the-gupnp-stack-on-windows-and-other-scary-tales/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Rygel XBox support update</title>
		<link>http://jensge.org/2010/03/rygel-xbox-support-update/</link>
		<comments>http://jensge.org/2010/03/rygel-xbox-support-update/#comments</comments>
		<pubDate>Sun, 14 Mar 2010 19:05:50 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Gnome]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programmieren]]></category>
		<category><![CDATA[UPnP]]></category>

		<guid isPermaLink="false">http://jensge.org/?p=388</guid>
		<description><![CDATA[XBox support still has not landed in rygel master, though the branch gets more stable currently. I put together a wiki page to describe the necessary quirks together with a helper script.]]></description>
			<content:encoded><![CDATA[<p>XBox support still has not landed in rygel master, though the branch gets more stable currently. I put together a <a href="http://live.gnome.org/Rygel/XBox360">wiki page</a> to describe the necessary quirks together with a helper script.</p>
]]></content:encoded>
			<wfw:commentRss>http://jensge.org/2010/03/rygel-xbox-support-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

