P is for Productivity in New Zealand

It costs 40c to produce every dollar in New Zealand which, is pretty astounding figure. A report released this week by the New Zealand Productivity Commission tries to determine why New Zealand’s GDP per capita is generating over 20% below the OECD average when (based on it’s broad policy settings) it should be generating 20% above the OECD average.

It identifies a number of causes:

The country has good resources – investment in physical capital and average years of schooling are broadly consistent with other countries. Employment of low-skilled workers also plays only a minor role in New Zealand’s poor (measured) productivity performance.

Instead, over half of New Zealand’s productivity gap relative to the OECD average can be explained by weaknesses in our international connections. New Zealand firms face reduced access to large markets and limited participation in global value chains, where the transfer of advanced technologies now often occurs.

Most of the rest of the gap reflects underinvestment in “knowledge-based capital”. In particular, R&D undertaken by the business sector is among the lowest in the OECD, reducing the capacity for “frontier innovation” and the ability of firms to absorb new ideas developed elsewhere (“technological catch-up”). The quality of management in New Zealand is also low, which lowers the productivity gains from new technology.

The paper also outlines ideas for addressing these problems. It’s a good read. The 4 page summary PDF can be found here and the full paper (An International Perspective on the New Zealand Productivity Paradox) can be found here [PDF].

O is for Open Source I use (and create)

Today I thought I’d go through some of the Open Source software that I regularly use. The Open Source movement is a interesting one, basically it calls for the source code of software to be released alongside the software. This allows anyone who can (or needs to) to modify the software and pass these changes back to the community thus benefiting all.

Traditionally Open Source products have been less polished then commercial software but these days, many rival or even better their commercial counterparts and Open Source software powers much of the Internet and even the mobile devices that you use everyday.

I have a few Open Source projects knocking around. Probably the most successful of these  is CsvJdbc. This project is over 13 years old (I started it on the 9th January 2001), it has been downloaded tens of thousands of times and it is included in numerous other software packages (including commercial ones). Ohloh estimates that over 7 man years of effort has gone into the project, worth almost $380000 USD. Not bad for free software. Whilst I no longer actively work on the project, others have picked up where I left off and the project still thrives.

But enough about my projects, here are a list (in no particular order) of some of the Open Source software I use:

 Notepad++ is an awesome text editor. I use this multiple times during any given day. It has a huge number of plugins and add-ons to tackle any text editing task.

I have already blogged about Blender. If you are interested in 3D modelling and animation then check it out.

Inkscape is another great piece of software. It is basically a vector image editing software, similar to Adobe Illustrator. Along similar lines, Gimp is like Photoshop. It’s user interface can be a little confusing but it is a powerful application.

VLC is a great media player and FFmpeg is a swiss-army knife for video format conversion (be warned it uses the command line).

Both Firefox and Chrome web browsers are open source too. As is Android the operating system you find on many phones.

This blog is powered by a bunch of open source software including WordPress.

As a software developer I use tens of pieces of Open Source software to do my job. Including:

  • Putty – a SSH client
  • WinSCP – A graphical SCP client
  • Jetty – A web app server
  • Python – A programming language
  • Java – A programming language
  • jQuery – A JavaScript library for creating web applications
  • AngularJS – A JavaScript framework
  • Eclipse – An integrated development environment
  • MySql – A database
  • Apache – A web server
  • PHP – A programming language
  • Ubuntu – An operating system

Etcetera, etcetera… its pretty safe to say that without Open Source I would not be able to do my job and they way we use the Internet and computers would be very very different!

M is for Monkey – the evilest testing tool around

I do a heaps of Android development and whilst it appears straightforward there are quite a lot of subtleties, particularly when dealing with threads and UI updates, that generate all sorts of app crashes.

Unfortunately these race conditions are often very hard to reproduce. Thankfully (and evilly) we have the monkey testing tool. Set it loose and it frantically taps and swipes away, switching activities, causing mayhem and inevitably crashing your app.

Running monkey is really easy just, run the adb tool with the following parameters:

adb shell monkey -p your.package.name -v 500

Also make sure you run monkey on your app, on different versions of Android, especially if you use the support libraries which don’t always behave the same way on different OS versions. You will be surprised at what goes wrong.

Let loose the monkey and despair ☺

L is for Logo and wee little turtles

Logo was one of first programming languages (after BASIC) that I really learned in depth. The most famous aspect of Logo is its turtle graphics which simulates a tiny turtle to which you can give commands such as forward, backward, left turn and right turn. As the turtle moves on the screen it draws a line behind it.

