Automate infrastructure setup through Azure Resource Group Deployment from your Visual Studio Online build

In this post I demonstrate how you can create and update your Azure infrastructure as part of a build in Visual Studio Online (VSO).  This enable to deliver and test your code and your infrastructure continuously.

Under your VSO project, choose build, and right click your build and choose “edit”, add an Azure Resource Group Deployment.


To be able to provision the infrastructure from your VSO build your Resource Group Deployment need to have the permission to add or modify resources in your Azure subscription.  Therefore you can use a Service Principal that has the proper access rights in your subscription.  This msdn article details how you can create a service principal and use it during your deployment.

Watch out: if you’ve several subscriptions, chances are that you run under the wrong subscription, this will result in the following error: “The provided information does not map to an AD object id”.  You’ll need to select the proper subscription, just after the step: “Add Azure Account” use the following command:
Select-AzureSubscription -SubscriptionId <subscription-id>

The remaining steps are obvious:



Select your Azure Subscription, provide a name to your resource group, select the ARM template inside your VS solution and the parameter file you want to use for this deployment.

Now you can include this step inside your continuous integration build or create a specific build for your infrastructure setup that you can trigger at will.

How To: Use Azure Resource Manager with Visual Studio for creating Web Apps


Here we want to create our Azure Web App from within visual studio.  The goal is to be able to recreate the infrastructure at will and host a web app on it.  We do this by including an Azure Resource Group project inside our solution. This bundle the code of our website with the definition of the infrastructure that is needed to host the website. The Azure Resource Group project contains the description of your infrastructure inside an ARM(Azure Resource Manager) template and one or many parameter files. With this project you make sure that your configurations can be consistently repeated, tested, shared and promoted across different environments. This concept is called “infrastructure as code”.

1) Define the infrastructure

First we need to add an Azure Resource Group project to our visual studio solution.

Right-click Add, new project.

If you didn’t have downloaded the Azure SDK, you first need to install it. Choose “Get Microsoft Azure SDK for .Net” from the Cloud category and complete the installation steps.


Once the Azure SDK installed, reload your solution, right click on your solution, add, new project and select Cloud, “Azure Resource Group”, provide a name to your project and click OK.



Here we’ll setup a simple website.


Then we’ll need to fill in the parameters.  You can do this via the deploy wizard or directly inside the “” file. The file is located under your ARM project in the folder Templates.

The siteName and hostingPlanName are up to you, you can fill in what you like or provide the name of an existing one.  For siteLocation you’ve to choose between one of the Azure datacenter regions, you find the list under:

Just copy the name of the region that is appropriate to you.


2) Deploy your infrastructure

Right click your ARM project and choose Deploy, New Deployment.


Click on Deploy.

Once completed you should see your Azure website listed in the portal.

3) Publish your app to your website

Now you can publish your web app through Visual Studio to the Web App you created in Step1.

Right Click your web project, choose publish and select “Microsoft Azure Web App”.


Select your web app.


Click, “OK” and then “Publish”.

Once completed you should see your browser should open showing your freshly published website.



How-to create a build with Visual Studio Online

This is the first in a series of How-to’s dedicated to continuous deployment with Azure.

Here I explain how to automate a simple build through visual studio online.
Before you start you should have at least one Visual Studio solution into the repository..

  1. Connect to your Visual Studio online project.
  2. Select Build, click + sign in the left column.
  3. Choose Visual Studio build as your build template


  1. Click on the Save button and provide a name and description for your build definition
  2. Test your first build by queuing a new build, right-click your build step and choose queue new build


  1. During the build you can follows all the steps through the console inside the page.

Build your Arduino Robot and program it with Javascript

In this post I explain step by step how I build an Arduino based Robot. This can be a handy if you want to build your own. I explain which design choices I made, which frameworks and technologies I used and how I program and configured the robot. Here you can find a video of the end result.

What is needed?

The robot is based on a RoverV2 + Bluetooth Arduino robotic kit sold by Robotshop.  This kit contains:

  • A compatible Arduino board including:
    • Dual H-bridge and onboard voltage regulator
    • An onboard charger
  • A Bluetooth module
  • An aluminum frame
  • Tamiya Twin-Motor Gear Box
  • Tamiya Track and Wheel Set
  • Lithium Polymer Battery Cell – 3.7V 1000mAh


