Programming is probably one of the most important subjects that educators have identified as part of STEM that we need to encourage kids to get interested in at an early age. Almost everything in our daily lives is programmed in some fashion. Your car might have EFI (Electronic Fuel Injection) controlled by a computer, your washing machine might have a computer controlling cycles & timers to the smart card that you use during your daily commute.

Someone, somewhere programmed that device you’re using… right now. So the importance of programming is now beginning to dawn on people everywhere all over the globe as we get more integrated Internet of Things spamming us with whatever it is they’re doing – brewing coffee?

So how do we get kids into programming? Lets take a step back, how did I get into programming?

I can remember my first programming language that I learned to use as a kid.

BASIC written for the VTech PRECOMPUTER 1000.

Now I’m showing my age, this thing is now classed as VINTAGE! Way to make me feel old.

It was HORRIBLE! It had a book with 3 or 4 BASIC word games such as Hang Man, Hello World, etc. You had to type each line painstakingly line by line following the instructions in the book. If you made a typo you would spend up to an hour looking for it. I can’t imagine how many kids of 13 would simply give up and consider it “too hard” or “too labor intensive” and instead go and play Sega.

Take a minute to watch the video below, SCRATCH in a single word is AWESOME!

A simple programming language where you drag logic blocks to form programming statements to make games, animations, sounds or anything you like.

I’ve been a coder-dojo mentor for a couple of years now, it’s a fantastic way to spend a weekend teaching kids to code. If your child can read and can perform basic logic they can learn to code. One of the best ways by far in teaching kids how to code is to get them to do something they love doing, play games.

If they can play games and learn something at the same time they will be motivated and more involved in the outcome. It’s simple, easy to understand and best of all it runs in your browser. If you’re looking for a iPad or Android version, fret not there is ScratchJr

I’ve developed a few resources for the kids to take an existing working game and to modify it to make it their own.
Feel free to make remixes of these and see what your kids can do with them.

It’s almost 2016 and virtual reality is almost a thing. While we’re all waiting for the production version of the Occulus Rift, we have a pretty suitable substitute sitting in our pockets right here right now. And the best part yet, we can already use this to play Occulus Rift Compatible VR Games, and it’s dirt cheap ($12 for Google Cardboard on ebay) and the Smartphone you already have. People are calling it the “Occulus Thrift”.

Smartphone

Choosing a smartphone for Virtual Reality consists primarily about pixel density. When viewing the phone though lenses you can get what’s called a “screen door” effect where you can see the individual pixels as if looking through your virtual world through a screen door. Using a high pixel density phone means far less noticeable screen door effect and higher resolution images.

Samsung have based their new Gear VR Headsets around the Samsung Galaxy S6 and S6 Edge smartphones, if you’re interested in getting a new phone, I recommend going for one of those as it both meets the computing and pixel density it’s also compatible with the Gear VR headset so you can upgrade your DIY VR Headset.

However any smartphone with a decent pixel density should work (android, windows or apple).

Left: Photo of my old S3 using my new S6. I saw plenty of pixels on this old beast, the new S6 is way better and easier on the eyes.

Personal Computer

To get the most out of your VR experience I recommend that you have a decent gaming rig. If you can play your favourite FPS games at a good framerate at a nice resolution this should translate to a nice VR experience. In addition to a PC you’re going to need decent a WiFi network in order to stream your desktop onto your phone.

Recommended Specs:

NVIDIA GTX 970 / AMD 290 equivalent or greater

Intel i5-4590 equivalent or greater

8GB+ RAM

Windows 7 SP1 or newer

Additional Specs for Occulus Rift:

Compatible HDMI 1.3 video output

2x USB 3.0 ports

Getting Started

Once you’ve collected everything you need to start see Things you’ll need. For this tutorial we’ll start with Mirrors Edge as it’s a well known VR Supported game.

To start you’ll need to have installed the Vireio Perception drivers and follow the instructions located here. Run the Vireio Perception App. Select DIY Rift, No Tracking and [your monitor].