With its graphical feedback, turtle graphics is an ideal way to introduce people to programming. Today I thought I’d go over some examples. I’m not going to use Logo but rather the Python programming language which has a turtle graphics module.

First steps, install Python and then launch IDLE (the Python installer should have created a short-cut). Now enter in the following (press Enter at the end of each line):

from turtle import *
showturtle()

You should see window with a black arrow in it. This is the turtle. Now type

forward(100)

The turtle should now move forward 100 turtle steps. Next enter the following lines:

right(90)
forward(100)
left(90)
forward(100)

The right and left commands turn the turtle the number of degrees you specify. It gets a little tedious to type these out the whole time so there is a shorthand. Try these commands:

bk(50)
fd(50)
rt(45)
lt(45)

Ok let’s try something more interesting. We are going to draw a square but first let’s clear the screen:

clearscreen()

Now the square:

fd(100)
rt(90)
fd(100)
rt(90)
fd(100)
rt(90)
fd(100)
rt(90)

Nice. But what if you want to draw lots of squares. It would get very boring typing out all those commands over and over again. Let’s tell the computer how to draw a square (note the indentation of the lines, these are important):

def sq():
    fd(100)
    rt(90)
    fd(100)
    rt(90)
    fd(100)
    rt(90)
    fd(100)
    rt(90)

Now we can just type:

sq()

to draw a square! Try this:

sq()
rt(5)
sq()
rt(5)
sq()

Shiny, we are getting a neat pattern forming… but once again it’s too tedious. So enter this:

clearscreen()
speed(0)
for i in range(6):
    sq()
    rt(60)

The speed command makes the turtle move faster so we don’t have to wait. The for statement gets the computer to repeat a set of commands and the range(6) command creates the numbers 0 to 5, which means that the commands sq() and rt(60) are repeated 6 times. Lets add a fd command in each iteration (step) of the loop:

clearscreen()
speed(0)
for i in range(72):
    sq()
    rt(5)
    fd(20)

And we get a donut type thing. Finally lets go crazy and write a new command called polyspi that calls itself!

def polyspi(angle,inc,side,times):
    if times > 0:
        fd(side)
        rt(angle)
        polyspi(angle,inc, (side + inc),(times - 1))

This is called recursion and because it changes it’s side and times values when it calls itself, we_ _can generate all sorts of interesting patterns such as:

clearscreen()
speed(0)
polyspi(90,5,50,50)

polyspi Example 1

or

clearscreen()
speed(0)
polyspi(95,1,50,100)

polyspi Example 2

or

clearscreen()
speed(0)
polyspi(117,3,25,200)

polyspi Example 3

To find out more check out the Python turtle documentation. Have fun!

K is for Kinect Fusion & 3D selfies

I’d thought I’d give the Kinect Fusion demos a try. Kinect Fusion allows you to take 3D scans of things by waving your Kinect around. It’s designed to work with the desktop/Windows version of the Kinect but I’d thought I’d give it a go with the Kinect from my old XBox 360.

Turns out it works pretty well. The resolution is pretty low but if you were using one of the new Kinect v2s things would be a lot cripser.

Here is a selfie (holding the Kinect at arms length):

YouTube Preview Image

And here is one of son number 1 (who did a fantastic job of sitting very very still):

YouTube Preview Image

You if you want to give it a try yourself you can download the Kinect SDK from here.

 

J is for Jasper – control anything with your voice

So I bought a Raspberry Pi a couple of months ago and I’ve been having all sorts of fun trying out different things. I’ve created a wifi packet sniffer to track mobile devices and turned it into an arcade game machine, all sorts of interesting things.

Jasper is going to be my next weekend project. It basically lets you build your own J.A.R.V.I.S (from the IronMan movies). Here is a video of it in action:

YouTube Preview Image

I’ll update this post once I’ve tried it out :)

 

 

I is for Insel – an fantasy setting I’m working on

Insel is a fantasy setting I’ve been working on for a role playing game. Imagine a island covered by a crowded, renaissance city surrounded by a vast ocean. In all of history no one who has left the island has ever come back.

Metal is plentiful and intricate “clockwork ” machines power the society. Food and “wood” is grown from fungus and giant mushrooms which are farmed in the many abandoned mine tunnels under the city. Fish is the primary source of protein.

The city is governed by a council of guilds and the powerful church. The church also runs the guard of the city who keep the peace and defend the city from creatures which occasionally rise from the depths or crawl out of the mines. However all is not right with Insel.

