IsRunning

In quite a lot of code I see following check for whether thread is running or not:

public bool IsRunning {
    get {
        return (this.Thread != null)
               && (this.Thread.ThreadState == ThreadState.Running);
    }
}

This code has big chance of working except in one quite often used case - if you have Sleep() inside of your code. Once that enters your main thread loop, you cannot count on your thread being in Running state all of the time. And Sleep() might not even be in your code (e.g. it might be in some external library).

Better check would be:

public bool IsRunning {
    get {
        return (this.Thread != null)
               && ((this.Thread.ThreadState == ThreadState.Running)
               || (this.Thread.ThreadState == ThreadState.WaitSleepJoin));
    }
}

P.S. If you like to mess with IsBackground thread property, also check for ThreadState.Background.

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.