Threading in .NET
If you have some trouble in updating GUI elements in .NET because they are not created by the thread just running, try the following:
delegate void onSensorChangeParameterDelegate(int index, int sensorValue); void kit_OnSensorChange(int index, int sensorValue) { if (InvokeRequired) { BeginInvoke(new onSensorChangeParameterDelegate(kit_OnSensorChange), new object[] { index, sensorValue }); return; } txtInfo.Text = String.Format("Index={0}, Value={1}", index, sensorValue); }
So the method is handed over to the GUI thread, where txtInfo is a TextField, and processed there. Jon has written a great article about threading in .NET and how it can be done.
Visual Studio 2005 Shortcut
There is a shortcut within Visual Studio i did not know yet. Press [Ctrl], [Alt] and arrow down. The following dialog shown below should appear. Using the up and down arrow it’s possible to cycle through the open files.
There is some redundancy with the dialog showing up when [Ctrl] + [Tab] is pressed, both provide the same functionality.
Coding4Fun @ UK
The last three weeks have been packed with traveling a lot. Birmingham, London and Harrogate. There, I was able to present a part of our work at the launch tour of Visual Studio et al. We present all the stuff together with MSDN Coding4Fun. So for everybody who asked: The Phidgets are available at the Phidgets Website and the fischertechnik models are sold in UK as well. Beside this, there is a video at Channel9 where Daniel Fernandez and Brian Kellel show some of the nifty projects. Next station of the launch events: Edinburgh. And yes, for all who asked: It works great with the Visual Studio Express Version, which is available for free.
Lutz Roeder’s .NET Reflector
Because I was assked again some minutes ago: Lutz Roeder’s .NET Reflector is one of must have tools for .NET programers.
Pimp my M200
Today, I decided to pimp my Tablet PC somehow. The first I pushed the available RAM of the Toshiba M200 to the absolute limit of 2GB. Finally, I decided against a second Samsung M40L2923 module. Instead I use a 1GB DIMM-S0 Infineon module.
Still not satisfied, I wanted to update my BIOS to the current BIOS version 1.7. This sound pretty easy while Toshiba offering a windows-based update utility for those not having any disk or DVD drive available. Anyway some issues appeared:
If you search for a while, you’ll find that the problem is well known and described in this technical support bulletin. All you have to do is downloading the Toshiba Utilities to make the missing DLLs available. Beside the installation of the BIOS some more utilities are available, too.
After starting the update utility again, the system need only a few seconds, until reboot. The after logging into the system the tool is finishing theĀ (un-)installation for a few seconds. After that everything works properly again.
The three most dangerous things in the world
The three most dangerous things in the world are a programmer with a
soldering iron, a hardware type with a program patch and a user with an idea.
The Wizardry Compiled, Rick Cook
Indigo Callbacks
While playing with Indigo, I spend several hours on duplex services and clients finally leading to an annoying issue. I tried two different examples, one from the book Programming “Indigo” and another one from the WinFX SDK documentation. In both cases, I spend hours writing down all the code, especially as the examples in the book do not fit with the current release of WCF anymore. So some fixes have been necessary. Having both examples, I tried to start the clients, but they did not receive any response from the service. If you are patient enough (which means waiting 5 to 10 minutes) the client will result in a ChannelConnectException.
What is wrong? Bindings? Any mistake in the XML config-files? The solution is as simple as it could be: Just right-click the web site in the solution browser and choose Start Options…
Uncheck NTLM Authentication which is checked by default and restart your service and client.
After restarting the service and the client, the client is processing, the service is responding and the Quick Console shows the expected output:
Visual Studio 2005 Highlighting Feature
Have you realized already this great feature in Visual Studio 2005?
If you write down some interface or class names which do not exist yet, they appear in black (as long as you still use the default settings for the editor). As soon as you write down the appropriate class or interface the color changes from black to light blue. Why this is cool? It makes it pretty easy to find typos in your code right before compiling. If you see such code not in the appropriate color, either you have a typo in its name or the class or the interface is not implemented yet. It makes a lot of sense when you write down code but the implementation of a class or interface is not yet available because it is written by another person. It’s a nice feature in VS 2005.
Some Office Hints
While writing papers, there are some really useful hints you must know. If you write down topics, usually it’s a royal pain on your back always to pick the mouse to choose the Heading 1 formatting. Just press [Ctrl]-[Alt]-[1] to [Ctrl]-[Alt]-[3] to mark the lines as a heading. Unfortunately this doesn’t work for Heading 4.
Another great thing is the rand macro. Sometimes it is useful to have some arbitrary text between all the headings which make the structure of you document. Just type in =rand() for some paragraphs of text or =rand(2) if you want exact two paragraphs. Of course you can choose any other number as well.
Word provides you some text to fill your empty space:
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.
The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog.