The personal ramblings of Jon Carlos mobile & web developer and technology enthusiast.

Sunday, 7 June 2015

KVM Install in OS X on a Mac

19:46 Posted by Webmonger , , , 1 comment
I was looking to get kvm installed on my mac so I could do some .net development and found a great blog post by Graeme Christie called ASP.NET vNext on OSX and Linux

One thing I had an issue with was the actual install of kvm though. Graeme provides a single line install which is handy but when I tried it I received the following error

Downloading kvm from ''

Appending source string to ~/.bash_profile
Type 'source ~/.k/kvm/' to start using kvm
-bash: ~/.kre/kvm/ No such file or directory

I found that the install command was very slightly wrong and used the ~/.kvm/ directory rather than ~/.k/ directory. I made the small change an re-ran the installation and it all worked great.

If you have the same problem try this line.

curl | sh && source ~/.k/kvm/ && kvm upgrade

Saturday, 25 April 2015

Using docker containers to run .net site on linux more complex example

22:19 Posted by Webmonger , , , , 3 comments
 Image by Greg Bishop used under creative commons licence

Because of the work I do with Xamarin I'm quite used to working on a mac but building using .net and C#. Amongst .net developers this is quite unusual however this is about to change with the recent open sourcing of the framework and Roslyn compiler there will be the ability to run .net on any platform.

This led me to start to investigate how you go about building and deploying applications on Linux. With Xamarin and mono this has been possible for some time though I don't think this is used quite to the extent developers use it for building mobile applications.

I guess the first thing I'd like to say about this process is that I found the set-up relatively easy but the complexity of the example apps I could find were really low so I started to hunt for something more complex so I could really get an idea of how .net ran within a Docker container on ubuntu.

Most of the docker commands are available on this MSDN article "Running ASP.NET 5 applications in Linux Containers with Docker" and a bit more detail about what you're actually doing is also available there. I'm going to concentrate on a couple of things, first I had quite a few issues getting boot2docker to allow me to access containers on my mac, secondly when building containers with boot2docker I had some issues with downloading NuGet packages.

  1. Get docker installed on your local machine or on an ubuntu box, there are loads of posts on how to do this but the docker site probably covers it best and most comprehensively for all platforms.
  2. Make sure git in installed on the host machine as we'll be cloning a repository that contains the app for our container.
  3. If you are running boot2docker all the following commands should work on your mac host or by working directly on a Linux box, if you're working on a Linux VM you'll need to SSH on to the box to run the following.
Getting the Application
As I said before the complexity of the projects that were used in most .net + docker examples was very low. After a little research I found the Music Store project which is a store front for CD purchases, it has a little bit of database logic and a few pages as well as login functionality and shopping cart.

To download this repository run

git clone

I found when building the container for this code it could not find all the NuGet packages so use a text editor to create a NuGet.config in the MusicStore project folder.

In Lunix or on a mac run

cd MusicStore/src/MusicStore

nano NuGet.config 

Paste this code in to the file

Once finished (when using nano) press ctrl+x then y then press [enter]

Building your container
To build a container you need to create a script that will tell docker how to configure the container  to run you app.

This script is called a Dockerfile create us file by running

nano Dockerfile

Now we need to add the build configuration so paste this code in to the file then press ctrl+x then y then press [enter] to save and exit nano.

FROM microsoft/aspnet

COPY . /app
RUN ["kpm", "restore"]

ENTRYPOINT ["k", "kestrel"]

I'm not going to go in too too much detail about what these commands do but the 2 main ones that will become more familiar with you once vNext comes out is "kpm restore" which will restore all the packages required for the project and "k kestrel" which is a basic web server that is capable of running sites.

Next we want to build our container. At the beginning of this article I explained the different ways you can set-up docker, some times you'll need to add sudo to the front of the following commands. In my set-up they work fine without.

docker build -t musicstore .

This command will then go off and run all the commands in your Dockerfile depending on how fast you connection and machine are it might take a little while as it's downloading the microsoft/aspnet docker container and all the NuGet libraries as well.

Once that's complete you should have a new image listed in your docker image repository, to see if it's there run

docker images

You should see an image called musicstore in the list, this is the container we're now going to start. Just run

docker run -t -d -p 80:5004 musicstore

I ran in to quite a few issues with this however when I ran this command on my ubuntu server it worked perfectly every time. If you are running this within an ubuntu VM you will need to configure the NAT settings on the VM for port forwarding, I also had issues using port 80 and 8080 in this configurations so I tried using NAT to transfer port 8081 to port 80 and it worked perfectly so just play about with the following settings if you have problems.

