Friday, May 29, 2015

Installing .NET 3.5 on Windows 8.1

I've recently upgraded my desktop with a shiny new SSD. I opted for the full reinstall of Windows as the easiest option. Window updates took a while, but I was able to get upgraded to Windows 8.1 eventually.

Unfortunately the next day I encountered a problem getting .NET 3.5 installed. The normal installers don't work because this is now a Windows Feature, but adding the feaure would always fail. After several different attempts at a fix, including trying to install from the command line via the original DVD I found a serverfault post here which suggested uninstalling two updates KB2966826 and KB2966828. After these were removed the install worked.

I don't know for certain that this was definitely the fix as I also did a disk cleanup which removed Windows.old which was the old Windows 8.0 directory. Both options are worth exploring.

Sunday, August 10, 2014

Hosting an Ubuntu VM on Windows 8 for Web Development

The VM

After a little bit of playing around, I managed to settle on Ubuntu 13.10 running under VirtualBox. Unity is the default window manager for Ubuntu, and is a little heavy for a VM, but it runs ok. The host is Windows 8.1 which is my preferred desktop. I've tried Linux as a desktop OS in the past and I always found reasons to go back to Windows (such as Steam, and RAW handling for my Canon). I'm used to working on servers running Windows Server, but I don't have to pay for them, so Linux is a nice alternative to get used to, especially for web development, which is outside of my normal experience.


The main thing I wanted working was networking. The VM needed to reach the internet in order to download new packages etc, and I needed to access the VM from Windows. Accessing the Windows host from the Ubuntu guest was less important, but I got that working too.

The default network adapter is a NAT setup. This allows access to the outside world, but there is no connection between the guest and the host. The first promising one was the Bridge network. I could access the VM from my Windows PC, but the VM couldn't access the host or the Internet. Luckily a reboot of the VM fixed that. Bridge networking now gives me host to guest, guest to host and guest to Internet.

Thursday, July 10, 2014

First Steps into Agile and Kanban

My day job doesn't always involve a lot of new technology or techniques, but recently we have made a commitment to start using Agile techniques, especially Scrum and Kanban. So far this has involved projects already in the pipeline and designs I have (or should have) completed previously, but I have a small team now and we get together to do three week sprints to develop new software. Well, changes to an existing system.


Sprint Planning

To begin, we all get together (developers and testers, sometimes a business analyst) and plan the sprint. Again there is a more traditional plan already hanging around in the background with existing requirements which have become backlog items, but we still get together and discuss the requirements and assign a size to them. We're using scrum poker cards for this (either physical cards or apps for our phones). The item sizes are meant to be relative, but have no meaning by themselves. The idea is that you are not committing to work based on estimated time, but just a more vague idea on how big the task is. The reasoning behind this is that estimates are rarely accurate, so why waste time and energy coming up with hours when they will probably be wrong?


The Sprint

Once we have committed to our backlog items (or have them committed for us), then its time to create tasks and begin work. Tasks come first, and are easily broken down and shared out. This is where our time estimates come in, as each task has a remaining time in hours. Using TFS, this then drives the burn down.
It hasn't always been easy to come up with tasks up front. The first sprint took about a week to get everything in place, due to inexperience. This meant that we burned up for a while, not down. The second sprint was better. We got it all done on day one, and the burn down was a lot more helpful. This time around, the backlog items are not as good as last time, as we are using raw requirements from the customer without a lot of backlog grooming. This is partly due to the requirements being created before we started the Scrum approach, and also due to the lack of time spent working the requirements into backlog items. This is again partly due to inexperience, and also due to me not having a lot, or any, time to look at them seriously before the start of the sprint.


 Test Left

One goal we have which predates the move to Scrum by several months is known as Test Left. This means getting test done early with partial releases from development. Previously we could go through months of development before any real QA besides what developers do themselves, which isn't always adequate, to be honest, especially when it comes to testing freshly built and deployed software. It has been difficult to make sure the development branch is in a place where a build can be created and given to test, and that we know that the components will install ok, and work as expected. It's ok testing something on your own machine, but can you be sure it will work for someone else?
That's a challenge I'm still trying to work out, and probably my biggest problem at the moment.



Coding is nice, but I feel like I'm doing less and less of it. Once problem is that it requires a lot of concentration. One big complaint developers have is about interruptions.When you are in the middle of some gnarly code, you are thinking about that one thing only. Being interrupted at that point is annoying and very disruptive. That's something I try and keep in mind when working with other developers in my team. It doesn't work to well when I'm the one trying to avoid interruptions though.



Demos are hard. You get all your code working nice on your development environment. The test team get it working for them. You run through the demo at the office, and everything works fine. Then, when you're in front of the customer, it all falls apart.
Lessons from this: have complete control of your environment, and have a backup plan.


Control your Environment

Corporate networks are usually finicky things. Even if you manage to get to the outside world, it doesn't mean that something won't interfere with your communications. Best to host everything in one place, e.g. a VM on your laptop, or in the cloud, provided you at can at least fall back to mobile internet if the client's network fails you. Trying to connect a device over a network you've never used before is a recipe for disaster.


Backup Plan

Your demo isn't working. What do you do? Just sit there staring at your hands, hoping everyone will forget about you, get up, and leave? Being able to fall back on mobile networks, VMs hosted on your laptop, or even videos of the demo recorded previously enable graceful degradation of your demo.