Note: that you’ll only need to run the DLL install utility of the Vireio App does not inject the VR drivers when running.

You should end up with something like the above. Which is great, however that doesn’t get it streaming to our Smartphone. Close down mirrors edge, now we know its working we can move onto the next step.

Streaming Games to your Mobile

Kino Console is a (free) awesome game streaming app for Android, iOS and Windows Phone. I’ve been using it for a while and it’s brilliant. Kino console is a remote desktop app which streams both video and sound to your phone or tablet of choice. This means that you can play Diablo III on you iPad in your living room being streamed over your WiFi with almost unnoticable lag, I do notice that the audio lags however playing VR Games I use my PC’s headset. I’m told the Pro version has better network code for better Lag free video streaming.

Here’s a demo streaming Bioshock Infinite to my now antiquated Nexus 7, the sound you’re hearing is streaming though the nexus. You can see that it has very acceptable lag, I wouldn’t go playing Battlefield 3 though it, but for playing most non network FPS it’s pretty acceptable.

To setup Kino Console, follow the setup instructions posted on their website for your smartphone of choice.

Head Tracking

To have a truly immersive VR experience you need to have some form of head tracking. I won’t get into all of the different types of head tracking, however I will go into detail about the one that I use which simply takes over the Mouse Movement using your Mobile Phones built in I.M.U. or Inertial Measurement Unit.

At the time of writing FreePIE is only compatible with Windows PC’s and Android Phones. Download and install the Program from the website. The application will have an .exe and also an .apk to install on your Android device. Note you will need to allow “Out of Market” apps to be installed in order to run FreeIMU on your device.

You’ll want to copy the code above into Notepad or your favourite editor and save it somewhere. Open up your saved script inside FreePie, click Script Run Script from the Free PIE Menu above.

Open Free PIE on your Android Device and enter in the IP address of your PC.

Click “ON”, now you’ll notice that nothings happening.

If you read the python script carefully at the end, it’s set so that by default it’s not active until you hit the “M” key on the keyboard. Pressing “M” now should show you the mouse moving around your screen according to your phones landscape mode orientation.

If you hit the home button on your android device, the IMU will continue running as a background process until you stop it and close the App.

Putting it all together

Putting it all together now requires the following process.

Start up Free PIE

Connect the Free PIE Android APP

Ensure that both are running and collecting data (click the “watch” tab in the FreePIE Console).

Open the Vireio Perception App (if you didn’t install the driver via the isntructions)

I’ve owned a 3D printer for about 2 years now, and I can say it’s one of the best nerd gifts that I’ve ever given myself. I’ve made dozens of things on it, some useful most of them not so useful, some of them downright fun. I chose to build my 3D printer from a Kit as opposed to buying a premade one.

The primary reason that I chose to build vs buy were pretty clear 2 years ago, the cost and availability in Australia were prohibitively expensive to buy a commercial desktop 3D printer. Today however prices have come down to less than what I purchased my kit 2 years ago, so price is no longer the deciding factor.

Today the deciding factor for me has changed to:

Do you want to build, tinker, increase your knowledge / Do you just want to use it like an appliance?

There’s no right answer here really, it’s up to the individual on what they intend to get out of owning a 3D Printer.

Building

Pros:

Cheaper than most professional grade desktop 3D printers

If something breaks (and it will), you know how to fix it (after all you built it).

Cases are generally very high quality and includes enclosures so you don’t breath in any fumes from the printing process (if you go ABS)

In General based from newer iterations of the reprap printers which avoids harmonic resonance and so can print faster

Cons:

More expensive than building or buying from a Kit

Locked into the manufacturers software

Locked into the manufacturers filament (can be more expensive than custom filament)

My Recommendation

If I were to do it over again today, I would probably still build (an i3 vs an i2 model Reprap Prusa), however to my friends and people I meet who are not hackers and tinkerers I highly recommend buying a desktop 3D printer. For similar price to buying a kit, you get a well tuned, calibrated desktop printer where you can plug it in and get reliable high quality prints day after day.

Just be aware that different commercial printers can have a small build volume. Price & build volume should be key indicators for choosing your next desktop printer.

You might be thinking, wow the Makerbot Replicator is so much more expensive than the rest. Makerbot is one of the original companies behind the desktop 3D printer industries we have today with their cupcake CNC (no longer available). Their software and printers are one of the best in the industry with years of improvements behind them. If you want a reliable printer with huge support and high quality filaments, wifi management, etc then the $5100 price tag is understandable.

For beginners who are looking for a Sub $1000 desktop 3D printer, I highly recommend the Davinci for $500. It’s got good quality prints and a great build volume for printing out large parts for your next project.

However if you’re a hacker, tinkerer or builder, I highly recommend that you build one from a kit or source the parts yourself. The experience that you get by interfacing all of the different components and building will make you a better builder with a more in-depth understanding of mechanical engineering, physics behind fused filament extrusion and many more things. I’ll be expanding on what I’ve learned in future posts. So keep your eyes peeled for more information.

Developing a mobile application these days is an arduous task. You need to have a mobile app to get your business noticed and to gain market share with your audience, however which platform do you choose? Apple? Android? Windows Phone?

Cost of developing a mobile app is one of the biggest hurdles besides the choice of platform. To get an application developed natively in two of the three major mobile operating systems immediately doubles the cost of development.

Each mobile operating system is designed around development in a specific programming language and development environment.

3 different operating systems, 3 separate languages and development environments, and counting. To be able to cater to all of these operating systems natively, mobile app developers need to have someone able to be an expert in each of these programming languages and also be an expert in the nuances of how each mobile operating system works. Task lifecycles, multi-threading, memory limitations, garbage collection, etc.

Thus to have 1 app developed in its native language and environment will take 3 times as long. Thus tripling the cost of development.

Cost of Maintenance

Any code written for any one of these is incompatible with the other and needs to be completely rewritten in the native language and development environment so that it’ll work for the target platform.

Because of that there will be subtle differences in the code base for each platform, so any future modifications to the app will require 3 separate changes, one for each language and platform, thus also tripling the long term cost of maintenance.

There is a solution to this dilemma, it’s not a silver bullet, however for most applications cross platform development may be a viable alternative.

Cross Platform Development

One solution to bring costs down is cross-platform development. Until such time as everyone settles on a specific platform for all mobile phones and tablet devices this will continue to be a huge time and cost saver for people interested in getting a mobile app developed for multiple platforms.

There’s essentially 2 approaches that cross-platform framework developers have taken to solve this particular problem.

Web app wrapped as a native app, such as Adobe PhoneGap/Cordova

Cross platform tool that creates native apps, such as Xamarin Studio

Mature Frameworks

Both Xamarin and PhoneGap are fairly mature cross-platform development frameworks. Xamarin – Mono project has been worked on and actively developed against since 2001. PhoneGap is less mature than Mono being first developed in 2009, however the concepts behind HTML5 and JavaScript have been around much longer.

PhoneGap

The purpose of PhoneGap is to allow HTML-based web applications to be deployed and installed as native applications. PhoneGap web applications are wrapped in a native application shell, and can be installed via the native app stores for multiple platforms.

Hybrid App

PhoneGap is really a hybrid development platform, neither being truly native, nor purely web-based. All layout and rendering is done via the Web View.

PhoneGap strives to provide a common API set which is typically unavailable to web applications, such as basic camera access, device contacts, and sensors not already exposed in the browser.

To develop PhoneGap applications, developers will create HTML, CSS, and JavaScript files in a local directory, much like developing a static website. Extending the capabilities of PhoneGap is via the use of plugins for each supported platform. Plugins are written in each platforms native language and development environment.

If there isn’t a plugin that does what you’d like to do with your device already, you’ll need to revert back to writing native code for each supported platform. As of writing there are a huge number of open sourced plugins available from the phonegap.com website ranging from Near Field Communication to Instagram and Facebook integration.

