<?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>nick.recoil.org</title>
	<atom:link href="http://nick.recoil.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://nick.recoil.org</link>
	<description>Connector in, receiver out</description>
	<lastBuildDate>Tue, 28 Jul 2009 21:39:23 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Mill Colour</title>
		<link>http://nick.recoil.org/2009/07/mill-colour/</link>
		<comments>http://nick.recoil.org/2009/07/mill-colour/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 14:09:48 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Handheld]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[app]]></category>
		<category><![CDATA[iphone]]></category>
		<category><![CDATA[MillColour]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[TheMill]]></category>

		<guid isPermaLink="false">http://nick.recoil.org/?p=124</guid>
		<description><![CDATA[
Over the past few months I&#8217;ve been working on developing professional iPhone and iPod Touch applications with a number of clients, and I wanted to mention the first one, which has had a great 6 week run at the top of the free photography apps chart.
My very first public iPhone project has been Mill Colour, [...]]]></description>
			<content:encoded><![CDATA[<p><img class="aligncenter size-full wp-image-134" title="Mill Colour" src="http://nick.recoil.org/wp-content/uploads/2009/07/mill_colour_01.jpg" alt="Mill Colour" width="410" height="369" /></p>
<p>Over the past few months I&#8217;ve been working on developing professional iPhone and iPod Touch applications with a number of clients, and I wanted to mention the first one, which has had a great 6 week run at the top of the free photography apps chart.</p>
<h3><span style="font-weight: normal; font-size: 13px;">My very first public iPhone project has been <a href="http://linktoapp.com/millcolour">Mill Colour</a>, for world-renowned visual effects company <a href="http://the-mill.com/">The Mill</a>. The idea behind this app is to offer users a means of  manipulating their pictures in a simple way, with built-in <em>looks</em>. It also offers the more adventurous user direct control over the <strong>Lift</strong>, <strong>Gamma</strong>, <strong>Gain</strong> and <strong>Saturation</strong> in their picture. These controls are the same as the Colourists at The Mill would use when <a href="http://en.wikipedia.org/wiki/Color_grading">colour grading</a> video footage.</span></h3>
<p>An important feature of this app was to offer users a learning curve suitable to the immediacy of mobile applications. Our goal was for the user to be able to see results within roughly 30 seconds of launching, but to offer additional controls which extend the learning curve, and offer a deeper experience for those who want to invest time. To achieve this, the simple built-in looks and the more direct controls interact with each other, offering a large combinatorial set of possible ways to alter the image.</p>
<p>Another interesting aspect of the project was the toolset I specifically built to capture the lookup tables for the looks. Each of the looks available within the app is based on a famous advert that The Mill have graded. To capture these looks, I wrote a program which would read and write the colour values from RGB &#8216;ramp&#8217; images. This allowed the Colourists to apply the same colour transform to the ramp image as they had done to the original source image. The tools then read this image back in and created a lookup table which could be applied to any image. This saved us a great deal of time in the early stages of the development process.</p>
<p>It has an active <a href="http://www.flickr.com/groups/1083518@N25/">Flickr group</a>, and by adding pictures to the pool, you can get entered into a competition to win time at The Mill, and get taught directly by their award-winning Colourists.</p>
<p>There are more applications in the pipeline, and I&#8217;ll post about them closer to the release date.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2009/07/mill-colour/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>mythRecommend</title>
		<link>http://nick.recoil.org/2009/03/mythrecommend/</link>
		<comments>http://nick.recoil.org/2009/03/mythrecommend/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 21:48:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[DVB]]></category>
		<category><![CDATA[Ruby & Rails]]></category>
		<category><![CDATA[Television]]></category>
		<category><![CDATA[mythtv]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ruby-mythtv]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2009-03-09:74</guid>
		<description><![CDATA[I’ve pushed my beta code for mythRecommend to Github. It’s a system which allows you to subscribe to a source of regular TV recommendations, and have those recommendations automatically get translated into concrete recording schedule for a MythTV system.
Once a recording has been made, the recording schedule is made dormant, so it will not clutter [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve pushed my beta code for <a href="http://github.com/nickludlam/mythrecommend/tree">mythRecommend</a> to Github. It’s a system which allows you to subscribe to a source of regular TV recommendations, and have those recommendations automatically get translated into concrete recording schedule for a MythTV system.</p>
<p>Once a recording has been made, the recording schedule is made dormant, so it will not clutter your existing schedule list as time goes on. You can decide if you would like to turn that recommended program into a permanent schedule or not, and reinstate it if desired.</p>
<p>I hope to add more feed parsers as the code matures, but as things stand there is only one written, specifically for <a href="http://www.guardian.co.uk/">The Guardian</a> here in the UK.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2009/03/mythrecommend/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts on parsing iPhone archives</title>
		<link>http://nick.recoil.org/2008/11/thoughts-on-parsing-iphone-archives/</link>
		<comments>http://nick.recoil.org/2008/11/thoughts-on-parsing-iphone-archives/#comments</comments>
		<pubDate>Mon, 10 Nov 2008 19:38:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[iphone]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-11-10:73</guid>
		<description><![CDATA[I’ve just put a little article up on the Tactotum blog about the possibilities of processing your automatic iPhone backups to create a giant database of all your phone calls and SMS messages.
]]></description>
			<content:encoded><![CDATA[<p>I’ve just put a little article up on the <a href="http://tactotum.com/blog">Tactotum blog</a> about the possibilities of <a href="http://tactotum.com/blog/2008/11/10/iphone-backup-extractor-possibilities/">processing your automatic iPhone backups</a> to create a giant database of all your phone calls and <span class="caps">SMS</span> messages.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/11/thoughts-on-parsing-iphone-archives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Scripting MythTV</title>
		<link>http://nick.recoil.org/2008/09/scripting-mythtv/</link>
		<comments>http://nick.recoil.org/2008/09/scripting-mythtv/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 12:00:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[DVB]]></category>
		<category><![CDATA[Ruby & Rails]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[mythtv]]></category>
		<category><![CDATA[ruby-mythtv]]></category>
		<category><![CDATA[scripting]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-09-29:72</guid>
		<description><![CDATA[At the end of June, I gave a short talk to the London Ruby Users Group on some code I’ve been working on to enable me to interface with MythTV on a programatic level. MythTV is Open Source software which allows the recording and playback of TV on a Linux box, turning it into a [...]]]></description>
			<content:encoded><![CDATA[<p>At the end of June, I gave a short talk to the <a href="http://lrug.org/meetings/2008/05/27/june-2008-meeting/">London Ruby Users Group</a> on some code I’ve been working on to enable me to interface with <a href="http://www.mythtv.org/">MythTV</a> on a programatic level. MythTV is Open Source software which allows the recording and playback of TV on a Linux box, turning it into a <span class="caps">PVR</span>. I use this at home to record TV from Freeview.</p>
<p>MythTV has a web interface written for it in the form of <a href="http://www.mythtv.org/wiki/index.php/MythWeb">MythWeb</a>, and it allows decent remote interaction with the system. It is also my main mode of interaction when trawling for interesting programmes to record. It’s much more convenient to use a keyboard and mouse to navigate, rather than a remote control. This is especially true here in the UK, where there are many <a href="http://www.freeview.co.uk/">Freeview</a> channels that could contain content of interest.</p>
<h3>Creating a pleasant <span class="caps">API</span></h3>
<p>However, if you’re looking to play around with integration, and prototype some ideas you have to help you navigate and interact in different ways, you’re not going to have an easy ride. There’s no single clean implementation of the functionality you can access in any one language. <span class="caps">PHP</span> drives the main MythWeb code, but it also mixes in some Perl to access some fairly major functionality (downloading/streaming the recorded programmes). There are also Python bindings within the MythTV codebase, but I’m not aware of anything substantial built on top of them, and what is implemented is mainly concerned with metadata.</p>
<p>The main functions I wanted a MythTV integration library to offer were the ability to list what had been recorded, obtain a thumbnail for that recording, and to be able to stream the data to you. This was achieved in the 0.1.0 release. Now we’re up to version 0.2.0, it now supports listing of <span class="caps">EPG</span> data, and creation/editing of  recording schedules. This paves the way for experiments in automatic scheduling of recordings. There are many potentially interesting sources of TV reviews to scrape. For instance, if you like what <a href="http://http://www.guardian.co.uk/">The Guardian</a> has to say about Television in its <a href="http://www.guardian.co.uk/culture/series/watchthis">Watch this</a> section, then extracting the titles from that page, and feeding them to ruby-mythtv is easy.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code"><pre class="ruby" style="font-family:monospace;">  <span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'ruby-mythtv'</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Connect to the server</span>
  mythbackend, mythdb = MythTV.<span style="color:#9900CC;">connect</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:host</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'mythtv.localdomain'</span>,
                                       <span style="color:#ff3333; font-weight:bold;">:database_password</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#996600;">'password'</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Find matches on our search term, and limit the results to 5 matches</span>
  programs = mythdb.<span style="color:#9900CC;">list_programs</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#ff3333; font-weight:bold;">:conditions</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#996600;">'title LIKE ?'</span>, <span style="color:#996600;">&quot;%Bruce Parry%&quot;</span><span style="color:#006600; font-weight:bold;">&#93;</span>,
                                  <span style="color:#ff3333; font-weight:bold;">:limit</span> <span style="color:#006600; font-weight:bold;">=&gt;</span> <span style="color:#006666;">5</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Take the first program match, and convert it to a recording schedule</span>
  new_schedule = <span style="color:#6666ff; font-weight:bold;">MythTV::RecordingSchedule</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>programs<span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006666;">0</span><span style="color:#006600; font-weight:bold;">&#93;</span>, mythdb<span style="color:#006600; font-weight:bold;">&#41;</span>
  new_schedule.<span style="color:#9900CC;">save</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Signal the backend of recording changes for our recording schedule entry</span>
  mythbackend.<span style="color:#9900CC;">reschedule_recordings</span><span style="color:#006600; font-weight:bold;">&#40;</span>new_schedule.<span style="color:#9900CC;">recordid</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Let the backend resolve matches</span>
  <span style="color:#CC0066; font-weight:bold;">sleep</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">1</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># Enumerate the list of pending recordings, find ours, and check for any conflicts</span>
  pending_recordings = mythbackend.<span style="color:#9900CC;">query_pending</span>
  conflicts = pending_recordings.<span style="color:#9900CC;">find</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#006600; font-weight:bold;">|</span>p<span style="color:#006600; font-weight:bold;">|</span> <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">recordid</span> == new_schedule.<span style="color:#9900CC;">recordid</span> <span style="color:#006600; font-weight:bold;">&amp;&amp;</span>
                                            <span style="color:#CC0066; font-weight:bold;">p</span>.<span style="color:#9900CC;">recstatus_sym</span> == <span style="color:#ff3333; font-weight:bold;">:rsConflict</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
&nbsp;
  <span style="color:#008000; font-style:italic;"># If conflicts is empty, then all is good. If it is populated, then action needs</span>
  <span style="color:#008000; font-style:italic;"># to be taken, such as bumping the priority, or removing the clashes....</span></pre></td></tr></table></div>

<p>Ruby-mythtv is present both on <a href="http://rubyforge.org/projects/ruby-mythtv/">Rubyforge</a> and <a href="http://github.com/nickludlam/ruby-mythtv">Github</a>. Major release versions will be present on Rubyforge, and development versions will be present on Github. This method allows me to push out code which I consider functional, but not necessarily finalised. <a href="http://www.google.com/search?q=release+early+release+often">Release early, release often</a>, as the saying goes, and this is all the more relevant when forking projects and sharing ideas is central to the way Github works. There’s nothing worse than code which is “almost there”, languishing in your “I really should finish it” folder, destined never to see the light of day.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/09/scripting-mythtv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Low-power embedded hardware</title>
		<link>http://nick.recoil.org/2008/05/low-power-embedded-hardware/</link>
		<comments>http://nick.recoil.org/2008/05/low-power-embedded-hardware/#comments</comments>
		<pubDate>Sun, 18 May 2008 11:29:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[DVB]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[pico-itx]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-05-18:68</guid>
		<description><![CDATA[A chap at Smoke and Mirrors, where I’m doing some Freelance work, is creating a system to bridge between video routers and a web-based status page. Most of the suites within the building are plumbed in via fibre-optic KVM connections, and depending on the schedule, different video processing systems can get presented in different rooms [...]]]></description>
			<content:encoded><![CDATA[<p>A chap at <a href="http://www.smoke-mirrors.co.uk/">Smoke and Mirrors</a>, where I’m doing some Freelance work, is creating a system to bridge between <a href="http://en.wikipedia.org/wiki/Video_router">video routers</a> and a web-based status page. Most of the suites within the building are plumbed in via fibre-optic <span class="caps">KVM</span> connections, and depending on the schedule, different video processing systems can get presented in different rooms at different times. All it takes is a change on the routers.</p>
<p>Although complex, this enables the most cost-effective use of each system, marrying the functionality needed to the number of physical people required to attend the session for any given day. There is a large variation in price and functionality with certain high-end systems, so you always want to try and get maximal use from the systems you have chosen to invest in.</p>
<p>He’s looking at using one of the boards from the wonderfully named <a href="http://www.acmesystems.it/">Acme Systems</a> from Rome. The idea is to communicate with the video router via its RS-232 serial interface, and retrieve an <span class="caps">ASCII</span> representation of the current router configuration. It’s a fascinating area of software <strong><span class="caps">AND</span></strong> hardware as glue. A physical device which will run some bespoke code to bridge information from one system into another.</p>
<p><img class="alignnone size-full wp-image-58" title="pico-itx_board" src="http://localhost/~nick/wordpress/wp-content/uploads/2009/03/pico-itx_board.jpg" alt="pico-itx_board" width="400" height="330" /></p>
<p>In related news, I’ve also received my <a href="http://www.via.com.tw/en/products/embedded/artigo/">Artigo Pico-ITX kit</a> and am now a proud owner of the tiniest system running Linux that I’ve ever seen. It also seems to play happily with the <span class="caps">DVB</span> sticks that I had stability issues with on the older Mini-ITX M10k board.</p>
<p>The fan is noticable in a very quiet room, but as soon as there’s anything else to be heard, it’s drowned out, so it’s not quite suitable for your bedroom. They do a fanless system, but it’s half the clock speed. Installing it was done over <span class="caps">PXE</span> from my Mac, using the <a href="http://archive.ubuntu.com/ubuntu/dists/hardy/main/installer-i386/current/images/netboot/">Ubuntu netboot downloads</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/05/low-power-embedded-hardware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AppleTV &amp; Ubuntu hacking</title>
		<link>http://nick.recoil.org/2008/05/appletv-ubuntu-hacking/</link>
		<comments>http://nick.recoil.org/2008/05/appletv-ubuntu-hacking/#comments</comments>
		<pubDate>Mon, 05 May 2008 23:04:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[Television]]></category>
		<category><![CDATA[appletv]]></category>
		<category><![CDATA[g-202]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[perian]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-05-05:67</guid>
		<description><![CDATA[I’ve finally enabled SSH on my long dormant AppleTV, and am integrating it into my DVB / Rails / Beanstalk / MySQL system for processing data. I’ve used the Patchstick image available from atv4windows. I ended up unpacking and dd’ing the image from the Mac, but the process remains exactly the same. I now have [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve finally enabled <span class="caps">SSH</span> on my long dormant AppleTV, and am integrating it into my <span class="caps">DVB</span> / Rails / Beanstalk / MySQL system for processing data. I’ve used the Patchstick image available from <a href="http://www.wiki.atv4windows.com/">atv4windows</a>. I ended up unpacking and dd’ing the image from the Mac, but the process remains exactly the same. I now have Perian, ssh and a slew of other things enabled, and all I need now is to attempt the hack to get composite output working. I’ve yet to take the plunge and replace my old <span class="caps">CRT</span> with an <span class="caps">LCD TV</span>.</p>
<p>Incidentally, for anyone looking to figure out the ssh username and password for your freshly enabled ssh daemon, they are both <strong>frontrow</strong>, and that user has <strong>passwordless sudo privileges</strong>.</p>
<p>I also had a minor breakthrough with my x86_64 Ubuntu 8.04 machine. I have a Zyxel G-202 Wireless <span class="caps">USB</span> stick, to keep the number of trailing wires to a minimum, but I kept getting an error saying:</p>
<table class="CodeRay">
<tr>
<td title="click to toggle" class="line_numbers">
<pre>1<tt>
</tt></pre>
</td>
<td class="code">
<pre>zd1211rw error ioread32(CF_REG1): -110<tt>
</tt></pre>
</td>
</tr>
</table>
<p>Which was exceedingly unhelpful. I eventually tried disabling hi-speed <span class="caps">USB</span> from the <span class="caps">BIOS</span>, and rebooted to find it sprang into life immediately. Great! What was even more strange that when I rebooted and reset the <span class="caps">BIOS</span> back to enable <span class="caps">USB 2</span>.0, the G-202 kept working.  I’m unsure whether this is due to the device not being cold booted, and I’ve yet to see if it stops working after I power the system off, but so far so good, and I don’t need to resort to <span class="caps">NDIS</span>.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/05/appletv-ubuntu-hacking/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mongrel init.d script</title>
		<link>http://nick.recoil.org/2008/04/mongrel-initd-script/</link>
		<comments>http://nick.recoil.org/2008/04/mongrel-initd-script/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 12:50:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Ruby & Rails]]></category>
		<category><![CDATA[crash]]></category>
		<category><![CDATA[mongrel]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-04-07:66</guid>
		<description><![CDATA[I’ve slightly modified Bojan Mihelac’s Mongrel init.d script to cope with the situation where there are stale PID files left from a server failure.



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60




#!/bin/env ruby
#
# mongrel Startup script for Mongrel by Tim Morgan, modified by bmihelac and Nick Ludlam
# Originally from http://source.mihelac.org/2007/3/27/customized-mongrel-startup-script
#
# chkconfig: 2345 85 15
# description: mongrel manages Mongrel
#

apps = [
  {:app =&#62; 'app1'},
 [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve slightly modified <a href="http://source.mihelac.org/2007/3/27/customized-mongrel-startup-script">Bojan Mihelac’s Mongrel init.d script</a> to cope with the situation where there are stale <span class="caps">PID</span> files left from a server failure.</p>
<table class="CodeRay">
<tr>
<td title="click to toggle" class="line_numbers">
<pre>1<tt>
</tt>2<tt>
</tt>3<tt>
</tt>4<tt>
</tt><strong>5</strong><tt>
</tt>6<tt>
</tt>7<tt>
</tt>8<tt>
</tt>9<tt>
</tt><strong>10</strong><tt>
</tt>11<tt>
</tt>12<tt>
</tt>13<tt>
</tt>14<tt>
</tt><strong>15</strong><tt>
</tt>16<tt>
</tt>17<tt>
</tt>18<tt>
</tt>19<tt>
</tt><strong>20</strong><tt>
</tt>21<tt>
</tt>22<tt>
</tt>23<tt>
</tt>24<tt>
</tt><strong>25</strong><tt>
</tt>26<tt>
</tt>27<tt>
</tt>28<tt>
</tt>29<tt>
</tt><strong>30</strong><tt>
</tt>31<tt>
</tt>32<tt>
</tt>33<tt>
</tt>34<tt>
</tt><strong>35</strong><tt>
</tt>36<tt>
</tt>37<tt>
</tt>38<tt>
</tt>39<tt>
</tt><strong>40</strong><tt>
</tt>41<tt>
</tt>42<tt>
</tt>43<tt>
</tt>44<tt>
</tt><strong>45</strong><tt>
</tt>46<tt>
</tt>47<tt>
</tt>48<tt>
</tt>49<tt>
</tt><strong>50</strong><tt>
</tt>51<tt>
</tt>52<tt>
</tt>53<tt>
</tt>54<tt>
</tt><strong>55</strong><tt>
</tt>56<tt>
</tt>57<tt>
</tt>58<tt>
</tt>59<tt>
</tt><strong>60</strong><tt>
</tt></pre>
</td>
<td class="code">
<pre><tt>
</tt><span class="c">#!/bin/env ruby</span><tt>
</tt><span class="c">#</span><tt>
</tt><span class="c"># mongrel Startup script for Mongrel by Tim Morgan, modified by bmihelac and Nick Ludlam</span><tt>
</tt><span class="c"># Originally from http://source.mihelac.org/2007/3/27/customized-mongrel-startup-script</span><tt>
</tt><span class="c">#</span><tt>
</tt><span class="c"># chkconfig: 2345 85 15</span><tt>
</tt><span class="c"># description: mongrel manages Mongrel</span><tt>
</tt><span class="c">#</span><tt>
</tt><tt>
</tt>apps = [<tt>
</tt>  {<span class="sy">:app</span> =&gt; <span class="s"><span class="dl">'</span><span class="k">app1</span><span class="dl">'</span></span>},<tt>
</tt>  {<span class="sy">:app</span> =&gt; <span class="s"><span class="dl">'</span><span class="k">app2</span><span class="dl">'</span></span>},<tt>
</tt>  {<span class="sy">:app</span> =&gt; <span class="s"><span class="dl">'</span><span class="k">app3</span><span class="dl">'</span></span>}<tt>
</tt>]<tt>
</tt><tt>
</tt>default_port = <span class="i">8000</span><tt>
</tt>default_options = {<tt>
</tt>  <span class="sy">:app_dir</span> =&gt; <span class="s"><span class="dl">'</span><span class="k">/var/www</span><span class="dl">'</span></span>,  <span class="sy">:environment</span> =&gt; <span class="s"><span class="dl">'</span><span class="k">production</span><span class="dl">'</span></span><tt>
</tt>}<tt>
</tt><tt>
</tt>pid_location = <span class="s"><span class="dl">&quot;</span><span class="k">log/mongrel.pid</span><span class="dl">&quot;</span></span><tt>
</tt><tt>
</tt><span class="r">if</span> [<span class="s"><span class="dl">'</span><span class="k">stop</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">restart</span><span class="dl">'</span></span>].include? <span class="pc">ARGV</span>.first<tt>
</tt>  apps.each <span class="r">do</span> |app|<tt>
</tt>    options = default_options.merge(app)<tt>
</tt>    path = <span class="co">File</span>.join options[<span class="sy">:app_dir</span>], options[<span class="sy">:app</span>], <span class="s"><span class="dl">&quot;</span><span class="k">current</span><span class="dl">&quot;</span></span><tt>
</tt>    puts <span class="s"><span class="dl">&quot;</span><span class="k">Stopping </span><span class="il"><span class="dl">#{</span>path<span class="dl">}</span></span><span class="k">...</span><span class="dl">&quot;</span></span><tt>
</tt>    <span class="sh"><span class="dl">`</span><span class="k">/usr/local/bin/mongrel_rails stop -c </span><span class="il"><span class="dl">#{</span>path<span class="dl">}</span></span><span class="k"> -P </span><span class="il"><span class="dl">#{</span>pid_location<span class="dl">}</span></span><span class="dl">`</span></span><tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span><tt>
</tt><tt>
</tt><span class="r">if</span> [<span class="s"><span class="dl">'</span><span class="k">start</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">restart</span><span class="dl">'</span></span>].include? <span class="pc">ARGV</span>.first<tt>
</tt>  apps.each <span class="r">do</span> |app|<tt>
</tt>    options = default_options.merge(app)<tt>
</tt>    path = <span class="co">File</span>.join options[<span class="sy">:app_dir</span>], options[<span class="sy">:app</span>], <span class="s"><span class="dl">&quot;</span><span class="k">current</span><span class="dl">&quot;</span></span><tt>
</tt>    port = options[<span class="sy">:port</span>] || default_port<tt>
</tt>    pid_file = <span class="co">File</span>.join path, pid_location<tt>
</tt><tt>
</tt>    <span class="c"># Check and remove stale PID file. Platform needs &quot;ps -p&quot; support</span><tt>
</tt>    <span class="r">if</span> <span class="co">File</span>.exists?(pid_file)<tt>
</tt>      old_pid = <span class="co">File</span>.read(pid_file)<tt>
</tt>      <span class="sh"><span class="dl">`</span><span class="k">ps -p </span><span class="il"><span class="dl">#{</span>old_pid<span class="dl">}</span></span><span class="dl">`</span></span><tt>
</tt>      <span class="r">if</span> old_pid.to_i &gt; <span class="i">0</span> &amp;&amp; <span class="gv">$?</span>.exitstatus == <span class="i">1</span><tt>
</tt>        puts <span class="s"><span class="dl">&quot;</span><span class="k">Removing stale PID file</span><span class="dl">&quot;</span></span><tt>
</tt>        <span class="co">File</span>.unlink(pid_file)<tt>
</tt>      <span class="r">end</span><tt>
</tt>    <span class="r">end</span><tt>
</tt><tt>
</tt>    puts <span class="s"><span class="dl">&quot;</span><span class="k">Starting </span><span class="il"><span class="dl">#{</span>options[<span class="sy">:app</span>]<span class="dl">}</span></span><span class="k"> on </span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="k">...</span><span class="dl">&quot;</span></span><tt>
</tt>    <span class="sh"><span class="dl">`</span><span class="k">/usr/local/bin/mongrel_rails start -d -p </span><span class="il"><span class="dl">#{</span>port<span class="dl">}</span></span><span class="k"> -e </span><span class="il"><span class="dl">#{</span>options[<span class="sy">:environment</span>]<span class="dl">}</span></span><span class="k"> -c </span><span class="il"><span class="dl">#{</span>path<span class="dl">}</span></span><span class="k"> -P log/mongrel.pid</span><span class="dl">`</span></span><tt>
</tt>    default_port = port + <span class="i">1</span><tt>
</tt><tt>
</tt>  <span class="r">end</span><tt>
</tt><span class="r">end</span><tt>
</tt><tt>
</tt><span class="r">unless</span> [<span class="s"><span class="dl">'</span><span class="k">start</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">stop</span><span class="dl">'</span></span>, <span class="s"><span class="dl">'</span><span class="k">restart</span><span class="dl">'</span></span>].include? <span class="pc">ARGV</span>.first<tt>
</tt>    puts <span class="s"><span class="dl">&quot;</span><span class="k">Usage: mongrel {start|stop|restart}</span><span class="dl">&quot;</span></span><tt>
</tt>    exit<tt>
</tt><span class="r">end</span><tt>
</tt></pre>
</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/04/mongrel-initd-script/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MacPorts contributions</title>
		<link>http://nick.recoil.org/2008/04/macports-contributions/</link>
		<comments>http://nick.recoil.org/2008/04/macports-contributions/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 10:27:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Mac OS X]]></category>
		<category><![CDATA[macports]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-04-01:65</guid>
		<description><![CDATA[I’ve been accepted as a committer to MacPorts, initially to look after beanstalkd, but I’ll hopefully extend what I contribute to. I’ve been a consumer of Macports (née Darwinports) for a long while, and use it regularly to create my local development environment on the Mac. As of today, I have 98 ports installed, from [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve been accepted as a committer to <a href="http://macports.org/">MacPorts</a>, initially to look after <a href="http://xph.us/software/beanstalkd/">beanstalkd</a>, but I’ll hopefully extend what I contribute to. I’ve been a consumer of Macports (née Darwinports) for a long while, and use it regularly to create my local development environment on the Mac. As of today, I have 98 ports installed, from ImageMagick to zlib, and I’m happy to be giving back some effort to something I get so much value from.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/04/macports-contributions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Saving my blown Seagate Barracuda 7200.10 hard drive</title>
		<link>http://nick.recoil.org/2008/03/saving-my-blown-seagate-barracuda-720010-hard-drive/</link>
		<comments>http://nick.recoil.org/2008/03/saving-my-blown-seagate-barracuda-720010-hard-drive/#comments</comments>
		<pubDate>Fri, 21 Mar 2008 13:59:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-03-21:63</guid>
		<description><![CDATA[Whilst messing around with my Mini ITX box, I managed to touch the power connector onto the drive backwards, blowing one of the components near the connector. I noticed that the controller board is screwed on with standard torx screws, so I took them out, curious about the connector to the main chassis.
After removing them, [...]]]></description>
			<content:encoded><![CDATA[<p>Whilst messing around with my Mini <span class="caps">ITX</span> box, I managed to touch the power connector onto the drive backwards, blowing one of the components near the connector. I noticed that the controller board is screwed on with standard torx screws, so I took them out, curious about the connector to the main chassis.</p>
<p>After removing them, the board came away easily, and uses pressure pads as a connection mechanism, rather than ribbon cable or other methods. This set me wondering about whether this would be a replaceable part. I contacted Seagate, who told me that they don’t supply them separately. I then wondered about getting an identical drive, and replacing the old board with one from the new drive, so I went ahead and ordered a replacement; I’d need it anyway, even if this attempt at data recovery failed.</p>
<p>After it arrived, and I’d done the swap, I turned on the machine, and back came my drive with all my data on it, safe and sound. I did worry about whether the <span class="caps">IDE</span> controller boards carry some kind of mapping table that’s specific to a particular set of platters, but this isn’t the case, it seems. Unfortunately I’ve no way of repairing the original blown board. Replacing surface mount components is tricky.</p>
<p>For anybody wondering, you can replace the controller board for a Seagate Barracuda 7200.10 500GB drive with no ill effects.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/03/saving-my-blown-seagate-barracuda-720010-hard-drive/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Stalling Wi-fi uploads on Mac OS X 10.5.2</title>
		<link>http://nick.recoil.org/2008/03/stalling-wi-fi-uploads-on-mac-os-x-1052/</link>
		<comments>http://nick.recoil.org/2008/03/stalling-wi-fi-uploads-on-mac-os-x-1052/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 12:22:00 +0000</pubDate>
		<dc:creator>nick</dc:creator>
				<category><![CDATA[Mac OS X]]></category>

		<guid isPermaLink="false">tag:nick.recoil.org,2008-03-03:60</guid>
		<description><![CDATA[I was sitting in my local wifi-enabled cafe in London for the first time yesterday, and was struck with a peculiar problem. I could attach to their Wi-fi network properly, and browsing webpages worked fine, but trying to scp a small file to one of the recoil.org servers was stalling at exactly 2064kB.
I had a [...]]]></description>
			<content:encoded><![CDATA[<p>I was sitting in my <a href="http://www.bertieandboo.com/cafe.html">local wifi-enabled cafe</a> in London for the first time yesterday, and was struck with a peculiar problem. I could attach to their Wi-fi network properly, and browsing webpages worked fine, but trying to scp a small file to one of the recoil.org servers was stalling at exactly 2064kB.</p>
<p>I had a quick glance around for the problem on Google, and <a href="http://discussions.apple.com/thread.jspa?threadID=1389943&amp;#38;tstart=0">a thread</a> turned up on the Apple message board. These people were discussing the same symptoms as I was having; An scp would start out fine, but stall after a particular amount of data had transfered. Following lots of discussion about tuning <strong>net.inet.tcp.delayed_ack</strong>, I tried fiddling with all sort of sysctl and ifconfig settings for the best part of an hour, and eventually had success.</p>
<p>I had to drop the <span class="caps">MTU</span> of en1 down from 1500 all the way down to 1400 for the problems to go away. The more common settings you might find via Google such as 1492 didn’t resolve the issue. For those of you who might have arrived here looking at similar issues, type the following into a Terminal window:</p>
<div class="code">
<pre><code>
 sudo ifconfig en1 mtu 1400
</code></pre>
</div>
<p>I’m not entirely sure what was going on, but Path <span class="caps">MTU</span> discovery is turned on by default on the Mac. By blocking <span class="caps">ICMP</span> packets on the Wifi network, it may cause issues with the discovery system. If people are more familiar with the networking circumstances here, drop me a comment/email.</p>
]]></content:encoded>
			<wfw:commentRss>http://nick.recoil.org/2008/03/stalling-wi-fi-uploads-on-mac-os-x-1052/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