The kit is complete and well documented but if you want to go hard core and start with a classic Arduino board, you can obtain the same result with following components:

  • An Arduino compatible board
  • An Arduino motor shield
  • A pair of two 5v motors and 4 Wheels & frame
  • A Bluetooth module
  • 4xAA battery & holder

The goal of this article is to set the basic building blocks to build a robotic platform that you can extend to finally build an autonomous robot.  Therefore, to enable the robot to sense his environment we extend the base platform with:

3 x ultrasonic sensors HC-SR04


1x Accelerometer MMA7361.


1x Compass HMC5883L


You can find all these components, including the wheels & frames in shops selling Arduino compatible boards online like SainSmart or Robotshop.



For the design I choosed to remotely control the robot from a server (a laptop or pc).  This design overcomes the limited processing & storage of the Arduino board but it comes at the expense of autonomy. My robot will not be able to evolve without be connected by Bluetooth to his server.  This is a concession I’ve to make but it provides me quasi infinitely processing power and makes my robot accessible through the internet.

The Arduino board plays the role of central nervous system and the PC is the brain. Another advantage that offers this design is that the robot can be controlled from anywhere in the world as it is exposed through http by a node.js application.

On the Arduino board runs a small program named “Firmata”.  This program enables you to control the Arduino board remotely through the Firmata protocol.  You’ll send commands from the server to the robot through a serial connection.  On the server side you’ll program your robot with Javascript using the johnny-five node library.  This library provides an abstraction over the Firmata protocol and enable us to interact with the Arduino board and a lot of the Arduinos compatible electronic devices like sensors and motors.

The robot can be remotely controlled and followed through a web interface dashboard.  The dashboard is a single page application built with angular.js   .  The html, images, css and javascript resources are served by express.js.  Express.js is the default web application framework for node.  Express.js is also used to expose a rest based API.   Through this REST interface, the radar and accelerometer data can be retrieved and commands can be send to the motor.  This allow you to program and control the robot via any device using the programming language of your choice.

To enable real time communication in both directions between the server and the robot I’ve used



 Assemble and configure your robot.

To assemble the DFRobotshop RoverV2 you can follow this video.  As I’m a Lego fan and that with two little boys in house I’ve a lot of little bricks, I’d no difficulties to find all pieces I needed to build a Lego frame where I could mount the ultrasonic sensors, the accelerometer and the compass on it. Here you can find a picture of the end result.


It’s up to you to decide to copy the design or make your own as long as you use the same core components and follow the schematics provided here beneath the code will be compatible with your robot.


Here you can find the schematics for your robot:




As the accelerometer MMA7361 can vary slightly between manufacturers and models I provide an alternative schematic only for the accelerometer:


Configure your Robot


Before you start make sure you’ve setup the following tools on your box:

– Git :

– Node 0.10.40 for x86 :

– Python 2.7.x :

If you’re on windows make sure you’ve configure your PATH correctly for all of these tools, therefore I suggest you use Chocolatey to install all of these components.

 Download the code

Create your working folder:
c:\Dev>mkdir arduino
cd arduino

Clone the repository:
c:\Dev\arduino> git clone

Install the packages:

c:\Dev\arduino\johnny5> npm install

You could receive some warnings here, don’t panic it should still be working fine.

Flashing your Arduino board

Because the onboard bluetooth ship is limited to 9600 baud I’hd to patch the firmate protocol. This patched version can be found on the root folder.

  1. Open the Arduino IDE
  2. Connect your Robot to your PC through the usb cable and temporarly remove the bluetooth module from your Arduino board
  3. In the IDE select the correct com port
  4. Choose, File, open and select the “firmate_pulse_9600B_patch.ino” file located under: ..\johnny5\firmate_pulse_9600B_patch
  5. Push the upload button
  6. Reconnect your bluetooth module


Connect to your Arduino board through Bluetooth

You should go to your Bluetooth settings and associate your Bluetooth with a COM port.  On resent versions of windows you should click on the Bluetooth icon, choose “Add Bluetooth devices”.  You should see “Bluetooth_Bee_V3” click on it and enter the secret code: 1234.

You need to know which COM port windows as configured to your outgoing connections to you robot.  Therefore open the Bluetooth settings, select the COM ports tab and note which COM port is associated with your Bluetooth_Bee_V3 outgoing connection.


Configure and start the server

With your preferred IDE modify the variable “comport” in the “app.js” file with the COM port you connected the Arduino with.

On the Johnny5 folder, start the program => “node app.js”



