WinDays 2012

Illustration

I will hold a presentation on WinDays 2012.

This year theme will be .NET Micro Framework. Although this platform works very close to hardware, I will try to avoid too much electrical engineering theory and just show what can be done with it in practice.

All examples will be shown on Netduino Plus, probably cheapest way to start working with .NET Micro Framework these days.

[2012-02-29: Unfortunatelly, I will not attend. My stay in USA got prolonged and, due to certain limits of physics, I cannot be at two places at same time. :(]

Canon SX230 Communication Error

After taking a lot of pictures in Washington Aquarium, came time to transfer them from Canon PowerShot SX230 HS camera to laptop. And then I was greeted with “Communication Error” displayed on camera’s screen. I tried multiple cables, tried resetting everything, every wiggling motion that I knew, but to no avail.

Quick search on Internet gave hint that this happens when there is too much pictures on camera. I connected SD card directly to computer, deleted some old pictures, reconnected camera and, like magic, it was working again. Happy ending.

For the sake of it, I cannot grasp why idiots who made camera’s firmware thought having 3000 pictures on camera that accepts SDXC cards should be a problem. 16 GB is not even biggest card there is and it was half full. How can you make camera fail on something that should be it’s basic operation?

Even worse they found it necessary to hide such error behind obscure message like “Communication Error”. Which part of that message has any connection to number of files? Only connection what-so-ever was in manual where, as sole source of this message, they said “Images could not be transferred to the computer or printed due to the large amount of images (aprox. 1000) stored on the memory card.” If this is sole source of error, how about giving “Too much files” message. Or “Sorry, but our product is shit if you actually want to transfer images”. Either message would do.

Or, dare I say it, they could fix their broken product…

VHD Attach 3.10

First version of VHD Attach was written in .NET Framework 3.5 SP1. I figured that since Windows 7 comes with it, it has WCF and it is new, there was no reason not to use it.

Just to prove me wrong there came ThinPC. It comes without any .NET Framework and only version that can be installed is 4.0. Yep, that is one that breaks backward compatibility with 3.0 and 3.5. Well, this version is now written in .NET Framework 2.0.

Those who need to create virtual disks had that feature in 3.0x but only for dynamic disks. With this version you can create fixed disks also.

Some GUI refreshing was in order but do not expect anything revolutionary. It is just an evolution, baby.

Download is available from within application or from these pages.

QText 3.00

Since there was quite a stable beta before, I will just quickly rehash what is new.

  • If you have big number of files, you can finally sort them in folders.
  • Corporate users will love that QText will leave no traces if it is not installed (check for zip version).
  • File synchronization tools (e.g. SugarSync or DropBox) should work nicely with QText.

What are you waiting for? Download it.

Simplest Service

Windows service is somewhat considered relic of the past. It is just not sexy enough for users. More often than not I see business applications that need to be always on sitting in tray processing their data. And there is mandatory “do not log off” paper sitting on keyboard.

And I always hear same excuses. My version of Visual Studio does not support it (from Express clan); It is very hard to debug it; It is confusing; etc. Worst thing is that Windows services made is C# is neither hard to create nor it is (too) hard to debug. You just need to do things your way.

First thing to keep in mind is that service is just simple Windows Form application. There is no reason why you need to debug it any differently. Just go into properties and set Program.cs (or App.cs, as I like to name it) to be startup object. When code starts running, just check for command line parameter (I like to use /Interactive). If that parameter is present DO NOT use ServiceBase.Run but start background thread manually.

Other annoying thing about services is installing them via installutil. You do not need to do that either. For install just execute:

ManagedInstallerClass.InstallHelper(new string[] { Assembly.GetExecutingAssembly().Location });

For uninstall it is:

ManagedInstallerClass.InstallHelper(new string[] { "/u", Assembly.GetExecutingAssembly().Location });

Of course, that can be done with /Install and /Uninstall parameters on command line.

As far as threading goes there is no escape. You must have your code in different thread in order to run a service. Windows Service Manager will call your OnStart and OnStop methods but it will not wait forever for result. My preferred method is just creating static class with methods Start, Stop and Run. Start gets called from OnStart and it starts a thread that executes private Run method (new Thread(Run)). Stop method gets called from OnStop to kill the party. Yes, there is some signaling needed for properly canceling everything but there is not much more to it.

Jut check sample application and happy background grinding.