Category Archives: Programming

Angular 2 version 2-1-1 PhpStorm/Webstorm Typescript compile error

Making the jump to Angular 2 version 2.1.1 is pretty straight forward, all was fine when testing the quickstart using the npm lite server, went to run it in PhpStorm/Webstorm and got so many errors:

Error:(46, 34) TS2304: Cannot find name 'Set'.
Error:(44, 38) TS2304: Cannot find name 'Promise'.
Error:(24, 15) TS2304: Cannot find name 'Map'.

Like most things this is an easy fix, this one is caused by an out dated Typescript compiler which some lazy Google Fu brought to my attention see here.

Install type script compiler using npm

npm install -g typescript 

When you run the above command it will tell you the path it has downloaded to, for example:


Then set PhpStorm/Webstorm to use the compiler.

I mainly threw this in a post to note that the tsc files have been moved to the “lib” folder, you will need to link to that rather than “bin”.

File>Settings>Language & Frameworks>Typescript

Set typescript version to the path we created and save, if your not sure where it went run the npm command again.


All done! you should be fine to compile Angular 2.1.1 now.

Angular version: 2.1.1

Typescript version: 2.0.8

Previous Typescript version: 1.8.10



Up next 2016

At the end of 2015 I pondered my 10 year career in 3D and realised not only was I content with everything I’ve done; it was time to move on and push for something new.

After 5 years both student and teacher at AIE plus another 5 years doing 3D architectural visualization I was ready for something new.

Throughout my 3D career I had always coded, whether it was learning web languages to complement the jobs I could take on as a 3D freelancer or out of personal interest in how to script within Maya using Python it’s always been a thing I would dabble in. During my time at AIE I also unofficially  completed the Advanced Diploma in programming, my fellow staff members often going out of their way to guide me through it.

This pushed me into a world of programming I was a newcomer to and gave me an appreciation for low level languages such as c++.

You learn to appreciate what something like a game engine does for you when you try and draw a line in c++…

You can see the projects on git hub here and here

With a the new goal in mind and plenty of experience to work from I left AIE to pursue a new career in programming and development.

That was in Feb 2016, since then things have progressed nicely with interesting projects coming along that have required new languages and frameworks to be used.

Practical Programming

I used to do IT work, I printed some flyers and would fix computers. Fixing computers for the average home user isn’t so hard when you have the know how.

Knowing this it annoys me when I see people’s lives made difficult by what should be a service that supports and informs. When  asked to restore a backup from an external drive to a new laptop for an older friend I thought “sure this will take ten minutes”…. you see where this is going.

The IT technician had used the default backup software that comes with the hard drive. I have a dislike of these packaged software as I often think of them as “bloatware”, if I want something on a hard drive i’ll put it there. Putting that aside though I installed the software and went to the recovery options, uh oh… no backups detected.

I tried all the standard things, updating software and praying to various deities. No luck, it looked like the backup wasn’t being read due a windows permission error, or something. The software has a single task and failed I wasn’t wasting more time working out why it didn’t do the thing it was meant to.

Time to get our hands dirty and do some practical programming.

The backup files where stored in a simple .zip thats a plus. They where also in hundreds of individual .zips, that’s a minus.

With the files sitting there in zips I decided a two pronged approach could rebuild the backup.

Batch unzip

Firstly the zips needed to be taken care of, with so many zipped files a batch file was in order. I found a suitable one through the google machine:

FOR /D /r %%F in ("*") DO (
    pushd %CD%
    cd %%F
        FOR %%X in (*.rar *.zip) DO (
            "C:\Program Files (x86)\7-Zip\7z.exe" x "%%X"

This gem unzips everything below the directory it runs in.

Python folder structure rebuild

With the folder unzipped the last thing was to rebuild the original folder structure.

I try not to do anything destructive in any workflow, so the goal was to rebuild the structure and copy the files into it.

For this I used python, this is a single use high end script making other options overkill.

I ran into some issues with os.listdir() throwing errors, since this is a once shot use I just threw it all into a try/catch and left it alone. It was only the odd uneeded system file that this happened for.

Throw in some recursive goodness and we have a functioning script!

import os
import shutil

dest = "D:/restore";

pathToMerge = "D:/folder/moreFolder/Backup Set yyy-mm-dd timetime";

fileFinder recursively digs down to each file within a directory, building and
copying to the new one as it goes
def fileFinder(path):
            dirList = os.listdir(path) #due to system files this can fail

            for x in range(0, len(dirList)):
                oldPath = os.path.join(path, dirList[x])
                    fileFinder(oldPath) #if we find a folder drill down recursively
                    #split the drive path at the correct junction
                    splObj = oldPath.split("\\C\\")

                    #create restored file path
                    newObj = os.path.join(dest, splObj[1])

                    #create folder path to allow os.makedirs()
                    subpath = path.split("\\C\\")
                    newFolder = os.path.join(dest, subpath[1])

                    #create folder if needed
                    if not os.path.exists(newFolder):

                    #notify the user and copy the folder
                    #note that so many print statements can slow things down, but I link the feedback
                    print("copying file: " + newObj)
                    shutil.copy2(oldPath, newObj)

            #print("found an error, ignoring that sucka: " + path)

        print("path does not exist")

drill down to the top level backup within each folder and call the file finder
for basePath in os.listdir(pathToMerge):
    newPath = os.path.join(pathToMerge, basePath )
    for copyPath in os.listdir(newPath):
        if(copyPath == "C"):
            src = os.path.join(newPath, copyPath)

And boom, rebuilt structure.

Practical programming

Being able to create these little scripts is a fantastic ability that any computer user would benefit from.

For a lot of people though this just isn’t a practical option. The importance of  decent IT technicians cannot be overstated!

Game AI – C++ Graphs and Pathfinding

This was an assignment I had been looking forward to, It was time to learn about AI! Unfortunately it was less like the matrix and more like complex Ideas and plenty of looping through lists.

You can download and view the final here

New concepts included:

  • Graphs
  • Nodes
  • Path finding algorithms and their implementation

Learning about these path finding algorithms was fascinating, how they differ and how they can be implemented for game mechanics.

Alongside the implementation of these algorithms was the structure of the program itself, I learnt a lot about modular design in the way classes are structured.

Presentation is key

Agents finding a path between selected nodes

Writing on the wall

I wanted a nice UI to give information to the user, this required a font library to be installed. While I respect the power of C++ having to spend a chunk of time to do something as simple as display text is never going to be fun.

Drawing the line

Another feature that I often take for granted is drawing lines… if you want anything above a single pixel line. Say a nice thick line with a subtle fall of gradient,  you have to go and create that yourself, enjoy!

Math Library

This project used my own math library from previous projects, after using almost every over a few projects it’s pretty solid. (Building my own allowed me to approach Monogames matrice library with confidence in a later project)

Debug lines

For both this and the previous projects I have learnt that debug lines and debug images are so very helpful, I had debug circles around every agent, and lines showing there intended direction. This kind of visual debugging allowed me to hone in obviously bad behavior.

As with all my learning projects A big thank you to all my Mentors, you know who you are.

Mouse Hunter – C++ Console Game

Woah now, what did mice ever do to us? and why make a game about hunting them?

Depending on their fighting ability

Depends on their fighting ability image from:

I’m happy to say that learning c++ is coming along nicely and will continue to. It’s no small thing for someone to say “I know all of c++”.

Pointers, references, lists and iterators, I’ve had the pleasure of using them all and more so far.

I am getting what I want from learning c++. A deeper understanding of programming for creating full blown applications and games and knowing how to approach the structure of these applications, classes and headers… Lots of them.

Base game play (straight from the tutorial)

The player can shoot fireballs at “evil monkeys”, these evil monkeys hunt the player relentlessly. This tutorial from 3D buzz was recommended to my by a colleague and mentor.

After working through it I can see why. It’s solid learning material.

New game play (It’s mouse hunting time)

Doing tutorials are great, Do them, do lots of them. But don’t’ “just” do them. Take the knowledge you have gained doing a tutorial and apply that to create something new and your own.

My own version has the following additions to the game you have on completing the tutorial:

  1. Game states (splash, win, lose, game)
  2. Mice
  3. Leader board that loads from disk
  4. modified player
  5. Game mode
Mouse hunter splash screen

Mouse hunter splash screen

The gameplay is based around either defeating the mice or collecting the cheese before they do. Once a mouse has cheese they cannot be hurt.

The player loses lives every time a mouse gets cheese, pretty simple!

Hunt mice, collect cheese!

Hunt mice, collect cheese!

And you can play this cheese eating, mouse hunting fun here

If you happen to play it and find any bugs or feedback i’d love to hear it, although it definitely has some balance issues.

Learning resources

3Dbuzz tutorial – This tutorial stands the test of time, it’s still a fantastic intro to programming in 2014 and I recommend it to anyone wanting a friendly introduction to c++ with a focus on games development.

The Academy of Interactive Entertainment – As staff at AIE I have access to the programming curriculum, all the lectures etc. This has been great to see how an introduction to programming has been structured.



image from:

I’m in a pretty lucky position, I’ve got three mentors available who love it when I corner them with coding roadblocks. I find I am able to move quickly when I bring my roadblocks  to a mentor, whether in person or online.

The main thing you get from a mentor is feedback and the mind expanding experience of approaching a problem from a different angle. Pen and paper often comes into play as we work our way through each new obstacle.

It also good to have people with experience guiding you through program construction, why things are done a certain way and what the repercussions might be if that certain way isn’t followed.

Everybody should seek feedback from their peers and people with experience who can provide constructive feedback.

Extending the game play (resources)


The only additional resource needed to create my version of the game was SQLite to allow database use. I’ve done plenty of web dev but this was my first c++ Library I installed purely from the documentation.

SQLite database

Working with a c++ library for the first time was an experience in itself, it assumes you know your way around Visual studio and know how to get a library going… I did not.

After stumbling around with code implementations I can safely say that the “five minutes or less” introduction tutorial took me significantly longer. As soon as the database was up and running though, awesome! I got it working all by myself, taking a few baby steps out from under my mentors wings.


Errors, simple not complex – Part One

Programming, it’s a complex beast. While I haven’t talked much about my current studies in C++ you can safely assume I’m knew to the language and it’s intricacies.

The current assessment i’m working on requires an SQL database. All well and good I think to myself. I’ve done plenty of PHP and MySQL web dev.This will be a breeze.

That's pretty breezy

That’s pretty breezy image from:

I knew I needed to use SQLite as defined by the assessment. So I need a library or something? Heading over to has everything you need to get going.

So, I added the .h and .c files through the right click “Add existing item” menu. Then i’m presented with the below error.

Cannot open source file

Cannot open include file

Looks can be scary

Looks can be scary

What is going on? I start looking deeper, maybe there is more involved to getting this going than I first thought.

I spent hours over two days looking for a solution, I tried building libraries including everything and altering so many settings of the project. Pro tip: do not alter settings because you feel like a good tweaking can fix everything, it doesn’t.

The solution

Copy the .h and .c files into my visual studio project.

I twigged that I might be barking up the wrong tree when I read the following.

stack overflow solution

I love you stack overflow

The solution explorer doesn’t show if stuff is usable! how helpful, knowing that I brought the files into the project and re-added them. Including the header no longer broke stuff. Progress!

Take it from me

So many times I have been caught out by this. The error is not cryptic at all, Visual Studio has no idea that i’m not going to link to the assets through one of the many methods it has for this.

So it told me it has no idea where to actually open the files, only that it knows I want them open. I feel you Visual studio and i’m sorry I didn’t understand.

Let’s not assume

I’m used to using 3D applications, for the most part these applications allow you to drag and drop assets into a content/project manager where they will either:

  • Import the asset into the project

Easy for asset management, common in game engines

  • Create a link/reference to the assets location and load it from there

Forces you to manage your assets wisely or rue the day you laughed as you linked assets from several different hard drives.

I assumed that by showing the files in the project solution VS could use them, this turns out to not be the case.

No I do not want to add includes to the project to work around this or setup a central place to include from. That’s for future me.

As with all lessons it’s well learned, learning them faster would be nice though.

Custom timeline control – Pyside – Maya 2014+

Recently a work colleague approached me with a request for a custom feature in Maya.

The request was for a custom tool that replicated the Maya timeline and it’s tools in a torn off window.

The colleague has a thing for large windows when animating, they enjoy a very custom setup.

So useful

If it’s useful to one person others may find it helpful as well

Tools that are going to be used are the best kind to make.

This is written entirely for Pyside, using a method for controlling Maya elements using pointers shown to me by Malcom.

As it’s written for pyside/Maya 2014+ you need not install anything to use it.

The timeline

As I looked a little deeper into this I came across this with the timeline:

From the Maya docs here

Note: only one timeControl may be created. The one Maya creates on startup can be accessed from the global string variable $gPlayBackSlider. Also, it is not a good idea to delete it.

So there can be only one, and yes I deleted it a few times. You do not want that, it does not come back.

So this tool rips the timeline from Maya and re parents it into the QT window, Holding a reference to the location it came from.

It then puts the timeline back on the close event of the QT window.

Range control

Creating the range control is straight forward as there can be more than one of these see here.

Other features

The tool will store the position and size of the window when the window is closed. It will then restore to this location/dimensions on next use.

There other elements are all QT.


The script can be downloaded here

Installation and use

  1. Unzip and copy the to “timelineCtrl” folder to maya script folder for example:
  2. C:\Users\YourName\Documents\maya\scripts
  3. run Maya, open script editor (Python window) and type in:
  4. import timelineCtrl

The import and timeline control lines can also be saved off to the shelf for easy use.

And boom, tool is good to go.

Alternate use method

If you have a thing for not installing scripts you can do the following:

  1. Copy the contents of “”
  2. Paste this into a python script editor window
  3. Run the code

Note: The refreshing of the states in the torn of window currently do not update as well as they could.

Tested on windows only, will note work with pre-Maya 2014 as Pyside is not part of the standard install.