Creating an HTML5 Paint App

There are several apps available today that allow one to draw freely on your touch screen smartphone. Be it to take notes, annotate photographs, capture signatures digitally or to play games like the popular OMGPOP Draw Something App. In this article we'll explore a way to achieve this using the HTML5 canvas element and a little JavaScript. (more…)

By Sheldon Neilson, ago

How to Add a Custom Eclipse Launcher to Unity

  Anyone that has worked with Eclipse on Ubuntu has undoubtedly experienced this particular annoyance. As Eclipse isn't really ever "installed" but just executed, it is never registered as an application on the system and so is completely absent from the menu system etc.. Odds are, if you're reading this that you too believe that there must be a better way than creating that sloppy desktop shortcut... (more…)

By Sheldon Neilson, ago

Extending AndEngine’s GenericPool to Safely Add and Remove Bodies from Box2D PhysicsWorld

Anyone delving into Android game development with Box2D physics will at some time struggled with seemingly random crashes when adding or removing bodies from the physics world. The instinctive thing to do is to destroy the object when some type of event has occurred, such as a touch event or collision in the physics simulation, however simply removing entities from the simulation can cause the simulation to crumble. In this article I'll go through my preferred method of safely adding and removing objects from the physics simulation with the minimum performance hit. (more…)

By Sheldon Neilson, ago

k-Means Cluster Analysis in Microsoft Excel

What is k-Means Cluster Analysis?

Cluster analysis is a method for automatically grouping data into a smaller number of subsets or clusters so that the records grouped are most statistically similar to each other based on the attributes of the data compared.

"In statistics and data miningk-means clustering is a method of cluster analysis which aims to partition n observations into k clusters in which each observation belongs to the cluster with the nearest mean.

Given a set of observations (x1x2, …, xn), where each observation is a d-dimensional real vector, k-means clustering aims to partition the n observations into k sets (k ≤ nS = {S1S2, …, Sk} so as to minimize the within-cluster sum of squares.

\underset{\mathbf{S}} {\operatorname{arg\,min}} \sum_{i=1}^{k} \sum_{\mathbf x_j \in S_i} \left\| \mathbf x_j - \boldsymbol\mu_i \right\|^2

where μi is the mean of points in Si." -Wikipedia 

[caption id="attachment_16" align="alignright" width="210"]Scatter Chart Clusters and Centroids Scatter chart with coloured clusters and their centroids displayed in red[/caption] k-Means cluster analysis achieves this by partitioning the data into the required number of clusters by grouping records so that the euclidean distance between the record's dimensions and the clusters centroid (point with the average dimensions of the points in the cluster) are as small as possible.

The following is a macro I wrote in VBA for Microsoft Excel that performs k-Means Cluster Analysis on the table selected.


By Sheldon Neilson, ago