<?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>Shtééf</title>
	<atom:link href="http://stephan.kochen.nl/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://stephan.kochen.nl/blog</link>
	<description></description>
	<lastBuildDate>Fri, 22 Jan 2010 13:38:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>POST requests and character encoding</title>
		<link>http://stephan.kochen.nl/blog/2010/01/22/post-requests-and-character-encoding/</link>
		<comments>http://stephan.kochen.nl/blog/2010/01/22/post-requests-and-character-encoding/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 13:38:05 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=72</guid>
		<description><![CDATA[While trying to eliminate all character encoding problems in my Rails application, I stumbled upon the problem of POST requests and their encoding. The problem with these requests is that, when a very basic HTML form is submitted, some browsers do not indicate the character encoding of the data in the request at all. I [...]]]></description>
			<content:encoded><![CDATA[	<p>While trying to eliminate all character encoding problems in my Rails application, I stumbled upon the problem of <span class="caps">POST</span> requests and their encoding. The problem with these requests is that, when a very basic <span class="caps">HTML</span> form is submitted, some browsers do not indicate the character encoding of the data in the request at all. I tested this on Firefox 3.6.</p>

	<p>Most of the info I could find on this simply claims that the encoding of the <span class="caps">POST</span> request is the same as the page that contained the submitted form. Therefor, if you serve pages as <span class="caps">UTF</span>-8, any forms that are submitted back to you will also be in <span class="caps">UTF</span>-8.</p>

	<p>That may be true, but that doesn&#8217;t really help you, if you&#8217;re an idealist who wants to treat the <span class="caps">HTTP</span> request like the stateless request that it really is. Such as yours truly.</p>

	<p>Looking around in specs, there are two methods a browser can use to indicate the character encoding in a <span class="caps">POST</span> request:<br />
<ul></p>
	<p><li>By specifying it in the Content-Type header, such as &#8220;application/x-www-form-urlencoded; charset=UTF-8&#8221;. It looks like there&#8217;s <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=7533">a Mozilla bug</a> from back in 1999, in which this was discussed. Eventually, they didn&#8217;t opt for this method because it caused breakage on several <span class="caps">HTTP</span> server implementations at the time.</li><br />
<li>For forms that use the application/x-www-form-urlencoded encoding (most forms that don&#8217;t do file uploads), a hidden field named &#8216;_charset_&#8217; can be included. Browsers will override its value on submission with the encoding used. This will be in <span class="caps">HTML5</span>, and you can <a href="http://dev.w3.org/html5/spec/forms.html#application-x-www-form-urlencoded-encoding-algorithm">find it in the current draft</a>.</li><br />
</ul></p>

	<p>Neither of these methods are handled by Rails or Rack for Ruby 1.9, and all you get is strings with the #encoding set to US-ASCII, while the string actually contains <span class="caps">UTF</span>-8. A nice contradiction and source of exceptions elsewhere deep in your application.</p>

	<p>I set out to get this sorted in my app, and wrote a monkey-patch. The patch automatically adds the hidden field when using FormHelper, and tries to deal with both that field and the Content-Type header in requests. It&#8217;s been briefly tested in Firefox 3.6 only. You can find it in a <a href="http://gist.github.com/283755">gist on Github</a>.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2010/01/22/post-requests-and-character-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache locale trickery in Ubuntu</title>
		<link>http://stephan.kochen.nl/blog/2010/01/22/apache-locale-trickery-in-ubuntu/</link>
		<comments>http://stephan.kochen.nl/blog/2010/01/22/apache-locale-trickery-in-ubuntu/#comments</comments>
		<pubDate>Fri, 22 Jan 2010 09:31:36 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=67</guid>
		<description><![CDATA[The default Apache install in Ubuntu, and probably Debian too, contains a config file /etc/apache2/envvars which I have consistently ignored. I can&#8217;t remember ever having to deal with environment variables in a web application before. But now I had to, and not realizing it, I spent a good hour fighting a vague problem from various [...]]]></description>
			<content:encoded><![CDATA[	<p>The default Apache install in Ubuntu, and probably Debian too, contains a config file /etc/apache2/envvars which I have consistently ignored. I can&#8217;t remember ever having to deal with environment variables in a web application before.</p>

	<p>But now I had to, and not realizing it, I spent a good hour fighting a vague problem from various angles, before I finally made the breakthrough.</p>

	<p>This config file contains a line &#8220;LANG=C&#8221; by default. This has many consequences, but one of them is that all file operations in Ruby 1.9 expect files to be in <span class="caps">ASCII</span> encoding, while the rest of the system operates in <span class="caps">UTF</span>-8.</p>

	<p>I ran into this with a Rails application hosted in Apache with Passenger, and a view containing non-ASCII characters. Ruby&#8217;s errors when it encounters incompatible encodings are&#8230; very terse.</p>

	<p>But I imagine the reason that particular line in that particular config file is really there, because someone else banged his or her head against a wall for a good hour too, because <span class="caps">LANG </span><strong>wasn&#8217;t</strong> C.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2010/01/22/apache-locale-trickery-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Of fighting piracy and spam</title>
		<link>http://stephan.kochen.nl/blog/2009/10/24/of-fighting-piracy-and-spam/</link>
		<comments>http://stephan.kochen.nl/blog/2009/10/24/of-fighting-piracy-and-spam/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 16:21:33 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=53</guid>
		<description><![CDATA[Here&#8217;s a thought. If we applied the same ferocity the media industry has applied to fighting piracy, to fighting spam instead, how much better would our internet be? If we were to make a list of every IP address of an SMTP server or rogue machine filling our inbox with spam, or of a machine [...]]]></description>
			<content:encoded><![CDATA[	<p>Here&#8217;s a thought.</p>

	<p>If we applied the same ferocity the media industry has applied to fighting piracy, to fighting spam instead, how much better would our internet be?</p>

	<p>If we were to make a list of every IP address of an <span class="caps">SMTP</span> server or rogue machine filling <strong>our</strong> inbox with spam, or of a machine probing and brute-forcing for <span class="caps">SSH</span> access to <strong>our</strong> systems, or attempting to exploit vulnerabilites in <strong>our</strong> HTTP servers, <span class="caps">FTP</span> servers, <span class="caps">SMB</span> servers, you name it.</p>

	<p>And then we would go and send abuse mail to providers of <strong>every single one of them</strong>. With logs. Detailed. And thorough inquiries after the perpetrator&#8217;s identity.</p>

	<p>And we would go all the way to take legal action against these basement crawlers or their shady providers.</p>

	<p><h5>Point is&#8230;</h5></p>

	<p>We take an awful lot of this crap as just an everyday chore for our systems to deal with, and put all of our services in virtual bunkers to prevent anything bad from happening because of it. Which is good sysadmin practice, of course, but&#8230;</p>

	<p>Then there&#8217;s nobody putting these guys on the stand for what they are doing. And it piles up. This often isn&#8217;t even that far from our doorstep. Most of the attacks on the systems I manage are from elsewhere in continental Europe.</p>

	<p>And furthermore, these things or not legally grey, like some of the things the media industry is pursuing. But <strong>pitch black</strong>, as far as I know.</p>

	<p>So why does it take such incredible effort to get back at these people?</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2009/10/24/of-fighting-piracy-and-spam/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>A strange concoction</title>
		<link>http://stephan.kochen.nl/blog/2009/06/06/a-strange-concoction/</link>
		<comments>http://stephan.kochen.nl/blog/2009/06/06/a-strange-concoction/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 21:22:26 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=35</guid>
		<description><![CDATA[Libvirtweb is a bland and unoriginal name for a spiffy new web interface to libvirt. Huzzah, I am releasing something! This is an early prototype kind of thing. Here&#8217;s what it looks like: You will find the code and some quick instructions are hosted at Github: http://github.com/stephank/libvirtweb/ The rest of this post is some background. [...]]]></description>
			<content:encoded><![CDATA[	<p>Libvirtweb is a bland and unoriginal name for a spiffy new web interface to libvirt. Huzzah, I am releasing something!</p>

	<p>This is an early prototype kind of thing. Here&#8217;s what it looks like:</p>

	<img class="size-medium wp-image-36" title="A quick glance of libvirtweb" src="http://stephan.kochen.nl/blog/wp-content/uploads/2009/06/libvirtweb-300x277.png" alt="libvirtweb viewing the console of a domain over an SSH tunnel" width="300" height="277" />

	<p>You will find the code and some quick instructions are hosted at Github:<br />
<a href="http://github.com/stephank/libvirtweb/"> http://github.com/stephank/libvirtweb/</a></p>

	<p>The rest of this post is some background.</p>

	<p><h3>Our office is a battlefield split in two</h3></p>

	<p>On the one side, there&#8217;s Linux on the desktop, Mac <span class="caps">OS X</span> on the desktop, Linux machines powering all primary services we sell. And then on the other, Microsoft Exchange, and Windows administrators. Sarcastic retorts and counter retorts go back and forth.</p>

	<p>So far, this is holding up fairly okayish. There&#8217;s just one piece of iron powering our office, and a Windows virtual machine gobbling up about half of it&#8217;s resources.</p>

	<p>We&#8217;ve tried a couple of alternative virtualization technologies, but surprisingly, an Ubuntu Server install with <span class="caps">KVM</span> was the most stable of all! Now comes the problem of colleagues wanting to manage the thing from their Windows desktops.</p>

	<p>Turns out it was a good choice not to make Windows the host. When we doubled up the processor, we found our Windows license goes up to just 4 cores. Score one for the *nix side.</p>

	<p><h3>Face to face with libvirt</h3></p>

	<p>No doubt one of nastiest obstacles in creating this was libvirt. When you look at it&#8217;s goals from a high level (a <em>very very</em> high level), it sounds nice: a single <span class="caps">API</span> to manage virtual machines of any kind.</p>

	<p>In practice, that has become a single <span class="caps">API</span> to manage local <em>and</em> remote iron over <em>various types</em> of connections and tunnels, and running <em>various</em> virtualization technologies. All that in a <em>blocking</em> fashion. Hell, I can&#8217;t even imagine how to do all that in a nice asynchronous <span class="caps">API</span>.</p>

	<p>It looks like the only useful thing the libvirt <span class="caps">API</span> can be used for is to script some things in Python. And the Python bindings are <em>very</em> limited. Scripting things in bash works just as well using virsh.</p>

	<p>If I had a say in it, the libvirtd daemon would not be optional, and would simply expose a DBus <span class="caps">API</span>. Rather like NetworkManager.</p>

	<p><h3>Mixing Twisted and CherryPy</h3></p>

	<p>The above is written in Twisted and CherryPy. However, when dealing with <span class="caps">SSH</span> tunnels, I had to find a way to take the tunnel out of the equation for the browser. The approach I took is a proxy for the <span class="caps">RFB</span> protocol, which is what is used to view consoles in <span class="caps">KVM</span> and <span class="caps">QEMU</span>.</p>

	<p>Adding an <span class="caps">RFB</span> server to a CherryPy server is not really one of CherryPy&#8217;s use cases. However, CherryPy can be treated like a <span class="caps">WSGI</span> application. This allowed me to host CherryPy in a twisted.web.wsgi.WSGIResource, and mix the rest of my Twisted components with the webapp.</p>

	<p>Using CherryPy as a <span class="caps">WSGI</span> application, and specifically in Twisted, is not really documented well anywhere. So here&#8217;s a snippit of code to do it. This is based on CherryPy 3.1.2 and Twisted 8.2.0.</p>

<pre>#!/usr/bin/env python

import cherrypy
from twisted.internet import reactor
from twisted.web import wsgi, server
from twisted.python import threadpool

# Here's our hello world CherryPy application
class Root(object):
   @cherrypy.expose
   def index(self):
      return "Hello world!"

# Use the 'embedded' configuration template
cherrypy.config.update({'environment': 'embedded'})
# We need to unsubscribe the CherryPy server to prevent a port conflict
cherrypy.server.unsubscribe()
# Start CherryPy internals
cherrypy.engine.start()
# Make sure we shut down CherryPy when we're done
reactor.addSystemEventTrigger('after', 'shutdown', cherrypy.engine.exit)

# Create a WSGI callable from our application
app = cherrypy.Application(Root())
# Twisted needs a threadpool to run WSGI applications
threads = threadpool.ThreadPool()
threads.start()
# Make sure we shut this down too
reactor.addSystemEventTrigger('after', 'shutdown', threads.stop)

# Setup the twisted.web factory, and listen on 8080
resource = wsgi.WSGIResource(reactor, threads, app)
factory = server.Site(resource, 'server.log')
reactor.listenTCP(8080, factory)

# The main loop
reactor.run()</pre>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2009/06/06/a-strange-concoction/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Wii, Linux and OpenEmbedded</title>
		<link>http://stephan.kochen.nl/blog/2008/07/22/wii-linux-and-openembedded/</link>
		<comments>http://stephan.kochen.nl/blog/2008/07/22/wii-linux-and-openembedded/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 18:15:43 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=34</guid>
		<description><![CDATA[In the spirit of &#8220;Don&#8217;t ever finish my last project and move on to the next&#8221;, I have been hacking away on Nintendo Wii related stuff again lately. I wanted to give kernel hacking a shot, and my first step was supposed to be setting up an easy to use build environment. I went beyond [...]]]></description>
			<content:encoded><![CDATA[	<p>In the spirit of <em>&#8220;Don&#8217;t ever finish my last project and move on to the next&#8221;</em>, I have been hacking away on Nintendo Wii related stuff again lately. I wanted to give kernel hacking a shot, and my first step was supposed to be setting up an easy to use build environment.</p>

	<p>I went beyond that, and here is bit of work I&#8217;d like to call <a href="http://stephan.kochen.nl/proj/wii-oe/">Whiite-OE</a>. It&#8217;s an integration of the <a href="http://gc-linux.org">Whiite</a> Linux kernel patches for Nintendo Wii support, with the <a href="http://www.openembedded.org/">OpenEmbedded</a> cross compile environment.</p>

	<p>Find it at: <a href="http://stephan.kochen.nl/proj/wii-oe/">http://stephan.kochen.nl/proj/wii-oe/</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/07/22/wii-linux-and-openembedded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Late responding</title>
		<link>http://stephan.kochen.nl/blog/2008/06/15/late-responding/</link>
		<comments>http://stephan.kochen.nl/blog/2008/06/15/late-responding/#comments</comments>
		<pubDate>Sun, 15 Jun 2008 12:01:07 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/?p=33</guid>
		<description><![CDATA[A couple of emails and comments got lost at some point and I&#8217;m late-responding to them. Most are about projects I blogged about but have not worked on since. Eoin Hennessy has taken over GstRaopSink development. He actually got it up and running, and set up a git repository with the code. I was also [...]]]></description>
			<content:encoded><![CDATA[	<p>A couple of emails and comments got lost at some point and I&#8217;m late-responding to them. Most are about projects I blogged about but have not worked on since.</p>

	<p>Eoin Hennessy has taken over GstRaopSink development. He actually got it up and running, and set up <a href="http://code.randomrules.org/gitweb/?p=gstraopsink">a git repository with the code</a>.</p>

	<p>I was also requested to publish the source code of the Nurikabe generator. The co-author, Vladimir Panteleev, was okay with it, so I uploaded <a href="http://stephan.kochen.nl/proj/nurikabe.tar.gz">the source code</a> of the generator and half-done <span class="caps">GUI</span> with a GPLv3 license.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/06/15/late-responding/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>In the spotlight</title>
		<link>http://stephan.kochen.nl/blog/2008/04/02/in-the-spotlight/</link>
		<comments>http://stephan.kochen.nl/blog/2008/04/02/in-the-spotlight/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 20:01:55 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/2008/04/02/in-the-spotlight/</guid>
		<description><![CDATA[I&#8217;d like to take a moment and briefly blog on a different subject. My brother is getting up to speed performing as a DJ again, going by the stage name Eric Preston. If you&#8217;re into minimal techno, you&#8217;ll definitely want to tune in to his monthly livemixes at ericprestonmusic.com. The first of which is now [...]]]></description>
			<content:encoded><![CDATA[	<p>I&#8217;d like to take a moment and briefly blog on a different subject. <img src='http://stephan.kochen.nl/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>

	<p>My brother is getting up to speed performing as a DJ again, going by the stage name <em>Eric Preston</em>. If you&#8217;re into minimal techno, you&#8217;ll definitely want to tune in to his monthly livemixes at <a href="http://www.ericprestonmusic.com/">ericprestonmusic.com</a>. The first of which is now available for free. I think you&#8217;ll be pleasantly surprised. <img src='http://stephan.kochen.nl/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/04/02/in-the-spotlight/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Tracing GTK+ drawing operations</title>
		<link>http://stephan.kochen.nl/blog/2008/02/10/tracing-gtk-drawing-operations/</link>
		<comments>http://stephan.kochen.nl/blog/2008/02/10/tracing-gtk-drawing-operations/#comments</comments>
		<pubDate>Sun, 10 Feb 2008 10:44:35 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/2008/02/10/tracing-gtk-drawing-operations/</guid>
		<description><![CDATA[I spent last week messing around in Python with a concept I had in the back of my head, and a problem I bumped into was figuring out what widget was drawing what on the screen in GTK+. So yesterday I sat down and wrote a set of tools to do that. First part is [...]]]></description>
			<content:encoded><![CDATA[	<p>I spent last week messing around in Python with a concept I had in the back of my head, and a problem I bumped into was figuring out what widget was drawing what on the screen in <span class="caps">GTK</span>+. So yesterday I sat down and wrote a set of tools to do that.</p>

	<p>First part is <a href="http://stephan.kochen.nl/proj/gtk-paint-trace/paint_trace.gdb">a <span class="caps">GDB</span> script</a> that automates the process of breaking on a gtk_paint_* operation and dumping the necessary information. This was written with <a href="http://www.stellingwerff.com/?page_id=10">The Widget Factory</a> in mind, so if your application needs parameters, or is written in Python, it needs adjustment. I&#8217;ve also uploaded some <a href="http://stephan.kochen.nl/proj/gtk-paint-trace/gdb.txt.gz">gzipped sample output</a> of The Widget Factory.</p>

	<p>Second part is <a href="http://stephan.kochen.nl/proj/gtk-paint-trace/paint_trace_parse.py">a Python script</a> that reads the redirected <span class="caps">GDB</span> output and visualizes it like so: (click the thumbnail for the full version)</p>

	<p><a href="http://stephan.kochen.nl/imgs/gtk-paint-trace.png"><img src="http://stephan.kochen.nl/imgs/gtk-paint-trace-thumb.png" alt="Screenshot" /></a></p>

	<p>It doesn&#8217;t draw images, text or polygons, but it shows most of the original. I found it helpful in figuring out what kind of calls widgets make when drawing, but also seeing from the theme engine point of view how the methods are invoked.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/02/10/tracing-gtk-drawing-operations/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>GTK+ theme translucency</title>
		<link>http://stephan.kochen.nl/blog/2008/01/14/gtk-theme-translucency/</link>
		<comments>http://stephan.kochen.nl/blog/2008/01/14/gtk-theme-translucency/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 18:55:43 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/2008/01/14/gtk-theme-translucency/</guid>
		<description><![CDATA[Translucency in GTK+ theme engines, as presented by a Murrine developer, is really nothing special. In fact, it&#8217;s overhyped. (Blog posts, news articles, etc.) It&#8217;s been around since day one when GDK implemented RGBA visual and Cairo support. Here&#8217;s the Mist engine with a translucent background: The big problem is, and Cimi&#8217;s blog post does [...]]]></description>
			<content:encoded><![CDATA[	<p>Translucency in <span class="caps">GTK</span>+ theme engines, <a href="http://www.cimitan.com/blog/2007/12/12/gtk-rgba-transparent-widgets-with-the-murrine-engine">as presented by a Murrine developer</a>, is really nothing special. In fact, it&#8217;s overhyped. (Blog posts, news articles, etc.) It&#8217;s been around since day one when <span class="caps">GDK</span> implemented <span class="caps">RGBA</span> visual and Cairo support.</p>

	<p>Here&#8217;s the Mist engine with a translucent background:<br />
<a href="http://stephan.kochen.nl/imgs/gtk-translucent-mist.png"><img src="http://stephan.kochen.nl/imgs/gtk-translucent-mist-thumb.png" alt="Screenshot of a translucent Mist engine."/></a></p>

	<p>The big problem is, and Cimi&#8217;s blog post does mention this: it needs application support. The theme engine can easily detect and perform drawing with translucency, but it&#8217;s up to the application to actually enable it. One way to do this is using a snippit of code like this, after gtk_init and before any windows are created:</p>

<pre>
 GdkDisplay* display = gdk_display_get_default ();
 gint nscreens = gdk_display_get_n_screens (display);
 for (gint i = 0; i &lt; nscreens; i++)
 {
     GdkScreen* screen = gdk_display_get_screen (display, i);
     GdkColormap* rgbamap = gdk_screen_get_rgba_colormap (screen);
     if (rgbamap != NULL)
         gdk_screen_set_default_colormap (screen, rgbamap);
 }
</pre>

	<p>Another way to do this, is to patch <span class="caps">GTK</span>+ itself to prefer <span class="caps">RGBA</span> surfaces over the trusty old <span class="caps">RGB</span> surfaces. Trusty, because <span class="caps">RGBA</span> still tends to break some applications, and probably some <span class="caps">GTK</span>+ custom widgets as well.</p>

	<p>So to get translucency, either all applications need to be patched, or <span class="caps">GTK</span>+ needs to break compatibility. Patching all applications is a rather stupid option, if we have to do that anyways once <span class="caps">GTK</span>+ breaks compatibility. I say it&#8217;s about time for <span class="caps">GTK</span>+ 3.0. <img src='http://stephan.kochen.nl/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>

	<p>Though I think it&#8217;s overhyped, I guess that it will end up to be a good thing. Maybe we will finally get a push for more of this great bling in <span class="caps">GTK</span>+.</p>

	<p>By the way, here&#8217;s the patch against gtk-engines trunk for the above screenshot of translucent Mist:<br />
<a href="http://stephan.kochen.nl/proj/gtk-translucent-mist.patch">http://stephan.kochen.nl/proj/gtk-translucent-mist.patch</a></p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/01/14/gtk-theme-translucency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Monkey surprise</title>
		<link>http://stephan.kochen.nl/blog/2008/01/08/monkey-surprise/</link>
		<comments>http://stephan.kochen.nl/blog/2008/01/08/monkey-surprise/#comments</comments>
		<pubDate>Tue, 08 Jan 2008 15:01:33 +0000</pubDate>
		<dc:creator>Stéphan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://stephan.kochen.nl/blog/2008/01/08/monkey-surprise/</guid>
		<description><![CDATA[The last couple of weeks I&#8217;ve spent working with C#. I had already seen and worked with it before, during my study, but this time I worked on a personal project. I&#8217;ll make another post about the project itself in the future, but now I&#8217;d like to write about C# itself and the platform surrounding [...]]]></description>
			<content:encoded><![CDATA[	<p>The last couple of weeks I&#8217;ve spent working with C#. I had already seen and worked with it before, during my study, but this time I worked on a personal project. I&#8217;ll make another post about the project itself in the future, but now I&#8217;d like to write about C# itself and the platform surrounding it.</p>

	<p>I&#8217;m normally a bit skeptical of anything Microsoft produces, but I&#8217;ll say C# is a rather nice language in itself; a bit more so than Java. There&#8217;s nothing spectacular about it, but it does offer some things that would make me prefer it over Java. I&#8217;m thinking small things like events, readonly fields, and no silly restriction of one class per unit.</p>

	<p>That&#8217;s just the language, though. I don&#8217;t feel like judging the standard libraries. But I can say that I&#8217;ve had no significant dissappointment there either.</p>

	<p>What this post is really about, however, and what gets me quite excited, is <a href="http://monodevelop.com/">MonoDevelop</a>. I dare say that this is shaping up to be <strong>the</strong> integrated Rapid Application Development environment for <span class="caps">GNOME</span>. It&#8217;s a bit buggy, I still can&#8217;t find any debugger integration (but saw screenshots of work in progress months ago, so I guess it&#8217;s in the pipeline), but altogether I really wouldn&#8217;t be able to point out any other <span class="caps">IDE</span> quite like it. And this comes from someone who&#8217;s otherwise quite firmly in the Eclipse camp when it comes to Java, Python, C/C++ and D.</p>

	<p>The builtin <span class="caps">GUI</span> builder Stetic works well, writing signal handling code is a snap, other features I expect from an <span class="caps">IDE</span> are there as well: refactoring, class browser, compiler error parsing, code completion, etc. Perhaps the only thing really missing is the debugger integration.</p>

	<p>Even tough the project I&#8217;m working on has both a Windows Forms and <span class="caps">GTK</span># front-end, development primarily takes place in MonoDevelop. Updating the Windows Forms front-end is often postponed until right before a release. <img src='http://stephan.kochen.nl/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>

	<p>So that&#8217;s it. I just wanted to dedicate a post to this great emerging platform.</p>
 ]]></content:encoded>
			<wfw:commentRss>http://stephan.kochen.nl/blog/2008/01/08/monkey-surprise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