There's nothing like a bad experience to make you help you learn the right way though.

Monday, May 19, 2014

Quick Non-update

It's been a long time since I've blogged anything. I've moved to the UK since then and turned 30. My main interests now are learning mobile development (as before, this doesn't include Window Mobile as that's the day job), web development, especially with things like Flask and Django because I like Python and its free, and making games, because that's why I got into the whole programming thing over 2 decades ago anyway.

Saturday, June 23, 2012

Lazy List in C#

I was playing around with some F# code and thinking about lazy lists in Haskell and how I could get them in F#. Well, since I know how to make an enumerable function in C# I decided to have a go making one in that instead.

void Main()
foreach (var i in LazyRange(1, (n) => ++n).Take(10))


var fizz = LazyRange(1, (n) => ++n)
.TakeWhile(n => n < 1000)
.Where(n => n % 3 == 0 || n % 5 == 0)


IEnumerable<T> LazyRange<T>(T start, Func<T, T> successor)
T value = start;
while (true)
yield return value;
value = successor(value);

To use it supply a starting value and a function to provide each successive value. Use Take or TakeWhile to limit the collection otherwise you will end up with an infinite list.

Friday, April 6, 2012

Long overdue update

I’ve had a lot going on in the past 18-months. Earthquakes in Christchurch for one, moving to the United Kingdom for another. Still, no real excuse not to be updating my blog, except maybe some programmers block.

While work sometimes sees me going weeks without writing much code, or even days without writing any, I try to keep myself busy with programming projects which I tend to pick up and put down again.

Learning new programming languages is an interest of mine, and one I’ve started using on a regular basis is D. It is a nice language to work in and feels to me to be most like a mix between C++ and C#, both languages I am quite familiar with. The D language seems to be quite mature, and the standard libraries are catching up, but the developer ecosystem isn’t anywhere near the more popular mainstream languages. Tools are a bit lacking right now too. This hasn’t stopped me on embarking on a few projects.

The first is Project Euler. The site contains a list of mathematical problems to solve, with the intention you write a program to do so. Going through these problems got me up to speed with D a lot quicker than just messing around with a tutorial. I haven’t been on in a while but I did get up to 63 problems solved.

The second project goes back to a long running interest of mine in ray tracers. Simply put a ray tracer renders a 3D scene by calculating a ray from a camera to a point on the screen (usually at least one per pixel), and determining what objects in the scene intersect with the ray. Then you perform some calculations based on the vectors at that intersection point to work out what colour it is. My first ray tracer was written about 6 years ago as part of a University assignment and I’ve been hooked ever since. Unfortunately I haven’t worked on a single program for 6 years, I’ve worked on several iterations of the same program over that time not really making much progress. My latest version is in D, and with a couple days of work taking the better C++ code I had and converting it to D I have yet another basic ray tracer. If I do more work on it more in the future it may become a topic for the blog.

More recently I have become interested in creating programming languages. It started with an idea on how you could turn a Reverse Polish Notation calculator into a language. The basic RPN interpreter is a typical student project. I know I made a couple during my study days. A bit of research on the idea lead me to Forth, which I ended up half (or a third) implementing in D. I then got a bit more ambitious and tried to come up with a more complex calculation only to get bogged down in details again. That design process is still on-going though so I might just make something of it yet.

With programming languages on my mind this put me in an appropriate mood to be receptive of the new project of Markus ‘Notch’ Persson, 0x10c. In summary it is an MMORPG set in the distant future in space. The most interesting part of this game is each player’s ship comes with a fully programmable computer, based on the fictional DCPU-16 chip. It is a very simple 16-bit processor and the spec is available so it isn’t surprising that emulators and assemblers are turning up everywhere. I’ve even written an emulator in D over a couple of nights and I’m planning an assembler next. It might even be interesting to implement a simple Pascal compiler for it.

Sunday, October 31, 2010

Playing with Minecraft levels

Minecraft is currently the only PC game I play these days. All my other games are on consoles. If you don’t know what Minecraft is, you can start here, but in a nutshell it is a freeform sandbox game set in a randomly generated world where you can mine and build.

Having spent some time playing I’ve built up a complicated network of structures and tunnels in search of those elusive diamonds (have not found them yet). It would be nice to have an alternative way of visualizing that world, so with that in mind I ignored the other mods and tools out there and set about writing my own.

The first tool is a NBT file to TXT converter. NBT stands for Named Binary Tags and is a format created by Notch for his Minecraft game. Following the documentation on the website I created a tool written in C# to read the compressed data files and turn them into a human readable format. The tool doesn’t understand what is in the files beyond the tags, which are essentially the metadata. The next step is to create something that understands the level format and is able to display the world in some way, such as a 2D map.

The tool is reasonably simple. It opens the target file into an uncompressing GZip stream and starts creating Tags. The Tag abstract class takes care of parsing basic data types and parsing the Tag Type to get the actual Tag derived object created. Each derived type parses its payload of data, which in the case of a List or a Compound will consist of other tags read recursively. Once that is done I write everything to another file by recursively calling the tree of Tags.

I should be doing some more Android programming but I have to admit little projects like this are more fun for me :).