<?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>Intrepid Blog</title>
	<atom:link href="http://blog.affien.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.affien.com</link>
	<description>A few thoughts</description>
	<lastBuildDate>Tue, 30 Jun 2009 15:58:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>PijsMarietje</title>
		<link>http://blog.affien.com/archives/2009/06/30/pijsmarietje/</link>
		<comments>http://blog.affien.com/archives/2009/06/30/pijsmarietje/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:58:44 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=395</guid>
		<description><![CDATA[At the faculty for sciences there are canteens for students.  In each of these, there&#8217;s sound equipment connected to linux boxes.  On each of those linux boxes, we run a music-request-server called Marietje.  I just finished writing a front-end in Javascript.  It wasn&#8217;t a pain.  As instead, the use of [...]]]></description>
			<content:encoded><![CDATA[<p>At the faculty for sciences there are canteens for students.  In each of these, there&#8217;s sound equipment connected to linux boxes.  On each of those linux boxes, we run a music-request-server called <em>Marietje</em>.  I just finished writing a front-end in Javascript.  It wasn&#8217;t a pain.  As instead, the use of <a href="http://jquery.com/">jQuery</a> was a bliss.</p>
<p><a href="http://zuidslet.science.ru.nl:8080/">The frontend for one of those boxes</a> and <a href="http://w-nz.com/cgi-bin/gitweb.cgi?p=maried.git;a=summary">the source code</a> (see the <code>ajax</code> folder).</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/06/30/pijsmarietje/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Damned DOM (1)</title>
		<link>http://blog.affien.com/archives/2009/06/22/damned-dom-1/</link>
		<comments>http://blog.affien.com/archives/2009/06/22/damned-dom-1/#comments</comments>
		<pubDate>Mon, 22 Jun 2009 14:34:51 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[stupid]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=391</guid>
		<description><![CDATA[When I wanted to react to any changes to a input textbox immediately, my first instrinct was to use onChange.  onChange, however, is called when the input loses focus.  onKeyPress then?  Isn&#8217;t called on backspaces.  onKeyDown, maybe?  It does get called, but the effect of the keystroke isn&#8217;t yet applied, [...]]]></description>
			<content:encoded><![CDATA[<p>When I wanted to react to any changes to a <code>input</code> textbox immediately, my first instrinct was to use <code>onChange</code>.  <code>onChange</code>, however, is called when the <code>input</code> loses focus.  <code>onKeyPress</code> then?  Isn&#8217;t called on backspaces.  <code>onKeyDown</code>, maybe?  It does get called, but the effect of the keystroke isn&#8217;t yet applied, for the return value determines whether it that is done in the first place. (Same story for <code>onKeyPress</code> by the way.) <code>onKeyUp</code> does work a bit, except if someone is holding down a single key, for a while.</p>
<p>The solution: hook <code>onKeyUp</code> and use <code>setTimeout</code> with a timeout of 0.  Yugh.  I hate DOM.</p>
<p><em><ins>Big Fat Disclaimer</ins>: I actually tested this only on one browser.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/06/22/damned-dom-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unicode to ASCII (1)</title>
		<link>http://blog.affien.com/archives/2009/06/19/unicode-to-ascii-1/</link>
		<comments>http://blog.affien.com/archives/2009/06/19/unicode-to-ascii-1/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 13:19:10 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[unicode]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=387</guid>
		<description><![CDATA[When I want to generate usernames from real names, which can contain non-ascii characters, you can&#8217;t simply ignore the unicode characters.  For instance, danielle@blaat.org is the right e-mail address for Daniëlle, danille@blaat.org isn&#8217;t.
There&#8217;s  trick.  Unicode has got a single code for ë itself, but it has also got a code which (simplified) [...]]]></description>
			<content:encoded><![CDATA[<p>When I want to generate usernames from real names, which can contain non-ascii characters, you can&#8217;t simply ignore the unicode characters.  For instance, danielle@blaat.org is the right e-mail address for Daniëlle, danille@blaat.org isn&#8217;t.</p>
<p>There&#8217;s  trick.  Unicode has got a single code for ë itself, but it has also got a code which (simplified) adds ¨ on top of the previous character.  The unicode standard defines a normal form in which (at least) all such characters, which can be, are represented using such modifiers.  If you then simply ignore the non-ascii representable codes, you&#8217;ll get the desired result.</p>
<p>In python: <code>unicodedata.normalize('NFKD', txt).encode('ASCII', 'ignore')</code>.</p>
<p>However, this isn&#8217;t <em>the</em> right solution. For instance, in german, one prefers ue as a replacement of ü over u.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/06/19/unicode-to-ascii-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Django annoyances: no reverse select_related</title>
		<link>http://blog.affien.com/archives/2009/05/30/django-annoyances-no-reverse-select_related/</link>
		<comments>http://blog.affien.com/archives/2009/05/30/django-annoyances-no-reverse-select_related/#comments</comments>
		<pubDate>Sat, 30 May 2009 13:48:45 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[select_related]]></category>
		<category><![CDATA[stupid]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=380</guid>
		<description><![CDATA[Consider
for page in Page.objects.all():
&#160;&#160;print page.title
&#160;&#160;for comment in page.comments.all():
&#160;&#160;&#160;&#160;print comment.
There will be a single query to fetch all pages, but there will be for every page another query to fetch its comments.  Luckily, Django has got a nice trick up its sleave: select_related.  Would I use instead of Page.objects.all(), Page.objects.select_related('comments').all() then Django will use [...]]]></description>
			<content:encoded><![CDATA[<p>Consider</p>
<p><code>for page in Page.objects.all():<br />
&nbsp;&nbsp;print page.title<br />
&nbsp;&nbsp;for comment in page.comments.all():<br />
&nbsp;&nbsp;&nbsp;&nbsp;print comment</code>.</p>
<p>There will be a single query to fetch all pages, but there will be for every page another query to fetch its comments.  Luckily, Django has got a nice trick up its sleave: <code>select_related</code>.  Would I use instead of <code>Page.objects.all()</code>, <code>Page.objects.select_related('comments').all()</code> then Django will use a single joined query to prefetch comments for each page.</p>
<p>However, Django&#8217;s <code>select_related</code> only supports forward one-to-many references.  No many-to-many; certainly no reverce many-to-many; no reverse one-to-many and no, not even reverse one-to-one (<a href="http://code.djangoproject.com/ticket/7270">yet</a>).  <a href="http://code.djangoproject.com/ticket/2238">A developer</a> claims it&#8217;s impossible (which is bullshit), <a href="http://code.djangoproject.com/ticket/9166">another</a> asks for patches, which means he doesn&#8217;t care doing it himself.</p>
<p>It&#8217;s quite easy to manually code around the missing reverse <code>select_related</code>, but it takes too many ugly lines compared to the single word it could&#8217;ve been.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/05/30/django-annoyances-no-reverse-select_related/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Javascript&#8217;s stupid Date constructor</title>
		<link>http://blog.affien.com/archives/2009/04/29/javascripts-stupid-date-constructor/</link>
		<comments>http://blog.affien.com/archives/2009/04/29/javascripts-stupid-date-constructor/#comments</comments>
		<pubDate>Wed, 29 Apr 2009 16:27:42 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[stupid]]></category>

		<guid isPermaLink="false">http://blog.affien.com/archives/2009/04/29/javascripts-stupid-date-constructor/</guid>
		<description><![CDATA[new Date(2009, 1, 1) represents the first of February 2009.  Not the second of February nor the first of January.  Why this stupidity?
]]></description>
			<content:encoded><![CDATA[<p><code>new Date(2009, 1, 1)</code> represents the first of February 2009.  Not the second of February nor the first of January.  Why this stupidity?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/04/29/javascripts-stupid-date-constructor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>GStreamer: accurate duration</title>
		<link>http://blog.affien.com/archives/2009/04/19/gstreamer-accurate-duration/</link>
		<comments>http://blog.affien.com/archives/2009/04/19/gstreamer-accurate-duration/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 13:26:01 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[duration]]></category>
		<category><![CDATA[gstreamer]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=371</guid>
		<description><![CDATA[When decoding, for instance, a variable-bitrate MP3, gstreamer reported durations are, to say the least, estimates.  I&#8217;ve tried to get a better result in a few ways.  First off, some files yield a duration tag, but even if you&#8217;re lucky and it is there, there are no guaranties about precision.  After that [...]]]></description>
			<content:encoded><![CDATA[<p>When decoding, for instance, a variable-bitrate MP3, gstreamer reported durations are, to say the least, estimates.  I&#8217;ve tried to get a better result in a few ways.  First off, some files yield a <code>duration</code> tag, but even if you&#8217;re lucky and it is there, there are no guaranties about precision.  After that I tried seeking to the end (<code>GST_SEEK_END</code>) of the stream and querying the position, which gstreamer didn&#8217;t like.  Finally, routing the audio into a <code>fakesink</code>, waiting for the end of stream and then querying for the position gives the right result.  It&#8217;s not the prettiest method, but it works.</p>
<p><a href='http://blog.affien.com/wp-content/uploads/2009/04/gst-duration.py'>This</a> is a Python script that prints the duration of a media to stdout.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/04/19/gstreamer-accurate-duration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Spacing up- and downarrow properly for up- and downsets</title>
		<link>http://blog.affien.com/archives/2009/03/24/spacing-up-and-downarrow-properly-for-up-and-downsets/</link>
		<comments>http://blog.affien.com/archives/2009/03/24/spacing-up-and-downarrow-properly-for-up-and-downsets/#comments</comments>
		<pubDate>Tue, 24 Mar 2009 22:34:44 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[LaTeX]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=365</guid>
		<description><![CDATA[ is ugly, but  is nice!  The solution: prefix \uparrow with \mathopen.
]]></description>
			<content:encoded><![CDATA[<p><img src='/wp-latexrender/pictures/dfd7ffe5be268423b112ca959b81b779.png' title='f(\uparrow x)' alt='f(\uparrow x)' align=absmiddle> is ugly, but <img src='/wp-latexrender/pictures/2050c367e48b116441583fd62a004658.png' title='f(\left\uparrow x\right.)' alt='f(\left\uparrow x\right.)' align=absmiddle> is nice!  The solution: prefix <code>\uparrow</code> with <code>\mathopen</code>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/03/24/spacing-up-and-downarrow-properly-for-up-and-downsets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fosdem (3)</title>
		<link>http://blog.affien.com/archives/2009/02/06/fosdem-3/</link>
		<comments>http://blog.affien.com/archives/2009/02/06/fosdem-3/#comments</comments>
		<pubDate>Fri, 06 Feb 2009 12:57:29 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[fosdem]]></category>

		<guid isPermaLink="false">http://blog.affien.com/archives/2009/02/06/fosdem-3/</guid>
		<description><![CDATA[In a few hours I’ll travel the short distance to Bruxelles to visit Fosdem. Once again I’m pretty excited  .  Lets hope this time the pink elephants of the Delirium Cafe don&#8217;t crush me.  If you&#8217;re also going, drop me a comment.
]]></description>
			<content:encoded><![CDATA[<p>In a few hours I’ll travel the short distance to Bruxelles to visit Fosdem. Once again I’m pretty excited <img src='http://blog.affien.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .  Lets hope this time the pink elephants of the Delirium Cafe don&#8217;t crush me.  If you&#8217;re also going, drop me a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/02/06/fosdem-3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Timestamp 1234567890</title>
		<link>http://blog.affien.com/archives/2009/01/29/timestamp-1234567890/</link>
		<comments>http://blog.affien.com/archives/2009/01/29/timestamp-1234567890/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 22:37:42 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[arbitrary]]></category>

		<guid isPermaLink="false">http://blog.affien.com/archives/2009/01/29/timestamp-1234567890/</guid>
		<description><![CDATA[It&#8217;s soon.  The 14th of februari, 00:31:30 (Europe/Amsterdam).  Will the world end?  Will ancient libc code giggle and break?
]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s soon.  The 14th of februari, 00:31:30 (Europe/Amsterdam).  Will the world end?  Will ancient libc code giggle and break?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/01/29/timestamp-1234567890/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Aperitif for order</title>
		<link>http://blog.affien.com/archives/2009/01/01/aperitif-for-order/</link>
		<comments>http://blog.affien.com/archives/2009/01/01/aperitif-for-order/#comments</comments>
		<pubDate>Thu, 01 Jan 2009 01:16:09 +0000</pubDate>
		<dc:creator>Bas Westerbaan</dc:creator>
				<category><![CDATA[Maths]]></category>
		<category><![CDATA[math]]></category>
		<category><![CDATA[order]]></category>

		<guid isPermaLink="false">http://blog.affien.com/?p=357</guid>
		<description><![CDATA[Assign 1 to True and 0 to False.  Now the minimum corresponds to &#8220;and&#8221; and maximum to &#8220;or&#8221;.  If you give it a bit more though, less or equal to corresponds to implication.  This is a lot more general than this specific case.  Add .5 for a third value (eg. NULL) [...]]]></description>
			<content:encoded><![CDATA[<p>Assign 1 to True and 0 to False.  Now the minimum corresponds to &#8220;and&#8221; and maximum to &#8220;or&#8221;.  If you give it a bit more though, less or equal to corresponds to implication.  This is a lot more general than this specific case.  Add .5 for a third value (eg. NULL) and it still yields natural results.</p>
<p>We can recognize the behaviour of minima and maxima in a lot of other things.  Take for instance set inclusion as order with intersection as minimum and union as maximum.  Actually, the link between general order and set inclusion is frequently made to then propose that &#8220;intersection of two set of cases&#8221; and &#8220;logical and&#8221; do look a lot alike.</p>
<p>This is just the tip of the huge iceberg.  Order appears everywhere!  Everywhere in Math.  Everywhere in CS.  And its just recognizing simple order I&#8217;ve demonstrated.  Other useful concepts in order theory that I didn&#8217;t even touch are Galois Connections and formal concept analysis.</p>
<p><ins>Oh, another</ins> example of an order are integers with bitwise or and bitwise and.  It is left as an exercise to the reader when one integer is greater than another.</p>
<p>Interested?  Buy <a href="http://www.cambridge.org/uk/catalogue/catalogue.asp?isbn=0521784514">an Introduction to Lattices and Order</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.affien.com/archives/2009/01/01/aperitif-for-order/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
