Archive

I’ve been having some problems with Cinnamon’s default lock screen cinnamon-screensaver not reliably being active after resume. Sometimes my screen was still visible for a blink of an eye, sometimes it didn’t even activate at all (often coinciding with hangs of Cinnamon, e.g. caused by FUSE).
In order to fix this I created a simple systemd service following the template in the Arch Wiki.

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).

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).

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).

Ever tried deleting a project from TFS? If so, then you found out that there is no GUI option for this.
Some minutes ago I found a nice CodeProject article describing the needed procedure to get rid of a project. In short: use the tfsdeleteProject command ; )

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();