OpenSource (Extending and developing plugins or modifying is easy and accessible)

Support Packages Available for Developers

Developed by Nirobe (ex Novell developers and purchased and supported by Adobe).

Free (Open Source)

Xamarin

Xamarin has brought to market its own IDE and snap-in for Visual Studio. The underlying premise of Mono is to create disparate mobile applications using C# while maintaining native UI development strategies.

Essentially this means that you’ll need to have a developer familiar with the User Interface for each platform, which is not ideal however the compromise that they’ve decided to go down has to do with Native look and feel and responsiveness.

Unlike PhoneGap, writing native UI does not have the same limitations placed on it that Web Applications do for real time performance and UI updates. Xamarin studio has abstracted tools for creating the Native UI for each of the target platforms so developers do not need to buy or open separate IDE’s

Xamarin Architecture

In addition to creating a visual design platform to develop native applications, they have integrated testing suites, incorporated native library support and a Nuget style component store. Recently they provided iOS visual design through their IDE freeing the developer from requiring to open XCode.

Xamarin has provided a rich Android visual design experience based from work done previously by the eclipse project. The major advantage and what is truly amazing is the ability to use LINQ to work with collections as well as create custom delegates and events that free developers from objective-C and Java limitations.

Many libraries (not all) work perfectly in all three environments.

There are several advantages of using Xamarin including

Near native performance

100% platform API coverage

C# goodness – LINQ, async\await, TPL

Code reuse (average 75% code sharing)

Testability

Shared code between client and server

Support

Scan your code for conformance scan.xamarin.com

Comparison – Xamarin vs PhoneGap vs Native

Looking at the above table it’s fairly clear that the winner is cross-platform development when compared to native development. However what’s less clear is the distinction between Xamarin and PhoneGap.

Being able to choose between these two platforms will depend on the particular application that is being developed.

Reasons to choose PhoneGap over Xamarin

Application lends itself natively to being a web-app (Reduce UI cost)

Cheaper to develop UI per platform

Plugins already available for needed features or plugin development is minimal

Reasons to choose Xamarin over PhoneGap

Legacy C# application code (code sharing)

Requires Native Performance for the UI

No need for plugin development for On Device Processing

Cross UI development with MVVM cross (allows for common UI code to be shared)

That’s not really a large list, I’ve used both of these products and in my humble opinion, these two products are very comparable. Xamarin lends itself more towards cross platform development between C# applications and shared code for projects. Whereas PhoneGap lends itself to be more suitable for “web apps” on mobile with some device capabilities (camera, sms, phone, etc).

No Clear Winner for Small Projects – Xamarin vs PhoneGap

There’s no clear winner in capability between PhoneGap and Xamarin (each of them are both extensible) and each development platform has its advantages and disadvantages for a specific App (cost of development being the most pertinent). Each platform will need to be evaluated over the lifetime of the App to determine which version will provide the best cost savings for development going forwards. This is especially true for small projects or projects that little business logic outside of what is available to PhoneGaps’ existing Plugin Library, then these two frameworks fight on equal footing. However…

Xamarin – The Clear winner for Larger / More Complex Projects

I will say for larger projects Xamarin has a clear advantage over PhoneGap. Harnessing the power of C# and wrapping all native iOS and Android Libraries gives Xamarin ability to scale horizontally (in team size) due to a common language being used, and Vertically by harnessing Strong Typing means that over the course of your project lifetime developers can quickly and easily make changes and improvements to your application. Additionally there are a multitude of pre-existing libraries which are available to help boot-strap any project which with a little work can be refactored to use the PCL core libraries required to get these working under Mono.Android / Mono.Touch.

This tutorial is going to assume that you already have the latest version of Umbraco CMS setup and installed. If not feel free to download and setup the latest version from umbraco.com/download, and the best part is that it’s free and open source.

If you’re unfamiliar with Umbraco CMS and are following along with this tutorial for the first time you can you read their easy-to-follow installation instructions directly from their website.

