<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
    <channel>
        <title>Cordinc Blog</title>
        <link>http://www.cordinc.com/blog/</link>
        <description></description>
        <language>en</language>
        <copyright>Copyright 2012</copyright>
        <lastBuildDate>Sat, 12 May 2012 11:31:21 +0000</lastBuildDate>
        <generator>http://www.sixapart.com/movabletype/</generator>
        <docs>http://www.rssboard.org/rss-specification</docs>
        
        <item>
            <title>Debugging context in Unity3D</title>
            <description><![CDATA[<p>A cool little feature of Unity3D scripting I recently found is using conditional compilation for debug statements. The C based languages (but not Java unfortuately) have inbuilt preprocessors that allow developers to only compile certain parts of the code if certain parameters are set (it can also do much more, including macros). Thus you could write the below and the code would only be included in the executable if <tt><span class="caps">DEBUG</span></tt> is defined.</p>

<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 55px">

<pre>
#if DEBUG
    // do some special code
#endif
</pre>

</div>

<p>Unity3D has a similar system. Mostly the docs (<a href="http://unity3d.com/support/documentation/Manual/Platform%20Dependent%20Compilation.html">available here</a>) seem to suggest this is for specialist code for different platforms: iPhone, Web, <span class="caps">PC, </span>etc. Thus the defined parameters are set in advance (e.g. <tt><span class="caps">UNITY</span>_IPHONE</tt>). However, there is one that is useful for debugging, <tt><span class="caps">UNITY</span>_EDITOR</tt>. This will only be set if the application is running inside the Unity3D <span class="caps">GUI.</span> Once you build the app those lines of code will be skipped. It can be used like the below example - very handy.</p>

<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 55px">

<pre>
#if UNITY_EDITOR
    Debug.Log(&quot;Debugging&quot;);
#endif 
</pre>

</div>

<p>According to <a href="http://forum.unity3d.com/threads/71445-How-To-Set-Project-Wide-pragma-Directives-with-JavaScript">this Unity3D forum post</a> it is also possible to define your own project specific preprocessor parameters.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/05/debugging-context-in-unity3d.html</link>
            <guid>http://www.cordinc.com/blog/2012/05/debugging-context-in-unity3d.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Unity</category>
            
            <pubDate>Sat, 12 May 2012 11:31:21 +0000</pubDate>
        </item>
        
        <item>
            <title>Unit Testing UnityScript in Unity3D with SharpUnit</title>
            <description><![CDATA[<p>I have been programming mainly in <a href="http://unity3d.com/">Unity3D</a> over the last fortnight, and thought it time to write some unit tests for my work. I found reference to a <a href="http://unifycommunity.com/wiki/index.php?title=Category%3AUnit_Test_Framework">few testing frameworks online</a>. The most promising appeared to be <a href="http://www.unifycommunity.com/wiki/index.php?title=SharpUnit">SharpUnit</a>, and it is also released under a fairly relaxed license. However, I had to make a few changed to get it running, so this post details that work.</p>

<p>SharpUnit works like a standard unit testing framework for C# code in Unity3D (although all output goes to the console, but that is fine for me). Although my work has largely been in UnityScript (Unity3D's JavaScript like language) and this didn't work so well due to issues with compilation order and SharpUnit's use of .Net custom attributes. After making the changes below, I found SharpUnit works well, and I'll probably be using it for my unit testing.</p>

<p>Unity3D compiles scripts in a set order (<a href="http://unity3d.com/support/documentation/ScriptReference/index.Script_compilation_28Advanced29.html">as described here</a>). Thus if you have C# code that references a UnityScript class there can be a problem - although the reverse is not such an issue. When testing UnityScript with SharpUnit this means that the C# <tt>Unity3D_TestRunner</tt> class can be an issue. It references the <tt>TestCase</tt> classes, which I want to write in UnityScript. To do this I put the SharpUnit code in a folder under the <tt>Plugins</tt> top-level folder (the <tt>Standard Assets</tt> folder would have also worked). This means the SharpUnit code is compiled first. Then my tests went in a new folder together with a UnityScript rewrite of <tt>Unity3D_TestRunner</tt>, as shown below. This UnityScript TestRunner script is then attached to the TestRunner GameObject (in a special testing scene) rather than the C# version as described in the SharpUnit instructions.</p>

<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 210px">

<pre>
#pragma strict

import SharpUnit;

function Start () {
	var suite: TestSuite = new TestSuite();
	suite.AddAll(DummyTest());
	var res: TestResult = suite.Run(null);
	var reporter: Unity3D_TestReporter = new Unity3D_TestReporter();
    reporter.LogResults(res);
}
</pre>

</div>

<p>Other possible solutions to this problem would be to just write my code in C# or to change SharpUnit to load <tt>TestCase</tt> classes dynamically at runtime. Rewriting the TestRunner seemed easiest.</p>

<p>The other problem encountered is that SharpUnit uses the C# custom attribute <tt>[UnitTest]</tt> to identify its test methods. The equivalent in UnityScript is a script directive (see <a href="http://answers.unity3d.com/questions/12911/what-are-the-syntax-differences-in-c-and-javascrip.html">the relevant section here</a>). Thus <tt>@UnitTest</tt> needs to be placed at the top of each test function.</p>

After that change I could run UnityScript tests with SharpUnit. An example test is below:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 350px">

<pre>
#pragma strict

import SharpUnit;

class DummyTest extends TestCase {

    var dummy: String;  

    /** Setup test resources, called before each test. */
    function SetUp() {
        dummy = &quot;lkjkjh&quot;; 
    }

    /** Dispose of test resources, called after each test */
    function TearDown() {
        dummy = null; 
    }

    /** Sample test that passes */
    @UnitTest
    function TestDummy_Pass() {
        Assert.NotNull(dummy);
    }

    /** Sample test that fails. */
    @UnitTest
    function TestDummy_Fail() {
        Assert.Null(dummy);
    }
}
</pre>

</div>]]></description>
            <link>http://www.cordinc.com/blog/2012/05/unit-testing-unityscript-in-un.html</link>
            <guid>http://www.cordinc.com/blog/2012/05/unit-testing-unityscript-in-un.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Unity</category>
            
            <pubDate>Fri, 04 May 2012 15:13:05 +0000</pubDate>
        </item>
        
        <item>
            <title>Sicily</title>
            <description><![CDATA[<p>I've just returned from an underwhelming two week break in Sicily. A <a href="http://www.flickr.com/photos/33547649@N07/sets/72157629910747427/show/">Flickr slideshow is viewable here.</a></p>

<p><a href="http://www.flickr.com/photos/33547649@N07/sets/72157629910747427/show/"><img src="http://farm8.staticflickr.com/7262/6972257770_e73a3020b0.jpg" alt="" /></a></p>]]></description>
            <link>http://www.cordinc.com/blog/2012/04/sicily.html</link>
            <guid>http://www.cordinc.com/blog/2012/04/sicily.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Sicily</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Travel</category>
            
            <pubDate>Fri, 27 Apr 2012 13:06:06 +0000</pubDate>
        </item>
        
        <item>
            <title>Rio Rambo Course</title>
            <description><![CDATA[<p>The most oft repeated tale of my time at Rio Tinto <span class="caps">R&amp;TD </span>is the Rambo course. Every year a dozen or so staff would be sent on a management training course. Many people were eager to avoid it. Although everyone had to do it at least once and it was advisable to go if you wanted to be promoted (so I was keen). Most people had been multiple times. Since our team was so small, about a third of the facility went each year. </p>]]></description>
            <link>http://www.cordinc.com/blog/2012/04/rio-rambo-course.html</link>
            <guid>http://www.cordinc.com/blog/2012/04/rio-rambo-course.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Memories</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Rio Tinto</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Work</category>
            
            <pubDate>Sat, 14 Apr 2012 09:51:49 +0000</pubDate>
        </item>
        
        <item>
            <title>Failure: Unity Javascript in Java VM</title>
            <description><![CDATA[<p>School science teachers like to emphasize that the failure of an experiment is as useful a learning experience as its success. Of course the high-achieving student knows that is bollocks and ensures their experiements always succeed - if you need a straight line, only gather two data points! Despite that I think the underlying idea is correct and experimental failure should not be hidden. </p>

<p>A recent experiment of mine failed. I am writing a game with an online component and wanted the same code running on both the client and server - as this would reduce the chance of bugs. For ease of development <a href="http://unity3d.com/">Unity3D</a> is being used for the client end, so the code there is either Javascript or C#. I have been writing Java servers professionally for years so it seemed silly not to use that knowledge. Clearly there is no common ground there. However, there is a project called <a href="http://www.mozilla.org/rhino/">Rhino</a> to allow Javascript to run inside the Java <span class="caps">JVM. </span></p>

<p>So can Javascript from Unity run in a Java environment? The short answer is "no", but the longer answer is "sometimes, with many caveats".  </p>

Firstly it is possible to run Javascript functions in Java. Load up the Rhino library into the classpath and if you have Javascript code like:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 50px">

<pre>
function square(i) {
	return i*i;
}
</pre>

</div>
then you can run it in Java with the folowing:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 80px">

<pre>
Context cx = Context.enter();
Scriptable scope = cx.initStandardObjects();
Function f1 = cx.compileFunction(scope, readFile(&quot;src/test_fn.js&quot;), &quot;&lt;cmd&gt;&quot;, 1, null);
System.out.println(f1.call(cx, scope, f1, new Object[] {5}));
</pre>

</div>
So far so good. If your Unity Javascript is just a collection of simple functions then this is all that is required. However, there is a good chance this is not the case. Obviously any Unity specific functions and classes are not available (eg Ray, Input, etc). However, more important are the big differences between Unity Javascript and standard (ECMA) Javascript.

<p>Many people say that Javascript in Unity should more accurately be referred to as UnityScript. I think that is definitely true. Although it looks like Javascript there are some fundamental changes. Most importantly, Javascript uses a <a href="http://stackoverflow.com/questions/387707/whats-the-best-way-to-define-a-class-in-javascript">prototype-based scheme to define classes</a>. UnityScript has an inheritance model, and <a href="http://unifycommunity.com/wiki/index.php?title=UnityScript_versus_JavaScript">the two schemes are not compatible</a>. To me these differences are enough to prevent want I wanted to achieve.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/04/failure-unity-javascript-in-ja.html</link>
            <guid>http://www.cordinc.com/blog/2012/04/failure-unity-javascript-in-ja.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Unity</category>
            
            <pubDate>Sat, 07 Apr 2012 11:13:23 +0000</pubDate>
        </item>
        
        <item>
            <title>Lost Code</title>
            <description><![CDATA[<p>Recently at work I was asked to find out if anyone was still using a small tactical program I wrote. If it was unused, they apologetically asked me to shut it down. No apology was required, but I understand why it was offered. Some developers can become quite precious about their code and want to see it keep running forever. However, after working in this fast-paced industry for nearly 15 years I have long accepted that most of my code is no longer running. I'd be lucky if most of it is even still backed up somewhere rather than being sent to <a href="http://en.wikipedia.org/wiki//dev/null">/dev/null</a>.</p>

<p>Four of my old teams were shutdown with near total loss of code. Another two years were spent at a consulting firm where most of the clients I serviced no longer exist. Those 5 jobs combined mean that half of my working life's production is largely gone. At a guess I would say 10% of the code from my first five working years is still used; around 30% from the second five years; and, over two-thirds of the last 5 years of my code is currently running. My professional code appears to have a half-life of around 4 years. This sounds about right considering the rate of technology change.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/04/lost-code.html</link>
            <guid>http://www.cordinc.com/blog/2012/04/lost-code.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Memories</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
            <pubDate>Sun, 01 Apr 2012 15:08:19 +0000</pubDate>
        </item>
        
        <item>
            <title>Line / Plane Intersection in Unity3D</title>
            <description><![CDATA[<p>In a recent <a href="http://unity3d.com/">Unity3D</a> game prototype I needed to determine the point of intersection between a line and plane. A player would click on the screen where they wanted their spaceship to go, and I needed to work out where that actually was in the world coordinates. The line is defined by the camera point and the point on the screen clicked (as given by <tt>camera.ScreenToWorldPoint</tt>). The plane was the spaceship (assuming no up or down movement).  </p>

<p><img src="http://www.cordinc.com/blog/line_plane.png" alt="" /></p>

<p>If the line was intersecting an object in the scene then this could be easily achieved with Unity3D's built in functions. In this case by casting a ray from the camera and finding the objects it hits (see the <a href="http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html">Raycast help page</a>). However, my prototype is set in space, there is no object there to hit other than a small spaceship. </p>

First, let's work out the equation of the line from the camera (point 'c') and the mouse click (point 'm'). We can get the position of the camera with <tt>var c = camera.transform.position</tt> and the position of the mouse click with:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 40px">

<pre>
var s = camera.ScreenToWorldPoint(Vector3(Input.mousePosition.x, Input.mousePosition.y, 100.0)); 
</pre>

</div>
Note that in the above, the third vector parameter (the Z value) in the <tt>ScreenToWorldPoint</tt> call is the distance from the camera of the resulting point. Thus if 0 or <tt>mousePosition.z</tt> (which is also 0) is used then the resulting point is just the camera location itself. Here I have used a distance of 100 to make sure there is a good separation between the points describing the line. The <a href="http://mathworld.wolfram.com/Point-LineDistance3-Dimensional.html">general equation of a line in 3 dimensions</a> is (for the points c &amp; m):<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 40px">

<pre>
[c.x + (m.x - c.x) * t, c.y + (m.y - c.y) * t, c.z + (m.z - c.z) * t]
</pre>

</div>
So to find the point of intersection requires solving that simultaneously with the equation of the plane. Here is where my scenario gets easy. The plane this line intersects with in my game is the horizontal plane the spaceship is current only. That is the plane is described by:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 30px">

<pre>
y = spaceship.y
</pre>

</div>
At some point on the line the following holds as long as the line intersects at some point:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 30px">

<pre>
spaceship.y = c.y + (m.y - c.y) * t
</pre>

</div>
which means:<br />
<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 90px">

<pre>
if (m.y == c.y) {
   t = 0; // no intersection
} else {
   t = (spaceship.y - c.y) / (m.y - c.y); 
}
</pre>

</div>
The case <tt>m.y == c.y</tt> denotes the case where the line does not intersect the plane. What happens here is up to you. With the value of 't' known the equation for the line can be solved to give the point of intersection. Done.]]></description>
            <link>http://www.cordinc.com/blog/2012/03/line-plane-intersection-in-uni.html</link>
            <guid>http://www.cordinc.com/blog/2012/03/line-plane-intersection-in-uni.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Unity</category>
            
            <pubDate>Mon, 26 Mar 2012 18:54:22 +0000</pubDate>
        </item>
        
        <item>
            <title>La Trobe University Archaeology</title>
            <description><![CDATA[<p>Available from <a href="http://itunes.apple.com/gb/itunes-u/archaeology/id394588178">iTunes</a> or from the <a href="http://www.latrobe.edu.au/news/podcasts">La Trobe University Podcasts page</a> (but they will have to be found individually as there does not appear to be a series webpage).</p>

<p>This is a series of talks and interviews from the La Trobe University Archaeology department. The topics vary wildly, from the traditional Ancient Egypt and Cyprus, to relatively modern digs in <a href="http://en.wikipedia.org/wiki/Melbourne">Melbourne city</a> (founded in 1835). As the series is archaeologically focussed there is more emphasis on the extraction and identification of objects than history. At present there are 12 episodes - 2 are short videos (around 3 minutes) and the remainder are audio only. Two of the audio podcasts are hour long scholarly presentations, while the other 8 are interviews of between 15 to 20 minutes duration. There may be more episodes in the series as the entries so far have trickled in over the last 2 years. Production quality is high for the whole series. </p>

<p>There are two podcasts on archaeology in <a href="http://en.wikipedia.org/wiki/Oceania">Oceania</a>, particularly <a href="http://en.wikipedia.org/wiki/Hawaii">Hawaii</a>. One is an academic presentation, while the other is an interview with the same presenter on the same topic. There is some talk on <a href="http://en.wikipedia.org/wiki/Collapse:_How_Societies_Choose_to_Fail_or_Succeed">Jared Diamond's  Collapse book</a>. Diamond suggests that society on the Polynesian island <a href="http://en.wikipedia.org/wiki/Mangareva">Mangareva</a> due to overforestation. However, the presenter's research suggests instead that the deforestation was caused by a lack of phosphorus in the soil due to the killing of sea birds. The discussion of Hawaii is similarly focussed on the affect of intensive cultivation on soil quality. Unsurprisingly the indigenous people started agriculture on the best land and as population grew, expanded out to less productive land. Once all arable areas were cultivated, the land became more subdivided and population growth slowed. Also there is evidence of political consolidation beginning around the same time.</p>

<p>Another paired presentation and interview discuss excavations at the ancient Egyptian capital <a href="http://en.wikipedia.org/wiki/Akhetaton">Amarna</a>. They are focussed on the industry of the time - in particular small metal work and glazed pottery. Details of the materials used are probed with <a href="http://en.wikipedia.org/wiki/Synchrotron">synchrotrons</a> and a bit of experimental archaeology is conducted to determine the techniques used to manufacture them.</p>

<p>Another episode details the search for ships lost in Vietnam by the Chinese emperor <a href="http://en.wikipedia.org/wiki/Kublai_Khan">Kublai Khan</a> at the <a href="http://en.wikipedia.org/wiki/Battle_of_B%E1%BA%A1ch_%C4%90%E1%BA%B1ng_(1288)">Battle of Bach Dang</a>. Three episodes (including both video podcasts) discuss the tools and evolution of early humans, especially the position in the evolutionary tree of some complete skeletons recently found in <a href="http://en.wikipedia.org/wiki/Sediba">Sediba</a>. There is also an interview about bronze age burials in Cyprus and other podcasts focus on the archaeological difficulties and discoveries underwater or in cities.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/03/la-trobe-university-archaeolog.html</link>
            <guid>http://www.cordinc.com/blog/2012/03/la-trobe-university-archaeolog.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">History</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Podcasts</category>
            
            <pubDate>Sat, 17 Mar 2012 11:57:06 +0000</pubDate>
        </item>
        
        <item>
            <title>NavigableMap &amp; time-based caches</title>
            <description><![CDATA[<p>NavigableMap</p>

<p>I often find myself writing time-based caches. Something like storing the last X hours of ticks from a data feed. Most teams I join usually have a utility class to help with such tasks. In a recent move I joined a team that didn't have such a utility, but did have a need for such a cache. Before coding, I thought I do a quick check to see if anything new had come along to help. At this point I discovered the Java 6 <a href="http://docs.oracle.com/javase/6/docs/api/java/util/NavigableMap.html">NavigableMap</a> interface.</p>

<p>NavigableMap defines a type of sorted map with handy methods for obtaining submaps. So to get a map of the entries greater than a particular value use the <tt>tailMap</tt> method. The corresponding method for the submap less than a value is <tt>headMap</tt>. These methods return a view on the original map. So changes to the submap are reflected in the original map. The <span class="caps">JDK </span>provides <a href="http://docs.oracle.com/javase/6/docs/api/java/util/concurrent/ConcurrentSkipListMap.html">concurrent</a> and <a href="http://docs.oracle.com/javase/6/docs/api/java/util/TreeMap.html">non-concurrent</a> implementations of the interface.</p>

<p>This is very useful for a time-based cache. Create a NavigableMap sorted on the time (I used the epoch milliseconds returned by <tt>System.currentTimeMillis()</tt>) then <tt>tailMap</tt> returns the entries younger than a given time, and <tt>headMap</tt> those older. So to trim the cache of entries older than a certain time use <tt>headMap(System.currentTimeMillis() - maxAge).clear()</tt>. So easy!</p>

<p>Here is a complete time-based cache class for use as an example.</p>

<div style="background: #DFE8DF; overflow: auto; padding: 2px; margin-bottom: 10px; margin-top: 1px; height: 300px">

<pre>
public class TimeSeriesCache&lt;V&gt; {

    private static final int MILLIS_IN_MINUTE = 60 * 1000;
    private static final int CLEAR_OLD_PERIOD_MINUTES = 1;

    private final NavigableMap&lt;Long, V&gt; series = new ConcurrentSkipListMap&lt;Long, V&gt;();
    private final Set&lt;TickListener&lt;K, Long, V&gt;&gt; subscribers;

    public TimeSeriesCache(int maxAgeMinutes) {
        if (maxAgeMinutes &gt; 0) {
            final int maxAge = maxAgeMinutes * MILLIS_IN_MINUTE;
            Executors.newSingleThreadScheduledExecutor().scheduleWithFixedDelay(
                    new Runnable() {
                        @SuppressWarnings(&quot;boxing&quot;)
                        @Override public void run() {
                            series.headMap(System.currentTimeMillis() - maxAge).clear();

                        }
                    }, CLEAR_OLD_PERIOD_MINUTES, CLEAR_OLD_PERIOD_MINUTES, TimeUnit.MINUTES);
        }
    }

    public Collection&lt;V&gt; getSeriesAfter(Long fromTimestamp) {
        return series.tailMap(fromTimestamp).values();
    }

    public void add(V value) {
        series.put(System.currentTimeMillis(), value);
    }

    public void add(Long timestamp, V value) {
        series.put(timestamp, value);
    }
}
</pre>

</div>]]></description>
            <link>http://www.cordinc.com/blog/2012/03/navigablemap-timebased-caches.html</link>
            <guid>http://www.cordinc.com/blog/2012/03/navigablemap-timebased-caches.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Java</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Technical</category>
            
            <pubDate>Sat, 10 Mar 2012 09:52:16 +0000</pubDate>
        </item>
        
        <item>
            <title>Kuala Lumpur</title>
            <description><![CDATA[<p>I'm not sure how many people who read this blog actually know me in person - probably very few. However, for those that do, I am moving. Towards the end of the year (the exact date is still uncertain), I'm physically moving to <a href="http://en.wikipedia.org/wiki/Kuala_Lumpur">Kuala Lumpur</a>. Virtual location (email, website, etc) will remained unchanged. It is not yet known what I'll be doing there - there are some work visa issues to be sorted out.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/03/kuala-lumpur.html</link>
            <guid>http://www.cordinc.com/blog/2012/03/kuala-lumpur.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">General</category>
            
            <pubDate>Sat, 03 Mar 2012 16:47:24 +0000</pubDate>
        </item>
        
        <item>
            <title>Game Reviews Again</title>
            <description><![CDATA[<p>Almost exactly six months ago I wrote a <a href="http://www.cordinc.com/blog/2011/08/modern-gaming.html">review of some modern computer games</a>. All were well known, and I said they were all excellent. I even suggested that computer games were in a golden age - better than ever before. Now I have completed 3 more well known, highly regarded, recent games. How did they do in comparison? Not as well unfortunately.</p>

<p>First up I played <a href="http://en.wikipedia.org/wiki/Call_of_Duty_4:_Modern_Warfare">Call Of Duty 4: Modern Warfare</a>, the original 2007 Modern Warfare game which spawned the incredibly popular series of <a href="http://en.wikipedia.org/wiki/First-person_shooter">first-person shooters</a> of the same name. At first I was impressed with the intensity of this game. However, the fast pace quickly slows with realisation there is essentially no penalty to getting shot. Death is a mere slight pause. I felt like I was on rails, being led through the action. The game was just a reaction speed test. Multiplayer is probably better, but I didn't play that - I doubt my reactions are fast enough. The story is ok, nothing special. Although I did detect a possible subtle satire on war - but that could just be me. The story is most notable for a couple of impressive famous scenes (the nuke level and the gunship level) that do work very well. This game is probably too linear and twitchy for me.</p>

<p>Next up I played <a href="http://en.wikipedia.org/wiki/Assassin's_Creed:_Brotherhood">Assasins Creed: Brotherhood</a>. I was particularly looking forward to this game because of its open world setting in medieval Rome. Certainly the graphics are beautiful and I enjoyed wandering around the ruins of Rome. But the controls! This game was incredibly frustrating - it was hard to get my avatar to perform as intended. I tried for many hours (28 total), but still found myself often shouting at the computer and cursing the clumsy controls. Eventually I just raced to finish the main story. Incidently, the story is very silly and not worth discussing. This game could have been so much better, but is just annoying.</p>

<p>Just a few days ago I completed <a href="http://en.wikipedia.org/wiki/BioShock">Bioshock</a>. This is an excellent game, restoring my belief in modern gaming after the previous two disappointments. The Ayn Rand-gone-wild underwater setting is incredible. The art-deco and slightly cartoony (but I think that was the point) graphics are decent. I often found myself just walking around looking at the banners and architecture. Most importantly the controls were super smooth. The game was also quite intense, particularly at the start and end. Sometimes I jumped at a surprising action or went looking for someone I could hear nearby. It is interesting that both this game and Mass Effect 2, give the player some small choices that make minor differences to gameplay, as opposed to the lack of agency in Modern Warfare. A little choice (even if it is fairly inconsequential in plot terms) goes a long way in making the player feel involved. </p>]]></description>
            <link>http://www.cordinc.com/blog/2012/02/game-reviews-again.html</link>
            <guid>http://www.cordinc.com/blog/2012/02/game-reviews-again.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Games</category>
            
            <pubDate>Sun, 26 Feb 2012 10:23:52 +0000</pubDate>
        </item>
        
        <item>
            <title>Rio Tinto R&amp;TD (continued)</title>
            <description><![CDATA[<p>After joining Knowledge-based Systems at Rio Tinto <span class="caps">R&amp;TD, </span>my first task was working on the MineSim project. This was a very successful application to simulate minesites. To do this a user would define the topology/geology of a mine, the equipment/personnel available and the goals to pursue. The program would then simulate the mine minute by minute. New blocks would be blown when ready, little loaders would muck out the ore from the block and large trucks moved round the mine, picking up ore and driving back to the dumps. </p>]]></description>
            <link>http://www.cordinc.com/blog/2012/02/rio-tinto-rtd-continued.html</link>
            <guid>http://www.cordinc.com/blog/2012/02/rio-tinto-rtd-continued.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Memories</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Rio Tinto</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Work</category>
            
            <pubDate>Sun, 19 Feb 2012 13:29:04 +0000</pubDate>
        </item>
        
        <item>
            <title>Rio Tinto R&amp;TD</title>
            <description><![CDATA[<p>After <a href="http://www.cordinc.com/blog/2011/03/electrolley.html">Electrolley</a> I worked at <a href="http://www.riotinto.com/">Rio Tinto</a> in their Research and Technical Development division. I had wanted a job there for sometime. Many of my honours classmates and one of my ex-lecturers (the one I originally wanted as my honours supervisor) worked there. I had interviewed with them during my PhD, but was rejected as the position was for a more practical programmer and they saw me as too theoretical. After a few months at Electolley I was contacted saying a position more suited for my skills had arisen and asking if was I still interested. Soon I was being interviewed again.</p>

<p>The interview process was the most arduous I've ever encountered. First there was an interview by a couple of managers. Then another interview by the entire team I would be joining. A panel of nine people arrayed in front on me. During this part they asked me to give an impromptu 15 minute presentation of my ex-PhD topic. A quizzing on its practical applicability followed. By this stage I have been onsite two hours and they said it was time for the next stage. I was taxied into the city and given a battery of psychometric tests. There was a logical reasoning test (well-above average), vocabulary test (average), Myers-Briggs test (INTP, as always) and another test I'd never heard of before to check my work aptitude. Nearly 5 hours in total and I was completely drained.</p>

<p>I got the job and after a few months I heard that it didn't really matter what the tests said. Half the team (including the manager) knew me from uni or honours, so unless I had a breakdown the job was always mine. To prove the point I was told the results of the psychometric tests. Apparently the unknown test had indicated I was completely unemployable and unable to work in a team. They ignored it and hired me anyway.</p>

<p>The Rio Tinto <span class="caps">R&amp;TD </span>team in Perth was in beautiful purpose built building near Curtin University. It was designed to be like a village - a central street walkway acting as a street with trees and benches (all inside). Off the walkway came the open plan office space. There was also a large reception, board room, library, large eating area and kitchen. No canteen, but I never heard of anyone in Perth having a canteen. It was set on landscaped grounds with more than enough parking and there was tons of natural light. A very pleasant workspace. The only problem was the abandoned building and the emptiness.</p>

<p>The complex was built to house over 300 staff, but never housed more than 55 people while I was there. There was another entire building with workshops unused and locked up. Most of my colleagues spread themselves out over 2 desks. A couple of months before I started there was over 200 people on site. Most desks were taken and the workshops full of engineers. However, many were made redundant or transferred around the time of my interview. Four small teams were left (plus admin staff). </p>

<p>I was in Knowledge-Based Systems. We were supposed to focus on applying machine learning techniques (like expert systems) to mining problems. Although most of our time was spent writing mine simulations, linear optimisation systems (basically the <a href="http://en.wikipedia.org/wiki/Simplex_algorithm">simplex method</a> with a large number of variables and a nice <span class="caps">GUI</span>) or training tools. There was another team of more "practical" software developers working with early web technologies. On the non-computer side was a team of mathematicians and engineers doing various consulting tasks and a small team focused on <a href="http://en.wikipedia.org/wiki/Computational_fluid_dynamics" title="CFD">Computational Fluid Dynamics</a> in smelters. </p>

<p>With just 1st class Honours I was clearly one of the least educated people in the building. Their was a distinct academic bias. Most of the senior managers had PhDs, as did probably a third of the staff. People generally had time to think - although that may not have been a good indicator for future prospects. There were often discussions of very scientific topics and opinions were always well informed. Here I learnt the more theoretical side of software engineering with regular arguments on what process or pattern was best in a certain situation. Later I learnt the more practical side.</p>

<p>While I was there the place had an eerie atmosphere. All non-managers openly believed that we would all be made redundant sooner rather than later. Everyone knew the intimate details of the redundancy policy. It was very generous so staff turnover was low as people waited for their inevitable payout. I remember hearing a couple of anonymous shouts of "make me redundant now!". There was a bit of black humour around the situation. When the head of the global technology division changed we joked about him being an evil leprechaun (he had an unfortunate staff photo) who would sack us all. We were right!</p>

<p>The site was also extremely safe. All sites in Rio Tinto apparently followed the same safety precautions. Thus our research office building took safety as seriously as a mine site. There was a sign at the entrance proudly displaying there there had been no lost time due to injury for over 600 days (not sure the actual number, but it was years). Towards the end of my time there the counter reset after a morning was lost when a minor traffic accident resulted in a checkup at the doctors (they were fine). We had a safety manager who trained us all on the safety precautions. Every month he would tour the site for safety violations and hand out cautions - normally for overly large stacks of paper or dirty mugs. I felt a little sorry for the guy, there wasn't much for him to do. He previously had a similar job at a mine, which must have been much more interesting. Although it was impressive how after I casually mentioned my fingers ached a little one day to see how serious it was taken. I was visited by an outside ergonomics expert who recommended my desk be lowered a few centimeters. That afternoon it was dismantled and rebuilt! The expert was right, the new desk was much better.</p>

<p>I sat with two colleagues is a small area of desks partitioned off between a reception desk and the General Manager's office. The area was partitioned into thirds, each section with 2 desks, 2 PCs, etc. We took one section each. It was a good little spot. The partitions went up to eye level, and there was only one place to enter the area. The partitions were also setup such that to reach the back thirds a visitor would need to make a couple of 90 degree turns. Furthermore large pot plants had been placed at strategic points to block sightlines into the area. The basic affect was that we could tell when someone was coming towards us, but they couldn't see what we were doing. Knowing the person who sat furthest from the entrance (an aspiring DJ), I don't think this setup was unintentional. For the same reason none of the three of us could see eachothers' screens. I had two PCs, but only ever used one, a decent second hand computer (from someone recently made redundant - Pentium2 with a 17" CRT, good for the late 90's). One of the other guys had 2 PCs and bright blue <a href="http://en.wikipedia.org/wiki/SGI_Indigo">Silicon Graphics Indigo</a> machine for a 3D modelling project he did - very cool. </p>

<p>As a small office in a global company we traveled often to various mining sites around the world. I only went once, to an Australian gold mine, which I will write about later. Others went around the world. The one place I would have like to have visited was the <a href="http://en.wikipedia.org/wiki/Grasberg_mine">Grasberg mine in Indonesia</a> - a very large gold and copper mine up a tropical mountain. There was some talk of sending me there to run a training course, but I didn't act keen and the timing wasn't good with my other projects. In retrospect I should have volunteered. <a href="http://en.wikipedia.org/wiki/West_Papua_(province)">Irian Jaya</a> is a place that most foreigners (or even Indonesians) do not get a chance to visit. There were always good stories about visits. During the <a href="http://en.wikipedia.org/wiki/1997_Asian_financial_crisis">Asian financial crisis in 1997</a> one colleague visiting there managed to run up an enormous 5 digit expenses bill - he occasionally told snippets of the story of his few days living the high life. Management were aghast, but I had the sense they were slightly impressed with the ability to spend so much when the local currency was so cheap.</p>

<p>Soon after I declined the trip to Grasberg one of our staff visiting the mine was threatened with a spear when some locals bust into the onsite offices. I think it turned out to be a dispute over a pig, but management was greatly concerned as there is a low-level insurgency in the area (over independence from Indonesia). No one from our office ever went there again. </p>

<p>Working at <span class="caps">R&amp;TD </span>was fairly pleasant on a day-to-day basis. It was small enough for us all know eachother, and there was a slight siege mentality - us versus the off-site management wanting to shut us down. Everyone got a mug with their name (or nickname) printed on it when they started work. This stopped the problem everywhere else about disappearing mugs/cups. I still have mine 12 years later. When an eclipse occurred we all headed outside for the afternoon to see it. There was a social committee which arranged various regular small events. I was actually a member or the committee for a while. I arranged the Christmas Party river cruise right before I left. In fact I didn't go to the party I organised, it didn't seem right as I quit and left a few weeks before the event. </p>

<p>I also tried to get involved in the company superannuation/pension plan. They had elections for staff representatives on the plan's board. I thought it would look good on my resume. Most of the people I worked with acted bemused when told I was running. My campaign was fairly weak, consisting mainly of writing a blurb for the company magazine (As did all the other candidates). In the end I think I got about 20 votes, not even half the people I worked with. The winners got thousands of votes.</p>

<p>After I had been at Rio just over a year, the work starting slowing, senior management swapped jobs and a review was announced. It seemed like the end was nigh. I knew the redundancy policy very well (as did everyone) and until I had been there over two years I would receive very little. It seemed unlikely I would make it that far or be promoted. It is best to jump than be pushed so I looked around. Finding a job in the dotcom boom was not too hard, and I left after 18 months at Rio. A few months later all but a handful of my ex-colleagues were sacked and the facility shuttered. My timing was just right.</p>

<p>My last memories of working at Rio were having competitions with the aspiring DJ next to me over who could leave earliest. He won by leaving at 3pm, walking past the General Managers office and saying goodbye before walking out. I didn't have the balls to top that even though I had quit. On my last day we all went to the pub for lunch. I left about 4pm, my manager and most of his team were still there (and stayed late into the night). He teased me for leaving "early". </p>

<p><a href="http://www.cordinc.com/blog/2012/02/rio-tinto-rtd-continued.html">Continued with details of the tasks I performed while at Rio Tinto</a>.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/02/rio-tinto-rtd.html</link>
            <guid>http://www.cordinc.com/blog/2012/02/rio-tinto-rtd.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Memories</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Rio Tinto</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">Work</category>
            
            <pubDate>Sun, 12 Feb 2012 10:40:24 +0000</pubDate>
        </item>
        
        <item>
            <title>Bonds: Addendum</title>
            <description><![CDATA[
<ul>
<li>Part 1  - <a href="http://www.cordinc.com/blog/2011/10/bonds-part-1-the-theory.html">The Theory</a> </li>
<li>Part 2a - <a href="http://www.cordinc.com/blog/2011/10/bonds-part-2a-the-reality.html">The Reality</a></li>
<li>Part 2b - <a href="http://www.cordinc.com/blog/2011/12/bonds-part-2b-the-reality-cont.html">The Reality continued</a></li>
<li>Part 3a - <a href="http://www.cordinc.com/blog/2011/12/bonds-part-3a-the-technology.html">The Technology</a></li>
<li>Part 3b  - <a href="http://www.cordinc.com/blog/2012/01/bonds-part-3b-the-technology-c.html">The Technology continued</a></li>
<li>Part 4 - <a href="http://www.cordinc.com/blog/2012/01/bonds-part-4-the-future.html">The Future</a></li>
</ul>



<p>After writing 6 long posts on my experiences in <span class="caps">EGB IT,</span> I realised I still missed out many points. Here they are in no particular order.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/01/bonds-addendum.html</link>
            <guid>http://www.cordinc.com/blog/2012/01/bonds-addendum.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Finance</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">General</category>
            
            <pubDate>Sat, 21 Jan 2012 12:02:16 +0000</pubDate>
        </item>
        
        <item>
            <title>Bonds: Part 4 - The Future</title>
            <description><![CDATA[
<ul>
<li>Part 1  - <a href="http://www.cordinc.com/blog/2011/10/bonds-part-1-the-theory.html">The Theory</a> </li>
<li>Part 2a - <a href="http://www.cordinc.com/blog/2011/10/bonds-part-2a-the-reality.html">The Reality</a></li>
<li>Part 2b - <a href="http://www.cordinc.com/blog/2011/12/bonds-part-2b-the-reality-cont.html">The Reality continued</a></li>
<li>Part 3a - <a href="http://www.cordinc.com/blog/2011/12/bonds-part-3a-the-technology.html">The Technology</a></li>
<li>Part 3b  - <a href="http://www.cordinc.com/blog/2012/01/bonds-part-3b-the-technology-c.html">The Technology continued</a></li>
<li><a href="http://www.cordinc.com/blog/2012/01/bonds-addendum.html">Addendum</a></li>
</ul>



<p>So after nearly 7 years on <span class="caps">EGB </span>technology teams I have moved on. Not out of banking (at least not yet), but when the opportunity came to try a different business area I jumped. This is despite being able to earn more money if I stayed in my <span class="caps">EGB </span>niche. There are two related reasons for leaving: the industry and technology are both changing to the detriment of developers. </p>

<p>When I started in 2005, <span class="caps">EGB </span>trading was already on an upswing that lasted through 2009. I'm not sure when this upwards trajectory began, but the people around me considered it normal. Business was good throughout the mortgage and banking crisis of 2008. When times are good and the desks are making good money some of it is reinvested into technology. There was a lot of optimism and this translated into banks wanting the fastest and smartest trading platform. We got to rewrite systems. Increasingly business was relying on technology - it was becoming trade-by-wire. It seemed that there was much further to go. Algorithmic trading is big in equities, why couldn't it be big in fixed income too. There was huge potential for writing interesting code.</p>

<p>This environment no longer exists. It was only when the European debt crisis began to bite in 2011 that things trended downwards, but then they went down fast. There is a great deal less ambition among the fixed income desks. Most traders seem happy just to not be losing money - something many are not achieving. Some banks are shutting down their bonds desks. As a natural consequence there is less to spend on technology and little desire to do more than maintenance. Flow volume is king, and as far as technology development is concerned, that is not hard. Thus less developers are required and the work is less interesting.</p>

<p>Combined with this is the creeping commoditisation of bonds technology. When I started Ion provided mainly gateways, little tools and their message bus. Over time they have climbed up the product stack. Now they also sell pricing engines, autoquoters, autohedgers, risk engines, position servers - nearly everything a bank needs to trade cash bonds. The quality is fine too. Their applications won't do everything a desk requires, but it will do most of it and the desk's technology team can add the remainder quickly. Not all banks will use vendor systems (many don't like Ion or see advantage in bespoke systems), but enough will to affect the market for <span class="caps">EGB </span>technologists.</p>

<p>Thus, once again, less developers are required and the work is less interesting. I don't see the situation changing until the market improves - and I don't see that happening soon. So I thought it time to try a different business area.</p>]]></description>
            <link>http://www.cordinc.com/blog/2012/01/bonds-part-4-the-future.html</link>
            <guid>http://www.cordinc.com/blog/2012/01/bonds-part-4-the-future.html</guid>
            
            
                <category domain="http://www.sixapart.com/ns/types#tag">Finance</category>
            
                <category domain="http://www.sixapart.com/ns/types#tag">General</category>
            
            <pubDate>Sat, 14 Jan 2012 12:00:37 +0000</pubDate>
        </item>
        
    </channel>
</rss>

