<?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>Spice World!</title>
	<atom:link href="http://www.cyberspice.org.uk/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.cyberspice.org.uk/blog</link>
	<description>The life and times of a jet setting software engineer!</description>
	<lastBuildDate>Sat, 29 Dec 2012 18:17:53 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Apple bluetooth keyboard and iPad</title>
		<link>http://www.cyberspice.org.uk/blog/2012/12/29/apple-bluetooth-keyboard-and-ipad/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/12/29/apple-bluetooth-keyboard-and-ipad/#comments</comments>
		<pubDate>Sat, 29 Dec 2012 16:18:05 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=534</guid>
		<description><![CDATA[For Christmas my partner bought me an Apple bluetooth keyboard to go with my iPad Mini together with my other Apple devices (I am such a fan-girl). Since then I&#8217;ve been playing with it and finding out just how much I can control with it. The keyboard itself is basically the same as the keyboard [...]]]></description>
			<content:encoded><![CDATA[<p>For Christmas my partner bought me an Apple bluetooth keyboard to go with my iPad Mini together with my other Apple devices (I am such a fan-girl). Since then I&#8217;ve been playing with it and finding out just how much I can control with it.</p>
<div id="attachment_554" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image4.jpg"><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image4-300x210.jpg" alt="iPad Mini and Apple Bluetooth keyboard" title="iPad Mini and Apple Bluetooth keyboard" width="300" height="210" class="size-medium wp-image-554" /></a><p class="wp-caption-text">iPad Mini and Apple Bluetooth keyboard</p></div><br />
<span id="more-534"></span><br />
The keyboard itself is basically the same as the keyboard on my 13 inch Mac Book Pro except it has white keys and not black ones (and they&#8217;re not lit). The keyboard case machined aluminium and is at most 5mm thick  except for at the rear where the battery holder (which takes two AA batteries) acts as the rear &#8216;feet&#8217;. One end of this is a screw cover for the batteries, the other is the power button. There is a small green LED by the power button.</p>
<h2>Pairing</h2>
<p>Holding the power button puts it in to pairing mode.<br />
<div id="attachment_539" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image.jpg"><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image-300x131.jpg" alt="Before pairing keyboard" title="Before pairing keyboard" width="300" height="131" class="size-medium wp-image-539" /></a><p class="wp-caption-text">Before pairing keyboard</p></div><br />
To pair start &#8216;Settings&#8217; then select the &#8216;Bluetooth&#8217; option. The keyboard will be found and shown as un-paired. Tap on the description and you will be asked to enter a four digit code on the keyboard and then hit the return key. Once this is done, the keyboard will be paired, and takes over keyboard duties.</p>
<p><div id="attachment_541" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image1.jpg"><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image1-300x147.jpg" alt="Pairing keyboard" title="Pairing keyboard" width="300" height="147" class="size-medium wp-image-541" /></a><p class="wp-caption-text">Pairing keyboard</p></div>
<h2>How do I get the on-screen keyboard back?</h2>
<div id="attachment_544" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image2.jpg"><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image2-300x225.jpg" alt="Using bluetooth keyboard" title="Using bluetooth keyboard" width="300" height="225" class="size-medium wp-image-544" /></a><p class="wp-caption-text">Using bluetooth keyboard</p></div>
<p>The first question I think everyone will ask is &#8220;How do I get the on-screen keyboard back?&#8221;. This is simple. Just press the Eject button on the keyboard in the top right corner. Press it a second time to use the keyboard again. Of course this means you need access to your keyboard. It has a pretty good range so if its say, locked in a draw, you will have to &#8216;forget&#8217; the keyboard in settings and re-pair the next time you want to use it.</p>
<div id="attachment_546" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image3.jpg"><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/12/image3-300x225.jpg" alt="Using on-screen keyboard" title="Using on-screen keyboard" width="300" height="225" class="size-medium wp-image-546" /></a><p class="wp-caption-text">Using on-screen keyboard</p></div>
<h2>What else can it do?</h2>
<h3>Function keys</h3>
<p>The function keys on the keyboard also double as control/media keys. The iPad supports the following keys:</p>
<ul>
<li>The screen brightness keys (F1 and F2)
<li>The player (iTunes) control keys for rewind, play/pause and fast forward (F7 to F9)
<li>The volume control keys e.g. mute, volume down and volume up (F10 to F12)
</ul>
<h3>Text selection</h3>
<p>The arrow keys will move the caret around text input as you would expect. Holding down <i>shift</i> as you use them allows selection of text for cut, copy or delete as follows:</p>
<ul>
<li><i>shift</i> and left/right arrow selects previous/next character.
<li><i>shift</i> and <i>option/alt</i> and left/right arrow selects previous/next row.
<li><i>shift</i> and <i>control</i> and left/right arrow selects to start of line/end of line.<br />
</uL><br />
You can also use <i>command</i> and A to select all the text.</p>
<h3>Cut, copy, paste, undo, redo</h3>
<p>These are as you would expect if you&#8217;re a Mac user.</p>
<ul>
<li><i>command</i> and x &#8211; cut
<li><i>command</i> and c &#8211; copy
<li><i>command</i> and v &#8211; paste
<li><i>command</i> and z &#8211; undo
<li><i>command</i>, <i>shift</i> and z &#8211; redo
</ul>
<h3>Alternative characters and accents</h3>
<p>By now you&#8217;ll realise that this keyboard near enough supports all the functionality you would expect from a keyboard used with Apple&#8217;s desktop operating system (OSX). This isn&#8217;t a surprise since iOS and OSX are very closely related.</p>
<p>Holding <i>alt</i> down when typing a character will give you an alternative character. Usually this are related to the standard character for that key. For example on a UK keyboard <i>shift</i> and 3 gives you £ but <i>alt</i> and 3 gives you # (the reverse of the US case). Both # and £ are known as pound which is why Apple has mapped them that way. <i>alt</i> and ./&gt; gives you ≥. <i>alt</i> and s gives you ß (which is a double S symbol used in German words such as Schloß).</p>
<p>The exceptions to the above rule is where the key is used to create accented characters. In that case you use <i>alt</i> and a key to create an accent modifier the you type the character you want to apply the accent too.  Again the key used is related to the accent generated. For example back tick for a grave (accent that slopes down to the right), e.g. è. e for ecute (accent that slopes down to the left), such as é. u for umlaut (double dots) e.g. Mötorhead, and so on.</p>
<h3>Other keys</h3>
<p>When using Pages on the iPad I have found that the following are also supported:</p>
<ul>
<li><i>command</i> and B to toggle the bold on text.
<li><i>command</i> and I to toggle the italics on text.
</ul>
<p>When using Textastic the tab key can indent blocks of text (and <i>shift</i> tab to reverse indent).</p>
<p>Tab and <i>shift</i> tab will select the next/previous field in a form in Safari.</p>
<p>And that&#8217;s it. If I find any more I shall update this post. However I think that with the addition of a keyboard an iPad fulfils most of my day to day non-development requirements together with some minor development duties as well.</p>
<p>P.S. This post was written on my iPad.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/12/29/apple-bluetooth-keyboard-and-ipad/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Changing the IP address for OS X&#8217;s shared network</title>
		<link>http://www.cyberspice.org.uk/blog/2012/09/26/changing-the-ip-address-for-os-xs-shared-network/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/09/26/changing-the-ip-address-for-os-xs-shared-network/#comments</comments>
		<pubDate>Wed, 26 Sep 2012 15:08:37 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[Internet sharing]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=532</guid>
		<description><![CDATA[When I&#8217;m developing software on small and embedded devices I tend to network them by using a CAT-6 cable between a network port on my Mac and the device and enable Internet Sharing via System Preferences. Unfortunately OS X always selects 192.168.2.0 as the network address and this may class with other networks on your [...]]]></description>
			<content:encoded><![CDATA[<p>When I&#8217;m developing software on small and embedded devices I tend to network them by using a CAT-6 cable between a network port on my Mac and the device and enable Internet Sharing via System Preferences. Unfortunately OS X always selects 192.168.2.0 as the network address and this may class with other networks on your network. Recently I found out how to change this.<span id="more-532"></span><center><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/09/619311024525.jpg"></center></p>
<p>I have an Apple USB Network Adapter that I use to provide a second network port. I connect this, using a CAT-6 cable, directly to my target device when developing. Enabling Internet Sharing will forward network traffic from either my primary ethernet port or wi-fi adapter. The only problem with this is the network IP address as I said above. This seems to be a hardcoded default.</p>
<p>However behind all the UI utilities Apple has command line ones that do the grunt work. Internet Sharing is no different. Checking out the man page for <strong>InternetSharing</strong> provides all sorts of gems.</p>
<pre>
$ man InternetSharing
</pre>
<p>Specifically these two snippets of information. This:</p>
<pre>
     InternetSharing reads the property list com.apple.nat.plist stored in the
     /Library/Preferences/SystemConfiguration.
</pre>
<p>And this:</p>
<pre>
     One property worth mentioning is SharingNetworkNumberStart.  This prop-
     erty controls the behavior of InternetSharing when it configures IP
     addresses for the local interfaces.  The property is encoded as a string
     containing the dotted decimal network IP address, assumed to be a class C
     network.
</pre>
<p>You can change the network IP address for the private network by defining a new value for the <em>SharingNetworkNumberStart</em> property.</p>
<p>Open a terminal and edit the file <strong>/Library/Preferences/SystemConfiguration/com.apple.nat.plist</strong> in <strong>vim</strong>. (You will need to us <strong>sudo</strong> to give you administrator/super-user privileges.)</p>
<pre>
$ sudo vim /Library/Preferences/SystemConfiguration/com.apple.nat.plist
</pre>
<p>At the bottom of the file, just above the second from bottom &lt;/dict&gt; add a key value pair for <em>SharingNetworkNumberStart</em> as follows:</p>
<pre>
                &lt;key&gt;SharingNetworkNumberStart&lt;/key&gt;
                &lt;string>192.168.111.0&lt;/string&gt;
        &lt;/dict&gt;
&lt;/dict&gt;
&lt;/plist&gt;
</pre>
<p>Where the <em>192.168.111.0</em> can be any network IP address you choose.</p>
<p>Once edited if you restart Internet Sharing you will see the new IP address is used for the network.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/09/26/changing-the-ip-address-for-os-xs-shared-network/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OSH Camp 2012 &#8211; Flickr Group</title>
		<link>http://www.cyberspice.org.uk/blog/2012/09/20/osh-camp-2012-flickr-group/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/09/20/osh-camp-2012-flickr-group/#comments</comments>
		<pubDate>Thu, 20 Sep 2012 10:04:00 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Crafty]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[BeagleBone]]></category>
		<category><![CDATA[RaspberryPi]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=520</guid>
		<description><![CDATA[There is a Flickr group for the Open Source Hardware User Group (OSHUG) and photos from this years camp have been uploaded to it. The photos below are courtesy of Carrier Detect. The group can be found at http://www.flickr.com/groups/oshug/pool/. Me speaking Hippiegunnut interfacing to her Pi]]></description>
			<content:encoded><![CDATA[<p>
There is a Flickr group for the Open Source Hardware User Group (OSHUG) and photos from this years camp have been uploaded to it. The photos below are courtesy of <a href="http://www.flickr.com/photos/carrierdetect/">Carrier Detect</a>.  The group can be found at <a href="http://www.flickr.com/groups/oshug/pool/">http://www.flickr.com/groups/oshug/pool/</a>.
</p>
<p><center><a href="http://www.flickr.com/photos/carrierdetect/7997545982/in/pool-oshug"><img src="http://farm9.staticflickr.com/8298/7997545982_549a65e390.jpg" /></a><br />
<h2>Me speaking</h2>
<p></center></p>
<p><center><a href="http://www.flickr.com/photos/carrierdetect/7998966998/in/pool-oshug"><img src="http://farm9.staticflickr.com/8032/7998966998_b29ab1cfaf.jpg" /></a><br />
<h2>Hippiegunnut interfacing to her Pi</h2>
<p></center></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/09/20/osh-camp-2012-flickr-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSHCamp 2012 Talk &#8211; Developing Linux on Embedded Devices Slides</title>
		<link>http://www.cyberspice.org.uk/blog/2012/09/15/oshcamp-2012-talk-developing-linux-on-embedded-devices-slides/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/09/15/oshcamp-2012-talk-developing-linux-on-embedded-devices-slides/#comments</comments>
		<pubDate>Sat, 15 Sep 2012 11:20:03 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[BeagleBoard]]></category>
		<category><![CDATA[BeagleBone]]></category>
		<category><![CDATA[Embedded Linux]]></category>
		<category><![CDATA[RaspberryPi]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=518</guid>
		<description><![CDATA[Here are the slides to the talk I gave at Open Source Hardware Camp 2012 here in the UK. http://www.cyberspice.org.uk/downloads/EmbeddedLinux.pdf]]></description>
			<content:encoded><![CDATA[<p><center><img src="http://www.cyberspice.org.uk/blog/wp-content/uploads/2012/09/EmbeddedLinux-e1348667579909.png" /></center></p>
<p>Here are the slides to the talk I gave at Open Source Hardware Camp 2012 here in the UK.</p>
<p><a href="http://www.cyberspice.org.uk/downloads/EmbeddedLinux.pdf">http://www.cyberspice.org.uk/downloads/EmbeddedLinux.pdf</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/09/15/oshcamp-2012-talk-developing-linux-on-embedded-devices-slides/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Setting up a GIT server on OSX using the Command Line</title>
		<link>http://www.cyberspice.org.uk/blog/2012/08/27/setting-up-a-git-server-on-osx-using-the-command-line/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/08/27/setting-up-a-git-server-on-osx-using-the-command-line/#comments</comments>
		<pubDate>Mon, 27 Aug 2012 20:15:42 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[GIT]]></category>
		<category><![CDATA[GIT server]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=516</guid>
		<description><![CDATA[I do a lot of my development these days in VMs (various OSes), one for each project. I have two different physical machines I work on, my iMac and my MacBook. Today I finally got around to setting up a git server on the iMac (its backed up with Timemachine) to make code sharing across [...]]]></description>
			<content:encoded><![CDATA[<p>I do a lot of my development these days in VMs (various OSes), one for each project. I have two different physical machines I work on, my iMac and my MacBook. Today I finally got around to setting up a git server on the iMac (its backed up with Timemachine) to make code sharing across machines, virtual and real, easier.  Since I&#8217;m in the office at work I did it all remotely on the command line over ssh.<span id="more-516"></span>Generally the process I am going to describe is little different to the one described in the GIT documentation except OSX isn&#8217;t Linux. Being BSD based there are differences.</p>
<h1>On the server</h1>
<h2>Creating a &#8220;git&#8221; user</h2>
<p>Firstly we need to create a &#8220;git&#8221; user. On Linux you would use <em>useradd</em> on OSX the tool <em>dscl</em> (See <em>man dscl</em>) is used to create new users as one of a many number of things it can do. Below are the steps to create a new user.</p>
<pre>
$ sudo dscl . -create /Users/git
$ sudo dscl . -create /Users/git UserShell /bin/bash
$ sudo dscl . -create /Users/git RealName "Git server"
$ sudo dscl . -create /Users/git UniqueID 504
$ sudo dscl . -create /Users/git PrimaryGroupID 20
$ sudo dscl . -create /Users/git NFSHomeDirectory /Users/git
$ sudo dscl . -passwd /Users/git ******
$ sudo mkdir -p /Users/git
$ sudo chown -R git:staff /Users/git
</pre>
<p>The ****** represents what ever password you want to set.  The UniqueID is the user ID and must be unique. I picked the next free ID in the same range as the other users on my system. You can list all the user information as follows:</p>
<pre>
dscacheutil -q user
</pre>
<p>I got a list of sorted UIDs with a bit of shell magic.</p>
<pre>
dscacheutil -q user | grep ^uid: | cut -d\  -f2 | sort -n
</pre>
<p>The PrimaryGroupID must be a suitable existing group. I picked 20 as that&#8217;s &#8220;staff&#8221; on my system. On an Ubuntu Linux system it would be &#8220;users&#8221;. Again you can get a list of group information using dscacheutil like so:</p>
<pre>
dscacheutil -q group
</pre>
<p>You could create a new group with the <em>dscl</em> command. I leave that as an exercise for the reader.</p>
<h2>Creating a git repo</h2>
<p>Now we have the git user we can set up the server. A git server isn&#8217;t really a server in so much as it doesn&#8217;t have a daemon process. Its just another SSH user.  Setting it up is no different on OSX to any other *NIX system so I just followed the instructions from the GIT site. But I&#8217;ve put them below for completeness.</p>
<pre>
$ su - git
$ mkdir -p repo/project
$ cd repo/project
$ git --bare init
</pre>
<p>Basically login as the git user. Create a &#8220;repo&#8221; directory to contain all your git projects and a project directory called what ever your project is called. Then initialise it.</p>
<h1>On the client</h1>
<p>Now switch the client.</p>
<h2>Generating SSH keys</h2>
<p>As I said above a git server is just another SSH user. The recommended way of using git is via secure keys. The commands to create keys are as show below:</p>
<pre>
$ mkdir .ssh
$ chmod 700 .ssh
$ cd .ssh
$ ssh-keygen -f my_key_name -t rsa -q
$ ssh-add my_key_name
$ cp my_key_name.pub ~/Desktop
</pre>
<p>Firstly create a &#8220;.ssh&#8221; directory if you don&#8217;t already have one. It must have only user read, write and execute privileges. In that directory create the keys. The &#8220;my_key_name&#8221; can be substituted for any name you wish to use. Finally copy out the public key to somewhere easily accessible.  Finally you can copy the key to the git server using the command:</p>
<pre>
$ scp ~/Desktop/my_key_name.pub git@git.some.domain:/Users/git
</pre>
<p>Repeat this step for all clients which wish to use the server.</p>
<h1>On the server</h2>
<p>Back on the server.</p>
<h2>Adding a client&#8217;s SSH key</h2>
<p>Now we need to add the client public keys to the server. As the git user create an &#8220;.ssh&#8221; directory, if one does not exist, and then just append the client public key(s) to the &#8220;authorized_keys&#8221; file.</p>
<pre>
$ mkdir .ssh
$ chmod 700 .ssh
$ cat my_key_name.pub >> .ssh/authorized_keys
</pre>
<h1>On the client</h1>
<p>Back to the client again.</p>
<h2>Setting the git server SSH port (optional)</h2>
<p>SSH on my server is accessed via a non standard port because there&#8217;s another machine behind the firewall on port 22. So I have to tell git which port to use. To do this I have created a &#8220;config&#8221; file within the &#8220;.ssh&#8221; the follow contents:</p>
<pre>
Host git@git.some.domain
	Port 1234
</pre>
<h2>Creating the local repository</h2>
<p>Finally we need to create the local git repo. </p>
<pre>
$ mkdir project
$ cd project
$ git init
$ git add .
$ git commit -m "Initial commit"
$ git remote add origin git@git.some.domain:/Users/git/repo/project
$ git push origin master
</pre>
<p>Create the local project repo directory. Add any contents and commit them. Finally we set the remote git server to be the &#8216;master&#8217; and push up all the content. Note that on Linux the remote path would be &#8220;git@git.some.domain:/home/git/repo/project&#8221;.</p>
<h2>Cloning a repository</h2>
<p>Now the repo is on the server further clients can clone and update it like so.</p>
<pre>
$ git clone git@git.some.domain:/Users/git/repo/project
$ # Modify, add and remove files.
$ git commit -m "Commit comment"
$ git push origin master
</pre>
<h1>On the server</h1>
<h2>Disable shell access to git (optional)</h2>
<p>Finally you can replace bash as the git shell with git-shell. On OSX use the command below. On Linux it is simplest just to edit the git line &#8220;/etc/passwd&#8221; file.</p>
<pre>
$ sudo dscl . -create /Users/git UserShell /usr/bin/git-shell
</pre>
<p>This will disable shell access. If you try and use it you&#8217;ll get the following message:</p>
<pre>
$ ssh git@git.some.domain
fatal: What do you think I am? A shell?
Connection to gitserver closed.
</pre>
<p>And that&#8217;s it!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/08/27/setting-up-a-git-server-on-osx-using-the-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Release script for SVN</title>
		<link>http://www.cyberspice.org.uk/blog/2012/06/08/release-script-for-svn/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/06/08/release-script-for-svn/#comments</comments>
		<pubDate>Fri, 08 Jun 2012 21:12:14 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[SVN]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=510</guid>
		<description><![CDATA[I am currently working on a project that comprises several components individually managed in SVN. These components are built and then linked in to the final binary. To makes things easier I wrote a release script that creates an editable commit message with the SVN revisions of the components and commits the final binary. I [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently working on a project that comprises several components individually managed in SVN. These components are built and then linked in to the final binary. To makes things easier I wrote a release script that creates an editable commit message with the SVN revisions of the components and commits the final binary. I thought it might be useful to others so generalised it.<br />
<span id="more-510"></span><br />
The script is available <a href="/downloads/release.sh">here</a> and is shown below.</p>

<div class="wp_syntax"><table><tr><td class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">#!/bin/bash</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Returns the SVN revision of a directory and whether it is modified.</span>
getsvnrev<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;$1&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #007800;">dir</span>=<span style="color: #007800;">$1</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #007800;">dir</span>=.
	<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-d</span> <span style="color: #007800;">$dir</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #666666; font-style: italic;"># Get the last changed revision</span>
		<span style="color: #007800;">ver</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">svn info</span> <span style="color: #007800;">$dir</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;/^Last Changed Rev/p&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ver</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #007800;">ver</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #007800;">$ver</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">awk</span> <span style="color: #ff0000;">'{ print $NF; }'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
		<span style="color: #666666; font-style: italic;"># Test to see if there are modified files in the sandbox</span>
		<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$ver</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
			<span style="color: #007800;">mod</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">svn status</span> <span style="color: #007800;">$dir</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;/^[AMD]/p&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$mod</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
				<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;R<span style="color: #007800;">$ver</span>(modified)&quot;</span>
			<span style="color: #000000; font-weight: bold;">else</span>
				<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;R<span style="color: #007800;">$ver</span>&quot;</span>
			<span style="color: #000000; font-weight: bold;">fi</span>
		<span style="color: #000000; font-weight: bold;">fi</span>
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># tempfile is nicer but not always supported</span>
mktempfile<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$(which tempfile)</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span>; <span style="color: #000000; font-weight: bold;">then</span>
		<span style="color: #c20cb9; font-weight: bold;">tempfile</span>
	<span style="color: #000000; font-weight: bold;">else</span>
		<span style="color: #c20cb9; font-weight: bold;">mktemp</span> <span style="color: #000000; font-weight: bold;">/</span>tmp<span style="color: #000000; font-weight: bold;">/</span>makerelease.XXXXX
	<span style="color: #000000; font-weight: bold;">fi</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Output usage to stderr</span>
usage<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;usage: makerelease [option] dir [dir]&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Output help to stdout</span>
fullhelp<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Usage: makerelease [option] dir [dir]&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -r directory    commit specified release directory&quot;</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;  -h              display this help&quot;</span>
<span style="color: #7a0874; font-weight: bold;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># If no release directory supplied commits pwd</span>
<span style="color: #007800;">reldir</span>=.
&nbsp;
<span style="color: #666666; font-style: italic;"># Process command line options</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">getopts</span> :r:h opt
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #000000; font-weight: bold;">case</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$opt</span>&quot;</span> <span style="color: #000000; font-weight: bold;">in</span>
		r<span style="color: #7a0874; font-weight: bold;">&#41;</span>
			<span style="color: #007800;">reldir</span>=<span style="color: #ff0000;">&quot;<span style="color: #007800;">$OPTARG</span>&quot;</span>
			<span style="color: #000000; font-weight: bold;">;;</span>
		h<span style="color: #7a0874; font-weight: bold;">&#41;</span>
			fullhelp
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span>
			<span style="color: #000000; font-weight: bold;">;;</span>
		:<span style="color: #7a0874; font-weight: bold;">&#41;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Missing argument for <span style="color: #007800;">$OPTARG</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			usage
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
			<span style="color: #000000; font-weight: bold;">;;</span>
		<span style="color: #000000; font-weight: bold;">*</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
			<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Invalid option: <span style="color: #007800;">$OPTARG</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
			usage 
			<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
			<span style="color: #000000; font-weight: bold;">;;</span>
	<span style="color: #000000; font-weight: bold;">esac</span>
<span style="color: #000000; font-weight: bold;">done</span>   
&nbsp;
<span style="color: #666666; font-style: italic;"># Skip all the options processed above</span>
<span style="color: #7a0874; font-weight: bold;">shift</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">expr</span> <span style="color: #007800;">$OPTIND</span> - <span style="color: #000000;">1</span><span style="color: #000000; font-weight: bold;">`</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Check we have at least one argument</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$#</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">1</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;You need to supply at least one component directory.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
	usage
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Check to see if release directory is modified</span>
<span style="color: #007800;">reldirmod</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #c20cb9; font-weight: bold;">svn status</span> <span style="color: #007800;">$reldir</span> <span style="color: #000000; font-weight: bold;">|</span> <span style="color: #c20cb9; font-weight: bold;">sed</span> <span style="color: #660033;">-n</span> <span style="color: #ff0000;">&quot;/^[AMD]/p&quot;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #660033;">-z</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$reldirmod</span>&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;No changes to commit.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Create a log file and allow user to edit it</span>
<span style="color: #007800;">msgfile</span>=$<span style="color: #7a0874; font-weight: bold;">&#40;</span>mktempfile<span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Could not create temp file.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Components...&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #007800;">$msgfile</span>
<span style="color: #000000; font-weight: bold;">while</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #7a0874; font-weight: bold;">&#40;</span> <span style="color: #ff0000;">&quot;$#&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#41;</span><span style="color: #7a0874; font-weight: bold;">&#41;</span>
<span style="color: #000000; font-weight: bold;">do</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;   $1: <span style="color: #007800;">$(getsvnrev $1)</span>&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> <span style="color: #007800;">$msgfile</span>
	<span style="color: #7a0874; font-weight: bold;">shift</span>
<span style="color: #000000; font-weight: bold;">done</span>
&nbsp;
<span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #007800;">$msgfile</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Editor returned an error.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$msgfile</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Commit changes</span>
<span style="color: #c20cb9; font-weight: bold;">svn commit</span> <span style="color: #660033;">-F</span> <span style="color: #007800;">$msgfile</span> <span style="color: #007800;">$reldir</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #7a0874; font-weight: bold;">&#91;</span> <span style="color: #007800;">$?</span> <span style="color: #660033;">-ne</span> <span style="color: #000000;">0</span> <span style="color: #7a0874; font-weight: bold;">&#93;</span> ; <span style="color: #000000; font-weight: bold;">then</span>
	<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Commit failed.&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&amp;</span><span style="color: #000000;">2</span>
	<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #660033;">-f</span> <span style="color: #007800;">$msgfile</span>
	<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">1</span>
<span style="color: #000000; font-weight: bold;">fi</span>
&nbsp;
<span style="color: #666666; font-style: italic;"># Clean up</span>
<span style="color: #c20cb9; font-weight: bold;">rm</span> <span style="color: #007800;">$msgfile</span>
<span style="color: #7a0874; font-weight: bold;">exit</span> <span style="color: #000000;">0</span></pre></td></tr></table></div>

<p>It is commented so I will not explain it further. To use it either run it in the directory you wish to commit, or use the -r option (followed by the path to the directory to commit), together with a list of directories comprising the SVN components.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/06/08/release-script-for-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Sleeper Awakens</title>
		<link>http://www.cyberspice.org.uk/blog/2012/05/01/the-sleeper-awakens/</link>
		<comments>http://www.cyberspice.org.uk/blog/2012/05/01/the-sleeper-awakens/#comments</comments>
		<pubDate>Tue, 01 May 2012 17:27:27 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Sundry]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=508</guid>
		<description><![CDATA[This will be my first blog post in a very long time. Life has been busy and, in my day job, productive. Unfortunately this has meant that activities outside of work have been somewhat curtailed. But today I am &#8216;bunking off&#8217; early as it is the monthly PHP NW meeting in Manchester so I am [...]]]></description>
			<content:encoded><![CDATA[<p>This will be my first blog post in a very long time. Life has been busy and, in my day job, productive. Unfortunately this has meant that activities outside of work have been somewhat curtailed. But today I am &#8216;bunking off&#8217; early as it is the monthly PHP NW meeting in Manchester so I am on a train heading across the country to it. This is giving me a chance to write this!<span id="more-508"></span>The end of 2010 and the first half of 2011 saw me debugging and optimising low level Linux driver and kernel code for a client&#8217;s consumer product. There was little new code written as it was mostly bug fixing and refactoring. Once I decided the driver was bad enough to throw it away and re-write it. I was regularly at the client&#8217;s premises which involved travelling early Monday and late Friday. Sometimes I stayed over for weekends. This time away from home did not help my personal projects.</p>
<p>I finally finished on this project mid 2011 and was given the chance to work on an in-house project that I have been proposing for some time. The in-house project was interesting in that it was related to the core areas of the expertise for employer but it was a completely different type of development. The project has given me a chance to use technologies that interest me outside of work but typically aren&#8217;t used in work. As I result I have found myself developing client server software running on a LAMP server, developing a PHP application, writing UIs in HTML, CSS, jQuery and JavaScript, using JSON-RPC and other web technologies. All good fun.</p>
<p>The in-house project is still on-going but I have fee paying work again. This latest project is pseudo-embedded but with a web UI again. This time the back-end is written in C but the front end is again HTML, CSS, jQuery, JavaScript and JSON-RPC. I even found myself testing on an iPad the other day.</p>
<p>There has been a bit of a learning curve and as I&#8217;m admittedly less experienced at commercial development in some areas there are elements I would do differently. But the products have had a good reception and I have a lot of ideas for new blog posts based on things I have learnt and issues I have had.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2012/05/01/the-sleeper-awakens/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My BBC Micro and Me</title>
		<link>http://www.cyberspice.org.uk/blog/2011/12/02/my-bbc-micro-and-me/</link>
		<comments>http://www.cyberspice.org.uk/blog/2011/12/02/my-bbc-micro-and-me/#comments</comments>
		<pubDate>Fri, 02 Dec 2011 14:39:42 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Geek]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Women In Technology]]></category>
		<category><![CDATA[BBC Micro]]></category>
		<category><![CDATA[BBC Microcomputer]]></category>
		<category><![CDATA[Beeb]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=492</guid>
		<description><![CDATA[The BBC Microcomputer is 30 years old. The BBC News web site had an article about it but from the article you would think that only males benefited from it. Well it wasn&#8217;t just the boys who had fun with them! (Photo &#169; Anachrocomputer) The first computer in the house was my father&#8217;s. It was [...]]]></description>
			<content:encoded><![CDATA[<p>The BBC Microcomputer is 30 years old. The BBC News web site had an article about it but from the article you would think that only males benefited from it. Well it wasn&#8217;t just the boys who had fun with them!  (Photo &copy; <a href="http://www.flickr.com/photos/anachrocomputer/">Anachrocomputer</a>)<span id="more-492"></span><a href="http://www.flickr.com/photos/anachrocomputer/4440207275/" title="View 'Maker Faire 2010: BBC Micro with Ethernet' on Flickr.com"><img border="0" style="float:right; margin:10px;" height="160" src="http://farm5.staticflickr.com/4024/4440207275_1b732860b6_m.jpg" alt="Maker Faire 2010: BBC Micro with Ethernet &copy;Anachrocomputer" width="240" title="Maker Faire 2010: BBC Micro with Ethernet &copy;Anachrocomputer"/></a></p>
<p>The first computer in the house was my father&#8217;s. It was a TRS-80 Model 1. He had bought it to learn computing and because he realised computers were the future. I used it a lot learning to program in the BASIC language and then in Z80 assembly language (the language of the<br />
microprocessor that ran the computer).</p>
<p>I was also interested in electronics (thanks to my Uncle who taught it in schools) and around the same time I saw an advertisement for the<br />
Acorn Atom in an electronics magazine and I wanted one. I started saving but the BBC Microcomputer (&#8220;The Beeb&#8221;) came out before I could afford one. My Parents offered to help buy a Beeb by way of multiple combined Birthday and Christmas presents and the deal I would not use it until after my &#8216;O&#8217; levels which I mainly complied with. I remember the excitement of going in to the store to purchase my Beeb.</p>
<p>I learnt to program that machine from top to bottom. I had the reference manuals and the data sheets for all the chips. I loved how you got the full circuit diagram with the Advanced User Guide (it was a print of the one hand drawn by Acorn). I learnt BBC BASIC and 6502 assembly language. I learnt how to add to the operating system and how to do clever things by directly programming the chips in the machine. It taught me a lot about programming, such as interrupts, concurrency, race conditions, dead and live locks, and so on. Programming did become my first love and superseded electronics but I wouldn&#8217;t be the programmer I am today with out it!</p>
<p>I didn&#8217;t just program. I did play games with my favourites being Chuckie Egg and Elite! Elite was a complete time sink. No game following sucked me in as much as Elite did until World of Warcraft!</p>
<p>I didn&#8217;t completely give up on electronics and would develope small projects to connect to my Beeb. In the mid 80s I was studying for a Physics degree and naturally I used my Beeb. My final year project was based around the automation of an experiment. I designed hardware to drive the equipment, sensors and hardware to read data, and wrote software to drive it all from a Beeb.</p>
<p>In 1989 I got an Acorn A3000. It was the successor to the Beeb and also used in schools. It had the Acorn designed ARM processor (now used in nearly everything from a mobile phone to the iPad, set top boxes and televisions), what seemed like copious amounts of memory, loads of colours and a built in disk drive. It had BBC BASIC so I was at home and also taught me to program ARM assembly language (which I still use today). So the Beeb was basically retired.</p>
<p>I moved on to other machines, developing for Linux, higher degrees and becoming a research assistant but I never lost my love of my Beeb though and I still own mine almost 30 years after I bought it. I also still make projects for it. The most recent being an ethernet interface so that I can connect it to the internet.</p>
<p>I am now an embedded software consultant and I work for a company that was formed by employees of the company that bought Acorn Computers when it finally ended in 1999. My most recent project was optimising Linux on a device with an ARM processor. And my entire career is down to me and my Parents buying that Beeb 30 years ago!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2011/12/02/my-bbc-micro-and-me/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>The BBC Model B Microcomputer keyboard &#8211; How it works</title>
		<link>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/</link>
		<comments>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 19:06:14 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[BBC Micro PC]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=485</guid>
		<description><![CDATA[As part of my BBC Micro PC project (more about this later) I need to turn the keyboard in a BBC Micro in to a USB hid device. I could just rip the insides out of a PC USB keyboard and solder wires on to the back off all the key switches but that seems [...]]]></description>
			<content:encoded><![CDATA[<p>As part of my BBC Micro PC project (more about this later) I need to turn the keyboard in a BBC Micro in to a USB hid device. I could just rip the insides out of a PC USB keyboard and solder wires on to the back off all the key switches but that seems somewhat messy. So I decided to design a micro-controller circuit to read the keyboard and to appear as a standard USB HID device. The neatest solution is to have the micro-controller drivng the keyboard circuitry the same was as the BBC Micro main board does. This post explains how the keyboard circuit works.<span id="more-485"></span>The BBC Model B keyboard circuit board is more than just a grid of key-switches. It comprises some circuitry to reduce the number of connections between it and the main circuit board to 8 lines and to generate interrupts on key presses. Its a very neat design. Below is the keyboard circuit diagram taken from the BBC Model B service manual. The diagram also includes a bit of circuitry for the speech ROM expansion which I will ignore.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5660684665" title="View 'BBC Model B Keyboard Circuit' on Flickr.com"><img border="0" style="display:block; margin-left:auto; margin-right:auto;" height="337" src="http://farm6.static.flickr.com/5188/5660684665_b5af5c664b.jpg" alt="BBC Model B Keyboard Circuit" width="500" title="BBC Model B Keyboard Circuit"/></a><br />
<center><br />
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<th>IC1</th>
<td>74xx161/163</td>
<td>Synchronous 4 bit binary counter</td>
</tr>
<tr>
<th>IC2</th>
<td>74xx45</td>
<td>BCD to decimal decoder</td>
</tr>
<tr>
<th>IC3</th>
<td>74xx251</td>
<td>3 state 1 of 8 line data selector</td>
</tr>
<tr>
<th>IC4</th>
<td>74xx30</td>
<td>Octal NAND gate</td>
</tr>
</table>
<p></center></p>
<p>At the core is the traditional key matrix. It is a grid of rows and columns with momentary push switches that connect a row to a column when pressed. All of the rows are tied high by resistors to the 5v supply rail. The rows are inputs to an octal NAND gate (IC4), which, in this case is better thought of as an OR gate with inverting inputs. I.e. but default the output of the NAND gate is low but if one of the rows is pulled low the NAND output goes high. The rows are also inputs in to the line data selector (IC2).</p>
<p>The synchronous 4 bit binary counter (IC1) is driven by the BBC Micro&#8217;s 1MHz clock and when the KB EN is high is in free running mode. The 4 bit outputs (outputs QA-QD) are decoded by the BCD to decimal decoder (IC3) such that the decoder&#8217;s outputs go low in turn. The outputs of the decoder form the columns of the grid. I.e. column 0 is low on the first clock pulse, column 1 on the second and so on. If a key is pressed the row the key is on will go low when the column goes low.  This in turn makes the output of the NAND gate go high indicating a key is pressed. The output of the NAND gate is used to generate an interrupt in the BBC Micro&#8217;s CPU.</p>
<p>So normally the keyboard is being scanned by the hardware without any software influence.  This is a good thing as it takes a lot of loading off of the BBC Micro&#8217;s CPU.  When the key press interrupt is triggered the key scanning software takes over. As I said normally the 4 bit binary counter (IC1) is free running however if the LOAD pin (pin 9) is taken low the 4 bit input value (inputs A-D) are latched through to the outputs (QA-QD) and hence control the columns provided by the decoder (IC3). IC1&#8242;s load pin is connected to KB EN.</p>
<p>The S line of the data line selector (IC2) is the select line and is also connected to KB EN. The output of IC2 is 3 state meaning it either reflects the appropriate data input line when select is low or is high impedance. The data input lines are the row lines of the keyboard matrix. The input line is chosen using the three bit &#8216;address&#8217; value on A-C. The row state is output via pin W. </p>
<p>So the keyboard is normally hardware scanning. If the user presses a key, the interrupt is triggered. The CPU enables the keyboard by setting KB EN low and then manually scans the key board by setting the columns in turn via IC1 and checking the state of the rows in turn via IC2.  Once the scan is complete KB EN is set high and the hardware scanning continues.</p>
<p>There are three keys on the keyboard which are exceptions. The two SHIFT and CTRL keys are on a row that does not trigger an interrupt. This means that shift is only scanned manually or when another key is pressed.  The BREAK key (labled RST) is completely separate from the matrix and triggers the CPU&#8217;s reset line. On boot the CPU scans the keyboard manually to see if any of the modifiers are held down to do a cold reset or mount the disk for example.</p>
<p>The BBC Micro keyboard can be easily interfaced with say an ATMEL ATMega328 (like in an Arduino).  The micro-controller can drive a pin directly from one of the timers generating a square wave output to scan the keyboard. The interrupt can be connected to one of interrupt inputs and the rest connected to general purpose IO pins set as outputs or inputs as appropriate.  Dick Streefland&#8217;s <a href="http://www.xs4all.nl/%7Edicks/avr/usbtiny/">USBtiny</a> code provides the functionality to support the USB protocol in software utilising three IO pins on the micro-controller and a few discrete components. All that is required by me is to write the keyboard scanning code and provide the missing bits of the HID device profile.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2011/04/27/the-bbc-model-b-microcomputer-keyboard-how-it-works/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Upgrading your UK T-Mobile Google G1 (HTC Dream) to Android 2.x</title>
		<link>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/</link>
		<comments>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/#comments</comments>
		<pubDate>Fri, 22 Oct 2010 15:33:22 +0000</pubDate>
		<dc:creator>cyberspice</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Geek]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Google G1]]></category>
		<category><![CDATA[HTC Dream]]></category>
		<category><![CDATA[T-Mobile]]></category>

		<guid isPermaLink="false">http://www.cyberspice.org.uk/blog/?p=480</guid>
		<description><![CDATA[I&#8217;m currently developing a new project. Its a bluetooth enabled bracelet. I wanted to write an iPhone app to control it. However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks. So I then looked at writing an Android application for my G1. The problem with that is that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently developing a new project.  Its a bluetooth enabled bracelet.  I wanted to write an iPhone app to control it.  However, much as I like my iPhone 4, Apple&#8217;s policy about locking the thing down sucks.  So I then looked at writing an Android application for my G1.  The problem with that is that bluetooth support only arrived in Android 2.0 and T-Mobile/HTC ceased upgrades at 1.6 on the G1.  Since my G1 is two years old and out of contract I decided to be brave and upgrade it to Android 2.2.  Note the G1 is called the HTC Dream in many markets.</p>
<p><span id="more-480"></span><br />
<h2>Overview</h2>
<p>In order to install kind of new operating system I needed to have root access on the device.  This meant I had to <em>root</em> it.  Since Android 1.6 (Release R10) on the G1 doesn&#8217;t have any useful exploits I had to downgrade the OS to Release R7 first.  Once it is downgraded it you can use the rooting exploit in R7 to get root access and install a recovery image that will allow the installation of an updated radio software and the new operating system.</p>
<h2>Preliminaries</h2>
<p>Firstly read all of this blog post and all of the pages linked to from this blog post.  There is at least one point in this process where you can &#8220;brick your phone&#8221;.  I.e. you can put it in a state where by a regular user cannot make it usable.</p>
<p>Secondly you will be wiping your phone and replacing the software on it.  Back anything up you want to keep.  This includes purchased applications, data, contacts, whatever.</p>
<p>Make sure the phone is fully charged.  You don&#8217;t want it running out of power mid-flash!</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<h2>Downgrading and rooting</h2>
<p>Downgrading, rooting the phone, and installing a recovery image is described in the link below.  However since there are specific requirements for upgrading to Android 2.X I&#8217;ll explain each stage here.</p>
<p><a href="http://forum.xda-developers.com/showthread.php?t=442480">http://forum.xda-developers.com/showthread.php?t=442480</a></p>
<h3>Downgrading</h3>
<p>Before you do anything take note of the radio version string in the boot-loader.  Its the fourth line down.  You get the boot-loader screen up by holding down the camera button when powering on the phone.  With the original loader you should have multi-coloured bars with yellow text in the top left hand corner.  On my phone the radio version string read <em>&#8220;RADIO-2.22.19.26I&#8221;</em>.  Write down the string and store it somewhere safe.  You&#8217;ll need it later.</p>
<p>Now download the appropriate older image for your phone.  The links to the image downloads are on the page above however here&#8217;s the link for <a href="http://koushikdutta.blurryfox.com/G1/DREAMIMG-RC7.zip">RC7</a> for those with UK phones.  Download the image, unzip it, and save the <em>DREAMIMG.nbh</em> file in the root of your SD card.  While you&#8217;re at it also download <a href="http://www.androidspin.com/downloads.php?dir=amon_ra/RECOVERY/&#038;file=recovery-RA-dream-v1.5.2.img">recovery-RA-dream-v1.5.2.img</a> which is a recovery image and will be used later.  Save this in the root of your SD card also.</p>
<p>Turn off your phone, insert the SD card, and turn it back on again holding down the camera key as before.  It should now re-flash your phone.  There should be a progress bar.  When its all complete you can restart your phone normally (without the camera key held down).  This will result in some old school Android graphics and you wondering how anyone ever coped with that software.  Once the phone has booted find the phone details in settings and check the software build version number.  It should appear as something like <em>TC5-RC7 112931</em>.</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135008" title="View 'Initial bootloader' on Flickr.com"><img height="240" alt="Initial bootloader" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4113/5075135008_1492d33db5_m.jpg" width="162"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074536617" title="View 'Installing an image from SD card' on Flickr.com"><img height="240" alt="Installing an image from SD card" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4012/5074536617_0f606f44e1_m.jpg" width="172"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075135512" title="View 'Software information screen' on Flickr.com"><img height="240" alt="Software information screen" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4111/5075135512_f439d0d7e8_m.jpg" width="168"/></a></td>
</tr>
</table>
<p></center></p>
<h3>Rooting the phone</h3>
<p>Now you have exploitable image installed it is time to root the phone.  This can be done using a back door.  Go to the home screen then type&#8230;</p>
<pre>
&lt;return&gt;
&lt;return&gt;
telnetd
&lt;return&gt;
</pre>
<p>&#8230;on the slide out keyboard.  This will look like a search in contacts for the name of <em>telnetd</em>.  In fact <em>telnetd</em> is the telnet daemon which allows you to connect to shell on the phone via telnet.  So now you need a telnet client.  Use the Android Market to download a telnet client.  Once installed you should be able to telnet to <em>localhost</em> and get a telnet prompt.</p>
<p>If all is well you have shell access as root (a &#8216;#&#8217; prompt).  Yay!</p>
<h3>Installing a recovery image</h3>
<p>Now we are going to install the recovery image we downloaded earlier. This will also give us permanent root access.  In the shell type&#8230;</p>
<pre>
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
cd sdcard
flash_image recovery recovery-RA-dream-v1.5.2.img
cat recovery-RA-dream-v1.5.2.img > /system/recovery.img
</pre>
<p>For those who are interested the lines do the following:</p>
<ol>
<li>Remounts the flash memory in read/write mode.  This allows you to save to the flash in the phone.</li>
<li>Navigate to the sdcard (which is mounted at /sdcard)</li>
<li>Flashes the recovery-RA-dream-v1.5.2.img image file in to the special recovery partition in the flash.</li>
<li>Copies the recovery-RA-dream-v1.5.2.img as /system/recovery.img (The Android busybox doesn&#8217;t have the copy command but cat with a pipe works just as well!).</li>
</ol>
<p>Once you&#8217;ve done this and have a prompt again you can reboot the phone.  This time if you hold down the home and power buttons when you power on the phone it will boot in to the recovery image.  You can use the short cuts or the track ball to select a menu item.</p>
<p>Now we are ready to install the new software.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537061" title="View 'Custom recovery image menu' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Custom recovery image menu" border="0" src="http://farm5.static.flickr.com/4071/5074537061_048eed984f_m.jpg" width="166"/></a></p>
<h2>New radio software and DangerSPL</h2>
<p>Now we have to repartition the flash to give enough room for the new platform.  This is the scary bit.  As I said before&#8230;</p>
<p><span style="text-color: #ff0000;"><strong>Finally I provide no warranty express or implied.  You are doing this to your phone.  If it goes wrong its your fault!  You have been warned!</strong></span></p>
<p>Read this page thoroughly <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL">http://wiki.cyanogenmod.com/index.php?title=Dream:DangerSPL</a>.  If you&#8217;ve gotten this far you fulfil the prerequisites to install Danger/SPL.  You now need to download the appropriate radio image, place it in the root of your SD card and flash it.  Remember that number we noted down from the boot-loader screen at the start (<em>&#8220;RADIO-2.22.19.26I&#8221;</em> or similar).  You will need it now.</p>
<p>Boot in to recovery by holding down the home and power buttons. Select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Select <em>update.zip</em> (if that&#8217;s the name of the file) from the file menu.  The image should be flashed and will then reboot the phone.  Reboot the phone again.</p>
<p>Take out the SD card and boot back in to the boot loader.  It should now appear as below.</p>
<p><a href="http://www.flickr.com/photos/39013214@N03/5074537429" title="View 'Updated Google G1 bootloader' on Flickr.com"><img height="240" style="display:block; margin-left:auto; margin-right:auto;" alt="Updated Google G1 bootloader" border="0" src="http://farm5.static.flickr.com/4043/5074537429_0bebc5256a_m.jpg" width="179"/></a></p>
<h2>Upgrading to FROYO and installing Google Apps</h2>
<p>All the hard work is now done.  You have a rooted phone with a nice recovery menu which allows you to flash anything that will fit.</p>
<p>To install the latest Android read this link: <a href="http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B">http://wiki.cyanogenmod.com/index.php?title=Dream:Installing_CyanogenMod_5%2B</a>.</p>
<p>Clear out your SD card and download <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#DreamCM6">Froyo for the G1/Dream</a> and the <a href="http://wiki.cyanogenmod.com/index.php?title=Latest_Version#Google_Apps">Google <strong>Tiny</strong> Apps</a> (The G1 is a bit short on flash space so wont fit the all singing all dancing versions of the Google apps).  Boot in to recovery as before (home and power buttons) and again select <em>&#8220;Flash zip from sdcard&#8221;</em>.  Flash first Froyo and then the apps.</p>
<p>Finally reboot your phone.  You should now have Android 2.2 installed!</p>
<p><center><br />
<table>
<tr>
<td><a href="http://www.flickr.com/photos/39013214@N03/5074537651" title="View 'Cyanogen's Froyo (Android 2.2) booting' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) booting" border="0" style="display: inline;" src="http://farm5.static.flickr.com/4068/5074537651_fd8dc6e0e7_m.jpg" width="179"/></a></td>
<td><a href="http://www.flickr.com/photos/39013214@N03/5075136748" title="View 'Cyanogen's Froyo (Android 2.2) home screen.' on Flickr.com"><img height="240" alt="Cyanogen's Froyo (Android 2.2) home screen." border="0" style="display: inline;" src="http://farm5.static.flickr.com/4089/5075136748_9bb89e6b2c_m.jpg" width="179"/></a></td>
</tr>
</table>
<p></center></p>
<h2>Issues</h2>
<p>The only issue I had was an exception from the keyboard software the first time I used Froyo.  This can be solved using the <em>&#8220;Wipe&#8221;</em> menu in the recovery image.  I wiped data, cache and delvik cache (The latter generated an error I ignored) and then re-installed Froyo.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.cyberspice.org.uk/blog/2010/10/22/upgrading-your-uk-t-mobile-google-g1-htc-dream-to-android-2-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
