## codingkata.net – warm up test with fizzbuzz

First try and five minutes later I’ve got a passing solution, the Kata really makes you think about what you’re coding a bit more – I’m now hooked and I’ll be completing more Katas! You should try it at: Coding Kata.

```using System;

namespace KataFizzbuzz
{
// Any number divisible by three is replaced by the word fizz and any divisible by five by the word buzz.
// Numbers divisible by both become fizzbuzz. A player who makes a mistake has to take a drink.
// Einstein will choose a random number to start with – for example: 4, buzz, fizz, 7, 8, fizz, buzz, 11, fizz, 13, 14, fizzbuzz

public class FizzBuzzKata : IFizzBuzzKata
{
static void Main()
{
var fb = new FizzBuzzKata();

var r = new Random();

while (true)
{
var seed = r.Next(0, 1000);

Console.WriteLine("FizzBuzz number selected {0}", seed);

Console.WriteLine(result);

Console.WriteLine("Press q to exit or any other key to play again.");

if (input != null && input.Equals("q"))
{
break;
}
}

}

{
var result = i.ToString();

if (i % 3 == 0)
result = "fizz";

if (i % 5 == 0)
result = "buzz";

if (i % 3 == 0 && i % 5 == 0)
result = "fizzbuzz";

return result;
}
}

public interface IFizzBuzzKata
{
/// <summary>
/// Give an answer to the current game
/// </summary>
/// <param name="number">current number in the game sequence</param>
/// <returns>appropriate answer to the current number</returns>
}
}
```

## codingkata.net

We’ve all got to stay sharp when it comes to coding, I’ve been looking at a few sites that might help with this. codingkata.net is one that claims to help by allowing you to practice code kata, I’m going to have a go and report back on how it helps.

## A slightly better Wget spider syntax

Updated to to add a few more command line switches.

`wget.exe --recursive --spider --bind-address=localhost --verbose http://localhost --random-wait --no-directories --server-response`

## Using GNU Wget to spider a local site

Wget has lots of options but this is the simplest configuration for spidering a website.

```wget.exe --spider --bind-address=localhost --verbose http://localhost --recursive ```

## JavaScript parse query string values

A quick post on how to use JavaScript to retrieve a query string value.

```   // Function to parse the querystring
getQueryString= function(sVar) {
return unescape(window.location.search.replace(new RegExp("^(?:.*[&\\?]" + escape(sVar).replace(/[\.\+\*]/g, "\\\$&") + "(?:\\=([^&]*))?)?.*\$", "i"), "\$1"));
};

// Get the value
```

## .Net C# the default keyword

Default returns the default value when the applied type has not been initialized.

```using System;

namespace CsharpDefaultDemo
{
class CsharpDefaultExample
{
/// <summary>
/// Defines the entry point of the application.
/// </summary>
static void Main()
{
var testOne = default(StringComparer);
var testTwo = default(int);
var testThree = default(bool);
var testFour = default(MyClass);
var testFive = default(long);

Console.WriteLine(testOne);
Console.WriteLine(testTwo);
Console.WriteLine(testThree);
Console.WriteLine(testFour);
Console.WriteLine(testFive);

}
}

/// <summary>
/// Simple class for demonstration
/// </summary>
public class MyClass
{
}
}
```

Returns:

```0
False

0

```

## Umbraco 7 first look and installation

I’ve recently been involved in a project deploying an open source .Net based CMS called Umbraco. It’s been interesting to compare it to more mature products like Microsoft SharePoint and in particular the web content management features.

First step is to install from source, this is a quick post to show the installation steps:

1) Grab the source (7.0.1) from GitHub

2) This is how the 7.0.1 source tree looks:

3) Initial install screen

6) Install the database

8) Starter kit screen

9) Install a starter kit (or not in this case)

10) Complete the setup.

I’ll be looking more at Umbraco 7 and how the development process works, this will happen in future posts.

## Hadoop and Cloudera in a virtual machine

I’ve been trying out the Cloudera Hadoop virtual machine, looking at different tools that can help with managing ‘big’ data. There’s a useful post on using the Cloudera CH4 virtual machine on ZDNet.

## .Net C# dynamic typing

C# 4 introduced dynamic typing into the language specification, this give the developer the ability to declare something that can be decided at run-time rather than compile-time. One of the advantages of this feature is the ability to deal with uncertain types such as objects returned from COM. It also allows C# to emulate the behaviour of languages such as: Perl, Ruby, Python etc.

```using System;

namespace CsharpDynamicDemo
{
class CsharpDynamicExample
{
static void Main()
{
dynamic dynamicVariable = "Hello I'm dynamic.";

const string staticVariable = "I'm static.";

Console.WriteLine(dynamicVariable.GetType());

Console.WriteLine(staticVariable.GetType());

```System.String