Calories Burnt Calculation for Walking or Running in Java

Its surprisingly difficult to find a calorie calculation for Java for performing a number of steps at a certain speed. Based on the Compendium of Physical Activities ( )  and using Corrected METS, I have converted the formulas on their website into Java code! I found the website particularly difficult to read as it did not have brackets in the right places to ensure that the calculations were correct. Hopefully I can save someone the hassle of having to wonder what is going on with all their formulas.

Simple Printing in Android to a Network Printer

So for a few days I have been researching how to send a document to a network printer without using any third party libraries in android. This sounds like a simple task but by default Android doesn’t offer this service, sure there are loads of apps that can do it but this took me a while to find, and I think someone else may find it useful one day.

I made use of an AsyncTask so as not to tie up the UI thread. In the doInBackground method, the following simple code helped me achieve printing to a network printer.

This code will allow for sending PDF files, PCL files and PS files directly to the printer by using Sockets. The default port for most printers is 9100. You will also need to know the IP Address of the printer.

This code might not work with all printers but it worked with 2 different brands that I tried it with.

Basic Controls of Lego Mindstorm NXT 2.0

So after the past two days of trying countless tutorials on the web, I decided to sift through the Microsoft articles to see if I could understand their code, and what happened? Success.

I managed to look at the Drive by wire tutorial on Microsoft (

Basically I first created a DSS Service 4.0 in VS2010, added the partners of the Lego NXT brick (very basic ones, just the Drive Operation and Brick basically) – made sure to select Add Notification Port and then built the solution. Then opened it up in DSS Manifest Editor and followed the blog here to edit and set up my Manifest file.

Next, I used Microsofts Drive By Wire Tutorial, which is very clever as you create an abstract class that can be then used with any Manifest file that implements the required services, so if your Lego Robot breaks – you can easily use the simulated environment to showcase your skills.

Any ways, I now have a moving robot that can be controlled by bluetooth and simple up, down, left, right and stop commands.

I have accomplished something today. Time for bed.

Problems with Microsoft Robotics Studio 4.0 Beta 2 and Lego Mindstorm NXT 2.0

This year I am studying my Honours in IT at the University of Johannesburg, South Africa. I decided to take on the task of programming the Lego Mindstorm robot in MRDS, it seemed relatively easy but believe me its complicated.

I have tried a few tutorials but I am having problems making the Robot actually do anything. Don’t get me wrong the VPL is very simple to use, got that working in about 5 minutes. What I am trying to do is actually code in C#, which is proving to be a bit more challenging than expected. 
I have only about 8 months to get this thing working properly, with a bunch of other projects in between, I will try post as I go on with the project as I noticed there isn’t much development with Robotics that is published online.
Here is a picture of what it looks like so far..

I haven’t managed to give my puppy a name yet, can’t think of anything clever yet.
Here is to hoping that by this time next week I have a Robot that moves!