Notebook FanControl custom use

A user called Grantig on computerbase.de created the tool Notebook FanControl. It is written in C# and uses WCF for communication with a backend service. Using JustDecompile and the information from the config I managed to build my own front-end.

Image courtesy of bplanet
Image courtesy of bplanet / FreeDigitalPhotos.net

The Fancontrol client uses a DispatcherTimer for interval updates. A DispatcherTimer is close related to WPF and needs some extra work for unittesting and other non-WPF programs. So I’m using polling.

// simplified code
var model = new NbfcServiceClient.ViewModels.MainWindowViewModel();
model.PropertyChanged += (s, e) => 
    Console.WriteLine(model.CpuTemperature);
var client = new NbfcServiceClient.FanControlClient(model, 10);
client.StartFanControl();

// polling (done recursive)
Task.Factory.StartNew(() => {
    client.UpdateViewModel();
    Thread.Sleep(10000);
};

References

How to Test a Class Which Uses DispatcherTimer by Josh Smith.
My sources on Github

Posted in Development | Tagged , , | Leave a comment

Week 5 roundup

Last week recap and links:

Image courtesy of kanate / FreeDigitalPhotos.net

Image courtesy of kanate / FreeDigitalPhotos.net

What are your best reads this week? Leave them in the comments below.

Posted in Uncategorized | Tagged , , , , | Leave a comment

Add tracelistener with powershell

In our deployment script we automate the installation and configuration of our product. For Development and Test environment we want to log everything to a file. The powershell script below takes care of adding TextWriterTraceListener to the trace listeners.

$configFile = "YOUR_CONFIG_FILE"
$xml=New-Object XML
$xml.Load($configFile)
# locate the sharedlistener with name TextFileLogListener
$tracelistenernode = $xml.SelectSingleNode("/configuration/system.diagnostics/sharedListeners/add[@name='TextFileLogListener']")
if (!$tracelistenernode)
{
    # filter on eventtype Information
    $filter = $xml.CreateElement("filter")
    $filter.SetAttribute("type", "System.Diagnostics.EventTypeFilter")
    $filter.SetAttribute("initializeData", "Information")
    # TextWriterTraceListener in shared listeners
    $tracelistenernode = $xml.CreateElement("add")
    $tracelistenernode.SetAttribute("name", "TextFileLogListener")
    $tracelistenernode.SetAttribute("type", "System.Diagnostics.TextWriterTraceListener")
    $tracelistenernode.SetAttribute("initializeData", "c:\\log.txt")
    $tracelistenernode.AppendChild($filter)
    $xml.configuration.'system.diagnostics'.sharedListeners.AppendChild($tracelistenernode)
    # TextFileLogListener in tracelistenerd
    $listener = $xml.CreateElement("add")
    $listener.SetAttribute("name", "TextFileLogListener")
    $xml.configuration.'system.diagnostics'.trace.listeners.AppendChild($listener)
    # write the config changes to disk
    $xml.Save($configFile)
}

works-on-my-machine
The filter is set to Information. This means everything is logged and you can end up with a huge file. Feel free to use the script, but you do this on your own risk.

Posted in Development | Tagged , , | Leave a comment

Xamarin iOS development

I’m creating an app for personal use. Here’s what I’ve learned so far.

  • Installation of the SDK and Xamarin is easy. Just download and install. I’ve chosen the starter (free) plan.
  • To run the app without an Apple iOS Developer license you must change the target to emulator. (step 25 in the Quickstart) Else you’ll get the following build error

    No valid iPhone code signing keys found in keychain.

  • Use the storyboard feature for adding views since the xib synchronization with xcode seems broken
  • If your app is showing an expiry time, … do a clean rebuild

This post will update when my project progresses.

Posted in Development | Tagged , | Leave a comment

Week 4 roundup

Last week recap and links:

Image courtesy of kanate / FreeDigitalPhotos.net

  • Seems like LiveDocumenter has got an update to 2.0. I’ve been using it for some time to view my documentation as I was programming.
  • Aure friday is my main source to keep up with what’s new in the Microsoft cloud. Websites testing is an awesome feature with lots of uses.
  • Those guys (and girls) at Trello keep posting good uses for their product. Reading Trello editorial calendar, I found the list of twitter lines an eye opener.

Image courtesy of kanate / FreeDigitalPhotos.net

What are your best reads this week? Leave them in the comments below.

Posted in Uncategorized | Tagged , , , , | Leave a comment