You can find this screen in VirtualBox by right clicking on your VM selecting Settings > Network > Port forwarding (down at the bottom) then clicking the add button on the right.

Now open up the browser of your choice and with any luck hit the IP address of your server/VM/boot2docker/localhost with or without the additional port number and you should see something like this.

So I hope you'll agree, with reasonably little effort you've just managed to set-up quite a complex .net app on a docker container with little work.

I'm sure if you're a .net developer you can see how this might revolutionise the way you deploy apps in to the wild or even just develop locally on your many work machines or between multiple developers! I have managed to get this docker set-up to work across Windows, Linux and OS X which is pretty cool and the ability to scale the number of instances running your app with just that simple command is amazing.

I hope you managed to have a bit of fun with this and if you have any questions let me know.

Sunday, 12 April 2015

AllPixel and Raspberry Pi WS2812 strip first setup using USB cable

10:07 Posted by Webmonger , , , No comments

My AllPixel arrived today from ManiacalLabs the first think you need to do when you get it is install the included components. As described not all of the components included are required but if you know what you're planning to do it should be pretty easy to work out what you need.

Next you need to make sure when you connect up the USB cable to the Raspberry Pi it sees your AllPixel board. I attached the USB before I had started the Pi and first off it did not see the board using;

ls /dev/ttyACM*

I restarted a couple of times and then I just unplugged it and plugged it back it an ta-da there is was listed.

Once I knew the board was recognised I was ready to connect up the LEDs. I have a short strip of WS2812 I was using, I connected the wires like this;

V+ to +5v

Once you've do this you should be able to just press the button on the AllPixel and you'll see the LEDs light up and if you press it again they should change configuration.

Now you're ready for installing the python library, the raspberry pi comes with pip installed so it should just be a case of running;

sudo pip install BiblioPixel

Now at this point you have a couple of options, you should have everything you need to start coding against the python library however if you'd also like to use the AllPixel with the GPIO pins on your Pi then you might want to run these commands.

curl > requirements.txt

sudo pip install -r requirements.txt

I installed them just in case I wanted to work with the GPIO at a later date. There are further options you might need but these are all I had to run on my Raspberry Pi.

Now I wanted to do a test of my of my LED strip, the guys at ManiacalLabs have provided a great little script to run as quick start. All you need to do is download it and then run it and you'll see your LEDs come to life.

curl >


You should see the first 10 of the LEDs in you strip come to life and the 3 LEDs at the end change colour. Details of exactly what should happen is available on the AllPixel Documentation

Note: If you're using a different strip from you'll need to change the enum at the top to select the strip you are using. On line 7 change LEDTYPE.WS2812B to one of the following properties.
  • LPD8806
  • WS2801
  • WS2811
  • WS2812
  • WS2812B
  • APA104
  • WS2811_400
  • TM1809
  • TM1804
  • TM1803
  • UCS1903
  • SM16716
  • APA102
  • LPD1886
  • P9813
That should be you all set-up, you should have some LEDs flashing something like this.

A video posted by Jon Carlos (@webmonger) on

Saturday, 14 March 2015

Results of my TwtPoll "What programming languages do you use to build mobile apps?"

22:27 Posted by Webmonger , , , No comments
I'm my day job at Screenmedia I work for a range of clients building mobile apps and websites. We spent a great deal of time looking in to cross platform development frameworks that would allow us to create the quality of mobile app we love using. We spent about 2 years testing different tools and frameworks so woe could pick the route that suited us the best.

After all that time we found Xamarin I wrote more about this on the screenmedia blog. Soon after making this decision about Xamarin we started working on a project that took our mobile development team from beginner cross platform developers to Certified developers and Xamarin Consulting Partners in a matter of months.

Since we started working with Xamarin I've been constantly surprised by the speed of delivery of new features and also the delivery of zero day support for iOS 8, Apple Watch, Android Lollipop and Wear. This has led me to become a vocal advocate for truly native cross platform apps using C# and Xamarin.

I know there are loads of other options for building cross platform apps so to a couple of weeks ago I posted a quick poll asking "What programming languages do you use to build mobile apps?" while I did not receive a huge number of votes I was glad some people had taken the time to let me know what they used.

As you can see almost 3/4 of the voters use C# which I was quite surprised about, I'm not sure whether the results were somewhat skewed by my twitter followers or just the focus of what I' regularly post or if this is the current state of mobile development. It's interesting to see that HTML and JavaScript are almost evens and Objective-C and Java are trailing behind by quite a significant number. I guess that would bring me to question whether people are using JavaScript with HTML or if they are using a framework like Titanium.