Start your preferred browser on http://localhost:3000 , you should now be able to control your robot through the interface:




Leren programmeren in Minecraft met Javascript


Hier kun je een link vinden naar een cursus in het Nederlands van hoe je met Scriptcraft Minecraft kunt programmeren:


Learn Javascript with Minecraft and ScriptCraft.

Here you can find a course with exercices and tutorials about how to program Minecraft with Scriptcraft:




Learning programming with Scratch


Here is a little coding exercise inspired from one of the codeingame puzzels. It was ported based on the Mars Lander-2 game made by mrswanson.  This game is primarily targeted as a coding exercise for kids/students to learn programming.

Your mission: reprogram the mars lander.

In fact the problems concerns the landing phase for “Mars Lander”, the landing ship which contains the Opportunity rover. Mars Lander is guided by a program, and right now the failure rate for landing on the NASA simulator is unacceptable.

Built as a game, the simulator puts Mars Lander on a limited zone of Mars sky. The zone is 138m wide, the center of his position is at position “LanderX”. The ship can get into the zone at a variable location but may not crash on the mountains.

Your mission is to write a new artificial intelligence program that will enable Mars Lander to land safely on Mars without crashing. The program will have to go through a series of increasingly complex simulator tests.

You’ll find the Mars Lander program under:


– You should add your code inside the lander forever loop.
Click on the lander sprite, in the “Scripts” tab you should see:


– To drive the lander you should broadcast “left”, “right” or “up” messages.


For a landing to be successful, the ship must:

– land inside the flat ground, the center of the landing path is at horizontal coordinate 0 (when  x = 0).  (=LanderX)

– vertical speed (=ymotion) must be limited ( ≤ 1 m/s).

– horizontal speed (=xmotion) must be limited ( ≤ 1 m/s).


Have fun!



Wouldn’t it be great if I ‘had a central place where I could keep and work on all my little nuggets of utility code I’ve written over the years. Also be able to download them from nuget would be very convenient. This is why I’ve decided to setup a new project on Github. There I just posted the first library of my personal Swiss army knife framework.

These libraries where primarily designed to build loosely-coupled applications where you can swap out particular components without affecting the rest of the application. Most of my libraries are just small layers above existing frameworks providing a common API that simplify their usage (for me at least). The libraries ease the use of these frameworks by providing standard configurations and exposing only the functionalities I found useful for me through what I saw as a “common API”.

The first library I uploaded is: Go.Simple.Logging

GoSimple.Logging is a small and simple library that provides a common interface for logging. It comes together with an implementation for Log4Net: GoSimple.Logging.Log4Net.

It provides a simple logging interface (Logger.Debug(..),, Logger.warn(…), Logger.Error(…),….).  I use this nuget package in all my projects to easily integrate with Log4Net without having to remember how to configuer & setup Log4Net.

The library comes with an appender to send the logs through syslog to a Splunk server. The TcpSyslogAppender you’ll find in the Log4Net implementation was extensively tested and fine-tuned on many large scale applications running in production.

You can download it through nugget by using the nugget console:

Install-Package GoSimple.Logging.Log4Net

The most valuable extensions you’ll find in this project are:

  • Syslog Appender: used to send your logs over TCP or UDP to a syslog server like Splunk, Logstach or Kiwi.
  • Rolling File Appender: when GoSimple rolls a log file, it saves and closes the old file and starts a new file.

GoSimple.Logging comes with a sample project, you’ll find it on the github project home. It provides an example of how to configure your application for GoSimple.Logging in just one line of code. You’ll also find a sample Log4Net config file with example config sections for each appender.

To enable it on your project you need to :

  • 1) Review the Log4Net.config file on the application root.
  • 2) In VS set the property “Copy to output directory” of the Log4Net.config file to “Copy always”
  • 3) In your application entry point (bootstrapper/main) initialize the Logger:
    Logger.Initialize(new Log4NetLogger());

Voilà that’s all you need to configure to enable logging in your application.

How to prevent powershell long content to be truncated with three dots.

Powershell sometimes truncate large strings with three dots ()

PS C:\> Get-MyServers
Even when using the Format-Table command and setting the length via the width property is not always a solution especially when you want to export the result to a CSV format, you can’t use the ft command.
The simplest solution I found is:
to set the variable $FormatEnumerationLimit to -1
PS C:\> $FormatEnumerationLimit =-1
PS C:\> Get-MyServers