January 5th, 2009

In an earlier post I looked at how I could add my own icon to the Gnome Notification area from my Mono C# applications. The next thing I wanted to do was to show a notification in the taskbar to the user when something truly important happens. If you are running Ubuntu Intrepid (8.10) then its easy to create them from Mono. As I found out, Hoary (8.04) doesn’t include the required libraries.
Read the rest of this entry »
Posted in Beginner, GTK, Learn C# | 1 Comment already!»
January 2nd, 2009

Cool (Linux) applications have their own icon in the notification area. To add my own icon in the Gnome notification area using Mono only took a few lines of code. In the post below I show how you can add your icon and associate a tooltip and right click menu to it.
Read the rest of this entry »
Tags: GTK, Learn C#, mono, StatusIcon, Tooltip
Posted in Beginner, GTK, Learn C# | 2 Comments - getting there! »
January 1st, 2009
Sorting a basic generic list in C# is trivial as long as you store basic elements such as strings or integers for which default comparison classes have been defined. In this post we will look into how we can reverse the string sort by implementing your own ICompare comparer, and how you can build your own comparison routines to compare other types. In the example we sort a list (List<>) of people by both their name and their age.
Read the rest of this entry »
Tags: generic, ICompare, Learn C#, list, quicksort, sorting
Posted in Beginner, Learn C# | No Comments, yet!
December 30th, 2008
In a previous post I looked at how to build a very simple linked list in C#.. That class had many problems, including that it exposed quite a bit of its inner workings to the outside world. In this post I will introduce a C# generic LinkedList class that implements the Java LinkedList specification and behaves accordingly. I used this opportunity to explore how to apply unit testing with NUnit to effectively test the development process.
Read the rest of this entry »
Tags: linked list, nunit, unit testing
Posted in Algorithms, Beginner, Learn C# | No Comments, yet!
December 30th, 2008
Unit testing with NUnit is deeply integrated into Mono. The Mono code itself uses NUnit extensively to test its own functionality. In this post we look at how you can enable unit testing for your own code under MonoDevelop. In an earlier post I looked at how to install NUnit for Visual Studio 2008 Express, in this post we do the same for MonoDevelop.
Read the rest of this entry »
Tags: monodevelop, nunit, unit testing
Posted in Beginner, Learn C# | 4 Comments - getting there! »
December 29th, 2008
There is re-markedly little honor in building your own linked list class in C#. The standard libraries provide a solid implementation in the LinkedList generic class. The point of languages such as C# and Java is of course that code re-use should be the top priority, so why re-invent one of the most elementary wheels of computer science? In this post I will look at why you could use a linked list, and how they work.
Read the rest of this entry »
Posted in Algorithms, Beginner, Learn C# | 1 Comment already!»
December 29th, 2008
As soon as I heard that the MonoDevelop Subversion code included support for actually debugging my C# code I tried installing it to give it a go. Optimistically I kept notes, figuring that it would be useful to write a post about the install process later. As my notes started to turn into a book, and the arrows back and forth and crossed out scribbles increased I gave up on writing the ultimate “ten step guide to installing Monodevelop on Ubuntu”.
When I finally had MonoDevelop compiled and installed — the promised debugging didn’t actually work. Bummer. I gave up, and went back to coding the old way (with ticker tape). This morning I checked out the latest SVN, installed it and ran it, just for laughs.
And behold as shown below — debugging actually worked. I can step and trace through the code, and set watches making MonoDevelop suddenly that much more useful to me.
The best thing? The Mono C# libraries are not black boxes but open source — you can step and trace directly into the Mono libraries themselves and find out what Mono is doing as you call library functions.

The problem with installing MonoDevelop 2.0alpha 2 is that the guides online don’t actually produce a working MonoDevelop installation. If you run MonoDevelop under Ubuntu like I do, the number of dependencies and sub-dependencies you need to resolve is large and I ended up compiling, re-compiling and changing version numbers of modules multiple times to find combinations that worked. In addition I had to change, add and resolve many missing library conflicts within Ubuntu as well.
Concluding: Yes, it is possible. Just do not expect a quick and easy install of MonoDevelop 2.0 alpha 2 on your Ubuntu installation.
This is fun only if you have plenty of spare time.
Some hints — this does not produce a working Mono Develop installation
- Remove Mono 1.9, MonoDevelop 1.0, and any and all other mono related things from your ubuntu installation before attempting to compile MonoDevelop 2.0 Alpha 2 to avoid conflicts down the road.
- Install mono 2.3, the debugger and mono develop from SVN, not from the packages provided on the website (they do not work)
- $ svn co svn://anonsvn.mono-project.com/source/trunk/mono
$ svn co svn://anonsvn.mono-project.com/source/trunk/mcs
$ svn co svn://anonsvn.mono-project.com/source/trunk/debugger
$ svn co svn://anonsvn.mono-project.com/source/trunk/mono-addins
$ svn co svn://anonsvn.mono-project.com/source/trunk/olive
$ svn co svn://anonsvn.mono-project.com/source/trunk/monodevelop
- I installed gtk-sharp-2.12.5, gnome-sharp-2.20.0 and libglade-2.0.1 as support libraries
- Compile and install monodevelop last of all
Mono JIT compiler version 2.3 (/trunk/mono r121276 Thu Dec 11 13:04:53 CST 2008)
Copyright (C) 2002-2008 Novell, Inc and Contributors. www.mono-project.com
Tags: Learn C#, monodevelop
Posted in Intermediate, Learn C# | No Comments, yet!
December 12th, 2008
This post looks at how to implement a binary tree using generics in C#. A binary tree is a data structure in which each node has at most two children. They are a good way to store unsorted data, as the data becomes sorted as you insert it into the tree.
Another benefit of storing information in a tree structure is the opportunity for faster search times. In an array (or list) you need to traverse the whole array to discover if it contains a particular value. A well-balanced binary tree can drastically reduce the number of look-ups required.
Read the rest of this entry »
Tags: binary tree, generics, Learn C#
Posted in Algorithms, Beginner, Learn C# | No Comments, yet!
December 10th, 2008
It is often necessary to convert binary data to and from strings. One common way of encoding such information is through Base-64 encoding. The following post shows you how to convert a byte array to a Base64 string , and back again.
Read the rest of this entry »
Tags: base64, convert
Posted in Beginner, Learn C# | 1 Comment already!»
December 9th, 2008

Hash values have many uses in computing: for storing password tokens, securing that a file hasn’t been tampered with, or to create a short semi-unique signature for a larger data set. A hash algorithm takes a data set — such as a string — and turns it into a numeric value of a certain length.
This article will go into how to create a hash of your passwords and how salting them makes them more secure.
Read the rest of this entry »
Tags: crc, hash, Learn C#, md5, salted, sha-1, sha-256
Posted in Algorithms, Intermediate, Learn C# | No Comments, yet!