Lorenzo’s Tale is a short bit of fiction that I wrote to help solidify some of the concepts of the world. I hope you enjoy it.

“Lorenzo’s Tale”

Lorenzo squinted into the night sky as his coracle gently bobbed on the ocean. With just a stretch of his imagination he could make out The Winged Horse raring up to crush The Serpent, the stars of the constellations seemed weak and ill. Grandfather used to recount tales of a night sky filled with hundreds of stars that shone so bright you didn’t need a lantern to walk around at night! That must have been quite a sight, Lorenzo though to himself.

Shaking himself out of his reverie, Lorenzo checked his lines and nervously cast his eye across the small fleet of fishing coracles bobbing around him. The stars aren’t the only things to be disappearing he thought, the sea should be teeming with Shrike on their annual mating run but this year they seem to have completely disappeared.

In desperation, the fishing fleet had been forced to move further and further away from Insel and it’s protective shallows. Going this far out was mad, a shiver ran up Lorenzo’s spine. He lied to himself, pretending it was just from the cool night air and not the dull fear trying to claw its way out of his gut. Perhaps he should have listened to Mora and not gone out with the fleet tonight but the fish were critically important to the city. So important in fact that Guild Master Arvo came down to the docks with Demi-Bishop Ragner to see the fleet off. The Demi-Bishop’s sermon was riveting, his blessing comforting and Lorenzo had cast off in high spirits.

“Lorenzo,” a voice called across the waters. Lorenzo turned to see Zefron hailing him from a nearby coracle, “you catch anything?”. Lorenzo shook his head and shouted back “Nothing! How about you?”

“I…” yelled Zefron. A massive tentacle smashed into Zefron’s boat, a second grabbed Zefron, raising him up into the air and then slamming him violently into the surface, before pulling him under.

“Sweet Mother Mary!” Lorenzo gasped as he stood stunned, watching the wreckage of Zefron’s coracle. Panic took hold and he started to scream “Leviathan, Leviathan…”. Confused shouts and then frantic screams erupted throughout the fleet.

Lorenzo grabbed the crank handle of his coracle’s motor and started to crank for all his worth. The flywheel painfully spun up to speed, the gears meshed and his boat started to slowly move, building up speed. He turned it towards Insel and safety. ”Sweet Mother Mary” he prayed “please let me see Mora’s face again. Please, please please..”

Behind him the catch lights of the fleet winked out one by one and the screams died away.

H is for Hosted network

Windows 7 and above has a neat feature called hosted networking. This allows you to turn your laptop into a wireless access point. This is very useful if you want to share your laptop’s Internet connection with other wireless devices or (the reason I use it) for testing.

To set up a network open a command prompt and run the following commands

netsh wlan set hostednetwork mode=allow ssid=”GremlinsTestAP” key=”Pa$$w0rd”
netsh wlan start hostednetwork

This will create a wireless access point named GremlinsTestAP with a password of Pa$$w0rd

To shutdown the network run

netsh wlan stop hostednetwork

More detailed info can be found here:

G is for Games I own

The last decade has seen a renaissance in board gaming. The Internet and crowd funding platforms such as Kickstarter have made it particularly easy to publish a game and 1000s of new games are released each year.

For this post I thought I’d go over my collection and talk about the games I own.

BSG box artBattlestar Galactica

This game is based on the recent TV series. The players are the humans trying to escape the Cylons. Unfortunately a few of the players are secretly Cylon agents trying to derail the other players. My gaming group never really got into this one. I suspect it is because we know each other too well and can tell who the Cylons are right from the start.

 

Descent

Descent box art

****Descent is an awesome board game. The bulk of the players are adventures working their way through a dungeon, one of the players gets to be the Overlord and it’s their job to stop the players. The board consists of interlocking tiles that form the map of the dungeon. Miniatures are used to represent the location of the players and the monsters on the board. With treasure, traps, equipment upgrades and magic, Descent is basically a RPG dungeon crawl in board game format. I own the first edition of the game and a typical game can take 3 to 4 hrs to complete. The second edition has much more streamlined rules and apparently only takes an hour or so to complete.

 

Evil Baby Orphanage Box Art

Evil baby orphanage

