<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" version="2.0">

<channel>
	<title>Lior Gradstein's Blog</title>
	
	<link>http://www.gradstein.info</link>
	<description />
	<lastBuildDate>Sun, 29 Aug 2010 01:04:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/LiorGradsteinsBlog" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="liorgradsteinsblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://www.gradstein.info/?pushpress=hub" /><creativeCommons:license>http://creativecommons.org/licenses/by-sa/3.0/</creativeCommons:license><item>
		<title>Default behaviour in implementation of STOMP protocol in RabbitMQ with python</title>
		<link>http://www.gradstein.info/python/default-behaviour-implementation-stomp-protocol-rabbitmq-python/</link>
		<comments>http://www.gradstein.info/python/default-behaviour-implementation-stomp-protocol-rabbitmq-python/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 15:51:39 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[rabbitmq]]></category>
		<category><![CDATA[Advanced Message Queuing Protocol]]></category>
		<category><![CDATA[amqp]]></category>
		<category><![CDATA[consumers]]></category>
		<category><![CDATA[direct]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[Internet protocols]]></category>
		<category><![CDATA[one]]></category>
		<category><![CDATA[protocol]]></category>
		<category><![CDATA[round-robin]]></category>
		<category><![CDATA[stomp]]></category>
		<category><![CDATA[stompy]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=368</guid>
		<description><![CDATA[Why STOMP? Why STOMP, and not directly AMQP, as I&#8217;m using RabbitMQ. No real reason, but the fact that there are less dependencies on a STOMP client, as it&#8217;s just a socket with text sent. Implementations There are several implementations of the STOMP protocol for Python. The module I chose is python-stomp (version 0.2.9), from]]></description>
			<content:encoded><![CDATA[<h2>Why STOMP?</h2>
<p>Why STOMP, and not directly AMQP, as I&#8217;m using RabbitMQ. No real reason, but the fact that there are less dependencies on a STOMP client, as it&#8217;s just a socket with text sent.</p>
<h2>Implementations</h2>
<p>There are <a href="http://pypi.python.org/pypi?%3Aaction=search&#038;term=stomp&#038;submit=search" class="liexternal">several implementations</a> of the STOMP protocol for Python. The module I chose is <a href="http://pypi.python.org/pypi/stompy/" class="liexternal">python-stomp</a> (version 0.2.9), from Benjamin W. Smith. It&#8217;s simple and easy to understand.</p>
<h2>Simple Code Examples</h2>
<p>sto_send.py:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> stompy.<span style="color: black;">simple</span> <span style="color: #ff7700;font-weight:bold;">import</span> Client
&nbsp;
stomp = Client<span style="color: black;">&#40;</span>host=<span style="color: #483d8b;">'rabbitmq2'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>username=<span style="color: #483d8b;">'guest'</span>,password=<span style="color: #483d8b;">'noneofyourbusiness'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">put</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Thomas est une b*te à Tetris...'</span>, destination=<span style="color: #483d8b;">'/queue/jeuvideo'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">disconnect</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>sto_receive.py:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> stompy.<span style="color: black;">simple</span> <span style="color: #ff7700;font-weight:bold;">import</span> Client
&nbsp;
stomp = Client<span style="color: black;">&#40;</span>host=<span style="color: #483d8b;">'rabbitmq2'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>username=<span style="color: #483d8b;">'guest'</span>,password=<span style="color: #483d8b;">'noneofyourbusiness'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">subscribe</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/queue/jeuvideo'</span><span style="color: black;">&#41;</span>
message = stomp.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">print</span> message.<span style="color: black;">body</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#stomp.ack(message)</span>
stomp.<span style="color: black;">unsubscribe</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'/queue/video'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">disconnect</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>Everything is working fine, when launching sto_receive.py, I receive the message. But when I launched several receivers, I noticed, that ONLY ONE programs received the message! After some research, I found the answer: As documented <a href="https://dev.rabbitmq.com/wiki/StompGateway" class="liexternal">in the RabbitMQ wiki</a>, the default exchange is &#8216;direct&#8217;:</p>
<blockquote><p>[...]when messages leave a queue for a consumer, they are not duplicated. One message, sitting on a queue, is delivered to only one of the available consumers. [...] If there are multiple clients, all SUBSCRIBEing to the same queue, then there will be multiple consumers all on the same queue, leading to round-robin delivery to those clients.</p></blockquote>
<p>There is <a href="https://dev.rabbitmq.com/wiki/StompGateway" class="liexternal">an explanation</a> on how to change the behaviour, by changing the exchange type, and some of particular bits (like the id). I even found <a href="http://github.com/dcarley/mcollective-plugins/commit/4801dda81cdb7fca2fc3f87efdcc3295d497e973" class="liexternal">an example of modification</a> for use in the equivalent <a href="http://rubygems.org/gems/stomp" class="liexternal">STOMP Ruby module</a>.</p>
<p>Here are the modifications. The good news is that there is no need to patch the stompy module, as the author provided the possibility to pass arbitrary parameters to the headers by the use of the &#8216;conf&#8217; variable. </p>
<p>The important points are:</p>
<ul>
<li>You need to define an exchange of type amq.topic</li>
<li>You need to set an id, which is different for each client</li>
<li>As you&#8217;re using topics, you&#8217;ll have to specify a routing_key</li>
</ul>
<p>sto_receive.py:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> stompy.<span style="color: black;">simple</span> <span style="color: #ff7700;font-weight:bold;">import</span> Client
<span style="color: #ff7700;font-weight:bold;">import</span> uuid
&nbsp;
unique_id = uuid.<span style="color: black;">uuid4</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
stomp = Client<span style="color: black;">&#40;</span>host=<span style="color: #483d8b;">'rabbitmq2'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>username=<span style="color: #483d8b;">'guest'</span>,password=<span style="color: #483d8b;">'nonononono'</span><span style="color: black;">&#41;</span>
&nbsp;
stomp.<span style="color: black;">subscribe</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>,
                conf=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'exchange'</span>: <span style="color: #483d8b;">'amq.topic'</span>,
                      <span style="color: #483d8b;">'routing_key'</span>:<span style="color: #483d8b;">'x.#'</span>,
                      <span style="color: #483d8b;">'id'</span>: unique_id,
                      <span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #808080; font-style: italic;"># Wait for a message to appear</span>
<span style="color: #ff7700;font-weight:bold;">while</span> <span style="color: #ff4500;">1</span>:
    message = stomp.<span style="color: black;">get</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">print</span> message.<span style="color: black;">body</span>
&nbsp;
<span style="color: #808080; font-style: italic;">#stomp.ack(message)</span>
stomp.<span style="color: black;">unsubscribe</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>,conf=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'id'</span>: unique_id<span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">disconnect</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

<p>sto_send.py:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> stompy.<span style="color: black;">simple</span> <span style="color: #ff7700;font-weight:bold;">import</span> Client
&nbsp;
&nbsp;
&nbsp;
stomp = Client<span style="color: black;">&#40;</span>host=<span style="color: #483d8b;">'rabbitmq2'</span><span style="color: black;">&#41;</span>
stomp.<span style="color: black;">connect</span><span style="color: black;">&#40;</span>username=<span style="color: #483d8b;">'guest'</span>,password=<span style="color: #483d8b;">'nonononono'</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> i <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #008000;">range</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">10000</span><span style="color: black;">&#41;</span>:
 stomp.<span style="color: black;">put</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Thomas est une b*te au Tetris...'</span>, destination=<span style="color: #483d8b;">'x.y'</span>,
          conf=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'exchange'</span>:<span style="color: #483d8b;">'amq.topic'</span>,
                <span style="color: #808080; font-style: italic;">#  'routing_key':'x.y'</span>
                <span style="color: black;">&#125;</span><span style="color: black;">&#41;</span>
&nbsp;
stomp.<span style="color: black;">disconnect</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>


<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/" title="How to dial a number using Asterisk and Python (December 17, 2008)">How to dial a number using Asterisk and Python</a> (1)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=H_EQcx8JC3g:yUKyDDZ4ct0:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=H_EQcx8JC3g:yUKyDDZ4ct0:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=H_EQcx8JC3g:yUKyDDZ4ct0:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/H_EQcx8JC3g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/python/default-behaviour-implementation-stomp-protocol-rabbitmq-python/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Puppet: Files found in modules without specifying ‘modules’ in file path will be deprecated in the next major release</title>
		<link>http://www.gradstein.info/network/puppet-files-modules-modules-file-path-deprecated-major-release/</link>
		<comments>http://www.gradstein.info/network/puppet-files-modules-modules-file-path-deprecated-major-release/#comments</comments>
		<pubDate>Thu, 19 Aug 2010 14:11:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[network]]></category>
		<category><![CDATA[puppet]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[deprecation]]></category>
		<category><![CDATA[notice]]></category>
		<category><![CDATA[warning]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=351</guid>
		<description><![CDATA[DEPRECATION NOTICE: Files found in modules without specifying &#8216;modules&#8217; in file path will be deprecated in the next major release. If you get this warning in your puppet logs, you should take action (only if you don&#8217;t have any Puppet agent with a version]]></description>
			<content:encoded><![CDATA[<blockquote><p>DEPRECATION NOTICE: Files found in modules without specifying &#8216;modules&#8217; in file path will be deprecated in the next major release.
</p></blockquote>
<p>If you get this warning in your puppet logs, you should take action (only if you don&#8217;t have any Puppet agent with a version <= 0.24) and modify all you references to file resources.<br />
For example, if you have a module named 'ssh', normally, up to puppet 0.25 you would reference a file to it as:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">source <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;puppet:///ssh/authorized_keys&quot;</span>,<span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p>But now, you need to insert a &#8216;module&#8217; identifier in between like this:</p>

<div class="wp_syntax"><div class="code"><pre class="ruby" style="font-family:monospace;">source <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">&quot;puppet:///modules/ssh/authorized_keys&quot;</span>,<span style="color:#006600; font-weight:bold;">&#93;</span></pre></div></div>

<p><em>Just a small note: It seems that the templates do not need any modification.</em></p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/ruby/synchronization-methods-of-a-file-with-puppet/" title="Synchronization methods of a file with Puppet (September 29, 2008)">Synchronization methods of a file with Puppet</a> (0)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=ZOaDdwdjoGM:5cebwCg-l3k:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=ZOaDdwdjoGM:5cebwCg-l3k:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=ZOaDdwdjoGM:5cebwCg-l3k:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/ZOaDdwdjoGM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/network/puppet-files-modules-modules-file-path-deprecated-major-release/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where do I find pngout for Linux?</title>
		<link>http://www.gradstein.info/software/where-do-i-find-pngout-for-linux/</link>
		<comments>http://www.gradstein.info/software/where-do-i-find-pngout-for-linux/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 17:11:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=290</guid>
		<description><![CDATA[I just found a nice comparison chart of different compression programs for PNG images (optimizations). It seems that PNGout is the best of the best :-) On the author&#8217;s website, there&#8217;s only a windows version. The link to the Linux version gets redirected to a gtagaming website?! After asking the great oracle Google where I]]></description>
			<content:encoded><![CDATA[<p>I just found a <a href="http://www.olegkikin.com/png_optimizers/" class="liexternal">nice comparison chart of different compression programs</a> for PNG images (optimizations). It seems that PNGout is the best of the best :-) On the author&#8217;s website, there&#8217;s only a windows version. The link to the Linux version gets redirected to a gtagaming website?!<br />
After asking the great oracle Google where I could find a version for Linux, he replied to me I could find it on <a href="http://www.jonof.id.au/pngout" class="liexternal">JonoF&#8217;s website</a>.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=0C5C926uCVk:uFj3Ksuh6kk:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=0C5C926uCVk:uFj3Ksuh6kk:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=0C5C926uCVk:uFj3Ksuh6kk:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/0C5C926uCVk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/software/where-do-i-find-pngout-for-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New chess website for Chess education/promotion</title>
		<link>http://www.gradstein.info/kid/new-chess-website-for-chess-educationpromotion/</link>
		<comments>http://www.gradstein.info/kid/new-chess-website-for-chess-educationpromotion/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 21:53:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[chess]]></category>
		<category><![CDATA[kid]]></category>
		<category><![CDATA[learning]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=277</guid>
		<description><![CDATA[BNPParibas in association with the FIDE created a new nicely done website (in french only). The goal of this website is to show the usefulness of chess to parents/teachers or schools. Children will also be happy to consult this website, there are cool games, and even a quiz, where one can win a sort of]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.gradstein.info/wp-content/uploads/2009/12/chess.png" alt="Chess set" title="Chess set" width="80" height="52" align="left" class="alignleft size-full wp-image-280" />BNPParibas in association with the FIDE created a <a href="http://www.jeu-echecs.bnpparibas.com" class="liexternal">new nicely done website</a> (in french only). The goal of this website is to show the usefulness of chess to parents/teachers or schools. Children will also be happy to consult this website, there are cool games, and even a quiz, where one can win a sort of printable &#8220;diploma&#8221;. A really nice initiative.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/kid/idos-chess-journey-how-to-teach-chess-to-a-3-year-old-kid/" title="Ido&#8217;s chess Journey: How to teach chess to a 3 year old kid (January 28, 2009)">Ido&#8217;s chess Journey: How to teach chess to a 3 year old kid</a> (1)</li>
	<li><a href="http://www.gradstein.info/kid/easy-chess-games-for-kids-mate-in-one/" title="Easy chess games for kids (mate in one) (February 2, 2009)">Easy chess games for kids (mate in one)</a> (5)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=VfQhFcXPRW8:OU9h-6xEhlw:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=VfQhFcXPRW8:OU9h-6xEhlw:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=VfQhFcXPRW8:OU9h-6xEhlw:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/VfQhFcXPRW8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/kid/new-chess-website-for-chess-educationpromotion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Asterisk: DADHI module not working when using Xen</title>
		<link>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/</link>
		<comments>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/#comments</comments>
		<pubDate>Thu, 26 Mar 2009 11:30:54 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[digium]]></category>
		<category><![CDATA[hardware card]]></category>
		<category><![CDATA[rtc]]></category>
		<category><![CDATA[timer]]></category>
		<category><![CDATA[xen]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=224</guid>
		<description><![CDATA[If you want to use any Asterisk module that needs a timer, like MeetMe, you have to use a module named dahdi (previously named zaptel). DAHDI has one module for each Digium supported card (B410P), and a dummy module (named dahdi_dummy) if you don&#8217;t have a hardware card, like me. The problem appears when you]]></description>
			<content:encoded><![CDATA[<p>If you want to use any <a href="http://www.asterisk.org/" class="liexternal">Asterisk</a> module that needs a timer, like MeetMe, you have to use a module named dahdi (previously named zaptel). DAHDI has one module for each Digium supported card (B410P), and a dummy module (named dahdi_dummy) if you don&#8217;t have a hardware card, like me.</p>
<p>The problem appears when you have your Asterisk in a Xen environment. Xen does not allow the use of the RTC, so when using Dahdi/meetme, you get the following in you logs:</p>
<blockquote><p>res_timing_dahdi.c: Asterisk has detected a problem with your DAHDI configuration and will shutdown for your protection.</p></blockquote>
<p>So get the sources, and let&#8217;s patch it!</p>
<p><code>svn co  http://svn.digium.com/svn/dahdi/linux-complete/trunk DAHDI</code></p>
<p>In dahdi_dummy.c, you&#8217;ll have to comment the two defines USE_RTC, as in a Xen, you can&#8217;t use it:</p>

<div class="wp_syntax"><div class="code"><pre class="diff" style="font-family:monospace;"># diff -u dahdi_dummy.c.ori dahdi_dummy.c
<span style="color: #888822;">--- dahdi_dummy.c.ori	<span style="">2009</span>-03-<span style="">23</span> 09:<span style="">50</span>:<span style="">36.000000000</span> +0000</span>
<span style="color: #888822;">+++ dahdi_dummy.c	<span style="">2009</span>-03-<span style="">23</span> 08:<span style="">55</span>:<span style="">38.000000000</span> +0000</span>
<span style="color: #440088;">@@ -<span style="">59</span>,<span style="">11</span> +<span style="">59</span>,<span style="">11</span> @@</span>
 #if defined<span style="">&#40;</span>CONFIG_HIGH_RES_TIMERS<span style="">&#41;</span> &amp;&amp; LINUX_VERSION_CODE &gt;= VERSION_CODE<span style="">&#40;</span><span style="">2</span>,<span style="">6</span>,<span style="">22</span><span style="">&#41;</span>
 #define USE_HIGHRESTIMER
 #else
<span style="color: #991111;">-#define USE_RTC</span>
<span style="color: #00b000;">+//#define USE_RTC</span>
 #endif
 #else
 #if <span style="">0</span>
<span style="color: #991111;">-#define USE_RTC</span>
<span style="color: #00b000;">+//#define USE_RTC</span>
 #endif
 #endif
 #endif</pre></div></div>

<p>Then compile the module, as usual, with :</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/etc/init.d/dahdi stop
make all
make install
make config</pre></div></div>

<p>Verify that your module has been correctly installed:</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">ls -al ./2.6.24-19-xen/dahdi/dahdi_dummy.ko</pre></div></div>

<p>Comment out all the defined modules in the /etc/dahdi/modules file.</p>

<div class="wp_syntax"><div class="code"><pre class="shell" style="font-family:monospace;">/etc/init.d/dahdi start
# dmesg
1007539.576458] dahdi: Telephony Interface Registered on major 196
[1007539.576468] dahdi: Version: SVN-trunk-r6201M
[1007540.642839] dahdi: Registered tone zone 2 (France)</pre></div></div>


<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/" title="How to dial a number using Asterisk and Python (December 17, 2008)">How to dial a number using Asterisk and Python</a> (1)</li>
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/" title="Asterisk cirpack problem with Free and freephonie.net (February 12, 2009)">Asterisk cirpack problem with Free and freephonie.net</a> (0)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=RtalISg0ycw:lmM-60vFTvQ:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=RtalISg0ycw:lmM-60vFTvQ:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=RtalISg0ycw:lmM-60vFTvQ:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/RtalISg0ycw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Django: How to find the url/path you’re into, in a template loaded by a generic view</title>
		<link>http://www.gradstein.info/python/django-how-to-find-the-urlpath-youre-into-in-a-template-loaded-by-a-generic-view/</link>
		<comments>http://www.gradstein.info/python/django-how-to-find-the-urlpath-youre-into-in-a-template-loaded-by-a-generic-view/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 22:11:39 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=197</guid>
		<description><![CDATA[In a Django project, I have a template that is used by two urls, which is quite common (generic views, using &#8216;create_object&#8217; and &#8216;update_object&#8217;). The problem is that I had to add a supplementary menu just when the template is loaded from the &#8216;update&#8217; generic view, and not from the &#8216;create&#8217; generic view. Making the]]></description>
			<content:encoded><![CDATA[<p>In a Django project, I have a template that is used by two urls, which is quite common (generic views, using &#8216;create_object&#8217; and &#8216;update_object&#8217;). The problem is that I had to add a supplementary menu just when the template is loaded from the &#8216;update&#8217; generic view, and not from the &#8216;create&#8217; generic view.</p>
<p>Making the difference between the two urls calls at the template level is a problem because it&#8217;s managed by generic views, so the same template is used.</p>
<p>Anyways, there are several possibilities:</p>
<p>In urls.py, use the <a href="http://docs.djangoproject.com/en/dev/ref/generic-views/#django-views-generic-create-update-create-object" class="liexternal">&#8216;template_name&#8217; variable</a>, where you can speficy a specific template for this url(). That is instead of using the default &lt;model&gt;_form.html.<br />
What I don&#8217;t like in this situation, is that I will have two nearly similar templates, just for an added menu. Not cool. Another problem is that I use <a href="http://code.djangoproject.com/wiki/GenerateGenericURLs" class="liexternal">a loop to create all my urls</a>. So if I add a special template, I&#8217;ll add it to <strong>ALL my models</strong> :-(.</p>
<p>Another solution, is to find a way to use a variable in the template that would be different wether the template has been loaded by update_object or create_object.</p>
<p>In our urlpatterns in urls.py, we can use the &#8216;<strong>extra_context</strong>&#8216; variable (takes a <a href="http://docs.djangoproject.com/en/dev/ref/generic-views/?from=olddocs#django-views-generic-create-update-create-object" class="liexternal">dictionnary as parameter</a>). It is correctly managed, even when using generic views. So, you&#8217;ll have :</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'foo/ajouter/$'</span>, <span style="color: #483d8b;">'django.views.generic.create_update.create_object'</span>,  
		<span style="color: #008000;">dict</span><span style="color: black;">&#40;</span>form_class=modelForm,
                extra_context=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'usage'</span>:<span style="color: #483d8b;">'create'</span><span style="color: black;">&#125;</span>,
                name=<span style="color: #483d8b;">'foo_create'</span>,<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'foo/%s/(?P&lt;object_id&gt;<span style="color: #000099; font-weight: bold;">\d</span>+)/modifier/$'</span>,
                <span style="color: #483d8b;">'django.views.generic.create_update.update_object'</span>,
		<span style="color: #008000;">dict</span><span style="color: black;">&#40;</span>form_class=modelForm,
                extra_context=<span style="color: black;">&#123;</span><span style="color: #483d8b;">'usage'</span>:<span style="color: #483d8b;">'modify'</span><span style="color: black;">&#125;</span>,
                name=<span style="color: #483d8b;">'foo_update'</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>We can also use, in urls.py, the <a href="http://docs.djangoproject.com/en/dev/ref/generic-views/?from=olddocs#django-views-generic-create-update-create-object" class="liexternal">&#8216;context_processors&#8217; variable</a>. For more information about the context processors, have <a href="http://www.b-list.org/weblog/2006/jun/14/django-tips-template-context-processors/" class="liexternal">a look at this tutorial</a>. The goal is to add &#8216;django.core.context_processors.request&#8217;, like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">from</span> django.<span style="color: black;">core</span>.<span style="color: black;">context_processors</span> <span style="color: #ff7700;font-weight:bold;">import</span> request</pre></div></div>

<p>and in the url(), add context_processors:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">url<span style="color: black;">&#40;</span>r<span style="color: #483d8b;">'foo/ajouter/$'</span>, <span style="color: #483d8b;">'django.views.generic.create_update.create_object'</span>,  
		<span style="color: #008000;">dict</span><span style="color: black;">&#40;</span>form_class=modelForm,
		context_processors=<span style="color: black;">&#91;</span>request,<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>,
                name=<span style="color: #483d8b;">'foo_create'</span>,<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>The last possiblity is a more global solution. It&#8217;s like the context_processors usage above, but added into every templates automatically.<br />
To do this, you&#8217;ll have to edit the list of Template Processors in your settings.py file. That list is run each time a template is loaded, and allows one to add any variable to the template automatically. By default (on Django 1.0.x) this list is commented out, so it has by <a href="http://docs.djangoproject.com/en/dev/ref/settings/#setting-TEMPLATE_CONTEXT_PROCESSORS" class="liexternal">default the list</a>:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;django.core.context_processors.auth&quot;</span>,
<span style="color: #483d8b;">&quot;django.core.context_processors.debug&quot;</span>,
<span style="color: #483d8b;">&quot;django.core.context_processors.i18n&quot;</span>,
<span style="color: #483d8b;">&quot;django.core.context_processors.media&quot;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>You&#8217;ll have to uncomment it, and add &#8216;django.core.context_processors.request&#8217;. By doing this, you get the variable &#8216;request.path&#8217; available in your template.</p>
<p>Finally, you&#8217;ll be able to test your variable with {% ifequal %} and display your conditional elements.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=AQmI1uwmT1o:34sMJybBgrE:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=AQmI1uwmT1o:34sMJybBgrE:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=AQmI1uwmT1o:34sMJybBgrE:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/AQmI1uwmT1o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/python/django-how-to-find-the-urlpath-youre-into-in-a-template-loaded-by-a-generic-view/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>calcubetimer moved to Google Code</title>
		<link>http://www.gradstein.info/rubik/calcubetimer-moved-to-google-code/</link>
		<comments>http://www.gradstein.info/rubik/calcubetimer-moved-to-google-code/#comments</comments>
		<pubDate>Thu, 19 Mar 2009 16:51:08 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[rubik]]></category>
		<category><![CDATA[cube]]></category>
		<category><![CDATA[google]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=190</guid>
		<description><![CDATA[Calcubetimer&#8217;s website doesn&#8217;t seem to work anymore :-( Fortunately, gnehzr has moved the code to Google Code. Related posts No related posts.]]></description>
			<content:encoded><![CDATA[<p><a href="http://gnehzr.net/cct/" class="liexternal">Calcubetimer&#8217;s website</a> doesn&#8217;t seem to work anymore :-( Fortunately, gnehzr has moved the code to <a href="http://code.google.com/p/calcubetimer/" class="liexternal">Google Code</a>.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li>No related posts.</li>
	</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=azM3382nPQM:JRxjmZRPP78:yIl2AUoC8zA"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?d=yIl2AUoC8zA" border="0"></img></a> <a href="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?a=azM3382nPQM:JRxjmZRPP78:V_sGLiPBpWU"><img src="http://feeds.feedburner.com/~ff/LiorGradsteinsBlog?i=azM3382nPQM:JRxjmZRPP78:V_sGLiPBpWU" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/azM3382nPQM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/rubik/calcubetimer-moved-to-google-code/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Asterisk cirpack problem with Free and freephonie.net</title>
		<link>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/</link>
		<comments>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 09:34:51 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[asterisk]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[voip]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[cirpack]]></category>
		<category><![CDATA[correction]]></category>
		<category><![CDATA[france]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[free isp provider]]></category>
		<category><![CDATA[freephonie.net]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[provider]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=179</guid>
		<description><![CDATA[If you configured your Asterisk/FreeSWITCH server to talk to your freephonie.net (french Free ISP provider), you&#8217;ll see in the logs the following warning message: [Feb 12 09:29:06] WARNING[9228]: chan_sip.c:6624 determine_firstline_parts: Bad request protocol Packet This is not really a problem, but an annoyance, as it fills up your logs. This is a known problem for]]></description>
			<content:encoded><![CDATA[<p>If you configured your Asterisk/FreeSWITCH server to talk to your freephonie.net (french Free ISP provider), you&#8217;ll see in the logs the following warning message:<br />
<code>[Feb 12 09:29:06] WARNING[9228]: chan_sip.c:6624 determine_firstline_parts: Bad request protocol Packet</code></p>
<p>This is not really a problem, but an annoyance, as it fills up your logs. This is a <a href="http://bugs.digium.com/view.php?id=7261&#038;nbn=6" class="liexternal">known problem</a> for more than years, but has never been corrected (neither by Asterisk nor by Cirpack devs). The usual correction was to add the following line to your startup scripts (/etc/rc.local on Debian for example):<br />
<code>iptables -A INPUT -p udp -m udp --dport 5060 -m string --string "Cirpack KeepAlive Packet" -j DROP</code></p>
<p>But the syntax has changed in iptables, and you&#8217;ll get the error:<br />
<code>iptables v1.3.6: STRING match: You must specify `--algo'</code></p>
<p>so, just add one of the 2 available algorithms (bm and kmp):<br />
<code>iptables -A INPUT -p udp -m udp --dport 5060 -m string --string "Cirpack KeepAlive Packet" --algo bm -j DROP<br />
</code></p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/python/how-to-dial-a-number-using-asterisk-and-python/" title="How to dial a number using Asterisk and Python (December 17, 2008)">How to dial a number using Asterisk and Python</a> (1)</li>
	<li><a href="http://www.gradstein.info/software/asterisk/asterisk-dadhi-module-not-working-when-using-xen/" title="Asterisk: DADHI module not working when using Xen (March 26, 2009)">Asterisk: DADHI module not working when using Xen</a> (5)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=OAp2q9WX"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=QuwmG6zn"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?i=QuwmG6zn" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/j2iF2iz33-Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/software/asterisk/asterisk-cirpack-problem-with-free-and-freephonienet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Easy chess games for kids (mate in one)</title>
		<link>http://www.gradstein.info/kid/easy-chess-games-for-kids-mate-in-one/</link>
		<comments>http://www.gradstein.info/kid/easy-chess-games-for-kids-mate-in-one/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 00:45:12 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[chess]]></category>
		<category><![CDATA[kid]]></category>
		<category><![CDATA[child]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[database]]></category>
		<category><![CDATA[diagrams]]></category>
		<category><![CDATA[generate]]></category>
		<category><![CDATA[generator]]></category>
		<category><![CDATA[kids]]></category>
		<category><![CDATA[mate]]></category>
		<category><![CDATA[mate in one]]></category>
		<category><![CDATA[pdf]]></category>
		<category><![CDATA[pgn]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=151</guid>
		<description><![CDATA[In my journey to teach chess to Ido, an easy (I thought) job was to generate diagrams where he has to find mate in a fixed number of turns. Starting with mate in one. It appeared that making diagrams is an easy task, as there are many programs (Linux and Windows) that permit this. On]]></description>
			<content:encoded><![CDATA[<p>In my journey to teach chess to Ido, an easy (I thought) job was to generate diagrams where he has to find mate in a fixed number of turns. Starting with mate in one.<br />
It appeared that making diagrams is an easy task, as there are many programs (Linux and Windows) that permit this.<br />
On Linux, the best I could find is <a href="http://scid.sourceforge.net/" class="liexternal">scid</a>. That&#8217;s cool as I use it to maintain my databases of games. Even cooler, is that scid development has just restarted (stopped around 2004!), with the help of <a href="http://prolinux.free.fr/scid/" class="liexternal">Pascal Georges</a>. Using scid (I&#8217;m using the 3.7devel2009 version) I can export games to HTML or even to LaTeX files.</p>
<p>At first I thought I&#8217;d create the endings myself, for example, using <a href="http://www.apronus.com/chess/diagram.php" class="liexternal">online diagrams generators</a> or using <a href="http://en.wikipedia.org/wiki/Template:Chess_diagram" rel="nofollow" class="liwikipedia">Wikipedia/MediaWiki&#8217;s templates</a>, but it was not so easy, so I thought about making a program to generate them.<br />
Generating one from scratch would take me time I really don&#8217;t have, and there are just <a href="http://www.willmcgugan.com" class="liexternal">two</a> <a href="http://www.alcyone.com/pyos/church/" class="liexternal">python</a> modules that give high-level functions to chess.<br />
So I started looking for projects similar to mine, that include games with mate in one. I found a small database of mate in one on my favorite <a href="http://www.chess.com/" class="liexternal">chess website</a>, in the <a href="http://www.chess.com/download/view/1171-mates-in-1" class="liexternal">download section</a>: a Chessbase datafile with 1171 mate in one studies! So cool.</p>
<p>Well, It was really a pain to convert that Chessbase (.cbv) file, as the only program able to convert to PGN is <a href="http://www.chessbase.com/download/cblight2007/index.asp" class="liexternal">running on Windows</a>ã€€(at least it&#8217;s free). You just have to follow the <a href="http://www.avlerchess.com/chess-misc/Converting_chessbase_to_PGN_for_Scid_180896.html" class="liexternal">instructions from this thread</a>.<br />
After getting a <a href="/static/mate_in_one.pgn.gz" class="lizip">nice PGN file</a>, just open it with scid, go to &#8220;Tools&#8221;, then select &#8220;Write the filter&#8221;, and choose LaTeX. You&#8217;ll get a <a href="/static/mate_in_one.tex.gz" class="lizip">TeX file</a>. Use you favorite TeX generator (Live TeX seems to be the one today), like this for example, to generate directly a PDF file:</p>
<p><code>cat mat_temp.tex |grep -v "\\\\$" > mate_in_one.tex<br />
latex --output-format=pdf mate_in_one.tex</code></p>
<p><em>(Yes I had to cleanup a bit the file before generating the .pdf)</em></p>
<p>The result is <a href="/static/mate_in_one.pdf" class="lipdf">here</a>, 196 pages of tests (6 one each page) if you don&#8217;t want to fight with the missing TeX modules (you&#8217;ll need chess12.sty) and get a nice result.</p>
<p>I&#8217;m sure many people search for this kind of file, so I&#8217;m pretty happy to help other parents/coaches.</p>
<div id="attachment_172" class="wp-caption aligncenter" style="width: 298px"><img src="http://www.gradstein.info/wp-content/uploads/2009/02/a.jpg" alt="White mate in one" title="Mate in one" width="288" height="288" class="size-full wp-image-172" /><p class="wp-caption-text">White mate in one</p></div>
<p>Edit: I added a <a href="/static/mate_in_one_without_solution.pdf" class="lipdf">PDF version without the solution included</a>.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/kid/idos-chess-journey-how-to-teach-chess-to-a-3-year-old-kid/" title="Ido&#8217;s chess Journey: How to teach chess to a 3 year old kid (January 28, 2009)">Ido&#8217;s chess Journey: How to teach chess to a 3 year old kid</a> (1)</li>
	<li><a href="http://www.gradstein.info/kid/new-chess-website-for-chess-educationpromotion/" title="New chess website for Chess education/promotion (December 29, 2009)">New chess website for Chess education/promotion</a> (0)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=xys5AGdP"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=7NhAwjEm"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?i=7NhAwjEm" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/SbfQPr08xfw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/kid/easy-chess-games-for-kids-mate-in-one/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Ido’s chess Journey: How to teach chess to a 3 year old kid</title>
		<link>http://www.gradstein.info/kid/idos-chess-journey-how-to-teach-chess-to-a-3-year-old-kid/</link>
		<comments>http://www.gradstein.info/kid/idos-chess-journey-how-to-teach-chess-to-a-3-year-old-kid/#comments</comments>
		<pubDate>Wed, 28 Jan 2009 01:20:24 +0000</pubDate>
		<dc:creator>Lior Gradstein</dc:creator>
				<category><![CDATA[chess]]></category>
		<category><![CDATA[kid]]></category>
		<category><![CDATA[Ã©cole]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[kindergarten]]></category>
		<category><![CDATA[learn]]></category>
		<category><![CDATA[petite section]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[teaching]]></category>

		<guid isPermaLink="false">http://www.gradstein.info/?p=115</guid>
		<description><![CDATA[How to teach chess to a 3 year old kid? That&#8217;s a good question. I wanted to teach Ido chess for a long time, but each time I tried, he lost focus after 2 minutes, even just for teaching him just rook movements. I decided I needed to plan it a little more, make it]]></description>
			<content:encoded><![CDATA[<p>How to teach chess to a 3 year old kid? That&#8217;s a good question. I wanted to teach Ido chess for a long time, but each time I tried, he lost focus after 2 minutes, even just for teaching him just rook movements.<br />
I decided I needed to plan it a little more, make it much more fun, and &#8220;embed&#8221; it in mini-games. It seems to work much better now, but that&#8217;s maybe because he matured a lot.</p>
<p>Here are some ideas (some not yet implemented):</p>
<ul>
<li>Using a <a href="http://annathered.wordpress.com/2009/01/25/how-to-make-japanese-style-hamburg/" class="liexternal">DIY plastified</a> chess board, allows me to show/play different positions really fast, anywhere.</li>
<li>Colorize squares where a piece is allowed to go :<br />
<p class="flickrTag_container"><a href="http://farm4.static.flickr.com/3381/3227796869_f287f321c3.jpg" class="flickr" title="Ido colored in the squares where the bishop is allowed to go &lt;a href=&quot;http://www.flickr.com/photos/17782122@N00/3227796869/&quot;&gt;view&amp;nbsp;on&amp;nbsp;flickr&amp;raquo;&lt;/a&gt;" rel="lightbox"><img src="http://farm4.static.flickr.com/3381/3227796869_f287f321c3_m.jpg" alt="Array" class="flickr small photo" /></a></p>
</li>
<li><a href="http://www.chesskids.com/ckbook/ppawnrace.htm" class="liexternal">Pawn race games</a> (no en-passant rule yet).</li>
<li>Really small games (must not go over 5 minutes) with reduced chess set (for example Queen and 3 pawns vs Knight, bishop and 3 pawns).</li>
<li>Checkmate in one, using <a href="http://alain.blaisot.free.fr/DiagTransfer/English/home.htm" class="liexternal">DiagTransfer</a> program to draw series of chess diagrams. This program works only on Windows, but it works fine with Wine.<br />
<p class="flickrTag_container"><a href="http://farm4.static.flickr.com/3354/3228648000_7266b64e20.jpg" class="flickr" title="Ido found the mate in 1, for white &lt;a href=&quot;http://www.flickr.com/photos/17782122@N00/3228648000/&quot;&gt;view&amp;nbsp;on&amp;nbsp;flickr&amp;raquo;&lt;/a&gt;" rel="lightbox"><img src="http://farm4.static.flickr.com/3354/3228648000_7266b64e20_m.jpg" alt="Array" class="flickr small photo" /></a></p></p>
<p>For quick single diagrams, I found <a href="http://www.apronus.com/chess/wbeditor.php" class="liexternal">wbeditor</a>, an online javascript diagram generator.</li>
</ul>
<p>There&#8217;s a <a href="http://blog.capakaspa.info/index.php?2006/12/10/30-apprentissage-des-echecs-aux-enfants" class="liexternal">thread</a> (french) about experience from different teachers, giving really good advices.<br />
Most notably, <a href="http://pagesperso-orange.fr/veronique.houck/" class="liexternal">VÃ©ronique Houck</a> who has 15 years of experience of teaching chess to kindergarten/maternelle children. She wrote two books (in french). One is named <a href="http://www.amazon.fr/Bibou-monde-%C3%A9checs-V%C3%A9ronique-Houck/dp/2878333934" class="liexternal">Bibou &#038; le monde des Ã©checs</a>, and the other one <a href="http://www.echecs.com/actualites/actualites-le-jeu-d-echecs-au-cycle-2-1126.html" class="liexternal">Le jeu d&#8217;Ã©checs au cycle2</a>. It&#8217;s not so easy to find, but using Google, you can find <a href="http://www.amazon.fr/jeu-d%C3%A9checs-cycle-2/dp/2866344081/ref=sr_1_6?ie=UTF8&#038;s=books&#038;qid=1233105118&#038;sr=8-6" class="liexternal">shows</a> <a href="http://www.decitre.fr/livres/Le-jeu-d-echecs-au-cycle-2.aspx/9782866344085" class="liexternal">many</a> <a href="http://www.priceminister.com/offer/buy/59851203/Houck-Veronique-Le-Jeu-D-echecs-Au-Cycle-2-Livre.html" class="liexternal">links</a>.</p>
<p>I&#8217;ve not yet read them. I&#8217;ll make a review when I get them.</p>

<div style="font-size:0px;height:0px;line-height:0px;margin:0;padding:0;clear:both"></div>
	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.gradstein.info/kid/easy-chess-games-for-kids-mate-in-one/" title="Easy chess games for kids (mate in one) (February 2, 2009)">Easy chess games for kids (mate in one)</a> (5)</li>
	<li><a href="http://www.gradstein.info/kid/new-chess-website-for-chess-educationpromotion/" title="New chess website for Chess education/promotion (December 29, 2009)">New chess website for Chess education/promotion</a> (0)</li>
</ul>

<div class="feedflare">
<a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=PHBKZyNA"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?d=41" border="0"></img></a> <a href="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?a=ftIfj9g9"><img src="http://feeds.feedburner.com/~f/LiorGradsteinsBlog?i=ftIfj9g9" border="0"></img></a>
</div><img src="http://feeds.feedburner.com/~r/LiorGradsteinsBlog/~4/bmHhNtMJmJA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.gradstein.info/kid/idos-chess-journey-how-to-teach-chess-to-a-3-year-old-kid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
