Monday, April 09, 2012

TopShelf Service won't install

I created a Windows service using TopShelf and for the life of me I couldn't get it to install. I followed the Command Syntax from http://topshelf-project.com/documentation/command-line-syntax/ and the install process ran with no error. But when I did net start myservice, I get "The service name is invalid." After a lot of head scratching, I realized I need to run the install process as an Administrator. Anyway, I put it here just in case someone has the same problem I have.


Saturday, April 07, 2012

Dell XPS 15z active window randomly lost focus

I have been using the Dell XPS 15z for a few months and it has this really annoying bug that drive me crazy. Some how my active window would lose focus and I have no idea why. I look at the task bar and there appears to be no other active window. This is especially frustrating while writing code. After doing a little research, I cut and paste together a little utility that helps pin point the thief. It was Dell quickset.exe util. Further research reveal that the ambient light sensor trigger quickset.exe which in turn steals the focus from the active window. You can read more from this forum, http://en.community.dell.com/support-forums/laptop/f/3518/t/19393785.aspx?PageIndex=3.

Here is the code to my little utility. I didn't come up with the idea nor the code.
https://bitbucket.org/tuesdaysiren/detectfocusstealingprocess/overview

There doesn't seem to be a fix for the problem except taping over the sensor. The only temporary fix is to adjust the back-light by pressing Fn + F6.

Friday, April 06, 2012

Partial declarations of must not specify different base classes

I am working on my first WPF application and I decided to clean up my code and moved all common properties into a  base class for all my user controls. I hit this error, Partial declarations of must not specify different base classes. After a few minutes of head scratching, I found this post,
http://blog.peterlesliemorris.com/archive/2009/07/23/partial-declarations-of-must-not-specify-different-base-classes.aspx, by Peter Morris that fixed the problem. Basically, the base class is declared in the xaml.

Basically, just change your xaml from
<UserControl x:Class="MyApp.MyUserControl" />
to
<local:BaseUserControl
  x:Class="MyApp.MyUserControl "
  xmlns:local="clr-namespace:NameSpace.To.Your.BaseClass"
  />

Yes, I copied the sample from Peter Morris's post.