<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Matt Daubneys Blog &#187; python</title>
	<atom:link href="http://daubers.co.uk/category/programming/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://daubers.co.uk</link>
	<description></description>
	<lastBuildDate>Sun, 25 Mar 2012 19:34:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Reading Hackspace Door Entry System</title>
		<link>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/</link>
		<comments>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/#comments</comments>
		<pubDate>Sun, 25 Mar 2012 19:34:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[mosquitto]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[rfid]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=393</guid>
		<description><![CDATA[Maybe 6 months ago I started going to Reading Hackspace. For those of you unaware, wikipedia describes a hackspace as &#8220;a location where people with common interests, often in computers,technology, science, digital or electronic art (but also in many other realms) can meet, socialise and/or collaborate.&#8221; In the past 6 months of hanging out with the Hackspace people, I&#8217;ve probably learnt more than in [...]]]></description>
			<content:encoded><![CDATA[<p>Maybe 6 months ago I started going to <a title="Reading Hackspace" href="http://www.readinghackspace.org.uk" target="_blank">Reading Hackspace</a>. For those of you unaware, wikipedia describes a hackspace as &#8220;a location where people with common interests, often in <a title="Computer" href="http://en.wikipedia.org/wiki/Computer">computers</a>,<a title="Technology" href="http://en.wikipedia.org/wiki/Technology">technology</a>, <a title="Science" href="http://en.wikipedia.org/wiki/Science">science</a>, <a title="Digital art" href="http://en.wikipedia.org/wiki/Digital_art">digital</a> or <a title="Electronic art" href="http://en.wikipedia.org/wiki/Electronic_art">electronic art</a> (but also in many other realms) can meet, <a title="Socialization" href="http://en.wikipedia.org/wiki/Socialization">socialise</a> and/or <a title="Collaboration" href="http://en.wikipedia.org/wiki/Collaboration">collaborate</a>.&#8221; In the past 6 months of hanging out with the Hackspace people, I&#8217;ve probably learnt more than in the previous 12.</p>
<p>Reading Hackspace has recently aquired a physical space to work in, and in order to help things along I offered to build the RFID based door system. As with all systems of this manner, the spec was changed a couple of times along the way, and probably will be changed again in the future.</p>
<p>The door system is composed of three parts:</p>
<ol>
<li>An Arduino based card reader connected to an electronic lock</li>
<li>An MQTT server (namely the epic <a title="Mosquitto MQTT Server" href="http://mosquitto.org/" target="_blank">Mosquitto</a>)</li>
<li>A python script that uses a SQL database to authenticate users running on an Ubuntu server.</li>
</ol>
<p>A full write up is in progress on the <a title="Reading Hackspace WIki Door Entry System" href="http://readinghackspace.org.uk/wiki/Projects/DoorEntrySystem" target="_blank">Reading Hackspace wiki </a>. Here&#8217;s a quick pic of the reader screwed to the door.</p>
<p><a href="http://daubers.co.uk/wp-content/uploads/2012/03/20120311_125832.jpg"><img class="aligncenter size-medium wp-image-394" title="Hackspace RFID Door System" src="http://daubers.co.uk/wp-content/uploads/2012/03/20120311_125832-300x225.jpg" alt="" width="300" height="225" /></a></p>
<p>And a video of the system working!</p>
<p><iframe src="http://www.youtube.com/embed/H1JNykWHfgI" frameborder="0" width="560" height="315"></iframe></p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2012/03/25/reading-hackspace-door-entry-system/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>bzr+MQTT=Win \o/</title>
		<link>http://daubers.co.uk/2011/12/31/bzrmqttwin-o/</link>
		<comments>http://daubers.co.uk/2011/12/31/bzrmqttwin-o/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 17:07:58 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bzr]]></category>
		<category><![CDATA[mqtt]]></category>
		<category><![CDATA[notifications]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=380</guid>
		<description><![CDATA[I&#8217;ve been meaning to post this for a little while, but now seems as good a time as any My little team in the office has expanded since I started as the only developer. With two other devs on board managing the bzr commits has meant a little extra overhead to make sure I know [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to post this for a little while, but now seems as good a time as any <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>My little team in the office has expanded since I started as the only developer. With two other devs on board managing the bzr commits has meant a little extra overhead to make sure I know when new revisions have been pushed. Thinking there had to be a better way then getting people to email me when they do a commit and push to the main branch I went digging through the bzr docs.</p>
<p>It turns out I&#8217;ve been &#8220;doing it wrong™&#8221;. The bzr repo was setup so that people could connect to it using sftp as that was a quick easy way to get things rolling when it was needed. Apparently bzr has an inbuilt <a title="bzr server docs" href="http://doc.bazaar.canonical.com/beta/en/user-guide/server.html">&#8220;smart server&#8221;</a> that can run scripts on certain hooks when certain events take place. This looked like the way to go!</p>
<p>First thing was setting up the smart server. I threw Apache onto the dev box, install mod-wsgi (because it&#8217;s so much better than mod-python) and started reading through the instructions. About an hour of screaming and poking I got the system running  as a smart server, meaning I could push using bzr+http instead of sftp. Now came the difficult part.</p>
<p>It seems that only very specific events can be hooked into on the server side. This wasn&#8217;t immediately obvious from the <a title="bzr docs on hooks" href="http://doc.bazaar.canonical.com/beta/en/user-guide/hooks.html">bzr docs</a>, but a little shouting, throwing things at the monitor and emptying nerf after nerf at the keyboard eventually got me to the hook I wanted specifically.</p>
<p>Now I had the ability to hook into things with bzr, but where could I send the events that it was generating? EMail was a bit dull, so I went back to MQTT, with the thought of commits could now light a lamp in the office when they happen <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  The code for the server side bzr plugin is below. You just need to drop it into your .plugins directory for your smart server (ensuring you set this up in you wsgi configuration).</p>
<pre>from bzrlib import branch
import mosquitto as mqtt
import os

mqttServerIp = "192.168.0.250"

def post_push_hook(push_result):
    branchFolder = [x for x in str(push_result.branch.__dict__['_base']).replace("//","/").split("/") if x]
    connectSendDisconnect("new branch revision: "+str(push_result.new_revno),branchFolder[1])

def connectSendDisconnect(msg, branchName):
    mqttc = mqtt.Mosquitto("bzrlib"+str(os.getpid()))
    mqttc.connect(mqttServerIp, 1883, 60, True)
    mqttc.publish("/code/"+branchName, msg, 1, False)
    mqttc.loop()
    mqttc.disconnect()

branch.Branch.hooks.install_named_hook('post_change_branch_tip', post_push_hook, "My post_push hook")</pre>
<p>Magic! Now a message will be sent on the &#8220;/code/branchName&#8221; topic every time a commit happens <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Using some borrowed python magic from <a href="http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/">http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/</a> I&#8217;ve made it integrate into the default Ubuntu notifications system so a nice little box pops up informing me of a commit and the new revision number of the branch <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Doubles aces!</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2011/12/31/bzrmqttwin-o/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Banishing the Demons of Distraction Redux</title>
		<link>http://daubers.co.uk/2011/05/20/banishing-the-demons-of-distraction-redux/</link>
		<comments>http://daubers.co.uk/2011/05/20/banishing-the-demons-of-distraction-redux/#comments</comments>
		<pubDate>Fri, 20 May 2011 22:12:17 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[learning]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[annoyances]]></category>
		<category><![CDATA[distractions]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=342</guid>
		<description><![CDATA[My fight against distractions has carried on further. This brief episode is brought to you by the theory of &#8220;scratching your own itch&#8221;. There are a lot of things that annoy me with various tasks I perform every day. This past week I&#8217;ve been taking note of each one, and I count 78 in total. [...]]]></description>
			<content:encoded><![CDATA[<p>My fight against distractions has carried on further. This brief episode is brought to you by the theory of &#8220;scratching your own itch&#8221;.</p>
<p>There are a <span style="text-decoration: underline;">lot</span> of things that annoy me with various tasks I perform every day. This past week I&#8217;ve been taking note of each one, and I count 78 in total. Each one of those 78 things could probably be fixed very easily, but because I&#8217;m generally running around like a headless chicken trying to get things done, I don&#8217;t even think about fixing them, I just put up with them and carry on. A fair few of these are things that take a while to fix, like the office being short of physical space because of all the orders coming in/out at the moment. Other issues are easy to fix, like the fact that it takes me 30 minutes to an hour to do a quick analysis of some testing data. This is a problem I can solve easily with a smattering of python and a little concentration. In fact, I&#8217;m intending to tackle this on Sunday by going into the office when it&#8217;s quiet, and just making this problem vanish.</p>
<p>A few other problems on that list of 78 can also be solved with code, some easily, some not so. Some can be solved by a few simple changes in my work routine, like the fact I constantly go to do a task, get pulled away by something else, and then forget what I was going to do. Keeping a simple log book of what I&#8217;m doing during the day would solve this easily. It would be better if this was digitized in some form, but for now a simple notebook will probably make a huge difference. This distraction on its own has probably caused me to lose my train of thought more times this week than any other on the list.</p>
<p>So how id my fight going? I&#8217;m much more aware of what causes me to be distracted after the past week or so. It&#8217;s taking me time to come to terms with each of those distractions and to deal with them, but ultimately, I am becoming more productive in a given period of time. The next big thing I&#8217;m going to have to tackle is project methodology. Since I don&#8217;t even have a passing familiarity with any of the standard methodologies, this is going to take some research, some thought and  a lot of conversations in order to find the best one to suite the needs of my team at work. As always, any pertinant reading material suggestions are always welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2011/05/20/banishing-the-demons-of-distraction-redux/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>On Life</title>
		<link>http://daubers.co.uk/2009/12/07/on-life/</link>
		<comments>http://daubers.co.uk/2009/12/07/on-life/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 00:28:49 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[FOSS]]></category>
		<category><![CDATA[learning]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[community]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[kde]]></category>
		<category><![CDATA[kubuntu]]></category>
		<category><![CDATA[workflow]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=247</guid>
		<description><![CDATA[For the past few weeks life has been busy, and when I say busy I mean hectic beyond belief. In that time I&#8217;ve had a few OSS revelations I&#8217;d like to share. As an experiment at work I thought I&#8217;d try using eclipse as an IDE instead of my normal vim+terminator job. Scary as it is, [...]]]></description>
			<content:encoded><![CDATA[<p>For the past few weeks life has been busy, and when I say busy I mean hectic beyond belief. In that time I&#8217;ve had a few OSS revelations I&#8217;d like to share.</p>
<p>As an experiment at work I thought I&#8217;d try using eclipse as an IDE instead of my normal vim+terminator job. Scary as it is, I find myself actually quite liking eclipse. It may be that my work machine has 4GB of RAM, and so copes better than the machines I&#8217;ve used in the past, or it may be that I&#8217;m starting to lose my qualms about what tools I use to do a job, as long as a job gets done. The PHP and Python tools inside eclipse have made my life a lot easier, and I really do find little things, like it reading out the docstring I&#8217;d put in a function when I hover over that function when it&#8217;s called, useful. Has eclipse evolved to where it&#8217;s useable or has affordable technology caught up with eclipse? A bit of a quandry for me that one.</p>
<p>The other small revelation I&#8217;ve had recently is that KDE4 is now inherently useable, and quite shiny to boot. when I&#8217;ve tried it in the past I quickly got fed up with things that didn&#8217;t quite fit or where missing completely, but now time has passed, and like KDE4 I believe I&#8217;ve changed a bit, and actually quite like it. I won&#8217;t be using it at home for a while, as the 7&#8243; screen on this tiny little netbook certainly won&#8217;t make it very use-able compared to the  20&#8243; odd monitor I have at work. The one big thing annoying me with it at the moment though is that konquerer doesn&#8217;t seem to fit with the default theme. Niggly annoyance I know, but surely that should be a papercut?</p>
<p>The last revelation I&#8217;ve had, though it&#8217;s not really a revelation, is a pang of guilt. I&#8217;m inherently a consumer in the whole Linux ecosphere. I consume by far more than I give back, and at the moment I simply don&#8217;t have the time to give back as much as I&#8217;d like. So this is my decree, and a proclamation that as of next year (with certain exceptions) I intend to deem one night a week free software night. On that night I will help to squish bugs, I&#8217;ll sit on IRC and be patient with people trying to help them through problems, I shall try and get involved in the various mailing list debates I sit and read, and I shall attempt to stop consuming quite so much and start giving back as much as I can.</p>
<p>In order to do this I will need a little help. The whole software workflow thing is a bit of a mystery to me. I&#8217;ve had little formal training in such things and as such tend to wing it more than I&#8217;d like. Can people point me in the direction of some good literature to help mend this? I&#8217;m quite willing to get my hands dirty if people are willing to be patient with me as I learn how the OSS developer crowd works so I can learn and adjust. In a way I&#8217;m hoping that this will flow back and help me at work as much as it&#8217;ll help me contribute back to the community in general.</p>
<p>If anyone also has a project they might want a hand with one evening a week from the of the month, feel free to drop me a line by your favourite communications method <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2009/12/07/on-life/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Memobot</title>
		<link>http://daubers.co.uk/2008/07/13/memobot/</link>
		<comments>http://daubers.co.uk/2008/07/13/memobot/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 08:34:40 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[jabber]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=37</guid>
		<description><![CDATA[This is a simple jabber bot which lets you jot down simple memos. Use the command &#8220;add:&#8221; to add a memo, e.g. &#8220;add: This is a memo&#8221;. the command &#8220;list&#8221; will give you all the memos in the database including their ids, and &#8220;delete: 3&#8243; will delete the memo with id 3. It&#8217;s written in [...]]]></description>
			<content:encoded><![CDATA[<p>This is a simple jabber bot which lets you jot down simple memos. Use the command &#8220;add:&#8221; to add a memo, e.g. &#8220;add: This is a memo&#8221;. the command &#8220;list&#8221; will give you all the memos in the database including their ids, and &#8220;delete: 3&#8243; will delete the memo with id 3.</p>
<p>It&#8217;s written in Python with sleekxmpp as the xmpp library, and uses sqlite for the database <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Code can be found <a title="memobot script" href="http://daubers.co.uk/~matt/scripts/memobot.tar.gz" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2008/07/13/memobot/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

