<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.2" -->
<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/"
	>

<channel>
	<title>danielbray</title>
	<link>http://danielbray.com/blog</link>
	<description>Daniel Bray's professional website</description>
	<pubDate>Tue, 20 Oct 2009 23:10:11 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>
	<language>en</language>
			<item>
		<title>Media centre (daddy&#8217;s toys are making way for baby)</title>
		<link>http://danielbray.com/blog/home-network/media-centre/</link>
		<comments>http://danielbray.com/blog/home-network/media-centre/#comments</comments>
		<pubDate>Mon, 26 Nov 2007 22:34:31 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>home network</category>
		<guid isPermaLink="false">http://danielbray.com/blog/uncategorized/media-centre/</guid>
		<description><![CDATA[My wife is currently incubating a daughter for the new year, which means that my old office at home has to go. In fact, it&#8217;s going downstairs; down into a tiny alcove between the toilet and where we keep our fruit and veg. I can live with most of this, but we don&#8217;t have the [...]]]></description>
			<content:encoded><![CDATA[<p>My wife is currently incubating a daughter for the new year, which means that my old office at home has to go. In fact, it&#8217;s going downstairs; down into a tiny alcove between the toilet and where we keep our fruit and veg. I can live with most of this, but we don&#8217;t have the space to store my thousand or so CDs any more.</p>
<p>I know, a thousand CDs&#8230; I wasn&#8217;t always married, you know.</p>
<p>So. What did I to do? I can&#8217;t afford to make the house bigger and I can&#8217;t persuade my wife to even consider using the shed out in the back garden as a nursery, so I had to bite the bullet and store them all as MP3&#8217;s and listen to them (somehow) over the network.</p>
<p>When I started this, I had a few requirements:</p>
<ol>
<li>I didn&#8217;t want to have a computer switched on in order to listen to music.</li>
<li>It couldn&#8217;t cost an arm and a leg.</li>
</ol>
<p>That was pretty much it.</p>
<p>I didn&#8217;t want to leave a computer on all the time, &#8217;cause I&#8217;m pretty tight and don&#8217;t fancy the idea of my electricity bill going through the roof, also, even &#8216;though my wife has a masters in computer science, it&#8217;s very much in the &#8220;science&#8221; end of the spectrum, and so doesn&#8217;t know all that much about computers, and I didn&#8217;t want her to have to deal with switching on two things just to listen to some music.</p>
<p>I figured that these were pretty reasonable requirements, but they threw up some pretty hefty brick walls, but like Randy Pausch said: &#8220;Brick walls are there for a reason. They let us prove how badly we want things.&#8221;</p>
<p>And I didn&#8217;t want to spend too much money&#8230; <em>really badly</em>.</p>
<p>Eventually, after much searching, I decided upon this setup:</p>
<ul>
<li>I store my music on a NAS drive that&#8217;s plugged straight into my wireless router.</li>
</ul>
<blockquote><p>The benefit of this is that it&#8217;s sitting there all the time, and hardly drawing any power at all, unless its being used. I chose the half-terabyte Buffalo <a href="http://www.buffalotech.com/products/network-storage/linkstation/">LinkStation </a>Live. I could have gone for a simple external hard drive at half the cost, and just plugged it into the media server, but everyone I know who bought an external hard drive, and moved it, had a broken external hard drive in about a year and a half. This is because external hard drives, for reasons i don&#8217;t understand, don&#8217;t come with fans, and so tend to be a bit brittle.</p></blockquote>
<blockquote><p>Also, I didn&#8217;t want all of my music sitting on a hot external hard drive within reach of my daughter&#8217;s clumsy, sticky hands.</p></blockquote>
<ul>
<li>I stream my music through a media server, that I&#8217;m also using as a DVR to store TV.</li>
</ul>
<blockquote><p>It&#8217;s funny, but every audio-only media server i could find cost an absolute fortune, so I went for a more general media server in the <a href="http://www.neurostechnology.com/">Neuros OSD</a>. It&#8217;s open-source, and so it&#8217;s a little rough around the edges, but it does everything that I need it to.</p></blockquote>
<blockquote><p>There is a slight niggle with it, in that it doesn&#8217;t come with a wireless antennae, so, rather than run cat-5 cables all over the house, I got a ethernet-wireless bridge. The first one I got was the god-awful D-Link DWL-G810 802.11g Wireless Bridge, that I won&#8217;t bother adding a link for because even &#8216;though the website said it supported WPA, their support said it didn&#8217;t (I got my money back on that one). After that debacle,   I went for another Buffalo product: their <a href="http://www.buffalo-technology.com/products/wireless/wireless-g-mimo-performance/wireless-g-mimo-performance-ethernet-converter/">Wireless Media convertor</a>. It was cheaper than the D-Link, and had the added bonus of working.</p></blockquote>
<ul>
<li>I rip my CDs to a &#8220;high enough&#8221; quality.</li>
</ul>
<blockquote><p>You don&#8217;t get to own a thousand CDs without becoming an elitist music snob. I know this about myself, and I wasn&#8217;t going to let my snobbery fool me into ripping my CDs in a completely lossless format unless I could actually tell the difference between FLAC and MP3 encoding.</p></blockquote>
<blockquote><p>So I did a few experiments: I ripped a few albums in different formats (FLAC, MP3 96K, etc), mixed the songs up so I didn&#8217;t know which format was which, and then listened to them all a few times, trying to guess which song was in which format.</p></blockquote>
<blockquote><p>Hey, I have a science degree, and this was my first chance to do a double-blind test, so I was going to take it.</p></blockquote>
<blockquote><p>Anyway, it seems that I have a good enough ear, but not fantastic, in that I can spot the lower quality MP3 encodings easily enough, but towards the upper end I&#8217;m right only about 60-70% of the time, and when I get to 320K VBR and FLAC, I&#8217;m right about half the time (i.e. I can&#8217;t tell them apart).</p></blockquote>
<blockquote><p>The upshot of all of this is that I&#8217;m ripping my CDs as 224KBs VBR, (my double-blind test showed that I can&#8217;t really tell these apart from FLAC with any real consistency) which means the half-terabyte NAS drive should be big enough to store this all with plenty of room to spare.</p></blockquote>
<ul>
<li>I rip my CDs with a good tool.</li>
</ul>
<blockquote><p>I&#8217;m using <a href="http://www.exactaudiocopy.de/">Exact Audio Copy</a> for this. They describe their tool pretty well, but simply put, it gets you a good copy of the music by repeatedly checking sections of music that it thinks &#8220;smells&#8221; a little, until it thinks it has gotten it right. It&#8217;s slower at ripping than your usual tool, but I figured that once my CDs are in the attic they won&#8217;t be coming down again, so I want as good a soft copy as I can get.</p></blockquote>
<blockquote><p>EAC is quite configurable, but I&#8217;ve gone with the flow and am using <a href="http://lame.sourceforge.net/index.php">LAME </a>as my MP3 encoder.</p></blockquote>
<ul>
<li>I&#8217;m managing my media with a single, good, tool.</li>
</ul>
<blockquote><p>There are so many media tools out there and I just wanted one that was small and light. My PC is four years old now and after years of upgrades it&#8217;s starting to show its age, so something like iTunes was going to be way too heavy for my liking.</p></blockquote>
<blockquote><p>In the end I let <a href="http://filehippo.com/">file hippo</a> point me towards <a href="http://www.mediamonkey.com/">media monkey</a>; partly because it&#8217;s small and light and fast, and partly because I really like monkeys.</p></blockquote>
<p>And that&#8217;s pretty much it. The Neuros is working like a charm, although I&#8217;m running it with a beta firmware, because the latest official one has some niggles I&#8217;m not too fond of (I said it was a little rough).</p>
<p>All I need to do now is find a cable splitter so I can pipe the sound from the Neuros through my stereo, since I don&#8217;t like having my TV on all day just so I can listen to music (I said I was tight).</p>
<p>Oh yeah, and I need to rip all my CDs. It&#8217;s quite interesting to listen to music alphabetically, but I&#8217;m only as far as Bach.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/home-network/media-centre/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>(Update) WiFi encryption: how to make a good PSK for WPA</title>
		<link>http://danielbray.com/blog/coding/update-wifi-encryption-how-to-make-a-good-psk-for-wpa/</link>
		<comments>http://danielbray.com/blog/coding/update-wifi-encryption-how-to-make-a-good-psk-for-wpa/#comments</comments>
		<pubDate>Sun, 19 Aug 2007 18:50:39 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
	<category>home network</category>
		<guid isPermaLink="false">http://danielbray.com/blog/uncategorized/update-wifi-encryption-how-to-make-a-good-psk-for-wpa/</guid>
		<description><![CDATA[A while back I did a bit on how to generate good preshared keys for WPA. Well, in a moment of boredom I hacked together a web-facing PHP version of the same idea.
You can find it here http://www.danielbray.com/php/keygen
Enjoy.

]]></description>
			<content:encoded><![CDATA[<p>A while back I did a bit on <a href="http://danielbray.com/blog/coding/good-key-generation-for-wireless-encryption/">how to generate good preshared keys for WPA</a>. Well, in a moment of boredom I hacked together a web-facing PHP version of the same idea.</p>
<p>You can find it here <a href="http://www.danielbray.com/php/keygen/index.php?min=33&#038;max=126&#038;length=63">http://www.danielbray.com/php/keygen</a></p>
<p>Enjoy.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/update-wifi-encryption-how-to-make-a-good-psk-for-wpa/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Bringing out baby (new and improved)</title>
		<link>http://danielbray.com/blog/coding/bringing-out-baby/</link>
		<comments>http://danielbray.com/blog/coding/bringing-out-baby/#comments</comments>
		<pubDate>Fri, 05 Jan 2007 23:40:17 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
		<guid isPermaLink="false">http://danielbray.com/blog/?p=9</guid>
		<description><![CDATA[UPDATE: I’ve had some trouble getting people to use this because, well, it was hard to use; so I changed it about a little: now it uses MySQL rather than XML to store the locations, and there’s a new, web-based, method for creating new locations.
I’ve been playing with PHP (fun) and google maps (more fun) [...]]]></description>
			<content:encoded><![CDATA[<div class="itemtext"><strong>UPDATE:</strong> I’ve had some trouble getting people to use this because, well, it was hard to use; so I changed it about a little: now it uses MySQL rather than XML to store the locations, and there’s a new, web-based, method for creating new locations.<br />
<hr />I’ve been playing with PHP (fun) and google maps (more fun) and my <a href="http://www.braindelay.com/martha">daughter </a>(most fun of all). The results, can be found here: <a href="http://www.braindelay.com/baby/outside/">http://www.braindelay.com/baby/outside/</a>. Enjoy, and feel free to contribute. If you like this: <a href="http://braindelay.com/brainblog/wp-content/uploads/2007/01/baby-outside-mysql.zip">the source is available here</a>, feel free to play with it (some of it <em>is </em>third party).</div>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/bringing-out-baby/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Trying out a bugfix in Eclipse without redeploying your application.</title>
		<link>http://danielbray.com/blog/coding/eclipse-bugfixing/</link>
		<comments>http://danielbray.com/blog/coding/eclipse-bugfixing/#comments</comments>
		<pubDate>Wed, 20 Dec 2006 22:05:28 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
	<category>eclipse</category>
		<guid isPermaLink="false">http://danielbray.com/blog/coding/trying-out-a-bugfix-in-eclipse-without-redeploying-your-application/</guid>
		<description><![CDATA[Sometimes, when you&#8217;re debugging your application in eclipse, you see where you&#8217;ve made a mistake in your code, and that if you had assigned some variable differently, or had invoked some operation a bit earlier, your code would work. Trouble is, you&#8217;re not completely sure, and you don&#8217;t want to have to shut down your [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, when you&#8217;re debugging your application in eclipse, you see where you&#8217;ve made a mistake in your code, and that if you had assigned some variable differently, or had invoked some operation a bit earlier, your code would work. Trouble is, you&#8217;re not <strong>completely sure</strong>, and you don&#8217;t want to have to shut down your application, make your change, rebuild your jars, redeploy your jars, and then restart your application. Which is a lot to ask.</p>
<p>Well, if you&#8217;re running your application in eclipse, you might be able to try out your fix first, without needing to redeploy everything to find out that you were wrong, &#8217;cause lets be honest here, the first time you try something, it usually blows.</p>
<p>How? This is easiest done with an example:</p>
<p>Consider this &#8220;application&#8221;</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">
public class Plaything {
  public static void main(String[] args) {
    for (int i=0; i!= 5; i++) {
      doIt("monkey");
    }
  }

  static void doIt(String primate) {
    System.out.println(primate);
  }
}</pre>
<p>If you run this, it will output the following:</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">monkey
monkey
monkey
monkey
monkey</pre>
<p>Now, suppose you find out during debug, that you set the wrong parameter, and that perhaps the word &#8220;monkey&#8221; shouldn&#8217;t have been in there, and you want too see what would happen if you had passed a different parameter into <em>doIt(String)</em>, &#8220;gorilla&#8221; perhaps.</p>
<p>What you can do is this:</p>
<ul>
<li>Set a breakpoint on the first line of <em>doIt</em>.</li>
<li>Right click the breakpoint, and edit the &#8220;Breakpoint Properties&#8221;</li>
<li>Check the &#8220;Enable condition&#8221; checkbox, and drop in the following code</li>
</ul>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">primate = "gorilla";
return false;</pre>
<p><br clear="all" /> What we&#8217;re trying to do here is invoke some code in the breakpoint condition, every time eclipse gets to this point, but to make sure that the debugger doesn&#8217;t stop the execution. It works because of the following:</p>
<ul>
<li>You can execute any code fragment you want in here, so long as the java is correct and the variables are in scope. In this case we change the value of the &#8220;primate&#8221; parameter, but you can pretty much do whatever you want, although inside of inner classes the parameter/field names will not be the same as they appear in code.</li>
<li>The <strong>return false;</strong> is important, it&#8217;s there so that the condition is never true, and so eclipse won&#8217;t stop on the breakpoint. If we returned <strong>true</strong> from this fragment then eclipse would stop on this breakpoint every time we hit it, and that&#8217;s what we&#8217;re trying to avoid.</li>
</ul>
<p>The output of this code is as follows</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">gorilla
gorilla
gorilla
gorilla
gorilla</pre>
<p>Is that all you can do? No wait&#8230; there&#8217;s more.  Here&#8217;s a more complicated &#8220;application,&#8221; it&#8217;s so complicated that it breaks.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">/**
* A simple enough class to demonstrate what
* we can do with breakpoint fragments
*/
public class Plaything {
  /**
  * A string value for later comparison. It's private
  * with no accessor, so I'll be forced to do some gymnastics
  * to get at it.
  */
  private String primate;

  /**
  * Create and populate the primate with the constructor
  * @param primate
  */
  Plaything(String primate) {
    this.primate = primate;
  }

  /**
  * Is the candidate string the same as the one we
  * passed in the constructor
  * @param candidate
  * @return
  */
  boolean isSame(String candidate) {
    return primate.equals(candidate);
  }

  /**
  * This will fail on an NullPointerException
  * because we created the plaything with a null
  * field
  * @param args
  */
  public static void main(String[] args) {
    Plaything plaything = new Plaything(null);
    System.out.println("Is it a monkey? " + plaything.isSame("monkey"));
    System.out.println("Is it a gorilla? " + plaything.isSame("gorilla"));;
  }
}</pre>
<p>We create a <strong>Plaything</strong> with a <strong>null</strong> <em>primate</em>, and then later try to compare this with <em>&#8220;monkey&#8221;</em> the result is the all too familiar.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">Exception in thread "main" java.lang.NullPointerException
  at com.braindelay.Plaything.isSame(Plaything.java:39)
  at com.braindelay.Plaything.main(Plaything.java:50)</pre>
<p>Now, suppose we put a breakpoint on this line:</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">System.out.println("Is it a monkey? " + plaything.isSame("monkey"));</pre>
<p>&#8230; and added this breakpoint condition</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">java.lang.reflect.Field field = Plaything.class.getDeclaredField("primate");
field.setAccessible(true);
field.set(plaything, "gorilla");
return false;</pre>
<p>If we run this in <strong>debug</strong> mode now, we get the following output:</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">Is it a monkey? false
Is it a gorilla? true</pre>
<p>Now, I&#8217;m aware that since Plaything is in the same class as the <strong>main</strong> operation, so we could have just accessed <em>primate</em> directly, but I was trying to make a point here: the code fragment that you put into the breakpoint condition can be pretty much anything you want; just make sure you return a <strong>false</strong> at the end of it.</p>
<hr />
<p>
So, the object of this lesson is that although you&#8217;re eventually going to have to fix the code <em>properly</em>, you can try things out on a running system without needing to take it down and recompile it to do so.
</p>
<p>
Enjoy.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/eclipse-bugfixing/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Rails Toolkit</title>
		<link>http://danielbray.com/blog/ruby-on-rails/toolkit/</link>
		<comments>http://danielbray.com/blog/ruby-on-rails/toolkit/#comments</comments>
		<pubDate>Sun, 10 Dec 2006 19:50:03 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>Ruby on Rails</category>
		<guid isPermaLink="false">http://danielbray.com/blog/ruby-on-rails/toolkit/</guid>
		<description><![CDATA[This is part of my Ruby on Rails project.

Once I figured out what I wanted to do, I guess I had to figure out how I was going to do it.

InstantRails: kind of like xampp, but for rails. It&#8217;s a simple-to-use installation of rails that comes with a deployment of MySQL that works out of [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part of my <strong><a href="http://danielbray.com/blog/ruby-on-rails/">Ruby on Rails</a> </strong>project.</em></p>
<p><a id="more-16"></a></p>
<p>Once I figured out what I wanted to do, I guess I had to figure out how I was going to do it.</p>
<ul>
<li><a href="http://instantrails.rubyforge.org/wiki/wiki.pl"><strong>InstantRails</strong></a>: kind of like <a href="http://www.apachefriends.org/en/xampp.html">xampp</a>, but for rails. It&#8217;s a simple-to-use installation of rails that comes with a deployment of MySQL that works out of the box. I&#8217;ve been playing with this for a while now and it&#8217;s pretty easy to use. So easy, in fact, that it just worked without my needing to <em>do </em>anything.</li>
<li>I do my actual coding in <a href="http://www.eclipse.org/">eclipse</a>, using these two ruby plugins:</li>
<ul>
<li><a href="http://rubyeclipse.sourceforge.net/"><strong>RDT</strong></a>: update site (<a href="http://updatesite.rubypeople.org/release">http://updatesite.rubypeople.org/release</a>).<a href="http://updatesite.rubypeople.org/release"><br />
</a></li>
<li><a href="http://www.radrails.org/"><strong>RadRails</strong></a>:update site (<a href="http://radrails.sourceforge.net/update">http://radrails.sourceforge.net/update</a>).</li>
</ul>
<li>I&#8217;m doing my user authentication with the <a href="http://wiki.rubyonrails.org/rails/pages/LoginGenerator">LoginGenerator </a>gem.</li>
</ul>
<p>I keep track of any other bits and bobs I find interesting on this subject in del.icio.us at <a href="http://del.icio.us/braindelay/ruby">http://del.icio.us/braindelay/ruby</a>.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/ruby-on-rails/toolkit/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>What is my Rails project going to do?</title>
		<link>http://danielbray.com/blog/ruby-on-rails/what-it-is/</link>
		<comments>http://danielbray.com/blog/ruby-on-rails/what-it-is/#comments</comments>
		<pubDate>Sun, 03 Dec 2006 18:48:49 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>Ruby on Rails</category>
		<guid isPermaLink="false">http://danielbray.com/blog/2006/12/03/what-it-is/</guid>
		<description><![CDATA[This is part of my Ruby on Rails project. 

I guess the first thing you need to do before you do something is decide what it is you want to do.
That sounded a bit like humpty-dumpty, didn&#8217;t it.
Anyway, I wanted to do something realistic, so I would have to learn how real programs work, and [...]]]></description>
			<content:encoded><![CDATA[<p><em>This is part of my <strong><a href="http://danielbray.com/blog/ruby-on-rails/">Ruby on Rails</a> </strong>project. </em></p>
<p><a id="more-15"></a></p>
<p>I guess the first thing you need to do before you do something is decide what it is you want to do.</p>
<p>That sounded a bit like humpty-dumpty, didn&#8217;t it.</p>
<p>Anyway, I wanted to do something realistic, so I would have to learn how <em>real </em>programs work, and also something with a little twist, so that there would be some actual <em>coding </em>involved, and not just a lot of integration.</p>
<p>I&#8217;ve also decided, when this is all over, to push this up onto sourceforge, &#8217;cause I figure that if this open source it&#8217;ll force me to try to write good code, rather than cheap, and nasty hacks, just to get it finished.</p>
<p>What I&#8217;m not trying to is come up with anything new, so, well, I&#8217;m writing a kind of <em>collaborative blog</em>. Right now, I&#8217;m thinking of calling it <strong>cauliflower</strong>, but I&#8217;m not married to it.</p>
<p>I <em>really </em>hate cauliflower.</p>
<p>So, what do I mean by <em>collaborative blog</em>?</p>
<p><!--more--> I mean this:</p>
<ol>
<li>Anyone can read it and sign up to write to it.</li>
<li>Each user has their own personal blog, and all posts are open to comment by other signed-up users.</li>
<li>When a user writes a post, or makes a comment, then that <em>document </em>will be marked with one or more tags (very web 2.0).</li>
<li>When a post or comment is rendered by the blog, then any word in that document that corresponds to any tag (created by any user) will link to the results of a search of all documents created with that tag. The results can be sorted by:</li>
<ol>
<li>Most recently added document first.</li>
<li>Most read document first.</li>
<li>The document which was written by the most active user first. By active I mean who writes the most documents on this topic.</li>
<li>The document which was written by the most read user first. By most read, I mean which user has written the most documents on this topic, and that have been read most.</li>
</ol>
<li>The home page will be split up into three sections: posts; users; tags.</li>
<ol>
<li>Posts can be sorted:</li>
<ol>
<li>Most recently added first.</li>
<li>Most read first.</li>
<li>Most popular author first.</li>
<li>These searches can also be filtered by topic (i.e. tag).</li>
<li>Clicking a post will take you to that post.</li>
<li>Clicking a comment will take you to that comment.</li>
</ol>
<li>Users can be sorted:</li>
<ol>
<li>Most read first.</li>
<li>Most active first.</li>
<li>These searches can also be filtered by topic (i.e. tag).</li>
<li>Clicking a user will take you to their personal blog.</li>
</ol>
<li>Tags can be sorted by:</li>
<ol>
<li>Most recently added first.</li>
<li>Most popular (over all time).</li>
<li>Most popular (today, last week, last month, last year).</li>
<li>Clicking a tag will take you you the same search results that the in-document link would take you to (see 4. above).</li>
</ol>
</ol>
<li>From the main page you will be able to search posts by tag. The tag search will be sortable in the same way as the in-document link results (see 4. above).</li>
<li>From the main page you will be able to search posts by plain text. The results will be sortable by:</li>
<ol>
<li>Best match (exact string match/most words/best hit count).</li>
<li>Where many documents are matched, order them by the most popular author of those documents&#8217; topics (i.e. who has written the most popular documents in that topic). This could be tricky.</li>
</ol>
</ol>
<p><!--more--></p>
<p>So, the plan is to create a big matrix of interconnected documents, where the search attempts to take you to the user who is the most active and most popular author in that field.</p>
<p>Personally, I&#8217;m no fan of wikipedia, so as a tool I would have no respect for this in the real world. I think democracy is not good for expertise; mediocrity maybe, but not expertise.</p>
<p>Still, it&#8217;s a hard enough project, so by the end of it I should know what I&#8217;m doing.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/ruby-on-rails/what-it-is/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Ruby on Rails Project</title>
		<link>http://danielbray.com/blog/ruby-on-rails/ruby-on-rails-project/</link>
		<comments>http://danielbray.com/blog/ruby-on-rails/ruby-on-rails-project/#comments</comments>
		<pubDate>Thu, 23 Nov 2006 22:57:24 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>Ruby on Rails</category>
		<guid isPermaLink="false">http://danielbray.com/blog/2006/11/23/ruby-on-rails-project/</guid>
		<description><![CDATA[Right, so I wanted to learn that whole Ruby on Rails thing, and I figured the best thing to do would be to throw myself in at the deep(ish) end and do something big(ish).
So, the plan is to do some kind of automatically cross-referenced bloggy/wiki kind of thing; where people can log in, create/edit articles, [...]]]></description>
			<content:encoded><![CDATA[<p>Right, so I wanted to learn that whole <a href="http://www.rubyonrails.org/">Ruby on Rails</a> thing, and I figured the best thing to do would be to throw myself in at the deep(ish) end and do something big(ish).</p>
<p>So, the plan is to do some kind of automatically cross-referenced bloggy/wiki kind of thing; where people can log in, create/edit articles, give these articles tags, and then, whenever any article contains these tags, have them link automatically into each other.</p>
<p>I figured that this would be simple enough that it wouldn&#8217;t take too long to do, and be complicated enough that I would actually learn something from it, namely:</p>
<ul>
<li>User management.</li>
<li>Session management.</li>
<li>Database management.</li>
<li>And some (slightly) complicated GUI rendering.</li>
</ul>
<p>I figured that this would be enough to be getting on with, and that I should have some idea of how Ruby on Rails works.</p>
<p><a id="more-14"></a> As I go along, I&#8217;ll be keeping track of any interesting Ruby/Rails links I find on <a href="http://del.icio.us/braindelay/ruby">http://del.icio.us/braindelay/ruby</a>, but for now, this is what I&#8217;m looking at to do this:</p>
<ul>
<li><a href="http://instantrails.rubyforge.org/wiki/wiki.pl">InstantRails </a>is a bondoogle that will allow you to get up and running pretty quickly, and will have you writing your hello world in about five minutes.</li>
<li>OnLamp have a good tutorial called <a href="http://www.onlamp.com/pub/a/onlamp/2005/01/20/rails.html">Rolling with Ruby on Rails</a> that&#8217;ll have you doing database interactions five minutes later.</li>
</ul>
<p>Thats all for now, I don&#8217;t have a design in my head for this yet, but I do have requirements (kind of) which is always a good start.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/ruby-on-rails/ruby-on-rails-project/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>WiFi encryption: how to make a good PSK for WPA</title>
		<link>http://danielbray.com/blog/coding/good-key-generation-for-wireless-encryption/</link>
		<comments>http://danielbray.com/blog/coding/good-key-generation-for-wireless-encryption/#comments</comments>
		<pubDate>Sun, 16 Jul 2006 20:30:19 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
	<category>home network</category>
		<guid isPermaLink="false">http://danielbray.com/blog/?p=7</guid>
		<description><![CDATA[Updated: I&#8217;ve rejigged all of this into a public, automatic key generator, that you can see here: http://www.danielbray.com/php/keygen/.

I got a broadband a while back, and it came with a wireless router, which was just enough to tip my natural anxiety over into full-blown paranoia.
So, I spent a bit of time investigating how safe I could [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Updated</strong>: I&#8217;ve rejigged all of this into a public, automatic key generator, that you can see here: <a href="http://www.danielbray.com/php/keygen/?min=33&#038;max=126&#038;length=63">http://www.danielbray.com/php/keygen/</a>.</p>
<p><a id="more-7"></a><br />
I got a broadband a while back, and it came with a wireless router, which was just enough to tip my natural anxiety over into full-blown paranoia.</p>
<p>So, I spent a bit of time investigating how safe I could make my router and I came up with the following. I won&#8217;t go into too much detail, because people who know more about this have already done that <a href="http://www.informit.com/articles/article.asp?p=27666&#038;rl=1">here</a>, and <a href="http://www.ciscopress.com/articles/article.asp?p=369221&#038;seqNum=1&#038;rl=1">here</a>.</p>
<p>First you need to hide your SSID and limit your network access to specific MAC addresses. This won&#8217;t do a huge amount to protect your network, but it will, at least, prevent your neighbours from using up your bandwidth since it would only take a wireless-enabled laptop to be switched on near your router for your network to be compromised. It&#8217;s not a <em>real</em> safety measure since the wi-fi protocol requires that the SSID be broadcast occasionally, and it&#8217;s actually pretty easy to sniff this out and instruct your network card to identify itself with a different MAC address.</p>
<p>So the only real way to secure your network is to encrypt the traffic so that nobody can read what your up to, won&#8217;t be able to read your personal data and won&#8217;t be able to join your network.</p>
<p>If you&#8217;re doing this at home (as I am) then you&#8217;re pretty much going to be restricted to using either <strong>WEP</strong> or <strong>WPA-PSK</strong>. Both are crackable, but <strong>WEP</strong> is fundamentally flawed, whereas <strong>WPA-PSK</strong> is only really broken if your pre-shared key is too small. You&#8217;re going to hear a lot of noise that <strong>WPA-PSK</strong> is &#8220;easy&#8221; to crack, but if you do it right you&#8217;re pretty safe.</p>
<p>If your pre-shared key is &#8220;presharedkey&#8221; then you deserve whatever you get.</p>
<p>So, what&#8217;s a <em>good</em> pre-shared key? It&#8217;s simple enough: it needs to be as long as possible, from as large an alphabet as possible, and to be as random as possible.</p>
<p>What you don&#8217;t want to do is to use anything approaching a natural language, there are too many tools out there like <a href="http://www.openwall.com/john/">john the ripper</a> that are just far too good at breaking keys like this. Luckily, a network pre-shared key doesn&#8217;t need to be able to be remembered: you&#8217;re not going to be typing this in every time you &#8220;log in,&#8221; you&#8217;re only going to have to type this in once when you set up your network connection.</p>
<p>So, what to do? First you need a whole bunch of random numbers. That is, <strong>real</strong> random numbers, and not numbers generated by software (<a href="http://mindprod.com/jgloss/pseudorandom.html">they&#8217;re not really random</a>). I get my random numbers from <a href="http://www.random.org">http://www.random.org</a>, who get their random numbers by pointing an antenna at the sky and reading the satic, which is about as random as you can get.</p>
<p>The next thing to do is to turn these numbers into a string that you can paste into your router/clients. I did it with a bit of java. It&#8217;s in java 1.5, but if you use earlier versions there&#8217;s only the tinest bit of auto-boxing, so it&#8217;s trivial to retrofit it.</p>
<p>The first thing I needed to do was to get random.org to give me the numbers I needed in as simple a format as they could. Luckily, it turned out to be trivial to get it to return a plain list of numbers, one per line. All I needed to do was to open the following URL and read what it gave me.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">http://www.random.org/cgi-bin/randnum?num=100&#038;min=1&#038;max=10&#038;col=1</pre>
<p>The above example will return 100 numbers (num=100) between 1 (min=1) and 10 (max=10). It was a simple task to get this to return the numbers I wanted. All I had to do then was to figure out what were the numbers I wanted.</p>
<p>The best advice I can find out there is that the pre-shared key should be at least 20 characters, but if you make it longer you should: I made mine as big as I could, at 63 characters. The next thing I needed to worry about was how to turn these numbers into a string.</p>
<p>This is very easy, it&#8217;s just case of turning these numbers into <a href="http://www.lookuptables.com/">ASCII characters</a>. I wanted to make my pre-shared key as complex, and as hard to crack as possible, which meant I needed to make the alphabet as larges as possible. This turned out to be all the characters between 33 (&#8221;<strong>!</strong>&#8220;) and 126 (&#8221;<strong>-</strong>&#8220;), but your own router might not allow this range.</p>
<p>So, first you need to create your URL to poke at random.org.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">// how long should the password be
int passwordLength = 63;

// What's the minimum ASCII character allowed in the password
int minCharacter = 33;

// What's the maximum ASCII character allowed in the password
int maxCharacter = 126;

// this URL will return a plaintext page of numbers, between
// min and max, one per line
String unformattedUrlString =
"http://www.random.org/cgi-bin/randnum?num={0}&#038;min={1}&#038;max={2}&#038;col=1";

String formattedUrlString = MessageFormat.format(
unformattedUrlString,
new Object[]{
passwordLength,
minCharacter,
maxCharacter
}
);

URL url = new URL(formattedUrlString);</pre>
<p>Now you want to open a connection to this URL, read the data, and turn it int a list of numbers.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">private List getNumbers(URL url) throws IOException {
BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream()));

List keyElements = new ArrayList();
while (true) {
final String read = in.readLine();
if (read == null) {
break;
} else {
int value = (int)Integer.parseInt(read);
keyElements.add(value);
}
}

return keyElements;
}</pre>
<p>Now you want to turn this list of numbers into a string.</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">private String getPasswordFromNumbers(List elements) {

StringBuffer buffer = new StringBuffer();
for (Integer element : elements) {
char character = (char)element.intValue();
buffer.append(character);
}

String password = buffer.toString();
return password;
}</pre>
<p>This pre-shared key is strong. At 94<sup>63</sup> combinations (that&#8217;s about one and a half times as many protons and neutrons there are in the <em>whole</em> universe) it&#8217;s stronger than anything you&#8217;re ever liable to actually need, so until someone finds the same kind of deep flaw in <strong>WPA-PSK</strong> that they found in <strong>WEP</strong> your network encryption should be good enough to be getting on with.</p>
<p>If you don&#8217;t want to go to the effort of writing this up yourself then you can grab the <a href="http://www.danielbray.com/published/wpa.jar">wpa.jar</a> from here. The jar contains the source and the javadocs too. If you want to run it, then just go:</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">java -jar wpa.jar</pre>
<p>The output is like this:</p>
<pre style="border: 1px solid black; margin: 10px; padding: 10px; background: #f7f7f7 none repeat scroll 0% 50%; color: black; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">cnMpO'5s:_=?[z42L25C`Sro"~ke27</pre>
<p>Enjoy your safe networking! Let me know how it works out.
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/good-key-generation-for-wireless-encryption/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Struts: avoiding some common problems</title>
		<link>http://danielbray.com/blog/coding/struts-avoiding-some-common-problems/</link>
		<comments>http://danielbray.com/blog/coding/struts-avoiding-some-common-problems/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 18:22:18 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
		<guid isPermaLink="false">http://danielbray.com/blog/?p=6</guid>
		<description><![CDATA[A lot of what I do is web-applications, and the framework for serving up these web-applications that I’ve chosen to work with has been tomcat and struts: tomcat serves up the pages; struts organizes and controls the flow of the web-app. This essay is about struts, and how to avoid some of the pitfalls that [...]]]></description>
			<content:encoded><![CDATA[<div class="itemtext">A lot of what I do is web-applications, and the framework for serving up these web-applications that I’ve chosen to work with has been tomcat and struts: tomcat serves up the pages; struts organizes and controls the flow of the web-app. This essay is about struts, and how to avoid some of the pitfalls that a novice can fall into… that I fell into, and trust me, you wouldn’t like it down here.<a target="essay" href="http://braindelay.com/danielbray/struts-top-tips/stt.html">Struts: avoiding some common problems</a></div>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/struts-avoiding-some-common-problems/feed/</wfw:commentRSS>
		</item>
		<item>
		<title>Object-oriented programming: rarer than you think</title>
		<link>http://danielbray.com/blog/coding/object-oriented-programming-rarer-than-you-think/</link>
		<comments>http://danielbray.com/blog/coding/object-oriented-programming-rarer-than-you-think/#comments</comments>
		<pubDate>Sat, 15 Jul 2006 18:17:24 +0000</pubDate>
		<dc:creator>danielbray</dc:creator>
		
	<category>coding</category>
		<guid isPermaLink="false">http://danielbray.com/blog/?p=4</guid>
		<description><![CDATA[Object-oriented languages are well known, and are part of every college CS syllabus: object-oriented programming is, however, as rare as the penny black. This is a short(-ish) essay on the subtleties of the paradigm that tend to be overlooked in the speedy twelve-week OO programming course that gets thrown at college students.
 Object-oriented programming: rarer [...]]]></description>
			<content:encoded><![CDATA[<div class="itemtext">Object-oriented languages are well known, and are part of every college CS syllabus: object-oriented <em>programming</em> is, however, as rare as the penny black. This is a short(-ish) essay on the subtleties of the paradigm that tend to be overlooked in the speedy twelve-week OO programming course that gets thrown at college students.</div>
<p><a target="essay" href="http://braindelay.com/danielbray/endangered-object-oriented-programming/oo.html"> Object-oriented programming: rarer than you think</a>
</p>
]]></content:encoded>
			<wfw:commentRSS>http://danielbray.com/blog/coding/object-oriented-programming-rarer-than-you-think/feed/</wfw:commentRSS>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 1.013 seconds -->
<!-- Cached page served by WP-Cache -->
