<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>

<channel>
	<title>Matthew Roper</title>
	<atom:link href="http://mattroper.co.uk/feed/" rel="self" type="application/rss+xml" />
	<link>http://mattroper.co.uk</link>
	<description></description>
	<pubDate>Thu, 05 Jun 2008 08:09:26 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
	<language>en</language>
			<item>
		<title>JavaScript overlay using Prototype and Script.aculo.us</title>
		<link>http://mattroper.co.uk/2008/05/27/javascript-overlay-using-prototype-and-scriptaculous/</link>
		<comments>http://mattroper.co.uk/2008/05/27/javascript-overlay-using-prototype-and-scriptaculous/#comments</comments>
		<pubDate>Tue, 27 May 2008 13:37:55 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[development]]></category>

		<category><![CDATA[javascript]]></category>

		<category><![CDATA[prototype]]></category>

		<category><![CDATA[scriptaculous]]></category>

		<guid isPermaLink="false">http://mattroper.co.uk/?p=8</guid>
		<description><![CDATA[As part of the interface for a web application, I wrote the following code to implement a modal dialogue box in JavaScript (similar to the Lightbox effect).
While there are a few different examples of this effect that I could have used, I was after something straight-forward and lightweight with clear separation of design (CSS) and [...]]]></description>
			<content:encoded><![CDATA[<p>As part of the interface for a web application, I wrote the following code to implement a modal dialogue box in JavaScript (similar to the <a href="http://www.lokeshdhakar.com/projects/lightbox2/">Lightbox</a> effect).</p>
<p>While there are a few different examples of this effect that I could have used, I was after something straight-forward and lightweight with clear separation of design (CSS) and presentation logic (JavaScript).</p>
<pre class="javascript"><span style="color: #003366; font-weight: bold;">function</span> DialogOverlay<span style="color: #66cc66;">&#40;</span>content, container<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
&nbsp;
	<span style="color: #009900; font-style: italic;">// Manage arguments and assign defaults,</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">typeof</span> container == <span style="color: #3366CC;">'undefined'</span> <span style="color: #66cc66;">&#41;</span> container = document.<span style="color: #006600;">body</span>;
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">null</span> == <span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">container</span> = $<span style="color: #66cc66;">&#40;</span>container<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #000066; font-weight: bold;">throw</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;container is not valid&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">// Assign instance variables</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">content</span> = content;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">overlay</span> = <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'div'</span>, <span style="color: #66cc66;">&#123;</span> <span style="color: #3366CC;">'class'</span>: <span style="color: #3366CC;">'overlay'</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span> = <span style="color: #003366; font-weight: bold;">new</span> Element<span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">'div'</span>, <span style="color: #66cc66;">&#123;</span> <span style="color: #3366CC;">'class'</span>: <span style="color: #3366CC;">'dialog'</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">// Hide the overlay when clicked. Ignore clicks on the dialog.</span>
	Event.<span style="color: #006600;">observe</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">overlay</span>, <span style="color: #3366CC;">'click'</span>, <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">hide</span>.<span style="color: #006600;">bindAsEventListener</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	Event.<span style="color: #006600;">observe</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span>, <span style="color: #3366CC;">'click'</span>,  <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span> Event.<span style="color: #000066;">stop</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">// Insert the elements into the DOM</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span>.<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">content</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">container</span>.<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">overlay</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">container</span>.<span style="color: #006600;">insert</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
	<span style="color: #009900; font-style: italic;">// Content may have been hidden if it is embedded in the page</span>
	content.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
DialogOverlay.<span style="color: #006600;">prototype</span>.<span style="color: #006600;">show</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">new</span> Effect.<span style="color: #006600;">Appear</span><span style="color: #66cc66;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">overlay</span>, <span style="color: #66cc66;">&#123;</span> duration: <span style="color: #CC0000;">0.5</span>,  to: <span style="color: #CC0000;">0.8</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span>.<span style="color: #006600;">show</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>;
<span style="color: #66cc66;">&#125;</span>;
DialogOverlay.<span style="color: #006600;">prototype</span>.<span style="color: #006600;">hide</span> = <span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">dialog</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #006600;">overlay</span>.<span style="color: #006600;">hide</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span>;
<span style="color: #66cc66;">&#125;</span>;</pre>
<p>Adding a dialogue object to your page is simple:</p>
<pre class="html4strict"><span style="color: #009900;"><a href="http://december.com/html/4/element/script.html"><span style="color: #000000; font-weight: bold;">&lt;script</span></a> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;text/javascript&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	var dialog = new Element('div');
	dialog.insert(new Element('h2').insert('Dialogue'));
	var overlay = new DialogOverlay(dialog);
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/script&gt;</span></span></pre>
<p>In addition, you'll need some CSS to control the presentation of the overlay and dialogue box:</p>
<pre class="css"><span style="color: #6666ff;">.overlay</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span>: <span style="color: #933;"><span style="color: #933;">100</span>%</span>;
	<span style="color: #000000; font-weight: bold;">height</span>: <span style="color: #933;"><span style="color: #933;">100</span>%</span>;
	<span style="color: #000000; font-weight: bold;">background</span>: <span style="color: #000000; font-weight: bold;">black</span>;
	<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">fixed</span>;
	<span style="color: #000000; font-weight: bold;">top</span>: <span style="color: #933;">0</span>;
	<span style="color: #000000; font-weight: bold;">left</span>: <span style="color: #933;">0</span>;
	<span style="color: #000000; font-weight: bold;">z-index</span>: <span style="color: #933;">98</span>;
<span style="color: #66cc66;">&#125;</span>
<span style="color: #6666ff;">.dialog</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">width</span>: <span style="color: #933;"><span style="color: #933;">50</span>%</span>;
	<span style="color: #000000; font-weight: bold;">min-height</span>: <span style="color: #933;"><span style="color: #933;">50</span>%</span>;
	<span style="color: #000000; font-weight: bold;">background</span>: <span style="color: #993333;">white</span>;
	<span style="color: #000000; font-weight: bold;">position</span>: <span style="color: #993333;">fixed</span>;
	<span style="color: #000000; font-weight: bold;">top</span>: <span style="color: #933;"><span style="color: #933;">25</span>%</span>;
	<span style="color: #000000; font-weight: bold;">left</span>: <span style="color: #933;"><span style="color: #933;">25</span>%</span>;
	<span style="color: #000000; font-weight: bold;">z-index</span>: <span style="color: #933;">99</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>I uploaded the JavaScript class (<a href="/assets/js-overlay/overlay.js">overlay.js</a>) and made a quick <a href="/assets/js-overlay/overlay-test.html">example page</a> to show it working.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattroper.co.uk/2008/05/27/javascript-overlay-using-prototype-and-scriptaculous/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Running Ruby scripts in Apache2</title>
		<link>http://mattroper.co.uk/2008/04/02/running-ruby-scripts-in-apache2/</link>
		<comments>http://mattroper.co.uk/2008/04/02/running-ruby-scripts-in-apache2/#comments</comments>
		<pubDate>Wed, 02 Apr 2008 09:36:00 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[apache]]></category>

		<category><![CDATA[cgi]]></category>

		<category><![CDATA[linux]]></category>

		<category><![CDATA[programming]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mattroper.co.uk/?p=4</guid>
		<description><![CDATA[Instructions for configuring Apache to execute Ruby scripts using CGI. Useful for quickly setting up a test environment for simple scripts.]]></description>
			<content:encoded><![CDATA[<p>Create a directory in your webroot (e.g. <code>/var/www/ruby/</code> on Debian/Ubuntu) to store and execute your Ruby scripts and add the following directives to a <code>.htaccess</code> file in that directory:</p>
<pre class="apache"><span style="color: #00007f;">AddHandler</span> cgi-<span style="color: #00007f;">script</span> .rb
<span style="color: #00007f;">Options</span> +ExecCGI</pre>
<p>Note: these directives can (and should) be specified in the Apache sites configuration file if you have permission to edit it.</p>
<p>To test that files in the created directory are being properly executed, copy (or <a title="Simple Ruby test script" href="http://mattroper.co.uk/assets/test.rb">download</a>) the following code into a file named <code><a title="Simple Ruby test script" href="http://mattroper.co.uk/assets/test.rb">test.rb</a></code> within the directory:</p>
<pre class="ruby"><span style="color:#008000; font-style:italic;">#!/usr/bin/env ruby</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">&quot;cgi&quot;</span>
cgi = <span style="color:#CC00FF; font-weight:bold;">CGI</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">&quot;html4&quot;</span><span style="color:#006600; font-weight:bold;">&#41;</span>
cgi.<span style="color:#9900CC;">out</span><span style="color:#006600; font-weight:bold;">&#123;</span>
  cgi.<span style="color:#9900CC;">html</span><span style="color:#006600; font-weight:bold;">&#123;</span>
    cgi.<span style="color:#9900CC;">head</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span>+cgi.<span style="color:#9900CC;">title</span><span style="color:#006600; font-weight:bold;">&#123;</span><span style="color:#996600;">&quot;Ruby is working!&quot;</span><span style="color:#006600; font-weight:bold;">&#125;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> +
    cgi.<span style="color:#9900CC;">body</span><span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span>+
      cgi.<span style="color:#9900CC;">h1</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;Ruby is working!&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span> + <span style="color:#996600;">&quot;<span style="color:#000099;">\n</span>&quot;</span>+
      cgi.<span style="color:#CC0066; font-weight:bold;">p</span> <span style="color:#006600; font-weight:bold;">&#123;</span> <span style="color:#996600;">&quot;Now it's time to get on with some real work.&quot;</span> <span style="color:#006600; font-weight:bold;">&#125;</span>
    <span style="color:#006600; font-weight:bold;">&#125;</span>
  <span style="color:#006600; font-weight:bold;">&#125;</span>
<span style="color:#006600; font-weight:bold;">&#125;</span></pre>
<p>Change the permissions on your file so that it is executable (<code>chmod 774</code> should work fine) and visit the page you created (e.g. <code>http://example.com/ruby/test.rb</code>) with a web browser. </p>
<p>Hopefully, you should see a successful Ruby test page.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattroper.co.uk/2008/04/02/running-ruby-scripts-in-apache2/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Encoding QR Codes using Ruby</title>
		<link>http://mattroper.co.uk/2008/04/01/encoding-qr-codes-using-ruby/</link>
		<comments>http://mattroper.co.uk/2008/04/01/encoding-qr-codes-using-ruby/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 14:38:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[bath]]></category>

		<category><![CDATA[qr]]></category>

		<category><![CDATA[qrcodes]]></category>

		<category><![CDATA[rmagick]]></category>

		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://mattroper.co.uk/?p=3</guid>
		<description><![CDATA[A QR Code image generator written in Ruby using rQRCode (a Ruby library for encoding QR Codes) and RMagick (a Ruby interface to the ImageMagick image processing libraries).]]></description>
			<content:encoded><![CDATA[<p>I've recently been working on a project at the <a href="http://www.bath.ac.uk/">University of Bath</a> (I'm a Software Developer in their e-Learning Team) that aims to increase mobile/handheld access to online resources by promoting the use of <a title="QR Code article on Wikipedia" href="http://en.wikipedia.org/wiki/QR_codes">QR Codes</a>.</p>
<p>Obviously, the first thing I needed was a QR Code generator and I set about creating one  using <a title="A Ruby library that encodes QR Codes" href="http://rubyforge.org/projects/rqrcode">rQRCode</a> (a Ruby library for encoding QR Codes, developed by <a href="http://whomwah.com/">Duncan Robertson</a>) and <a href="http://rmagick.rubyforge.org/">RMagick</a> (a Ruby interface to the <a href="http://www.imagemagick.org/index.php">ImageMagick</a> image processing libraries).</p>
<p>To output the QR Code as an image, I created a class, <a title="QRImage Class" href="http://mattroper.co.uk/assets/qr_image.rb">QRImage</a>, that extends Magick::Image and then used the following code to output the image to a file:</p>
<pre class="ruby"><span style="color:#008000; font-style:italic;"># QR Code parameters</span>
text = <span style="color:#996600;">'http://mattroper.co.uk/'</span>
size = <span style="color:#006666;">3</span>
level = <span style="color:#996600;">'h'</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Produce the QR Code</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rubygems'</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'rqrcode'</span>
qr = <span style="color:#6666ff; font-weight:bold;">RQRCode::QRCode</span>.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>text,  <span style="color:#ff3333; font-weight:bold;">:size</span> =&gt; size, <span style="color:#ff3333; font-weight:bold;">:level</span> =&gt; level<span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Create the image and double its size</span>
<span style="color:#CC0066; font-weight:bold;">require</span> <span style="color:#996600;">'qr_image'</span>
img = QRImage.<span style="color:#9900CC;">new</span><span style="color:#006600; font-weight:bold;">&#40;</span>qr<span style="color:#006600; font-weight:bold;">&#41;</span>.<span style="color:#9900CC;">sample</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006666;">2</span><span style="color:#006600; font-weight:bold;">&#41;</span>
&nbsp;
<span style="color:#008000; font-style:italic;"># Write image to disk</span>
img.<span style="color:#9900CC;">write</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#996600;">'/home/matt/Desktop/qr.png'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span> quality = <span style="color:#006666;">100</span> <span style="color:#006600; font-weight:bold;">&#125;</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://mattroper.co.uk/2008/04/01/encoding-qr-codes-using-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Simple Subversion log viewer</title>
		<link>http://mattroper.co.uk/2008/03/01/simple-subversion-log-viewer/</link>
		<comments>http://mattroper.co.uk/2008/03/01/simple-subversion-log-viewer/#comments</comments>
		<pubDate>Sat, 01 Mar 2008 17:45:23 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<category><![CDATA[java]]></category>

		<category><![CDATA[logs]]></category>

		<category><![CDATA[netbeans]]></category>

		<category><![CDATA[openoffice]]></category>

		<category><![CDATA[subversion]]></category>

		<category><![CDATA[svn]]></category>

		<category><![CDATA[svnkit]]></category>

		<category><![CDATA[swing]]></category>

		<category><![CDATA[uno]]></category>

		<guid isPermaLink="false">http://mattroper.co.uk/?p=5</guid>
		<description><![CDATA[I've recently been involved in the upgrade and migration of a fairly large, customised deployment of the Moodle open source e-Learning platform at the University of Bath.
To help us understand the code changes that had been made by  several different developers over a number of years, I wrote a simple Subversion log viewer to [...]]]></description>
			<content:encoded><![CDATA[<p>I've recently been involved in the upgrade and migration of a fairly large, customised deployment of the <a href="http://moodle.org/">Moodle</a> open source e-Learning platform at the <a href="http://www.bath.ac.uk/">University of Bath</a>.</p>
<p>To help us understand the code changes that had been made by  several different developers over a number of years, I wrote a simple <a href="http://code.google.com/p/simplesvnlogviewer/">Subversion log viewer</a> to extract the logs and output them to a spreadsheet.</p>
<p>The spreadsheet format allowed non-technical staff to identify why modifications were made and was useful in identifying which features and bugfixes would need to be reimplemented by the development team.</p>
<p>I have made the simple <a href="http://code.google.com/p/simplesvnlogviewer/">Subversion log viewer</a> and Java <a href="http://code.google.com/p/simplesvnlogviewer/source/browse">source code</a> available on <a href="http://code.google.com/">Google Code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mattroper.co.uk/2008/03/01/simple-subversion-log-viewer/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
