<?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>Alex Sleat &#187; how to</title>
	<atom:link href="http://alexsleat.co.uk/tag/how-to/feed/" rel="self" type="application/rss+xml" />
	<link>http://alexsleat.co.uk</link>
	<description>/home/alex</description>
	<lastBuildDate>Sat, 04 Feb 2012 22:11:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>AL lib: pulseaudio.c:331: PulseAudio returned minreq &gt; tlength/2; expect break up &#8211; Ubuntu 11.10</title>
		<link>http://alexsleat.co.uk/2012/01/11/al-lib-pulseaudio-c331-pulseaudio-returned-minreq-tlength2-expect-break-up-ubuntu-11-10/</link>
		<comments>http://alexsleat.co.uk/2012/01/11/al-lib-pulseaudio-c331-pulseaudio-returned-minreq-tlength2-expect-break-up-ubuntu-11-10/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 23:49:56 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[11.04]]></category>
		<category><![CDATA[11.10]]></category>
		<category><![CDATA[blender]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[floating point exception]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[ndof]]></category>
		<category><![CDATA[oneiric]]></category>
		<category><![CDATA[pulseaudio]]></category>
		<category><![CDATA[spacenavd]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=26522</guid>
		<description><![CDATA[<br/>./blender connect failed: No such file or directory ndof: spacenavd not found AL lib: pulseaudio.c:331: PulseAudio returned minreq &#62; tlength/2; expect break up Floating point exception <p>Download and install the associated package to your processor from here : https://launchpad.net/ubuntu/oneiric/+package/python-openal</p> <p>Restart your computer and the issue should now be resolved.</p> ]]></description>
			<content:encoded><![CDATA[<br/><div class="dean_ch" style="white-space: wrap;">./blender<br />
connect failed: No such <span class="kw2">file</span> or directory<br />
ndof: spacenavd not found<br />
AL lib: pulseaudio.c:<span class="nu0">331</span>: PulseAudio returned minreq &gt; tlength/<span class="nu0">2</span>; expect <span class="kw3">break</span> up<br />
Floating point exception</div>
<p>Download and install the associated package to your processor from here : <a href="https://launchpad.net/ubuntu/oneiric/+package/python-openal">https://launchpad.net/ubuntu/oneiric/+package/python-openal</a></p>
<p>Restart your computer and the issue should now be resolved.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2012/01/11/al-lib-pulseaudio-c331-pulseaudio-returned-minreq-tlength2-expect-break-up-ubuntu-11-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating The Kernel in Ubuntu</title>
		<link>http://alexsleat.co.uk/2012/01/11/updating-the-kernel-in-ubuntu/</link>
		<comments>http://alexsleat.co.uk/2012/01/11/updating-the-kernel-in-ubuntu/#comments</comments>
		<pubDate>Wed, 11 Jan 2012 12:35:25 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[check kernel verison]]></category>
		<category><![CDATA[dpkg]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=26414</guid>
		<description><![CDATA[<br/>Download the latest from here: <p>http://kernel.ubuntu.com/~kernel-ppa/mainline/</p> <p>The folders correspond to kernel versions and should also include the ubuntu version, for example I chose to update 11.10 (oneiric) from &#8220;3.0.0-14-generic&#8221; to &#8220;3.1.4&#8243;, this was in a directory called &#8220;v3.1.4-oneiric/&#8220;.</p> You&#8217;ll need 3 files (replace * with the kernel version you&#8217;ve downloaded): <p>linux-headers-*_all.deb</p> For 64 bit [...]]]></description>
			<content:encoded><![CDATA[<br/><h6>Download the latest from here:</h6>
<p><a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/">http://kernel.ubuntu.com/~kernel-ppa/mainline/</a></p>
<p>The folders correspond to kernel versions and should also include the ubuntu version, for example I chose to update 11.10 (oneiric) from &#8220;3.0.0-14-generic&#8221; to &#8220;3.1.4&#8243;, this was in a directory called &#8220;<a href="http://kernel.ubuntu.com/~kernel-ppa/mainline/">v3.1.4-oneiric/</a>&#8220;.</p>
<h6>You&#8217;ll need 3 files <em>(replace * with the kernel version you&#8217;ve downloaded)</em>:</h6>
<p>linux-headers-*_all.deb</p>
<h6>For 64 bit systems <em>(replace * with the kernel version you&#8217;ve downloaded)</em>:</h6>
<p>linux-headers-*_amd64.deb<br />
linux-image-*_amd64.deb</p>
<h6>For 32 bit systems <em>(replace * with the kernel version you&#8217;ve downloaded)</em>:</h6>
<p>linux-headers-*_i386.deb<br />
linux-image-*_i386.deb</p>
<h6>Once you have the files, install them in the following order using these commands <em>(of course, replacing the version number for the ones you&#8217;ve downloaded)</em>:</h6>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> dpkg -U linux-headers<span class="nu0">-3.1</span><span class="nu0">.4</span>-030104_3<span class="nu0">.1</span><span class="nu0">.4</span><span class="nu0">-030104</span>.201111281851_all.deb<br />
<span class="kw2">sudo</span> dpkg -U linux-headers<span class="nu0">-3.1</span><span class="nu0">.4</span><span class="nu0">-030104</span>-generic_3<span class="nu0">.1</span><span class="nu0">.4</span><span class="nu0">-030104</span>.201111281851_amd64.deb<br />
<span class="kw2">sudo</span> dpkg -U linux-image<span class="nu0">-3.1</span><span class="nu0">.4</span><span class="nu0">-030104</span>-generic_3<span class="nu0">.1</span><span class="nu0">.4</span><span class="nu0">-030104</span>.201111281851_amd64.deb</div>
<p>Once that&#8217;s done, reboot. Once you&#8217;re back use the following command to check that the kernel you&#8217;re using is the one you&#8217;ve just downloaded and installed!</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">uname</span> -r</div>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2012/01/11/updating-the-kernel-in-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting Up Surround Sound in Linux</title>
		<link>http://alexsleat.co.uk/2011/12/03/setting-up-surround-sound-in-linux/</link>
		<comments>http://alexsleat.co.uk/2011/12/03/setting-up-surround-sound-in-linux/#comments</comments>
		<pubDate>Sat, 03 Dec 2011 13:21:41 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Arch Linux]]></category>
		<category><![CDATA[blog1]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[HowTo]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[5.1]]></category>
		<category><![CDATA[7.1]]></category>
		<category><![CDATA[cm106]]></category>
		<category><![CDATA[easy]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[quick]]></category>
		<category><![CDATA[set up]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[speakers]]></category>
		<category><![CDATA[surround sound]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=24714</guid>
		<description><![CDATA[<br/><p>It&#8217;s been a while since I bothered, the reason being it&#8217;s always seemed like an un-worthwhile struggle to get it working but either things changed or I was doing something to overcomplicate the process but it&#8217;s actually pretty simple to get surround sound up and running on your Linux machine. Now, I&#8217;m not going [...]]]></description>
			<content:encoded><![CDATA[<br/><p>It&#8217;s been a while since I bothered, the reason being it&#8217;s always seemed like an un-worthwhile struggle to get it working but either things changed or I was doing something to overcomplicate the process but it&#8217;s actually pretty simple to get surround sound up and running on your Linux machine. Now, I&#8217;m not going to go in to how to install the drivers for your specific sound card, because there are so many and I don&#8217;t have them all and most times on most popular distributions (Debian, Ubuntu, Mint, Fedora, OpenSuse etc) you&#8217;re going to notice that the sound card is actually already supported. What I will be doing is showing you how easy it was to get my 5.1&#8242;s set up (and the same will be said for 7.1&#8242;s).</p>
<h6>Step 1:</h6>
<p>First off you&#8217;re going to want to edit the pulseaudio configuration file to add the number of speakers you&#8217;re using, it&#8217;s default is set to 2.</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> gedit /etc/pulse/daemon.conf</div>
<p>Near the bottom of the file, there will be a line which looks like this:</p>
<blockquote><p>;default-sample-channels = 2</p></blockquote>
<p>The semi-colon is a comment, so this line isn&#8217;t actually doing anything unless you remove that. I would suggest leaving that line alone and adding a new line at the bottom:</p>
<blockquote><p>default-sample-channels = 6</p></blockquote>
<p>If you&#8217;re using 5.1&#8242;s the number of channels will be 6, 7.1&#8242;s will be 8 and I think you get where I&#8217;m going with this? So in this example, I&#8217;m using 5.1&#8242;s.</p>
<p>Now save and close that file. You&#8217;ll need to reboot your system now too, so that these changes will take effect.</p>
<h6>Step 2:</h6>
<p>So you&#8217;re back? Good..</p>
<p>Now you&#8217;re going to want to open up the Sound Preferences, usually you can do this by clicking on the little sound icon in your panel, or System > Preference > Sounds from the menu.</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/12/Screenshot-Sound-Preferences.png"><img src="http://alexsleat.co.uk/wp-content/uploads/2011/12/Screenshot-Sound-Preferences.png" alt="" title="Screenshot-Sound Preferences" width="678" height="594" class="aligncenter size-full wp-image-24716" /></a></p>
<p>From here, you&#8217;ll want to click on the Hardware tab. Near the bottom it&#8217;ll say Profile: with a drop down box next to it. Here you can select the type of set up you have, as you can see in the screenshot I have an &#8220;Analogue Surround 5.1 Output&#8221;, yours might be different and that&#8217;s cool and if you don&#8217;t know feel free to try a few out. Next to that drop down box is a button which says &#8220;Test Speakers&#8221;, this didn&#8217;t work for me so I have to use an <a href="http://www.youtube.com/watch?v=w0eaV8r-nXQ">online test</a> but give it a try as it might work!</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/12/Screenshot-Speaker-Testing-for-CM106-Like-Sound-Device.png"><img src="http://alexsleat.co.uk/wp-content/uploads/2011/12/Screenshot-Speaker-Testing-for-CM106-Like-Sound-Device.png" alt="" title="Screenshot-Speaker Testing for CM106 Like Sound Device" width="457" height="395" class="aligncenter size-full wp-image-24719" /></a></p>
<p>That&#8217;s it, you should be done!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/12/03/setting-up-surround-sound-in-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenNI &#8211; error CS0006: cannot find metadata file `System.Windows.Forms.dll&#8217;</title>
		<link>http://alexsleat.co.uk/2011/12/01/openni-error-cs0006-cannot-find-metadata-file-system-windows-forms-dll/</link>
		<comments>http://alexsleat.co.uk/2011/12/01/openni-error-cs0006-cannot-find-metadata-file-system-windows-forms-dll/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 13:41:37 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[11.04]]></category>
		<category><![CDATA[11.10]]></category>
		<category><![CDATA[ddl missing]]></category>
		<category><![CDATA[drivers]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[kinect]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=24552</guid>
		<description><![CDATA[<br/><p>During installing the OpenNi kinect drivers, found here: https://github.com/OpenNI/OpenNI, I came across this error:</p> <p>make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net&#8217; gmcs -out:../../../Bin/Release/SimpleViewer.net.exe -target:winexe -unsafe -o+ -r:OpenNI.net.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll -lib:../../../Bin/Release ../../../../../Samples/SimpleViewer.net/*.cs ../../Res/AssemblyInfo-OpenNI.cs error CS0006: cannot find metadata file `System.Windows.Forms.dll&#8217; Compilation failed: 1 error(s), 0 warnings make[1]: *** [../../../Bin/Release/SimpleViewer.net.exe] Error 1 make[1]: Leaving directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net&#8217; make: *** [Samples/SimpleViewer.net] [...]]]></description>
			<content:encoded><![CDATA[<br/><p>During installing the OpenNi kinect drivers, found here: <a href="https://github.com/OpenNI/OpenNI">https://github.com/OpenNI/OpenNI</a>, I came across this error:</p>
<blockquote><p>make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net&#8217;<br />
gmcs -out:../../../Bin/Release/SimpleViewer.net.exe -target:winexe -unsafe -o+ -r:OpenNI.net.dll -r:System.Windows.Forms.dll -r:System.Drawing.dll -lib:../../../Bin/Release ../../../../../Samples/SimpleViewer.net/*.cs ../../Res/AssemblyInfo-OpenNI.cs<br />
error CS0006: cannot find metadata file `System.Windows.Forms.dll&#8217;<br />
Compilation failed: 1 error(s), 0 warnings<br />
make[1]: *** [../../../Bin/Release/SimpleViewer.net.exe] Error 1<br />
make[1]: Leaving directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Samples/SimpleViewer.net&#8217;<br />
make: *** [Samples/SimpleViewer.net] Error 2</p></blockquote>
<p>To fix it, simply install the following package:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> mono-<span class="kw3">complete</span></div>
<p>Once finished, re-make and make install and everything should be dandy!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/12/01/openni-error-cs0006-cannot-find-metadata-file-system-windows-forms-dll/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Java &#8211; .jar Error 127 /bin/sh: javac: not found.</title>
		<link>http://alexsleat.co.uk/2011/12/01/java-jar-error-127-binsh-javac-not-found/</link>
		<comments>http://alexsleat.co.uk/2011/12/01/java-jar-error-127-binsh-javac-not-found/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 13:33:42 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[error 127]]></category>
		<category><![CDATA[fix]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[javac not found]]></category>
		<category><![CDATA[jdk]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[sun-java6]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=24549</guid>
		<description><![CDATA[<br/><p>If you&#8217;re getting a similar error to this while trying to compile java files (.jar) then you&#8217;re probably missing the jdk, in ubuntu it&#8217;s called &#8220;sun-java6-jdk&#8221; so just go ahead and install that and all should be good!</p> <p>make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Wrappers/OpenNI.java&#8217; javac -d Release ../../../../../Wrappers/OpenNI.java/src/org/OpenNI/*.java /bin/sh: javac: not found make[1]: *** [../../../Bin/Release/org.OpenNI.jar] Error [...]]]></description>
			<content:encoded><![CDATA[<br/><p>If you&#8217;re getting a similar error to this while trying to compile java files (.jar) then you&#8217;re probably missing the jdk, in ubuntu it&#8217;s called &#8220;sun-java6-jdk&#8221; so just go ahead and install that and all should be good!</p>
<blockquote><p>make[1]: Entering directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Wrappers/OpenNI.java&#8217;<br />
javac  -d Release ../../../../../Wrappers/OpenNI.java/src/org/OpenNI/*.java<br />
/bin/sh: javac: not found<br />
make[1]: *** [../../../Bin/Release/org.OpenNI.jar] Error 127<br />
make[1]: Leaving directory `/home/alex/kinect/OpenNI/Platform/Linux-x86/Build/Wrappers/OpenNI.java&#8217;<br />
make: *** [Wrappers/OpenNI.java] Error 2</p></blockquote>
<p>FIX:</p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> sun-java6-jdk</div>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/12/01/java-jar-error-127-binsh-javac-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How To Take Screenshots in Ice Cream Sandwich (Android 4.0.x)</title>
		<link>http://alexsleat.co.uk/2011/11/28/how-to-take-screenshots-in-ice-cream-sandwich-android-4-0-x/</link>
		<comments>http://alexsleat.co.uk/2011/11/28/how-to-take-screenshots-in-ice-cream-sandwich-android-4-0-x/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 13:23:32 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[blog1]]></category>
		<category><![CDATA[4.0]]></category>
		<category><![CDATA[android]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[ice cream sandwich]]></category>
		<category><![CDATA[ics]]></category>
		<category><![CDATA[screen grab]]></category>
		<category><![CDATA[screenshot]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=24329</guid>
		<description><![CDATA[<br/><p>Android 4.0 or Ice Cream Sandwich (ICS) finally brings screenshots natively to the mobile platform, to a lot of users of custom ROMs such as CyanogenMod or Darkys ROM it may seem like this has been a feature for a while but that isn&#8217;t the case.</p> To take a screenshot: Simply hold down the [...]]]></description>
			<content:encoded><![CDATA[<br/><p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot_2011-11-27-23-43-13.png"><img class="alignright size-full wp-image-24296" title="Android 4.0 ICS Ice cream sandwich screenshot" src="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot_2011-11-27-23-43-13.png" alt="" width="288" height="480" /></a>Android 4.0 or Ice Cream Sandwich (ICS) finally brings screenshots natively to the mobile platform, to a lot of users of custom ROMs such as CyanogenMod or Darkys ROM it may seem like this has been a feature for a while but that isn&#8217;t the case.</p>
<h6>To take a screenshot:</h6>
<ul>
<li>Simply <strong>hold down</strong> the <strong>Volume Down</strong> button and <strong>Power</strong> button <strong>for about a second</strong>.</li>
</ul>
<p>&nbsp;</p>
<p>You&#8217;ll see a flash and the screen will be framed which shows the screenshot was taken (I&#8217;ve tried grabbing a screenshot of this screen, but it&#8217;s pretty tricky and no luck yet!). The screenshot will be saved in a folder /Pictures/Screenshots on your phones internal SD card.</p>
<p>You&#8217;ll also get a new notification in the notification bar saying &#8220;Saving Screenshot&#8230;&#8221; and once it&#8217;s done there&#8217;ll be a &#8220;Screenshot captured.&#8221; notification in the pull down menu which will take you directly the screenshot in the Gallery.</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot_2011-11-28-13-18-31.png"><img class="size-full wp-image-24341 alignnone" title="Android 4.0 ICS Ice cream sandwich screenshot captured" src="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot_2011-11-28-13-18-31.png" alt="" width="384" height="173" /></a></p>
<h5></h5>
<blockquote>
<h5 style="text-align: center;">For more screenshots, check out my first look and impressions post about ICS!<br />
<a href="http://alexsleat.co.uk/2011/11/30/android-4-0-ice-cream-sandwich-first-look-impressions/"> HERE</a></h5>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/11/28/how-to-take-screenshots-in-ice-cream-sandwich-android-4-0-x/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Linux USB Errors with usb-creator-gtk &#8220;stdin: I/O error stdin: error 0 /init: line 1: can&#8217;t open /dev/sr0: No medium found&#8221;</title>
		<link>http://alexsleat.co.uk/2011/11/26/linux-usb-errors-with-usb-creator-gtk-stdin-io-error-stdin-error-0-init-line-1-cant-open-devsr0-no-medium-found/</link>
		<comments>http://alexsleat.co.uk/2011/11/26/linux-usb-errors-with-usb-creator-gtk-stdin-io-error-stdin-error-0-init-line-1-cant-open-devsr0-no-medium-found/#comments</comments>
		<pubDate>Sat, 26 Nov 2011 14:29:01 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Command Line]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[fedora]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[linuxmint]]></category>
		<category><![CDATA[live usb]]></category>
		<category><![CDATA[mint]]></category>
		<category><![CDATA[opensuse]]></category>
		<category><![CDATA[pen drive]]></category>
		<category><![CDATA[persistence]]></category>
		<category><![CDATA[stdin I/O error]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[unetbootin]]></category>
		<category><![CDATA[usb]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=24181</guid>
		<description><![CDATA[<br/><p>After installing Ubuntu on a USB stick with the Ubuntu USB Startup Disk Creator (usb-creator-gtk) you might encounter an error such as the following:</p> stdin: I/O error stdin: error 0 /init: line 1: can&#8216;t open /dev/sr0: No medium found <p>This is actually a bug with the software and isn&#8217;t anything you&#8217;ve done wrong. It [...]]]></description>
			<content:encoded><![CDATA[<br/><p>After installing Ubuntu on a USB stick with the Ubuntu USB Startup Disk Creator (usb-creator-gtk) you might encounter an error such as the following:</p>
<div class="dean_ch" style="white-space: wrap;">stdin: I/O error<br />
stdin: error <span class="nu0">0</span><br />
/init: line <span class="nu0">1</span>: can<span class="st0">&#8216;t open /dev/sr0: No medium found</span></div>
<p>This is actually a <a href="https://bugs.launchpad.net/ubuntu/+bug/500822">bug</a> with the software and isn&#8217;t anything you&#8217;ve done wrong. It seems to be a bug that&#8217;s effecting users running Karmic, Lucid, Maverick and Natty so it&#8217;s a pretty wide spread issue.</p>
<p>The best way I have found to get around this issue is to install and run <a href="http://unetbootin.sourceforge.net">unetbootin</a> to create live USBs. If you&#8217;re using linux it should be found in the usual place you can install things.</p>
<h6>Installation:</h6>
<p><strong>Ubuntu/LinuxMint/Debian:</strong></p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> unetbootin</div>
<p><strong>Fedora/OpenSuse:</strong></p>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> yum <span class="kw2">install</span> unetbootin</div>
<h6>Create a live USB:</h6>
<p>To install a distro it&#8217;s pretty simple, either select it from the &#8220;Distribution&#8221; option and pick a distribution and version, UNetbootin will then actually download it and install it for you. Alternatively you can pick an Diskimage and browse for the ISO file you download (and would usually burn to a CD/DVD) and install from that. Select the USB Drive at the bottom and hit ok and it&#8217;ll install a bootloader, the system and you&#8217;ll be up and running in no time.</p>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot-UNetbootin.png"><img class="aligncenter size-full wp-image-24182" title="Screenshot-UNetbootin" src="http://alexsleat.co.uk/wp-content/uploads/2011/11/Screenshot-UNetbootin.png" alt="" width="530" height="387" /></a></p>
<h6>Persistence File:</h6>
<p>If you wanted a persistence install which allows you to save files, settings and installed programs you&#8217;ll have to do a little manual work as it currently doesn&#8217;t support that option.</p>
<p>Go to <a href="http://unetbootin.sourceforge.net/diskimg/">http://unetbootin.sourceforge.net/diskimg/</a> and download one of the files (128mb.zip, 256mb.zip, or 512mb.zip) corresponding to the amount of persistent space you want (make sure the size of the persistent disk image is smaller than the free space you have on your USB drive).</p>
<p>You&#8217;ll then need to edit the syslinux.cfg file that was created by UNetbootin in the root of the directory (just open it with a text editor) you should see something similar to the following:</p>
<blockquote><p>label unetbootindefault<br />
menu label Default<br />
kernel /ubnkern<br />
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash &#8211;</p></blockquote>
<p>So on the line that starts &#8220;appen initrd=&#8221; you&#8217;ll want to add the option of &#8220;persistent&#8221;, it should then look like the following:</p>
<p>NOTE: WordPress changes my double dash at the end of the last line to a single long dash, this won&#8217;t work. It&#8217;s easiest just to add the final word before the double dash in the file, do not copy and paste this in to your file. If you do, you will get more errors.</p>
<blockquote><p>label unetbootindefault<br />
menu label Default<br />
kernel /ubnkern<br />
append initrd=/ubninit file=/cdrom/preseed/ubuntu.seed boot=casper quiet splash persistent &#8211;</p></blockquote>
<p>I added this line to all that used the &#8220;file=/cdrom/preseed/ubuntu.seed&#8221; option, since that&#8217;s the image that&#8217;s being opened and it should then change all options on the bootloader that will load the ubuntu install.</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/11/26/linux-usb-errors-with-usb-creator-gtk-stdin-io-error-stdin-error-0-init-line-1-cant-open-devsr0-no-medium-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python &#8211; Making Use of Google&#8217;s Text To Speech Translation Tool</title>
		<link>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/</link>
		<comments>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 00:46:22 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[mp3]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[source code]]></category>
		<category><![CDATA[stream]]></category>
		<category><![CDATA[text to speech]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[tts]]></category>
		<category><![CDATA[voice]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=23542</guid>
		<description><![CDATA[<br/><p>Text to speech (tts) is a difficult task to get right and there are quite a few packages that show just how hard with their terrible tinny voices, these are also usually only limited to English, which for the larger part than most people would like to believe don&#8217;t find it very useful. Nevermind, [...]]]></description>
			<content:encoded><![CDATA[<br/><p>Text to speech (tts) is a difficult task to get right and there are quite a few packages that show just how hard with their terrible tinny voices, these are also usually only limited to English, which for the larger part than most people would like to believe don&#8217;t find it very useful. Nevermind, Google to the rescue, their <a href="http://translate.google.com">Translation tool</a> has had the ability to also voice translations for a while now. So wouldn&#8217;t it be awesome if we could utilize this, stable, constantly developing and ultimately free utlilty? Yes? Well luckly for you it&#8217;s possible. It&#8217;s been done before with the use of JavaScript, like <a href="http://weston.ruter.net/projects/google-tts/">here</a> but those more used to scripting and desktop programming don&#8217;t worry, you can use it too.</p>
<p>Basically it works by sending a request to the Google translate servers which then, pretty much instantly, reply with an MP3 file which contains the requested words in their most sexy of robot voices.</p>
<p>Check this URL for an example of said voice &#8211; <a href="http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice">http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice</a> (if it doesn&#8217;t load in your browser, open VLC, CTRL+N and paste the URL in)</p>
<h6>First, we want to be able to get python to stream an MP3 file off the web:</h6>
<p>More info on this can be found <a href="http://codeboje.de/playing-mp3-stream-python/">here</a>, the following code was is a stripped down version of the code found at codeboje.de.</p>
<script src="http://gist.github.com/1362973.js?file=playMP3stream.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">time</span>		<span class="c">#for delay</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">pygst</span>		<span class="c">#for playing mp3 stream</span></div><div class='line' id='LC5'><span class="kn">import</span> <span class="nn">gst</span>		<span class="c"># &quot; &quot;</span></div><div class='line' id='LC6'><br/></div><div class='line' id='LC7'><span class="c">#Play an .mp3 file from the internet</span></div><div class='line' id='LC8'><span class="n">music_stream_uri</span> <span class="o">=</span> <span class="s">&#39;http://www.sample-url.com/file.mp3&#39;</span></div><div class='line' id='LC9'><span class="n">player</span> <span class="o">=</span> <span class="n">gst</span><span class="o">.</span><span class="n">element_factory_make</span><span class="p">(</span><span class="s">&quot;playbin&quot;</span><span class="p">,</span> <span class="s">&quot;player&quot;</span><span class="p">)</span></div><div class='line' id='LC10'><span class="n">player</span><span class="o">.</span><span class="n">set_property</span><span class="p">(</span><span class="s">&#39;uri&#39;</span><span class="p">,</span> <span class="n">music_stream_uri</span><span class="p">)</span></div><div class='line' id='LC11'><span class="n">player</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">gst</span><span class="o">.</span><span class="n">STATE_PLAYING</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="c">#requires a delay, if the py process closes before the mp3 has finished it will be cut off.</span></div><div class='line' id='LC14'><span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/bc68a8dd1807586944708fbb24fe09716c8153ae/playMP3stream.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_play_mp3stream.py" style="float:right;margin-right:10px;color:#666">playMP3stream.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<h6>Now we want to make a string to send :</h6>
<p>We&#8217;re going to use command line arguments as the string which wants to be read by the Google TTS engine, the following code will grab those arguments and concatenate them into a string. It also has to be in a format like a usual Google URL, these usually replace white space for the &#8216;+&#8217; sign, that&#8217;s easy to do.</p>
<script src="http://gist.github.com/1362973.js?file=argvURLfriendly.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">sys</span>		<span class="c">#for cmd line argv</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="c">#take command line args as the input string</span></div><div class='line' id='LC6'><span class="n">input_string</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span></div><div class='line' id='LC7'><span class="c">#remove the program name from the argv list</span></div><div class='line' id='LC8'><span class="n">input_string</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="c">#convert to google friendly url (with + replacing spaces)</span></div><div class='line' id='LC11'><span class="n">tts_string</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_string</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="k">print</span> <span class="n">tts_string</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/f3480729df33a3ff5cf17899a0a6354b49d86ad1/argvURLfriendly.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_argv_ur_lfriendly.py" style="float:right;margin-right:10px;color:#666">argvURLfriendly.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<p>Now let&#8217;s just pass this URL to the bit we wrote to stream an MP3 and watch it go:</p>
<h6>Full Source Code:</h6>
<p>(Uses command line arguments as it&#8217;s input, run like &#8216;<em>python ttsString.py Hello World</em>&#8216;)<br />
<script src="http://gist.github.com/1362973.js?file=ttsString.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362973" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">import</span> <span class="nn">sys</span>		<span class="c">#for cmd line argv</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">time</span>		<span class="c">#for delay</span></div><div class='line' id='LC5'><span class="kn">import</span> <span class="nn">pygst</span>		<span class="c">#for playing mp3 stream</span></div><div class='line' id='LC6'><span class="kn">import</span> <span class="nn">gst</span>		<span class="c"># &quot; &quot;</span></div><div class='line' id='LC7'><br/></div><div class='line' id='LC8'><span class="c">#take command line args as the input string</span></div><div class='line' id='LC9'><span class="n">input_string</span> <span class="o">=</span> <span class="n">sys</span><span class="o">.</span><span class="n">argv</span></div><div class='line' id='LC10'><span class="c">#remove the program name from the argv list</span></div><div class='line' id='LC11'><span class="n">input_string</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="mi">0</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="c">#convert to google friendly url (with + replacing spaces)</span></div><div class='line' id='LC14'><span class="n">tts_string</span> <span class="o">=</span> <span class="s">&#39;+&#39;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span><span class="n">input_string</span><span class="p">)</span></div><div class='line' id='LC15'><br/></div><div class='line' id='LC16'><span class="k">print</span> <span class="n">tts_string</span></div><div class='line' id='LC17'><br/></div><div class='line' id='LC18'><span class="c">#use string in combination with the translate url as the stream to be played</span></div><div class='line' id='LC19'><span class="n">music_stream_uri</span> <span class="o">=</span> <span class="s">&#39;http://translate.google.com/translate_tts?q=&#39;</span> <span class="o">+</span> <span class="n">tts_string</span></div><div class='line' id='LC20'><span class="n">player</span> <span class="o">=</span> <span class="n">gst</span><span class="o">.</span><span class="n">element_factory_make</span><span class="p">(</span><span class="s">&quot;playbin&quot;</span><span class="p">,</span> <span class="s">&quot;player&quot;</span><span class="p">)</span></div><div class='line' id='LC21'><span class="n">player</span><span class="o">.</span><span class="n">set_property</span><span class="p">(</span><span class="s">&#39;uri&#39;</span><span class="p">,</span> <span class="n">music_stream_uri</span><span class="p">)</span></div><div class='line' id='LC22'><span class="n">player</span><span class="o">.</span><span class="n">set_state</span><span class="p">(</span><span class="n">gst</span><span class="o">.</span><span class="n">STATE_PLAYING</span><span class="p">)</span></div><div class='line' id='LC23'><br/></div><div class='line' id='LC24'><span class="c">#requires a delay, if the py process closes before the mp3 has finished it will be cut off.</span></div><div class='line' id='LC25'><span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mi">12</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362973/2616de7115260a45b45ec55d84050a4dc39e8613/ttsString.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362973#file_tts_string.py" style="float:right;margin-right:10px;color:#666">ttsString.py</a>
            <a href="https://gist.github.com/1362973">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript></p>
<p>That&#8217;s pretty much how easy it is to use Google&#8217;s free online TTS engine, one main thing to watch out for is the 100 character limit to the use of this service in this way along with the API call limits which apply to each IP address. There are loads of cool things this can be used for and I&#8217;d love to see what anyone comes up with, keep me posted and have fun!</p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/11/14/python-making-use-of-googles-text-to-speech-translation-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://translate.google.com/translate_tts?q=check+out+my+sexy+robot+voice" length="10272" type="audio/mpeg" />
		</item>
		<item>
		<title>Python &#8211; Writing a &#8216;Fuzzy Clock&#8217;</title>
		<link>http://alexsleat.co.uk/2011/11/13/python-writing-a-fuzzy-clock/</link>
		<comments>http://alexsleat.co.uk/2011/11/13/python-writing-a-fuzzy-clock/#comments</comments>
		<pubDate>Sun, 13 Nov 2011 13:57:47 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[fuzzy clock]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[source code]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=23560</guid>
		<description><![CDATA[<br/><p>If you want a clock that&#8217;s a little more human, there&#8217;s no better way than a &#8216;Fuzzy&#8217; clock, essentially this converts the time in to a more brain friendly format such as &#8220;Twenty past Twelve&#8221; rather than 12:22. </p> Writing a simple fuzzy clock Source Code: #!/usr/bin/pythonfrom time import gmtime, strftime#Get minutestime_min = strftime(&#34;%M&#34;, [...]]]></description>
			<content:encoded><![CDATA[<br/><p>If you want a clock that&#8217;s a little more human, there&#8217;s no better way than a &#8216;Fuzzy&#8217; clock, essentially this converts the time in to a more brain friendly format such as &#8220;Twenty past Twelve&#8221; rather than 12:22. </p>
<h5>Writing a simple fuzzy clock</h5>
<h6>Source Code:</h6>
<script src="http://gist.github.com/1362167.js?file=fuzzyTime_num.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362167" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">gmtime</span><span class="p">,</span> <span class="n">strftime</span></div><div class='line' id='LC4'><br/></div><div class='line' id='LC5'><span class="c">#Get minutes</span></div><div class='line' id='LC6'><span class="n">time_min</span> <span class="o">=</span> <span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%M&quot;</span><span class="p">,</span> <span class="n">gmtime</span><span class="p">())</span></div><div class='line' id='LC7'><span class="c">#Get hour, as int</span></div><div class='line' id='LC8'><span class="n">time_hour</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%H&quot;</span><span class="p">,</span> <span class="n">gmtime</span><span class="p">()))</span></div><div class='line' id='LC9'><br/></div><div class='line' id='LC10'><span class="c">#round minutes to nearest 5, return as int</span></div><div class='line' id='LC11'><span class="n">time_min</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">time_min</span><span class="p">)</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span></div><div class='line' id='LC12'><br/></div><div class='line' id='LC13'><span class="c">#Make it 12 hour, rather than 24</span></div><div class='line' id='LC14'><span class="k">if</span> <span class="n">time_hour</span> <span class="o">&gt;=</span> <span class="mi">13</span><span class="p">:</span></div><div class='line' id='LC15'>	<span class="n">time_hour</span> <span class="o">=</span> <span class="n">time_hour</span> <span class="o">-</span> <span class="mi">12</span></div><div class='line' id='LC16'><br/></div><div class='line' id='LC17'><span class="c">#Get the O&#39;clock for if it&#39;s around 0mins past</span></div><div class='line' id='LC18'><span class="k">if</span> <span class="n">time_min</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span></div><div class='line' id='LC19'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time_hour</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; o&#39;clock&quot;</span></div><div class='line' id='LC20'><span class="k">elif</span> <span class="n">time_min</span> <span class="o">==</span> <span class="mi">60</span><span class="p">:</span></div><div class='line' id='LC21'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time_hour</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; o&#39;clock&quot;</span></div><div class='line' id='LC22'><span class="c">#If it&#39;s less than half past, it&#39;ll be past</span></div><div class='line' id='LC23'><span class="k">elif</span> <span class="n">time_min</span> <span class="o">&lt;=</span> <span class="mi">30</span><span class="p">:</span></div><div class='line' id='LC24'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time_min</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; past &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time_hour</span><span class="p">)</span></div><div class='line' id='LC25'><span class="c">#otherwise it&#39;ll be to, you need to invert the minutes and add on an hour</span></div><div class='line' id='LC26'><span class="c">#	so 35 past 12 becomes: 25 to 1</span></div><div class='line' id='LC27'><span class="k">else</span><span class="p">:</span></div><div class='line' id='LC28'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="mi">60</span><span class="o">-</span><span class="n">time_min</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot; to &quot;</span> <span class="o">+</span> <span class="nb">str</span><span class="p">(</span><span class="n">time_hour</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362167/597bdf0da683147a65f90204dd178d18d51f98a4/fuzzyTime_num.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362167#file_fuzzy_time_num.py" style="float:right;margin-right:10px;color:#666">fuzzyTime_num.py</a>
            <a href="https://gist.github.com/1362167">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<h6>Output:</h6>
<blockquote><p> $ python fuzzytime.py<br />
It&#8217;s 25 to 2
</p></blockquote>
<h5>Writing a more readable fuzzy clock:</h5>
<p>Now, this returns in a form of &#8220;It&#8217;s 20 past 1&#8243; rather than &#8220;It&#8217;s twenty past one&#8221;, if you&#8217;re going to want this then it&#8217;s only a little more tricky. For this I used a lookup table which would essentially replace the numbers for the written numbers.</p>
<h6>Source Code:</h6>
<script src="http://gist.github.com/1362167.js?file=fuzzyTime_word.py"></script><noscript><link rel="stylesheet" href="https://gist.github.com/stylesheets/gist/embed.css"><div id="gist-1362167" class="gist">

        <div class="gist-file">
          <div class="gist-data gist-syntax">
              <div class="highlight"><pre><div class='line' id='LC1'><span class="c">#!/usr/bin/python</span></div><div class='line' id='LC2'><br/></div><div class='line' id='LC3'><span class="kn">from</span> <span class="nn">time</span> <span class="kn">import</span> <span class="n">gmtime</span><span class="p">,</span> <span class="n">strftime</span></div><div class='line' id='LC4'><span class="kn">import</span> <span class="nn">bisect</span></div><div class='line' id='LC5'><br/></div><div class='line' id='LC6'><span class="n">minLookup</span><span class="o">=</span><span class="p">[</span></div><div class='line' id='LC7'>	<span class="s">&#39; &#39;</span><span class="p">,</span></div><div class='line' id='LC8'>	<span class="s">&#39;five&#39;</span><span class="p">,</span> </div><div class='line' id='LC9'>	<span class="s">&#39;ten&#39;</span><span class="p">,</span> </div><div class='line' id='LC10'>	<span class="s">&#39;quater&#39;</span><span class="p">,</span> </div><div class='line' id='LC11'>	<span class="s">&#39;twenty&#39;</span><span class="p">,</span> </div><div class='line' id='LC12'>	<span class="s">&#39;twenty-five&#39;</span></div><div class='line' id='LC13'><span class="p">]</span></div><div class='line' id='LC14'><span class="n">hourLookup</span><span class="o">=</span><span class="p">[</span></div><div class='line' id='LC15'>	<span class="s">&#39;midnight&#39;</span><span class="p">,</span></div><div class='line' id='LC16'>	<span class="s">&#39;one&#39;</span><span class="p">,</span></div><div class='line' id='LC17'>	<span class="s">&#39;two&#39;</span><span class="p">,</span></div><div class='line' id='LC18'>	<span class="s">&#39;three&#39;</span><span class="p">,</span></div><div class='line' id='LC19'>	<span class="s">&#39;four&#39;</span><span class="p">,</span></div><div class='line' id='LC20'>	<span class="s">&#39;five&#39;</span><span class="p">,</span></div><div class='line' id='LC21'>	<span class="s">&#39;six&#39;</span><span class="p">,</span></div><div class='line' id='LC22'>	<span class="s">&#39;seven&#39;</span><span class="p">,</span></div><div class='line' id='LC23'>	<span class="s">&#39;eight&#39;</span><span class="p">,</span></div><div class='line' id='LC24'>	<span class="s">&#39;nine&#39;</span><span class="p">,</span></div><div class='line' id='LC25'>	<span class="s">&#39;ten&#39;</span><span class="p">,</span></div><div class='line' id='LC26'>	<span class="s">&#39;eleven&#39;</span><span class="p">,</span></div><div class='line' id='LC27'>	<span class="s">&#39;noon&#39;</span></div><div class='line' id='LC28'><span class="p">]</span></div><div class='line' id='LC29'><br/></div><div class='line' id='LC30'><span class="c">#Get minutes</span></div><div class='line' id='LC31'><span class="n">time_min</span> <span class="o">=</span> <span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%M&quot;</span><span class="p">,</span> <span class="n">gmtime</span><span class="p">())</span></div><div class='line' id='LC32'><span class="c">#Get hour, as int</span></div><div class='line' id='LC33'><span class="n">time_hour</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">strftime</span><span class="p">(</span><span class="s">&quot;%H&quot;</span><span class="p">,</span> <span class="n">gmtime</span><span class="p">()))</span></div><div class='line' id='LC34'><br/></div><div class='line' id='LC35'><span class="c">#round minutes to nearest 5, return as int</span></div><div class='line' id='LC36'><span class="n">time_min</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="nb">round</span><span class="p">(</span><span class="nb">float</span><span class="p">(</span><span class="n">time_min</span><span class="p">)</span><span class="o">*</span><span class="mi">2</span><span class="p">,</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">/</span><span class="mi">2</span><span class="p">)</span></div><div class='line' id='LC37'><br/></div><div class='line' id='LC38'><span class="c">#Make it 12 hour, rather than 24</span></div><div class='line' id='LC39'><span class="k">if</span> <span class="n">time_hour</span> <span class="o">&gt;=</span> <span class="mi">13</span><span class="p">:</span></div><div class='line' id='LC40'>	<span class="n">time_hour</span> <span class="o">=</span> <span class="n">time_hour</span> <span class="o">-</span> <span class="mi">12</span></div><div class='line' id='LC41'><br/></div><div class='line' id='LC42'><span class="c">#Get the O&#39;clock for if it&#39;s around 0mins past</span></div><div class='line' id='LC43'><span class="k">if</span> <span class="n">time_min</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span></div><div class='line' id='LC44'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="n">hourLookup</span><span class="p">[</span><span class="n">time_hour</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; o&#39;clock&quot;</span></div><div class='line' id='LC45'><span class="k">elif</span> <span class="n">time_min</span> <span class="o">==</span> <span class="mi">60</span><span class="p">:</span></div><div class='line' id='LC46'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="n">hourLookup</span><span class="p">[</span><span class="n">time_hour</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; o&#39;clock&quot;</span></div><div class='line' id='LC47'><span class="c">#If it&#39;s less than half past, it&#39;ll be past</span></div><div class='line' id='LC48'><span class="k">elif</span> <span class="n">time_min</span> <span class="o">&lt;=</span> <span class="mi">30</span><span class="p">:</span></div><div class='line' id='LC49'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="n">minLookup</span><span class="p">[</span><span class="n">time_min</span><span class="o">/</span><span class="mi">5</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; past &quot;</span> <span class="o">+</span> <span class="n">hourLookup</span><span class="p">[</span><span class="n">time_hour</span><span class="p">]</span></div><div class='line' id='LC50'><span class="c">#otherwise it&#39;ll be to, you need to invert the minutes and add on an hour</span></div><div class='line' id='LC51'><span class="c">#	so 35 past 12 becomes: 25 to 1</span></div><div class='line' id='LC52'><span class="k">else</span><span class="p">:</span></div><div class='line' id='LC53'>	<span class="k">print</span> <span class="s">&quot;It&#39;s &quot;</span> <span class="o">+</span> <span class="n">minLookup</span><span class="p">[(</span><span class="mi">60</span><span class="o">-</span><span class="n">time_min</span><span class="p">)</span><span class="o">/</span><span class="mi">5</span><span class="p">]</span> <span class="o">+</span> <span class="s">&quot; to &quot;</span> <span class="o">+</span> <span class="n">hourLookup</span><span class="p">[</span><span class="n">time_hour</span><span class="o">+</span><span class="mi">1</span><span class="p">]</span></div></pre></div>
          </div>

          <div class="gist-meta">
            <a href="https://gist.github.com/raw/1362167/be00ecfca9bd328060783378382e405f73326025/fuzzyTime_word.py" style="float:right;">view raw</a>
            <a href="https://gist.github.com/1362167#file_fuzzy_time_word.py" style="float:right;margin-right:10px;color:#666">fuzzyTime_word.py</a>
            <a href="https://gist.github.com/1362167">This Gist</a> brought to you by <a href="http://github.com">GitHub</a>.
          </div>
        </div>
</div>
</noscript>
<h6>Output:</h6>
<blockquote><p>$ python fuzzytime.py<br />
It&#8217;s two o&#8217;clock
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/11/13/python-writing-a-fuzzy-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Install the &#8216;gnome-shell-extensions-mediaplayer&#8217; Extension</title>
		<link>http://alexsleat.co.uk/2011/10/19/how-to-install-gnome-shell-extensions/</link>
		<comments>http://alexsleat.co.uk/2011/10/19/how-to-install-gnome-shell-extensions/#comments</comments>
		<pubDate>Wed, 19 Oct 2011 19:38:58 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[blog1]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[arch]]></category>
		<category><![CDATA[extensions]]></category>
		<category><![CDATA[from source]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[github]]></category>
		<category><![CDATA[gnome-shell]]></category>
		<category><![CDATA[gnome-tweak-tool]]></category>
		<category><![CDATA[gnome3]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[install]]></category>
		<category><![CDATA[isadora]]></category>
		<category><![CDATA[julia]]></category>
		<category><![CDATA[katya]]></category>
		<category><![CDATA[linux mint]]></category>
		<category><![CDATA[lisa]]></category>
		<category><![CDATA[make]]></category>
		<category><![CDATA[make install]]></category>
		<category><![CDATA[media player]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://alexsleat.co.uk/?p=22391</guid>
		<description><![CDATA[<br/><p>The mediaplayer widget found on github, created by eonpatapon &#8211; (https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer).</p> <p>I&#8217;ve been searching for a while for a good, solid widget style thing that&#8217;ll sit in the top of the gnome-shell panel which can control the music that&#8217;s playing in banshee, rhythmbox or whatever else you want to use to play your tunes.</p> [...]]]></description>
			<content:encoded><![CDATA[<br/><p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/10/Screenshot-at-2011-10-19-202514.png"><img class="size-full wp-image-22404 alignright" title="Screenshot at 2011-10-19 20:25:14" src="http://alexsleat.co.uk/wp-content/uploads/2011/10/Screenshot-at-2011-10-19-202514.png" alt="" width="434" height="348" /></a>The mediaplayer widget found on github, created by eonpatapon &#8211; (<a href="https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer">https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer</a>).</p>
<p>I&#8217;ve been searching for a while for a good, solid widget style thing that&#8217;ll sit in the top of the gnome-shell panel which can control the music that&#8217;s playing in banshee, rhythmbox or whatever else you want to use to play your tunes.</p>
<p>&nbsp;</p>
<h4>Installation:</h4>
<h5>1. <span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">First you&#8217;ll need to grab some dependencies:</span></h5>
<div class="dean_ch" style="white-space: wrap;"><span class="kw2">sudo</span> apt-get <span class="kw2">install</span> git gnome-common gnome-tweak-tool</div>
<h5>2. <span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Next download the files from the git repository as below (this will download the folder to whatever directory you&#8217;re currently in, in terminal):</span></h5>
<div class="dean_ch" style="white-space: wrap;">git clone https://github.com/eonpatapon/gnome-shell-extensions-mediaplayer.git</div>
<h5>3. <span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">Once it&#8217;s finished download (it shouldn&#8217;t take too long it&#8217;s only about 2.30MB as of writing this guide), you&#8217;ll want to install using the following commands:</span></h5>
<div class="dean_ch" style="white-space: wrap;"><span class="kw3">cd</span> gnome-shell-extensions-mediaplayer<br />
./autogen.<span class="kw2">sh</span> &#8211;<span class="re2">prefix=</span>/usr<br />
<span class="kw2">make</span><br />
<span class="kw2">sudo</span> <span class="kw2">make</span> <span class="kw2">install</span></div>
<h5>4. <span class="Apple-style-span" style="font-size: 13px; font-weight: normal;">That&#8217;s it, it&#8217;s installed. Next you&#8217;re going to want to enable it, run gnome-tweak-tool and under extensions slide the newly installed extension to ON and it should appear next to the &#8220;Universal Access Settings&#8221; in the top right.</span></h5>
<p><a href="http://alexsleat.co.uk/wp-content/uploads/2011/10/Screenshot-at-2011-10-19-203544.png"><img class="aligncenter size-full wp-image-22410" title="Screenshot at 2011-10-19 20:35:44" src="http://alexsleat.co.uk/wp-content/uploads/2011/10/Screenshot-at-2011-10-19-203544.png" alt="" width="662" height="529" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://alexsleat.co.uk/2011/10/19/how-to-install-gnome-shell-extensions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

