Today I found myself in a problem I never guessed I would get into, deadlocks. A deadlock is a situation where one lock is waiting for another lock to clear. But the other lock can’t be cleared until the piece of code that’s currently is waiting for the lock to clear is run. More about Threads and Locks can be found here. And with a little bit of googling
Problem with deadlocks is the seem quite hard to find, and when found to solve. At the moment my program runs in a deadlock I press the Pauze button in Visual Studio, problem: Visual Studio stops at the position where the program is in the main thread. When using WPF in .NET Micro Framework this isn’t very usefull.
But I managed to find the piece of code that blocks but that doesn’t help a lot eather becouse you can’t see what piece of code currently holds the lock.
Read more…
Some title I made for this post.. The reason for this is that I wanted to do something what I tought was very simple and took me some time to do. For my "HomeTerm" project I want to have a select box with supported timezones. The first method that I used was getting all the Enum values available with the "reflector". This was very easy to do but posed a problem.. The names aren’t very descriptive. In this post I describe how I fetched all the timezone names, made a sortable type with IComparible and sorted an ArrayList with Bubble Sort. Read more…
Introduction:
Many applications require a way to persistently store settings and other data. On the full .NET Framework you can use the file system for this. The new 3.0 .NET Micro Framework system adds support for a file system but it’s up to the device manufacturer to add support for this. And this file system isn’t the most efficient way to store simple application data. The .NET Micro Framework has a more efficient way to persistently store information. This are Extended Weak References. In this post I try to explain how to use these Extended Weak References. It isn’t written to be absolutely complete but to get you started.
Read more…
Today I came acros this post on the GHI Electronics forum:
I’m developing my first application with EM, but sometimes i switch from happyness
to sadness
, this is why:
- Read/Write method in FileStream class of EMLibrary accept only bytes array, but what if I have to write/read int/float/long arrays ?
In C++ it easy: fwrite(&AnyKindOfData, DataLenght, Elements),
InsertValueIntoArray and ExtractValueFromArray of Utility class work only for unsigned types but not for float, and of course it is less that the best way to do this job, some idea ?
You can use binary serialization for this. As not much information is available on the web about this I’ll try to shed some light on the subject.
Read more…
Introduction:
When I started programming for the .NET Micro Framework one of the things that where a bit difficult to grab was how to update WPF UI elements (Like a text control) from a thread.
It has all to do with thread safety. Threads run (semi) simultainus and so there is the change that you access the same variable at the same time. When you have you’re own variables that you want make "Thread-Safe" you can use the lock statement (MSDN). When you’re developing for WPF you can use the Dispatcher and DispatcherTimer to "Thread-Safe" access UI controls.
Read more…
Recent Comments