<?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>Tom Mitchell &#187; Code</title>
	<atom:link href="http://tom.net.nz/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://tom.net.nz</link>
	<description>Life, the internets, and everything.</description>
	<lastBuildDate>Thu, 15 Dec 2011 00:19:05 +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>Windows Phone 7 game development tutorials</title>
		<link>http://tom.net.nz/2011/11/windows-phone-7-game-development-tutorials/</link>
		<comments>http://tom.net.nz/2011/11/windows-phone-7-game-development-tutorials/#comments</comments>
		<pubDate>Mon, 14 Nov 2011 20:20:49 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=473</guid>
		<description><![CDATA[Wow, updates to the blog have been few and far between lately! Recently I have been exploring the creation of video as an extension to my photography work &#8211; you can see some of the fruits of my labour on my YouTube channel. These have given me the taste for basic video production, and I [...]]]></description>
			<content:encoded><![CDATA[<p>Wow, updates to the blog have been few and far between lately!</p>
<p>Recently I have been exploring the creation of video as an extension to my photography work &#8211; you can see some of the fruits of my labour on my <a href="http://www.youtube.com/TradeMarkNZ">YouTube channel</a>. These have given me the taste for basic video production, and I decided to combine coding and videography, to put together an open-ended series of screencasts about how to create an XNA game for Windows Phone.</p>
<p>If you have any interest in this topic, I would love for the readers of my blog to go and check it out and let me know what you think!</p>
<p>Here&#8217;s the first episode:</p>
<p><iframe width="560" height="315" src="http://www.youtube.com/embed/MqyrCM1kIL8?hd=1" frameborder="0" allowfullscreen></iframe></p>
<p>You can find all of the episodes I have produced to date in <a href="http://www.youtube.com/playlist?list=PL94004E6E18C3CA62">a playlist</a>. I am aiming to put a new video together roughly once a week &#8211; so be sure to subscribe if you like what you see!</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2011/11/windows-phone-7-game-development-tutorials/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>C# 5.0 concurrency</title>
		<link>http://tom.net.nz/2010/10/c-5-0-concurrency/</link>
		<comments>http://tom.net.nz/2010/10/c-5-0-concurrency/#comments</comments>
		<pubDate>Fri, 29 Oct 2010 05:33:14 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=437</guid>
		<description><![CDATA[The next iteration of the core .NET languages (C#, VB.NET) looks set to have some pretty cool language constructs for performing tasks asynchronously in a really easy fashion. Designed to &#8220;let you have your cake and eat it to&#8221; &#8211; write code as you would for synchronous operations, and let the compiler take care of [...]]]></description>
			<content:encoded><![CDATA[<p>The next iteration of the core .NET languages (C#, VB.NET) looks set to have some pretty cool language constructs for performing tasks asynchronously in a really easy fashion. Designed to &#8220;let you have your cake and eat it to&#8221; &#8211; write code as you would for synchronous operations, and let the compiler take care of asynchronous callbacks and so on. Very cool! Check out the <a href="http://player.microsoftpdc.com/Session/1b127a7d-300e-4385-af8e-ac747fee677a">PDC talk from Anders Hejlsberg</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/10/c-5-0-concurrency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Diaspora on Windows</title>
		<link>http://tom.net.nz/2010/09/installing-diaspora-on-windows/</link>
		<comments>http://tom.net.nz/2010/09/installing-diaspora-on-windows/#comments</comments>
		<pubDate>Thu, 16 Sep 2010 02:06:44 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=401</guid>
		<description><![CDATA[Update: I have been super busy lately, so haven&#8217;t had time to update this post. Some parts may no longer be relevant, as the project is moving pretty quickly. There is now a page on Diaspora&#8217;s GitHub Wiki that describes some additional workarounds for Windows, so check there if your problem isn&#8217;t solved here. So [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update: </strong>I have been super busy lately, so haven&#8217;t had time to update this post. Some parts may no longer be relevant, as the project is moving pretty quickly. There is now a page on <a href="http://github.com/diaspora/diaspora/wiki/Installing-on-Windows">Diaspora&#8217;s GitHub Wiki</a> that describes some additional workarounds for Windows, so check there if your problem isn&#8217;t solved here.</p>
<p>So today the <a href="http://www.joindiaspora.com">Diaspora</a> team finally released their <a href="http://github.com/diaspora">source</a> for developers. This post describes my efforts in getting Diaspora to run on Windows. It&#8217;s actually very straightforward (considering the readme has no mention of Windows!) &#8211; anyone with a small amount of technical knowledge should be able to successfully follow the steps below. I&#8217;ve included some fixes for common pitfalls. Please leave a comment if you are having trouble, or manage to find the solution to a problem you are having.</p>
<p><strong>Warning:</strong> Diaspora is classified as pre-alpha software. You should not be ditching Facebook and moving your online social persona to Diaspora &#8211; at least, not yet. It&#8217;s full of documented security holes and bugs. You should only be installing it to have a play with it and get a feel for what the system is going to be like.</p>
<h2>Prerequisites</h2>
<p>The <a href="http://github.com/diaspora/diaspora/blob/master/README.md">project readme</a> describes the prerequisites for the project, and gives a basic installation guide (for Ubuntu and MacOS X). You will need to install all of them:</p>
<ul>
<li><a href="http://www.mongodb.org/downloads">MongoDB</a></li>
<li>Git (<a href="http://code.google.com/p/tortoisegit/downloads/list">TortoiseGit</a> with <a href="http://code.google.com/p/msysgit/downloads/list">msysgit</a> &#8211; you need both)</li>
<li>Ruby 1.8.7 (version is important!). I used the <a href="http://rubyinstaller.org/download/">RubyInstaller Windows package</a>. Make sure you specify that Ruby binaries be placed on your PATH.</li>
<li>You will also need to install the Ruby DevKit from the same download page in order to build native gems. Comprehensive <a href="http://github.com/oneclick/rubyinstaller/wiki/Development-Kit">installation instructions</a> are available for the development kit. I used 3.4.5, but later versions should be fine.</li>
<li><a href="http://www.slproweb.com/products/Win32OpenSSL.html">OpenSSL</a> (Win32 v1.0.0a precompiled binary)</li>
<li><a href="http://www.imagemagick.org/script/binary-releases.php?ImageMagick=8oh273lq2k60s75ig4eheq5cl0#windows">ImageMagick</a> (6.6.4-2-Q16 Win32 DLL)</li>
<li>Bundler (type &#8220;gem install bundler&#8221; at the command line)</li>
</ul>
<p>You&#8217;ll need to make sure most things are on your path (especially your <strong>Ruby\bin</strong> directory).</p>
<h2>Getting the source and dependencies</h2>
<p>First, <strong>git clone</strong> the source into a sensible place using TortoiseGit. The repository URI is as follows:</p>
<pre>http://github.com/diaspora/diaspora.git</pre>
<p>Then, at a command line, browse to the repository and run the following command to install project dependencies:</p>
<pre>bundle install</pre>
<p>If you encounter an error about a native build failing, make sure you have installed the <a href="http://github.com/oneclick/rubyinstaller/wiki/Development-Kit">DevKit</a> properly.</p>
<p>If you encounter an error about bundler not being able to find its functions, you will need to modify one of bundler&#8217;s source files. Open up <strong>Ruby\lib\ruby\gems\1.8\gems\bundler-1.0.0\lib\bundler\lockfile_parser.rb</strong> and modify line 14 so it reads as follows:</p>
<pre class="brush:ruby">      lockfile.split(/\r?\n+/).each do |line|</pre>
<p>Then run the <strong>bundle install</strong> command again. (Thanks Kristoffer!)</p>
<p>When the command succeeds, you should see a pretty substantial list of items install (in the order of 50 or so). The Diaspora team certainly know how to reuse existing solutions!</p>
<h2>Running Diaspora</h2>
<p>There is an official guide to <a href="http://www.mongodb.org/display/DOCS/Quickstart+Windows">installing Mongo on Windows</a>, and <a href="http://www.mongodb.org/display/DOCS/Windows+Service">running it as a Windows service</a>, so I won&#8217;t go into that here. Just make sure that it is running before continuing (preferably as a service). Then, run the following at the command line from the repository directory to start the development server:</p>
<pre>bundle exec thin start</pre>
<p>You might encounter an error that looks like the following:</p>
<pre class="brush:plain">rbreadline.rb:4404: uninitialized constant RbReadline::Encoding (NameError)</pre>
<p>A quick search turned up a <a href="http://trbhoang.blogspot.com/2010/05/issue-with-rspec-on-windows.html">blog post</a> that described commenting out the affected line, which seemed to work for me. Just open <strong>Ruby\lib\ruby\site_ruby\1.8\rbreadline.rb</strong> in Notepad or similar, and comment out line 4404. This shouldn&#8217;t break anything significant. (It might affect you if you are doing some development and need to use the test suite &#8211; otherwise shouldn&#8217;t make a difference if you&#8217;re just running Diaspora to have a play).</p>
<p>Run the <strong>bundle exec thin start</strong> command to start the server once more, and you should see something similar to the following:</p>
<pre class="brush:plain">&gt;&gt; Using rack adapter
&gt;&gt; Thin web server (v1.2.7 codename No Hup)
&gt;&gt; Maximum connections set to 1024
&gt;&gt; Listening on 0.0.0.0:3000, CTRL+C to stop</pre>
<p>Opening <strong>localhost:3000</strong> in my web browser, I am then presented with the following:</p>
<p><a href="http://tom.net.nz/wp-content/uploads/2010/09/diaspora.png"><img class="alignnone size-medium wp-image-402" title="diaspora" src="http://tom.net.nz/wp-content/uploads/2010/09/diaspora-300x213.png" alt="" width="300" height="213" /></a></p>
<p>Success! I should mention that this is of course just a development server. If you close the command window then the server stops running.</p>
<h2>Getting access to your Diaspora node</h2>
<p><strong>Update:</strong> <span style="text-decoration: line-through;">To register on your server, browse to <strong>/get_to_the_choppa</strong></span>. [<em>This may no longer work, see next update</em>]. <span style="text-decoration: line-through;">It seems they haven&#8217;t yet built a proper registration page (or at least, you&#8217;re not supposed to be able to go to a random server and register)</span>. [<em>Official signup page is now present</em>]. Interestingly, that page worked for a short time on the developers&#8217; own nodes &#8211; it seems they&#8217;ve since plugged the hole though.</p>
<p><strong>Update 2:</strong> I assume the fact they&#8217;ve plugged the hole means it&#8217;s also plugged in the latest copy of the source. Here&#8217;s the &#8220;official&#8221; way to be able to log into Diaspora. [<em>This way still works fine, but you may prefer to start from scratch - see next update</em>]. From a command line in your repository, run the following commands:</p>
<pre>gem install rake</pre>
<pre>rake db:seed:tom</pre>
<pre>bundle exec thin start</pre>
<p>The rake command prepopulates some data, allowing you to then log in with username <strong>tom</strong> and password <strong>evankorth</strong>.</p>
<p><strong>Update 3:</strong> It seems a Sign Up link has now been added to the login page (and /get_to_the_choppa redirects to this). You may want to use this to gain access instead of one of the above steps. I would recommend using the method above however, as it populates some images and a &#8220;friend&#8221; to play with.</p>
<p>Here&#8217;s what my running version of Diaspora looks like:</p>
<p><a href="http://tom.net.nz/wp-content/uploads/2010/09/diaspora2.png"><img class="alignnone size-medium wp-image-406" title="diaspora2" src="http://tom.net.nz/wp-content/uploads/2010/09/diaspora2-300x213.png" alt="" width="300" height="213" /></a></p>
<p>Although, as you can see, image resizing seems to be broken at the moment &#8211; perhaps a problem with my ImageMagick install. Other than that, seems to functioning ok. Of course, the &#8220;excitement factor&#8221; of testing the experience of a social platform by oneself is not particularly great!</p>
<h2>Updating your Diaspora installation</h2>
<p>Code updates are being pushed pretty thick and fast currently. To upgrade your Diaspora node, run the following commands at the command line in your repository directory:</p>
<pre>git pull</pre>
<p>This gets the latest version of the source code. You may need to run a <strong>git stash</strong> first if it complains about uncomitted changes.</p>
<pre>bundle install</pre>
<p>This will update and install new dependencies. You may encounter an error about a native build failing. To temporarily add DevKit to your path to allow building, first run <strong>devkitvars.bat</strong> from the extracted DevKit directory, then try running <strong>bundle install</strong> again.</p>
<pre>rake</pre>
<p>This compiles code and runs the test suite. Don&#8217;t worry too much about failed tests! You can also optionally nuke your database to start fresh again by running:</p>
<pre>mongo diaspora-development
&gt; db.dropDatabase()</pre>
<p>Note that this requires MongoDB to be on your PATH. Finally, run the server again:</p>
<pre>bundle exec thin start</pre>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/09/installing-diaspora-on-windows/feed/</wfw:commentRss>
		<slash:comments>36</slash:comments>
		</item>
		<item>
		<title>Still finding bugs</title>
		<link>http://tom.net.nz/2010/09/still-finding-bugs/</link>
		<comments>http://tom.net.nz/2010/09/still-finding-bugs/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 03:21:39 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=396</guid>
		<description><![CDATA[Sometimes bugs really astound me. The current tom.net.nz theme has been active for at least 6 months. When I first developed the theme, it was in Firefox, and looked great. But then I started using Chrome and noticed the following: That is, sidebar text that looked fine in Firefox was now weirdly spaced out in [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes bugs really astound me. The current tom.net.nz theme has been active for at least 6 months. When I first developed the theme, it was in Firefox, and looked great. But then I started using Chrome and noticed the following:</p>
<p><a href="http://tom.net.nz/wp-content/uploads/2010/09/sidebar.png"><img class="alignnone size-full wp-image-397" title="sidebar" src="http://tom.net.nz/wp-content/uploads/2010/09/sidebar.png" alt="" width="371" height="389" /></a></p>
<p>That is, sidebar text that looked fine in Firefox was now weirdly spaced out in Chrome, and some elements (e.g. Archive date links) that were meant to be plain text now had Cufon styling.</p>
<p>For the longest time (well ok, maybe ~2 hours &#8211; still, a long time for such a minor annoyance), I searched my code, and tried out many different things in order to find a fix. I tried changing the Cufon selector (bypassing jQuery, for example), getting deep into the WordPress API to modify the output of the archive date list, messing with CSS, upgrading Cufon/jQuery, etc etc etc. Nothing I tried gave satisfactory results. Eventually I just gave up, and chalked it up as a behaviour oddity of jQuery selectors or Cufon, or something (I just knew it was nothing to do with me &#8211; how could it be, after putting so much time into it, right?!).</p>
<p>So today I was preparing to describe this oddity to someone as being a concrete example of weird JS in Chrome, and I happened to find this in part of the source:</p>
<pre class="brush:html">&lt;li&gt;&lt;h1&gt;&lt;a href="/"&gt;Home&lt;/a&gt;&lt;h1&gt;&lt;/li&gt;</pre>
<p>See the problem? I had fudged the closing <strong>h1</strong> tag. So basically, the behaviour I was seeing was not a bug in any of the libraries I was using, but rather Chrome and Firefox choosing to treat my broken code differently. It was also a frustratingly simple fix to what I had assumed was a complex problem (and had spent considerable time trying to fix). Going back for a second look, I found the 6-month-old bug almost by accident, in the space of about 30 seconds.</p>
<p>So at long last, my sidebar works correctly in all major browsers. Hurray! I just wish I&#8217;d had the aptitude to run my HTML through a validator or check it fully by hand back when the problem first manifested&#8230; Hindsight, as always, is 20/20.</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/09/still-finding-bugs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Windows Phone 7 Beta tools</title>
		<link>http://tom.net.nz/2010/08/windows-phone-7-beta-tools/</link>
		<comments>http://tom.net.nz/2010/08/windows-phone-7-beta-tools/#comments</comments>
		<pubDate>Fri, 06 Aug 2010 03:44:35 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=353</guid>
		<description><![CDATA[In my experimentation with the Windows Phone 7 developer tools, certain things have been a little hard to find information on. Here&#8217;s some of the best resources I have found, along with little nuggets of good information I have discovered and want to document. Resources MSDN Windows Phone 7 forums &#8211; often my own questions [...]]]></description>
			<content:encoded><![CDATA[<p>In my experimentation with the <a href="http://developer.windowsphone.com/windows-phone-7/">Windows Phone 7 developer tools</a>, certain things have been a little hard to find information on. Here&#8217;s some of the best resources I have found, along with little nuggets of good information I have discovered and want to document.</p>
<h2>Resources</h2>
<ul>
<li><a href="http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series">MSDN Windows Phone 7 forums</a> &#8211; often my own questions were answered here. Search up the top for what you&#8217;re interested in.</li>
</ul>
<p>Also keep in mind that the Windows Phone 7 SDK is based mainly on Silverlight, so many resources that apply to Silverlight can be readily applied to WP7.</p>
<h2>Checking internet connectivity</h2>
<p>It&#8217;s suggested in several places that Windows Phone 7 developers should test for internet connectivity in their internet-connected applications, as it is not a guaranteed resource (and of course, respond accordingly if no connection is available). However, there are few places that document how to actually do this. In the Beta version of the tools, the correct way is by testing the result of the following function:</p>
<pre class="brush:csharp">// Available in the System.Net.NetworkInformation namespace
bool connected = NetworkInterface.GetIsNetworkAvailable();</pre>
<p>Note that this has changed from the CTP version of the tools.</p>
<h2>Creating a scrollable region</h2>
<p>Another seemingly under-documented feature is how to create a region that scrolls using the typical finger scrolling action. Fortunately, this is as simple as wrapping your controls in a <strong>ScrollViewer</strong> element:</p>
<pre class="brush:xml">&lt;ScrollViewer&gt;
    &lt;!-- Insert controls here --&gt;
&lt;/ScrollViewer&gt;</pre>
<p>This gives you scrolling momentum for free, along with a little position scrollbar that appears as you scroll. Very easy!</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/08/windows-phone-7-beta-tools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dark Visual Studio 2010 theme</title>
		<link>http://tom.net.nz/2010/07/visual-studio-2010-theme/</link>
		<comments>http://tom.net.nz/2010/07/visual-studio-2010-theme/#comments</comments>
		<pubDate>Thu, 29 Jul 2010 23:41:17 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=319</guid>
		<description><![CDATA[Looking for a refreshing change in colour? Getting sick of coding against that glaring white background? Look no further! I&#8217;ve decided to upload my Visual Studio 2010 Fonts and Colors settings for public consumption. The colour scheme is loosely based on the Railscasts TextMate theme. Here&#8217;s a couple of screenshots to give an idea of [...]]]></description>
			<content:encoded><![CDATA[<p>Looking for a refreshing change in colour? Getting sick of coding against that glaring white background? Look no further!</p>
<p>I&#8217;ve decided to upload my <a href="http://tom.net.nz/uploads/private/Railscast-VisualStudio2010.vssettings">Visual Studio 2010 Fonts and Colors settings</a> for public consumption. The colour scheme is loosely based on the <a href="http://railscasts.com/">Railscasts</a> <a href="http://railscasts.com/about">TextMate theme</a>. Here&#8217;s a couple of screenshots to give an idea of appearance:</p>
<p><a href="http://tom.net.nz/wp-content/uploads/2010/07/theme-1.png"><img class="alignnone size-thumbnail wp-image-320" title="Theme Sample 1" src="http://tom.net.nz/wp-content/uploads/2010/07/theme-1-150x150.png" alt="" width="150" height="150" /></a> <a href="http://tom.net.nz/wp-content/uploads/2010/07/theme-2.png"><img class="alignnone size-thumbnail wp-image-321" title="Theme Sample 2" src="http://tom.net.nz/wp-content/uploads/2010/07/theme-2-150x150.png" alt="" width="150" height="150" /></a></p>
<p>(Click to view larger).</p>
<p>To install:</p>
<ul>
<li>Download the <a href="http://tom.net.nz/uploads/private/Railscast-VisualStudio2010.vssettings">theme settings file</a>.</li>
<li>In Visual Studio 2010, go to menu <strong>Tools -&gt; Import and Export Settings&#8230;</strong></li>
<li><strong>Import selected environment settings</strong></li>
<li>I recommend you save your current settings &#8211; just so you can revert them later if you don&#8217;t like the theme!</li>
<li>Hit <strong>Browse&#8230;</strong> when asked to specify a collection of settings</li>
<li>Make sure that everything is ticked to import, and hit <strong>Finish</strong></li>
</ul>
<p>By default, the theme uses Consolas size 12. You can adjust these settings easily by opening menu <strong>Tools -&gt; Options</strong> and finding the <strong>Fonts and Colors</strong> section under <strong>Environment</strong>.</p>
<p>Note that Visual Studio is a prick, and has something in the order of 100 different colours that can be set. I have only set up colours for things that I am commonly doing, such as coding in C#, HTML, or XAML. Every now and then you might come across a colour that looks funny against the dark background. This can of course be modified by hand in the Color settings by tracking down the appropriate item in the colour list.</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/07/visual-studio-2010-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visual Studio tip</title>
		<link>http://tom.net.nz/2010/07/visual-studio-tip/</link>
		<comments>http://tom.net.nz/2010/07/visual-studio-tip/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 22:42:24 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=298</guid>
		<description><![CDATA[If you&#8217;re like me, the way that Visual Studio 2008&#8242;s Solution Explorer jumps around to select the file in the current tab makes you disoriented and frustrated. Fortunately, I have found the ideal solution! Disable the automated behaviour: In options, open the Projects and Solutions section Untick Track Active Item in Solution Explorer Enable a [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re like me, the way that Visual Studio 2008&#8242;s Solution Explorer jumps around to select the file in the current tab makes you disoriented and frustrated. Fortunately, I have found the ideal solution!</p>
<ul>
<li>Disable the automated behaviour:
<ul>
<li>In options, open the <strong>Projects and Solutions</strong> section</li>
<li>Untick <strong>Track Active Item in Solution Explorer</strong></li>
</ul>
</li>
<li>Enable a keyboard shortcut to track the active item when <em>you</em> want to:
<ul>
<li>In options, open <strong>Environment -&gt; Keyboard</strong></li>
<li>Search for the command <strong>View.TrackActivityinSolutionExplorer</strong>, and enter your desired keyboard shortcut</li>
</ul>
</li>
</ul>
<p>Not sure if this works in other versions of Visual Studio, but it&#8217;s working a treat for me!</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/07/visual-studio-tip/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Next big thing</title>
		<link>http://tom.net.nz/2010/07/next-big-thing/</link>
		<comments>http://tom.net.nz/2010/07/next-big-thing/#comments</comments>
		<pubDate>Wed, 07 Jul 2010 01:32:40 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=293</guid>
		<description><![CDATA[I have something of a prediction. If not a prediction then a wish. A wish for a feature that should become part of IDEs everywhere, in much the same way that IntelliSense-esque tools and refactoring tools have. To explain the feature, first let me explain the problem it solves. Supposing I have a number of [...]]]></description>
			<content:encoded><![CDATA[<p>I have something of a prediction. If not a prediction then a wish. A wish for a feature that should become part of IDEs everywhere, in much the same way that IntelliSense-esque tools and refactoring tools have.</p>
<p>To explain the feature, first let me explain the problem it solves. Supposing I have a number of similar lines of code:</p>
<pre class="brush:[vbnet]">Item1.Text = GetData("Item1")
Item2.Text = GetData("Item2")
Item3.Text = GetData("Item3")
Item4.Text = GetData("Item4")
Item5.Text = GetData("Item5")</pre>
<p>&#8230; and I want to make a similar change to each of these lines, such as:</p>
<pre class="brush:[vbnet]">Item1.Value = Convert(GetData("Item1"), String)
Item2.Value = Convert(GetData("Item2"), String)
Item3.Value = Convert(GetData("Item3"), String)
Item4.Value = Convert(GetData("Item4"), String)
Item5.Value = Convert(GetData("Item5"), String)</pre>
<p>Currently, I can use tools such as Find and Replace to replace e.g. &#8220;.Text = GetData(&#8221; with &#8220;.Value = Convert(GetData(&#8220;, but replacing &#8220;)&#8221; with &#8220;), String)&#8221; is a bit more tricky. For that I would probably copy and paste &#8220;, String)&#8221; onto the end of each line. Either way, this is a very repetitive task. And if there&#8217;s one thing that we know, it&#8217;s that computers are <em>excellent</em> at automating repetitive tasks. I would love a tool that, after I&#8217;ve changed a couple lines, spots the repetition and intelligently asks if I want to apply the same modification to subsequent similar lines &#8211; ideally with a preview to check accuracy.</p>
<p>Another example. Supposing I have a list of blank &lt;select&gt; options that I&#8217;ve quickly copied and pasted ready for population:</p>
<pre class="brush:[html]">&lt;option value=""&gt;&lt;/option&gt;
&lt;option value=""&gt;&lt;/option&gt;
&lt;option value=""&gt;&lt;/option&gt;
&lt;option value=""&gt;&lt;/option&gt;
&lt;option value=""&gt;&lt;/option&gt;</pre>
<p>&#8230; and I fill the lines in like so:</p>
<pre class="brush:[html]">&lt;option value="Item1"&gt;Item1&lt;/option&gt;
&lt;option value="Item2"&gt;Item2&lt;/option&gt;
&lt;option value="Item3"&gt;Item3&lt;/option&gt;
&lt;option value="Item4"&gt;Item4&lt;/option&gt;
&lt;option value="Item5"&gt;Item5&lt;/option&gt;</pre>
<p>Again, I would fill in the first couple of lines, but this one would work a bit differently. The tool would realise that the value and text of each item is the same, and automatically fill out one based on what I type in the other. I.e. I&#8217;d type &#8220;Item3&#8243; into the value field of the third option, and it would automatically put &#8220;Item3&#8243; as the inner HTML. Taking it a step further, in this particular example, it could also pick up the sequential numbering of items, and suggest to fill out the remaining items automatically. A step further again, and you could get it to work with e.g. form elements or project datasource columns, to automatically produce entire forms and classes based on a bit of initial prompting &#8211; i.e. write out some code that mentions the first and second columns of a given datasource, and it suggests lines of code similar to the lines entered, but with the other column names.</p>
<p>Of course this tool is completely hypothetical &#8211; at least as far as I&#8217;m aware&#8230; But in theory would not be <em>too</em> drastically hard to create, and would save developers everywhere a lot of time; I&#8217;m allowed to dream, aren&#8217;t I? If it became a reality, it would be a huge feature &#8211; the next big thing perhaps?</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/07/next-big-thing/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Facebook Connect observation</title>
		<link>http://tom.net.nz/2010/06/facebook-connect/</link>
		<comments>http://tom.net.nz/2010/06/facebook-connect/#comments</comments>
		<pubDate>Mon, 21 Jun 2010 03:23:26 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Intarwebs]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=277</guid>
		<description><![CDATA[Here&#8217;s a bit of a dud write-up. Dud because the risks are minimal, as I realised when I started looking into cross-domain iframe DOM scraping&#8230; But potentially interesting reading for web developers nonetheless. If you have been browsing the internet lately, you have more than likely seen a Facebook Connect box. It looks like this: [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a bit of a dud write-up. Dud because the risks are minimal, as I realised when I started looking into cross-domain iframe DOM scraping&#8230; But potentially interesting reading for web developers nonetheless.</p>
<p>If you have been browsing the internet lately, you have more than likely seen a Facebook Connect box. It looks like this:</p>
<p><a href="http://tom.net.nz/wp-content/uploads/2010/06/gp-facebook.png"><img class="alignnone size-full wp-image-278" title="GamePlanet Facebook Connect" src="http://tom.net.nz/wp-content/uploads/2010/06/gp-facebook.png" alt="" width="340" height="666" /></a></p>
<p>This particular screenshot is taken from <a href="http://gpforums.co.nz">Gameplanet Forums</a>, but Facebook Connect makes it easy for <em>any</em> website developer to embed the panel into their website. I could put one on tom.net.nz, if I was so inclined.</p>
<p>Now, Facebook would argue that this frame is a naive, harmless feature, because the information is never passed directly to the website in question, but rather the website just embeds a little piece of code, and Facebook generates the actual content of the pane. The code embedded is identical for any user visiting the website.</p>
<p>This is all well and good, however (!), the content that Facebook generates for this pane will differ depending on whether or not the user viewing it is currently logged into Facebook. If they are, then Facebook tries to show information more &#8220;relevant&#8221; to that user. For example, in the above screenshot, &#8220;Matt&#8221; is my friend on Facebook (and the only person in my friends who has &#8220;liked&#8221; Gameplanet on Facebook). The other people are generated randomly, but no matter how many times I refresh the page, Matt will always appear in the list. Do you see where this is going?</p>
<p>One might assume that Facebook has put some measures in place to stop the site from scraping this information, however the tech savvy can follow the following link which generates the box for Gameplanet&#8217;s Facebook Connect pane: <a href="http://www.facebook.com/plugins/likebox.php?api_key=118242074867196&amp;connections=15&amp;header=false&amp;height=630&amp;id=173654025454&amp;locale=en_US&amp;sdk=joey&amp;stream=true&amp;width=300">link</a>. If you view the source, there are all the names, in plain HTML, with links to both the photo, <em>and</em> (perhaps more disturbingly), the profile of each person. I was also able to scrape my own user ID from the HTML. Fortunately, in most modern browsers, XSS (Cross-Site Scripting) protection prevents the parent page from accessing the DOM of Facebook&#8217;s frame, but this is still a major potential security problem for older browsers which don&#8217;t have such protection built-in. By inspecting the list of users on a few page loads and looking for duplicate names, a malicious site could ascertain who is friends with the user browsing the page. The parameters passed to the frame source allow significant customization of the response, for example with a bit of tweaking I was able to come up with the following <a href="http://www.facebook.com/plugins/likebox.php?api_key=118242074867196&amp;connections=100&amp;height=800&amp;header=false&amp;id=173654025454&amp;locale=en_US&amp;sdk=joey&amp;width=700">source</a>, which now shows 100 users instead of the default 15. To take it a step further, a malicious page could potentially load this frame without even showing it, meaning the user would be completely unaware that the site was doing anything to do with Facebook, meanwhile it&#8217;s scraping the user&#8217;s private information.</p>
<p>Of course, those using a remotely modern browser do not have to worry about this sort of attack&#8230; But I think it does highlight the potential risks associated with these completely unnecessary &#8220;features&#8221; &#8211; not to mention the dangers of using an out-of-date browser. I would have hoped that at the very least Facebook would have performed some source obfuscation or dynamic JavaScript DOM population.</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/06/facebook-connect/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Moving</title>
		<link>http://tom.net.nz/2010/05/moving/</link>
		<comments>http://tom.net.nz/2010/05/moving/#comments</comments>
		<pubDate>Wed, 19 May 2010 06:10:00 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Life]]></category>

		<guid isPermaLink="false">http://tom.net.nz/?p=270</guid>
		<description><![CDATA[For a long time, I&#8217;ve been interested in software development and computer programming. At some point in my mid-teens I worked out that I could get paid to write code, something I already enjoyed doing. It was from this time that I had vague aspirations to move overseas and work at a large software organisation, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://tom.net.nz/2010/02/coding-a-not-so-brief-history/">For a long time</a>, I&#8217;ve been interested in software development and computer programming. At some point in my mid-teens I worked out that I could get paid to write code, something I already enjoyed doing. It was from this time that I had vague aspirations to move overseas and work at a large software organisation, and even back then, the first one that always came to mind was Microsoft.</p>
<p>Those aspirations had always been in the back of my mind, while I worked on my Bachelor of Engineering, and worked at <a href="http://canary.co.nz/">Canary</a>. After an initial application attempt to Microsoft in 2008 that was thwarted by the recession, I decided to prepare my CV once again at the end of last year (2009). Without much further thought, I submitted it to Microsoft. Then about a month ago, I received an email that I was to be having an interview over the phone. As far as I could tell, this phone interview went atrociously, but contrary to my expectations I received an email a week later detailing plans to fly me over to Sydney to interview in person with a few recruiters. I arrived back from said flight this morning.</p>
<p>Long story short, I will be moving to Microsoft&#8217;s Redmond HQ in Seattle, USA. This will be taking place in late September.</p>
<p>This is pretty much a dream come true, and I&#8217;m stoked to actually be seeing those aspirations from so long ago become reality. I have long said that I would not be looking for another job in New Zealand, and I have truly enjoyed my time working at <a href="http://canary.co.nz/">Canary</a>. However, the opportunity to be able to work in another country and see some more of the world was simply too great to pass up. I believe that I will also find more room for personal growth and career advancement in a larger company. By the way, quick plug for our <a href="http://www.trademe.co.nz/Trade-me-jobs/IT-Jobs/Programming-development/listing-289582815.htm">job ad</a>, if you&#8217;re a software developer in Auckland.</p>
<p>This change is not without its drawbacks, and I will miss much about my life in New Zealand, not the least of which being proximity to family, and the friends that I have grown close to in Auckland over these last few years. I will miss you all like crazy. I hope to have a blast with my last few months in New Zealand (let&#8217;s hit the snow!), and no doubt I&#8217;ll be spending the majority of my annual leave here (New Year&#8217;s anyone?).</p>
<p>Keep an eye out for some sort of leaving party!</p>
<p>Cheers.</p>
]]></content:encoded>
			<wfw:commentRss>http://tom.net.nz/2010/05/moving/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

