<?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>Plan Zero Blog</title>
	<atom:link href="http://blog.planzero.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.planzero.org</link>
	<description>Mind dump</description>
	<lastBuildDate>Sat, 05 Sep 2009 17:29:18 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Book review: Ender&#8217;s Game</title>
		<link>http://blog.planzero.org/2009/09/book-review-enders-game/</link>
		<comments>http://blog.planzero.org/2009/09/book-review-enders-game/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 17:27:04 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Book Reviews]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=281</guid>
		<description><![CDATA[<p>I&#8217;d had <em><a href="http://www.amazon.co.uk/gp/product/185723720X?ie=UTF8&#038;tag=planzero-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=185723720X">Ender&#8217;s Game</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=planzero-21&#038;l=as2&#038;o=2&#038;a=185723720X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></em> by <a href="http://www.hatrack.com/">Orson Scott Card</a> on my list of books to read for a while, but a friend of mine persuaded me to bump it up to the top. And I&#8217;m glad she did, for it is, as she described it, <em>&#8220;like crack on paper&#8221;</em>.<br />
<span style="float: left; margin: 1em 2em 1em 0"><a href="http://www.amazon.co.uk/gp/product/185723720X?ie=UTF8&#038;tag=planzero-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=185723720X"><img border="0" src="https://images-na.ssl-images-amazon.com/images/I/41K1R0JKAML._SL160_.jpg"/></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=planzero-21&#038;l=as2&#038;o=2&#038;a=185723720X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></span></p>
<p>The book follows the path of a child, Ender, as he is carefully (and somewhat&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;d had <em><a href="http://www.amazon.co.uk/gp/product/185723720X?ie=UTF8&#038;tag=planzero-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=185723720X">Ender&#8217;s Game</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=planzero-21&#038;l=as2&#038;o=2&#038;a=185723720X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></em> by <a href="http://www.hatrack.com/">Orson Scott Card</a> on my list of books to read for a while, but a friend of mine persuaded me to bump it up to the top. And I&#8217;m glad she did, for it is, as she described it, <em>&#8220;like crack on paper&#8221;</em>.<br />
<span style="float: left; margin: 1em 2em 1em 0"><a href="http://www.amazon.co.uk/gp/product/185723720X?ie=UTF8&#038;tag=planzero-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=185723720X"><img border="0" src="https://images-na.ssl-images-amazon.com/images/I/41K1R0JKAML._SL160_.jpg"></a><img src="http://www.assoc-amazon.co.uk/e/ir?t=planzero-21&#038;l=as2&#038;o=2&#038;a=185723720X" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></span></p>
<p>The book follows the path of a child, Ender, as he is carefully (and somewhat sadistically) crafted into a tool to save the human race from a long feared enemy. Now the thought of a book focusing mostly on a single kid didn&#8217;t really make me think &#8220;ooh, what an exciting concept&#8221;, but Ender is no ordinary kid.</p>
<p>Every child in Ender&#8217;s society is implanted at a young age with a monitoring device through with they are closely observed. The powers that be are always there, watching and feeling; knowing everything that the children know, looking for those special few who can help save the world. And Ender is chosen as the ultimate saviour.</p>
<p>As I read this book, I could feel what Ender was feeling; think as Ender was thinking. Images formed in my mind as vividly as they would were I watching <em>Ender&#8217;s Game, The Film</em>. I found myself unable to put the book down. At times I only stopped because my head started hurting from staring at those yellow-white pages for too long.</p>
<p>The advice of my friend when we first spoke about the book was that if I liked the first chapter, I should buy the next two books in the saga. And I wish I had followed her advice. I now have to wait several days for my copy of <em><a href="http://www.amazon.co.uk/gp/product/1857238575?ie=UTF8&#038;tag=planzero-21&#038;linkCode=as2&#038;camp=1634&#038;creative=6738&#038;creativeASIN=1857238575">Speaker for the Dead</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=planzero-21&#038;l=as2&#038;o=2&#038;a=1857238575" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></em>, and quite frankly, I need my fix.</p>
<p>I highly recommend this book, and if you do buy it, and you do like the first chapter, please, for your own sake, follow my friend&#8217;s advice and buy <em>Speaker for the Dead</em> at the first opportunity!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/09/book-review-enders-game/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>JavaScript Luhn modulus implementation</title>
		<link>http://blog.planzero.org/2009/08/javascript-luhn-modulus-implementation/</link>
		<comments>http://blog.planzero.org/2009/08/javascript-luhn-modulus-implementation/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 21:43:01 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=267</guid>
		<description><![CDATA[<p>The following luhn_check() function is a small JavaScript function which checks whether a number is a valid based on the Luhn algoritm. One common example of use is with credit and debit card numbers. This function may be used to check for valid credit card numbers, however additional checks may be desired, such as card prefix and length checks.</p>
<p>There&#8217;s a&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>The following luhn_check() function is a small JavaScript function which checks whether a number is a valid based on the Luhn algoritm. One common example of use is with credit and debit card numbers. This function may be used to check for valid credit card numbers, however additional checks may be desired, such as card prefix and length checks.</p>
<p>There&#8217;s a <a href="http://planzero.org/bits/example_luhn_check">working example</a> of this function to give you more of an idea of how it works!
<pre></pre>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">/* Luhn algorithm number checker - (c) 2005-2009 - planzero.org            *
 * This code has been released into the public domain, however please      *
 * give credit to the original author where possible.                      */</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> luhn_check<span style="color: #009900;">&#40;</span>number<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #006600; font-style: italic;">//&lt;![CDATA[</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// Strip any non-digits (useful for credit card numbers with spaces and hyphens)</span>
  <span style="color: #003366; font-weight: bold;">var</span> number<span style="color: #339933;">=</span>number.<span style="color: #660066;">replace</span><span style="color: #009900;">&#40;</span><span style="color: #009966; font-style: italic;">/\D/g</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// Set the string length and parity</span>
  <span style="color: #003366; font-weight: bold;">var</span> number_length<span style="color: #339933;">=</span>number.<span style="color: #660066;">length</span><span style="color: #339933;">;</span>
  <span style="color: #003366; font-weight: bold;">var</span> parity<span style="color: #339933;">=</span>number_length <span style="color: #339933;">%</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// Loop through each digit and do the maths</span>
  <span style="color: #003366; font-weight: bold;">var</span> total<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
  <span style="color: #000066; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> number_length<span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> digit<span style="color: #339933;">=</span>number.<span style="color: #660066;">charAt</span><span style="color: #009900;">&#40;</span>i<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #006600; font-style: italic;">// Multiply alternate digits by two</span>
    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>i <span style="color: #339933;">%</span> <span style="color: #CC0000;">2</span> <span style="color: #339933;">==</span> parity<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      digit<span style="color: #339933;">=</span>digit <span style="color: #339933;">*</span> <span style="color: #CC0000;">2</span><span style="color: #339933;">;</span>
      <span style="color: #006600; font-style: italic;">// If the sum is two digits, add them together (in effect)</span>
      <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>digit <span style="color: #339933;">&gt;</span> <span style="color: #CC0000;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        digit<span style="color: #339933;">=</span>digit <span style="color: #339933;">-</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #006600; font-style: italic;">// Total up the digits</span>
    total <span style="color: #339933;">=</span> total <span style="color: #339933;">+</span> parseInt<span style="color: #009900;">&#40;</span>digit<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #006600; font-style: italic;">// If the total mod 10 equals 0, the number is valid</span>
  <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>total <span style="color: #339933;">%</span> <span style="color: #CC0000;">10</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">true</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #006600; font-style: italic;">//]]&gt;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/08/javascript-luhn-modulus-implementation/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>PHP Luhn modulus implementation</title>
		<link>http://blog.planzero.org/2009/08/luhn-modulus-implementation-php/</link>
		<comments>http://blog.planzero.org/2009/08/luhn-modulus-implementation-php/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 21:28:51 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Code Snippets]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=250</guid>
		<description><![CDATA[<p>The following <code>luhn_check()</code> function is a small PHP function which checks whether a number is a valid based on the <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn algorithm</a>. One common example of use is with credit and debit card numbers. This function may be used to check for valid credit card numbers, however additional checks may be desired, such as card prefix and length checks.
<pre></pre>

<pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&#60;?php</span>
<span style="color: #666666; font-style: italic;">/* Luhn&#8230;</span></pre></p>]]></description>
			<content:encoded><![CDATA[<p>The following <code>luhn_check()</code> function is a small PHP function which checks whether a number is a valid based on the <a href="http://en.wikipedia.org/wiki/Luhn_algorithm">Luhn algorithm</a>. One common example of use is with credit and debit card numbers. This function may be used to check for valid credit card numbers, however additional checks may be desired, such as card prefix and length checks.
<pre></pre>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">/* Luhn algorithm number checker - (c) 2005-2008 - planzero.org            *
 * This code has been released into the public domain, however please      *
 * give credit to the original author where possible.                      */</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> luhn_check<span style="color: #009900;">&#40;</span><span style="color: #000088;">$number</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Strip any non-digits (useful for credit card numbers with spaces and hyphens)</span>
  <span style="color: #000088;">$number</span><span style="color: #339933;">=</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/\D/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$number</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Set the string length and parity</span>
  <span style="color: #000088;">$number_length</span><span style="color: #339933;">=</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$number</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$parity</span><span style="color: #339933;">=</span><span style="color: #000088;">$number_length</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// Loop through each digit and do the maths</span>
  <span style="color: #000088;">$total</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #000088;">$number_length</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$digit</span><span style="color: #339933;">=</span><span style="color: #000088;">$number</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$i</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// Multiply alternate digits by two</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$i</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">2</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$parity</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$digit</span><span style="color: #339933;">*=</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">;</span>
      <span style="color: #666666; font-style: italic;">// If the sum is two digits, add them together (in effect)</span>
      <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$digit</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$digit</span><span style="color: #339933;">-=</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
    <span style="color: #666666; font-style: italic;">// Total up the digits</span>
    <span style="color: #000088;">$total</span><span style="color: #339933;">+=</span><span style="color: #000088;">$digit</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #666666; font-style: italic;">// If the total mod 10 equals 0, the number is valid</span>
  <span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$total</span> <span style="color: #339933;">%</span> <span style="color: #cc66cc;">10</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> ? <span style="color: #009900; font-weight: bold;">TRUE</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/08/luhn-modulus-implementation-php/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>An introduction to the vi editor</title>
		<link>http://blog.planzero.org/2009/08/an-introduction-to-the-vi-editor/</link>
		<comments>http://blog.planzero.org/2009/08/an-introduction-to-the-vi-editor/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 18:34:37 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=231</guid>
		<description><![CDATA[<p>Back in 2006 I wrote an article on the vi text editor. While I&#8217;m in the process of rearranging my site, the time seems right to republish the article. Read and enjoy!</p>
<h3>The history of vi</h3>
<p>The vi text editor originated at the University of California in Berkeley. Created by Bill Joy in 1976 as a replacement for the frustrating ed line&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Back in 2006 I wrote an article on the vi text editor. While I&#8217;m in the process of rearranging my site, the time seems right to republish the article. Read and enjoy!</p>
<h3>The history of vi</h3>
<p>The vi text editor originated at the University of California in Berkeley. Created by Bill Joy in 1976 as a replacement for the frustrating ed line editor, it was designed to be usable over a 300 or 1200 baud modem, and as such quickly evolved into a powerful yet light text editing application, cramming functionality into every keystroke.</p>
<p>In a 1999 <a href="http://www.theregister.co.uk/2003/09/11/bill_joys_greatest_gift/">interview</a> talking about what inspired him to write vi, Bill Joy explains:</p>
<blockquote><p>… we got frustrated with the editor we were using which was named ed. ed is certainly frustrating. We got this code from a guy named George Coulouris … called em &#8211; Editor for Mortals &#8211; since only immortals could use ed to do anything. So we modified em and created en. I don&#8217;t know if there was an eo or an ep but finally there was ex. [laughter] I remember en but I don&#8217;t know how it got to ex. So I had a terminal at home and a 300 baud modem so the cursor could move around and I just stayed up all night for a few months and wrote vi.</p></blockquote>
<h3>Why vi?</h3>
<p>Despite its age, vi is still an important tool today. This is demonstrated by the fact that every unix/linux distribution released over the last twenty years is likely to have a copy installed by default. Since the original release of vi, many derivatives have been written (such as vim, vile and elvis), with usability and functionality added along the way. Because of this, vi is probably one of the most evolved and stable text editors in the world.</p>
<p>Many of the more recent vi clones are also intelligent enough to know about the type of document you are editing, and will help you out by automatically indenting your text (in the case of HTML or C, for example) or by highlighting the syntax to make your work much clearer. In the great Unix tradition, features that bug you or help you can be turned on and off at your preference, and spending a few minutes customising vi to your liking can save you hours of work in the long run.</p>
<h3>Operation modes</h3>
<p>Most common text editors have just one mode, and use a menu system or multiple key combinations to allow you to perform functions on your document, such as saving or searching and replacing text. The vi editor has two modes: <em>insert mode</em>, in which text is edited and entered, and <em>command mode</em>, where editing functions and document navigation take place. If this seems strange, don&#8217;t let it put you off; you&#8217;ll get used to the concept fairly quickly!</p>
<p>In <em>command mode</em>, you can tell vi to use any number of functions, from pasting text to quitting or opening up a shell. Most commands in vi are short, and many are single letters. Command mode is also where you enter <em>insert mode</em>. In <em>insert mode</em>, you can only enter text. Nothing more, with the exception of using the backspace key to go back and correct mistakes in the newly entered text. In <em>insert mode</em> you cannot copy and paste, search or save your document.</p>
<p>You will find yourself using both modes extensively in vi, and once you get the hang of using the two modes properly, you will see that you can edit documents much faster than you ever could using your current text editor. Personally, I use vi for almost all of my console-based text editing and coding, including to write this tutorial :-)</p>
<h3>Using modes and adding text</h3>
<p>Okay, enough theory, on to the useful stuff!</p>
<p>When you first fire up vi (by opening up a shell and typing <code>vi</code>), you will be presented with a screen that looks something like this:</p>
<p><code>~<br />
~<br />
~<br />
~<br />
~<br />
~</code></p>
<p>Each tilde represents a line with no content. The tildes are used to distinguish between a line with no content whatsoever, and a blank line; i.e. one with a newline character (what you get when you press<code>enter</code>) but no visible text. When vi first starts up, you will be in <em>command mode</em>. It is important to note that commands in vi are case sensitive &#8211; a lower case i does not do the same thing as an upper case I at all!</p>
<p>To enter some text into the document, start off by typing <code>i</code>, which will put you into <em>insert mode</em>. Everything that you type from now on will be taken as text to be entered into the document. Try typing a few words and practice using the backspace key to modify and type over some of the text.</p>
<p>From <em>insert mode</em>, pressing the escape key will put you back into <em>command mode</em>. Play around with changing modes a few times until you get the hang of it. Now, to quit vi, make sure that you are in <em>command mode</em>, then type <code>:q</code> (colon q) and press enter. This probably won&#8217;t quit as expected, but will give you a warning about the document being unsaved. As we don&#8217;t want to save this document, we can force vi to enact a command without warnings by using the force command. Try typing: <code>:q!</code> (colon q exclamation mark) and pressing enter. The vi editor should now oblige and drop you back to the shell.</p>
<h3>Navigating around</h3>
<p>For those who are used to using the mouse to navigate around documents, you may find navigation in vi a little tricky at first, however the power of the vi navigation commands far outweigh the advantages of using a mouse. To try out some of the navigation methods, it may be best to open a file which already has some content, or to create one to mess around with. You can open an existing file by running <code>vi [filename]</code>, or just fire up vi, enter <em>insert mode</em> and type a few lines of random words.</p>
<p>The navigation keys in vi are as follows:</p>
<ul>
<li>h &#8211; left</li>
<li>j &#8211; down</li>
<li>k &#8211; up</li>
<li>l &#8211; right</li>
</ul>
<p>Easy to remember, huh? Although most modern clones of vi will allow you to use the arrow keys to move around your document in addition to the keys above, it is always good to learn the &#8220;proper&#8221; navigation keys just in case you are stuck using a version of vi that doesn&#8217;t support these more familiar keys. The other advantage of learning and using the keys above is that you spend less time moving your hands away from the centre of the keyboard, thus increasing typing speed. Give it a go!</p>
<p>One of the more useful navigation methods in vi is the search function. When in <em>command mode</em>, simply type <code>/<search pattern></code> (forward slash, then the text you wish to search for) then enter and you will be taken directly to the first match forwards from your current position. To repeat the search forwards, simply type <code>/</code> and hit enter. Searching backwards is also easy; type <code>?</code> instead of <code>/</code> in either of the previous commands. Note that all searches are case sensitive by default; if you want to turn this off, try <code>:set ic</code> before searching.</p>
<p>Something to note when using this search method is that certain characters have special meaning to vi. For example, the full stop character . means match any character. This means that when performing the search /192.168, the string 192.168.1.125 will be matched, but so will 1920168. You can escape these special characters by using a back slash (\). So, to find our first pattern and not the second, we would use /192\.168. For more information, search for regular expressions on <a href="http://en.wikipedia.org/wiki/Regular_expression">Wikipedia</a> or check out Starmerj&#8217;s indispensable <a href="http://web.mit.edu/semenko/Public/regexp.html">RegExp Crib Sheet</a>.</p>
<h3>Editing text</h3>
<p>To recap, when you first start up vi you are put into <em>command mode</em>. From here, you can enter <em>insert mode</em> by typing <code>i</code> and typing away to your heart&#8217;s content. But are there other ways of entering <em>insert mode</em>? And what about editing what you&#8217;ve written? From <em>command mode</em>, you have many options.</p>
<p>As we have already found out, typing <code>i</code> will put us into <em>insert mode</em> at the cursor position. There are also a few other ways of entering <em>insert mode</em>. For example, if you type <code>I</code>, you will enter <em>insert mode</em> at the beginning of the current line. By typing a you will start from the character to the right of the cursor, and by typing A you will start editing at the end of the current line. You can also open an blank line for text below the cursor by typing <code>o</code> and above the cursor by typing <code>O</code>. Give it a try!</p>
<p>You can delete text character by character by placing the cursor in front of the text to be deleted and typing <code>x</code>. To delete text in the other direction (similar to using the backspace key), type <code>X</code>. You can delete a whole line by typing dd, whilst typing dw will delete the next word, and the <code>D</code> command will delete from the cursor to the end of the line.</p>
<p>Deleted too much text? No problem! Just type <code>u</code> to undo the last action, or <code>U</code> to restore the current line. Some clones of vi support multiple levels of undo, so typing <code>u</code> multiple times will take you further back in the history of the document. Make sure you are familiar with the working of these undelete commands, as you will find yourself using them often!</p>
<h3>Copying and pasting</h3>
<p>The vi editor has advanced copy and paste support. Should you need the functionality, vi also makes available multiple named buffers for performing complex copy and paste actions, such as swapping segments of code around without the need to go to and fro multiple times.</p>
<p>As you may have guessed, there are several commands for copying text with vi. Typing <code>yw</code> will copy a word, <code>yy</code> will copy the current line, and <code>y<motion></code> will copy from the cursor to the target motion. For example, to copy from the cursor position to the word <em>blue</em> further down the document, you can type <code>y/blue</code> and press enter, which uses the search syntax as described in the Navigating Around section to move the cursor to its final position. You can use almost any navigation command here!</p>
<p>Pasting the copied text couldn&#8217;t be easier; simply type <code>p</code> to place the text before the cursor, and <code>P</code> to place the text after the cursor. You can, of course, paste copied text multiple times, so this is a handy way of duplicating data.</p>
<p>Using named buffers isn&#8217;t much different from normal copying and pasting &#8211; to copy text into a named buffer, type <code>x[action]</code> where x is the buffer name (a-z), and action is one of the copy actions above, such as yy. To paste text from a named buffer, just type <code>xp</code> or <code>xP</code>, again where x is the name of the buffer. After a little practice, you&#8217;ll be able to copy and paste <em>sans souris</em> in your sleep :-)</p>
<h3>Saving files</h3>
<p>Now that you know how to open documents, add and edit text and navigate around, it&#8217;s probably a good time to learn how to save your masterpiece.</p>
<p>If you started up vi with a filename as a parameter (i.e. vi [filename]), simply typing <code>:w</code> will save the document as filename. If there is a problem writing to the file (such as the file being read-only) and you have the correct permissions, you can force an override by using the ! (exclamation mark) character, like this <code>:w!</code>.</p>
<p>If you want to save another copy of the current document (for example, as a backup), or if you started vi without a filename parameter, you can write to a specifically named file by typing <code>:w [filename]</code>. You can also save typing by using the magic % place-the-current-filename-here variable. For example, typing <code>:w %.bak</code> will save the current document as it&#8217;s current filename with the extension .bak.</p>
<p>To save and quit vi with one command, type either <code>:x</code> or <code>:wq</code>; they both have the same effect. Personally, I prefer the latter, as I find it too easy to confuse <code>:q</code> and <code>:x</code> otherwise. You can also use <code>ZZ</code> (no colon!) to save the current text and exit vi. Again, you can attempt to override any errors by using an exclamation mark at the end of the save command.</p>
<h3>More navigation</h3>
<p>As you may have noticed, there are often many ways of getting a job done in vi. Navigation is no exception, and here to prove it are a few more elegant ways of navigating around your document.</p>
<p>You will no doubt at some point want to edit large files. If scrolling through it line-by-line doesn&#8217;t appeal to your sense of fun, help is at hand! To scroll forwards one screen type <code>ctrl-F</code> and to go backwards one screen type <code>ctrl-B</code>. You can scroll half-pages by typing <code>ctrl-D</code> to go forwards, or <code>ctrl-U</code> to go backwards. To show one more line at the top of the screen, type <code>ctrl-Y</code>, and for one more line at the bottom type <code>ctrl-E</code>.</p>
<p>It&#8217;s also sometimes handy to be able to reposition the page in relation to the cursor. Typing <code>z</code> and then pressing enter will reposition the line with the cursor to the top of the screen. <code>z.</code> will reposition to the middle of the screen, and z- to the bottom of the screen. These functions can be a bit disorientating at first, but don&#8217;t let that put you off!</p>
<p>Yet another handy navigation feature, especially when programming, is the ability to jump to a specific line number within your text. You can do this by typing <code>:[line number]</code> (colon followed by the line number) and pressing enter. For example, typing <code>:32</code> will jump to the beginning of line 32 of your code or text.</p>
<h3>Seek and&#8230; replace</h3>
<p>Did I mention that you can enter <em>insert mode</em> in over-type mode by typing <code>R</code>, or that you can replace a single character by typing <code>r[character]</code>? Well, now you know. But that isn&#8217;t what this part of the tutorial is about.</p>
<p>The search and replace mechanism in vi uses <a href="http://en.wikipedia.org/wiki/Regular_expression">regular expressions</a> and can be made to do some complicated things, such as replacing the second o in the first seven matches of the word potato, or replacing any word containing two Ps with the word parrot. As with the closely related search function mentioned in the Navigating around section, all search operations are case sensitive. Type <code>:set ic</code> to turn this off if it irritates you.</p>
<p>I won&#8217;t delve into the world of regular expressions fully here, as there is far too much to cover in this small space. Suffice it to say that if you can think of an operation involving replacement of text, you can probably do it in vi with a single regexp command.</p>
<p>Basic search and replace operations are fairly easy; typing <code>:s/foo/bar</code> will substitute the word foo with the word bar on the current line. You can specify which portion of the document to search by using <code>:1,4s/foo/bar</code>, which will replace any occurrences on lines 1-4 of the document. If you want to do a search and replace operation globally, <code>:%s/chicken/dog</code> will replace chicken with dog wherever it is written throughout the document, and is the same as typing <code>:1,$s/chicken/dog</code>, where the $ means last line.</p>
<p>If you&#8217;re a bit nervous about accidentally replacing too much text in your document, you can ask vi to prompt you before each replacement is made by adding the <code>/c</code> flag to the end of your search expression, like this <code>:%s/abuot/about/c</code>. To aid with clarity, you can also get vi to print back a copy of each line after it has been modified by adding the <code>/p</code> flag.</p>
<p>Finally, beware of special characters! As mentioned in the Navigating around section, some characters have a special meaning to vi. You can find out more on Wikipedia, or by using your favourite search engine. Just search for regular expressions, regex or regexp!</p>
<h3>Fin</h3>
<p>As I hope this tutorial has shown, vi is an immensely powerful text editor which has an wide range of uses to this day. With a little work and a lot of patience, you too can find the joy of vi! The door has been opened a crack; through it you have seen the tip of the iceberg.</p>
<p>Where you go from here is a choice I leave to you&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/08/an-introduction-to-the-vi-editor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Sounds of the STS-125 SRB Lt Intertank</title>
		<link>http://blog.planzero.org/2009/05/sounds-of-the-sts-125-srb-lt-intertank/</link>
		<comments>http://blog.planzero.org/2009/05/sounds-of-the-sts-125-srb-lt-intertank/#comments</comments>
		<pubDate>Wed, 20 May 2009 16:04:21 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Media]]></category>
		<category><![CDATA[audio]]></category>
		<category><![CDATA[space]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=196</guid>
		<description><![CDATA[<p>Nasa played some launch footage from the latest shuttle &#8211; sent to repair Hubble &#8211; on <a href="http://www.nasa.gov/multimedia/nasatv/index.html">Nasa TV</a> today while <a href="http://www.nasa.gov/mission_pages/shuttle/shuttlemissions/hst_sm4/index.html">the crew</a> have a day off before they return to Earth. Call me a geek, but watching the footage taken from the solid rocket boosters is quite fun.</p>
<img src="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_sm.jpg" alt="The other solid rocket booster" title="sts-125_srb_lt_intertank_sm" width="320" height="240" class="size-full wp-image-214" /><p class="wp-caption-text">Another blurry UFO picture? No, the <i>other</i> solid rocket booster.</p>
<p>The sounds are rather strange, too:</p>
<p><a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_separating.ogg">The tank&#8230;</a></p>]]></description>
			<content:encoded><![CDATA[<p>Nasa played some launch footage from the latest shuttle &#8211; sent to repair Hubble &#8211; on <a href="http://www.nasa.gov/multimedia/nasatv/index.html">Nasa TV</a> today while <a href="http://www.nasa.gov/mission_pages/shuttle/shuttlemissions/hst_sm4/index.html">the crew</a> have a day off before they return to Earth. Call me a geek, but watching the footage taken from the solid rocket boosters is quite fun.</p>
<div id="attachment_214" class="wp-caption alignnone" style="width: 330px"><img src="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_sm.jpg" alt="The other solid rocket booster" title="sts-125_srb_lt_intertank_sm" width="320" height="240" class="size-full wp-image-214" /><p class="wp-caption-text">Another blurry UFO picture? No, the <i>other</i> solid rocket booster.</p></div>
<p>The sounds are rather strange, too:</p>
<p><a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_separating.ogg">The tank separating from the shuttle</a> (.ogg, 176.8 KB)<br />
<a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_wailing.ogg">The tank wailing as it falls back to Earth</a> (.ogg, 327.2 KB)<br />
<a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank_parachuting.ogg">The tank&#8217;s parachutes opening and splashdown</a> (.ogg, 302.6 KB)</p>
<p>I love the second clip, which makes the SRB sound almost alive. If you&#8217;re sad enough, you might want to listen to the <a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_srb_lt_intertank.ogg">full recording</a> (.ogg, 3.0 MB).</p>
<p><b>Bonus track!</b> If you&#8217;re read this far, you deserve it. Another recording I made a day after the above tracks, where an astronaut was asked to to perform a &#8220;cycle of the WCS control handle&#8221; to fix an intermittent valve problem. This is the first time I&#8217;ve heard laughter in the mission control room during a mission. <a href="http://blog.planzero.org/wp-content/uploads/2009/05/sts-125_cycle_the_wcs_control_handle.ogg">The handle used when operating the commode?</a> (.ogg, 588.7 KB)</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/05/sounds-of-the-sts-125-srb-lt-intertank/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>&#8216;No Phorm&#8217; logos</title>
		<link>http://blog.planzero.org/2009/04/no-phorm-logos/</link>
		<comments>http://blog.planzero.org/2009/04/no-phorm-logos/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 14:36:51 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Privacy]]></category>
		<category><![CDATA[phorm]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=151</guid>
		<description><![CDATA[<p>Recently, <a href="http://news.bbc.co.uk/1/hi/technology/7959099.stm">Phorm</a> started operation.</p>
<p>Large websites were urged to opt out, and the wave has started. Amazon.co.uk, for example, have <a href="http://news.bbc.co.uk/1/hi/technology/7999635.stm">told Phorm</a> that they may not use data from their website. The Open Rights Group have <a href="http://www.openrightsgroup.org/2009/04/15/open-rights-group-welcomes-decisions-to-block-phorm/">welcomed the decision</a> of such companies.</p>
<p>In the comments on the Open Rights Group announcement, there were calls to create a logo for websites owners to display to show&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Recently, <a href="http://news.bbc.co.uk/1/hi/technology/7959099.stm">Phorm</a> started operation.</p>
<p>Large websites were urged to opt out, and the wave has started. Amazon.co.uk, for example, have <a href="http://news.bbc.co.uk/1/hi/technology/7999635.stm">told Phorm</a> that they may not use data from their website. The Open Rights Group have <a href="http://www.openrightsgroup.org/2009/04/15/open-rights-group-welcomes-decisions-to-block-phorm/">welcomed the decision</a> of such companies.</p>
<p>In the comments on the Open Rights Group announcement, there were calls to create a logo for websites owners to display to show that they have opted out of Phorm.</p>
<p>I whipped out Gimp and knocked up a few logos quickly, and here they are. I will add logos, and improve on these when I get some spare time.</p>
<div id="attachment_184" class="wp-caption alignnone" style="width: 90px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_opted_out_80x15.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_opted_out_80x15.png" alt="Opted out button" title="phorm_opted_out_80x15" width="80" height="15" class="size-full wp-image-184" /></a><p class="wp-caption-text">Opted out button</p></div>
<div id="attachment_189" class="wp-caption alignnone" style="width: 90px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_no_80x15.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_no_80x15.png" alt="No Phorm button" title="phorm_no_80x15" width="80" height="15" class="size-full wp-image-189" /></a><p class="wp-caption-text">No Phorm button</p></div>
<div id="attachment_164" class="wp-caption alignnone" style="width: 90px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_80x15.png"><img class="size-full wp-image-164" title="no_phorm_80x15" src="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_80x15.png" alt="No Phorm button" width="80" height="15" /></a><p class="wp-caption-text">No Phorm button</p></div>
<div id="attachment_186" class="wp-caption alignnone" style="width: 110px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_opted_out_100x32.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_opted_out_100x32.png" alt="Opted out button" title="phorm_opted_out_100x32" width="100" height="32" class="size-full wp-image-186" /></a><p class="wp-caption-text">Opted out button</p></div>
<div id="attachment_169" class="wp-caption alignnone" style="width: 110px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/say_no_to_phorm_100x32.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/say_no_to_phorm_100x32.png" alt="Say no button" title="say_no_to_phorm_100x32" width="100" height="32" class="size-full wp-image-169" /></a><p class="wp-caption-text">Say no button</p></div>
<div id="attachment_177" class="wp-caption alignnone" style="width: 110px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/we_said_no_to_phorm_100x32.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/we_said_no_to_phorm_100x32.png" alt="We said no button" title="we_said_no_to_phorm_100x32" width="100" height="32" class="size-full wp-image-177" /></a><p class="wp-caption-text">We said no button</p></div>
<div id="attachment_187" class="wp-caption alignnone" style="width: 145px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_we_opted_out_135x45.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_we_opted_out_135x45.png" alt="We opted out" title="phorm_we_opted_out_135x45" width="135" height="60" class="size-full wp-image-187" /></a><p class="wp-caption-text">We opted out</p></div>
<div id="attachment_181" class="wp-caption alignnone" style="width: 145px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_135x45.png"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_135x45.png" alt="No Phorm logo" title="no_phorm_135x45" width="135" height="45" class="size-full wp-image-181" /></a><p class="wp-caption-text">No Phorm logo</p></div>
<div id="attachment_191" class="wp-caption alignnone" style="width: 285px"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_we_said_no_275x40.png" alt="We said no to Phorm" title="phorm_we_said_no_275x40" width="275" height="40" class="size-full wp-image-191" /><p class="wp-caption-text">We said no to Phorm</p></div>
<div id="attachment_160" class="wp-caption alignnone" style="width: 170px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/we_said_no_phorm_160x40.png"><img class="size-full wp-image-160" title="we_said_no_phorm_160x40" src="http://blog.planzero.org/wp-content/uploads/2009/04/we_said_no_phorm_160x40.png" alt="We said no Phorm" width="160" height="40" /></a><p class="wp-caption-text">We said no Phorm</p></div>
<div id="attachment_192" class="wp-caption alignnone" style="width: 130px"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_we_said_no_120x120.png" alt="We said no" title="phorm_we_said_no_120x120" width="120" height="121" class="size-full wp-image-192" /><p class="wp-caption-text">We said no</p></div>
<div id="attachment_150" class="wp-caption alignnone" style="width: 70px"><a href="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_60x40.png"><img class="size-full wp-image-150" title="no_phorm_60x40" src="http://blog.planzero.org/wp-content/uploads/2009/04/no_phorm_60x40.png" alt="No Phorm" width="60" height="40" /></a><p class="wp-caption-text">No Phorm</p></div>
<p>For reference, here is Phorm&#8217;s logo, upon which my design is based:<br />
<div id="attachment_180" class="wp-caption alignnone" style="width: 150px"><img src="http://blog.planzero.org/wp-content/uploads/2009/04/phorm_logo.gif" alt="Phorm logo" title="phorm_logo" width="140" height="43" class="size-full wp-image-180" /><p class="wp-caption-text">Phorm logo</p></div></p>
<p>If you have a logo of your own, give me a shout and I&#8217;ll be happy to add it to the collection. In the mean time, head over to <a href="http://www.openrightsgroup.org/">Open Rights Group</a> and see how you can protect your rights online.</p>
<p>Incidentally, if you would like to opt out your website from scans by Phorm, send an email to <strong>website-exclusion@webwise.com</strong> stating which domains you would like excluded.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/04/no-phorm-logos/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Going space crackers?</title>
		<link>http://blog.planzero.org/2009/04/going-space-crackers/</link>
		<comments>http://blog.planzero.org/2009/04/going-space-crackers/#comments</comments>
		<pubDate>Thu, 09 Apr 2009 10:09:12 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Music Reviews]]></category>
		<category><![CDATA[clawjob]]></category>
		<category><![CDATA[Music]]></category>
		<category><![CDATA[space crackers]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=114</guid>
		<description><![CDATA[<p>Every now and again I have a hunt around the internet for good, free music. At the end of last year I came across a full album &#8211; Space Crackers by <a href="http://clawjob.com/">Clawjob</a>. The album languished on my hard drive until this week, when I started catching up on my backlog of music-that-could-be-good-but-probably-isn&#8217;t-worth-keeping.</p>
<p>I stuck Space Crackers on and was blown away&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Every now and again I have a hunt around the internet for good, free music. At the end of last year I came across a full album &#8211; Space Crackers by <a href="http://clawjob.com/">Clawjob</a>. The album languished on my hard drive until this week, when I started catching up on my backlog of music-that-could-be-good-but-probably-isn&#8217;t-worth-keeping.</p>
<p>I stuck Space Crackers on and was blown away by over an hour of musical genius. Space Crackers isn&#8217;t so much an album as a full <strong><em>science fiction rock opera</em></strong>. By the time I&#8217;d finished listening, I felt as though I had watched an entire musical, well acted and bizarrely twisted.</p>
<p>Here&#8217;s a summary of the plot <a href="http://clawjob.com/music/disco-spacecrackers.htm">as written</a> by the band:</p>
<p><img src="http://clawjob.com/store/thumb_spacecrackers.jpg" width="200" height="176" alt="Space Crackers" style="float: right; padding-left: 2em" /></p>
<blockquote><p>
In the future, the world is at peace, and two of Space School&#8217;s most promising young scientists are to be sent into orbit to discover a solution to global hunger. When one of the scientists can&#8217;t go, his replacement sees the mission as an opportunity to woo his unsuspecting female spacemate. Things get a little awkward when 50 million ravenous aliens land on Earth, hoping to feed on human flesh!</p></blockquote>
<p>This is a tale of disappointment, of war, of love, and of snack food. It is a human story of galactic proportions. The genius of the story is matched only by the epic soundtrack. Listen once and you&#8217;ll find in your mind images of horrors, space stations, test tubes and golden crackers. Mmmm.</p>
<p>The style of the album swings from the smooth tones of <em>Crackers + Chips</em> to the heavy rock chords of <em>Dooks of Doom</em>, to the creepy undertones of <em>Zero Gravity</em>. You even get a peek into the future with <em>(Meanwhile&#8230;) One Hundred Million Years in the Future</em>, of which there is a revealing <a href="http://www.youtube.com/watch?v=ROTFb0XVer8">music video</a> available.</p>
<p>You can download a few of the tracks from <a href="http://www.spacecrackers.com/">www.spacecrackers.com</a>, or find the full album on <a href="http://beta.legaltorrents.com/torrents/145-clawjob---space-crackers">legaltorrents.com</a>. The album is covered by a <a href="http://creativecommons.org/licenses/by-sa/2.5/">Creative Commons Attribution-Share Alike</a> license. Listen, you&#8217;ll be hooked.</p>
<p>Have I gone space crackers? Absolutely.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2009/04/going-space-crackers/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>BBEditor, the free BBCode editor</title>
		<link>http://blog.planzero.org/2008/12/bbeditor-the-free-bbcode-editor/</link>
		<comments>http://blog.planzero.org/2008/12/bbeditor-the-free-bbcode-editor/#comments</comments>
		<pubDate>Thu, 18 Dec 2008 13:23:41 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[Code Projects]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=45</guid>
		<description><![CDATA[<p>Well, I said that I&#8217;d be using this blog to publish code, so here&#8217;s my latest little project.</p>
<p>BBEditor is a <a href="http://en.wikipedia.org/wiki/MIT_License">free</a> BBCode editor written in JavaScript for HTML/PHP. It&#8217;s standards compliant, and really is rather sexy.</p>
<h3>

<dl id="attachment_89" class="wp-caption alignnone" style="width: 310px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-89" title="BBEditor edit bar" src="http://blog.planzero.org/wp-content/uploads/2008/12/bbeditor_bbebar_300x30.png" alt="BBEditor edit bar" width="300" height="30" /></dt>
</dl>

</h3>
<h3>Features:</h3>
<ul>
<li>Easy to integrate</li>
<li>Cross-browser compliant</li>
<li>Degrades wonderfully in old or non-compliant browsers</li>
<li>Sleek code &#8211; fast loading, no bulk, no mess</li>
<li>Easy to style to your needs</li>
<li>Adding additional buttons and&#8230;</li></ul>]]></description>
			<content:encoded><![CDATA[<p>Well, I said that I&#8217;d be using this blog to publish code, so here&#8217;s my latest little project.</p>
<p>BBEditor is a <a href="http://en.wikipedia.org/wiki/MIT_License">free</a> BBCode editor written in JavaScript for HTML/PHP. It&#8217;s standards compliant, and really is rather sexy.</p>
<h3>
<div class="mceTemp">
<dl id="attachment_89" class="wp-caption alignnone" style="width: 310px;">
<dt class="wp-caption-dt"><img class="size-full wp-image-89" title="BBEditor edit bar" src="http://blog.planzero.org/wp-content/uploads/2008/12/bbeditor_bbebar_300x30.png" alt="BBEditor edit bar" width="300" height="30" /></dt>
</dl>
</div>
</h3>
<h3>Features:</h3>
<ul>
<li>Easy to integrate</li>
<li>Cross-browser compliant</li>
<li>Degrades wonderfully in old or non-compliant browsers</li>
<li>Sleek code &#8211; fast loading, no bulk, no mess</li>
<li>Easy to style to your needs</li>
<li>Adding additional buttons and functionality is a sinch!</li>
</ul>
<p>Got you curious? Try the <a href="http://planzero.org/bits/bbeditor_demo/">basic demonstration</a> that comes with BBEditor!</p>
<h3>Download</h3>
<p>Current version: <a title="Download BBEditor" href="http://planzero.org/bits/bbeditor_20081218.tar.bz2">BBEditor v0.1</a></p>
<h3>Integration</h3>
<p>You&#8217;ll like this.</p>
<ol>
<li>Download and extract BBEditor</li>
<li> Add the following two lines to the &lt;head&gt; section of your page:
<pre lang="html" id="line1">&lt;<span class="start-tag">link</span><span class="attribute-name"> href</span>=<span class="attribute-value">"bbeditor.css" </span><span class="attribute-name">rel</span>=<span class="attribute-value">"stylesheet" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/css" </span><span class="error"><span class="attribute-name">/</span></span>&gt;
&lt;<span class="start-tag">script</span><span class="attribute-name"> src</span>=<span class="attribute-value">"bbeditor.js" </span><span class="attribute-name">type</span>=<span class="attribute-value">"text/javascript"</span>&gt;&lt;/<span class="end-tag">script</span>&gt;</pre>
</li>
<li>Add <em>class=&#8221;bbeditor&#8221;</em> to any &lt;textarea&gt; that uses BBCode</li>
</ol>
<p>Yup, that&#8217;s all there is to it. Simple.</p>
<h3>Customisation</h3>
<p>Customising BBEditor is fairly easy. To <strong>edit the styles</strong> associated with the BBEditor bar, you can edit <em>bbeditor.css</em>. The main bar uses a class named <em>bbebar</em>. To keep things simple, you may want to add the contents of <em>bbeditor.css</em> to your main style sheet. This will also cut down on browser traffic.</p>
<p>To <strong>add your own buttons and functionality</strong> to BBEditor, you&#8217;ll have to have a little JavaScript knowhow. You&#8217;ll find that <em>bbeditor.js</em> has a compressed chunk of code at the top; skip this and go to the bottom of the file. This is where the fun stuff is.</p>
<p>The buttons are defined in a <em>Hash</em>, so to make changes locate and alter the following code (this should be fairly self explanatory, so I won&#8217;t go into detail):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Buttons definitions!</span>
bbeButtons<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Hash<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  bold<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Hash<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Embolden Text'</span><span style="color: #339933;">,</span>
    icon<span style="color: #339933;">:</span> bbeSettings.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'imageBase'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'text_bold.png'</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
  italic<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">new</span> Hash<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
    title<span style="color: #339933;">:</span> <span style="color: #3366CC;">'Italicise Text'</span><span style="color: #339933;">,</span>
    icon<span style="color: #339933;">:</span> bbeSettings.<span style="color: #660066;">get</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'imageBase'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'text_italic.png'</span>
  <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
...
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The function to be performed is defined by the target link associated with each button.  This is defined in the <em>bbeButtons</em> hash, so in the above code, <em>italic</em> and <em>bold</em> are the link targets. To add new functionality, add the relevant link target to the <em>switch() </em>statement in the <em>bbeAction()</em> function:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// Perform an action, determined by the href of the followed link</span>
<span style="color: #003366; font-weight: bold;">function</span> bbeAction<span style="color: #009900;">&#40;</span>el<span style="color: #339933;">,</span> et<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
...
  <span style="color: #000066; font-weight: bold;">switch</span><span style="color: #009900;">&#40;</span>action<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'#bold'</span><span style="color: #339933;">:</span>
      et.<span style="color: #660066;">insertAroundCursor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'before'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'[b]'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'after'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'[/b]'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
    <span style="color: #000066; font-weight: bold;">case</span> <span style="color: #3366CC;">'#italic'</span><span style="color: #339933;">:</span>
      et.<span style="color: #660066;">insertAroundCursor</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span><span style="color: #3366CC;">'before'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'[i]'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'after'</span><span style="color: #339933;">:</span> <span style="color: #3366CC;">'[/i]'</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000066; font-weight: bold;">break</span><span style="color: #339933;">;</span>
...
  <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<h3>FAQ</h3>
<p><span style="color: #ff6600;"><strong>Why did you write BBEditor when there are other similar tools?</strong></span></p>
<p>When I was looking for a simple BBCode editor, I found so much messy code that I got fed up and decided to take the time to write my own. Many of the existing editors wouldn&#8217;t create a text input box at all if JavaScript was disabled, or were slow and clunky to use. BBEditor is light, and degrades well. If a user doesn&#8217;t have JavaScript, the input box is still usable without the editing bar.</p>
<p><span style="color: #ff6600;"><strong>My images aren&#8217;t loading! Help!</strong></span></p>
<p>If you have moved the location of the script or the images, the images may not load. Don&#8217;t panic! You can set the base location for the images in <em>bbeditor.js</em>. Just update the <em>imageBase</em> setting in the following block of code:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #006600; font-style: italic;">// General settings</span>
bbeSettings<span style="color: #339933;">=</span><span style="color: #003366; font-weight: bold;">new</span> Hash<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
  position<span style="color: #339933;">:</span> <span style="color: #3366CC;">'before'</span><span style="color: #339933;">,</span>
  imageBase<span style="color: #339933;">:</span> <span style="color: #3366CC;">'icons/'</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p><span style="color: #ff6600;"><strong>Where did you get those great icons, anyway?</strong></span></p>
<p>I have used the fantastic free <a href="http://www.famfamfam.com/lab/icons/silk/" target="_blank">Silk icon set</a>. If you want to add some buttons, I couldn&#8217;t recommend this set of icons enough.</p>
<p><strong><span style="color: #ff6600;">What technology does BBEditor use?</span></strong></p>
<p>BBEditor uses DOM-compliant JavaScript. For compatibility and efficiency reasons I have used code from the <a href="http://mootools.net/" target="_blank">mootools</a> library complimented by the <a href="http://www.clientcide.com/wiki/cnet-libraries/" target="_blank">Clientcide</a> extension for accessing forms. This is all included in <em>bbeditor.js</em>.</p>
<p><span style="color: #ff6600;"><strong>How much does this all cost?</strong></span></p>
<p>Nothing! This is free, open source software, released under the <a href="http://en.wikipedia.org/wiki/MIT_License" target="_blank">MIT License</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2008/12/bbeditor-the-free-bbcode-editor/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
		<item>
		<title>Here goes nothing</title>
		<link>http://blog.planzero.org/2008/12/here-goes-nothing/</link>
		<comments>http://blog.planzero.org/2008/12/here-goes-nothing/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 11:23:39 +0000</pubDate>
		<dc:creator>Plan Zero</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://blog.planzero.org/?p=3</guid>
		<description><![CDATA[<p>Well, I finally got around to setting up a blog. It&#8217;s been a long time coming. I&#8217;m not sure how this is going to turn out, but I do know how it will start.</p>
<p>I&#8217;m going to be making some structure and style changes to Planzero.org in the near future, so just to get things up and running I&#8217;m using a&#8230;</p>]]></description>
			<content:encoded><![CDATA[<p>Well, I finally got around to setting up a blog. It&#8217;s been a long time coming. I&#8217;m not sure how this is going to turn out, but I do know how it will start.</p>
<p>I&#8217;m going to be making some structure and style changes to Planzero.org in the near future, so just to get things up and running I&#8217;m using a mildly modified Wordpress theme, with the intention of integrating the blog with the new site once things have settled.</p>
<p>Initially I&#8217;ll be using this blog to publish code more than anything, but over time I may use it as a place to empty my mind. Who knows, something of use may eventually turn up here :-)</p>
<p>So without further ado, I hereby declare this blog&#8230; <em>open!</em></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.planzero.org/2008/12/here-goes-nothing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
