Archive

Archive for the ‘.NET / C#’ Category

GraphicsSwitcher 1.0.1.0

November 17th, 2009 2 comments

Just uploaded an improved version of GraphicsSwitcher.

Changes:
– When hovering over the tray icon it is displayed which graphics adapter has been activated
NOTE: Switches made through PowerManager are not detected (That’s on my todo list for the next days).

Download

Automatic graphics switching in Windows 7

November 12th, 2009 1 comment

A feature I liked very much was the automatic graphics switching depending on the used power source that the Catalyst Control Center offered on my T400 in Vista. For those not knowing what I am talking about: some Lenovo notebooks are equipped with two graphics chips – one saving energy and one having more performance. In Vista / Windows 7 a dynamic switching between these chips is possible.
One (constructional?) flaw the T400 has is that only this high performance adapter is connected to the digital video output. This makes it necessary to use the high performance card for displays connected via DVI. Still I want to use the energy saving adapter when I am on the road as it gives at least 25% longer runtimes on battery.
Bottom line: Automatic switching would be great in Win 7.

Some days ago I stumbled over an article (link below) describing how to use Lenovo’s PowerManager libraries to switch the active graphics adapter and decided to implement the automatic switching myself.
To avoid trouble with Lenovo my graphics switcher does not need the PowerManager libraries in its folder but rather loads them from the PM directory (provided PM is installed).

Download GraphicsSwitcher (executable and source)

Usage:

  • Extract the bin folder to a location of your choice
  • Run GfxSwitcher.exe
  • Automatic switching now occurs on power source changes
  • To quit GraphicsSwitcher right click the belonging tray icon (right in the task bar) and click Close

Warning: Please use GraphicsSwitcher carefully (save documents before power source changes) as the current version of Lenovo’s graphics drivers are not perfect yet and tend to crash sometimes (which happens as often when you switch using PowerManager).

Licence: MIT licence, see licence.txt in the downloaded archive.

Source (graphics switching using PowerManager libraries): http://zabadab.eu/switchablegraphics/

TypeBuilder is a Type!

June 4th, 2009 Comments off

Today, although it would have been quite obvious by simply reading the MSDN (yes, RTFM fits in this situation), I spent some minutes searching for a way to dynamically create two mutually referencing classes via TypeBuilder. What I was looking for was a way to generate something like:

class A { public B b; }
class B { public A a; }

My first attempt was to create A without any fields, use the type to generate B and modify the former afterwards. As one cannot change a type once TypeBuilder.CreateType() has been called, that attempt failed.
After some searching I found out that TypeBuilder is a subclass of Type. Knowing this, the initial problem is easily solvable through:

TypeBuilder aBuilder = moduleBuilder.DefineType(…);
TypeBuilder bBuilder = moduleBuilder.DefineType(…);
aBuilder.DefineField("b", bBuilder, FieldAttributes.Public);
bBuilder.DefineField("a", aBuilder, FieldAttributes.Public);
aBuilder.CreateType();
bBuilder.CreateType();

Once again the simplest solution was the best.

Categories: .NET / C#, English, Programming

Introducing PET – Process Enactment Tool

May 24th, 2009 Comments off

Es war nun lange Zeit still um mich und meinen Blog. Von der hierfür eingeplanten Zeit floss ein Großteil in die Weiterentwicklung und Fertigstellung von PET.

Das plastische Akronym steht für ein Framework – entwickelt am Lehrstuhl für Software- und Systems-Engineering der TU München – welches die Forcierung von Prozessen unterstützt. Unser ursprüngliches Ziel bestand in der Abbildung eines prozessspezifisch angepassten V-Modell XT auf Microsofts Team Foundation Server 2005/08 und somit in der Ablösung des bestehenden Werkzeugs CollabXT.

Schnell stellte sich heraus, dass bei sorgfältigem Design des Frameworks eine Abbildung beliebiger Prozesse auf beliebige Tools möglich ist. PET war geboren.

Alle Besonderheiten des erstellten Frameworks aufzuzählen würde die Länge eines gut leserlichen Blog-Eintrags sprengen, deshalb hier nur einige Kernpunkte:

  • Liest beliebige Prozessmodelle und erzeugt daraus Eingabedaten für prozessunterstützende Werkzeuge
  • Benutzerfreundlicher Konvertierungsassistent für Windows XP, Vista, Server 2003/08
  • Vollständig lokalisiert in Deutsch und Englisch
  • Dynamische geladene Plugins zum Lesen des Prozessmodells
    • Im aktuellen Release ist ein Plugin für das V-Modell XT enthalten
  • Dynamische geladene Plugins zum Erstellen von Werkzeugvorlagen und direkten Endprodukten
    • Plugins für Microsofts Team Foundation Server, SharePoint und Word 2007 liegen bereits vor
  • kompletter Quelltext in C#, .NET 3.5
  • Open Source

Bei Interesse verweise ich auf die Codeplex-Homepage des Projekts: http://pet.codeplex.com. Hier finden sich eine ausführliche Beschreibung des Projekts, sowie die Programmdateien. Bald folgen an gleicher Stelle der vollständige Quelltext von PET, sowie eine Ausarbeitung über die inneren Strukturen des Systems.