I was also quite surprised that 50% of the developers that voted were 35-44, the next largest age group that voted were the 24-34 group with 32%.

It seems that the majority of people that voted were male though some people did not select the option. In such a small sample it's difficult to make anything of this but having been to a few universities to speak to graduates the number of female students is still very low.

So I guess while any conclusions are limited due to the small sample size, Xamarin and mobile development in C# is popular, at the moment HTML and JavaScript are still being used for mobile development though as I understand it enterprise and large SMEs are not really investing in these technologies so I suspect these developers have a background in web development and are transitioning to mobile without learning new technologies.

Thanks to everyone that took the time to vote.

Friday, 6 March 2015

Raspberry Pi b+ and max7219 LED matrix

21:45 Posted by Webmonger , , , 2 comments

I had a little bit of a shopping binge on Ali Express recently spending no more than £3 per item I purchased a bunch of random items I thought would be fun to hook up to a Raspberry Pi.

One of which was this little LED Matrix called a Max7219, it had 64 red LEDs in an 8x8 configuration and includes the controller chip required to control them from the 5v pin on a Raspberry Pi. It was all soldered together and came with a 5 pin cable so I didn't need to do anything but hook it up.

I found this guide on but I had a completely clean install on Raspbian and I had not configured it correctly so I needed some more help. I looked about a Googled the issues but I did not get a great deal of help so I hope this will help some others that have the same issues I did.

First up the pin configuration as detailed in the max7219 python library uses the SPI pins, I did not know theses needed to be configured to be used to while I was trying to run the tests I got this error.

can't open device: No such file or directory

It turns out to use the SPI pins you need to run 'sudo raspi-config' to enable access to the pins. below are the selections you need to use to enable them.

Once this is done that error should go away and you should be able to access the pins without issue.

Next you'll need to get the right software to be able to run the python libraries run these commands and you'll then be ready for the hardware setup.

sudo apt-get install python-dev python-pip
sudo pip install spidev

So now connect the pins to your Raspberry Pi following the instructions on github by rm-hull, now we're ready to pull the max7219 library.

git pull
sudo python max7219/ install 

Now you should be ready for your first test but before hand make sure that all your pins are nice and tight then run.

sudo python /max7219/examples/
A video posted by Jon Carlos (@webmonger) on

Tuesday, 24 February 2015

Bose Sound Dock Pi MusicBox using Raspberry Pi a viable sonos alternative in 2 hours

So my wife's very old CD player broke the other week and I promised her I get a replacement. I looked in to 30 pin bluetooth adapters and even bought one but it really did not scratch the itch that provided a room based music player like you would have with Sonos.

During this period a good friend Matt Brailsford posted this project he'd started:

That made me think I have this old Bose Sound Dock that's been lying about for a couple of years and I have a Raspberry Pi maybe I can hack these 2 things together. So I had a quick chat with Matt and he introduced me to Pi MusicBox, this awesome project is basically a headless (has no screen, keyboard or mouse) streaming music player. You can upload your own music to the memory card or you can add a Spotify Premium account and there you have it a streaming music player.

The main issue I had to overcome with the Bose Sound Dock is that it does not have a jack to plug in to the Raspberry Pi only a male 30pin Apple connector. I looked in to this issue and found a great video on YouTube that explained exactly how to modify the sound dock to add a jack.

Once this modification was complete it was a case of downloading Pi MusicBox and installing it on a memory card. This took somewhere in the region on 10 mins and as I described earlier this is a completely headless system so the configuration is all done via a text file you open it up insert the details for your wifi and Spotify account and that is. Power it up, plug it in and there we go.

Sonos like functionality with things that I had lying about in my house that took under 2 hours to hack together. Awesome!

If you'd like a complete guide on hoe to create a Pi MusicBox look no further Christoph Buenger has provided one for you

Friday, 6 February 2015

JazzHands for iOS and Android using Xamarin

It's been a while since my last post but I've been very busy working on many projects.

I've been doing a lot of cross platform mobile development using Xamarin and during this we were looking at animation frameworks we found a fantastic one developed by IFTTT for iOS called JazzHands.

We thought this framework was great but having done everything in C# we decided that it would cool to convert it to C# and see if we could share code between both iOS and Android.

So we started with a straight conversion from Objective-C to C# found at It performs just as well as the original and so we pushed this up to the Xamarin Component store

By this point we did not have a working version in Android so we continued the development and managed move the calculations in a shared project and implement the keyframe animations. You can find the project at

When I get some more time I'll update the iOS version so it works with the new 64bit unified API and add the new Android version to the component store.