<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.0.12-alpha" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>blog.cons.org.nz</title>
	<link>http://blog.cons.org.nz</link>
	<description>(cons web log)</description>
	<pubDate>Sun, 30 Sep 2007 09:20:15 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.12-alpha</generator>
	<language>en</language>
			<item>
		<title>FlickrTidy</title>
		<link>http://blog.cons.org.nz/2007/09/30/flickrtidy/</link>
		<comments>http://blog.cons.org.nz/2007/09/30/flickrtidy/#comments</comments>
		<pubDate>Sun, 30 Sep 2007 09:20:15 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/2007/09/30/flickrtidy/</guid>
		<description><![CDATA[<p>Some photos on Flickr have nothing but &#8220;awards&#8221; in the comments. These &#8220;awards&#8221; are little more than thinly veiled spam and there are few things more irritating than spam. Here&#8217;s an example.</p>

<p>While the best solution would be for these comments to be deleted, I suspect other people do not sympathize with me on this.
Another related [...]</p>
]]></description>
			<content:encoded><![CDATA[<p>Some photos on <a href="http://www.flickr.com">Flickr</a> have nothing but &#8220;awards&#8221; in the comments. These &#8220;awards&#8221; are little more than thinly veiled spam and there are few things more irritating than spam. Here&#8217;s an <a href="http://www.flickr.com/photos/bubbs67/1426440530/in/pool-nz/">example</a>.</p>
<a id="more-24"></a>
<p>While the best solution would be for these comments to be deleted, I suspect other people do not sympathize with me on this.</p>
<p>Another related problem is a photo associated with a large number of pools, often resulting from the &#8220;awards&#8221;. This requires a large amount of scrolling to see the tags and photo properties.</p>
<p>I propose a workaround using <a href="http://www.greasespot.net/">GreaseMonkey</a>, and I shall call it &#8220;FlickrTidy&#8221;.
<ul>
  <li><a href="http://cons.org.nz/~lorne/flickrtidy/commenthider.user.js">Comment Hider</a></li>
  <li><a href="http://cons.org.nz/~lorne/flickrtidy/poolslast.user.js">Pools Last</a></li>
</ul>
</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2007/09/30/flickrtidy/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Python Gotchas</title>
		<link>http://blog.cons.org.nz/2006/09/04/python-gotchas/</link>
		<comments>http://blog.cons.org.nz/2006/09/04/python-gotchas/#comments</comments>
		<pubDate>Mon, 04 Sep 2006 02:32:31 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=22</guid>
		<description><![CDATA[<p>Python isn't quite what you would expect</p>
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently required to use Python for <a href="http://www.mcs.vuw.ac.nz/courses/COMP312/" title="COMP312 Home Page">COMP312</a>. Having come from doing nothing but Haskell and Prolog in <a href="http://www.mcs.vuw.ac.nz/courses/COMP304/" title="COMP304 Home Page">COMP304</a> you can imagine my mind isn&#8217;t exactly bent around Python&#8217;s way of doing things. Here are a couple of traps I ran into</p>

<p>First off is expressions and lambda</p>

<pre>>>> def p(x): print(x)
...  
>>> f = lambda x:p(x) 
>>> f(5) 
5
>>> f = lambda x:print(x)
  File "&lt;stdin&gt;", line 1
    f = lambda x:print(x)
                     ^
SyntaxError: invalid syntax
</pre>

<p>You cannot put an expression in a lambda. What&#8217;s more there is no implicit return value in Python. There was <a href="https://www.mcs.vuw.ac.nz/cgi-bin/yabb/YaBB.pl?board=opre352_2006T2;action=display;num=1152784529">a thread</a> about this, for those of you with access to the MSCS forums. After that last post I wasn&#8217;t sure how to reply</p>

<p>Next up is scope</p>

<pre>>>> def counter(x):
...     base = x
...     def inc():
...             oldbase = base
...             base = base + 1
...             return oldbase
...     return inc
... 
>>> c = counter(5)
>>> c()
Traceback (most recent call last):
  File "&lt;stdin&gt;", line 1, in ?
  File "&lt;stdin&gt;", line 4, in inc
UnboundLocalError: local variable 'base' referenced before assignment</pre>

<p>&#8220;Oh, but that should happen as <tt>base</tt> shouldn&#8217;t leak into <tt>inc</tt>!&#8221;</p><p>
<pre>>>> def counter(x):
...     base = x
...     def inc():
...             oldbase = base
...             return base
...     return inc
... 
>>> c = counter(5)
>>> c()
5</pre>
</p><p>Python is happy to read variables and mutate objects, but introducing assignment makes Python come up with a new variable for you. The obvious argument is that this <tt>counter</tt> should be a class. Perhaps true, but it still caught me out.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2006/09/04/python-gotchas/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Short Code</title>
		<link>http://blog.cons.org.nz/2006/06/21/short-code/</link>
		<comments>http://blog.cons.org.nz/2006/06/21/short-code/#comments</comments>
		<pubDate>Tue, 20 Jun 2006 12:58:47 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=21</guid>
		<description><![CDATA[<p>One of the complaints I've heard about Haskell is that it makes your code shorter. I'm not quite sure how that's a bad thing, but it occurred to me while looking at a algorithm I wrote in Ruby.</p>
]]></description>
			<content:encoded><![CDATA[<p>One of the complaints I&#8217;ve heard about Haskell is that it makes your code shorter. I&#8217;m not quite sure how that&#8217;s a bad thing, but it occurred to me while looking at a algorithm I wrote in Ruby.</p>

<pre>puts $_.chomp.gsub(/../) { |b| b.hex.to_s + "."}.chop</pre>

<p>The algorithm takes an IP address compactly represented in hex and returns the dotted decimal form.</p>

<p>Parsec is wonderful! I&#8217;ve been using it for a <a href="http://user.interface.org.nz/~lorne/tetrispy/">tetrinet protocol decoder</a> so that was the first thing on my mind.</p>

<pre>main = do
  (h:_) &lt;- getArgs
  case parse (count 4 hexbyte) "Arguments" h of
    Right r -&gt; putStrLn $ tail $ concatMap (('.':) . show) r
    Left e -&gt; fail $ "Invalid input\n" ++ (show e)

hexbyte :: Parser Int
hexbyte = count 2 hexDigit >>= return . read . ('0':) . ('x':)</pre>

<p>Which seems fairly easy to follow and has some error reporting free from Parsec, but I figure a parser library might be overkill for this task.</p>

<p>Turning to more &#8220;raw&#8221; Haskell, mostly the useful functions in the Data.List library, gives</p>

<pre>main = getArgs &gt;&gt;= putStrLn . concat . intersperse "." .
       map (show . readByte) .  unfoldr lf . head
       where
         readByte :: String -&gt; Int
         readByte = read . ('0':) . ('x':)
         lf [] = Nothing
         lf t  = Just $ splitAt 2 t</pre>

<p>They&#8217;re all following approximately the same algorithm of a mapping on every two characters. However the <tt>gsub(/../) { |b| &#8230; }</tt> appears to be a very compact notation which I have been unable to match.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2006/06/21/short-code/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Pros and Cons RSS</title>
		<link>http://blog.cons.org.nz/2005/12/12/pros-and-cons-rss/</link>
		<comments>http://blog.cons.org.nz/2005/12/12/pros-and-cons-rss/#comments</comments>
		<pubDate>Mon, 12 Dec 2005 09:27:12 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=20</guid>
		<description><![CDATA[<p>RSS feed added to pros and cons</p>
]]></description>
			<content:encoded><![CDATA[<p>This is not some silly new product title, it is the announcement of an <a href="http://pros.and.cons.org.nz/meta/note/feed">RSS feed</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/12/12/pros-and-cons-rss/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flickr</title>
		<link>http://blog.cons.org.nz/2005/11/23/flickr/</link>
		<comments>http://blog.cons.org.nz/2005/11/23/flickr/#comments</comments>
		<pubDate>Wed, 23 Nov 2005 09:55:00 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=18</guid>
		<description><![CDATA[<p>I purchased a <a href="http://www.fujifilm.com/JSP/fuji/epartners/digitalE500Overview.jsp?item=I789906&#38;dbid=789906&#38;urltype=overview&#38;NavBarId=I789906">camera</a> and joined <a href="http://www.flickr.com">Flickr!</a></p>
]]></description>
			<content:encoded><![CDATA[<p>After stealing a <a href="http://www.fujifilm.com/JSP/fuji/epartners/digitalS7000Overview.jsp?item=I616757&amp;dbid=616757&amp;urltype=overview&amp;NavBarId=I616757">camera</a> to take <a href="http://www.flickr.com/photos/lorne/tags/tictac/">photos of tictacs</a> for use with <a href="http://tic.t.ac.nz">tic.t.ac.nz</a> I decided to get myself a camera. Now armed with a <a href="http://www.fujifilm.com/JSP/fuji/epartners/digitalE500Overview.jsp?item=I789906&amp;dbid=789906&amp;urltype=overview&amp;NavBarId=I789906">Fuji FinePix E500</a> and a free <a href="http://www.flickr.com">Flickr</a> account I&#8217;m ready for anything. The camera has joined the rest of the equipment that lives in my bag and my iBook is now equipped with iPhoto. </p>

<p>I <em>do</em> have a &#8220;camera&#8221; in my <a href="http://www.sonyericsson.com/k700/">phone</a> but it really is hopeless. As far as I&#8217;m aware, the argument goes &#8220;I want a camera in my phone so it&#8217;s always with me&#8221;. I intend to keep my <em>real</em> camera for this purpose, however <a href="http://www.flickr.com/photos/pftqg/65278430/">some</a> <a href="http://www.flickr.com/photos/pftqg/65278301/">people</a> seem to take this a little too far.</p>

<p>Of course, take a look at <a href="http://www.flickr.com/photos/lorne/">my photos</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/11/23/flickr/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flock</title>
		<link>http://blog.cons.org.nz/2005/10/22/flock/</link>
		<comments>http://blog.cons.org.nz/2005/10/22/flock/#comments</comments>
		<pubDate>Sat, 22 Oct 2005 00:50:27 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/2005/10/22/flock/</guid>
		<description><![CDATA[<p>Flock is a recently released &#8220;social&#8221; web browser derived from Firefox. For the social part, it offers posting to various blogs (including WordPress) with a built-in editor and del.icio.us for bookmarks. As everything these days has an RSS reader builtin, it&#8217;s not surprising this does also. The feature I like the most is a searchable [...]</p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.flock.com">Flock</a> is a recently released &#8220;social&#8221; web browser derived from <a href="http://www.mozilla.org/products/firefox/">Firefox</a>. For the social part, it offers posting to various blogs (including <a href="http://www.wordpress.org">WordPress</a>) with a built-in editor and <a href="http://del.icio.us/">del.icio.us</a> for bookmarks. As everything these days has an RSS reader builtin, it&#8217;s not surprising this does also. The feature I like the most is a searchable history by way of <a href="http://clucene.sourceforge.net/">CLucene</a>. Typing in the search field gives a <a href="http://www.apple.com/macosx/features/spotlight/">Spotlight</a> like view of pages you have visited that contain that term.<br /><p>It&#8217;s still in development and there are some obvious things that are missing, but definately something to keep an eye on.<br /></p><p>And yes, this post <span style="font-weight: bold;">was</span> written with Flock.<br /></p></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/10/22/flock/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Salient Released</title>
		<link>http://blog.cons.org.nz/2005/10/05/salient/</link>
		<comments>http://blog.cons.org.nz/2005/10/05/salient/#comments</comments>
		<pubDate>Wed, 05 Oct 2005 09:43:48 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=15</guid>
		<description><![CDATA[<p>The issue of <a href="http://www.salient.org.nz">Salient</a> containing <em>the</em> article, temporarily prevented from distribution, has been released.</p>
]]></description>
			<content:encoded><![CDATA[<p>The issue of <a href="http://www.salient.org.nz">Salient</a> containing <em>the</em> article, temporarily prevented from distribution, has been released. I got my hands on a copy tonight and scanned it, just <a href="http://n.gen.nz/salient-1.png">page one</a>, <a href="http://n.gen.nz/salient-2.png">page two</a> and <a href="http://n.gen.nz/salient-1-colour.png">page one in colour</a> if you so desire.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/10/05/salient/feed/</wfw:commentRss>
		</item>
		<item>
		<title>HTTP in Reverse</title>
		<link>http://blog.cons.org.nz/2005/09/15/http-in-reverse/</link>
		<comments>http://blog.cons.org.nz/2005/09/15/http-in-reverse/#comments</comments>
		<pubDate>Thu, 15 Sep 2005 07:14:03 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>Linux</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=14</guid>
		<description><![CDATA[<p>An exploration into Ajax</p>
]]></description>
			<content:encoded><![CDATA[<p>The design of <a href="http://pros.and.cons.org.nz">pros.and.cons</a> makes it difficult to easily track new changes. I&#8217;ve whipped up <a href="http://watch.n.gen.nz">something</a> to notify you when there are changes.</p>

<p>I used the phrase &#8220;notify you&#8221; as this is what took the most time to do. There is a notification management daemon running which broadcasts the messages generated by the pros.and.cons script. To get this working nicely over HTTP, the background request is made to a script that returns either when there is something to report, or a period of time has elapsed. Notice the typical chain of events would cause a notification to be sent, an instance of the client script to return and the result to be displayed, such that there is no wasteful polling.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/09/15/http-in-reverse/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dolls</title>
		<link>http://blog.cons.org.nz/2005/08/30/dolls/</link>
		<comments>http://blog.cons.org.nz/2005/08/30/dolls/#comments</comments>
		<pubDate>Tue, 30 Aug 2005 10:02:11 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=13</guid>
		<description><![CDATA[<p>Dolls from Eleanor Toland published as splash pages.</p>
]]></description>
			<content:encoded><![CDATA[<p><a href="http://frothmouthedlefty.blogspot.com/">Eleanor Toland</a> has been <a href="http://frothmouthedlefty.blogspot.com/2005/08/first-blog-then-doll.html">creating &#8220;dolls&#8221;</a> with likeness to people she knows and including them in her blog posts. There was <a href="http://frothmouthedlefty.blogspot.com/2005/08/horror-that-eleanor-bestowed-upon-us.html">one I quite liked</a> so I stole the pictures from it and put them up as splash pages. Then came more and I couldn&#8217;t resist, so far I&#8217;ve got <a href="http://fibonacci.n.gen.nz">fibonacci</a>, <a href="http://lorne.n.gen.nz">lorne</a>, <a href="http://donald.n.gen.nz">donald</a> and <a href="http://eleanor.n.gen.nz">eleanor</a>.</p>

<p>Here&#8217;s hoping for some more!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/08/30/dolls/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Ring Two</title>
		<link>http://blog.cons.org.nz/2005/08/27/the-ring-two/</link>
		<comments>http://blog.cons.org.nz/2005/08/27/the-ring-two/#comments</comments>
		<pubDate>Sat, 27 Aug 2005 03:08:20 +0000</pubDate>
		<dc:creator>lorne</dc:creator>
		
		<category>General</category>

		<guid isPermaLink="false">http://blog.cons.org.nz/?p=12</guid>
		<description><![CDATA[<p>I watched The Ring Two last night, it brought closure to a well of issues.</p>
]]></description>
			<content:encoded><![CDATA[<p>I watched <a href="http://imdb.com/title/tt0377109/">The Ring Two</a> last night, it brought closure to a well of issues.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.cons.org.nz/2005/08/27/the-ring-two/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