This is a casual card game. The premise is that each player is a Time Nanny whose job it is to grab famously evil people when they where babies and place them into time orphanages before they can do harm. Each baby has a mischief value and the first player to START their turn with 8 mischief points wins. This is harder then it sounds as the other players are actively stealing your babies or activating their bad behaviors causing all sorts of mayhem. This is a fun and quick game with a great theme. A game takes between 15 and 30 minutes to finish.

 

Hex Hex XL

Hex Hex XL box artThis is another card game. This time you are bored wizards bouncing a spell (hex) between each other. If a wizard is unable to pass on a hex, it triggers, causing the wizard to lose points and the wizard who passed them the hex to gain points. The game ends after each wizard has had a chance to cast the first hex and the player with the most points wins. This game gets pretty hectic as cards can cause hexes to duplicate, be forced to only travel in certain directions and do more damage. Game length is  about 30 minutes depending on the number of players.

 

Lords of Waterdeep box artLords of Waterdeep

In this game you play one of the secret Lords of the fantasy city of Waterdeep. The goal is to accumulate the most victory points in 8 turns. The primary way to earn points is to complete quests. To complete quests you need to gather together clerics, wizards, rouges, warriors and gold using your agents which you place at various points at the board. Additionally each lord has a number of types of quests which are their forte, finishing these earn extra victory points at the end. As well as blocking access to resources using your agents, you can also hinder the other players by playing intrigue cards. Whilst the game sounds and looks complicated it’s actually very straight forward and easy to learn. It’s fun to play but has quite a bit of depth to it. Game length is about 1.5 hours.

 

Munchkin

Munchkin box artMunchkin is an older card game but still a great game. The players are heroes delving through a dungeon, collecting  treasure and fighting monsters. The first player to reach 10 levels of experience wins. Levels are gained (or lost) by fighting monsters. Other players can aid or interfere with another player’s actions. This is definitely a “screw-your-friends” type of game so you really want to play with people who can handle that. The cartoon art on the cards is fantastic, full of geeky RPG references. A game typically takes about 45 minutes to play but it can drag on if players are being silly.

 

Pandemic box artPandemic

Pandemic is a very interesting board game as it is a cooperative game,  it’s players vs the board. Basically the players need to move around a map of the world, fighting the spread of 4 pandemics, trying to cure each one before the world is overwhelmed. The mechanics of the games are such that as play progresses things become more and more dire which really ramps up the stress levels. Each player gets a number of actions they can perform as well as a specialist role which gives them some kind of extra ability. The players really need to work together and plan ahead to win. I really enjoy this game but several in my gaming group find it very stressful, particularly when you dial up the difficulty of the game. It takes about an hour to play the game.

 

Settlers of Catan

Settlers of Catan box artOne of the most successful of the modern boardgames having sold over 18 million copies. Settlers sees players trying to get to 10 points first. Points are awarded for each city and town a player owns. These are placed at the corner of hex tiles that generate the player either wood, ore, sheep or brick resource cards. These cards are used (in different combinations) to build roads, build towns or upgrade towns to cities. The game also allows players to trade resource cards.  There is no direct player conflict in the game but you can cut off other player’s access to the resources they need, hold trade embargoes and set  The Robber on them to steal their resources. This game is very good with simple, elegant mechanics. If you were looking to get a game that will appeal to a wide group, get this one.

 

Small World box artSmall World

A first glance Smallworld looks likes Risk with a fantasy theme but it’s much more then that. Each player draws a race and a power from a deck. This gives the player a number of units to grab and hold areas of the map. Each area of the map held at the end of the player’s gives them a victory point. Additionally each power and race gives the play additional abilities or ways to earn bonus points. For instance if a player drew Humans as their race they would get an extra victory point for each field area of the map they hold (they like to farm). If that player also drew Flying as their power they would be to able to place units in any area of the board, rather then areas adjacent to their current ones (which is the standard rule).

An interesting aspect of the game is that a player can put their current race into decline, skip a turn and pick a new one. This is needed because your units slowly get whittled down by other player’s attacks to the point where  you cannot hold enough areas to earn any decent amount of victory points on your turn. When to go into decline can be crucial to winning the game. Because the combination of power and race are randomized, replayability of the game is high. For instance you might have Commando Elves one game and Peace Loving Elves the next which radically effects how you play with them. The game comes with a number of different boards and the one you use depends on the number of players you are playing with. The number of players also determines the number of rounds that are played before victory points are tallied.  This is great game with easy rules which,  typically takes about an 1 hour to play._

_

Hopefully this post has wet your appetite. If you are looking to get started I’d suggest grabbing a copy of Settlers Of Catan or Small World to start.