<?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>Dr Jekyll &#38; Mr Hyde</title>
	<atom:link href="http://www.rfc1149.net/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.rfc1149.net/blog/</link>
	<description>Samuel Tardieu's dual-sided blog</description>
	<lastBuildDate>Sat, 13 Jun 2009 19:27:58 +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>Small is beautiful</title>
		<link>http://www.rfc1149.net/blog/2009/04/26/small-is-beautiful/</link>
		<comments>http://www.rfc1149.net/blog/2009/04/26/small-is-beautiful/#comments</comments>
		<pubDate>Sun, 26 Apr 2009 14:12:11 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Forth]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/?p=158</guid>
		<description><![CDATA[A friend of mine challenged me today to <a href="http://www.frv100.com/morpion/plumoin.htm" title="the number game">the number game</a>. This is a classical one, where you have to guess a number between 0 and 999, and the computer will tell you whether you were right on or if you were above or below the chosen number.
Instead of doing dichotomy by hand or with [...]]]></description>
			<content:encoded><![CDATA[<p>A friend of mine challenged me today to <a href="http://www.frv100.com/morpion/plumoin.htm" title="the number game">the number game</a>. This is a classical one, where you have to guess a number between 0 and 999, and the computer will tell you whether you were right on or if you were above or below the chosen number.</p>
<p>Instead of doing dichotomy by hand or with a calculator, I wrote the following <a href="http://en.wikipedia.org/wiki/Forth_(programming_language)" title="Forth">Forth</a> snippet using the <a href="http://www.jwdt.com/~paysan/gforth.html" title="gforth">gforth</a> interpreter:</p>
<p><code>: guess 2dup + 2/ dup . ;<br />
: init 0 999 guess ;<br />
: big nip guess ;<br />
: small -rot big ;<br /> <br />
</code></p>
<p>Here is the transcript of an interactive session (what I typed is in black, what was printed by gforth is in red):</p>
<p><span id="more-158"></span></p>
<p><code>init <font color="red">499  ok</font><br />
small <font color="red">749  ok</font><br />
small <font color="red">874  ok</font><br />
big <font color="red">811  ok</font><br />
big <font color="red">780  ok</font><br />
big <font color="red">764  ok</font><br />
small <font color="red">772  ok</font><br />
big <font color="red">768  ok</font><br />
big <font color="red">766  ok</font><br />
big <font color="red">765  ok</font><br />
</code></p>
<p>For those not well-versed in Forth, here is how it works:</p>
<ul>
<li><code>guess</code> takes the low bound and the high bound from the stack, put them back there and adds the middle value as well, and prints it.</li>
<li><code>init</code> starts a session by putting 0 and 999 on the stack and calls <code>guess</code> to print the initial value to be entered.</li>
<li><code>big</code> removes the high bound from the stack, leaving only the low bound and the previous middle value, then calls <code>guess</code> to get a new value.</li>
<li><code>small</code> replaces the low bound on the stack by the previous middle value, and calls <code>guess</code>. The stack manipulation and the call of <code>guess</code> would be done using <code>-rot nip guess</code>, and I took advantage of <code>big</code> by factoring it into <code>-rot big</code>.
</li>
</ul>
<p>That&#8217;s it. Who could now pretend that small isn&#8217;t beautiful?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2009/04/26/small-is-beautiful/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The OVH-Google XMPP mess</title>
		<link>http://www.rfc1149.net/blog/2008/11/20/the-google-xmpp-mess/</link>
		<comments>http://www.rfc1149.net/blog/2008/11/20/the-google-xmpp-mess/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 13:41:40 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[OVH]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[XMPP]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/?p=146</guid>
		<description><![CDATA[Beware: trying to move your Jabber (XMPP) server from one host to another may result in your users not being able to reliably talk to users using Google Talk or Gmail chat. It looks like one way or the other Google caches the SRV records of your Jabber server and do not consult the DNS [...]]]></description>
			<content:encoded><![CDATA[<p>Beware: trying to move your Jabber (XMPP) server from one host to another may result in your users not being able to reliably talk to users using Google Talk or Gmail chat. It looks like one way or the other Google caches the <tt>SRV</tt> records of your Jabber server and do not consult the DNS anymore afterwards.</p>
<p>It has been several weeks since I moved the <a href="http://www.ejabberd.im/" title="ejabberd">ejabberd</a> XMPP server for <tt>rfc1149.net</tt> on a new host which kept the same name as the old one. However, connections with <tt>gmail.com</tt> users are randomly working, while all the other domains my users interact with seem to have no problems at all. I have found several server administrators who experienced the same issue, and even read a suggestion to send an e-mail to the address <tt>xmpp@google.com</tt> which could supposedly solve the problem. The result? No answer, no working connection with <tt>gmail.com</tt> users.</p>
<p>What is needed to get Google to reread the new DNS information?</p>
<p><em><strong>Edit:</strong> I received an answer from Jonas, a software engineer at Google. It looks like they are having troubles linking with Jabber servers located on the OVH network (as is mine, and as Ploum also wrote in comments), and they have contacted OVH. In the meantime, I may try to add another port to my Jabber server, update the <tt>SRV</tt> record, and see if it brings me more luck.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2008/11/20/the-google-xmpp-mess/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DADVSI : en arrière la musique</title>
		<link>http://www.rfc1149.net/blog/2008/11/18/dadvsi-en-arriere-la-musique/</link>
		<comments>http://www.rfc1149.net/blog/2008/11/18/dadvsi-en-arriere-la-musique/#comments</comments>
		<pubDate>Tue, 18 Nov 2008 09:25:17 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[French]]></category>
		<category><![CDATA[Législation]]></category>
		<category><![CDATA[Logiciel libre]]></category>
		<category><![CDATA[Technologie]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/?p=132</guid>
		<description><![CDATA[Il y a maintenant trois ans <a href="http://www.rfc1149.net/blog/2005/11/26/logiciels-libres-et-dadvsi-il-y-a-urgence/" title="Logiciels libres et DADVSI : il y a urgence">je prévenais</a>, ainsi que beaucoup d&#8217;autres, du danger de la loi sur le <a href="http://fr.wikipedia.org/wiki/Dadvsi" title="droit d'auteur de droits voisins dans la société de l'information">droit d'auteur de droits voisins dans la société de l'information</a>, plus connue sous le petit nom de DADVSI. Un amendement, surnommé par les bloggers et les journalistes «&#160;Amendement [...]]]></description>
			<content:encoded><![CDATA[<p>Il y a maintenant trois ans <a href="http://www.rfc1149.net/blog/2005/11/26/logiciels-libres-et-dadvsi-il-y-a-urgence/" title="Logiciels libres et DADVSI : il y a urgence">je prévenais</a>, ainsi que beaucoup d&#8217;autres, du danger de la loi sur le <a href="http://fr.wikipedia.org/wiki/Dadvsi" title="droit d'auteur de droits voisins dans la société de l'information">droit d'auteur de droits voisins dans la société de l'information</a>, plus connue sous le petit nom de DADVSI. Un amendement, surnommé par les bloggers et les journalistes «&nbsp;Amendement Vivendi Universal&nbsp;», proposait d&#8217;interdire la simple mise à disposition du public de logiciels qui <strong>pourraient</strong> être utilisés pour contrefaire du contenu protégé par le droit d&#8217;auteur.</p>
<p>Et voila, on y est. La société civile des producteurs de phonogrammes en France (SPPF) <a href="http://torrentfreak.com/record-labels-to-sue-vuze-limewire-and-sourceforge-081114/" title="poursuit quatre sociétés américaines">poursuit quatre sociétés américaines</a> au prétexte que leurs logiciels de <em>peer-to-peer</em> permettent de partager du contenu contrefait. Peu importe que ces logiciels servent à partager des <a href="http://releases.ubuntu.com/8.10/" title="logiciels libres">logiciels libres</a> ou de la <a href="http://www.jamendo.com/" title="musique légalement partageable">musique légalement partageable</a>, le fait qu&#8217;ils <em>puissent</em> être utilisés pour partager des &oelig;uvres dont la redistribution est interdite par leurs ayants-droits suffit à donner une chance à la SPPF de gagner une telle action en justice. Le texte de <a href="http://www.legifrance.gouv.fr/affichCodeArticle.do;jsessionid=651378D72161DDEB53E612F4710B8235.tpdjo15v_2?cidTexte=LEGITEXT000006069414&#038;idArticle=LEGIARTI000006279235&#038;dateTexte=20081118&#038;categorieLien=id" title="l'article L335-2-1 du code de la propriété intellectuelle">l'article L335-2-1 du code de la propriété intellectuelle</a> est formulé en ces termes&nbsp;:<br />
<span id="more-132"></span></p>
<blockquote><p>
« Est puni de trois ans d&#8217;emprisonnement et de 300 000 euros d&#8217;amende le fait :</p>
<p>1° D&#8217;éditer, de mettre à la disposition du public ou de communiquer au public, sciemment et sous quelque forme que ce soit, un logiciel manifestement destiné à la mise à disposition du public non autorisée d&#8217;oeuvres ou d&#8217;objets protégés ;</p>
<p>2° D&#8217;inciter sciemment, y compris à travers une annonce publicitaire, à l&#8217;usage d&#8217;un logiciel mentionné au 1°. »
</p></blockquote>
<p>Notez bien le «&nbsp;<strong>manifestement</strong> destiné à la mise à disposition du public non autorisée d&#8217;oeuvres ou d&#8217;objets protégés&nbsp;» employé ici&nbsp;: c&#8217;est lui qui peut faire la différence, le juge devant apprécier si cette condition est respectée. La loi pénale étant d&#8217;interprétation stricte, c&#8217;est peut-être ce qui sauvera nos logiciels de partage du jouc de la justice.</p>
<p>On pourra également remarquer qu&#8217;en cas de succès de l&#8217;action judiciaire, la SPPF aura beau jeu de la prolonger par l&#8217;attaque des fournisseurs de distributions GNU/Linux, car ceux ci fournissent en général certains des logiciels mis en cause (<a href="http://azureus.sourceforge.net/" title="Azureus">Azureus</a> par exemple) dans leurs paquets. Ainsi que de tous ceux qui fournissent des dépôts, notamment en France, contenant une copie de ces distributions GNU/Linux (je pense à la quasi-totalité des fournisseurs d&#8217;accès par exemple). D&#8217;ailleurs, une des sociétés attaquées actuellement n&#8217;est autre que <a href="http://www.sourceforge.net/" title="SourceForge">SourceForge</a>, la plus grande plate-forme de développement de logiciels libres. Et ce uniquement parce qu&#8217;elle héberge et distribue un des logiciels de partage incriminés, même si la société ne contribue pas directement à son développement.</p>
<p>Oh, vous me direz que ça ne peut pas arriver chez nous, qu&#8217;on ne pourra pas interdire la distribution de logiciels libres sous prétexte que certains pourraient les utiliser illégalement. On parie&nbsp;? </p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2008/11/18/dadvsi-en-arriere-la-musique/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Silent death of a LG Flatron monitor</title>
		<link>http://www.rfc1149.net/blog/2008/09/21/silent-death-of-a-lg-flatron-monitor/</link>
		<comments>http://www.rfc1149.net/blog/2008/09/21/silent-death-of-a-lg-flatron-monitor/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 19:39:17 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/?p=127</guid>
		<description><![CDATA[My LG Flatron L1915S monitor decided that it was tired of working so hard: the backlight now turns off after a fraction of second. Of course, it happened right after the warranty period expired, so it is unlikely that I can get it fixed. A fair number of users <a href="http://www.fixya.com/support/t376489-when_press_power_button_lg_displaying" title="seem to have the same problem">seem to have the same problem</a>, [...]]]></description>
			<content:encoded><![CDATA[<p>My LG Flatron L1915S monitor decided that it was tired of working so hard: the backlight now turns off after a fraction of second. Of course, it happened right after the warranty period expired, so it is unlikely that I can get it fixed. A fair number of users <a href="http://www.fixya.com/support/t376489-when_press_power_button_lg_displaying" title="seem to have the same problem">seem to have the same problem</a>, so I guess I will have to find another brand.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2008/09/21/silent-death-of-a-lg-flatron-monitor/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>20 years later, I&#8217;m proud of myself</title>
		<link>http://www.rfc1149.net/blog/2008/08/06/20-years-later-im-proud-of-myself/</link>
		<comments>http://www.rfc1149.net/blog/2008/08/06/20-years-later-im-proud-of-myself/#comments</comments>
		<pubDate>Wed, 06 Aug 2008 11:02:06 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Health]]></category>
		<category><![CDATA[Science]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2008/08/06/20-years-later-im-proud-of-myself/</guid>
		<description><![CDATA[Back in 9th grade. My science teacher was explaining to the class why carbon monoxide (CO) inhalation was dangerous: carbon monoxide molecules attach themselves to the hemoglobin, preventing dioxygen molecules (O2) to do so. The carbone monoxide doesn&#8217;t dissociate from hemoglobin under normal pressure, making it a long-term problem (ok, this was a simplification, but [...]]]></description>
			<content:encoded><![CDATA[<p>Back in 9th grade. My science teacher was explaining to the class why carbon monoxide (CO) inhalation was dangerous: carbon monoxide molecules attach themselves to the hemoglobin, preventing dioxygen molecules (O2) to do so. The carbone monoxide doesn&#8217;t dissociate from hemoglobin under normal pressure, making it a long-term problem (ok, this was a simplification, but it was ninth grade, don&#8217;t forget).</p>
<p>I remember myself asking the teacher: <em>&#8220;Would it be ok to run a person&#8217;s blood through a machine that temporarily increases its pressure in the presence of oxygen?&#8221;</em> She looked surprised and told me she didn&#8217;t know.</p>
<p>Two days ago, I watched an episode of <a href="http://www.fox.com/house/" title="House M.D">House M.D</a> in which Dr. House puts a patient into an hyperbaric oxygen chamber to cure a patient from <a href="http://en.wikipedia.org/wiki/Carbon_monoxide_poisoning" title="carbon monoxide poisoning">carbon monoxide poisoning</a>. Not quite the same thing as the derivation I was thinking about, but the same principle, increase the blood pressure in an oxygen-saturated environment. This reminded me of the question I asked when I was a child. Twenty years later, I&#8217;m proud to know that my idea was not that stupid.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2008/08/06/20-years-later-im-proud-of-myself/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Battle Programme Shirase</title>
		<link>http://www.rfc1149.net/blog/2008/08/04/battle-programme-shirase/</link>
		<comments>http://www.rfc1149.net/blog/2008/08/04/battle-programme-shirase/#comments</comments>
		<pubDate>Mon, 04 Aug 2008 17:08:24 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Anime]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Geek]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2008/08/04/battle-programme-shirase/</guid>
		<description><![CDATA[Am I the only one who would have loved to see a second season of <a href="http://en.wikipedia.org/wiki/Battle_Programmer_Shirase" title="Battle Programmer Shirase">Battle Programmer Shirase</a> coming?
]]></description>
			<content:encoded><![CDATA[<p>Am I the only one who would have loved to see a second season of <a href="http://en.wikipedia.org/wiki/Battle_Programmer_Shirase" title="Battle Programmer Shirase">Battle Programmer Shirase</a> coming?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2008/08/04/battle-programme-shirase/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The crazyness of DRM</title>
		<link>http://www.rfc1149.net/blog/2007/12/07/the-crazyness-of-drm/</link>
		<comments>http://www.rfc1149.net/blog/2007/12/07/the-crazyness-of-drm/#comments</comments>
		<pubDate>Fri, 07 Dec 2007 11:27:58 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Technology]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2007/12/07/the-crazyness-of-drm/</guid>
		<description><![CDATA[First I hoped I had misread the web page. Then I realized I had not.
Networked disks are very useful. At home, they allow you to access your data from any computer on your local network without needing to keep a machine acting as a file server turned on all the time. But wait! You could [...]]]></description>
			<content:encoded><![CDATA[<p>First I hoped I had misread the web page. Then I realized I had not.</p>
<p>Networked disks are very useful. At home, they allow you to access your data from any computer on your local network without needing to keep a machine acting as a file server turned on all the time. But wait! You <em>could</em> use a networked disk to store songs and movies that you have illegally downloaded, couldn&#8217;t you?</p>
<p>Don&#8217;t worry, your networked disk will make sure you comply with the law and much more . Did you intend to store music that you legally downloaded from <a href="http://www.jamendo.com" title="Jamendo">Jamendo</a> and let your spouse and children access it? Too bad, since it <em>may</em> infringe someone else copyrights, Western Digital seems to think that <a href="http://wdc.custhelp.com/cgi-bin/wdc.cfg/php/enduser/std_adp.php?p_faqid=1495&#038;p_created=1168641440&#038;p_sid=bLTfVJLi&#038;p_accessibility=0&#038;p_redirect=&#038;p_lva=&#038;p_sp=cF9zcmNoPTEmcF9zb3J0X2J5PSZwX2dyaWRzb3J0PSZwX3Jvd19jbnQ9NSw1JnBfcHJvZHM9MCZwX2NhdHM9MCZwX3B2PSZwX2N2PSZwX3NlYXJjaF90eXBlPWFuc3dlcnMuc2VhcmNoX2ZubCZwX3BhZ2U9MSZwX3NlYXJjaF90ZXh0PS5hdmk*&#038;p_li=&#038;p_topview=1" title="it is best that you do not share it at all">it is best that you do not share it at all</a>, just in case:</p>
<blockquote><p>
Due to unverifiable media license authentication, the following file types cannot be shared by different users using WD Anywhere Access.</p>
<p>If these file types are on a share on the WD My Book World Edition system and another user accesses the share, these file will not be displayed for sharing. Any other file types can be shared using WD Anywhere Access.
</p></blockquote>
<p>As a friend send to me, &#8220;sure, sharing 1 tera bytes of text files looks very appealing&#8221;. This post could have been titled &#8220;how DRM (Digital Rights Management) can hurt the world even when they are not used&#8221; or &#8220;we assume that you are a criminal&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2007/12/07/the-crazyness-of-drm/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Using IPv6 by default with wget</title>
		<link>http://www.rfc1149.net/blog/2007/10/31/using-ipv6-by-default-with-wget/</link>
		<comments>http://www.rfc1149.net/blog/2007/10/31/using-ipv6-by-default-with-wget/#comments</comments>
		<pubDate>Wed, 31 Oct 2007 13:05:37 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[IPv6]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wget]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2007/10/31/using-ipv6-by-default-with-wget/</guid>
		<description><![CDATA[I was surprised to see that wget chose to use IPv4 over IPv6 when downloading a file. It looks like it is on purpose (I would call it a bad design choice). You can tell wget to prefer IPv6 over IPv4 by putting the following line
prefer-family = IPv6

in either /etc/wgetrc (system wide) or $HOME/.wgetrc (user [...]]]></description>
			<content:encoded><![CDATA[<p>I was surprised to see that <tt>wget</tt> chose to use IPv4 over IPv6 when downloading a file. It looks like it is on purpose (I would call it a bad design choice). You can tell <tt>wget</tt> to prefer IPv6 over IPv4 by putting the following line</p>
<blockquote><pre>prefer-family = IPv6</pre>
</blockquote>
<p>in either <tt>/etc/wgetrc</tt> (system wide) or <tt>$HOME/.wgetrc</tt> (user settings).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2007/10/31/using-ipv6-by-default-with-wget/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Strange keyboard problem</title>
		<link>http://www.rfc1149.net/blog/2007/10/19/strange-keyboard-problem/</link>
		<comments>http://www.rfc1149.net/blog/2007/10/19/strange-keyboard-problem/#comments</comments>
		<pubDate>Fri, 19 Oct 2007 21:40:37 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bug]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Free Software]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Xorg]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2007/10/19/strange-keyboard-problem/</guid>
		<description><![CDATA[Since about a week, I started to notice that I had been making a lot of typos in some commands I use frequently. For example, I became unable to type correctly

cd /usr/src/linux


which always resulted in

cd /usr/src:linux


(incidentally, when typing the above strings, I had to fix the first one and the second one came naturally buggy)
On [...]]]></description>
			<content:encoded><![CDATA[<p>Since about a week, I started to notice that I had been making a lot of typos in some commands I use frequently. For example, I became unable to type correctly</p>
<blockquote><pre>
cd /usr/src/linux
</pre>
</blockquote>
<p>which always resulted in</p>
<blockquote><pre>
cd /usr/src:linux
</pre>
</blockquote>
<p><em>(incidentally, when typing the above strings, I had to fix the first one and the second one came naturally buggy)</em></p>
<p>On a French keyboard (AZERTY layout), <code>/</code> is obtained by pressing <code>shift</code><code> and </code><code>:</code>. I first thought that my laptop keyboard was misfunctioning. But it happened on my home computer as well. I then thought I had become unable to properly release the <code>C</code> key before pressing the <code>shift</code> one, but no, I think I found a real bug somewhere: this problem occurs only when a key amongst the lowest left part of the keyboard (near to the shift, namely one of the <code>WXCV</code> letters on my keyboard) is rapidly followed by a <code>shift</code>.</p>
<p>Let&#8217;s make a test: while running a X11 server, press the <code>C</code> key, let it pressed so that you turn the auto-repeat mode on, then press <code>shift</code> (without releasing the key). You should, at least under Linux with Xorg, see something like:</p>
<blockquote><pre>
ccccccccccccccCCCCCCCCCCCCCCCC...
</pre>
</blockquote>
<p>But what I get is:</p>
<blockquote><pre>
cccccccccccccccccccccc...
</pre>
</blockquote>
<p>The <code>shift</code> key is ignored. Note that it works fine with the right <code>shift</code> key though.</p>
<p>For a fast touch typist (as I otherwise luckily am), this is rather unfortunate; the combination of one of those <code>wxcv</code> letters followed by a slash happens to me at least fifty times a day, often much more than that. Since I cannot reproduce that on the Linux console, I will for the moment put the blame on my X server.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2007/10/19/strange-keyboard-problem/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Recursion and while loops in Factor</title>
		<link>http://www.rfc1149.net/blog/2007/10/11/recursion-and-while-loops-in-factor/</link>
		<comments>http://www.rfc1149.net/blog/2007/10/11/recursion-and-while-loops-in-factor/#comments</comments>
		<pubDate>Wed, 10 Oct 2007 23:10:38 +0000</pubDate>
		<dc:creator>Samuel Tardieu</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[English]]></category>
		<category><![CDATA[Factor]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.rfc1149.net/blog/2007/10/11/recursion-and-while-loops-in-factor/</guid>
		<description><![CDATA[Tonight, I was willing to create a while construct in <a href="http://www.factorcode.org/" title="Factor">Factor</a> taking two items on the stack:

a quotation to execute when the test is true
a test quotation

For example, I wanted to be able to find the smallest power of two greater than or equal to an arbitrary number (here 34098) by doing:


1 [ 2 * [...]]]></description>
			<content:encoded><![CDATA[<p>Tonight, I was willing to create a <code>while</code> construct in <a href="http://www.factorcode.org/" title="Factor">Factor</a> taking two items on the stack:</p>
<ol>
<li>a quotation to execute when the test is true</li>
<li>a test quotation</li>
</ol>
<p>For example, I wanted to be able to find the smallest power of two greater than or equal to an arbitrary number (here 34098) by doing:</p>
<blockquote>
<pre>
1 [ 2 * ] [ dup 34098 < ] while
</pre>
</pre>
</blockquote>
<p>(of course there are much better ways of doing that, such as <code>34098 2 * 1 + 2 /i</code> but that's not the point here)</p>
<p>This would be much easier if we could recurse from within a block (by using a <code>recurse</code> word). Let's start with that:</p>
<p><span id="more-121"></span></p>
<blockquote>
<pre>
SYMBOL: recursive-block

: set-block ( quot -- )
  recursive-block set ;

: recurse ( quot -- )
  recursive-block get call ;

: with-recurse ( quot -- )
  recursive-block get >r
  dup set-block call
  r> set-block ;
</pre>
</blockquote>
<p>A quote passed through <code>with-recurse</code> can use the <code>recurse</code> word and re-execute itself.</p>
<p>Now that we have recursion, it is easy to implement <code>while</code> using currying:</p>
<blockquote>
<pre>
: while ( quot quot -- )
  swap [ call recurse ] curry [ slip when ] 2curry
  with-recurse ; inline
</pre>
</blockquote>
<p>Note that <code>inline</code> is used here to give the optimizing compiler a chance to build the complete quotation at compile-time if both quotations given to <code>while</code> are statically known.</p>
<p>To create a vocabulary <code>recursion</code> containing this code, one can create a file <code>extra/recursion/recursion.factor</code> containing:</p>
<blockquote>
<pre>
USING: kernel namespaces ;
IN: recursion

&lt;PRIVATE

SYMBOL: recursive-block

: set-block ( quot -- )
  recursive-block set ;

: init-block ( -- )
  [ "recurse called without with-recurse" throw ] set-block ;

PRIVATE&gt;

: recurse ( quot -- )
  recursive-block get call ;

: with-recurse ( quot -- )
  recursive-block get >r
  dup set-block call
  r> set-block ;

: while ( quot quot -- )
  swap [ call recurse ] curry [ slip when ] 2curry
  with-recurse ; inline

MAIN: init-block
</pre>
</blockquote>
<p>Loading this library can be done by issuing the following command in the listener: <code>"recursion" run</code>.</p>
<p>That's all folks.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.rfc1149.net/blog/2007/10/11/recursion-and-while-loops-in-factor/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
