<?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; programming</title>
	<atom:link href="http://daubers.co.uk/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://daubers.co.uk</link>
	<description></description>
	<lastBuildDate>Sat, 31 Dec 2011 17:08:35 +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>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>Arduinos, MQTT and Light levels</title>
		<link>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/</link>
		<comments>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/#comments</comments>
		<pubDate>Sun, 04 Sep 2011 13:54:36 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[EasyRadio]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[hacking]]></category>
		<category><![CDATA[homeeasy]]></category>
		<category><![CDATA[mosquitto]]></category>
		<category><![CDATA[mqtt]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=377</guid>
		<description><![CDATA[Since watching Andy Pipers talk on MQTT at Oggcamp, I&#8217;ve been trying to understand and use Mosquitto with my Arduinos. I&#8217;ve got a few sensors lying around to test this with (and have ordered some more \o/ ) and have started to have some success. Installing Mosquitto is a doddle. I added the ppa to one of [...]]]></description>
			<content:encoded><![CDATA[<p>Since watching <a href="http://blip.tv/episode/5493280" target="_blank">Andy Pipers talk on MQTT</a> at Oggcamp, I&#8217;ve been trying to understand and use <a href="http://mosquitto.org/" target="_blank">Mosquitto</a> with my Arduinos. I&#8217;ve got a few sensors lying around to test this with (and have ordered some more \o/ ) and have started to have some success.</p>
<p>Installing Mosquitto is a doddle. I added the <a href="https://launchpad.net/~mosquitto-dev/+archive/mosquitto-ppa/" target="_blank">ppa</a> to one of my household servers, then just apt-get install mosquitto. MQTT broker up and running in a matter of minutes. The first thing I setup to check if it was working was a simple python program that would just connect to the broker and send &#8220;Hello World&#8221; to the &#8220;hello&#8221; topic. I wrote a second little python script to just listen to the &#8220;hello&#8221; topic and print out the message from any updates. Most of the code was borrowed from <a href="http://chemicaloliver.net/programming/first-steps-using-python-and-mqtt/" target="_blank">this blog post</a> which was incredibly helpful <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>With that running happily, I moved on a stage. Digging out an <a href="http://daubers.co.uk/2010/11/07/arduino-powered-lights-and-heating/" target="_blank">old shield</a> for my arduino that I made to control the lights in my flat using some home easy sockets and an RF chip, I added an LDR and used the thermister that was already on the board. This simple set of components means I can now monitor both the temperature and light levels in one of the rooms of my flat. Using an ethernet shield for the arduino also means that I can then report that information to my Mosquitto broker using the arduino mqtt <a href="http://knolleary.net/arduino-client-for-mqtt/" target="_blank">library</a>.</p>
<p>What will I do with all this information? Well, initially I&#8217;m going to write an mqtt to sql bridge (might use this an excuse to learn postgres now mysql has an uncertain OSS future) and will setup some scripts to graph the information. I&#8217;ll probably change this sketch to control the lights in the flat, so I could have a machine somewhere sending a message to the mqtt broker at a set time to turn the lights on in the bedroom (a simple mqtt powered alarm clock <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  ). Hopefully I&#8217;ll write a small application using the app indicator framework for Ubuntu (and growl for OSX) to tell me when certain thresholds are passed, especially for the other sensors I have coming (Alcohol, Gas, Smoke and humidity). I might write another bridge to use the google cloud messaging system to add an alert on my phone as well.</p>
<p>There&#8217;s a whole world of possibilities out there, thanks to so many people building these various components and libraries that make hacking fun toys so much easier <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Many thanks to all those who have developed the frameworks, libraries and services that I&#8217;m using and for making the F/OSS to make life even easier.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2011/09/04/arduinos-mqtt-and-light-levels/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Day 3: Printers and Development</title>
		<link>http://daubers.co.uk/2011/07/03/day-3-printers-and-development/</link>
		<comments>http://daubers.co.uk/2011/07/03/day-3-printers-and-development/#comments</comments>
		<pubDate>Sun, 03 Jul 2011 10:06:14 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[learning]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[c#]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=365</guid>
		<description><![CDATA[This is where I&#8217;ll slightly move away from &#8220;the average persons&#8221; tasks. Day to day I write or manage software projects, and for this experiment to continue I need to be able to do that on my laptop. Generally I work day to day using python in Eclipse with the pydev extension. This is relativley [...]]]></description>
			<content:encoded><![CDATA[<p>This is where I&#8217;ll slightly move away from &#8220;the average persons&#8221; tasks. Day to day I write or manage software projects, and for this experiment to continue I need to be able to do that on my laptop. Generally I work day to day using python in Eclipse with the pydev extension. This is relativley easy to get going on Windows, download a JDK, install eclipse, download/install python, install pydev. Job done. However I wanted to play with the Microsoft blessed languages, so I downloaded and installed Visual C# express as well. C# is a language I&#8217;ve had to use before, so I&#8217;m a bit rusty, but should be able to pick it up relativley quickly, and a big kudos to MS as the Visual Studio envornment is still probably the best IDE on the planet (I&#8217;m open to suggestions of others which do the job as well, but I&#8217;ve yet to play with one that does).</p>
<p>c# uses the .net framework to do all the heavy lifting. It&#8217;s a bit like Java in that it&#8217;s compiled into byte code and then interpreted so isn&#8217;t as fast as something like C++ but makes up for that by being easy and fast to develop in. Some of the widgets that come with the new .net framework (such as the graphing widget) are pretty fantastic and really do make life easy. In a couple of hours I&#8217;d refamiliarised myself with the language and written a short program that took in a CSV export from my Current Cost recording box and turned it into a nice graph. Doing the same using the GTK toolkit would probably take a bit longer with a little hacking around as there&#8217;s no dedicated graphing widget (that I&#8217;m aware of), so you&#8217;d have to generate the graph either on the fly by drawing it at a lower level or by creating a jpg and then displaying that in an image box.</p>
<p>One minor issue with the Visual Studio express suite is that there is no built in in subversioning system. At work, and most of the time at home, I tend to use the bzr suite of tools. A quick look on the bzr website and that&#8217;s also available for Windows. Download, install and it integrates very nicely into the My Computer interface, and can be called from the command prompt. Easy.</p>
<p>A lot of my dev work is for server stuff, so putty and winscp were downloaded and installed successfully on top of that as well.</p>
<p>Printers are another problem and a bit of a nightmare. I have an HP Photosmart C4180 All-in-One that I bought some time ago while I was at university. Having long since lost the driver disk for this, I nievley just plugged it in and hoped Windows would just find it as Ubuntu does. No such luck. It goes away and gives me a list of printers which mine isn&#8217;t in and then offers me the option to go to the Windows update site to find even more. I click that button and wait 5 minutes&#8230; then another 5 minutes&#8230; then it gives me a bigger list of printers. My printer is in this list (why it couldn&#8217;t just have said &#8220;We found your printer! Here is the driver.&#8221; rather than me spending 5 minutes scrolling through a badly sorted list I don&#8217;t know) and then installed it. The scanner wouldn&#8217;t work without the software from HP, but otherwise the thing worked as expected.</p>
<p>I have to admit, the boot time for Windows is now slowing down considerably. But my games work and it&#8217;s not overly getting in my way yet. So we&#8217;ll see.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2011/07/03/day-3-printers-and-development/feed/</wfw:commentRss>
		<slash:comments>1</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>Training vs Teaching</title>
		<link>http://daubers.co.uk/2010/12/11/training-vs-teaching/</link>
		<comments>http://daubers.co.uk/2010/12/11/training-vs-teaching/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 14:37:35 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[learning]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=332</guid>
		<description><![CDATA[Today I&#8217;ve been mostly teaching myself the oddities of C++. Now C++ is an object orientated language that&#8217;s an extension of C. This has led me to a revalation. Recently at work I&#8217;ve been doing masses of OO stuff (as a change from the previous stuff I was writing which was largely linear) and as a result [...]]]></description>
			<content:encoded><![CDATA[<p>Today I&#8217;ve been mostly teaching myself the oddities of C++. Now C++ is an object orientated language that&#8217;s an extension of C. This has led me to a revalation.</p>
<p>Recently at work I&#8217;ve been doing masses of OO stuff (as a change from the previous stuff I was writing which was largely linear) and as a result of that I&#8217;ve started seeing the world in terms of objects. Now in order to achieve what I needed at work, I ended up reading up on the theory of objects and what they actually are. In times past when I&#8217;ve been &#8220;taught&#8221; how to program (rather than teaching myself) , the content of the classes where more designed for a specific language on how to solve a specific problem. I think I only once sat in a computing based lecture that talked about the more abstract issues in programming. Whenever I start designing a program I always go back to that single lecture, and a few books that have a higher level stance on problems (such as Design Patterns)  and then once I&#8217;m passed that do I go to the language specific things.</p>
<p>The reason I digress this far is that after learning all this meta-stuff, learning another language is actually relatively easy. Now everything is falling down to syntax rather than subject. Going back to the title, I think that those lectures that taught me to do this in this language because it does that has got things backwards. They were doing the training first in the hope it would teach you something. What they should be doing is teaching you the concepts (all the &#8220;meta&#8221;) and the train you in the language.</p>
<p>Teach and then train, not train and then teach. Something I shall have to try and follow more often in the future.</p>
<p>(Many thanks to Alan Bell for the inspiration in the title <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/2010/12/11/training-vs-teaching/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Arduino and Easy Radios</title>
		<link>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/</link>
		<comments>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/#comments</comments>
		<pubDate>Thu, 04 Feb 2010 09:55:41 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[arduino]]></category>
		<category><![CDATA[EasyRadio]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[easy-radio]]></category>
		<category><![CDATA[example]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=264</guid>
		<description><![CDATA[A few days ago I received a pair of Easy Radios to help with a project I&#8217;m working on. Since I&#8217;ve never used these before (having only got my first arduino a couple of weeks ago) I had a dig on the net for information on how to use them. Since this information was quite [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago I received a pair of Easy Radios to help with a project I&#8217;m working on. Since I&#8217;ve never used these before (having only got my first arduino a couple of weeks ago) I had a dig on the net for information on how to use them. Since this information was quite sparse, I thought I&#8217;d put up my experimental rig to show it working. This setup requires 2 arduinos, an easy radio transmitter and an easy radio receiver.  First, the transmitter layout.</p>
<div id="attachment_276" class="wp-caption aligncenter" style="width: 222px"><a href="http://daubers.co.uk/wp-content/uploads/2010/02/transmit.png"><img class="size-medium wp-image-276" title="Transmitter Layout" src="http://daubers.co.uk/wp-content/uploads/2010/02/transmit-212x300.png" alt="Transmitter Layout" width="212" height="300" /></a><p class="wp-caption-text">Transmitter Layout</p></div>
<p style="text-align: left;">Now the receiver layout.</p>
<div id="attachment_275" class="wp-caption aligncenter" style="width: 222px"><a href="http://daubers.co.uk/wp-content/uploads/2010/02/recieve.png"><img class="size-medium wp-image-275" title="Receiver Layout" src="http://daubers.co.uk/wp-content/uploads/2010/02/recieve-212x300.png" alt="Receiver Layout" width="212" height="300" /></a><p class="wp-caption-text">Receiver Layout</p></div>
<p style="text-align: center;">
<p style="text-align: left;">and finally the code.</p>
<p style="text-align: left;"><span style="font-family: Consolas, Monaco, 'Courier New', Courier, monospace; line-height: 18px; font-size: 12px; white-space: pre;">#reciever code</span></p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">19200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">available</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        Serial.<span style="color: #202020;">print</span><span style="color: #009900;">&#40;</span>Serial.<span style="color: #202020;">read</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> BYTE<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code"><pre class="c" style="font-family:monospace;"><span style="color: #339933;">#transmitter code</span>
<span style="color: #993333;">void</span> setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">begin</span><span style="color: #009900;">&#40;</span><span style="color: #0000dd;">19200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #993333;">void</span> loop<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    Serial.<span style="color: #202020;">write</span><span style="color: #009900;">&#40;</span><span style="color: #ff0000;">&quot;Hello<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    delay<span style="color: #009900;">&#40;</span><span style="color: #0000dd;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>This should result in the receiver outputting &#8220;Hello&#8221; over and over across the USB serial in the arduino environments serial monitor. If you have any problems, feel free to give me a shout! Oh, make sure you unplug the easy radio receiver from the arduino before flashing it, it&#8217;ll throw nasty errors otherwise. (Simply unplug digital 0 pin on the arduino board)</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2010/02/04/arduino-and-easy-radios/feed/</wfw:commentRss>
		<slash:comments>0</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>Denyhosts Stats</title>
		<link>http://daubers.co.uk/2009/05/25/denyhosts-stats/</link>
		<comments>http://daubers.co.uk/2009/05/25/denyhosts-stats/#comments</comments>
		<pubDate>Mon, 25 May 2009 14:44:20 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[webbyness]]></category>
		<category><![CDATA[denyhosts]]></category>
		<category><![CDATA[graphs]]></category>
		<category><![CDATA[matplotlib]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[stats]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=187</guid>
		<description><![CDATA[I have been told many many times that moving ssh to a different port (i.e. other than 22) makes your machine more secure. I do see some wisdom in this, however, I&#8217;ve decided to put it to the test. I have been using Denyhosts to stop brute force attacks on my ssh servers for some [...]]]></description>
			<content:encoded><![CDATA[<p>I have been told many many times that moving ssh to a different port (i.e. other than 22) makes your machine more secure. I do see some wisdom in this, however, I&#8217;ve decided to put it to the test. I have been using Denyhosts to stop brute force attacks on my ssh servers for some time now, and on my most recent server, the attacks per day are fairly regular, as seen in the graph.</p>
<p style="text-align: left;">
<div id="attachment_188" class="wp-caption aligncenter" style="width: 490px"><a href="http://daubers.co.uk/wp-content/uploads/2009/05/plot.png"><img class="size-full wp-image-188" title="Plot of Deny Hosts Blocks per Day" src="http://daubers.co.uk/wp-content/uploads/2009/05/plot.png" alt="Plot of Deny Hosts Blocks per Day" width="480" height="360" /></a><p class="wp-caption-text">Plot of Deny Hosts Blocks per Day</p></div>
<p style="text-align: left;">At the end of June I will stop using port 22 and start using another random port. I&#8217;ll then collect data for 3 months and at the end of september do another blog post showing the difference. I also have another server that I will repeat this experiment on, but that one will be 3 months behind.</p>
<p style="text-align: left;">Hopefully then I will have a nice sturdy scientific answer as to how much more protection moving ssh to a different port gives <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p style="text-align: left;">The code I used to generate this graph is given below for reference.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
</pre></td><td class="code"><pre class="python" style="font-family:monospace;"><span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">os</span>
<span style="color: #ff7700;font-weight:bold;">import</span> matplotlib
<span style="color: #ff7700;font-weight:bold;">import</span> <span style="color: #dc143c;">datetime</span>
<span style="color: #ff7700;font-weight:bold;">import</span> matplotlib.<span style="color: black;">pyplot</span> <span style="color: #ff7700;font-weight:bold;">as</span> plt
<span style="color: #ff7700;font-weight:bold;">import</span> matplotlib.<span style="color: black;">dates</span> <span style="color: #ff7700;font-weight:bold;">as</span> mdates
<span style="color: #ff7700;font-weight:bold;">import</span> matplotlib.<span style="color: black;">mlab</span> <span style="color: #ff7700;font-weight:bold;">as</span> mlab
matplotlib.<span style="color: black;">use</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Agg'</span><span style="color: black;">&#41;</span>
&nbsp;
&nbsp;
datelist = <span style="color: black;">&#123;</span><span style="color: black;">&#125;</span>
rootdir = <span style="color: #483d8b;">'./'</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> plot_all<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
	<span style="color: #808080; font-style: italic;">#first convert dict to a set of x values and a set of y values</span>
	keys = datelist.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	keys.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	values = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	times = <span style="color: black;">&#91;</span><span style="color: black;">&#93;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> keys:
		values.<span style="color: black;">append</span><span style="color: black;">&#40;</span>datelist<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
	<span style="color: #808080; font-style: italic;">#now convert the keys into time format</span>
		times.<span style="color: black;">append</span><span style="color: black;">&#40;</span><span style="color: #dc143c;">datetime</span>.<span style="color: #dc143c;">datetime</span>.<span style="color: black;">strptime</span><span style="color: black;">&#40;</span>key, <span style="color: #483d8b;">&quot;%Y-%m-%d&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#now we're ready to plot with matplotlib</span>
	months   = mdates.<span style="color: black;">MonthLocator</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>  <span style="color: #808080; font-style: italic;"># every month</span>
	days	= mdates.<span style="color: black;">DayLocator</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	yearsFmt = mdates.<span style="color: black;">DateFormatter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%b'</span><span style="color: black;">&#41;</span>
	dayFmt = mdates.<span style="color: black;">DateFormatter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%d'</span><span style="color: black;">&#41;</span>
&nbsp;
	fig = plt.<span style="color: black;">figure</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
	ax = fig.<span style="color: black;">add_subplot</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">111</span><span style="color: black;">&#41;</span>
	dates = <span style="color: #008000;">range</span><span style="color: black;">&#40;</span>times<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>.<span style="color: black;">toordinal</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>, times<span style="color: black;">&#91;</span>-<span style="color: #ff4500;">1</span><span style="color: black;">&#93;</span>.<span style="color: black;">toordinal</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span> 
	ax.<span style="color: black;">bar</span><span style="color: black;">&#40;</span>times,values,width=<span style="color: #ff4500;">1</span><span style="color: black;">&#41;</span>
&nbsp;
	ax.<span style="color: black;">set_xlabel</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Date'</span><span style="color: black;">&#41;</span>
	ax.<span style="color: black;">set_ylabel</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Number of Hosts Denied'</span><span style="color: black;">&#41;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">#ax.plot(times, values)</span>
	<span style="color: #808080; font-style: italic;">#ax.xaxis.set_major_formatter(yearsFmt)</span>
	<span style="color: #808080; font-style: italic;">#ax.xaxis.set_major_locator(months)</span>
	<span style="color: #808080; font-style: italic;">#ax.xaxis.set_minor_formatter(dayFmt)</span>
	<span style="color: #808080; font-style: italic;">#ax.xaxis.set_minor_locator(days)</span>
	ax.<span style="color: black;">format_xdata</span> = mdates.<span style="color: black;">DateFormatter</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'%Y-%m-%d'</span><span style="color: black;">&#41;</span>
	fig.<span style="color: black;">autofmt_xdate</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
        fig.<span style="color: black;">savefig</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;plot.png&quot;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> countup<span style="color: black;">&#40;</span><span style="color: #008000;">file</span><span style="color: black;">&#41;</span>:
	f = <span style="color: #008000;">open</span><span style="color: black;">&#40;</span><span style="color: #008000;">file</span>, <span style="color: #483d8b;">'r'</span><span style="color: black;">&#41;</span>
	<span style="color: #ff7700;font-weight:bold;">for</span> line <span style="color: #ff7700;font-weight:bold;">in</span> f.<span style="color: black;">readlines</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
		<span style="color: #808080; font-style: italic;">#split by spaces to get the date</span>
		line = line.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot; &quot;</span><span style="color: black;">&#41;</span>
		<span style="color: #808080; font-style: italic;">#now see if this is already in the list</span>
		newline = <span style="color: #008000;">False</span>	
		<span style="color: #ff7700;font-weight:bold;">for</span> part <span style="color: #ff7700;font-weight:bold;">in</span> line:
			<span style="color: #ff7700;font-weight:bold;">if</span> part == <span style="color: #483d8b;">&quot;new&quot;</span>:
				newline = <span style="color: #008000;">True</span>
			<span style="color: #ff7700;font-weight:bold;">else</span>:
				<span style="color: #ff7700;font-weight:bold;">continue</span>
		<span style="color: #ff7700;font-weight:bold;">if</span> newline == <span style="color: #008000;">True</span>:
			n = <span style="color: #ff4500;">0</span>
			<span style="color: #ff7700;font-weight:bold;">if</span> line<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> <span style="color: #ff7700;font-weight:bold;">in</span> datelist:
				datelist<span style="color: black;">&#91;</span>line<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> = datelist<span style="color: black;">&#91;</span>line<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> + <span style="color: #ff4500;">1</span>
			<span style="color: #ff7700;font-weight:bold;">else</span>:
				datelist<span style="color: black;">&#91;</span>line<span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span><span style="color: black;">&#93;</span> = <span style="color: #ff4500;">1</span>
	f.<span style="color: black;">close</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> subdir, dirs, files <span style="color: #ff7700;font-weight:bold;">in</span> <span style="color: #dc143c;">os</span>.<span style="color: black;">walk</span><span style="color: black;">&#40;</span>rootdir<span style="color: black;">&#41;</span>:
	<span style="color: #ff7700;font-weight:bold;">for</span> <span style="color: #008000;">file</span> <span style="color: #ff7700;font-weight:bold;">in</span> files:
		<span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> <span style="color: #008000;">file</span><span style="color: black;">&#91;</span>-<span style="color: #ff4500;">2</span>:<span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;py&quot;</span> <span style="color: #ff7700;font-weight:bold;">and</span> <span style="color: #008000;">file</span>.<span style="color: black;">split</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;.&quot;</span><span style="color: black;">&#41;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span> == <span style="color: #483d8b;">&quot;denyhosts&quot;</span>:
			countup<span style="color: black;">&#40;</span>rootdir + <span style="color: #008000;">file</span><span style="color: black;">&#41;</span>
&nbsp;
keys = datelist.<span style="color: black;">keys</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
keys.<span style="color: black;">sort</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">for</span> key <span style="color: #ff7700;font-weight:bold;">in</span> keys:
	<span style="color: #ff7700;font-weight:bold;">print</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;%s, %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: black;">&#40;</span>key,datelist<span style="color: black;">&#91;</span>key<span style="color: black;">&#93;</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
plot_all<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2009/05/25/denyhosts-stats/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple Fault Diagnosis in Ubuntu</title>
		<link>http://daubers.co.uk/2009/05/23/simple-fault-diagnosis-in-ubuntu/</link>
		<comments>http://daubers.co.uk/2009/05/23/simple-fault-diagnosis-in-ubuntu/#comments</comments>
		<pubDate>Sat, 23 May 2009 20:41:30 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[diagnosis]]></category>
		<category><![CDATA[dmesg]]></category>
		<category><![CDATA[htop]]></category>
		<category><![CDATA[logs]]></category>
		<category><![CDATA[top]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=173</guid>
		<description><![CDATA[Every so often people ask for help and are not sure where the problem lies. When diagnosing problems in Ubuntu, and some of these tips should apply to other linux distros as well, there are a few places you should look at. System Log Files Linux distributions have fantastic logging capabilities built in. If there [...]]]></description>
			<content:encoded><![CDATA[<p>Every so often people ask for help and are not sure where the problem lies. When diagnosing problems in Ubuntu, and some of these tips should apply to other linux distros as well, there are a few places you should look at.</p>
<h3>System Log Files</h3>
<p>Linux distributions have fantastic logging capabilities built in. If there is a hardware fault it will more than likely appear in the system log.  The most useful log files are kept in /var/log/ and can be accessed directly or through the Log File Viewer (System -&gt; Administration -&gt; Log File Viewer.)</p>
<p style="text-align: center;">
<div id="attachment_174" class="wp-caption aligncenter" style="width: 650px"><img class="size-full wp-image-174" title="System Log Viewer" src="http://daubers.co.uk/wp-content/uploads/2009/05/syslogviewer.png" alt="System Log Viewer" width="640" height="373" /><p class="wp-caption-text">System Log Viewer</p></div>
<p>The one thats most useful is the dmesg log. This can be found in the log viewer or on the command line by typing dmesg.  There&#8217;s normally lots of information here and depending on what the fault is with depends on what&#8217;s not working. If you have a non-functional USB peripheral, like a USB wifi card or a printer, a look at what dmesg says before it&#8217;s plugged in and after it&#8217;s plugged in can supply you with some information to start hitting google, the mailing lists or IRC with. Sometimes it will tell you what needs to be done, for example I have stuck a dodgy memory stick in one machine which didn&#8217;t automount, dmesg quite happily told me the stick had errors and to check it. Fantastic!</p>
<h3>The Tops</h3>
<p>Is something slowing your machine down to a crawl? There are a few tools that can help here, largley from the &#8220;top&#8221; family of applications. Starting with the ones that are graphical, you can use the System Monitor (System -&gt; Administration -&gt; System Monitor) and have a look under the processes tab to see which process is eating the most cpu. Easy peasy.</p>
<div id="attachment_175" class="wp-caption aligncenter" style="width: 623px"><a href="http://daubers.co.uk/wp-content/uploads/2009/05/sysmonitor.png"><img class="size-full wp-image-175" title="System Monitor Tool" src="http://daubers.co.uk/wp-content/uploads/2009/05/sysmonitor.png" alt="System Monitor Tool" width="613" height="524" /></a><p class="wp-caption-text">System Monitor Tool</p></div>
<p>The next one is top itself. Open a terminal and type &#8220;top&#8221;. This gives us a nice list of running processes and how much cpu/memory it&#8217;s using and its pid (process id). You can kill processes by hitting k and then typing in the pid.</p>
<div id="attachment_177" class="wp-caption aligncenter" style="width: 598px"><a href="http://daubers.co.uk/wp-content/uploads/2009/05/top.png"><img class="size-full wp-image-177" title="top" src="http://daubers.co.uk/wp-content/uploads/2009/05/top.png" alt="top" width="588" height="370" /></a><p class="wp-caption-text">top</p></div>
<p>The main reason I introduce people to top is because it is installed by default on most distros. A better version is htop, which while still in the terminal, is much easier to read.</p>
<div id="attachment_178" class="wp-caption aligncenter" style="width: 598px"><a href="http://daubers.co.uk/wp-content/uploads/2009/05/htop.png"><img class="size-full wp-image-178" title="htop" src="http://daubers.co.uk/wp-content/uploads/2009/05/htop.png" alt="htop" width="588" height="370" /></a><p class="wp-caption-text">htop</p></div>
<p>As you can see, it gives you all the info top gives you, but in a slightly nicer, more intuitive layout. What if somethings really giving your hard drive a bad time? Want to find out what process is doing that, simply install iotop (sudo apt-get install iotop).</p>
<div id="attachment_179" class="wp-caption aligncenter" style="width: 598px"><a href="http://daubers.co.uk/wp-content/uploads/2009/05/iotop.png"><img class="size-full wp-image-179" title="iotop" src="http://daubers.co.uk/wp-content/uploads/2009/05/iotop.png" alt="iotop" width="588" height="370" /></a><p class="wp-caption-text">iotop</p></div>
<p>This gives a list of the processes running on the machines, who&#8217;s running it and how much io it&#8217;s using.</p>
<h3>Other Useful Things to Know</h3>
<p>Along with these diagnosis tools, there are also a few tools which can identify what hardware is connected to your machine. These are all in the terminal, and are &#8220;lspci&#8221;, &#8220;lsusb&#8221; and &#8220;lsmod&#8221;. These will give you a list of hardware connected to a pci like adapter, a usb like adapter and the modules loaded into your running kernel. If you&#8217;re asking for help somewhere, you will more than likely be asked for the information from one of these.</p>
<h3>Rounding Up</h3>
<p>The purpose of giving access to all this information is because diagnosis is half way to a fix. If you know what is causing the problem you know where to start looking, and what to start google-ing for. Hopefully this post will be helpful to someone <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  I&#8217;ll write a few more in the future going into a bit more depth into each of the commands listed, but a useful place to find more info on them is in their man pages, in a terminal simply run &#8220;man &lt;command&gt;&#8221; where&lt;command&gt; is the command you&#8217;re running.</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2009/05/23/simple-fault-diagnosis-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Solving Sleep Problems with Lua</title>
		<link>http://daubers.co.uk/2009/04/18/solving-sleep-problems-with-lua/</link>
		<comments>http://daubers.co.uk/2009/04/18/solving-sleep-problems-with-lua/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 13:26:22 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[learning]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[initscripts]]></category>
		<category><![CDATA[lua]]></category>

		<guid isPermaLink="false">http://daubers.co.uk/?p=166</guid>
		<description><![CDATA[I&#8217;ve discovered recently that I don&#8217;t sleep well if I sit on the internet too late at night. Here is my solution. I&#8217;d been intending to learn Lua for a little while now, so this entire project was written in lua, with some bash scripts to call stuff. Essentially what it does, is every minute [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve discovered recently that I don&#8217;t sleep well if I sit on the internet too late at night. Here is my solution.</p>
<p>I&#8217;d been intending to learn Lua for a little while now, so this entire project was written in lua, with some bash scripts to call stuff. Essentially what it does, is every minute it checks the time. If the hour is greater than or equal too that set in /etc/bedtimer then it uses iptables to close all the ports I use that go out to the internet. This allows me to continue using my local network stuff (except ssh) if I had things like coursework to do. The server part continues to run every minute after that, incase I try and override it (bad me). There is also a gnome bit that is loaded when I log in. This part simply uses the ubuntu notify-send thing to warn me when I have 15 minutes before the net shuts off, and when it shuts off.</p>
<p>The bit that does all the work is loaded at boot using an initscript. I have yet to reboot and test this, as it&#8217;s my first initscript, but it looks ok <img src='http://daubers.co.uk/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Hopefully this will force me to actually stop wasting time on the net in the evenings and actually go read a book or do something to wind down at the end of the day.</p>
<p>The files can be found<a title="Bedtimer Scripts" href="http://daubers.co.uk/~daubers/bedtimer.tar.gz"> here</a>. There is a shell script to install it all, but it&#8217;s rubbish and may not work on your machine! BE WARNED!</p>
]]></content:encoded>
			<wfw:commentRss>http://daubers.co.uk/2009/04/18/solving-sleep-problems-with-lua/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

