<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Graham King</title>
	
	<link>http://www.darkcoding.net</link>
	<description>Solvitas perambulum</description>
	<lastBuildDate>Tue, 20 Oct 2009 17:47:06 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/darkcoding" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>Memcached: List all keys</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/2IpOwHTf9yo/</link>
		<comments>http://www.darkcoding.net/software/memcached-list-all-keys/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 16:50:30 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[memcached cache keys list]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=596</guid>
		<description><![CDATA[	In the general case, there is no way to list all the keys that a memcached instance is storing. You can, however, list something like the first 1Meg of keys, which is usually enough during development. Here&#8217;s how:

	Telnet to your server:

	telnet 127.0.0.1 11211

	

	List the items, to get the slab ids:

	stats items
STAT items:3:number 1
STAT items:3:age 498
STAT [...]]]></description>
			<content:encoded><![CDATA[	<p>In the general case, there is <a href="http://code.google.com/p/memcached/wiki/FAQ#Can_I_iterate_the_items_of_the_memcached_server?">no way to list all the keys</a> that a <a href="http://www.danga.com/memcached/">memcached</a> instance is storing. You can, however, list something like the first 1Meg of keys, which is usually enough during development. Here&#8217;s how:</p>

	<p>Telnet to your server:</p>

	<p><blockquote>telnet 127.0.0.1 11211</blockquote></p>

	<p><span id="more-596"></span></p>

	<p>List the items, to get the slab ids:</p>

	<p><blockquote>stats items<br />
<span class="caps">STAT</span> items:3:number 1<br />
<span class="caps">STAT</span> items:3:age 498<br />
<span class="caps">STAT</span> items:22:number 1<br />
<span class="caps">STAT</span> items:22:age 498<br />
<span class="caps">END</span></blockquote></p>

	<p>The first number after &#8216;items&#8217; is the slab id. Request a cache dump for each slab id, with a limit for the max number of keys to dump:</p>

	<p><blockquote>stats cachedump 3 100<br />
<span class="caps">ITEM</span> views.decorators.cache.cache_header..cc7d9 [6 b; 1256056128 s]<br />
<span class="caps">END</span><br />
stats cachedump 22 100<br />
<span class="caps">ITEM</span> views.decorators.cache.cache_page..8427e [7736 b; 1256056128 s]<br />
<span class="caps">END</span></blockquote></p>

	<p>Thanks to Boris Partensky in the Memcached group <a href="http://groups.google.com/group/memcached/browse_thread/thread/632ce89cff47522d?pli=1">here</a></p>

	<p>There you go!</p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/2IpOwHTf9yo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/memcached-list-all-keys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/memcached-list-all-keys/</feedburner:origLink></item>
		<item>
		<title>Guy Kawasaki’s 10-20-30 presentation rule</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/at_QTTNo9Ls/</link>
		<comments>http://www.darkcoding.net/misc/guy-kawasakis-10-20-30-presentations-rule/#comments</comments>
		<pubDate>Thu, 01 Oct 2009 17:41:22 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[presentation youtube guykawasaki 10-20-30]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=587</guid>
		<description><![CDATA[	Funny, practical, and well worth 1 minute 50 seconds of your life:

	

	via the BootUp Labs Blog.

 ]]></description>
			<content:encoded><![CDATA[	<p>Funny, practical, and well worth 1 minute 50 seconds of your life:</p>

	<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/liQLdRk0Ziw&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/liQLdRk0Ziw&#038;color1=0xb1b1b1&#038;color2=0xcfcfcf&#038;hl=en&#038;feature=player_embedded&#038;fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object></p>

	<p>via the <a href="http://blog.bootuplabs.com/2009/09/29/3-investor-pitch-conditions-why-you-get-conflicting-advice/">BootUp Labs Blog</a>.</p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/at_QTTNo9Ls" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/guy-kawasakis-10-20-30-presentations-rule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/guy-kawasakis-10-20-30-presentations-rule/</feedburner:origLink></item>
		<item>
		<title>I’m on identi.ca and Twitter</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/Jr9EV5nq8gg/</link>
		<comments>http://www.darkcoding.net/misc/im-on-identi-ca-and-twitter/#comments</comments>
		<pubDate>Thu, 17 Sep 2009 16:08:35 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[microblogging twitter identica]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=578</guid>
		<description><![CDATA[I am sharing my thoughts, mainly about web technologies, on identi.ca and twitter.


Graham King on identi.ca
Graham King on Twitter


The nature of the medium means those thoughts will be generally raw and truncated, but timely.
]]></description>
			<content:encoded><![CDATA[<p>I am sharing my thoughts, mainly about web technologies, on identi.ca and twitter.</p>

<ul>
<li><a href="http://identi.ca/grahamking">Graham King on identi.ca</a></li>
<li><a href="http://twitter.com/grahamking">Graham King on Twitter</a></li>
</ul>

<p>The nature of the medium means those thoughts will be generally raw and <a href="http://identi.ca/notice/9739093">truncated</a>, but timely.</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/Jr9EV5nq8gg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/im-on-identi-ca-and-twitter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/im-on-identi-ca-and-twitter/</feedburner:origLink></item>
		<item>
		<title>Social psychology in sales copy: Good copy writing</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/4GbKdZ3lyYw/</link>
		<comments>http://www.darkcoding.net/behaviour/social-psychology-in-sales-copy-good-copy-writing/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 18:03:35 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Behaviour]]></category>
		<category><![CDATA[behavior socialpsychology influence copy copywriting sales]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=560</guid>
		<description><![CDATA[I recently received an advert for an investment fund in which, as the amateur social psychologist that I am, I noticed illustrated a couple of psychological principles. The are both covered in the email title:


  Last chance to invest in a firm favourite


They are covered again in more detail in this paragraph:


  The [...]]]></description>
			<content:encoded><![CDATA[<p>I recently received an advert for an investment fund in which, as the amateur social psychologist that I am, I noticed illustrated a couple of psychological principles. The are both covered in the email title:</p>

<blockquote>
  <p>Last chance to invest in a firm favourite</p>
</blockquote>

<p>They are covered again in more detail in this paragraph:</p>

<blockquote>
  <p>The x y z Fund only launched six months ago, but has already attracted considerable interest. To keep it small and flexible the number of units has been capped at 200 million. Last week they had reached two-thirds of that total and interest is intensifying. In the last two days alone they sold over 6 million units, so it is likely to close very soon.</p>
</blockquote>

<p><span id="more-560"></span></p>

<h2>Social Proof</h2>

<p>The first principle is <a href="http://en.wikipedia.org/wiki/Social_Proof">Social Proof</a>. This fund is <em>&#8220;a firm favorite&#8221;</em> and <em>&#8220;has already attracted considerable interest&#8221;</em> and already <em>&#8220;sold over 6 million units&#8221;</em>. In other words, other people think it&#8217;s a very good idea to invest in this fund, so you should to.<br />
Many of the top researchers in the field of influence (social psychology, behavioral economics, etc) <a href="http://www.time.com/time/printout/0,8816,1889153,00.html">worked with the Obama campaign</a>, Their last minute get-out-the-vote message was <em>&#8220;A Record Turnout Is Expected&#8221;</em>. People are more likely to vote if they think other people will vote. The most beautiful part of social proof is that it is undetected &#8211; most people will deny that this is the case.</p>

<p>No-one know which fund to invest in, because most of them under-perform the index, and if the stock market really is a <a href="http://en.wikipedia.org/wiki/Random_walk_hypothesis">random walk</a>, then there is no sane way to invest. It is in exactly that type of ambiguous situation where people look to other people to decide how to react.</p>

<h2>Scarcity</h2>

<p>We want what we may not be able to have in the future, that&#8217;s the <a href="http://changingminds.org/principles/scarcity.htm">Scarcity Principle</a>. This is the <em>&#8220;Last chance&#8221;</em> to invest in this fund because it is <em>&#8220;likely to close very soon&#8221;</em>. Fear of losing out on something can be an extremely powerful motivator, and you see it every day when stores have end-of-line or closing-down sales, or when something is offer in &#8216;limited quantity&#8217;.</p>

<h2>Invest with your calculator, not your heart</h2>

<p>That email is an emotional appeal, not a rational one. Selling a new fund during a recession must be difficult, and there&#8217;s no reason to think this one is selling well. The language doesn&#8217;t promise anything concrete, so it doesn&#8217;t lie. It just influences. And that is good copy writing.</p>

<p>The seminal book on this topic is  <a href="http://www.amazon.com/gp/product/0205609996?ie=UTF8&#038;tag=darkcoding-20&#038;linkCode=as2&#038;camp=1789&#038;creative=390957&#038;creativeASIN=0205609996">Robert Cialdini&#8217;s &#8220;Influence&#8221;</a><img src="http://www.assoc-amazon.com/e/ir?t=darkcoding-20&#038;l=as2&#038;o=1&#038;a=0205609996" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" />, which I highly recommend. It&#8217;s a New York Times best seller, and Fortune Magazine lists Influence in their &#8220;75 Smartest Business Books.&#8221; You see what I did there? :-)</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/4GbKdZ3lyYw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/behaviour/social-psychology-in-sales-copy-good-copy-writing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/behaviour/social-psychology-in-sales-copy-good-copy-writing/</feedburner:origLink></item>
		<item>
		<title>Choosing a message queue for Python on Ubuntu on a VPS</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/xO-uPwO5HSE/</link>
		<comments>http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/#comments</comments>
		<pubDate>Mon, 10 Aug 2009 05:05:13 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[python ubuntu messaging queue gearman]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=539</guid>
		<description><![CDATA[More and more, my web apps need to run things in the background: Sending email, re-calculating values, fetching website thumbnails, etc. In short, I need a message queue in my toolbox.

Luckily for me, message queues are this years Hot New Thing, so there&#8217;s some good options. I looked at RabbitMQ, Gearman, Beanstalkd and StompServer.


I&#8217;d like [...]]]></description>
			<content:encoded><![CDATA[<p>More and more, my web apps need to run things in the background: Sending email, re-calculating values, fetching website thumbnails, etc. In short, I need a message queue in my toolbox.</p>

<p>Luckily for me, message queues are this years <a href="http://simonwillison.net/tags/messagequeues/">Hot New Thing</a>, so there&#8217;s some good options. I looked at <a href="http://www.rabbitmq.com/">RabbitMQ</a>, <a href="http://gearman.org">Gearman</a>, <a href="http://xph.us/software/beanstalkd/">Beanstalkd</a> and <a href="http://stompserver.rubyforge.org/">StompServer</a>.</p>

<p><span id="more-539"></span>
I&#8217;d like the message queue to play nice with Python, with Ubuntu, and take almost no memory, as I&#8217;m on a <a href="http://linode.com">Virtual Private Server</a>, and I&#8217;d like it to stay up forever. I want small and solid.</p>

<h2>Summary</h2>

<table border="1" cellpadding="2">
<tr>
  <td></td>
  <th>RabbitMQ</th>
  <th>Gearman</th>
  <th>Beanstalkd</th>
  <th>StompServer</th>
</tr>

<tr>
 <th>Language</th>
 <td>Erlang</td>
 <td>C</td>
 <td>C</td>
 <td>Ruby</td>
</tr>

<tr>
 <th>In Ubuntu?</th>
 <td>Yes: rabbitmq-server</td>
 <td>Only the old Perl version. The new C version has Ubuntu packages on launchpad</td>
 <td>No</td>
 <td>No, it&#8217;s a Ruby gem</td>
</tr>

<tr>
 <th>Python lib</th>
 <td>amqplib</td>
 <td>gearman</td>
 <td>pybeanstalk</td>
 <td>stomp-py</td>
</tr>

<tr>
 <th>In PyPI?</th>
 <td>Yes</td>
 <td>Yes</td>
 <td>No</td>
 <td>No</td>
</tr>

<tr>
  <th>Memory</th>
  <td>9Mb</td>
  <td>1.4Mb</td>
  <td>0.5Mb</td>
  <td>7Mb</td>
</tr>

<tr>
 <th>Protocol</th>
 <td>AMQP</td>
 <td>Custom</td>
 <td>Custom</td>
 <td>STOMP</td>
</tr>

<tr>
 <th>License</th>
 <td>MPL</td>
 <td>BSD</td>
 <td>GPL</td>
 <td>MIT</td>
</tr>

</table>

<p>Memory size is the resident set size, obtained like so: <code>ps -Ao pid,rsz,args | grep &lt;name&gt;</code>. If there is a better way of estimating memory please let me know in the comments.</p>

<h2>RabbitMQ</h2>

<p>An all-singing all-dancing &#8220;complete and highly reliable Enterprise Messaging system&#8221;. With language like that you&#8217;d expect horrible bloat and per-cpu licensing, but happily that&#8217;s not the case. It&#8217;s straightforward to setup and relatively lean.</p>

<p>The protocol, <a href="http://en.wikipedia.org/wiki/Advanced_Message_Queuing_Protocol">AMQP</a>, comes from the financial world, and is intended to replace Tibco&#8217;s RendezVous, the backbone of most investment banks. There&#8217;s lots of documentation, lots of users, a healthy ecosystem, and it looks good on your CV.<br />
I tried RabbitMQ first, and liked it so much I almost stopped my evaluation right there and deployed it.</p>

<p>The best tutorial for using it from Python is here: <a href="http://blogs.digitar.com/jjww/2009/01/rabbits-and-warrens/">Rabbits and Warrens</a></p>

<h4>Publisher</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5391');">Quick Code</a></p></p>

<div id="quickcode5391" class="quickcode"><code><br />
import sys<br />
import time<br />
&nbsp;<br />
from amqplib import client_0_8 as amqp<br />
&nbsp;<br />
conn = amqp.Connection(host=&quot;localhost:5672&quot;, userid=&quot;guest&quot;, password=&quot;guest&quot;, virtual_host=&quot;/&quot;, insist=False)<br />
chan = conn.channel()<br />
&nbsp;<br />
i = 0<br />
while 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;msg = amqp.Message(&#039;Message %d&#039; % i)<br />
&nbsp;&nbsp;&nbsp;&nbsp;msg.properties[&quot;delivery_mode&quot;] = 2<br />
&nbsp;&nbsp;&nbsp;&nbsp;chan.basic_publish(msg,exchange=&quot;sorting_room&quot;,routing_key=&quot;testke y&quot;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(1)<br />
&nbsp;<br />
chan.close()<br />
conn.close()<br />
</code></div>

<h4>Consumer</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5392');">Quick Code</a></p></p>

<div id="quickcode5392" class="quickcode"><code><br />
from amqplib import client_0_8 as amqp<br />
&nbsp;<br />
conn = amqp.Connection(host=&quot;localhost:5672&quot;, userid=&quot;guest&quot;, password=&quot;guest&quot;, virtual_host=&quot;/&quot;, insist=False)<br />
chan = conn.channel()<br />
&nbsp;<br />
chan.queue_declare(queue=&quot;po_box&quot;, durable=True, exclusive=False, auto_delete=False)<br />
chan.exchange_declare(exchange=&quot;sorting_room&quot;, type=&quot;direct&quot;, durable=True, auto_delete=False,)<br />
&nbsp;<br />
chan.queue_bind(queue=&quot;po_box&quot;, exchange=&quot;sorting_room&quot;, routing_key=&quot;testkey&quot;)<br />
&nbsp;<br />
def recv_callback(msg):<br />
&nbsp;&nbsp;&nbsp;&nbsp;print msg.body<br />
&nbsp;<br />
chan.basic_consume(queue=&#039;po_box&#039;, no_ack=True, callback=recv_callback, consumer_tag=&quot;testtag&quot;)<br />
&nbsp;<br />
while True:<br />
&nbsp;&nbsp;&nbsp;&nbsp;chan.wait()<br />
&nbsp;<br />
#chan.basic_cancel(&quot;testtag&quot;)<br />
#chan.close()<br />
#conn.close()<br />
</code></div>

<h2>Gearman</h2>

<p>Gearman is a system to farm out work to other machines, dispatching function calls to machines that are better suited to do work, to do work in parallel, to load balance lots of function calls, or to call functions between languages.</p>

<p>Developed by <a href="http://www.danga.com/">Danga Interactive</a> (essentially Brad Fitzpatrick, who brought us Memcached and Perlbal). Used by LiveJournal, Digg and Yahoo.</p>

<p>The original Perl version is the Ubuntu repository as &#8216;gearman-server&#8217;, but that&#8217;s not the one you want. To get the newer leaner C version follow the instructions here: <a href="https://launchpad.net/~gearman-developers/+archive/ppa">https://launchpad.net/~gearman-developers/+archive/ppa</a> 
You&#8217;ll also need to add the key:</p>

<ul>
<li>sudo apt-key adv &#8211;keyserver keyserver.ubuntu.com &#8211;recv-keys 1C73E014 </li>
<li>sudo apt-get update</li>
</ul>

<h4>Client</h4>

<div class="quickcodenoclick"><code><br />
import sys<br />
import time<br />
&nbsp;<br />
from gearman import GearmanClient, Task<br />
&nbsp;<br />
client = GearmanClient([&quot;127.0.0.1&quot;])<br />
&nbsp;<br />
i = 0<br />
while 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;client.dispatch_background_task(&#039;speak&#039;, i)<br />
&nbsp;&nbsp;&nbsp;&nbsp;print &#039;Dispatched %d&#039; % i<br />
&nbsp;&nbsp;&nbsp;&nbsp;i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(1)<br />
</code></div>

<h4>Worker</h4>

<div class="quickcodenoclick"><code><br />
import time<br />
&nbsp;<br />
from gearman import GearmanWorker<br />
&nbsp;<br />
def speak(job):<br />
&nbsp;&nbsp;&nbsp;&nbsp;r = &#039;Hello %s&#039; % job.arg<br />
&nbsp;&nbsp;&nbsp;&nbsp;print r<br />
&nbsp;&nbsp;&nbsp;&nbsp;return r<br />
&nbsp;<br />
worker = GearmanWorker(&quot;[127.0.0.1]&quot;)<br />
worker.register_function(&#039;speak&#039;, speak, timeout=3)<br />
worker.work()<br />
</code></div>

<h2>Beanstalkd</h2>

<p>Beanstalkd is a fast, distributed, in-memory workqueue service. Its interface is generic, but was designed for use in reducing the latency of page views in high-volume web applications by running most time-consuming tasks asynchronously.</p>

<p>Developed for a very popular Facebook Application. The smallest memory footprint: after startup, connecting, sending a few messages, it&#8217;s resident memory size (rsz) was still only <strong>0.5 Mb</strong>!</p>

<p>To install the server:</p>

<ul>
<li>sudo apt-get install libevent-dev</li>
<li>wget http://xph.us/dist/beanstalkd/beanstalkd-1.3.tar.gz</li>
<li>tar xvzf beanstalkd-1.3.tar.gz</li>
<li>./configure</li>
<li>make (there&#8217;s no install step, it just generates the file &#8216;beanstalkd&#8217;)</li>
</ul>

<p>To install the Python library:</p>

<ul>
<li>wget http://pybeanstalk.googlecode.com/files/pybeanstalk-0.11.1.tar.gz</li>
<li>extract it</li>
<li>sudo python setup.py install</li>
</ul>

<p>There&#8217;s a good tutorial here: <a href="http://parand.com/say/index.php/2008/10/12/beanstalkd-python-basic-tutorial/">http://parand.com/say/index.php/2008/10/12/beanstalkd-python-basic-tut orial/</a></p>

<h4>Producer</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5395');">Quick Code</a></p></p>

<div id="quickcode5395" class="quickcode"><code><br />
import time<br />
&nbsp;<br />
from beanstalk import serverconn<br />
from beanstalk import job<br />
&nbsp;<br />
def producer_main(connection):<br />
&nbsp;&nbsp;&nbsp;&nbsp;i = 0<br />
&nbsp;&nbsp;&nbsp;&nbsp;while True:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data = &#039;This is data to be consumed (%s)!&#039; % (i,)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print data<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data = job.Job(jid=i,data=data, conn=connection)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;data.Queue()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(1)<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;i += 1;<br />
&nbsp;<br />
connection = serverconn.ServerConn(&#039;localhost&#039;, 11300)<br />
#connection.job = job.Job<br />
producer_main(connection)<br />
</code></div>

<h4>Consumer</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5396');">Quick Code</a></p></p>

<div id="quickcode5396" class="quickcode"><code><br />
from beanstalk import serverconn<br />
from beanstalk import job<br />
&nbsp;<br />
def consumer_main(connection):<br />
&nbsp;&nbsp;&nbsp;&nbsp;while True:<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j = connection.reserve()<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &#039;got work: %s&#039; % j.data<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;j.Finish()<br />
&nbsp;<br />
connection = serverconn.ServerConn(&#039;localhost&#039;, 11300)<br />
connection.job = job.Job<br />
consumer_main(connection)<br />
</code></div>

<h2>StompServer</h2>

<p>StompServer is a lightweight pure Ruby <a href="http://en.wikipedia.org/wiki/Streaming_Text_Orientated_Messaging_Protocol">STOMP</a> server. </p>

<p>To install the server on Ubuntu:</p>

<ul>
<li>sudo apt-get install ruby-dev rubygems</li>
<li>sudo gem install stompserver</li>
</ul>

<p>To install the Python library:</p>

<ul>
<li>wget http://stomppy.googlecode.com/files/stomp.py-2.0.1.tar.gz</li>
<li>extract it</li>
<li>sudo python setup.py install</li>
</ul>

<p>There&#8217;s a good Python / Stompserver tutorial here: <a href="http://morethanseven.net/2008/09/14/using-python-and-stompserver-get-started-message-q/">http://morethanseven.net/2008/09/14/using-python-and-stompserver-get-s tarted-message-q/</a></p>

<h4>Sender</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5397');">Quick Code</a></p></p>

<div id="quickcode5397" class="quickcode"><code><br />
import time<br />
&nbsp;<br />
import stomp<br />
&nbsp;<br />
conn = stomp.Connection()<br />
conn.start()<br />
conn.connect()<br />
&nbsp;<br />
i = 0<br />
while 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;conn.send(&#039;Message %d&#039; % i, destination=&#039;/queue/test&#039;)<br />
&nbsp;&nbsp;&nbsp;&nbsp;i += 1<br />
&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(1)<br />
&nbsp;<br />
conn.disconnect()<br />
</code></div>

<h4>Listener</h4>

<p><a class="quickcode" title="Code" href="javascript:toggleLayer('quickcode5398');">Quick Code</a></p></p>

<div id="quickcode5398" class="quickcode"><code><br />
import time<br />
import sys<br />
&nbsp;<br />
import stomp<br />
&nbsp;<br />
class MyListener(object):<br />
&nbsp;&nbsp;&nbsp;&nbsp;def on_error(self, headers, message):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &#039;received an error %s&#039; % message<br />
&nbsp;<br />
&nbsp;&nbsp;&nbsp;&nbsp;def on_message(self, headers, message):<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;print &#039;received a message %s&#039; % message<br />
&nbsp;<br />
conn = stomp.Connection()<br />
conn.set_listener(&#039;&#039;, MyListener())<br />
conn.start()<br />
conn.connect()<br />
&nbsp;<br />
conn.subscribe(destination=&#039;/queue/test&#039;, ack=&#039;auto&#039;)<br />
&nbsp;<br />
while 1:<br />
&nbsp;&nbsp;&nbsp;&nbsp;time.sleep(2)<br />
</code></div>

<h2>Results and Conclusions</h2>

<p>I&#8217;d be happy working with any of these four. All four were easy to setup, fast, decent in memory consumption, and had good Python libraries.</p>

<p>RabbitMQ has the most mindshare (it is the only one which registers on <a href="http://www.google.com/trends?q=rabbitmq%2C+gearman%2C+beanstalkd%2C+stompserver&#038;ctab=0&#038;geo=all&#038;date=all&#038;sort=0">Google Trends</a>), but it took the most memory and is the most complex to use. It looks like a great product, but it&#8217;s Message Oriented Middleware, not an in-memory job queue, so it&#8217;s not what I&#8217;m looking for.</p>

<p>StompServer had the least documentation, and took several times more memory than Gearman and Beanstalkd. In seems the most immature project, but would probably be a good choice for someone working in Ruby.</p>

<p>Beanstalkd is great. I would like to see it in the Ubuntu repositories, and it&#8217;s Python lib in PyPI, but aside from that, I can&#8217;t fault it. I&#8217;m not choosing it, because Gearman is even better.</p>

<p>Gearman was designed for exactly the problem I have, takes almost no memory (1.4Mb), has a great pedigree (Danga), is widely deployed (LiveJournal, Digg, Yahoo), is in Ubuntu (almost), has a Python library is in PyPI, and someone helped me out on the #gearman IRC channel straight away. It even has queue persistence and clustering. So, <a href="http://twitter.com/jacobian/status/2761378698">Gearman it is</a>.</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/xO-uPwO5HSE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/choosing-a-message-queue-for-python-on-ubuntu-on-a-vps/</feedburner:origLink></item>
		<item>
		<title>Quote of the day – monkeys</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/NsPI-aDIxnk/</link>
		<comments>http://www.darkcoding.net/misc/quote-of-the-day-monkeys/#comments</comments>
		<pubDate>Thu, 30 Jul 2009 19:09:11 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[quote monkey business]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=535</guid>
		<description><![CDATA[	In response to monkeys stealing his coffee beans, an Indian farmer observes: If you start shooting monkeys, you&#8217;ll spend the rest of your life shooting monkeys.



	via  Bruce Eckel
 ]]></description>
			<content:encoded><![CDATA[	<p><blockquote>In response to monkeys stealing his coffee beans, an Indian farmer observes: <em>If you start shooting monkeys, you&#8217;ll spend the rest of your life shooting monkeys.</em></blockquote></p>



	<p>via <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=264047"> Bruce Eckel</a></p>
 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/NsPI-aDIxnk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/quote-of-the-day-monkeys/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/quote-of-the-day-monkeys/</feedburner:origLink></item>
		<item>
		<title>On cellphone use in cars</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/A7ud60-_N44/</link>
		<comments>http://www.darkcoding.net/society/on-cellphone-use-in-cars/#comments</comments>
		<pubDate>Mon, 20 Jul 2009 17:11:28 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Behaviour]]></category>
		<category><![CDATA[Society]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=527</guid>
		<description><![CDATA[	A very interesting article in the New-York Times on the research behind the risks of being distracted by a cellphone whilst driving:

	http://www.nytimes.com/2009/07/19/technology/19distracted.html

	Here&#8217;s some excerpts:

	in a survey of 1,506 people last year by Nationwide Mutual Insurance, 81 percent of cellphone owners acknowledged that they talk on phones while driving, and 98 percent considered themselves safe drivers. [...]]]></description>
			<content:encoded><![CDATA[	<p>A very interesting article in the New-York Times on the research behind the risks of being distracted by a cellphone whilst driving:</p>

	<p><a href="http://www.nytimes.com/2009/07/19/technology/19distracted.html">http://www.nytimes.com/2009/07/19/technology/19distracted.html</a></p>

	<p>Here&#8217;s some excerpts:</p>

	<p><blockquote>in a survey of 1,506 people last year by Nationwide Mutual Insurance, 81 percent of cellphone owners acknowledged that they talk on phones while driving, and 98 percent considered themselves safe drivers. But 45 percent said they had been hit or nearly hit by a driver talking on a phone. </blockquote></p>

	<p>That&#8217;s the <a href="http://en.wikipedia.org/wiki/Lake_Wobegon_effect">Lake Wobegon effect</a>, the tendency for overestimate their capabilities in relation to others.</p>

	<p><span id="more-527"></span></p>

	<p><blockquote>&#8230;research, showing that multitasking drivers are four times as likely to crash as people who are focused on driving, matches the findings of two studies, in Canada and in Australia, of drivers on actual roads.</p>

	<p>The highway safety administration estimates that drivers using a hand-held device are at 1.3 times greater risk of a crash or near crash, and at three times the risk when dialing, compared with others who are simply driving. The agency based its conclusions on research from the Virginia Tech Transportation Institute, which placed cameras inside cars to monitor drivers for more than a year. The study found cellphones to be the most common cause of driver distraction.</p>

	<p>Research also shows that drivers conversing with fellow passengers do not present the same danger, because adult riders help keep drivers alert and point out dangerous conditions and tend to talk less in heavy traffic or hazardous weather.</blockquote></p>

	<p>The research shows that having a conversation on a hands-free sets is as dangerous as a conversation on a handheld phone &#8211; the problem is that, unlike a passenger, the person on the phone doesn&#8217;t stop distracting you when road conditions change, and they aren&#8217;t a second pair of eyes compensating for your distraction.</p>

	<p>So if the research is so strong, there are so many lives to be saved, how come we haven&#8217;t solved this one yet. Read on:</p>

	<p><blockquote>Joe Simitian, a state senator in California, managed to get his hands-free legislation, an effort he began in 2001, passed in 2006. He argued, based on data collected by the California Highway Patrol, that drivers using cellphones caused more fatalities than all the drivers distracted by eating, children, pets or personal hygiene.</p>

	<p>In each previous year, the bill was killed &#8212; after lobbying by cellphone carriers, including Sprint, AT&#038;T and T-Mobile. Mr. Simitian said that in the first two years, he would visit the offices of his colleagues on the Transportation Committee on the day of the vote and &#8220;find three cellphone industry lobbyists sitting in the legislator&#8217;s office,&#8221; Mr. Simitian said. &#8220;They&#8217;d just smile.&#8221;</blockquote></p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/A7ud60-_N44" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/society/on-cellphone-use-in-cars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/society/on-cellphone-use-in-cars/</feedburner:origLink></item>
		<item>
		<title>Django dynamic forms and formsets</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/wBfvWBCUWgQ/</link>
		<comments>http://www.darkcoding.net/software/django-dynamic-forms-and-formsets/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 01:08:23 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[django form formset]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=517</guid>
		<description><![CDATA[	A couple of great posts which explain Django dynamic forms and advanced formset usage very clearly:

	
	James Bennett: So you want a dynamic formMalcolm Tredinnick: Advanced Formset usage in Django


 ]]></description>
			<content:encoded><![CDATA[	<p>A couple of great posts which explain <a href="http://www.djangoproject.com">Django</a> dynamic forms and advanced formset usage very clearly:</p>

	<p><ul></p>
	<p><li>James Bennett: <a href="http://www.b-list.org/weblog/2008/nov/09/dynamic-forms/">So you want a dynamic form</a></li><li>Malcolm Tredinnick: <a href="http://www.pointy-stick.com/blog/2009/01/23/advanced-formset-usage-django/">Advanced Formset usage in Django</a></li><br />
</ul></p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/wBfvWBCUWgQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/django-dynamic-forms-and-formsets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/django-dynamic-forms-and-formsets/</feedburner:origLink></item>
		<item>
		<title>How and Why to extend Firefox in Javascript</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/8rAYamLEMXs/</link>
		<comments>http://www.darkcoding.net/software/how-and-why-to-extend-firefox-in-javascript/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 03:29:22 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[owv2009 firefox speaking vancouver extension addon javascript]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=512</guid>
		<description><![CDATA[	I will be giving this talk on Friday 12th June, at Open Web Vancouver 2009.

	View more Keynote presentations from Graham King.

 ]]></description>
			<content:encoded><![CDATA[	<p>I will be giving this talk on Friday 12th June, at <a href="http://www.openwebvancouver.ca/">Open Web Vancouver 2009</a>.</p>

	<p><div style="width:425px;text-align:left" id="__ss_1565242"><object style="margin:0px" width="425" height="355"><param name="movie" value="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=owv2009-090610200628-phpapp02&#038;stripped_title=how-and-why-to-extend-firefox" /><param name="allowFullScreen" value="true"/><param name="allowScriptAccess" value="always"/><embed src="http://static.slidesharecdn.com/swf/ssplayer2.swf?doc=owv2009-090610200628-phpapp02&#038;stripped_title=how-and-why-to-extend-firefox" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="355"></embed></object><div style="font-size:11px;font-family:tahoma,arial;height:26px;padding-top:2px;">View more <a style="text-decoration:underline;" href="http://www.slideshare.net/">Keynote presentations</a> from <a style="text-decoration:underline;" href="http://www.slideshare.net/graham_king">Graham King</a>.</div></div></p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/8rAYamLEMXs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/how-and-why-to-extend-firefox-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/how-and-why-to-extend-firefox-in-javascript/</feedburner:origLink></item>
		<item>
		<title>Unix shared directory permissions: GUID and umask</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/qap1ixATOAM/</link>
		<comments>http://www.darkcoding.net/software/unix-shared-directory-permissions-guid-and-umask/#comments</comments>
		<pubDate>Wed, 10 Jun 2009 19:11:26 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[mercurial guid unix group permission directory]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=502</guid>
		<description><![CDATA[I setup my Mercurial repository in the same way we used to do CVS, then SVN: A directory owned by a group, with the GUID bit, and all users who need to commit are in that group. 

The steps are, create the group and add relevant users to it:


&#160;&#160;&#160;&#160;sudo groupadd topsecretgroup
&#160;&#160;&#160;&#160;sudo usermod -a -G topsecretgroup [...]]]></description>
			<content:encoded><![CDATA[<p>I setup my Mercurial repository in the same way we used to do CVS, then SVN: A directory owned by a group, with the GUID bit, and all users who need to commit are in that group. </p>

<p>The steps are, create the group and add relevant users to it:</p>

<div class="quickcodenoclick"><code><br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo groupadd topsecretgroup<br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo usermod -a -G topsecretgroup graham</code></div>

<p><span id="more-502"></span></p>

<p>Change the project directory to be owned by that group, and accessible by no-one else:</p>

<div class="quickcodenoclick"><code><br />
&nbsp;&nbsp;&nbsp;&nbsp;cd topsecretproject/<br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo chown graham:topsecretgroup -R .<br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo chmod g=u,o= -R .&nbsp;&nbsp;</code></div>

<p>Set the GUID bit on all the directories, so that new files and directories are created owned by the group:</p>

<div class="quickcodenoclick"><code><br />
&nbsp;&nbsp;&nbsp;&nbsp;find . -type d | sudo xargs chmod g+s</code></div>

<p>Change the umask for everyone, so that new files are created with read and write permissions for the group:</p>

<div class="quickcodenoclick"><code><br />
&nbsp;&nbsp;&nbsp;&nbsp;sudo vi /etc/profile<br />
&nbsp;&nbsp;&nbsp;&nbsp;change &#039;umask 022&#039; to &#039;umask 002&#039; </code></div>

<p>The last part, changing the umask, isn&#8217;t ideal. It works on Debian and Ubuntu, because every user has their own group. I would rather a more focused solution, just for that directory &#8211; suggestions welcome.</p>

<p>References:</p>

<p><a href="http://www.freehackers.org/thomas/2008/09/16/about-mercurial-and-permissions/">Mercurial and permissions</a><br />
<a href="http://www.selenic.com/mercurial/wiki/MultipleCommitters">Multiple Committers</a><br />
<a href="http://ubuntuforums.org/showthread.php?t=127084">Change Ubuntu global umask</a><br />
<a href="http://hgbook.red-bean.com/read/collaborating-with-other-people.html">Collaboration models</a>  </p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/qap1ixATOAM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/unix-shared-directory-permissions-guid-and-umask/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/unix-shared-directory-permissions-guid-and-umask/</feedburner:origLink></item>
		<item>
		<title>Legal 1 Usability 0</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/syoSnOH99wg/</link>
		<comments>http://www.darkcoding.net/misc/legal-1-usability-0/#comments</comments>
		<pubDate>Wed, 27 May 2009 18:55:46 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[food temperature microwave legal usability]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=494</guid>
		<description><![CDATA[	The cooking instructions for my Tandoori Chicken Breast microwave lunch, are to cook&#8230;

	&#8230;until internal temperature reaches 74C (165F).

	How many office kitchens have a cook&#8217;s thermometer? Score nothing for usability.

	Should you for any reason attempt to sue the manufacturer, it will rapidly become apparent that you didn&#8217;t follow the cooking instructions. Score one for legal.

 ]]></description>
			<content:encoded><![CDATA[	<p>The cooking instructions for my Tandoori Chicken Breast microwave lunch, are to cook&#8230;</p>

	<p><blockquote>&#8230;until internal temperature reaches 74C (165F).</blockquote></p>

	<p>How many office kitchens have a cook&#8217;s thermometer? Score nothing for usability.</p>

	<p>Should you for any reason attempt to sue the manufacturer, it will rapidly become apparent that you didn&#8217;t follow the cooking instructions. Score one for legal.</p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/syoSnOH99wg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/legal-1-usability-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/legal-1-usability-0/</feedburner:origLink></item>
		<item>
		<title>OpenTTD: Trains and signals for beginners – a tutorial</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/XnibbhArJgU/</link>
		<comments>http://www.darkcoding.net/misc/openttd-trains-and-signals-for-beginners-a-tutorial/#comments</comments>
		<pubDate>Thu, 21 May 2009 07:22:43 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[openttd train signal game tutorial]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=464</guid>
		<description><![CDATA[I have been playing Open Transport Tycoon Deluxe, or OpenTTD on and off for a while, but I confess I only understood train signals very recently. The game gets a lot more fun once you can have complex track layouts, so here&#8217;s a tutorial on train track layout and signaling for complete beginners.
Building tracks the [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing Open Transport Tycoon Deluxe, or <a href="http://www.openttd.org">OpenTTD</a> on and off for a while, but I confess I only understood train signals very recently. The game gets a lot more fun once you can have complex track layouts, so here&#8217;s a tutorial on train track layout and signaling for complete beginners.</p>
<h2>Building tracks the wrong way</h2>
<p>If you&#8217;re anything like I was, all your train layouts probably look like this:</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/one-to-one.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/one-to-one-150x150.jpg" alt="one-to-one" title="one-to-one" width="150" height="150" class="aligncenter size-thumbnail wp-image-468" /></a></p>
<p><span id="more-464"></span></p>
<p>You can only run one train on that track, but say you&#8217;re happy with that. When you need to connect another station, you might, unsuccessfully, try this:</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/two-stations-naive.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/two-stations-naive-150x150.jpg" alt="two-stations-naive" title="two-stations-naive" width="150" height="150" class="aligncenter size-thumbnail wp-image-469" /></a></p>
<p>Notice the three two-way signals. <strong>A signal locks an entire section of track from that signal until the next signal or the end of the line.</strong> These signals define four locks, color coded on this screenshot. If the train from Lundinghattan Ridge is in the Mardingbury station, it will have a lock on the yellow section, but not on the green section. The signal nearest Mardingbury will be red, but the other two signals will be green. The train from Marbourne will be able to acquire a lock on the green section, and stop at the signal nearest Mardingbury. We have a train stand-off. Not good.</p>
<p>To make that layout work, you&#8217;d need to remove the signal nearest Mardingbury, thereby merging the green and yellow sections. You remove that, and you have two trains sharing a station. OK, so now you add a third station to your network. Now things really start to break down.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/blocked.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/blocked-150x150.jpg" alt="blocked" title="blocked" width="150" height="150" class="aligncenter size-thumbnail wp-image-471" /></a></p>
<p>The blue section is shared between the Lundinghattan train and the Chenningpool train. The Lundinghattan train is top left, just leaving Mardingbury station. It has the lock on the yellow section. Notice the two signals nearest it are red (actually all the signals in this picture are red, but focus on just those two).  The train from Chenningpool acquired the lock on the blue section, but and this is the first important concept of this tutorial, once it got level with the depot it had a choice of two paths: Mardingbury, which is blocked by a red signal, and the depot, which isn&#8217;t. <strong>A train faced with a red two-way signal will always avoid that signal, even if that means going away from it&#8217;s destination</strong>. If instead of the depot we had a track running to the other side of the map, our Chenningpool would of happily headed down it, to avoid the red signal.</p>
<p>In practice this means our Chenningpool train will head into the depot, turn around, and head back to Chenningpool. It will never make it to Mardingbury. There is something very wrong with our approach, and the short answer is that we were using two-way tracks and two-way signals. We need to think one-way. Let&#8217;s start again.</p>
<h2>The basic loading loop</h2>
<p>Every shared station should have a one-way loading loop.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/loading-loop.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/loading-loop-150x150.jpg" alt="loading-loop" title="loading-loop" width="150" height="150" class="aligncenter size-thumbnail wp-image-473" /></a></p>
<p>Notice the signals around the loop are all one-way. To place a one-way signal place a signal as normal, then click the signal again, once or twice depending on the orientation you want for your signal.</p>
<p>Now let&#8217;s connect our loop up to a town, and run two trains betweens those two towns.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/shared-track1.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/shared-track1-150x150.jpg" alt="shared-track1" title="shared-track1" width="150" height="150" class="aligncenter size-thumbnail wp-image-474" /></a></p>
<p>We connected the shared track from Marbourne to our loading loop, with two short one-way sections. We can see the back of a one-way signal in the red circle, and the front of a one-way signal just to the right of the blue circle.</p>
<p>Let&#8217;s look at what&#8217;s going on in this picture. The train circled in red has the lock on the red section of track, and is held at the signal circled in red. It is waiting for a lock on the blue section of track. Notice that it could of kept going around the loop, instead of branching off and stopping at the red signal. <strong>Faced with a red one-way signal and a clear track going the wrong way, the train will stop at the signal, which is nearly always what we want</strong>. This is exactly the opposite to what would of happened with two-way signals.</p>
<p>The train circled in blue has the lock on the blue section of track, and is about to acquire the lock on the yellow section. As soon as it does, it will release the lock on the blue section, and the train circled in red will move forward. This is a layout that works.</p>
<h2>Prefer one way tracks</h2>
<p>Let&#8217;s connect up the other two towns, and not get blocked this time. The trick is to make all shared sections of track one-way.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/one-way.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/one-way-150x150.jpg" alt="one-way" title="one-way" width="150" height="150" class="aligncenter size-thumbnail wp-image-475" /></a></p>
<p>The only two-way signals in this picture are circled in blue. All the others are one-way. The two-way signals are there to prevent a train on the two-way track from locking part of the one-way loop. If the left-hand two-way signal was not there, a train in Lundinghattan station would hold a lock on it&#8217;s two-way section of track, and the bottom part of the one-way section, up to the next signals. Remember, a lock is between two signals or the end of the track. Incidentally, stations don&#8217;t end a lock. If you had a station half-way along a track, the lock would run right through it until the next signal.</p>
<h2>Pre-signals, the pro-layout</h2>
<p>Mardingbury is getting quite busy now, we&#8217;d like to have two tracks in the station. Stop all the trains (or be quick!), bulldoze the station, and build a new, two track one. I moved mine back a square to allow space for the tracks to merge. and made the loading loop a little bigger. To control access to a multi-track station, you need <strong>pre-signals</strong>.</p>
<p>Pre-signals come in two types, entrance and exit. An entrance pre-signal will be red if all the exit pre-signals behind it are also red. The motivation for pre-signals is nicely illustrated here: <a href="http://wiki.openttd.org/Signals#Pre-signals">Pre-signals on the OpenTTD wiki</a>.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/pro1.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/pro1-150x150.jpg" alt="pro1" title="pro1" width="150" height="150" class="aligncenter size-thumbnail wp-image-479" /></a></p>
<p>The entrance pre-signal is circled in blue. Notice that it has a horizontal white-bar, to show it is different. The exit pre-signals are circled in purple, and have vertical white bars. There is currently a train in the station, so one of the exit pre-signals is red. Because one of the tracks is free (green signal), the entrance pre-signal is green. The next arriving train will correctly go to the empty track. Even though they are pre-signals, we are still using one-way signals</p>
<p>What you can&#8217;t see on the picture, but which are very important, are the two normal one-way signals circled in black. They control station exit, by forcing a train wanting to leave the station to acquire a lock on the yellow section. This prevents two train leaving at the same time crashing into each other.</p>
<p>When a train is in the station, it still holds a lock on it&#8217;s section of track. The lock runs from the exit -pre-signal at the entrance to the station, to the regular one-way signal at the exit of the station.</p>
<h2>Scaling it up</h2>
<p>You now know all the key concepts, the rest is just more of the same. Here for example is what you would do if Lundinghattan got busy.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/two-loading-loops.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/two-loading-loops-150x150.jpg" alt="two-loading-loops" title="two-loading-loops" width="150" height="150" class="aligncenter size-thumbnail wp-image-481" /></a></p>
<p>You give it a loading loop, and a multi-bay station. Pre-signals control station entrance, and regular one-ways control the exit. You can see the one-way&#8217;s at the exit much better on this station.</p>
<p>There&#8217;s one final change we need to make to allow lots of trains &#8211; we need to replace the two-way section highlighted in blue with two one-way sections.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/pro-final.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/pro-final-150x150.jpg" alt="pro-final" title="pro-final" width="150" height="150" class="aligncenter size-thumbnail wp-image-483" /></a></p>
<p>We don&#8217;t have any more two-way signals. Each station has a loading loop, and one-way tracks connect the stations. In our first tries we had one track connecting the stations, and could only run one train between them. Now we have two tracks connection the stations, and in this picture alone there are eight trains, all serving Mardingbury. Now that&#8217;s more like it!</p>
<p>The stations are quite close together, so it might not be clear what is loading-loop and what is the tracks that connect them, so here&#8217;s an example with stations further apart.</p>
<p><a href="http://www.darkcoding.net/wp-content/uploads/2009/05/pro-big.jpg"><img src="http://www.darkcoding.net/wp-content/uploads/2009/05/pro-big-150x150.jpg" alt="pro-big" title="pro-big" width="150" height="150" class="aligncenter size-thumbnail wp-image-491" /></a></p>
<p>Other stations would have their own loading loops, and as long as the one way tracks connect, you end up with a network spanning the world. Trains can run from anywhere to anywhere, and new stations just need plugging in to the network.</p>
<p>I have one final tip: Playing with virtual toy trains can be quite addictive, so remember to get some sleep :-)</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/XnibbhArJgU" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/openttd-trains-and-signals-for-beginners-a-tutorial/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/openttd-trains-and-signals-for-beginners-a-tutorial/</feedburner:origLink></item>
		<item>
		<title>Quote of the day: Why racists have bad graphic design</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/EZlIGvKNfHQ/</link>
		<comments>http://www.darkcoding.net/society/quote-of-the-day-why-racists-have-bad-graphic-design/#comments</comments>
		<pubDate>Wed, 20 May 2009 16:34:19 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Society]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=460</guid>
		<description><![CDATA[	Charlie Brooker on a television advert by the British National Party, England&#8217;s (very small) right-wing political party:

	
Extremist material of any kind always looks gaudy and cheap, like a bad pizza menu. Not because they can&#8217;t afford decent computers &#8211; these days you can knock up a professional CD cover on a pay-as-you-go mobile &#8211; but [...]]]></description>
			<content:encoded><![CDATA[	<p>Charlie Brooker on a television advert by the British National Party, England&#8217;s (very small) right-wing political party:</p>

	<p><blockquote><br />
Extremist material of any kind always looks gaudy and cheap, like a bad pizza menu. Not because they can&#8217;t afford decent computers &#8211; these days you can knock up a professional CD cover on a pay-as-you-go mobile &#8211; but because anyone who&#8217;s good at graphic design is likely to be a thoughtful, inquisitive sort by nature. And thoughtful, inquisitive sorts tend to think fascism is a bit shit, to be honest. If the <span class="caps">BNP</span> really were the greatest British party, they&#8217;d have the greatest British designer working for them &#8211; Jonathan Ive, perhaps, the man who designed the iPod. But they don&#8217;t. They&#8217;ve got someone who tries to stab your eyes out with primary colours.</blockquote></p>

	<p>Read the article: <a href="http://www.guardian.co.uk/commentisfree/2009/may/18/charlie-brooker-bnp-racism">Charlie Brooker on the <span class="caps">BNP</span> and their political broadcast</a>.</p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/EZlIGvKNfHQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/society/quote-of-the-day-why-racists-have-bad-graphic-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/society/quote-of-the-day-why-racists-have-bad-graphic-design/</feedburner:origLink></item>
		<item>
		<title>Speaking at Open Web Vancouver 2009 in June</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/7fCngKnb4Xo/</link>
		<comments>http://www.darkcoding.net/software/speaking-open-web-vancouver-2009/#comments</comments>
		<pubDate>Sun, 17 May 2009 21:30:59 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Future of Web Apps]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[owv09 speaking vancouver]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=455</guid>
		<description><![CDATA[I will be speaking at Open Web Vancouver on Thursday, June 11, 2009 and Friday, June 12, 2009.
That&#8217;s in Vancouver, B.C., Canada. There&#8217;s a very interesting speaker lineup, and the whole conference is reasonably priced, so come along, learn, interact, and enjoy Vancouver in the summertime.

My talk will be entitled How and Why to Extend [...]]]></description>
			<content:encoded><![CDATA[<p>I will be speaking at <a href="http://www.openwebvancouver.ca">Open Web Vancouver</a> on Thursday, June 11, 2009 and Friday, June 12, 2009.<br />
That&#8217;s in Vancouver, B.C., Canada. There&#8217;s a very interesting <a href="http://www.openwebvancouver.ca/speakers_sessions">speaker lineup</a>, and the whole conference is reasonably priced, so come along, learn, interact, and enjoy Vancouver in the summertime.</p>

<p>My talk will be entitled <strong>How and Why to Extend Firefox in Javascript (and Thunderbird, Komodo, and Songbird)</strong>. I will post the slides here in June.</p>

<p>See you there!</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/7fCngKnb4Xo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/speaking-open-web-vancouver-2009/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/speaking-open-web-vancouver-2009/</feedburner:origLink></item>
		<item>
		<title>Micro-Zooids: A story</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/Q8ePPaHsQVQ/</link>
		<comments>http://www.darkcoding.net/software/micro-zooids-a-story/#comments</comments>
		<pubDate>Sun, 10 May 2009 22:23:13 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Misc]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Strategy]]></category>
		<category><![CDATA[story game youth]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=450</guid>
		<description><![CDATA[When I was 16, I wrote a computer game, called Micro Zooides. It was called that partly because on Windows .EXE files all start with the two characters MZ, and partly because it was about small creatures. Micro-Zooides was going to be about humanity&#8217;s progress, it was going to be Civilization, which didn&#8217;t exist yet.

The [...]]]></description>
			<content:encoded><![CDATA[<p>When I was 16, I wrote a computer game, called Micro Zooides. It was called that partly because on Windows .EXE files all start with the two characters <code>MZ</code>, and partly because it was about small creatures. Micro-Zooides was going to be about humanity&#8217;s progress, it was going to be <a href="http://www.civilization.com/">Civilization</a>, which didn&#8217;t exist yet.</p>

<p>The game had a splash screen of a Far Side comic, then a short video of me tromping through the woods like a Neanderthal, which my Dad filmed and which I digitized with a very early video capture card.</p>

<p>In <a href="http://en.wikipedia.org/wiki/Turbo_C%2B%2B#Historical_versions">Borland&#8217;s Turbo C++ 3.0</a> I wrote a basic graphics engine to display the tiles of the world, and an event loop so I could move the main character around the world. I drew sprites for a proto-human (the micro zooid), dirt, rocks and sticks. He could walk around the world, and pick up and put down rocks or sticks.</p>

<p>Then I took a break to plan. I have a proto-human, rocks, and sticks. How do I get to civilization?</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/Q8ePPaHsQVQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/micro-zooids-a-story/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/micro-zooids-a-story/</feedburner:origLink></item>
		<item>
		<title>Turn on debug output in SVN</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/CcvH7zCNk-o/</link>
		<comments>http://www.darkcoding.net/software/turn-on-debug-output-in-svn/#comments</comments>
		<pubDate>Thu, 07 May 2009 23:02:38 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=435</guid>
		<description><![CDATA[After a desktop and server upgrade, my subversion client stopped working. I am using Digest authentication, and it kept asking me for the username and password. Wireshark showed me that the SVN client wasn&#8217;t sending the Authentication header. To find out more, I turned on Subversion&#8217;s debug output. Here&#8217;s how you do it:

Edit /etc/subversion/servers
Add this [...]]]></description>
			<content:encoded><![CDATA[<p>After a desktop and server upgrade, my subversion client stopped working. I am using Digest authentication, and it kept asking me for the username and password. <a href="http://www.wireshark.org/">Wireshark</a> showed me that the SVN client wasn&#8217;t sending the Authentication header. To find out more, I turned on Subversion&#8217;s debug output. Here&#8217;s how you do it:</p>

<p>Edit <strong>/etc/subversion/servers</strong><br />
Add this line at the end: <strong>neon-debug-mask = 511</strong></p>

<p>That showed me this error: <code>auth: '/' is inside auth domain: 0.</code></p>

<p>This means that the path I was requesting (the root of the repo) was not considered inside the <code>AuthDigestDomain</code> I had set in Apache.</p>

<p>It turns out that at some point in the upgrade of Apache, Subversion, or a library, the AuthDigestDomain requires a scheme. I had<br />
<code>AuthDigestDomain svn.myserver.com</code><br />
whereas it should of been<br />
<code>AuthDigestDomain http://svn.gkgk.org</code>.</p>

<p>So now you know.</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/CcvH7zCNk-o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/turn-on-debug-output-in-svn/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/turn-on-debug-output-in-svn/</feedburner:origLink></item>
		<item>
		<title>Migrating from Picasa to GIMP</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/PPxI02jF8RI/</link>
		<comments>http://www.darkcoding.net/misc/migrating-from-picasa-to-gimp/#comments</comments>
		<pubDate>Wed, 06 May 2009 05:07:13 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Misc]]></category>
		<category><![CDATA[digital]]></category>
		<category><![CDATA[gimp]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[photo]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[picasa]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=423</guid>
		<description><![CDATA[I&#8217;ve been using Picasa to edit my pictures for a long time, and it&#8217;s an excellent program. Recently however I&#8217;ve started shooting RAW, and I&#8217;d like control, so I&#8217;ve started using GIMP. It&#8217;s more powerful and more complicated than Picasa, so to start myself off I went through all the features of Picasa and made [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://picasa.google.com">Picasa</a> to edit my pictures for a long time, and it&#8217;s an excellent program. Recently however I&#8217;ve started shooting RAW, and I&#8217;d like control, so I&#8217;ve started using <a href="http://www.gimp.org/">GIMP</a>. It&#8217;s more powerful and more complicated than Picasa, so to start myself off I went through all the features of Picasa and made notes on how to duplicate that operation in GIMP. Here are those notes.</p>

<p>Most of what Picasa does can be replicated with the Colors / Levels or Colors / Curves tool. It&#8217;s well worth spending a little time experimenting with both of those (the documentation is very good too).</p>

<h2>Crop</h2>

<p>In the Toolbox, click the Rectangle select tool<br />
In its options (beneath the tools), tick &#8216;Fixed: Aspect Ratio&#8217;<br />
Enter 6:4 ratio (for 1.6 sensor, most DSLRs)<br />
Tick Highlight.
Draw a rectangle on the image that you want to crop to.<br />
Image menu / Crop to Selection  </p>

<p><span id="more-423"></span></p>

<h2>Straighten</h2>

<p>Click one of the rulers above or to the left of the image, and drag a guideline onto your picture<br />
In the Toolbox, select the rotate tool<br />
Select &#8216;Clipping: Crop to result&#8217;. Maybe &#8216;Interpolation: Sinc (Lanczos3)&#8217;, although that doesn&#8217;t seem to matter<br />
Rotate until your picture is straight, using your guideline<br />
Click Rotate<br />
Image / Fit Canvas to Layers or Image / Autocrop Image<br />
Image / Guides / Remove all guides  </p>

<h2>Redeye</h2>

<p>Filters / Enhance / Red-Eye Removal (I have never used this)</p>

<h2>I&#8217;m feeling lucky</h2>

<p>Colors / Levels / Auto</p>

<h2>Auto Contrast / Auto Color</h2>

<p>Colors / Auto / something</p>

<h2>Fill light</h2>

<p>Colors / Levels<br />
Drag the middle triangle (grey) to the left  </p>

<h2>Highlights</h2>

<p>Colors / Levels<br />
Drag the right side (white) triangle  </p>

<h2>Shadows</h2>

<p>Colors / Levels<br />
Drag the left side (black) triangle  </p>

<h2>Color Temperature</h2>

<p>Tools / GEGL Operation / color-temperature<br />
Adjust Intended Temperature  </p>

<h2>Neutral Color Picker</h2>

<p>Colors / Levels<br />
There are three color pickers near the bottom right<br />
Use the left one to select black, the middle one neutral gray, and the right one white  </p>

<h2>Sharpen</h2>

<p>Filters / Enhance / Unsharp mask<br />
Try these values: Radius: 1 &#8211; 5  Amount: 0.5 &#8211; 1<br />
<strong>OR</strong><br />
Colors / Components / Decompose.<br />
HSV, Decompose to layers<br />
Switch off the hue and saturation layer<br />
Apply the Unsharp mask, as detailed above<br />
Colors / Components / Recompose  </p>

<h2>Sepia</h2>

<p>Filters / Decor / Old Photo</p>

<h2>B &#038; W</h2>

<p>Image / Mode / Grayscale<br />
<strong>OR</strong><br />
Colors / Desaturate  </p>

<h2>Warmify</h2>

<p>Colors / Curves<br />
Select Blue &#8211; pull the center-right of the curve down most of a grid box<br />
Select Red &#8211; pull the center-right of the curve up most of a grid box<br />
<strong>OR</strong>
Tools / GEGL Operation / color-temperature / Increase intended temperature by 10k or 20k  </p>

<h2>Saturation</h2>

<p>Colors / Hue-Saturation / Pull the Saturation slider to the right   </p>

<h2>Soft Focus</h2>

<p>Duplicate layer (right click / Duplicate or use the icon bottom of layers pane)<br />
Filters / Blur / Gaussian Blur..  Set to 60<br />
Reduce Opacity to ~60%<br />
Right click on blur layer, Add Layer Mask, White (full opacity)<br />
Click the foreground color, set S to 0 and V to 50 (or 60, 70)<br />
Select a brush, the Paintbrush tool, paint over the parts you don&#8217;t want fuzzy<br />
To replicate Picasa this would be a big circle somewhere in the middle of the picture  </p>

<h2>Graduated tint</h2>

<p>Duplicate layer<br />
Switch off Background by clicking the eye<br />
Edit that layer with Levels and Curves to expose sky correctly<br />
Right click on new layer / Add Layer Mask/  White (full opacity)<br />
Select Blend tool<br />
Draw a line on the image to make a gradient. Try again.<br />
Click the Background eye back on<br />
Right click on the edited layer, and Apply Layer Mask<br />
Merge the layers  </p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/PPxI02jF8RI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/misc/migrating-from-picasa-to-gimp/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/misc/migrating-from-picasa-to-gimp/</feedburner:origLink></item>
		<item>
		<title>What is the point of LinkedIn?</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/E1BYuxbNsJ8/</link>
		<comments>http://www.darkcoding.net/behaviour/what-is-the-point-of-linkedin/#comments</comments>
		<pubDate>Tue, 14 Apr 2009 20:23:47 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Behaviour]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=403</guid>
		<description><![CDATA[I&#8217;m on LinkedIn, I&#8217;m connected to 48 people. I go there, I declare to the world that I know these people. And then what? 

If that sounds familiar, you&#8217;re not alone. There&#8217;s:


a project to find uses for LinkedIn
a book on finding a point to LinkedIn
and the company itself had to blog about ten ways to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m on <a href="http://linkedin.com">LinkedIn</a>, I&#8217;m connected to 48 people. I go there, I declare to the world that I know these people. And then what? </p>

<p>If that sounds familiar, you&#8217;re not alone. There&#8217;s:</p>

<ul>
<li>a <a href="http://www.linkedintelligence.com/smart-ways-to-use-linkedin/">project to find uses for LinkedIn</a></li>
<li>a <a href="http://www.happyabout.info/images/onlinkedin.big.jpg">book on finding a point to LinkedIn</a></li>
<li>and the company itself had to blog about <a href="http://blog.linkedin.com/2007/07/25/ten-ways-to-use/">ten ways to use LinkedIn</a>. </li>
</ul>

<p>If it takes a blog post, a book, and a community project, to find a point to your web application, I think there may not be one.</p>

<p><span id="more-403"></span></p>

<h3>LinkedIn tries to explain itself</h3>

<p>Take the blog post for example. It says that LinkedIn is, and I quote, <em>&#8220;a great way for professionals to strengthen their online brand reputation and leverage their professional network&#8221;</em>.  Huh?</p>

<p>How about the front page. I bet they have a super-succinct <a href="http://en.wikipedia.org/wiki/Value_proposition">value proposition</a>. It&#8217;ll be obvious once I get to the front page:</p>

<blockquote>
  <ul>
  <li>Stay informed about your contacts and industry</li>
  <li>Find the people &#038; knowledge you need to achieve your goals</li>
  <li>Control your professional identity online</li>
  </ul>
</blockquote>

<p>Let&#8217;s be honest, the reason you are &#8216;connected&#8217; to these people on LinkedIn, as opposed to Facebook, Bebo, Orkut, or Friendster, is because you don&#8217;t want to <em>&#8220;stay informed&#8221;</em> about them. You don&#8217;t <em>want</em> to know what movie they watched last night.</p>

<p>What about the second bullet point, finding people? That&#8217;s about recruitment, and the trouble is, recruitment has gone niche.</p>

<ul>
<li>If I need a Python programmer, I post on <a href="http://www.python.org/community/jobs/">python.org</a>,</li>
<li>for Django I post on <a href="http://djangogigs.com">Django Gigs</a>, </li>
<li>front enders are on <a href="http://authenticjobs.com/">Authentic Jobs</a>, </li>
<li>and so on. </li>
</ul>

<p>LinkedIn seems to be built around a 1940&#8217;s model where you hire someone because they went to the same college as you: <em>&#8220;Cambridge lad eh? Jolly good. Welcome to the company. Scotch?&#8221;</em></p>

<p>Maybe it&#8217;s all about that last bullet point, your <em>&#8220;professional online identity&#8221;</em>? LinkedIn is your home on the web, a virtual calling card, MySpace without the teenage exuberance? Well, if you&#8217;re in tech and your only online presence is LinkedIn, that&#8217;s less than impressive. A bit like a graphic designer printing his business cards on that machine at the mall.</p>

<h3>LinkedIn prevents people from contacting you</h3>

<p>If you are trying to get in touch with someone, whom we&#8217;ll call Chris, you probably start with your favorite search engine. You type in his name. Chris&#8217; LinkedIn profile comes up. You click on it. You now have three options:</p>

<ul>
<li>You can pay LinkedIn $25, and they&#8217;ll let you send Chris an email (an &#8216;InMail&#8217;).</li>
<li>You ask your friend Alice to ask her friend Bob to introduce you to Chris. </li>
<li>You do what I do. You hit Back. Click on the next search result, which is Chris&#8217; blog, select the Contact or About page, and email him directly. LinkedIn just wasted your time.</li>
</ul>

<p>I may of mentioned this before, but this is not the 1940&#8217;s. We Internet types are comfortable talking to strangers. All I want is an email address, and that&#8217;s what LinkedIn doesn&#8217;t give me.</p>

<h3>Let&#8217;s recap</h3>

<p>You go to LinkedIn. You declare all your connections. You complete your profile, recommend people, answer questions, and so on. You give them a lot. And what does LinkedIn do for you? They <strong>prevent</strong> people contacting you. So, what, exactly, is the point of LinkedIn?</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/E1BYuxbNsJ8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/behaviour/what-is-the-point-of-linkedin/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/behaviour/what-is-the-point-of-linkedin/</feedburner:origLink></item>
		<item>
		<title>Foxden – your life on one page</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/hHULGUh3C3I/</link>
		<comments>http://www.darkcoding.net/software/foxden-your-life-on-one-page/#comments</comments>
		<pubDate>Tue, 07 Apr 2009 00:21:22 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Software]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=389</guid>
		<description><![CDATA[	Update: There is now a user group for Foxden: http://groups.google.com/group/foxden-users

	Foxden is a Firefox extension that allows you to tile all the web applications you use on one page. Imagine being able to see your email, your calendar, your bug tracker, feeds, twitter, whatever you use, on one page. Take a look at my setup:

	



	As you [...]]]></description>
			<content:encoded><![CDATA[	<p><strong>Update:</strong> There is now a user group for Foxden: <a href="http://groups.google.com/group/foxden-users">http://groups.google.com/group/foxden-users</a></p>

	<p><strong>Foxden is a Firefox extension that allows you to tile all the web applications you use on one page.</strong> Imagine being able to see your email, your calendar, your bug tracker, feeds, twitter, whatever you use, on one page. Take a look at my setup:</p>

	<p><a href="http://foxden.mozdev.org/Screenshot-Foxden.png" target="_blank"><br />
<img src="http://foxden.mozdev.org/Screenshot-Foxden-thumbnail.png" alt="Foxden screenshot" /><br />
</a></p>

	<p>As you can see, I have (counter clockwise from top left) my email, calendar, feed reader, todo list and a local text file for taking notes.</p>

	<p>It&#8217;s free, should work wherever Firefox 3 works, and it could be yours right now.</p>

	<p><a href="https://addons.mozilla.org/en-US/firefox/addon/11363">Download the Foxden Firefox extension</a></p>

 <img src="http://feeds.feedburner.com/~r/darkcoding/~4/hHULGUh3C3I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/software/foxden-your-life-on-one-page/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/software/foxden-your-life-on-one-page/</feedburner:origLink></item>
		<item>
		<title>Quote of the day: Congressman Mike Honda</title>
		<link>http://feedproxy.google.com/~r/darkcoding/~3/cRimxBHffuA/</link>
		<comments>http://www.darkcoding.net/society/quote-of-the-day-congressman-mike-honda/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 17:49:12 +0000</pubDate>
		<dc:creator>Graham King</dc:creator>
				<category><![CDATA[Ideas]]></category>
		<category><![CDATA[Society]]></category>

		<guid isPermaLink="false">http://www.darkcoding.net/?p=346</guid>
		<description><![CDATA[Congressman Mike Honda, D-San Jose, writing about opening government databases:


  Instead of databases becoming available as a result of Freedom Of Information Act requests, government officials should be required to justify why any public data should not be freely available to the taxpayers who paid for its creation.


Wow, what an exciting time to be [...]]]></description>
			<content:encoded><![CDATA[<p>Congressman <a href="http://honda.house.gov/">Mike Honda</a>, D-San Jose, writing about opening government databases:</p>

<blockquote>
  <p>Instead of databases becoming available as a result of Freedom Of Information Act requests, government officials should be required to justify why any public data should not be freely available to the taxpayers who paid for its creation.</p>
</blockquote>

<p>Wow, what an exciting time to be in North America.</p>

<p>From the <a href="http://radar.oreilly.com/2009/03/crowdsourcing-evolution-of-congressional-websites.html">O&#8217;Reilly Radar</a>.</p>
<img src="http://feeds.feedburner.com/~r/darkcoding/~4/cRimxBHffuA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.darkcoding.net/society/quote-of-the-day-congressman-mike-honda/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.darkcoding.net/society/quote-of-the-day-congressman-mike-honda/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic Page Served (once) in 1.402 seconds --><!-- Cached page served by WP-Cache -->
