How to save configuration settings in C#

How to save settings really quick and easy in C # applications? I’m sure this question has been asked certainly by everyone once during his career as C# programmer. And did you know? The answer is quite simple. The easiest way to answer this question is to use the  AppSettings from ConfigurationManager class of the .Net-Framework.
The. Net Framework brings its own managers to save and load settings with it. The properties are stored in the common XML format. And so you can see that dealing with the AppSettings is really a no-brainer , I have written two small functions for saving, changing and reading preferences.

public string getAppSetting(string key)
//Load the appsettings
Configuration config = ConfigurationManager.OpenExeConfiguration(

JavaScript based online Gameboy emulator

Original GameboyIt’s not often that I play games. And if I do, then my favorites are classic games. And yes, I still grow up with a Gameboy. With a large Gameboy.  Since these are no longer available, I have already had one or two emulators in my hands.  But what I’ve found now on the web, I’ve never seen before.
A student named Grant has developed his own Game Boy emulator. The remarkable thing is that it is completely written JavaScript and therefore runs online.
I think that’s an extraordinary achievement. An online demo can be found here. Also Grant has uploaded the sources to github.
The roms, which are needed to play, you have to get by yourself. But a short look over at Google should help you. Because the procurement of roms is in a legal […]

Tutorial: How to create a simple HTML5 JavaScript based progress bar

JavaScript Progressbar
Since I needed a javascript based progress bar for a Web project and I could not find a component that meets my expectations, I decided to write my own progressbar.
The project was implemented in JavaScript with help of the HTML5 canvas element. The progress bar gets along without any image files, as it is usually the case with other JS / CSS progress bar solutions. By default it can handle 100 states (0-100%) and input errors will be caught and visualized.
Since I like to share my developments I present you the progressbar of course. I’m always open for criticism, praise and suggestions.
For a demo / example click here. The source can be found over here: pbar.js
Below I will show you quickly how to use the progressbar.
At first you have to embed the progress bar script […]

How to use gzip on WordPress

gzipSo far I never worried about the page load speed of this blog. But so far I even thought WordPress would use gzip compression on it’s own. Like I said, so far. Today I realized that WordPress is not just doing exactly that.
For those who are lost in gzip, I’ll give a short explanation at first. Gzip is a compression method in order to minimize the size of a file. Today it is mostly used on Unix systems. In the website context, it is used to reduce the size of data which is transferred from the server to the user’s web browser. This not only reduces the traffic and, by implication, the overheads too, but also it brings a reduction of the website’s […]

C# Random.Next(int, int) – how to define the bounds correctly

The devil is in the detail. Recently I wanted to create random numbers between 0 and 1 in C#. The Visual Studio tells us that we have to use Random.Next (int, int) method, whereby the first integer defines the lower limit and the second integer defines the upper limit. No more and no less. So based on Visual Studio’s description the following function should work:

Random rnd = new Random();
int random = rnd.Next(0,1);

Wrong! So you’ll get only one thing – in fact zeros. So I had to dip into the MSDN library to find a solution. There is explained, on the contrary to IntelliSense from Visual Studio, that the lower bound is inclusive and the upper bound is exclusive.


Type: System.Int32
The inclusive lower bound of the random number returned.

Type: System.Int32
The exclusive upper bound of the random number returned. maxValue must be greater than or equal to minValue.

In plain language this means, to […]