As part of this tutorial I’ve downloaded and setup a new blog using the blog umbraco skins package, feel free to setup and install any one of these for your first site. I’m going to modify this slightly for my default domain later on.

To demonstrate a multi-site configuration with umbraco, I’m going to use the following website domains on my local machine.

blog.mammothmedia.com.au

business.mammothmedia.com.au

I’m not going to go into details on how to do this since there are plenty of instructions available on the web. You’ll also need to setup IIS to point the new domains to your Umbraco installation, note that this is to the SAME umbraco installation. Umbraco can handle multiple hostnames, we’re going to show you how.

Create some templates

The first item on the agenda is to create some alternative templates so we can tell the difference between our two sites.

I’ve created some new templates called Business, and renamed the default templates to Blog. This way I can tell the two apart when I setup the content later.

Add new allowed templates to the current document types

Since I’m going to be re-using the same document types for my 2 examples, we’ll need to add the new templates to the allowed structure of the existing document types.

I prefixed my new templates with Business in front so I can tell which ones are going to use the business template.

Create some content

We’re going to separate our content in the Content tree by domain name.

If we right click on the new root domain folder and select “Culture and Hostnames” from the menu

From there we add the associated domain name to the content and we’re done from the Umbraco side.

You’ll have to do this explicitly for each domain.

Set the template for your documents

Business is going to be using the non-default templates which also uses a different style sheet. So I’ll need to set the template in the documents properties.

Make sure that you do the same for any document which has a different template.

Also don’t forget to save.

Test it out

The final step is to test it out. If I point my browser to blog.mammothmedia.com.au and I get the following website.

And for business.mammothmedia.com.au

There you have it

Quite often there are a number of heavy items that are loaded on a web page which is located below the fold. These items such as flash movies located at the bottom of a page, or in some instances facebook activity feeds which are located below the fold, simply add to a pages load and response time.

This is especially true for website landing pages where users more often than not are only interested in clicking through to some feature article located above the fold.

Here is a “mini” javascript library which will allow you to lazy load these items below the fold when a user first scrolls down the page. I’ve tested it in IE7, IE8, IE9, FF, Chrome, Safari, Opera etc.

In a previous blog post I attempted to define some of the fundamental concepts of what it is that I do on a daily basis. In the process of defining said foundations, I stumbled and stubbed my toe on another concept. Hidden inside the other, not unlike the layers of a matryoshka doll. The concept of software craftsmanship.

Software craftsmanship is a bottom up approach to software development by emphasizing the coding skills of the developers themselves. Traditionally software engineering practictioners were encouraged to see themselves as part of a well defined statistical analysis and mathematical rigor of an engineer with the benefits of introducing professionalism, predictability, precision, and mitigated risk.

The reason that this approach is fundamentally flawed is unquestionable. Software engineering as a field of study is far too immature and is constantly in a state of flux.

For civil engineering there exists well defined and well understood ways for constructing bridges and buildings that is safe for people to use and inhabit. A person who designs a bridge can be certain that the people constructing that bridge know how to read the blueprint, and what all the symbols and formulae mean.

No such generally accepted blueprints exist for software engineering. Everything can be done in a multitude of ways with different methods and ideology at its core.

Not unlike the guild traditions of medieval europe software development is a craft that has developed a body of wisdom, most of which isn’t taught at universities nor in certification classes. Most developers arrive at these tricks of the trade by independent experimentation, or more recently from learning from their peers and mentors.

Tools of the Software Craftsman

Learning how to use the tools of the trade is a core concept for producing quality code. Here is a list of some of the tools used to increase the quality, extendability, reliability of code.

Use a version control system, like subversion, mercurial or gitSource control is like a time machine for your code, you can always go back in time.

Use a continuous integration tool like cruise controlContinuous integration implements a continuous process of applying quality control to daily or nightly builds.

Have a centralized bug tracking system like RT or BugTracThis is essential to maintaining software.

So MapReduce is an amalgamation of two higher order functions taken from functional programming.

Map and Reduce :. MapReduce.

