Fill a dictionary with properties of a class

Following scenario… you need to create a key/value configuration file within a configuration class. Properties are the Keys and their value is the value ;). Values for the properties need to be assigned automaticly when the “configuration file” is loaded, in a way that the class can be extended with new properties and no new code needs to be added.

One of the solutions I found, was to use a Singleton-Pattern with

that holds all the property keys and values.

Lets walk this through with a real life example. Nlog is used for logging. At the End you can see the whole class, but first let us go through everything step by step.

First the properties:

The “ConfigurationSet” Property is not used in the configuration file. It can be used for other parts of the program to find out if the configuration has been loaded and the properties have values.

Then there is the Dictionary as <string, object> and the singleton with the private and static constructor, this is thread-safe!

for more information on singletons, see: http://csharpindepth.com/Articles/General/Singleton.aspx

The last Members are the Configurationfolder, the configurationfilename and the logger (nlog).

Posted in C#, PC, programming, Sonstiges, Wissen, Work | Tagged , , , , | Leave a comment

Warum Qualitätssicherung wichtig ist!

In die Qualitätssicherung von Software wird grundsätzlich zu wenig investiert (Projekte sind zu knapp geplant, Budget wird für andere Bereiche aufgebraucht, etc.). Wieso dies ein Fehler ist oder warum gerade in systemkritischen Bereichen der Softwaretest nicht zu kurz kommen darf, zeigt Linux nach der Installation auf bestimmte Thinkpads auf.

Sollte auf einem Thinkpad mit UEFI Bios, Linux installiert oder sogar eine Festplatte mit Linux  eingebaut werden, wird das Notebook irreparable beschädigt.

Quelle: Heise.de

Posted in Deutsch, Languages, PC, programming, Sonstiges, Testing, Work | Tagged , , , , , | Leave a comment

Nature One 2014

This year again 😉 to the nature one… 20 year anniversary 😉

will be fun, we say,
will be cool we say!

www.nature-one.de

Posted in Events, Music, Spaß | Tagged , , | Leave a comment

User Clean UP

Deleted all users with Zero (0) posts ;), well at least all that I didn’t know.

Posted in administration | Leave a comment

New Flat

This gallery contains 6 photos.

One month ago I moved into a new flat and I’m renovating the living room 😉

More Galleries | Leave a comment

New sound from south africa

Fantastic new sound from south Africa, absolutely must hear 😉

Die Antwoord – Baby’s on fire

Die Antwoord – I Fink U Freeky

Official Youtube Channel: http://www.youtube.com/user/ZEFRECORDZ

Official Website: http://www.dieantwoord.com/

Itunes Link for the new Album “Ten$ion: http://itunes.apple.com/us/album/ten$ion/id497643650?ls=1

 

Update: Here is another one, from the Album $O$

Die Antwoord – Enter the Ninja

Posted in English, Languages, Music, Youtube | Tagged , , , , , , , , , , , , , , | Leave a comment

Fei Fei

Currently listening to one of my favorite djs FeiFei 😉

 

here is the direct link: http://soundcloud.com/fei-fei/fei-fei-feided-1032-hold-da-f

Posted in English, Languages, Music | Tagged , , , , | Leave a comment

Kleine und Große Quadratische Lösungsformel

Allgemeiner quadratische Funktion: $latex ax^2 + bx + c$

Die “große” Lösungsformel: $latex x_{1,2} = \frac{-b\pm\sqrt{b^2-4ac}}{2a}$ wird angewendet wenn $latex a$ ein numerischer Wert größer 1 ist.

zb.: $latex 3x^2+2x+3$ oder $latex 3x^2+2x$

Die “kleine” Lösungsformel: $latex x_{1,2} = -\frac{p}{2}\pm\sqrt{(\frac{p}{2})^2-q}$ wird angewendet wenn $latex a$ den numerischen Wert 1 hat.

zb.: $latex x^2+4x+2$ oder $latex x^2+4x$

weiterführende Informationen können in der Wikipedia nachgeschlagen werden: http://de.wikipedia.org/wiki/Quadratische_Gleichung

Posted in Deutsch, Mathematik, Wissen | Tagged , , , , , , , | Leave a comment

Simple Hello Kitty with C#

How to create a Simple “Hello Kitty” with C# (Console Application)

First we create a “Console-Application-Project” within the Visual C# Express Studio

Create a new console Project within Visual Studio Express C#

 

The Console Project Name can be anything you like (ex. HelloKitty)

After pressing “ok” the File Program.cs will be opened.

It will look something like this:

Program.cs

With the codeline: System.Console. you can work with the console “window”, display data, read data, etc.

To Display a normal text you use the function “WriteLine”, which writes a line of text. If you want to write just one character, you can use “Write” instead.

If you compile the program, the console window will be closed instantaneous, to prevent this behavior, we wait till the user enters at least one character.

This can be achvieved with the functions “ReadKey”, “Read” or “ReadLine”. The difference between those functions is that “ReadKey”, reads exactly one character and displays this character on the console, “Read” reads just the next character and “ReadLine” reads the whole line on the console application.

It should look like this now:

After compiling the program, it should open a console window and display the text which has been entered after the  “WriteLine” command:

Hello Kitty

Posted in English, Languages, programming | Tagged , , , , , , , , , | Leave a comment

Mein Blog lebt…

… ab und zu zumindest 😉 *gg*

Wink

Posted in Music | Tagged , , | Leave a comment