1. Computing & Technology

Discuss in my forum

David Bolton

C / C++ / C#

By , About.com Guide

Follow me on:

Wintellect Power Collections for .NET

Monday May 14, 2012

Although it's almost five years old, this collection of collection classes is still very handy to have and compliments that which comes with C# 4.0. Wintellect is a name associated with Jeffrey Richter who wrote the C# CLR book which I'll be reviewing shortly.

The code has a good reputation; it's well written and includes a set, deque, a bag, biglist, multi dictionary and ordered dictionary as well as some similar to those with C# 4.0 (Dictionary, Hash). It comes with a .chm (Windows Hypertext help file) documenting it. Don't forget to right click and unblock that or it won't work.

Friday Puzzle and Empire AI Design Doc

Sunday May 13, 2012

I asked if the C# was valid (it was) and what the values of a and b would be. It was valid C# with a = 1, b = 2. As the two variables are static they have a default value of 0 before the initializers are executed.

Empire AI Design Doc

Before the Empire C Game programming tutorials start, I thought I'd explain how the AI for the computer player will work. You can read it in the Computer Empire AI Design Spec, the first of 2 or 3 tutorials on the AI.

Programming Puzzle + Mud Server

Saturday May 12, 2012

The Thursday puzzle was C# as correctly guessed. It's a little known fact that the @character is valid in an identifier and this allows lines like class @class etc.

You can find this and other interesting but obscure parts in the C# 4.0 language specification. There's a 2.9MB downloadable htm version of it available from Microsoft.

Mud Server

In a past article I suggested it would be possible to create a Mud Server. Actually a bit more powerful than Mud, more accurately described as a text interface MMO, that can be accessed via a web browser so I'm having a go at writing one.

I've published the first spec. which is more of a design document and says how it's going to be implemented.

Programming puzzle Is this C# Valid?

Friday May 11, 2012
using System;

class Test
{
   static int a = b + 1;
   static int b = a + 1;

   static void Main() {
      Console.WriteLine("a = {0}, b = {1}", a, b);
   }
}

Without compiling it, can you say (a) if it will compile and (b) if it does, what values will it output? Answer on Sunday

Programming Puzzle - What Language Is this?

Thursday May 10, 2012
using System;

namespace ke
{
    class @class
    {
        public static void @static(bool @bool)
        {
            Console.WriteLine(@bool ? "true" : "false");
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            @class.@static(true);
        }
    }
}

Answer on Saturday. Oh and it is valid. It will most certainly compile and run on .NET!

Native Client Now Supports Mono

Wednesday May 9, 2012

The best way to track this is to subscribe to the Native Client Discuss on Google Groups. Elijah Taylor of Google posted an update today that Mono for Native Client is now available through the SDK.

Please bear in mind that this is "Bleeding Edge" development, ie somewhere between new and alpha. Every build increments the sdk_revision and it's up to 134804 for naclmono_20. But if you like dabbling, it can be quite fun and of course it's for Linux/Mac and Windows.

Course if you're interested in C/C++ on Native Client.

The Development of C - History

Monday May 7, 2012

If you've ever wondered how the C language came into being, wonder no more. A paper by Dennis M. Ritchie, published nearly twenty years ago explains the history in quite some detail and how various features came into being almost forty years ago.

Despite coming to C fairly late, I learnt C++ first in the mid 90s, the most C code I have written has been for the C programming tutorials and more recently the C Game programming tutorials. for anything involving string processing though I prefer C# but I've grown quite fond of C for other stuff.

The markings of Challenge 57 are on hold while I wait back for the answer to a query to an entrant.

A Data to Source Code Generator in C#

Sunday May 6, 2012

Here's another small C# project I've developed with source code. As part of the Asteroids tutorial, I'm developing the high accuracy collision detection. (Collision detection.).

That generated a lot of numbers that need to be in the game, so this new utility (runs rom the command line) takes numbers in a text file and wraps them in source code as a constant array. You can specify which language (C, C++ or C#) as there are subtle differences.

PS. I've started marking Challenge 57. results hopefully tomorrow.

Microsoft's Windows Development Plans

Thursday May 3, 2012

Unless you've been living under a rock, you'll know that Windows 8 isn't that far away (months I think), and there are betas available. Plus you can download Visual Studio 11 Beta and .NET Framework 4.5. These can be installed and run alongside .NET 4 and Visual Studio 2010. You can even use these two new betas to develop code and deploy it in a production environment, which is unusual but good.

There's also a Visual Studio 11 Express which lets you try developing for the Consumer preview of Windows 8. It provides provides the core tools that are required to build Windows Metro style apps. However so far there's no free equivalent of Visual C++ 2010 Express. There is a Visual Studio 11 Professional Beta (Click Express on the page linked above), but no Express equivalent for non Metro Apps.

With the best will in the world, there's no way that traditional WinForm type programs are going away overnight, but if the free tools to learn programming aren't made available, it would not be good. Of course people can stick with Visual C++/C# 2010 Express but it's not the same and they won't be around for ever.

Intro to 3D Graphics Programming E-Book

Tuesday May 1, 2012
London Eye in 3D

Back when I programmed games for a living (i.e. not long after the Jurassic period) they were simple 2D games. The games that were rendered in 3D by software, apart from a few exceptional ones were quite slow.

Now with high powered graphics chips, you can even get 3D rendering on browser maps (the image above is the London Eye (Needs Chrome) rendered in 3D using the MapsGL in Chrome browser. This is beta I think, but will become mainstream in months not years.

But programming in 3D is a different kettle of fish to 2D and far more complicated. If you're interested, this e-book on Learning Modern 3D Graphics Programming by Jason. L. McKesson is a pretty good place to start. It includes a lot of examples in C/C++.