<?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>Alan's blog &#187; techie</title>
	<atom:link href="http://www.alandix.com/blog/tag/techie/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.alandix.com/blog</link>
	<description>just starting ...</description>
	<lastBuildDate>Wed, 08 Feb 2012 18:53:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
		<item>
		<title>Hierarchical grammars for more human-like compiler parsing</title>
		<link>http://www.alandix.com/blog/2011/03/12/hierarchical-grammars-for-more-human-like-compiler-parsing/</link>
		<comments>http://www.alandix.com/blog/2011/03/12/hierarchical-grammars-for-more-human-like-compiler-parsing/#comments</comments>
		<pubDate>Sat, 12 Mar 2011 13:21:50 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[HCI and usability]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[techie]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=429</guid>
		<description><![CDATA[Nearly twenty years ago, back when I was in York, one of my student project suggestions was to try to make compiler parsers operate a little more like a human: scanning first for high-level structures like brackets and blocks and only moving on to finer level features later.  If I recall there were several reasons [...]]]></description>
			<content:encoded><![CDATA[<p>Nearly twenty years ago, back when I was in York, one of my student project suggestions was to try to make compiler parsers operate a little more like a human: scanning first for high-level structures like brackets and blocks and only moving on to finer level features later.  If I recall there were several reasons for this, including connections with &#8216;dynamic pointers&#8217;<sup><a href="#footnote-1-429" id="footnote-link-1-429" title="See the footnote.">1</a></sup>, but most important to help error reporting, especially in cases of mismatched brackets or missing &#8216;;&#8217; from line ends &#8230; still a big problem.</p>
<p>Looking back I can see that one MEng student considered it, but in the end didn&#8217;t do it, so it lay amongst that great pile of &#8220;things to do one day&#8221; and discuss occasionally over tea or beer. I recall too looking at grammar-to-grammar parsers &#8230; I guess now-a-days I might imagine using XSLT!</p>
<p>Today, 18 years on, while scanning David Unger&#8217;s publications I discover that he actually did this in the Java parser at Sun<sup><a href="#footnote-2-429" id="footnote-link-2-429" title="See the footnote.">2</a></sup>.  I don&#8217;t know if this is actually used in the current Java implementations.  Their reasons for looking at the issue  were to do with making the parser easier to maintain, so it may actually be that this is being done under the hood, but the benefits for the Java programmer not being realised.</p>
<p>While I was originally thinking about programming languages, I have more recently found myself using the general methods in anger when doing data cleaning as often one approaches this in a pipeline fashion, creating elements of structure along the way that are picked up by future parsing/cleaning steps.</p>
<p>To my knowledge there are no general purpose tools for doing this.  So, if anyone is looking for a little project, here is my own original project suggestion from 1993 &#8230;</p>
<blockquote><p><strong>Background</strong><br />
When compilers parse a computer program, they usually proceed in a sequential, left-to-right fashion. The computational requirement of limited lookahead means that the syntax of programming languages must usually be close to LL(1) or LR(1). Human readers use a very different strategy. They scan the text for significant features, building up an understanding of the text in a more top down fashion. The human reader thus looks at the syntax at multiple levels and we can think of this as a hierarchical grammar.<strong></strong></p>
<p><strong>Objective</strong><br />
The purpose of this project is to build a parser based more closely on this human parsing strategy. The target language could be Pascal or C (ADA is probably a little complex!). The parser will operate in two or more passes. The first pass would identify the block structure, for example, in C this would be based on matching various brackets and delimiters `{};,()&#8217;. This would yield a partially sequential, partially tree-like structure. Mismatched brackets could be detected at this stage, avoiding the normally confusing error messages generated by this common error. Subsequent passes would `parse&#8217; this tree eventually obtaining a standard syntax tree.</p>
<p><strong>Options</strong><br />
Depending on progress, the project can develop in various ways. One option is to use the more human-like parsing to improve error reporting, for example, the first pass could identify the likely sites for where brackets have been missed by analysing the indentation structure of the program. Another option would be to build a YACC-like tool to assist in the production of multi-level parsers.</p>
<p><strong>Reading</strong></p>
<p>1.  S. P. Robertson, E. F. Davis, K. Okabe and D. Fitz-Randolf, &#8220;Program comprehension beyond the line&#8221;<sup><a href="#footnote-3-429" id="footnote-link-3-429" title="See the footnote.">3</a></sup>, pp. 959-963 in <em>Proceedings of Interact&#8217;90</em>, North-Holland, 1990.<br />
2.  Recommended reading from compiler construction course<br />
3.  YACC manual from UNIX manual set.</p></blockquote>
<br /><ol class="footnotes"><li id="footnote-1-429">For more on Dynamic Pointers see my first book &#8220;<a href="http://www.hiraeth.com/books/formal/" target="_blank">Formal Methods for Interactive Systems</a>&#8220;, a CSCW journal paper &#8220;<a href="http://www.hcibook.com/alan/topics/dynamic/" target="_blank">Dynamic pointers and threads</a>&#8220;  [<a href="#footnote-link-1-429">back</a>]</li><li id="footnote-2-429"><a href="http://www.google.com/patents?hl=en&amp;lr=&amp;vid=USPAT7089541&amp;id=ist6AAAAEBAJ&amp;oi=fnd&amp;dq=IBM%2B%22D%2BUngar%22&amp;printsec=abstract" target="_blank">Modular parser architecture with mini parsers</a>. D M Ungar,  US Patent 7,089,541, 2006  [<a href="#footnote-link-2-429">back</a>]</li><li id="footnote-3-429">Incidentally, &#8220;Program comprehension beyond the line&#8221; is a fantastic paper both for its results and also methodologically. In the days when eye-tracking was still pretty complex (maybe still now!), they wanted to study program comprehension, so instead of following eye gaze, they forced experimental subjects to physically scroll through code using a  single-line browser.    [<a href="#footnote-link-3-429">back</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2011/03/12/hierarchical-grammars-for-more-human-like-compiler-parsing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>announcing Tiree Tech Wave!</title>
		<link>http://www.alandix.com/blog/2011/01/22/announcing-tiree-tech-wave/</link>
		<comments>http://www.alandix.com/blog/2011/01/22/announcing-tiree-tech-wave/#comments</comments>
		<pubDate>Sat, 22 Jan 2011 20:56:51 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[HCI and usability]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[digital culture]]></category>
		<category><![CDATA[hackfest]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[physicality]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[Tiree]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=392</guid>
		<description><![CDATA[Ever since I came to Tiree I&#8217;ve had a vision of bringing people here, to share some of the atmosphere and work together.  A few of you have come on research visits and we have had some really productive times.  Others have said they wished they could come sometime. Well now is your chance &#8230; [...]]]></description>
			<content:encoded><![CDATA[<p>Ever since I came to Tiree I&#8217;ve had a vision of bringing people here, to share some of the atmosphere and work together.  A few of you have come on research visits and we have had some really productive times.  Others have said they wished they could come sometime.</p>
<p>Well now is your chance &#8230;</p>
<p>Come to <strong>Tiree Tech Wave</strong> in March to make, talk and play at the wind-ripping edge of digital technology.</p>
<p style="text-align: center;"><a href="http://www.blipfoto.com/view.php?id=913113&amp;month=1&amp;year=2011" target="_blank" title="lovefibre blipfoto"><img class="aligncenter" title="windsurfer and waves" src="http://tireetechwave.com/wp-content/uploads/2011/01/draft-TTW-CfP-v0-1.jpg" alt="seascape" width="391" height="122" /></a></p>
<p>Every year Tiree hosts the <a href="http://www.tireewaveclassic.org/tireewaveclassic/news/news.html" target="_blank">Wave Classic</a>, a key international wind  surfing event.  Those of us at the edge of the digital wave do not risk  cold seas and bodily injury, but there is something of the same thrill  as we explore the limits of code, circuit boards and social computation.</p>
<p><a href="http://www.android.com/market" target="_blank"><img class="alignright" style="margin-left: 10px; border: 0pt none;" title="Android icons" src="http://tireetechwave.com/wp-content/uploads/2011/01/draft-TTW-CfP-v0-3.jpg" alt="icons" width="108" height="104" /></a>The  cutting edge of wind-surfing boards is now high technology, but  typically made by artisan craftsfolk, themselves often surfers.   Similarly hardware platforms such as Arduino, mobile apps for iPhone and  Android, and web mashups enabled by public APIs and linked data are all  enabling a new maker culture, challenging the hegemony of global  corporations.</p>
<p><a href="http://en.wikipedia.org/wiki/Lindisfarne_Gospels" target="_blank"><img class="alignleft" style="margin-right: 10px; border: 0pt none;" title="illumination" src="http://tireetechwave.com/wp-content/uploads/2011/01/draft-TTW-CfP-v0-2-150x150.jpg" alt="artwork" width="126" height="126" /></a>The  Western Celtic fringes were one of the oases of knowledge and learning  during the ‘dark ages’.  There is something about the empty horizon that  helped the hermit to focus on God and inspired a flowering of  decorative book-making, even in the face of battering storms of winter  and Viking attacks of summer; a starkness that gave scholars time to  think in peace between danger-fraught travel to other centres of  learning across Europe.</p>
<p>Nowadays regular Flybe flights and Calmac ferries reduce the risk of  Viking attacks whilst travelling to the isles, broadband Internet and  satellite TV invade the hermit cell, and double glazing and central  heating mollify the elements.  Yet there is still a rawness that helps  focus the mind, a slightly more tenuous connection to the global  infrastructure that fosters a spirit of self-reliance and independence.</p>
<p><a href="http://www.comp.lancs.ac.uk/~dixa/projects/firefly/" target="_blank"><img class="alignright" style="margin-left: 10px; border: 0pt none;" title="Firefly components" src="http://tireetechwave.com/wp-content/uploads/2011/01/draft-TTW-CfP-v0-300x155.jpg" alt="LEDs" width="213" height="111" /></a>Over  a long weekend 17 – 21 March (TBC), we plan what I hope will be a  semi-regular event.  A time to step out, albeit momentarily, from a  target-driven world, to experiment and play with hardware and software,  to discuss the issues of our new digital maker culture, what we know and  what we seek to understand, and above all to make things together.</p>
<p>This is all about technology and people: the physical device that  sits in our hands, the data.gov.uk mashup that tells us about local  crime, the new challenges to personal privacy and society and the nation  state.</p>
<p>Bring your soldering iron, and Arduino boards, your laptop and API  specs, your half-written theses and semi-formed ideas, your favourite  book or even well-loved eReader (!).  The format will be informal, with  lots of time to work hands-on together; however, there will be the  opportunity for short talks/demos/how-to-do-it sessions.  Also, if there  is demand, I&#8217;d  be happy to do some more semi-formal tutorial  sessions and maybe others would too (Arduino making, linked data).</p>
<p>Currently we have no idea whether there will be three or three  hundred people interested, but aiming for something like 15 – 30  participants.  We’ll keep costs down, probably around £70 for meeting  rooms, lunches, etc. over the five days, but will confirm that and more  details shortly.</p>
<p>Follow on Twitter at <a href="http://twitter.com/#!/tireetechwave" target="_blank">@tireetechwave</a> and the website will be at <a href="http://www.tireetechwave.com/" target="_blank">tireetechwave.com</a>. However, it is still &#8216;under development&#8217;, so don&#8217;t be surprised at the odd glich over the next couple of weeks as we sort out details.</p>
<p>If you are interested in coming or want to know more <a href="http://www.hcibook.com/alan/#contact" target="_blank" title="Alan's contact details">mail me</a> or <a href="http://highwired.co.uk/graham/about/" target="_blank" title="Graham's contact details">Graham Dean</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2011/01/22/announcing-tiree-tech-wave/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Apache: pretty URLs and rewrite loops</title>
		<link>http://www.alandix.com/blog/2010/07/13/apache-pretty-urls-and-rewrite-loops/</link>
		<comments>http://www.alandix.com/blog/2010/07/13/apache-pretty-urls-and-rewrite-loops/#comments</comments>
		<pubDate>Tue, 13 Jul 2010 09:30:02 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[htaccess]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[rewriterule]]></category>
		<category><![CDATA[snip!t]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[vfridge]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=265</guid>
		<description><![CDATA[[another techie post - a problem I had and can see that other people have had too] It is common in various web frameworks to pass pretty much everything through a central script using Apache .htaccess file and mod_rewrite.  For example enabling permalinks in a WordPress blog generates an .htaccess file like this: RewriteEngine On [...]]]></description>
			<content:encoded><![CDATA[<p>[another techie post - a problem I had and can see that other people have had too]</p>
<p>It is common in various web frameworks to pass pretty much everything through a central script using Apache .htaccess file and mod_rewrite.  For example enabling <a href="http://codex.wordpress.org/Using_Permalinks" target="_blank">permalinks</a> in a WordPress blog generates an .htaccess file like this:</p>
<pre class="brush: plain; title: ;">
RewriteEngine On
RewriteBase /blog/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /blog/index.php [L]
</pre>
<p>I use similar patterns for various sites such as <a href="http://www.vfridge.com/" target="_blank">vfridge</a> (see recent post &#8220;<a href="http://www.alandix.com/blog/2010/06/11/phoenix-rises-vfridge-online-again/" target="_blank">Phoenix rises</a>&#8220;) and <a href="http://www.snipit.org/" target="_blank">Snip!t</a>.  For Snip!t however I was using not a local <a href="http://httpd.apache.org/docs/2.2/howto/htaccess.html" target="_blank">.htaccess</a> file, but an <a href="http://httpd.apache.org/docs/2.1/mod/mod_alias.html" target="_blank">AliasMatch</a> in httpd.conf, which meant I needed to ask Fiona every time I needed to do a change (as I can never remember the root passwords!).  It seemed easier (even if slightly less efficient) to move this to a local .htaccess file:</p>
<pre class="brush: plain; title: ;">
RewriteEngine On
RewriteBase /
RewriteRule ^(.*)$ code/top.php/$1 [L]
</pre>
<p>The intention is to map &#8220;/an/example?args&#8221; into &#8220;/code/top.php/an/example?args&#8221;.</p>
<p>Unfortunately this resulted in a &#8220;500 internal server error&#8221; page and in the Apache error log messages saying there were too many internal redirects.  This seems to be a common problem reported in forums (see <a href="http://www.askapache.com/htaccess/mod_rewrite-tips-and-tricks.html#comment-104819" target="_blank" title="mathguy's comment on: .Htaccess rewrites, Mod_Rewrite Tricks and Tips">here</a>, <a href="http://drupal.org/node/60426" target="_blank" title=".htaccess rewrite loop">here</a> and <a href="http://stackoverflow.com/questions/1027801/500-server-error-infinite-rewrite-loop-in-apache-2-2-x-with-mod-vhost-alias-vir" target="_blank" title="500 Server Error: Infinite rewrite loop in Apache 2.2.x with mod_vhost_alias, VirtualDocumentRoot, and mod_rewrite for routing / “pretty” URLs">here</a>).  The reason for this is that .htaccess files are encountered very late in Apache&#8217;s processing and so anything rewritten by the rules gets thrown back into Apache&#8217;s processing almost as if they were a fresh request.  While the &#8220;[L]&#8220;(last)  flags says &#8220;don&#8217;t execute any more rules&#8221;, this means &#8220;no more rules on this pass&#8221;, but when Apache gets back to the .htaccess in the fresh round the rule gets encountered again and again leading to an infinite loop &#8220;/code/top/php/code/top.php/&#8230;/code/top.php/an/example?args&#8221;.</p>
<p>Happily, mod_rewrite thought of this and there is an additional &#8220;[NS]&#8221; (nosubreq) flag that says &#8220;only use this rule on the first pass&#8221;.  The mod_rewrite documentation for RewriteRule in Apache <a href="http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html#RewriteRule" target="_blank" title="RewriteRule: Apache 1.3">1.3</a>, <a href="http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html" target="_blank" title="RewriteRule: Apache 2.0">2.0</a> and <a href="http://httpd.apache.org/docs/2.3/rewrite/flags.html#flag_ns" target="_blank" title="RewriteRule Flags: Apache 2.3">2.3</a> says:</p>
<blockquote><p>Use the following rule for your decision: whenever you           prefix some URLs with CGI-scripts to force them to be           processed by the CGI-script, the chance is high that you           will run into problems (or even overhead) on           sub-requests. In these cases, use this flag.</p></blockquote>
<p>I duly added the flag:</p>
<pre class="brush: plain; title: ;">
RewriteRule ^(.*)$ code/top.php/$1 [L,NS]
</pre>
<p>This <em>should</em> work, but doesn&#8217;t.  I&#8217;m not sure why except that the <a href="http://httpd.apache.org/docs/2.2/rewrite/rewrite_flags.html#flag_ns" target="_blank" title="RewriteRule Flags: Apache 2.2">Apache 2.2 documentation for NS|nosubreq</a> reads:</p>
<blockquote><p><span style="color: #000080;"><strong><a name="flag_ns">NS|nosubreq</a></strong></span></p>
<p>Use of the [NS] flag prevents the rule from being used on subrequests. For example, a page which is included using an SSI (Server Side Include) is a subrequest, and you may want to avoid rewrites happening on those subrequests.</p>
<p>Images, javascript files, or css files, loaded as part of an HTML page, are not subrequests &#8211; the browser requests them as separate HTTP requests.</p></blockquote>
<p>This is identical to the documentation for 1.3, 2.0 and 2.3 except that quote about &#8220;URLs with CGI-scripts&#8221; is singularly missing.  I can&#8217;t find anything that says so, but my guess is that there was some bug (feature?) introduced 2.2 that is being fixed in 2.3.</p>
<p>WordPress is immune from the infinite loop as the directive &#8220;<code>RewriteCond %{REQUEST_FILENAME} !-f</code>&#8221; says &#8220;if the file exists use that without rewriting&#8221;.  As &#8220;index.php&#8221; is a file, the rule does not rewrite a second time.  However, the layout of my files meant that I sometimes have an actual file in the pseudo location (e.g. /an/example really exists).  I could have reorganised the complete directory structure &#8230; but then I would have been still fixing all the broken links now!</p>
<p>Instead I simply added an explicit &#8220;please don&#8217;t rewrite my top.php script&#8221; condition:</p>
<pre class="brush: plain; title: ;">
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI}  !^/code/top.php/.*
RewriteRule ^(.*)$ code/top.php/$1 [L,NS]
</pre>
<p>I suspect that this will be unnecessary when Apache upgrades to 2.3, but for now &#8230; it works <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2010/07/13/apache-pretty-urls-and-rewrite-loops/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>fix for toString error in PHPUnit</title>
		<link>http://www.alandix.com/blog/2010/07/09/fix-for-tostring-error-in-phpunit/</link>
		<comments>http://www.alandix.com/blog/2010/07/09/fix-for-tostring-error-in-phpunit/#comments</comments>
		<pubDate>Fri, 09 Jul 2010 19:54:22 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[techie]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=263</guid>
		<description><![CDATA[I was struggling to get PHPUnit to run under PHP 5.2.9. I&#8217;ve only used PHPUnit a little, so may have simply got something wrong, but I kept getting the error: Catchable fatal error: Object of class AbcTest could not be converted to string in {dir}/PHPUnit/Framework/TestFailure.php on line 98 The error happens in the PHPUnit_Framework_TestFailure::toString method, [...]]]></description>
			<content:encoded><![CDATA[<p>I was struggling to get <a href="http://www.phpunit.de/" target="_blank">PHPUnit</a> to run under PHP 5.2.9. I&#8217;ve only used PHPUnit a little, so may have simply got something wrong, but I kept getting the error:</p>
<blockquote><p><code><strong>Catchable fatal error</strong>:  Object of class AbcTest could not be  converted to string in <strong><em>{dir}</em>/PHPUnit/Framework/TestFailure.php</strong> on line <strong>98</strong></code></p></blockquote>
<p>The error happens in the <code>PHPUnit_Framework_TestFailure::toString</code> method, which tries to implicitly convert a test case to a string.</p>
<p>The class <code>AbcTest</code> is my test case, which it is trying to display following a test failure.  PHPUnit test cases all extend <code>PHPUnit_Framework_TestCase</code> and while this has a <code>toString</code> method it does not have the &#8216;<a href="http://php.net/manual/en/language.oop5.magic.php" target="_blank">magic method</a>&#8216; <code>__toString</code> required by PHP 5.2 onwards.</p>
<p>To fix the problem I simply added the following method to the class <code>PHPUnit_Framework_TestCase</code> in <code>PHPUnit/Framework/TestCase.php</code> .</p>
<pre class="brush: php; title: ;">
public function __toString()
 {
 return $this-&gt;toString();
 }
</pre>
<p>I am using PHPUnit 3.4.9, but peeking at 3.5.0beta it looks the same.  I&#8217;m guessing the <code>PHPUnit_Framework_TestFailure::toString</code> method is not used much so has got missed since the change to PHP 5.2.x.</p>
<p><a href="http://sebastian-bergmann.de/archives/876-PHPUnit-Development-Moved-to-GitHub.html" target="_blank">PHPUnit is now in GITHub</a> so I really ought to work out how to submit corrections to that &#8230; but another day I think.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2010/07/09/fix-for-tostring-error-in-phpunit/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>programming as it could be: part 1</title>
		<link>http://www.alandix.com/blog/2009/02/22/programming-as-it-could-be-part-1/</link>
		<comments>http://www.alandix.com/blog/2009/02/22/programming-as-it-could-be-part-1/#comments</comments>
		<pubDate>Sun, 22 Feb 2009 09:24:16 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[HCI and usability]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[Bangalore]]></category>
		<category><![CDATA[hypercard]]></category>
		<category><![CDATA[keynote]]></category>
		<category><![CDATA[literate programming]]></category>
		<category><![CDATA[mobile design]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[yahoo pipes]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=134</guid>
		<description><![CDATA[Over a cup of tea in bed I was pondering the future of business data processing and also general programming. Many problems of power-computing like web programming or complex algorithmics, and also end-user programming seem to stem from assumptions embedded in the heart of what we consider a programming language, many of which effectively date [...]]]></description>
			<content:encoded><![CDATA[<p>Over a cup of tea in bed I was pondering the future of business data processing and also general programming. Many problems of power-computing like web programming or complex algorithmics, and also end-user programming seem to stem from assumptions embedded in the heart of what we consider a programming language, many of which effectively date from the days of punch cards.</p>
<p>Often the most innovative programming/scripting environments, <a href="http://www.smalltalk.org/smalltalk/whatissmalltalk.html" target="_blank">Smalltalk</a>, <a href="http://en.wikipedia.org/wiki/HyperCard" target="_blank">Hypercard</a>, <a href="http://reference.wolfram.com/mathematica/" target="_blank">Mathematica</a>, humble spreadsheets, even (for those with very long memories) <a href="http://en.wikipedia.org/wiki/Filetab" target="_blank">Filetab,</a> have broken these assumptions, as have whole classes of &#8216;non-standard&#8217; declarative languages.  More recently <a href="http://pipes.yahoo.com/pipes/" target="_blank">Yahoo! Pipes</a> and <a href="http://scratch.mit.edu/" target="_blank">Scratch</a> have re-introduced more graphical and lego-block style programming to end-users (albeit in the case of Pipes slightly techie ones).</p>
<table border="0" align="center">
<tbody>
<tr>
<td><a href="http://pipes.yahoo.com/pipes/"><img class="alignnone" title="Yahoo! Pipes" src="http://upload.wikimedia.org/wikipedia/en/thumb/3/3c/Yahoo_Pipes_screenshot.png/200px-Yahoo_Pipes_screenshot.png" alt="" width="200" height="149" /></a></td>
<td style="text-align: center;"><a href="http://info.scratch.mit.edu/About_Scratch"><img class="alignnone" title="Scratch programming" src="http://www.alandix.com/images/scratch-programming.png" alt="" width="231" height="119" /></a></td>
</tr>
<tr>
<td style="text-align: center;"><a href="http://pipes.yahoo.com/pipes/" target="_blank">Yahoo! Pipes</a> (from <a href="http://en.wikipedia.org/wiki/Yahoo!_Pipes" target="_blank">Wikipedia article</a>)</td>
<td style="text-align: center;"><a href="http://info.scratch.mit.edu/About_Scratch" target="_blank">Scratch</a> programming using blocks</td>
</tr>
</tbody>
</table>
<p>What would programming be like if it were more incremental, more focused on live data, less focused on the language and more on the development environment?</p>
<p>Two things have particularly brought this to mind.</p>
<p>First was the bootcamp team I organised at the <a href="http://www.ukinit.org/02122008/winter-school-interactive-technologies" target="_blank">Winter School on Interactive Technologies</a> in Bangalore<sup><a href="#footnote-1-134" id="footnote-link-1-134" title="See the footnote.">1</a></sup>.  At the bootcamp we were considering &#8220;content development through the keyhole&#8221;, inspired by a working group at the <a href="http://www.cs.swan.ac.uk/mobdesign/" target="_blank">Mobile Design Dialog</a> conference last April in Cambridge.  The core issue was how one could enable near-end-use development in emerging markets where the dominant, or only, available computation is the mobile phone.  The bootcamp designs focused on more media content development, but one the things we briefly discussed was full code development on a mobile screen (not so impossible, after all home computers used to be 40&#215;25 chars!), and where <a href="http://www.literateprogramming.com/" target="_blank">literate programming</a> might offer some solutions, not for its original aim of producing code readable by others<sup><a href="#footnote-2-134" id="footnote-link-2-134" title="See the footnote.">2</a></sup>, but instead to allow very succinct code that is readable by the author.</p>
<pre style="padding-left: 30px;">if ( &lt;&lt; input invalid &gt;&gt; )
    &lt;&lt; error handling code &gt;&gt;
else
    &lt;&lt; update data &gt;&gt;</pre>
<p style="padding-left: 30px;">(example of simple literate programming)</p>
<p>The second is that I was doing a series of spreadsheets to produce some Fitts&#8217; Law related modelling.  I could have written the code in Java and run it to produce outputs, but the spreadsheets were more immediate, allowed me to get the answers I needed when I needed them, and didn&#8217;t separate the code from the outputs (there were few inputs just a number of variable parameters).  However, complex spreadsheets get unmanageable quickly, notably because the only way to abstract is to drop into the level of complex spreadsheet formulae (not the most readable code!) or VB scripting.  But when I have made spreadsheets that embody calculations, why can&#8217;t I &#8216;abstract&#8217; them rather than writing fresh code?</p>
<p>I have entitled this blog &#8216;part 1&#8242; as there is more to discuss  than I can manage in one entry!  However, I will return, and focus on each of the above in turn, but in particular questioning some of those assumptions embodied in current programming languages:</p>
<p>(a) code comes before data</p>
<p>(b) you need all the code in place before you can run it</p>
<p>(c) abstraction is about black boxes</p>
<p>(d) the programming language and environment are separate</p>
<p>In my <a href="http://www.alandix.com/blog/2008/09/16/ppig2008-and-the-twenty-first-century-coder/" target="_blank">PPIG keynote</a> last September I noted how programming as an activity has changed, become more dynamic, more incremental, but probably also less disciplined.  Through discussions with friends, I am also aware of some of the architectural and efficiency problems of web programming due to the opacity of code, and long standing worries about the dominance of limited models of objects<sup><a href="#footnote-3-134" id="footnote-link-3-134" title="See the footnote.">3</a></sup></p>
<p>So what would programming be like if it supported these practices, but in ways that used the power of the computer itself to help address some of the problems that arise when these practices address issues of substantial complexity?</p>
<p>And can we allow end-users to more easily move seamlessly from filling in a spreadsheet, to more complex scripting?</p>
<br /><ol class="footnotes"><li id="footnote-1-134">The winter school was part of the UK-India Network on <a href="http://www.ukinit.org/" target="_blank">Interactive Technologies for the End-User</a>.  See also my blog &#8220;<a href="../2009/02/09/from-anzere-in-the-alps-to-the-taj-bangelore-in-two-weeks/">From Anzere in the Alps to the Taj Bangelore in two weeks</a>&#8220;  [<a href="#footnote-link-1-134">back</a>]</li><li id="footnote-2-134">such as <a href="http://www-cs-faculty.stanford.edu/~knuth/" target="_blank">Knuth</a>&#8216;s &#8220;<a href="http://www.amazon.com/Computers-Typesetting-B-TeX-Program/dp/0201134373" target="_blank">TeX: the program</a>&#8221; book consisting of the full source code for TeX presented using Knuth&#8217;s original literate programming system WEB.  [<a href="#footnote-link-2-134">back</a>]</li><li id="footnote-3-134">I have often referred to object-oriented programming as &#8216;western individualism embodied in code&#8217;.  [<a href="#footnote-link-3-134">back</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2009/02/22/programming-as-it-could-be-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PPIG2008 and the twenty first century coder</title>
		<link>http://www.alandix.com/blog/2008/09/16/ppig2008-and-the-twenty-first-century-coder/</link>
		<comments>http://www.alandix.com/blog/2008/09/16/ppig2008-and-the-twenty-first-century-coder/#comments</comments>
		<pubDate>Tue, 16 Sep 2008 17:36:22 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[HCI and usability]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[HCI]]></category>
		<category><![CDATA[human computer interaction]]></category>
		<category><![CDATA[mathematics]]></category>
		<category><![CDATA[maths]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software engineering]]></category>
		<category><![CDATA[tagging]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=95</guid>
		<description><![CDATA[Last week I was giving a keynote at the annual workshop PPIG2008 of the Psychology of Programming Interest Group.   Before I went I was politely pronouncing this pee-pee-eye-gee … however, when I got there I found the accepted pronunciation was pee-pig … hence the logo! My own keynote at PPIG2008 was &#8220;as we may code: [...]]]></description>
			<content:encoded><![CDATA[<p>Last week I was giving a keynote at the annual workshop <a href="http://www.cs.st-andrews.ac.uk/~jr/ppig08/" target="_blank">PPIG2008</a> of the <a href="http://www.ppig.org/" target="_blank">Psychology of Programming Interest Group</a>.   Before I went I was politely pronouncing this pee-pee-eye-gee … however, when I got there I found the accepted pronunciation was pee-pig … hence the logo!</p>
<p><a href="http://www.ppig.org/" target="_blank"><img class="alignright" title="two pigs" src="http://www.cs.st-andrews.ac.uk/~jr/ppig08/img/pair-100.JPG" alt="" width="100" height="125" align="right" /></a></p>
<p>My own keynote at PPIG2008 was &#8220;<a title="as we may code - web pages" href="http://www.hcibook.com/alan/papers/PPIG2008-as-we-may-code/" target="_blank">as we may code: the art (and craft) of computer programming in the 21st century</a>&#8221; and was an exploration of the changes in coding from 1968 when <a title="Wikipedia.org: Donald Knuth" href="http://en.wikipedia.org/wiki/Donald_Knuth" target="_blank">Knuth</a> published the first of his books on &#8220;<a title="Wikipedia: the art of computer programmimg" href="http://en.wikipedia.org/wiki/The_Art_of_Computer_Programming" target="_blank">the art of computer programming</a>&#8220;.  On the <a title="as we may code - web pages" href="http://www.hcibook.com/alan/papers/PPIG2008-as-we-may-code/" target="_blank">web site for the talk</a> I&#8217;ve made a relatively unstructured list of some of the distinctions I&#8217;ve noticed between 20th and 21st Century coding (C20 vs. C21); and in <a href="http://www.comp.lancs.ac.uk/~dixa/papers/PPIG2008-as-we-may-code/as-we-may-code-v2.pdf" target="_blank">my slides</a> I have started to add some more structure.  In general we have a move from more mathematical, analytic, problem solving approach, to something more akin to a search task, finding the right bits to fit together with a greater need for information management and social skills. Both this characterisation and the list are, of course, a gross simplification, but seem to capture some of the change of spirit.  These changes suggest different cognitive issues to be explored and maybe different personality types involved &#8211; as one of the attendees, <a href="http://www.cs.ncl.ac.uk/people/david.greathead" target="_blank">David Greathead</a>, pointed out, rather like the judging vs. perceiving personality distinction in Myers-Briggs<sup><a href="#footnote-1-95" id="footnote-link-1-95" title="See the footnote.">1</a></sup>.</p>
<p>One interesting comment on this was from <a href="mcs.open.ac.uk/mp8/ " target="_blank">Marian Petre</a>, who has studied many professional programmers.  Her impression, and echoed by others, was that the heavy-hitters were the more experienced programmers who had adapted to newer styles of programming, whereas  the younger programmers found it harder to adapt the other way when they hit difficult problems.  Another attendee suggested that perhaps I was focused more on application coding and that system coding and system programmers were still operating in the C20 mode.</p>
<p>The social nature of modern coding came out in several papers about agile methods and pair programming.  As well as being an important phenomena in its own right, pair programming gives a level of think-aloud  &#8216;for free&#8217;, so maybe this will also cast light on individual coding.</p>
<p><a href="http://webhome.cs.uvic.ca/%7Emstorey/" target="_blank">Margaret-Anne Storey</a> gave a fascinating keynote about the use of comments and annotations in code and again this picks up the social nature of code as she was studying open-source coding where comments are often for other people in the community, maybe explaining actions, or suggesting improvements.  She reviewed a lot of material in the area and I was especially interested in one result that showed that <em>novice</em> programmers with <em>small</em> pieces of code found method comments more useful than class comments.  Given my own frequent complaint that code is inadequately <em>documented</em> at the class or higher level, this appeared to disagree with my own impressions.  However, in discussion it seemed that this was probably accounted for by differences in context: novice vs. expert programmers, small vs large code, internal comments vs. external documentation.  One of the big problems I find is that the way different classes work together to produce effects is particularly poorly documented.  Margaret-Anne described one system her group had worked on<sup><a href="#footnote-2-95" id="footnote-link-2-95" title="See the footnote.">2</a></sup> that allowed you to write a tour of your code opening windows, highlighting sections, etc.</p>
<p>I sadly missed some of the presentations as I had to go to other meetings (the danger of a conference at your home site!), but I did get to some and  was particularly fascinated by the more theoretical/philosophical session including one paper addressing the psychological origins of the notions of objects and another focused on (the dangers of) abstraction.</p>
<p>The latter, presented by <a href="http://www.lukechurch.net/" target="_blank">Luke Church</a>, critiqued  <a href="http://www.cs.cmu.edu/~wing/" target="_blank">Jeanette Wing</a>&#8216;s 2006 CACM paper on <a href="http://portal.acm.org/citation.cfm?id=1227504.1227378" target="_blank">Computational Thinking</a>.  This is evidently a &#8216;big thing&#8217; with loads of funding and hype &#8230; but one that I had entirely missed :-/ Basically the idea is to translate the ways that one thinks about computation to problems other than computers &#8211; nerds rule OK. The tenet&#8217;s of computational thinking seem to overlap a lot with management thinking and also reminded me of the way my own HCI community and also parts of the Design (with capital D) community in different ways are trying to say they we/they are the universal discipline  &#8230; well if we don&#8217;t say it about our own discipline who will &#8230;the physicists have been getting away with it for years <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Luke (and his co-authors) argument is that abstraction can be dangerous (although of course it is also powerful).  It would be interesting perhaps rather than Wing&#8217;s paper to look at this argument alongside  Jeff Kramer&#8217;s 2007 CACM article &#8220;<a href="http://dx.doi.org/10.1145/1232743.1232745" target="_blank">Is abstraction the key to computing?</a>&#8220;, which I recall liking because it says computer scientists ought to know more mathematics <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I also sadly missed some of <a href="http://www.lancs.ac.uk/staff/mackenza/" target="_blank">Adrian Mackenzie</a>&#8216;s closing keynote &#8230; although this time not due to competing meetings but because I had been up since 4:30am reading a PhD thesis and after lunch on a Friday had begin to flag!  However, this was no reflection an Adrian&#8217;s talk and the bits I heard were fascinating looking at the way bio-tech is using the language of software engineering.  This sparked a debate relating back to the overuse of abstraction, especially in the case of the genome where interactions between parts are strong and so the software component analogy weak.  It also reminded me of yet another relatively recent paper<sup><a href="#footnote-3-95" id="footnote-link-3-95" title="See the footnote.">3</a></sup> on the way computation can be seen in many phenomena and should not be construed solely as a science of computers.</p>
<p>As well as the academic content it was great to be with the PPIG crowd they are a small but very welcoming and accepting community &#8211; I don&#8217;t recall anything but constructive and friendly debate &#8230; and next year they have PPIG09 in Limerick &#8211; PPIG and Guiness what could be better!</p>
<br /><ol class="footnotes"><li id="footnote-1-95">David has done some really interesting work on the relationship between personality types and different kinds of programming tasks.  I&#8217;ve seen him present before about debugging and unfortunately had to miss his talk at PPIG on comprehension.  Given his work has has shown clearly that there are strong correlations between certain personality attributes and coding, it would be good to see more qualitative work investigating the nature of the differences.   I&#8217;d like to know whether strategies change between personality types: for example, between systematic debugging and more insight-based scan and see it bug finding.   [<a href="#footnote-link-1-95">back</a>]</li><li id="footnote-2-95">but I can&#8217;t find on their website <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' />   [<a href="#footnote-link-2-95">back</a>]</li><li id="footnote-3-95">Perhaps 2006/2007 in either CACM or Computer Journal, if anyone knows the one I mean please remind me!  [<a href="#footnote-link-3-95">back</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2008/09/16/ppig2008-and-the-twenty-first-century-coder/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>when virtual becomes real</title>
		<link>http://www.alandix.com/blog/2008/05/03/when-virtual-becomes-real/</link>
		<comments>http://www.alandix.com/blog/2008/05/03/when-virtual-becomes-real/#comments</comments>
		<pubDate>Sat, 03 May 2008 09:48:55 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[arts]]></category>
		<category><![CDATA[digital mediia]]></category>
		<category><![CDATA[firefly]]></category>
		<category><![CDATA[physicality]]></category>
		<category><![CDATA[techie]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/?p=75</guid>
		<description><![CDATA[Just read Adam Greenfield&#8217;s blog entry &#8220;Reality bites&#8220;. He describes how a design he produced for a friend&#8217;s new restaurant became a solid metal sign within days. Despite knowing about recent rapid fabrication techniques, actually seeing these processes in action for his own design was still shocking. I too am still amazed at the relative [...]]]></description>
			<content:encoded><![CDATA[<p>Just read Adam Greenfield&#8217;s blog entry &#8220;<a href="http://speedbird.wordpress.com/2008/04/28/reality-bites/">Reality bites</a>&#8220;.  He describes how a design he produced for a friend&#8217;s new restaurant became a solid metal sign within days.  Despite knowing about recent rapid fabrication techniques, actually seeing these processes in action for his own design was still shocking.</p>
<p>I too am still amazed at the relative ease that ideas can be turned into reality.  In a presentation &#8220;<a href="http://doi.acm.org/10.1145/953536.953543">As we may print</a>&#8221; at the 2003 Interaction Design for Children, <a href="http://www.cs.colorado.edu/people/mike_eisenberg.html">Michael Eisenberg</a> described how he and his co-workers at University Colorado were using  laser cutters to enable children to design their own 3D designs in card or even thin plywood.  More recently at the <a href="http://www.pdronline.co.uk/workshop/">National Centre for Product Design and Development Research</a> in Cardiff, I saw 3D metal printers.  I was aware of 3D printers working in various gels and foams, but did not realise it was possible to create parts in titanium and steel, simply printed from 3D CAD designs. Chasing one of Adam&#8217;s links I found instructions to <a href="http://fab.cba.mit.edu/classes/MIT/863.07/11.05/fabaroni/">make your own 3D printer </a>on  the MIT site &#8230; however, this constructs your designs in pasta paste not metal! </p>
<p>One of the arguments we are making about our <a href="http://www.comp.lancs.ac.uk/~dixa/projects/firefly/">FireFly technology</a> is that it will change lighting from being a matter of engineering and electronics, to a digital medium where the focus moves form hardware to software.  While FireFly allows more flexible 2D and 3D arrangements than other technologies we are aware of, it is certainly not alone in making this transformation in lighting.  Last week I was talking to Art Lights London and they are planning some large installations using <a href="http://www.barco.com/corporate/en/products/category.asp?catid=142">Barco&#8217;s LED lighting arrays</a>.  Soon anything that you can point on your computer screen you will also be able to paint in light from your own Christmas tree to London Bridge.</p>
<p>Although it sometimes seems that technology is simply fuelling war and environmental catastrophe, it is a joy to still glimpse these occasional moments of magic.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2008/05/03/when-virtual-becomes-real/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>puzzle with pictures</title>
		<link>http://www.alandix.com/blog/2008/01/01/puzzle-with-pictures/</link>
		<comments>http://www.alandix.com/blog/2008/01/01/puzzle-with-pictures/#comments</comments>
		<pubDate>Tue, 01 Jan 2008 21:41:12 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/2008/01/01/puzzle-with-pictures/</guid>
		<description><![CDATA[As it was new Years Day and it was too wet to go shift earth in the garden I thought I&#8217;d play a bit with Professor Alan&#8217;s puzzle square. I&#8217;ve had a &#8216;make your own&#8217; version for years, but you had to chop an image into bits give them special names, etc. Now it works [...]]]></description>
			<content:encoded><![CDATA[<p>As it was new Years Day and it was too wet to go shift earth in the garden I thought I&#8217;d play a bit with <a href="http://www.hiraeth.com/alan/misc/game/game.html" title="Professor Alan's puzzle square" target="_blank">Professor Alan&#8217;s puzzle square</a>.  I&#8217;ve had a &#8216;make your own&#8217; version for years, but you had to chop an image into bits give them special names, etc.  Now it works much more easily with any image (<a href="http://www.hiraeth.com/alan/misc/game/design/design.html" title="make your own puzzle square" target="_blank">try it yourself</a>).  This are a couple I made with my own photos:</p>
<table align="center">
<tr>
<td align="center"><script src="http://www.hiraeth.com/alan/misc/game/insert.php?version=2&amp;src=http%3A%2F%2Fwww.comp.lancs.ac.uk%2F%7Edixa%2Fbig_alan.jpg&amp;wid=24&amp;ht=32&amp;rows=3&amp;cols=3" language="JavaScript"> </script><br />
<noscript>needs Javascript</noscript></td>
<td align="center">&nbsp;</td>
<td align="center"><script src="http://www.hiraeth.com/alan/misc/game/insert.php?version=2&amp;start=plain&amp;wid=20&amp;ht=20&amp;rows=4&amp;cols=4&amp;src=http%3A%2F%2Fwww.alandix.com%2Fimages%2Falan-in-tripolis-square-128.jpg" language="JavaScript"> </script><br />
<noscript>needs Javascript</noscript></td>
</tr>
</table>
<p>The key is that it is I am now using the CSS clip property which allows you to show selected parts of an image (or in fact any HTML element).  This was made a little more complicated due to the fact that the <a href="http://www.w3.org/TR/REC-CSS2/visufx.html#clipping" title="W3C: clipping" target="_blank">W3C pages for clip</a> give <em>running</em> examples for every other kind of visual effect &#8230; but not clip!  Googling was a nightmare as it turns up page after page in forums saying &#8220;I can&#8217;t get clip to work&#8221;!</p>
<p>Happily I found <a href="http://www.seifi.org" target="_blank" title="seifi.org - A Web Development Blog by Mojo Seifi">seifi.org</a> (a blog that looks like a really great web resource) and a post on <a href="http://www.seifi.org/design/creating-thumbnails-using-the-css-clip-property.html" title="seifi.org - creatig thumbnails" target="_blank">Creating Thumbnails Using the CSS Clip Property</a>.   This was full of meticulously laid out examples &#8230; Mojo Seifi, you are a star!</p>
<p><span id="more-55"></span>The critical bit of CSS in the above example (left one) looks like:</p>
<blockquote>
<pre id="line1">div.clip { position:relative; width: 24px; height: 32px; overflow:hidden;
        padding:0px; margin:0px; line-height: 0px; }
div.clip img { position:absolute; }
.clip_r1_c1 {   top: 0px; left: 0px; clip: rect(0px 24px 32px 0px);    }
.clip_r1_c2 {   top: 0px; left: -24px; clip: rect(0px 48px 32px 24px);    }
// .... more the same ...
.clip_r3_c2 {   top: -64px; left: -24px; clip: rect(64px 48px 96px 24px);    }
.clip_r3_c3 {   top: -64px; left: -48px; clip: rect(64px 72px 96px 48px);    }</pre>
</blockquote>
<p>These styles are applied to image tiles, which look like:</p>
<blockquote>
<pre id="line256">&lt;<span class="start-tag">div</span><span class="attribute-name"> class</span>=<span class="attribute-value">"clip" </span>&gt;
   &lt;<span class="start-tag">img</span><span class="attribute-name"> class</span>=<span class="attribute-value">"clip_r3_c2"  </span><span class="attribute-name">id</span>=<span class="attribute-value">"img_id_r3_c2"
        </span><span class="attribute-name">src</span>=<span class="attribute-value">"http://www.comp.lancs.ac.uk/~dixa/big_alan.jpg" </span><span class="attribute-name">
        width</span>=<span class="attribute-value">"72" </span><span class="attribute-name">height</span>=<span class="attribute-value">"96" </span><span class="error"><span class="attribute-name">/</span></span>&gt;
&lt;/<span class="end-tag">div</span>&gt;</pre>
</blockquote>
<p>Notice the outer <code>div</code> and inner <code>img</code> tag.  The <code>clip</code> property only works inside  an enclosing  positioned <code>div</code> (<code>absolute</code> or <code>relative</code>). This is sized for the clipped size of the image (in this case 24&#215;32) and also has &#8220;<code>overflow:hidden</code>&#8221; otherwise the invisible portions of the image leak out and I have had problems with mouse clicks being attributed to the wrong area.  In contrast the inner <code>img</code> tag is give the size of the full unclipped image as the clipping model is about hiding parts of the image not cropping them.</p>
<p>The style for  &#8220;<code>div.clip img</code>&#8221; was just to avoid including the common elements in each <code>clip_r</code>{x}<code>_c</code>{y} style.  The clipping itself does not reduce the image size, just makes some parts invisible.  So in order to get a small cropped image you have to both clip it and position it relative to the outer <code>div</code>, hence the absolute positioning of the <code>img</code> tag.</p>
<p>The style <code>clip_r</code>{x}<code>_c</code>{y} is for the tile in column x row y.  It consists of a clip rectangle in the (very confusing) CSS-standard order top right bottom left.  Strictly it should have commas, but there seems to have been problems with this in some versions of IE, so spaces while wrong are safer (this is CSS!).  Also it has the top and left set in order to position the clipped area at the top left of the enclosing area &#8211; these are negative offset as the image origin needs to be somewhere to the left and above the origin of the enclosing <code>div</code> in order to get the clipped region in the right place.</p>
<p>I used named styles for this rather then generating styles inline as this means I can swop tiles around by simply changing the classes of the image tags <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   &#8230; and this also works in facebook <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   Also the styles and image ids are actually suffixed with unique tags (e.g. <code>.clip_r1_c1_217906</code>) so that if there are several puzzles on the same page (as there are above), they do not interfere with one anther.</p>
<p><strong>Gotchas</strong>:</p>
<p>The <a href="http://www.w3.org/TR/REC-CSS2/visufx.html#clipping" title="W3C: clipping" target="_blank">W3C pages</a> seem to imply that the right and bottom clip parameters are effectively margins, so that <code>clip (  10px 10px 10px 10px )</code> would clip off a 10 pixel margin around the image &#8211; this is <strong>NOT</strong> the case.  The <a href="http://www.seifi.org/design/creating-thumbnails-using-the-css-clip-property.html" title="seifi.org - creating thumbnails" target="_blank">seifi.org pages</a> make it clear that these are the actual right and bottom edges relative to the origin, so that <code>clip (  10px 10px 10px 10px )</code> means clip to nothing at all!</p>
<p>In addition, the right and bottom mean the margin <em>just outside</em> the clipped region, so that <code>clip ( 10px 50px 30px 5px )</code> creates a clipped region that starts at pixel 5 on the left and includes pixel 49 but not pixel 50 on the right.</p>
<p>The <code>lineheight</code> property is also essential as without it small images end up with tiny margins.  The same thing can happen even with larger images depending on their positioning relative to the line <code>lineheight:0px</code> seems extreme, but does the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2008/01/01/puzzle-with-pictures/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>spell with flickr</title>
		<link>http://www.alandix.com/blog/2007/05/25/spell-with-flickr/</link>
		<comments>http://www.alandix.com/blog/2007/05/25/spell-with-flickr/#comments</comments>
		<pubDate>Fri, 25 May 2007 07:36:58 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[web development]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[snip!t]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[web2.0]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/2007/05/25/spell-with-flickr/</guid>
		<description><![CDATA[I just found a wonderful service spell with flickr that makes images like: It is built from a pool of letters on flickr which have been collected independently (there are also pools for digits and punctuation), a lovely example of Web2.0 in action! I&#8217;ve added it to Snip!t, so now if you snip a single [...]]]></description>
			<content:encoded><![CDATA[<p>I just found a wonderful service <a href="http://metaatem.net/words/">spell with flickr</a> that makes images like:</p>
<p><a title="T" id="fs_1" href="http://www.flickr.com/photos/92709190@N00/456152977"><img border="0" alt="T" src="http://static.flickr.com/205/456152977_6c7c244586_t.jpg" /></a>    <a title="h3" id="fs_2" href="http://www.flickr.com/photos/26063977@N00/228112565"><img border="0" alt="h3" src="http://static.flickr.com/96/228112565_195133fafb_t.jpg" /></a>    <a title="I" id="fs_3" href="http://www.flickr.com/photos/82505070@N00/238988372"><img border="0" alt="I" src="http://static.flickr.com/88/238988372_3e29d7c1c2_t.jpg" /></a>    <a title="S" id="fs_4" href="http://www.flickr.com/photos/92745470@N00/479020865"><img border="0" alt="S" src="http://static.flickr.com/210/479020865_0aa56f9936_t.jpg" /></a></p>
<p>It is built from a pool of <a title="flickr oneletter pool" href="http://flickr.com/groups/oneletter/">letters on flickr</a> which have been collected independently (there are also pools for <a title="flickr one digit pool" href="http://www.flickr.com/groups/onedigit/">digits</a> and <a title="flickr punctuation pool" href="http://www.flickr.com/groups/punctuation">punctuation</a>), a lovely example of Web2.0 in action!</p>
<p>I&#8217;ve added it to <a href="http://www.snipit.org/">Snip!t</a>, so now if you snip a single word &#8216;spell with flickr&#8217; gets suggested as an action.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2007/05/25/spell-with-flickr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>surprised by Microsoft</title>
		<link>http://www.alandix.com/blog/2007/05/20/surprised-by-microsoft/</link>
		<comments>http://www.alandix.com/blog/2007/05/20/surprised-by-microsoft/#comments</comments>
		<pubDate>Sun, 20 May 2007 09:58:13 +0000</pubDate>
		<dc:creator>alan</dc:creator>
				<category><![CDATA[academic]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[confidentiality]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[techie]]></category>
		<category><![CDATA[Word]]></category>

		<guid isPermaLink="false">http://www.alandix.com/blog/2007/05/20/surprised-by-microsoft/</guid>
		<description><![CDATA[I had thought I had got used to the ineptitude of Microsoft programmers, that nothing would surprise me any more. However, yet again their inventiveness in producing obscure yet damaging effects has once again amazed me. Some colleagues and I had a paper reviewed for a conference and when we received back the reviewers&#8217; comments [...]]]></description>
			<content:encoded><![CDATA[<p>I had thought I had got used to the ineptitude of Microsoft programmers, that nothing would surprise me any more.  However, yet again their inventiveness in producing obscure yet damaging effects has once again amazed me.</p>
<p><span id="more-24"></span></p>
<p>Some colleagues and I had a paper reviewed for a conference and when we received back the reviewers&#8217; comments  one of them mentioned that the document had track changes on. <sup><a href="#footnote-1-24" id="footnote-link-1-24" title="See the footnote.">1</a></sup><br />
As my colleague had been away, I had been responsible for the final upload so thought that it was me who had messed up.  I looked at the final version I had produced and then the anonymised version I had uploaded.  They both looked free of change marks on screen and sure enough when I checked the highlight changes dialogue box, sure enough nothing was selected and &#8216;Track changes&#8217; was off.</p>
<div style="text-align: center"><img border="1" alt="track changes dialogue" title="track changes dialogue" src="http://www.alandix.com/images/track-changes.gif" /></div>
<p>I sent this copy to my colleagues (on Windows machines, I was on Mac) and they could see the changes.  Obviously the dialogue means that no *new* changes will be collected, but that older changes are still secretly hidden somewhere and furthermore even the setting to say they should not be visible, seems to be platform dependent!</p>
<p>I am used to floating figure problems between platforms and problems moving between machines attached to printers with different characteristics. I was alsoÂ  aware that comments sometimes fail to show up when you switch platforms.Â  However, this trac changes bugÂ  was new to me and reminded me of the &#8216;bad old days&#8217; when Word&#8217;s incremental save meant if you opened a .doc file in a text editor you could see past copies of confidential letters or whaever the docuement had been edited from.</p>
<p>For us the damage was not to great, anonymity partially compormised through names on the changes and the occasional remark in a comment like &#8220;are we really making sense here&#8221; which I guess do not look that good to a reviewer!</p>
<p>However, if you are thinking of mailing anything confidential either make it a PDF or just send text &#8230; and I may take another look at Open Office!</p>
<p>Just imagine that last letter to a difficult client and all the words you delted before sending it <img src='http://www.alandix.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<br /><ol class="footnotes"><li id="footnote-1-24"> The submissions had been in Word &#8230; the lesson &#8230; always always always get submissions in PDF!   [<a href="#footnote-link-1-24">back</a>]</li></ol>]]></content:encoded>
			<wfw:commentRss>http://www.alandix.com/blog/2007/05/20/surprised-by-microsoft/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