Google took the concepts of Map and Reduce and designed a distributed computing framework around those two concepts. As it’s almost infinitely horizontally scalable, it lends itself to distributed computing quite easily.

If you’re in the industry or looking to get into the industry you’ll find yourself a little confused as to some of the labels and roles given to computer programmers.

Programmer

Developer

Analyst

Architect

Engineer

The first two terms are freely interchangeable, the dictionary term for a programmer is one who programs, the term for developer is one who develops. So is there a difference in the terms or the roles? No effectively these two terms are identical and is merely a preference in terminology. Even microsoft uses these terms interchangeably for their internal developers.

An analyst might not actually write code, in a lot of instances this will be a business analyst, someone who understands the business and also understands how to translate the business needs into terms that can be digested by a team of programmers or engineers. An analysts primary function is to write the specification or requirements documents required for a new project.

A software architect, is very much like the traditional architect. They are responsible for building the framework and designing the tools that the team will be using to develop the project. Software architects are senior level developers who have had years of experience in developing software and can quickly turn a functional specification into a framework which is maintainable and future proof. A software architect can also be responsible for mentoring the rest of the development team in how to use the framework.

An engineer is none of the above and could be any of the above. A software engineer is someone that subscribes to an engineering discipline.

Definition of software engineering

Software engineering is the “systematic approach to the analysis, design, assessment, implementation, test, maintenance and reengineering of software, that is, the application of engineering to software”[1]

Universities can’t teach you software engineering.

This is a crucial distinction to make because after 3-4 years of going to university to earn your degree and learning how to program computers in various languages. Designing relational database models, writing functional and requirements specifications, you are not actually qualified to start writing production quality code. Not without someone to mentor you. Or for that matter you are definitely not experienced enough to architect a solution for a company.

During implementation of the same algorithm from Haskell to (Functional) C#, I found that I hit quite a large snag with .NET (3.5) number types. A fibonacci sequence very quickly accumulates into integers larger than an Unsigned Long can contain, in which case you would have to move to using .NET 4.0 / F# BigInt to get the benefits of using their operators. The below code works very well within the problem domain, however you will need to refactor this to use BigInt if you wish to move into larger Fibonnaci sequences.

Project Euler – Problem 2

Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:
1, 2, 3, 5, 8, 13, 21, 34, 55, 89, …
By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms.

The backslash in this context is representing that the following code is a lambda (λ)

iterate

Creates an infinite list where the first item is calculated by applying the function on the secod argument, the second item by applying the function on the previous result and so on.

$

The ‘$’ operator is for substituting parenthesis. Anything appearing after it will take precedence over anything that comes before.

fst

Returns the first item in a tuple eg. fst (1,2) returns 1

map

Returns a list constructed by applying a function (the first argument) to all items in a list passed as the second argument

filter

returns a list constructed from members of a list (the second argument) fulfilling a condition given by the first argument

even

returns True if the integral is even, False otherwise.

takeWhile

creates a list from another one, it inspects the original list and takes from it its elements to the moment when the condition fails, then it stops processing

sum

computes a sum of all elements in the list

Armed with the knowledge of what each of the above functions do, we can now translate the above code. Like most functional programs we read the code right to left meaning that the code on the right is passed to the code to the left of the chain.
given a list of even fibonnaci numbers
whose number doesn’t exceed 4 million
return the sum

Which is almost identical to the c# implementation using a YCombinator.

This c# solution does have a few issues, as pointed out earlier, additionally it doesn’t produce a real fibonnaci sequence even though it returns the same answer it drops the first two elements of the sequence.

1

return new List<long> {1,1}.Concat(Fibbonacci(1, 1, Int32.MaxValue))

Additionally you’ll notice that I’ve put in a check there so that we don’t cause stack overflow errors in adding numbers larger than Int.MaxValue. I believe refactoring to use BigInt should alleviate the need for this check.

About This Blog

Software Engineering is an art form, a tricky art form that takes as much raw talent as it does technical know how. I'll be posting articles on professional tips and tricks, dos and donts, and tutorials.