<?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>porges &#187; Mono</title>
	<atom:link href="http://porg.es/blog/tag/mono/feed" rel="self" type="application/rss+xml" />
	<link>http://porg.es/blog</link>
	<description></description>
	<lastBuildDate>Sun, 06 May 2012 22:13:57 +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>Implementing futures in C#</title>
		<link>http://porg.es/blog/implementing-futures-in-c</link>
		<comments>http://porg.es/blog/implementing-futures-in-c#comments</comments>
		<pubDate>Tue, 13 Feb 2007 08:03:15 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Reference]]></category>

		<guid isPermaLink="false">http://porg.es/blog/implementing-futures-in-c</guid>
		<description><![CDATA[Why? I was bored, and it didn&#8217;t seem to have been done before, so here&#8217;s some Future action in C#. The Code using System; using System.IO; using System.Reflection; using System.Threading; &#160; public class Future&#60;T&#62; &#123; public delegate R FutureDelegate&#60;R&#62;&#40;&#41;; public Future &#40;FutureDelegate&#60;T&#62; del&#41; &#123; Del = del; Result = del.BeginInvoke&#40;null,null&#41;; &#125; private FutureDelegate&#60;T&#62; Del; private [...]]]></description>
			<content:encoded><![CDATA[<h3>Why?</h3>
<p>I was bored, and it didn&#8217;t seem to have been done before, so here&#8217;s some <a href="http://en.wikipedia.org/wiki/Future_(programming)">Future</a> action in C#.</p>
<h3>The Code</h3>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.IO</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Reflection</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Threading</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> Future<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> <span style="color: #008000;">&#123;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">delegate</span> R FutureDelegate<span style="color: #008000;">&lt;</span>R<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> Future <span style="color: #008000;">&#40;</span>FutureDelegate<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> del<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                Del <span style="color: #008000;">=</span> del<span style="color: #008000;">;</span>
                Result <span style="color: #008000;">=</span> del<span style="color: #008000;">.</span><span style="color: #0000FF;">BeginInvoke</span><span style="color: #008000;">&#40;</span><span style="color: #0600FF; font-weight: bold;">null</span>,<span style="color: #0600FF; font-weight: bold;">null</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> FutureDelegate<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> Del<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> IAsyncResult Result<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> T PValue<span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #6666cc; font-weight: bold;">bool</span> HasValue <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">false</span><span style="color: #008000;">;</span>
        <span style="color: #0600FF; font-weight: bold;">private</span> T Value <span style="color: #008000;">&#123;</span>
                get <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>HasValue<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span><span style="color: #008000;">!</span>Result<span style="color: #008000;">.</span><span style="color: #0000FF;">IsCompleted</span><span style="color: #008000;">&#41;</span>
                                        Result<span style="color: #008000;">.</span><span style="color: #0000FF;">AsyncWaitHandle</span><span style="color: #008000;">.</span><span style="color: #0000FF;">WaitOne</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                PValue <span style="color: #008000;">=</span> Del<span style="color: #008000;">.</span><span style="color: #0000FF;">EndInvoke</span><span style="color: #008000;">&#40;</span>Result<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                                HasValue <span style="color: #008000;">=</span> <span style="color: #0600FF; font-weight: bold;">true</span><span style="color: #008000;">;</span>
                        <span style="color: #008000;">&#125;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> PValue<span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #0600FF; font-weight: bold;">implicit</span> <span style="color: #0600FF; font-weight: bold;">operator</span> T<span style="color: #008000;">&#40;</span>Future<span style="color: #008000;">&lt;</span>T<span style="color: #008000;">&gt;</span> f<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">return</span> f<span style="color: #008000;">.</span><span style="color: #0000FF;">Value</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">class</span> MainClass <span style="color: #008000;">&#123;</span>
        <span style="color: #008080; font-style: italic;">//This is purposely wasteful!</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">ulong</span> Fib<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">ulong</span> n<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>n <span style="color: #008000;">&gt;</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> Fib<span style="color: #008000;">&#40;</span>n<span style="color: #008000;">-</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">+</span>Fib<span style="color: #008000;">&#40;</span>n<span style="color: #008000;">-</span><span style="color: #FF0000;">2</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #0600FF; font-weight: bold;">if</span> <span style="color: #008000;">&#40;</span>n <span style="color: #008000;">==</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #FF0000;">1</span><span style="color: #008000;">;</span>
                <span style="color: #0600FF; font-weight: bold;">else</span> <span style="color: #008080; font-style: italic;">//n == 0</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #FF0000;">0</span><span style="color: #008000;">;</span>
        <span style="color: #008000;">&#125;</span>
        <span style="color: #008080; font-style: italic;">//Demo using futures.</span>
        <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;First, call synchronously.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>Fib<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">40</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Next, call asynchronously.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Future<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">ulong</span><span style="color: #008000;">&gt;</span> fib40 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&lt;</span><span style="color: #6666cc; font-weight: bold;">ulong</span><span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span>
                        <span style="color: #0600FF; font-weight: bold;">return</span> Fib<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">40</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Begins computing Fib(40) at this point...</span>
                Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1500</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Note that we can do other things in the mean time, and that the thread only blocks when we ask for the value.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>fib40<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Need it now!</span>
                Thread<span style="color: #008000;">.</span><span style="color: #0000FF;">Sleep</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">2000</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;We can then ask for the computed value as many times as we like.&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
                Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>fib40<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span> <span style="color: #008080; font-style: italic;">//Already computed.</span>
        <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

<h3>Caveats</h3>
<p>Most notably, this doesn&#8217;t do <a href="http://c2.com/cgi/wiki?PromisePipelining">promise pipelining</a> (and I doubt I could without some compiler magicking), so instead of nesting futures, you&#8217;ll want to seperate them out. That is; instead of:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">t3 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> x<span style="color: #008000;">.</span><span style="color: #0000FF;">a</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">.</span><span style="color: #0000FF;">c</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> y<span style="color: #008000;">.</span><span style="color: #0000FF;">b</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>&#8230;you&#8217;ll want to do:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">t1 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> x<span style="color: #008000;">.</span><span style="color: #0000FF;">a</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
t2 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> y<span style="color: #008000;">.</span><span style="color: #0000FF;">b</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
t3 <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> Future<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">delegate</span><span style="color: #008000;">&#123;</span><span style="color: #0600FF; font-weight: bold;">return</span> t1<span style="color: #008000;">.</span><span style="color: #0000FF;">c</span><span style="color: #008000;">&#40;</span>t2<span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></pre></div></div>

<p>&#8230;although you&#8217;d probably want to do this anyway if you don&#8217;t want to wander into The LispZone.</p>
]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/implementing-futures-in-c/feed</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Sans-serif fonts for coding</title>
		<link>http://porg.es/blog/sans-serif-fonts-for-coding</link>
		<comments>http://porg.es/blog/sans-serif-fonts-for-coding#comments</comments>
		<pubDate>Tue, 19 Sep 2006 00:41:30 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Mono]]></category>
		<category><![CDATA[Review]]></category>

		<guid isPermaLink="false">http://porg.es/blog/sans-serif-fonts-for-coding</guid>
		<description><![CDATA[After reading a post about colour schemes and font choices for use in an IDE, it seems I&#8217;m one of the only people on the planet that uses non-monospace fonts for coding. So, in the spirit of equal access, I&#8217;ve decided to try a couple of different fonts in MonoDevelop. While it doesn&#8217;t have the [...]]]></description>
			<content:encoded><![CDATA[<p>After reading <a href="http://www.codinghorror.com/blog/archives/000682.html">a post about colour schemes and font choices for use in an IDE</a>, it seems I&#8217;m one of the only people on the planet that uses non-monospace fonts for coding. So, in the spirit of equal access, I&#8217;ve decided to try a couple of different fonts in MonoDevelop. While it doesn&#8217;t have the greatest highlighting support at the moment, or any code folding (although I suspect these shortcomings are due to <code>libgtksourceview</code>), it&#8217;s still good enough for my purposes. My colour coding is based upon the default, but with blue keywords instead of green, and the comments changed to a light grey colour to make them more ignorable (the default is a bright blue which is quite startling).</p>
<p>First up is DejaVu Sans, which is my default sans-serif font on my system. It is quite plain looking which is possibly a good thing as it doesn&#8217;t distract from the task at hand. The &#8217;0&#8242; and &#8216;O&#8217; characters are different enough, but you may have problems with &#8216;I&#8217; and &#8216;l&#8217;.</p>
<p><img id="image82" src="http://porg.es/blog/wp-content/uploads/2006/09/dejavu2.png" alt="DejaVu font test" /></p>
<p>Next I tried Candara, which is a new font that is bundled with Windows Vista. It has a bit of character, but the <a href="http://en.wikipedia.org/wiki/Text_figures">text figures</a> are a bit distracting, and the punctuation really doesn&#8217;t fit in nicely with the rest of the font.</p>
<p><img id="image83" src="http://porg.es/blog/wp-content/uploads/2006/09/candara2.png" alt="Candara font test" /></p>
<p>Finally I picked <a href="http://www.urwpp.de/english/home.html">URW</a> Gothic. While this was just a test to see how extreme the fonts could be before they were completely unsuitable for coding, it turned out to work surprisingly well. The large open geometric shapes make for easy reading and the punctuation goes well with the other glyphs. The only problem I could identify is the square brackets looking too much like the rounded ones, but if you can get over that it looks like a very nice font to program with. In fact, I&#8217;ve just changed it to be the default in MonoDevelop.</p>
<p><img id="image84" src="http://porg.es/blog/wp-content/uploads/2006/09/gothic2.png" alt="Gothic font test" /></p>
<p>Of course, there are many other sans-serif fonts out there, but I picked these three as representative of several classes of styles. If anyone knows of sans-serif (or even serif!) non-monospace fonts that have been specifically designed for programming, I&#8217;d be glad to hear about them.</p>
]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/sans-serif-fonts-for-coding/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>DBus, Mono, Rhythmbox, and Beagle, Oh My!</title>
		<link>http://porg.es/blog/dbus-mono-rhythmbox-and-beagle-oh-my</link>
		<comments>http://porg.es/blog/dbus-mono-rhythmbox-and-beagle-oh-my#comments</comments>
		<pubDate>Fri, 15 Sep 2006 10:26:38 +0000</pubDate>
		<dc:creator>Porges</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mono]]></category>

		<guid isPermaLink="false">http://porg.es/blog/dbus-mono-rhythmbox-and-beagle-oh-my</guid>
		<description><![CDATA[So I had this idea of writing a quick search plugin for Beagle to search Rhythmbox&#8217;s current playlist titles. They would show up in the search GUI and then you&#8217;d double-click on one and it&#8217;d handle this (probably through a pseudo-URL like playlist://rhythmbox/my-playlist-name which seems to be the de facto standard amongst Beagle plugins) by [...]]]></description>
			<content:encoded><![CDATA[<p>So I had this idea of writing a quick search plugin for Beagle to search Rhythmbox&#8217;s current playlist titles. They would show up in the search GUI and then you&#8217;d double-click on one and it&#8217;d handle this (probably through a pseudo-URL like <code>playlist://rhythmbox/my-playlist-name</code> which seems to be the <i>de facto</i> standard amongst Beagle plugins) by sending a DBus event to Rhythmbox to start playing this playlist. Sounds simple enough.</p>
<h3>Promise</h3>
<p>First of all I headed over to the Beagle site. It turns out that if you want to do more than handle a specific file-type (not an option in this case because the playlists are stored as <code>.xml</code>) you create not a &#8220;Filter&#8221; but a &#8220;Queryable&#8221;. Unfortunately the Queryable HowTo is <a href="http://beagle-project.org/index.php?title=Queryable_HOWTO">still being written</a>. Nevermind, I can always ask on the mailing list, and taking a look through the tutorial for Filters shows that the API for that is nice and clean and should be similar for the Queryables.</p>
<p>Next I try to find a reference for the C# DBus bindings. I install the Monodoc documentation for DBus, only to discover everything marked with &#8220;Documentation for this section has not yet been entered&#8221;&mdash;the default message for undocumented functions, classes, and so on. Nevertheless, I find <a href="http://www.electricrelaxation.com/2006/09/08/rhythmbox-toggle-showhide-using-dbus-and-python">a short tutorial on how to use Python with DBus to control Rhythmbox</a>. The class names and functions seem to have similar titles in C#, so I figure this will map fairly directly.</p>
<p>Finding the DBus reference for Rhythmbox takes a fair bit more effort, trawling through mailing list archives on Google. Eventually I find the DBus APIs hiding in a couple of <code>.xml</code> files in the CVS repositories; <a href="http://cvs.gnome.org/viewcvs/*checkout*/rhythmbox/shell/rb-playlist-manager.xml?content-type=text%2Fplain"><code>org.gnome.Rhythmbox.PlaylistManager</code></a> looks promising.</p>
<h3>Misfortune</h3>
<p>Unfortunately, I find a <a href="http://blogs.gnome.org/view/tko/2006/07/27/">post by a last-exit hacker</a> in which he states (my emphasis):</p>
<blockquote><p>As I was told <em>DBus C# bindings are unusable</em> I went on about writing DBus# objects the hard way.</p></blockquote>
<p>What? This can&#8217;t be right, I&#8217;ve already written a little test program:</p>
<pre><code>using System;
using DBus;

namespace RhythmboxQuery
{
   class MainClass
   {
      public static void Main(string[] args)
      {
         Connection bus = Bus.GetSessionBus();
         try {
            Service rhythmbox = Service.Get(bus,"org.gnome.Rhythmbox");
         } catch (ApplicationException ex) {
            Console.WriteLine("Rhythmbox not started: " + ex);
            return;
         }
         Console.WriteLine("Found Rhythmbox.");
         /*

         Okay, so all I need to do now is to call `getPlaylists` on:
         /org/gnome/Rhythmbox/PlaylistManager

         */
         Console.WriteLine("Uhoh.");
      }
   }
}</code></pre>
<p>Despite my valiant attempts to stave off the past through trivial C# programs, the DBus site <a href="http://www.freedesktop.org/wiki/Software_2fDBusBindings">confirms the aforementioned revelation</a>:</p>
<blockquote><p>They are schedualed to be removed from the core but has yet to find a maintainer. [sic]</p></blockquote>
<h3>Epilogue</h3>
<p>As it turns out, what I had been planning to do would have been impossible anyway because the Rhythmbox DBus bindings lack a <code>PlayPlaylist</code> function in any of the three interfaces. Also, it seems that DBus under C# only plays nicely with C# objects that you have access to&mdash;but this could be just because I couldn&#8217;t find a single example of how to call methods on non-C# DBus applications.</p>
<p>Ah well, that Beagle Filter API did seem quite nice anyway, I wonder if there are any filetypes I could parse out there&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://porg.es/blog/dbus-mono-rhythmbox-and-beagle-oh-my/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

