<?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"
	>

<channel>
	<title>jad</title>
	<atom:link href="http://jadickinson.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://jadickinson.co.uk</link>
	<description>random thoughts</description>
	<pubDate>Fri, 03 Oct 2008 10:24:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6</generator>
	<language>en</language>
			<item>
		<title>Fedora DS</title>
		<link>http://jadickinson.co.uk/2008/09/22/fedora-ds/</link>
		<comments>http://jadickinson.co.uk/2008/09/22/fedora-ds/#comments</comments>
		<pubDate>Mon, 22 Sep 2008 08:47:17 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[delicious feed]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=258</guid>
		<description><![CDATA[I have written some notes on building Fedora DS and the Fedora DS console from source.
]]></description>
			<content:encoded><![CDATA[<p>I have written some notes on building <a href="http://jadickinson.co.uk/test/howto/building-fedora-ds/">Fedora DS</a> and the <a href="http://jadickinson.co.uk/test/howto/fedora-ds-console-on-os-x/">Fedora DS console</a> from source.</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/09/22/fedora-ds/feed/</wfw:commentRss>
		</item>
		<item>
		<title>zzzZZZ</title>
		<link>http://jadickinson.co.uk/2008/08/28/zzzzzz/</link>
		<comments>http://jadickinson.co.uk/2008/08/28/zzzzzz/#comments</comments>
		<pubDate>Thu, 28 Aug 2008 16:49:26 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=206</guid>
		<description><![CDATA[This feels over engineered but&#8230;
I have always wanted to be able to put my Mac Pro to sleep using the power button on the Dell display I have connected to it. If you put the Mac to sleep and then turn off the display it will wake the mac up again due to the USB disconnect [...]]]></description>
			<content:encoded><![CDATA[<p>This feels over engineered but&#8230;</p>
<p>I have always wanted to be able to put my Mac Pro to sleep using the power button on the Dell display I have connected to it. If you put the Mac to sleep and then turn off the display it will wake the mac up again due to the USB disconnect of the USB hub in the display.</p>
<p>I came across <a href="http://www.bernhard-baehr.de/">sleepwatcher</a> which allows you to do stuff like this</p>
<p>Create a config file containing something like </p>
<pre>timeout=100
idle=if [ `system_profiler SPUSBDataType | grep "Apple Keyboard" &gt; /dev/null; \
    echo $?` -eq 1 ]; then /usr/local/sbin/sleepwatcher -n;fi</pre>
<p>(I have my Apple Keyboard connected to the USB hub in the display.)  Then edit the sleepwatcher Launch script to use that config file - make the launch command look like this</p>
<pre>/usr/local/sbin/sleepwatcher -d -V -s /etc/rc.sleep -w /etc/rc.wakeup -f /config/file</pre>
<p>Restart sleepwatcher and press the power button on your display and wait 10 seconds&#8230;</p>
<p>Now must just remember that this will occur whenever I disconnect the keyboard.</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/08/28/zzzzzz/feed/</wfw:commentRss>
		</item>
		<item>
		<title>DNS Spoofing</title>
		<link>http://jadickinson.co.uk/2008/08/19/dns-spoofing/</link>
		<comments>http://jadickinson.co.uk/2008/08/19/dns-spoofing/#comments</comments>
		<pubDate>Tue, 19 Aug 2008 08:23:21 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[DNS]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=165</guid>
		<description><![CDATA[At IETF 72 in Dublin I gave a demonstration of DNS spoofing based on the attack on DNS described by Dan Kaminsky. I was able to successfully inject a fake DNS record in to the cache of a name server with a fixed port in a few seconds and sometimes in well under a second. 
Bert [...]]]></description>
			<content:encoded><![CDATA[<p>At IETF 72 in Dublin I gave a <a href="http://www.ops.ietf.org/lists/namedroppers/namedroppers.2008/msg01191.html">demonstration</a> of DNS spoofing based on the attack on DNS described by <a href="http://www.doxpara.com/?p=1204">Dan Kaminsky</a>. I was able to successfully inject a fake DNS record in to the cache of a name server with a fixed port in a few seconds and sometimes in well under a second. </p>
<p><a href="http://www.ops.ietf.org/lists/namedroppers/namedroppers.2008/msg01194.html">Bert Hubert</a> published a description of the math behind this attack on namedroppers and I have been playing with the spoofer to see how close I can get the experiment and theory. </p>
<p>I ran my spoofer on a network consisting of three machines linked by a cheap gigabit switch. The attacker was on a Mac Pro, the target nameserver was on a Mac Book Pro and the authoritative server, that the attacker was pretending to be, was on a old FreeBSD box (100Mb). I used DUMMYNET to simulate a longer link to the authoritative server (delay = 30ms).</p>
<p>I ran the spoofer 1000 times and plotted a histogram of the frequency of success against time.<a href="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-0.png"><img class="aligncenter size-full wp-image-193" title="sp-0" src="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-0.png" alt="" width="500" height="300" /></a></p>
<p>The pink bar shows the median of all the times recorded. If I recall my A level maths correctly, this should coincide with the 50% chance of success predicted by the math.</p>
<p>The math presented by <a href="http://www.ops.ietf.org/lists/namedroppers/namedroppers.2008/msg01194.html">Bert Hubert</a> considers the expansion of the binomial </p>
<p>Ps = probability of success on a single attempt</p>
<p>Pf = probability of failure on a single attempt</p>
<p>( Ps + Pf )^n = 1</p>
<p>Expanding this and remembering that the sum of all the terms containing success = (1- the term for always failing) leads to the probability of combined success</p>
<p>Pcs(n) = 1 - (1 - Ps)^(n)</p>
<p>We know that n = T/W so we get </p>
<p>Pcs(t) = 1 - (1 - Ps)^(t/W)</p>
<p><a href="http://www.ops.ietf.org/lists/namedroppers/namedroppers.2008/msg01194.html">Bert Hubert</a> tells us that Ps = (D*R*W)/(N*P*I) where</p>
<p>     I: Number distinct IDs available (maximum 65536)</p>
<p>     P: Number of ports used (maximum around 64000 as ports under 1024<br />
     are not always available, but often 1)</p>
<p>     N: Number of authoritative nameservers for a domain (averages<br />
     around 2.5)</p>
<p>     R: Number of packets sent per second by the attacker</p>
<p>     W: Window of opportunity, in seconds.  Bounded by the response<br />
     time of the authoritative servers (often 0.1s)</p>
<p>     D: Average number of identical outstanding queries of a resolver<br />
     (typically 1, see Section 5)</p>
<p>I used the following values<br />
I=65535<br />
R=36000 - From looking at the traffic I was sending<br />
W=0.030 - From the settings I gave DUMMYNET<br />
N=1.0 (I fixed this)<br />
P=1 (I fixed this)<br />
D=1<br />
Plotting this on the same graph as the histogram gives:<a href="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-1.png"><img class="aligncenter size-full wp-image-194" title="sp-1" src="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-1.png" alt="" width="500" height="300" /></a></p>
<p>The blue circles are the predicted probability of combined success (Their y axis runs from 0 to 1 and is not shown). As you can see the predicted 50% chance (black cross lines) occurs slightly before the median but it is fairly close.</p>
<p>In order to improve things I added an extra term to the equation to account for the time that the window is closed (This is due to the spoofer taking a bit of time to notice that it has been unsuccessful and to try again). So:</p>
<p>n = T/(W+Wc)</p>
<p>Ps = (D*R*W))/(N*P*I)</p>
<p>where Wc is measured to be about 0.003 seconds. The graph now looks like<a href="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-2.png"><img class="aligncenter size-full wp-image-195" title="sp-2" src="http://jadickinson.co.uk/wp-content/uploads/2008/08/sp-2.png" alt="" width="500" height="300" /></a></p>
<p>That seems like good agreement to me. The median in this case is 1386ms.</p>
<p>BTW: The graphs were plotted using <a href="http://www.r-project.org">R</a>.  This is the code I used</p>
<pre>#Plot a histogram of frequency of success against time
mydata &lt;- read.table("/tmp/speed-test-30ms",header=TRUE)
#Plot both on a single graph
h &lt;- hist(mydata$time,breaks=100,plot=FALSE)
plot(h,freq=FALSE, xlim=range(h$mids),ylim=range(h$density),
    sub="Histogram showing time to success of real spoofer (pink line shows median)",
    main="DNS Spoofer Performance",
    ylab="Density", xlab="Time/ms")
abline(v=median(mydata$time),col=70)
#Plot Bert Hubert's math
D=1.0
R=36000.0
W=0.030
Wc=0.003
N=1.0
P=1
I=65535
Ps &lt;- ((D*R*W)/(N*P*I))
Pcs &lt;- function(t){1 - (1 - Ps)**((t/1000)/(W+Wc))}
par(new=TRUE)
nx &lt;- sample(h$mids)
y=Pcs(nx)
#Scale plot to same as histogram
my=max(y)
ny=y*max(h$density)/my
plot(nx,ny, xlim=range(h$mids),ylim=range(h$density),col="blue", ann=FALSE)
#Calculate time for 0.5 chance
time5 = 1000*(W+Wc)*(log10(0.5)/log10(1 - Ps))
abline(v=time5)
abline(h=0.5*max(h$density)/my)</pre>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/08/19/dns-spoofing/feed/</wfw:commentRss>
		</item>
		<item>
		<title>log(0.5) and the OS X calculator</title>
		<link>http://jadickinson.co.uk/2008/08/13/log05-and-the-os-x-calculator/</link>
		<comments>http://jadickinson.co.uk/2008/08/13/log05-and-the-os-x-calculator/#comments</comments>
		<pubDate>Wed, 13 Aug 2008 12:08:48 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<category><![CDATA[is it me?]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=178</guid>
		<description><![CDATA[The OS X calculator is one of my favorite applications and I use it every day for work (I find  the binary display in the programmer view especially useful). So I was very surprised when I noticed that it was giving me the wrong answer for log(0.5). I was getting log(0.5) = 0.301 when it should be -0.301. Strangely 1-log(0.5) [...]]]></description>
			<content:encoded><![CDATA[<p>The OS X calculator is one of my favorite applications and I use it every day for work (I find  the binary display in the programmer view especially useful). So I was very surprised when I noticed that it was giving me the wrong answer for log(0.5). I was getting log(0.5) = 0.301 when it should be -0.301. Strangely 1-log(0.5) was correctly shown as 1.301. Well today I discovered that this only happens if you enable &#8220;Show Separators&#8221; in  the View menu.</p>
<p>Does anyone else see this or is it just me?</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/08/13/log05-and-the-os-x-calculator/feed/</wfw:commentRss>
		</item>
		<item>
		<title>sshd on OS X</title>
		<link>http://jadickinson.co.uk/2008/07/22/sshd-is-on-os-x/</link>
		<comments>http://jadickinson.co.uk/2008/07/22/sshd-is-on-os-x/#comments</comments>
		<pubDate>Tue, 22 Jul 2008 16:30:13 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=156</guid>
		<description><![CDATA[I have been trying to understand how the SSH server settings are controlled on Leopard. To turn sshd on you tick the remote login box on the sharing preference pane. You can then control which users are allowed to log in by selecting them in the &#8220;allow access for&#8221; section.
But where does it store the [...]]]></description>
			<content:encoded><![CDATA[<p>I have been trying to understand how the SSH server settings are controlled on Leopard. To turn sshd on you tick the remote login box on the sharing preference pane. You can then control which users are allowed to log in by selecting them in the &#8220;allow access for&#8221; section.</p>
<p>But where does it store the settings? Traditionally you would have added a clause like</p>
<pre>AllowUsers jad</pre>
<div> to /etc/ssh/sshd_config. However OS X does not do this, instead it adds a file called</div>
<pre>/private/var/db/dslocal/nodes/Default/groups/com.apple.access_ssh.plist</pre>
<div>containing what appears to be a list of users in the remote  login group. I have no idea what uses this file. Is it a modified  version of sshd or is something cleverer at work?</div>
<div></div>
<div>And, what was wrong with the old way?</div>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/07/22/sshd-is-on-os-x/feed/</wfw:commentRss>
		</item>
		<item>
		<title>MacSpeech Dictate</title>
		<link>http://jadickinson.co.uk/2008/07/15/macspeech-dictate/</link>
		<comments>http://jadickinson.co.uk/2008/07/15/macspeech-dictate/#comments</comments>
		<pubDate>Tue, 15 Jul 2008 12:07:53 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[delicious feed]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=149</guid>
		<description><![CDATA[I am dictating this post using MacSpeech Dictate. It is amazing and much better than I expected at understanding what you&#8217;re saying. In addition to dictation it also allows you to control your computer, with commands such as &#8220;open mail&#8221; and &#8220;put this computer to sleep&#8221;.
When you are controlling your computer you have to be [...]]]></description>
			<content:encoded><![CDATA[<p>I am dictating this post using <a href="http://www.macspeech.com/">MacSpeech Dictate</a>. It is amazing and much better than I expected at understanding what you&#8217;re saying. In addition to dictation it also allows you to control your computer, with commands such as &#8220;open mail&#8221; and &#8220;put this computer to sleep&#8221;.</p>
<p>When you are controlling your computer you have to be careful to use the correct language and it does take a bit of getting used to but it&#8217;s quite easy. There is an on-screen list of commands to refer to and most of them are fairly intuitive.</p>
<p>As far as I can tell MacSpeech Dictate seems  to work in all applications. I have used it this morning in TextMate to write an XML document. Speaking &#8220;open angle bracket&#8221; is almost as easy as typing angle bracket. And long sections of text are obviously much easier to speak.</p>
<p>MacSpeech Dictate is able to detect commands during spoken text. Adding punctuation is easy, to add a full stop just say &#8220;full stop&#8221;. Correcting mistakes can be a little painful but can be done. Deleting a single word is done by saying &#8220;forget word&#8221; and deleting the last chunk of text that you dictated can be done by saying &#8220;forget that&#8221;.</p>
<p>It is really good in iChat. Being able to speak is exactly what you want when writing a chat message.</p>
<p>However, don&#8217;t forget to read what you wrote because it can make mistakes!</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/07/15/macspeech-dictate/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Totally useless error messages</title>
		<link>http://jadickinson.co.uk/2008/07/08/totally-useless-error-messages/</link>
		<comments>http://jadickinson.co.uk/2008/07/08/totally-useless-error-messages/#comments</comments>
		<pubDate>Tue, 08 Jul 2008 07:59:23 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<category><![CDATA[is it me?]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/?p=147</guid>
		<description><![CDATA[Why do some applications always generate such rubbish error messages. I am using eclipse for a project and it has just failed to start. The error on the screen was

That file contains this:
!SESSION 2008-07-08 08:34:44.307 -----------------------------------------------
eclipse.buildId=I20080617-2000
java.version=1.5.0_13
java.vendor=Apple Inc.
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US
Framework arguments:  -keyring /Users/jad/.eclipse_keyring -showlocation
Command-line arguments:  -os macosx -ws carbon -arch x86 [...]]]></description>
			<content:encoded><![CDATA[<p>Why do some applications always generate such rubbish error messages. I am using <a href="http://www.eclipse.org/">eclipse</a> for a project and it has just failed to start. The error on the screen was</p>
<p><a href="http://jadickinson.co.uk/wp-content/uploads/2008/07/error1.tiff"><img class="alignnone size-medium wp-image-148" title="error1" src="http://jadickinson.co.uk/wp-content/uploads/2008/07/error1.tiff" alt="" /></a></p>
<p>That file contains this:</p>
<p><code>!SESSION 2008-07-08 08:34:44.307 -----------------------------------------------<br />
eclipse.buildId=I20080617-2000<br />
java.version=1.5.0_13<br />
java.vendor=Apple Inc.<br />
BootLoader constants: OS=macosx, ARCH=x86, WS=carbon, NL=en_US<br />
Framework arguments:  -keyring /Users/jad/.eclipse_keyring -showlocation<br />
Command-line arguments:  -os macosx -ws carbon -arch x86 -keyring /Users/jad/.eclipse_keyring -consoleLog -showlocation</code></p>
<p><code> </code></p>
<p><code>!ENTRY org.eclipse.osgi 4 0 2008-07-08 08:34:45.312<br />
!MESSAGE Application error<br />
!STACK 1<br />
org.eclipse.swt.SWTError: No more handles<br />
at org.eclipse.swt.SWT.error(SWT.java:3803)<br />
at org.eclipse.swt.SWT.error(SWT.java:3695)<br />
at org.eclipse.swt.SWT.error(SWT.java:3666)<br />
at org.eclipse.swt.widgets.Display.createOverlayWindow(Display.java:741)<br />
at org.eclipse.swt.widgets.Display.internal_new_GC(Display.java:2300)<br />
at org.eclipse.swt.graphics.GC.(GC.java:149)<br />
at org.eclipse.swt.graphics.GC.(GC.java:115)<br />
...<br />
</code><br />
Why do I need all the junk? Why didn&#8217;t the message on the screen just say something like. &#8220;Sorry, the application failed to start. The reason was - No more handles.&#8221;. Even better, it could explain what a handle is and how to fix it or provide a link to a knowledge base.<br />
 </p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/07/08/totally-useless-error-messages/feed/</wfw:commentRss>
		</item>
		<item>
		<title>So I don&#8217;t forget again</title>
		<link>http://jadickinson.co.uk/2008/05/16/so-i-dont-forget-again/</link>
		<comments>http://jadickinson.co.uk/2008/05/16/so-i-dont-forget-again/#comments</comments>
		<pubDate>Fri, 16 May 2008 13:37:53 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/blog/?p=137</guid>
		<description><![CDATA[To exclude the annoying ._ files from tarballs built on OS X 10.5.x do this
export COPYFILE_DISABLE=true

Thanks to this thread for the answer.
]]></description>
			<content:encoded><![CDATA[<p>To exclude the annoying ._ files from tarballs built on OS X 10.5.x do this</p>
<p><code>export COPYFILE_DISABLE=true<br />
</code><br />
Thanks to <a href="http://www.nabble.com/OSX-considered-harmfull-td13705096s6745.html">this thread</a> for the answer.</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/05/16/so-i-dont-forget-again/feed/</wfw:commentRss>
		</item>
		<item>
		<title>nVidia MCP55 Ethernet</title>
		<link>http://jadickinson.co.uk/2008/04/16/nvidia-mcp55-ethernet/</link>
		<comments>http://jadickinson.co.uk/2008/04/16/nvidia-mcp55-ethernet/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 19:12:41 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[delicious feed]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/blog/?p=131</guid>
		<description><![CDATA[A recent upgrade of my server to Ubuntu 8.04 beta forced me to solve an issue I have been having with the integrated MCP55 ethernet and recent Linux kernels. At boot the network interface appears to come up and shows as up in ifconfg. However, it just will not work. Eventually I found a fix [...]]]></description>
			<content:encoded><![CDATA[<p>A recent upgrade of my server to <a href="http://www.ubuntu.com/testing/hardy/beta">Ubuntu 8.04 beta</a> forced me to solve an issue I have been having with the integrated MCP55 ethernet and recent Linux kernels. At boot the network interface appears to come up and shows as up in ifconfg. However, it just will not work. Eventually I found a fix on the <a href="http://gentoo-wiki.com/Asus_P5N32-E_SLI">Gentoo Wiki</a>. However, adding the forcedeth module options specified to /etc/modprobe.d/options did not fix the problem. I think that the kernel is loading the module from initramfs and that needs to be updated as well. This  is what fixed things for me.</p>
<p>Add the following line to /etc/modprobe.d/options<br />
<code>options forcedeth msi=0 msix=0</code><br />
Then rebuild initramfs like this<br />
<code>sudo update-initramfs -u</code></p>
<p>BTW - this was the only issue I came across doing the upgrade over ssh. Everything else worked perfectly.</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/04/16/nvidia-mcp55-ethernet/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Trouble with Rails</title>
		<link>http://jadickinson.co.uk/2008/04/14/trouble-with-rails/</link>
		<comments>http://jadickinson.co.uk/2008/04/14/trouble-with-rails/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 16:23:32 +0000</pubDate>
		<dc:creator>jad</dc:creator>
		
		<category><![CDATA[delicious feed]]></category>

		<guid isPermaLink="false">http://jadickinson.co.uk/blog/?p=130</guid>
		<description><![CDATA[This weekend I thought I would have a go at throwing together a Rails front end to my mythtv database. I thought this would be easy but it seemed to highlight one difficulty after another with using Rails with a so called &#8220;legacy&#8221; application (one that already exists and not designed for Rails).
To start with I used [...]]]></description>
			<content:encoded><![CDATA[<p>This weekend I thought I would have a go at throwing together a Rails front end to my <a href="http://www.mythtv.org">mythtv</a> database. I thought this would be easy but it seemed to highlight one difficulty after another with using Rails with a so called &#8220;legacy&#8221; application (one that already exists and not designed for Rails).</p>
<p>To start with I used the Rails install that comes with OS X. I did something like <br />
<code><br />
rails mythrails<br />
cd mythrails<br />
#edit database.yml<br />
ruby script/generate scaffold Program program<br />
</code></p>
<p>Since this is a so called legacy application you need to edit config environment.rb to tell rails not to pluralize table names<br />
<code><br />
ActiveRecord::Base.pluralize_table_names = false<br />
</code></p>
<p>and edit the model to tell it what the table is actually called<br />
<code><br />
class Program &lt; ActiveRecord::Base<br />
  set_table_name "capturecard"<br />
end<br />
</code></p>
<p>then starting the web server gives you a web interface to the program table. It&#8217;s really simple. But &#8230;</p>
<p>If you try to edit the data or create a new entry it will complain because (I think) there is no id field in the program table. This lead me to discover that you can add something like<br />
<code><br />
class Program &lt; ActiveRecord::Base<br />
  set_table_name "capturecard"<br />
  set_primary_key "the_id_field"<br />
end<br />
</code></p>
<p>This raises the next problem. Rails can not cope with composite primary keys. You need to install <a href="http://compositekeys.rubyforge.org/">composite_primary_keys</a>. However, this leads to the next issue - <a href="http://compositekeys.rubyforge.org/">composite_primary_keys</a> needs Rails 2. This then has the side effect that generating the scaffold no longer works. In Rails 2 you need to specify the fields and types for all the fields in the table. In the case of a legacy system the table already exists so why can&#8217;t the scaffold generator just read the fields from the database?</p>
<p>At this point I gave up. I am sure this is not too hard to work around but I only wanted to play and this all seemed like it was getting harder than I ever intended.</p>
]]></content:encoded>
			<wfw:commentRss>http://jadickinson.co.uk/2008/04/14/trouble-with-rails/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
