<?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>HeyChinaski.com</title>
	<atom:link href="http://www.heychinaski.com/blog/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.heychinaski.com/blog</link>
	<description>The weblog of Tom Martin</description>
	<lastBuildDate>Wed, 22 Feb 2012 09:51:17 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Scala with Mockito gotcha</title>
		<link>http://www.heychinaski.com/blog/2012/02/22/scala-with-mockito-gotcha/</link>
		<comments>http://www.heychinaski.com/blog/2012/02/22/scala-with-mockito-gotcha/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 09:41:54 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Scala]]></category>
		<category><![CDATA[JUnit]]></category>
		<category><![CDATA[Mockito]]></category>
		<category><![CDATA[Unit testing]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=468</guid>
		<description><![CDATA[We do a lot of Scala over at Top10 nowadays.  We also do a lot of unit testing and that means a lot of mocking.  We&#8217;ve been using Mockito due to our familiarity with it as Java developers and because &#8230; <a href="http://www.heychinaski.com/blog/2012/02/22/scala-with-mockito-gotcha/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>We do a lot of Scala over at <a title="Top10" href="http://top10.com">Top10</a> nowadays.  We also do a lot of unit testing and that means a lot of mocking.  We&#8217;ve been using <a title="Mockito on Google Code" href="http://code.google.com/p/mockito/">Mockito</a> due to our familiarity with it as Java developers and because Scala&#8217;s excellent interoperability with Java means that features like the @Mock annotation still work on Scala objects.</p>
<p>One thing to bear in mind when using Mockito matchers with Scala is that Mockito, being a Java library knows nothing of a Scala method&#8217;s default arguments.  So if you have a method like:</p>
<pre style="white-space: pre-wrap; /* css-3 */  white-space: -moz-pre-wrap; /* mozilla, since 1999 */  white-space: -pre-wrap; /* opera 4-6 */  white-space: -o-pre-wrap; /* opera 7 */  word-wrap: break-word;">def myMethod(param: String, defaultStr: String = "defaultToThis")</pre>
<p>and you try to mock it thusly:</p>
<pre style="white-space: pre-wrap; /* css-3 */  white-space: -moz-pre-wrap; /* mozilla, since 1999 */  white-space: -pre-wrap; /* opera 4-6 */  white-space: -o-pre-wrap; /* opera 7 */  word-wrap: break-word;">when(mocked.myMethod(anyString))</pre>
<p>you&#8217;ll probably be met with the following complaint from Mockito:</p>
<pre style="white-space: pre-wrap; /* css-3 */  white-space: -moz-pre-wrap; /* mozilla, since 1999 */  white-space: -pre-wrap; /* opera 4-6 */  white-space: -o-pre-wrap; /* opera 7 */  word-wrap: break-word;">[info]   org.mockito.exceptions.misusing.InvalidUseOfMatchersException: Invalid use of argument matchers!
[info] 0 matchers expected, 2 recorded.
[info] This exception may occur if matchers are combined with raw values:
[info]     //incorrect:
[info]     someMethod(anyObject(), "raw String");
[info] When using matchers, all arguments have to be provided by matchers.
[info] For example:
[info]     //correct:
[info]     someMethod(anyObject(), eq("String by matcher"));</pre>
<p>You can&#8217;t mix regular values with Mockito matchers when mocking a method&#8217;s behavior and the default values will be supplied as plain old values to the mockito object.  The only option is to call all the default parameters with matchers:</p>
<pre style="white-space: pre-wrap; /* css-3 */  white-space: -moz-pre-wrap; /* mozilla, since 1999 */  white-space: -pre-wrap; /* opera 4-6 */  white-space: -o-pre-wrap; /* opera 7 */  word-wrap: break-word;">when(mocked.myMethod(anyString, anyString))</pre>
<p>or if you want to be more specific (and generally you should):</p>
<pre style="white-space: pre-wrap; /* css-3 */  white-space: -moz-pre-wrap; /* mozilla, since 1999 */  white-space: -pre-wrap; /* opera 4-6 */  white-space: -o-pre-wrap; /* opera 7 */  word-wrap: break-word;">when(mocked.myMethod(anyString, Matchers.eq("defaultToThis")))</pre>
<p>(This highlights another gotcha.  eq is a method on AnyRef so it hides any static import of Matchers.eq).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2012/02/22/scala-with-mockito-gotcha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Leaving the BBC. Joining Top10</title>
		<link>http://www.heychinaski.com/blog/2011/08/31/leaving-the-bbc-joining-top10/</link>
		<comments>http://www.heychinaski.com/blog/2011/08/31/leaving-the-bbc-joining-top10/#comments</comments>
		<pubDate>Wed, 31 Aug 2011 14:55:56 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[BBC]]></category>
		<category><![CDATA[top10]]></category>
		<category><![CDATA[bbc]]></category>
		<category><![CDATA[job]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=462</guid>
		<description><![CDATA[After ~20 months it&#8217;s time for me to leave the Big British Castle. It&#8217;s been an honour to work for such a fantastic organisation which is very close to my heart. I&#8217;ve got to work on some great projects and &#8230; <a href="http://www.heychinaski.com/blog/2011/08/31/leaving-the-bbc-joining-top10/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>After ~20 months it&#8217;s time for me to leave the <a title="BBC - Adam and Joe: ADAM MAKES THE BIG BRITISH CASTLE JINGLE" href="http://www.bbc.co.uk/blogs/adamandjoe/2011/04/adam-makes-the-big-british-cas.shtml">Big British Castle</a>.  It&#8217;s been an honour to work for such a fantastic organisation which is very close to my heart.  I&#8217;ve got to work on some great projects and with an awesome bunch of very smart people.</p>
<p>I won&#8217;t go into my reasons for leaving other than to say that I&#8217;m super excited to be starting work at <a title="The Top 10 of Eveything, Created by Everyone | Top10" href="http://top10.co">Top10</a> tomorrow! The name of the site speaks for itself as does the subtitle on the front page &#8220;The Top 10 of Everything, Created by Everyone&#8221;.</p>
<p>I love the concept of the site and where the guys are taking it.  Top10 will be the first startup I&#8217;ve joined and I can&#8217;t wait to start working on the site with some new technologies and another great team.</p>
<p>Here are my <a title="Top 10 Lists by Tom Martin | Top10" href="http://top10.co/tom-martin">Top 10s</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/08/31/leaving-the-bbc-joining-top10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Most tweeted Columbo episodes</title>
		<link>http://www.heychinaski.com/blog/2011/06/26/most-tweeted-columbo-episodes/</link>
		<comments>http://www.heychinaski.com/blog/2011/06/26/most-tweeted-columbo-episodes/#comments</comments>
		<pubDate>Sun, 26 Jun 2011 14:36:21 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Fun]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[columbo]]></category>
		<category><![CDATA[columbo episodes]]></category>
		<category><![CDATA[peter falk]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[tweets]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=448</guid>
		<description><![CDATA[Sadly, Peter Falk died this week.  This means a lot of people are tweeting about Columbo.  Instead of doing all the things I ought to be doing today like exercising, working on an upcoming project and feeding myself I wrote &#8230; <a href="http://www.heychinaski.com/blog/2011/06/26/most-tweeted-columbo-episodes/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/06/Peter_Falk_Columbo.jpg"><img class="size-thumbnail wp-image-452 alignleft" title="Peter_Falk_Columbo" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/06/Peter_Falk_Columbo-150x150.jpg" alt="" width="150" height="150" /></a>Sadly, <a title="BBC News - Columbo star Peter Falk dies aged 83" href="http://www.bbc.co.uk/news/world-us-canada-13909992">Peter Falk died this week</a>.  This means a lot of people are <a title="columbo - Twitter Search" href="http://search.twitter.com/search?q=columbo">tweeting about Columbo</a>.  Instead of doing all the things I ought to be doing today like <a title="Tom Martin - Runkeeper" href="http://runkeeper.com/user/HeyChinaski/profile">exercising</a>, working on <a title="Music Road Trip" href="http://www.musicroadtrip.com/">an upcoming project</a> and <a title="BBC - Food - Recipe finder : roast beef" href="http://www.bbc.co.uk/food/recipes/search?keywords=roast+beef">feeding myself</a> I wrote <a title="tom-martin/Columbo-Tweet-Count - GitHub" href="https://github.com/tom-martin/Columbo-Tweet-Count">a Python script</a> to find the most tweeted about Columbo episodes.  Here are the results:</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/06/columbo_tweeted.jpg"><img class="alignnone size-full wp-image-449" title="Most tweeted Columbo episodes" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/06/columbo_tweeted.jpg" alt="" width="648" height="466" /></a></p>
<p>The script searches for the episode title in quotes plus the word Columbo (as episodes like &#8220;Undercover&#8221; and &#8220;Dead Weight&#8221; were returning a lot of false positives).  I&#8217;ll stick the script on github later, first I have to get to the supermarket before it closes.</p>
<p>Update: Script is on <a title="tom-martin/Columbo-Tweet-Count - GitHub" href="https://github.com/tom-martin/Columbo-Tweet-Count">github</a>.  It&#8217;s dead simple, probably could have just been a gist.  I got the list of episodes from <a title="Columbo - Episode Titles" href="http://www.columbo-site.freeuk.com/episode.htm">here</a>.  There are some <a title="sample-results-Jun-26-16:31:53-BST-2011.txt at master from tom-martin/Columbo-Tweet-Count - GitHub" href="https://github.com/tom-martin/Columbo-Tweet-Count/blob/master/sample-results-Jun-26-16:31:53-BST-2011.txt">sample results</a> in the git project.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/06/26/most-tweeted-columbo-episodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter rate limiting and Google App Engine</title>
		<link>http://www.heychinaski.com/blog/2011/04/23/twitter-rate-limiting-and-google-app-engine/</link>
		<comments>http://www.heychinaski.com/blog/2011/04/23/twitter-rate-limiting-and-google-app-engine/#comments</comments>
		<pubDate>Sat, 23 Apr 2011 15:32:20 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[markovator]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[GAE]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[twitter api]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=421</guid>
		<description><![CDATA[@markovator has been silent for some time. He&#8217;d been replying to people but he&#8217;d not been able to come up with his own original tweets. The reason for this is the that he was being rate limited by Twitter. Initially &#8230; <a href="http://www.heychinaski.com/blog/2011/04/23/twitter-rate-limiting-and-google-app-engine/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/04/twitter_blocked.png"><img class="size-full wp-image-434 alignleft" title="Twitter blocked icon" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/04/twitter_blocked.png" alt="Twitter blocked icon" width="200" height="200" /></a>@<a title="Markovator on Twitter" href="http://twitter.com/markovator">markovator</a> has been silent for some time.  He&#8217;d been replying to people but he&#8217;d not been able to come up with his own original tweets.  The reason for this is the that he was being rate limited by Twitter.  Initially this seemed strange to me as markovator tweets quite infrequently (at the very most once every minute if people are constantly pestering him).  However the markovator code was inconsistent in how it authenticated with the twitter api.  When it didn&#8217;t seem necessary to authenticate I didn&#8217;t (for example when requesting an unprotected user&#8217;s tweets).  Twitter applies the rate limit to the IP of the machine making the request and when you&#8217;re running on Google App Engine you never know anything about the node you&#8217;re making http requests from or who else is using it.  Whilst App Engines IPs seem to have been whitelisted (they can make 20000 requests per hour) all it would take (and did take, it seems) to cause markovator&#8217;s requests to be refused is a few more apps with very heavy unauthenticated twitter usage.</p>
<p>So you&#8217;ve been warned.  If you&#8217;re building an app the uses twitter on app engine always OAuth authenticate, even when this seems unnecessary or a pain otherwise you&#8217;ll always be at the whim of twitter&#8217;s IP limiting.  Obviously markovator always authenticates as @markovator now.  If you usually authenticate on behalf of your users then you should use the twitter account you used to register your twitter app just for making those public, read only requests you might have thought could go unauthenticated.  You can avoid the OAuth flow by getting a <a title="Using one access token with OAuth | dev.twitter.com" href="https://dev.twitter.com/pages/oauth_single_token">single access token</a> for that account from your <a title="Your Twitter applications" href="https://dev.twitter.com/apps">twitter app page on dev.twitter.com</a></p>
<p>On a side note the <a title="GET account/rate_limit_status | dev.twitter.com" href="http://dev.twitter.com/doc/get/account/rate_limit_status">account/rate_limit_status</a> endpoint seems a little capricious.  I have an admin endpoint that reports the status of the markovator app, including it&#8217;s authenticated rate limit status.  When run locally it returns 350 per hour whilst when run on app engine it returns 20000 per hour.  Perhaps the whitelisted status of App Engine overrides the fact that the status request is authenticated.  Despite this the authenticated rate limiting does seem to apply when making authenticated requests from App Engine to Twitter.</p>
<p>Links:</p>
<ul>
<li><a title="markovator on github" rel="bookmark" href="https://github.com/tom-martin/markovator">markovator on github</a></li>
<li><a title="Permalink to Markovator – Python + Google App Engine + Markov chains + Twitter" rel="bookmark" href="http://www.heychinaski.com/blog/2010/10/18/markovator-python-google-app-engine-markov-chains-twitter/">Markovator – Python + Google App Engine + Markov chains + Twitter</a></li>
<li><a title="twitter Rate limit exceeded google app engine - Stack Overflow" href="http://stackoverflow.com/questions/3284205/twitter-rate-limit-exceeded-google-app-engine">Relevant Stack Overflow question</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/04/23/twitter-rate-limiting-and-google-app-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Minecraft Tumblr blog</title>
		<link>http://www.heychinaski.com/blog/2011/03/05/minecraft-tumblr-blog/</link>
		<comments>http://www.heychinaski.com/blog/2011/03/05/minecraft-tumblr-blog/#comments</comments>
		<pubDate>Sat, 05 Mar 2011 15:34:29 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Fun]]></category>
		<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[minecraft]]></category>
		<category><![CDATA[postcards from minecraft]]></category>
		<category><![CDATA[tumblr]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=410</guid>
		<description><![CDATA[I created a Tumblr blog for recording our minecraft adventures rather than filling this site up. I&#8217;ve cross posted the original minecraft post from here and added a couple more. New Floor and a Better Farm Valentines Day More to &#8230; <a href="http://www.heychinaski.com/blog/2011/03/05/minecraft-tumblr-blog/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-422" style="border: 1px solid black;" title="Postcards from Minecraft" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/03/blog_screeny.jpg" alt="Postcards from Minecraft" width="530" height="620" /></p>
<p>I created a <a title="Postcards from Minecraft" href="http://minecraft-postcards.tumblr.com/">Tumblr b</a>log for recording our minecraft adventures rather than filling this site up.</p>
<p>I&#8217;ve cross posted the original minecraft post from here and added a couple more.</p>
<ul>
<li><a title="New Floor and a Better Farm" href="http://minecraft-postcards.tumblr.com/post/3648885453/new-floor-and-a-better-farm">New Floor and a Better Farm</a></li>
<li><a title="Valentines Day" href="http://minecraft-postcards.tumblr.com/post/3649353587/valentines-day">Valentines Day</a></li>
</ul>
<p>More to come soon.  Enjoy <img src='http://www.heychinaski.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/03/05/minecraft-tumblr-blog/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Minecraft</title>
		<link>http://www.heychinaski.com/blog/2011/02/08/minecraft/</link>
		<comments>http://www.heychinaski.com/blog/2011/02/08/minecraft/#comments</comments>
		<pubDate>Tue, 08 Feb 2011 14:18:18 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Gaming]]></category>
		<category><![CDATA[Minecraft]]></category>
		<category><![CDATA[gaming]]></category>
		<category><![CDATA[minecraft]]></category>
		<category><![CDATA[multiplayer]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=383</guid>
		<description><![CDATA[I&#8217;ve been playing Minecraft single player for a while now and it&#8217;s great.  Everything you&#8217;ve heard about the game is true.  The whole mechanic hinges around the simple rules that govern the physics of the world and the unique experiences &#8230; <a href="http://www.heychinaski.com/blog/2011/02/08/minecraft/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-07_23.54.38.jpg"><img class="alignnone size-full wp-image-400" title="Caragh looking out at the monsters from the castle walls" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-07_23.54.38.jpg" alt="Caragh looking out at the monsters from the castle walls" width="1920" height="1005" /></a>I&#8217;ve been playing <a title="Minecraft" href="http://www.minecraft.net/">Minecraft</a> single player for a while now and it&#8217;s great.  Everything you&#8217;ve heard about the game is true.  The whole mechanic hinges around the simple rules that govern the physics of the world and the unique experiences that emerge from them (apparently this is called <a title="Emergent gameplay on Wikipedia" href="http://en.wikipedia.org/wiki/Emergent_gameplay">emergent gameplay</a>).  The adventures you can have battling monsters, exploring caves and going off on hikes and sea voyages can be exhilarating, scary and challenging.  The simple graphics are charming and sometimes quite awe inspiring once you reach a mountain peak and get a good view of the impressive terrains that get generated.  There&#8217;s nothing like building your own world to really get you invested in what goes on in it and that&#8217;s exactly what you do as you stack tons of cobblestones into towering battlements around your castle keep, dig endlessly downwards into your labyrinth mines and caves and carefully landscape grassy forests and deserts into the perfect back garden.</p>
<p>Singleplayer was great but what has been even more fun is setting up a server and convincing Caragh to join me in a multiplayer world.  Here are some screenshots of the action we&#8217;ve encountered so far.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-29_23.54.01.jpg"><img class="alignnone size-full wp-image-394" title="A new world" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-29_23.54.01.jpg" alt="Minecraft beach/desert screenshot" width="960" height="503" /></a></p>
<p>This is the spawn location in our world, every time you die you&#8217;re yanked back here and all your stuff stays where you were so you have to run back and collect it before it disappears.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/cutting_trees.jpg"><img class="alignnone size-full wp-image-407" title="Logging" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/cutting_trees.jpg" alt="Screenshot Caragh of cutting down trees" width="923" height="470" /></a></p>
<p>Caragh&#8217;s cutting down logs while I head off to find coal.  It&#8217;s important to gather coal and wood on your first day so you can craft <a title="Torch - Minecraft wiki" href="http://www.minecraftwiki.net/wiki/Torch">torches</a> to get through that long first night.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-29_23.53.33.jpg"><img class="alignnone size-full wp-image-393" title="Sun's going down, here come the monsters" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-29_23.53.33.jpg" alt="Sun's going down, here come the monsters" width="960" height="503" /></a></p>
<p>The sun&#8217;s going down which means the monsters will be coming out.  Time to start to build a shelter so we can hide away.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.04.31.jpg"><img class="alignnone size-full wp-image-395" title="Time to dig a shelter into the hillside" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.04.31.jpg" alt="Time to dig a shelter into the hillside" width="960" height="503" /></a></p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.09.37.jpg"><img class="alignnone size-full wp-image-396" title="Got our chest, crafting bench and furnace set up" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.09.37.jpg" alt="Got our chest, crafting bench and furnace set up" width="960" height="503" /></a></p>
<p>We&#8217;ve got a little hole to hide away in now, with a <a title="Door - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Door">door</a>, a <a title="Furnace - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Furnace">furnace</a>, <a title="Crafting Table - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Crafting_Table">crafting bench</a>, a <a title="Chest - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Chest">chest</a> and most importantly, torch light.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.32.44.jpg"><img class="alignnone size-full wp-image-397" title="Started digging a mine" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.32.44.jpg" alt="Started digging a mine" width="960" height="503" /></a></p>
<p>At first the only thing to do at night is to start digging a mineshaft so you can mine out some raw materials like <a title="Coal (Item) - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Coal_(Item)">coal</a>, <a title="Iron (Ingot) - Minecraft" href="http://www.minecraftwiki.net/wiki/Iron_(Ingot)">iron</a> and maybe even <a title="Diamond (Gem) - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Diamond_(Gem)">diamond</a>.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.40.43.jpg"><img class="alignnone size-full wp-image-398" title="A scary cave to explore at the bottom of our mine" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_00.40.43.jpg" alt="A scary cave to explore at the bottom of our mine" width="960" height="503" /></a>Whilst mining you&#8217;ll often breakthrough into huge natural caverns or tight twisting passages with zombies and skeletons hiding around every corner.  It&#8217;s up to you whether to hastily brick them up or to grab a torch and a sword and venture in.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_01.16.45.jpg"><img class="alignnone size-full wp-image-399" title="I think Caragh got Creepered!" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-01-30_01.16.45.jpg" alt="I think Caragh got Creepered!" width="960" height="503" /></a></p>
<p>Caragh standing in a <a title="Creeper - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Creeper">creeper</a> crater.  Creepers will sneak up on you soundlessly before making a hissing noise and exploding.  Creeper death was our number two cause of death starting out, after falling down our mineshaft.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-07_23.55.06.jpg"><img class="alignnone size-full wp-image-401" title="Finally we have a small farm and some safe walls" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-07_23.55.06.jpg" alt="Finally we have a small farm and some safe walls" width="960" height="503" /></a></p>
<p>Eventually we get a nice set of castle walls up outside our shelter so we can come out at night in relative safety.  The plants down there are the start of a <a title="Wheat - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Wheat">wheat</a> farm and a <a title="Sugar Cane - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Sugar_cane">sugar cane</a> crop.<a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.23.27.jpg"><img class="alignnone size-full wp-image-402" title="I built a porch out the front" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.23.27.jpg" alt="I built a porch out the front" width="960" height="503" /></a></p>
<p>We built a porch out the front because we kept opening our front door to find a creeper or a <a title="Spider - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Spider">spider</a> waiting for us.  The elevated porch is harder for the creepers to get as near to and the <a title="Glass - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Glass">glass</a> allows us to look out and see where they are.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.54.18.jpg"><img class="alignnone size-full wp-image-405" title="Looking nicer inside, we have cake!" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.54.18.jpg" alt="Looking nicer inside, we have cake!" width="960" height="503" /></a></p>
<p>We expanded the inside around our mine a little bit and made <a title="Cake - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Cake">cake</a>.  The cake replenishes health and is made from the crops we farmed outside (and some <a title="Eggs - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Eggs">eggs</a> and <a title="Milk - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Milk">milk</a>).  We found the <a title="Pumpkin - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Pumpkin">pumpkin</a> outside and put a torch inside to make a <a title="Jack-O-Lantern - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Jack-O-Lantern">Jack-O-Lantern</a>.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.27.21.jpg"><img class="alignnone size-full wp-image-403" title="Better view" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.27.21.jpg" alt="I climbed a big tree on the mountainside to get a better view of our castle" width="960" height="503" /></a></p>
<p>I climbed a tall tree on the hillside to get a better view of our castle/shelter.  You can see the skylight that lights our mineshaft from here.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.27.21.jpg"></a><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-15.jpg"><img class="alignnone size-full wp-image-406" title="Venturing further from home" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-15.jpg" alt="Venturing further from home" width="960" height="503" /></a></p>
<p>Venturing even further from home.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.45.38.jpg"><img class="alignnone size-full wp-image-404" title="Begging to be explored!" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/02/2011-02-08_00.45.38.jpg" alt="Begging to be explored!" width="1920" height="1005" /></a></p>
<p>In the other direction is a huge island.  I can&#8217;t wait to take a <a title="Boat - Minecraft Wiki" href="http://www.minecraftwiki.net/wiki/Boat">boat</a> over there and explore.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/02/08/minecraft/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>A History of the World in 100 Seconds</title>
		<link>http://www.heychinaski.com/blog/2011/01/24/a-history-of-the-world-in-100-seconds/</link>
		<comments>http://www.heychinaski.com/blog/2011/01/24/a-history-of-the-world-in-100-seconds/#comments</comments>
		<pubDate>Tue, 25 Jan 2011 00:13:28 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Wikipedia]]></category>
		<category><![CDATA[hackday]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=373</guid>
		<description><![CDATA[I attended the History Hackday at the Guardian and helped Gareth implement his cunning plan to scrape Wikipedia for all historical events with associated geo coordinates and present them chronologically.  The video above is the result.  Unfortunately I couldn&#8217;t be &#8230; <a href="http://www.heychinaski.com/blog/2011/01/24/a-history-of-the-world-in-100-seconds/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><iframe src="http://player.vimeo.com/video/19088241" width="640" height="320" frameborder="0"></iframe></p>
<p>I attended the <a href="http://historyhackday.org/">History Hackday</a> at the Guardian and helped <a title="Gareth" href="http://www.ragtag.info/">Gareth </a>implement his cunning plan to scrape Wikipedia for all historical events with associated geo coordinates and present them chronologically.  The video above is the result.  Unfortunately I couldn&#8217;t be there on Sunday but whilst <a title="Gareth Lloyd on twitter" href="http://twitter.com/#!/godawful">Gareth</a> set about doing the hard bit, using Python and <a title="MongoDB" href="http://www.mongodb.org/">Mongo</a> to extract the events from his <a title="30 jiggabytes!!??" href="http://twitter.com/#!/godawful/status/28725374464561152">dump of Wikipedia</a>, I managed to code up a framework in Java for Gareth to produce the visualisation video from.  The dataset is pretty fuzzy, we went through each <a title="1983 - Wikipedia" href="http://en.wikipedia.org/wiki/1983">Wikipedia year page</a> and kept all pages that were linked to for that year that also had coords.  I&#8217;m pretty pleased with the results, we won a prize for &#8220;best visualisation&#8221;, although I&#8217;d like to spend a little more time tweaking the graphics if I find the time.  The code is available on <a title="visualizing-events on github" href="https://github.com/gareth-lloyd/visualizing-events">github</a>.</p>
<p>The hackday itself was pretty cool, well stocked with beer, pizza and cool people. Props for a well organised event go to <a title="Matt Patterson on twitter" href="http://twitter.com/#!/fidothe">@fidothe</a>, I&#8217;m sorry I couldn&#8217;t have been there for the whole thing.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/01/24/a-history-of-the-world-in-100-seconds/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Neon Trails Live Wallpaper for Android</title>
		<link>http://www.heychinaski.com/blog/2011/01/02/neon-trails-live-wallpaper-for-android/</link>
		<comments>http://www.heychinaski.com/blog/2011/01/02/neon-trails-live-wallpaper-for-android/#comments</comments>
		<pubDate>Sun, 02 Jan 2011 23:02:24 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Android]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[live wallpaper]]></category>
		<category><![CDATA[neon trails]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=350</guid>
		<description><![CDATA[Since version 2.1, Android has had a live wallpaper feature which allows dynamic wallpapers to be built for the Android home screen that can animate and respond to touch and other inputs.  They&#8217;re remarkably easy to develop so I spent &#8230; <a href="http://www.heychinaski.com/blog/2011/01/02/neon-trails-live-wallpaper-for-android/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Since version 2.1, Android has had a live wallpaper feature which allows dynamic wallpapers to be built for the Android home screen that can animate and respond to touch and other inputs.  They&#8217;re remarkably easy to develop so I spent some of my time off this holiday season building one I call Neon Trails.  The wallpaper draws little trails that wind themselves across the screen and around each other.<a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/any_medium_screen.png"><img class="alignnone size-full wp-image-353" title="Neon Live Wallpaper" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/any_medium_screen.png" alt="Neon Live Wallpaper" width="480" height="800" /></a></p>
<p>The algorithm for the trails is relatively simple, each moves forward one unit and then chooses a random direction to travel in before moving forward another unit and picking another direction.  Each trail won&#8217;t pick a direction that will cause it to overlap with itself or another and will stop moving as soon as is it gets trapped.</p>
<p>The rendering was done using the 2D API that Android provides via the <a title="Canvas Android docs" href="http://developer.android.com/reference/android/graphics/Canvas.html">Canvas</a> class.  The little lights at the end of active trails were achieved by faking a bloom effect by repeatedly rendering a circle with a number of <a title="BlurMaskFilter Android docs" href="http://developer.android.com/reference/android/graphics/BlurMaskFilter.html">BlurMaskFilters</a>, each with a smaller radius than the last.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/thin_green_screen.png"><img title="Neon Trails Live Wallpaper for Android with a green color scheme" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/thin_green_screen.png" alt="Neon Trails Live Wallpaper for Android with a green color scheme" width="480" height="800" /></a></p>
<p>Most of the work was spent optimising various things.  A more optimised wallpaper will scroll better as the user drags between virtual home screens and will use less battery.  Memory allocation and garbage collection are generally quite expensive on the <a title="Dalvik (software) - Wikipedia" href="http://en.wikipedia.org/wiki/Dalvik_%28software%29">Dalvik VM</a> so avoiding using the new keyword where ever possible, except on start up, is generally a good idea when optimising for Android (there is still some work to do here as both the Trail and Grid class frequently allocate new Point instances).  The <a title="DDMS Android docs" href="http://developer.android.com/guide/developing/tools/ddms.html">DDMS</a> eclipse tool that you get with Android is excellent for tracking these things.</p>
<p>The technique that seemed to give the greatest benefit in terms of performance was generating an offscreen buffer (an instance of Bitmap) to render the &#8220;terminated&#8221; trails to (active trails are moving too much so would invalidate the buffer on every frame).  Referencing the buffer with a <a title="SoftReference Android docs" href="http://developer.android.com/reference/java/lang/ref/SoftReference.html">SoftReference</a> meant that the system could always garbage collect the image if it couldn&#8217;t spare the memory required.  This is generally good practice for all non-essential offscreen buffers when working on optimised UIs in Java where memory might be tight.</p>
<p><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/thick_yellow_screen.png"><img class="alignnone size-full wp-image-352" title="Neon Trails Live Wallpaper for Android with yellow color scheme" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/thick_yellow_screen.png" alt="Neon Trails Live Wallpaper for Android with yellow color scheme" width="480" height="800" /></a></p>
<p>The wallpaper is fairly customisable in terms of appearance, you can alter the color scheme and appearance of the trails and can even set a lower frame rate if you&#8217;re worried about the wallpapers effect on battery life.  The wallpaper is available for free on the <a title="(Link only works on an android device)" href="market://details?id=com.heychinaski.droid.wp.trails">Android Market</a> and you can find <a title="Neon Trails source on Github" href="https://github.com/tom-martin/Neon-Trails">the code on Github</a>.</p>
<div id="attachment_371" class="wp-caption alignnone" style="width: 322px"><a href="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/neon_trails_qr.png"><img class="size-full wp-image-371" title="QR Code for Neon Trails Live Wallpaper for Android" src="http://www.heychinaski.com/blog/wp-content/uploads/2011/01/neon_trails_qr.png" alt="QR Code for Neon Trails Live Wallpaper for Android" width="312" height="312" /></a><p class="wp-caption-text">QR Code for Neon Trails Live Wallpaper for Android</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2011/01/02/neon-trails-live-wallpaper-for-android/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Markovator &#8211; Python + Google App Engine + Markov chains + Twitter</title>
		<link>http://www.heychinaski.com/blog/2010/10/18/markovator-python-google-app-engine-markov-chains-twitter/</link>
		<comments>http://www.heychinaski.com/blog/2010/10/18/markovator-python-google-app-engine-markov-chains-twitter/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 23:37:14 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[google app engine]]></category>
		<category><![CDATA[markov chains]]></category>
		<category><![CDATA[markovator]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=315</guid>
		<description><![CDATA[As a child a chat bot program called NIALL made quite an impression on me.  It came on one of those demo floppy disks from some PC magazine I forget the name of now.  NIALL stands for Non Intelligent Acquired &#8230; <a href="http://www.heychinaski.com/blog/2010/10/18/markovator-python-google-app-engine-markov-chains-twitter/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<!-- tweet id : 27594550337 --><style type='text/css'>#bbpBox_27594550337 a { text-decoration:none; color:#0084B4; }#bbpBox_27594550337 a:hover { text-decoration:underline; }</style><div id='bbpBox_27594550337' class='bbpBox' style='padding:20px; margin:5px 0; background-color:#F2F2F2; background-image:url(http://a0.twimg.com/profile_background_images/158574341/Markovator_bg.png); background-repeat:no-repeat'><div style='background:#fff; padding:10px; margin:0; min-height:48px; color:#333333; -moz-border-radius:5px; -webkit-border-radius:5px;'><span style='width:100%; font-size:18px; line-height:22px;'>Can good TV shows have a dog eating cat poop.</span><div class='bbp-actions' style='font-size:12px; width:100%; padding:5px 0; margin:0 0 10px 0; border-bottom:1px solid #e6e6e6;'><img align='middle' src='http://www.heychinaski.com/blog/wp-content/plugins/twitter-blackbird-pie//images/bird.png' /><a title='tweeted on October 16, 2010 6:48 pm' href='http://twitter.com/#!/markovator_dev/status/27594550337' target='_blank'>October 16, 2010 6:48 pm</a> via <a href="http://heychinaski.com" rel="nofollow" target="blank">markovator_dev</a><a href='https://twitter.com/intent/tweet?in_reply_to=27594550337' class='bbp-action bbp-reply-action' title='Reply'><span><em style='margin-left: 1em;'></em><strong>Reply</strong></span></a><a href='https://twitter.com/intent/retweet?tweet_id=27594550337' class='bbp-action bbp-retweet-action' title='Retweet'><span><em style='margin-left: 1em;'></em><strong>Retweet</strong></span></a><a href='https://twitter.com/intent/favorite?tweet_id=27594550337' class='bbp-action bbp-favorite-action' title='Favorite'><span><em style='margin-left: 1em;'></em><strong>Favorite</strong></span></a></div><div style='float:left; padding:0; margin:0'><a href='http://twitter.com/intent/user?screen_name=markovator_dev'><img style='width:48px; height:48px; padding-right:7px; border:none; background:none; margin:0' src='http://a0.twimg.com/profile_images/1138905232/Markovator_icon_normal.png' /></a></div><div style='float:left; padding:0; margin:0'><a style='font-weight:bold' href='http://twitter.com/intent/user?screen_name=markovator_dev'>@markovator_dev</a><div style='margin:0; padding-top:2px'>Markovator Dev</div></div><div style='clear:both'></div></div></div><!-- end of tweet -->
<p>As a child a chat bot program called NIALL made quite an impression on me.  It came on one of those demo floppy disks from some PC magazine I forget the name of now.  NIALL stands for Non Intelligent Acquired Language Learner and what it (he?) would do is remember each word you &#8220;said&#8221; to it and the frequency that any following word appeared after it.  So for example when given the sentence &#8220;the cat sat on the mat&#8221; NIALL would remember that &#8220;cat&#8221; always precedes &#8220;sat&#8221; but that &#8220;the&#8221; only precedes &#8220;cat&#8221; half the time, the other half of the time it precedes &#8220;mat&#8221;.  Whilst slowly building up this dataset of word frequencies with each message you would type in it would use them to generate its own nonsensical, sometimes amusing replies.  You can find a better description of the process on the <a title="gNiall | How it works" href="http://gniall.sourceforge.net/howitworks/">how it works</a> page of this <a title="gNiall" href="http://gniall.sourceforge.net/">GNOME implementation</a>.</p>
<p><span id="more-315"></span></p>
<p>I most enjoyed the experience of &#8220;talking&#8221; to a computer and having it reply.  Whilst NIALL wouldn&#8217;t get within a million miles of passing the <a title="Turing test on Wikipedia" href="http://en.wikipedia.org/wiki/Turing_test">Turing test</a> it was my first experience of any kind of a &#8220;chatbot&#8221;.  Additionally the accompanying explanation of how it worked (very similar to the gNiall explanation linked above) was simple concise and illustrated the technique quite clearly.  I&#8217;ve since always wanted to hack together a clone of NIALL as an exercise.  I&#8217;m sure I initiated a number of failed attempts in QBASIC but the required string manipulation would doubtless have been beyond my 10 year old programming brain.</p>
<p>With the recent realisation that the 2010 analog of a chatbot is a twitterbot and the need for a simple project to get to grips with Python on Google App Engine I needed no further excuse.  <a title="markovator on twitter" href="http://twitter.com/markovator">markovator</a> is the result.  If you @mention him he will send you a reply generated NIALL-style from some of your recent tweets.  He will also follow you (feel free to block him if you don&#8217;t like this!) and occasionally send out a tweet made up of all the tweets of the people he is following.  markovator won&#8217;t use @mentions you&#8217;ve sent to other people so you won&#8217;t be the cause of him spamming your friends.</p>
<p>Here are a few of my favourite markovator tweets that were generated whilst developing him:</p>
<!-- tweet id : 27773060677 --><style type='text/css'>#bbpBox_27773060677 a { text-decoration:none; color:#0084B4; }#bbpBox_27773060677 a:hover { text-decoration:underline; }</style><div id='bbpBox_27773060677' class='bbpBox' style='padding:20px; margin:5px 0; background-color:#F2F2F2; background-image:url(http://a0.twimg.com/profile_background_images/158574341/Markovator_bg.png); background-repeat:no-repeat'><div style='background:#fff; padding:10px; margin:0; min-height:48px; color:#333333; -moz-border-radius:5px; -webkit-border-radius:5px;'><span style='width:100%; font-size:18px; line-height:22px;'>@<a href="http://twitter.com/intent/user?screen_name=HeyChinaski" class="twitter-action">HeyChinaski</a> markovated: Criticker says it really needs to have randomly spammed BBC White City Tesco.</span><div class='bbp-actions' style='font-size:12px; width:100%; padding:5px 0; margin:0 0 10px 0; border-bottom:1px solid #e6e6e6;'><img align='middle' src='http://www.heychinaski.com/blog/wp-content/plugins/twitter-blackbird-pie//images/bird.png' /><a title='tweeted on October 18, 2010 2:59 pm' href='http://twitter.com/#!/markovator_dev/status/27773060677' target='_blank'>October 18, 2010 2:59 pm</a> via <a href="http://heychinaski.com" rel="nofollow" target="blank">markovator_dev</a><a href='https://twitter.com/intent/tweet?in_reply_to=27773060677' class='bbp-action bbp-reply-action' title='Reply'><span><em style='margin-left: 1em;'></em><strong>Reply</strong></span></a><a href='https://twitter.com/intent/retweet?tweet_id=27773060677' class='bbp-action bbp-retweet-action' title='Retweet'><span><em style='margin-left: 1em;'></em><strong>Retweet</strong></span></a><a href='https://twitter.com/intent/favorite?tweet_id=27773060677' class='bbp-action bbp-favorite-action' title='Favorite'><span><em style='margin-left: 1em;'></em><strong>Favorite</strong></span></a></div><div style='float:left; padding:0; margin:0'><a href='http://twitter.com/intent/user?screen_name=markovator_dev'><img style='width:48px; height:48px; padding-right:7px; border:none; background:none; margin:0' src='http://a0.twimg.com/profile_images/1138905232/Markovator_icon_normal.png' /></a></div><div style='float:left; padding:0; margin:0'><a style='font-weight:bold' href='http://twitter.com/intent/user?screen_name=markovator_dev'>@markovator_dev</a><div style='margin:0; padding-top:2px'>Markovator Dev</div></div><div style='clear:both'></div></div></div><!-- end of tweet -->
<!-- tweet id : 27674338960 --><style type='text/css'>#bbpBox_27674338960 a { text-decoration:none; color:#0084B4; }#bbpBox_27674338960 a:hover { text-decoration:underline; }</style><div id='bbpBox_27674338960' class='bbpBox' style='padding:20px; margin:5px 0; background-color:#F2F2F2; background-image:url(http://a0.twimg.com/profile_background_images/158574341/Markovator_bg.png); background-repeat:no-repeat'><div style='background:#fff; padding:10px; margin:0; min-height:48px; color:#333333; -moz-border-radius:5px; -webkit-border-radius:5px;'><span style='width:100%; font-size:18px; line-height:22px;'>Lovely pub lunch with my favorite movies of his nose?</span><div class='bbp-actions' style='font-size:12px; width:100%; padding:5px 0; margin:0 0 10px 0; border-bottom:1px solid #e6e6e6;'><img align='middle' src='http://www.heychinaski.com/blog/wp-content/plugins/twitter-blackbird-pie//images/bird.png' /><a title='tweeted on October 17, 2010 2:41 pm' href='http://twitter.com/#!/markovator_dev/status/27674338960' target='_blank'>October 17, 2010 2:41 pm</a> via <a href="http://heychinaski.com" rel="nofollow" target="blank">markovator_dev</a><a href='https://twitter.com/intent/tweet?in_reply_to=27674338960' class='bbp-action bbp-reply-action' title='Reply'><span><em style='margin-left: 1em;'></em><strong>Reply</strong></span></a><a href='https://twitter.com/intent/retweet?tweet_id=27674338960' class='bbp-action bbp-retweet-action' title='Retweet'><span><em style='margin-left: 1em;'></em><strong>Retweet</strong></span></a><a href='https://twitter.com/intent/favorite?tweet_id=27674338960' class='bbp-action bbp-favorite-action' title='Favorite'><span><em style='margin-left: 1em;'></em><strong>Favorite</strong></span></a></div><div style='float:left; padding:0; margin:0'><a href='http://twitter.com/intent/user?screen_name=markovator_dev'><img style='width:48px; height:48px; padding-right:7px; border:none; background:none; margin:0' src='http://a0.twimg.com/profile_images/1138905232/Markovator_icon_normal.png' /></a></div><div style='float:left; padding:0; margin:0'><a style='font-weight:bold' href='http://twitter.com/intent/user?screen_name=markovator_dev'>@markovator_dev</a><div style='margin:0; padding-top:2px'>Markovator Dev</div></div><div style='clear:both'></div></div></div><!-- end of tweet -->
<!-- tweet id : 27772966448 --><style type='text/css'>#bbpBox_27772966448 a { text-decoration:none; color:#0084B4; }#bbpBox_27772966448 a:hover { text-decoration:underline; }</style><div id='bbpBox_27772966448' class='bbpBox' style='padding:20px; margin:5px 0; background-color:#F2F2F2; background-image:url(http://a0.twimg.com/profile_background_images/158574341/Markovator_bg.png); background-repeat:no-repeat'><div style='background:#fff; padding:10px; margin:0; min-height:48px; color:#333333; -moz-border-radius:5px; -webkit-border-radius:5px;'><span style='width:100%; font-size:18px; line-height:22px;'>@<a href="http://twitter.com/intent/user?screen_name=HeyChinaski" class="twitter-action">HeyChinaski</a> markovated: So Ben Affleck is way more grey hairs in my Ubuntu install. Bedtime.</span><div class='bbp-actions' style='font-size:12px; width:100%; padding:5px 0; margin:0 0 10px 0; border-bottom:1px solid #e6e6e6;'><img align='middle' src='http://www.heychinaski.com/blog/wp-content/plugins/twitter-blackbird-pie//images/bird.png' /><a title='tweeted on October 18, 2010 2:58 pm' href='http://twitter.com/#!/markovator_dev/status/27772966448' target='_blank'>October 18, 2010 2:58 pm</a> via <a href="http://heychinaski.com" rel="nofollow" target="blank">markovator_dev</a><a href='https://twitter.com/intent/tweet?in_reply_to=27772966448' class='bbp-action bbp-reply-action' title='Reply'><span><em style='margin-left: 1em;'></em><strong>Reply</strong></span></a><a href='https://twitter.com/intent/retweet?tweet_id=27772966448' class='bbp-action bbp-retweet-action' title='Retweet'><span><em style='margin-left: 1em;'></em><strong>Retweet</strong></span></a><a href='https://twitter.com/intent/favorite?tweet_id=27772966448' class='bbp-action bbp-favorite-action' title='Favorite'><span><em style='margin-left: 1em;'></em><strong>Favorite</strong></span></a></div><div style='float:left; padding:0; margin:0'><a href='http://twitter.com/intent/user?screen_name=markovator_dev'><img style='width:48px; height:48px; padding-right:7px; border:none; background:none; margin:0' src='http://a0.twimg.com/profile_images/1138905232/Markovator_icon_normal.png' /></a></div><div style='float:left; padding:0; margin:0'><a style='font-weight:bold' href='http://twitter.com/intent/user?screen_name=markovator_dev'>@markovator_dev</a><div style='margin:0; padding-top:2px'>Markovator Dev</div></div><div style='clear:both'></div></div></div><!-- end of tweet -->
<p>markovator is so named because (as far as I understand the concept) the process of generating his tweets is a kind of <a title="Markov chain - Wikipedia" href="http://en.wikipedia.org/wiki/Markov_chain">Markov chain</a> in that it &#8220;is a random process with the property that the next state depends only on the current state.&#8221;  The source can be found on <a title="markovator on github" href="http://github.com/tom-martin/markovator">github</a> (sans twitter auth details of course).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2010/10/18/markovator-python-google-app-engine-markov-chains-twitter/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>HeyGraph Javascript and canvas graphing tool</title>
		<link>http://www.heychinaski.com/blog/2010/01/10/heygraph-javascript-and-canvas-graphing-tool/</link>
		<comments>http://www.heychinaski.com/blog/2010/01/10/heygraph-javascript-and-canvas-graphing-tool/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 00:48:13 +0000</pubDate>
		<dc:creator>HeyChinaski</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[canvas]]></category>
		<category><![CDATA[force-directed]]></category>
		<category><![CDATA[Google Chrome]]></category>
		<category><![CDATA[graph]]></category>
		<category><![CDATA[graphing]]></category>
		<category><![CDATA[HTML 5]]></category>

		<guid isPermaLink="false">http://www.heychinaski.com/blog/?p=288</guid>
		<description><![CDATA[To learn a bit about the HTML 5 canvas I&#8217;ve been writing a simple graphing visualization tool in Javascript.  Graphing in the sense of vertices connected by edges in a network, not in the pie chart and bar chart sense.  &#8230; <a href="http://www.heychinaski.com/blog/2010/01/10/heygraph-javascript-and-canvas-graphing-tool/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://heychinaski.com/hey-graph/demo.html"><img class="size-medium wp-image-294 aligncenter" title="HeyGraph Screenshot" src="http://www.heychinaski.com/blog/wp-content/uploads/2010/01/heygraph-screenshot-300x198.jpg" alt="HeyGraph Screenshot" width="300" height="198" /></a></p>
<p>To learn a bit about the <a title="Canvas element - Wikipedia" href="http://en.wikipedia.org/wiki/Canvas_element">HTML 5 canvas</a> I&#8217;ve been writing a simple graphing visualization tool in Javascript.  <span id="more-288"></span>Graphing in the sense of <a title="Graph (mathematics) - Wikipedia" href="http://en.wikipedia.org/wiki/Graph_%28mathematics%29">vertices connected by edges</a> in a network, not in the pie chart and bar chart sense.  There is already a fairly decent charting library for  HTML 5; <a title="RGraph: A canvas graph library" href="http://www.rgraph.net/">RGraph</a>.</p>
<p>The canvas API itself is quite straightforward, it even makes things like drop shadows <a title="HTML 5 canvas - the basic - Opera Developer Community - Shadows" href="http://dev.opera.com/articles/view/html-5-canvas-the-basics/#shadows">disappointingly simple</a>.  In fact most of the time spent on this project was on implementing a <a title="Warning! PDF!!! Graph Drawing by Force-directed Placement - THOMAS M. J. FRUCHTERMAN AND EDWARD M. REINGOLD" href="http://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol21/issue11/spe060tf.pdf">force-directed graph layout algorithm</a> in Javascript.  This was made easier by the fact that I&#8217;d already <a title="Altio + Last.fm : HeyChinaski.com" href="http://www.heychinaski.com/blog/?p=28">implemented it once in Java</a>.  You can see a <a title="Demo of Heygraph: Canvas-based network graph diagramming tool" href="http://heychinaski.com/hey-graph/demo.html">demo of the project here</a>.</p>
<p>The canvas element is only available on &#8220;real&#8221; web browsers such as Firefox, Chrome, Opera and Safari.  Also performance of the layout algorithm is notably better in Chrome, particularly in comparison to Firefox 3.5.7 (on Ubuntu).  The demo can even render in Internet Explorer now thanks to <a title="explorercanvas -    Project Hosting on Google Code" href="http://code.google.com/p/explorercanvas/">Google&#8217;s ExplorerCanvas</a> library although performance is so low that it is not recommended.  The time that the layout algorithm will take to complete is impossible to predict and so the layout will time out after a set time (around 15 seconds).  For this reason you are likely to get a substandard layout on particularly slow machines or when using browsers with poor Javascript performance.  The graph that is represented in the demo is generated at random so be sure to refresh the page a few times to see the tool handle a number of graph structures.</p>
<p>The tool is currently quite limited.  There is only one layout algorithm available<a id="footnote-back" href="#footnote">*</a> which could be <a title="Warning! PDF!!! FADE: Graph drawing, clustering and visual abstraction - Aaron Quigley and Peter Eades" href="http://www.csi.ucd.ie/staff/aquigley/home/downloads/aq-gd2000.pdf">better optimised</a>.  There are no ways to navigate the graph by zooming or panning and the appearance of the graph is currently limited to the white on blue default presented in the demo.  The graph can visualise any data as long as it is expressed in a certain format, easily described in JSON.  However it does add properties to that data when it lays out and renders the graph.  This would ideally be avoided.  I hope to address these issues in the future, particularly in regard to navigating the graph and customising the appearance, specifically so as to be able to visually distinguish and label the vertices.</p>
<p>The project along with it&#8217;s source is available under the MIT license from <a title="tom-martin's hey-graph at master - GitHub" href="http://github.com/tom-martin/hey-graph">github</a>.</p>
<h3><strong><a title="Demo of Heygraph: Canvas-based network graph diagramming tool" href="http://heychinaski.com/hey-graph/demo.html">HeyGraph Demo</a></strong></h3>
<p><span id="footnote">*</span>(although in my opinion force directed layout&#8217;s are appropriate for most small to medium size graphs) <a href="#footnote-back">&lt;</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.heychinaski.com/blog/2010/01/10/heygraph-javascript-and-canvas-graphing-tool/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

