Change the HAL of Windows OS

I am doing a presentation on Visual Studio 2010/.net 4 parallel programming enhancements in the near future. [MS] released Visual Studio 2010 CTP and that’s fine. The problem was that the one and only release comes in the form of a VirtualPC image. This is not a problem by itself but it is a problem if one wants to show parallelism. You see, VirtualPC supports only single processor guests ([MS] isn’t exactly pushing for VirtualPC enhancements, is it – at the time [MS] bought VirtualPC it was on the same level as [VMWare] Workstation, now it is lightyears away). How can one show performance enhancements of parallelism with one CPU?

Part of the solution is [VMWare] Workstation 6.5 (and earlier, don’t know exactly which ones): it supports multiprocessor guests. Great. However once I’ve imported VirtualPC image into Workstation the OS was still showing only one processor even though device manager recognized two processors. Even updating the computer driver (node Computer\Advanced Configuration and Power Interface (ACPI) PC) didn’t help – there were no choices. Luckily I’ve googled over this blog post: Hyper-V How To: Change the HAL on your vm. Oh, the joy, the trick just worked.

The other problem with this presentation is that Visual Studio 2010 CTP expired by the end 2008. The solution is to change date backwards (silly, isn’t it) but Workstation/Windows keep synchronizing the time with current and thus yielding all sort of activation and expiration warnings. The solution is a twofold one:

- add these lines to Workstation’s configuration file so the Workstation won’t synchronize the guest on every occasion (thanks to Virtual Time Freeze):

tools.syncTime = "FALSE"
time.synchronize.continue = "FALSE"
time.synchronize.restore = "FALSE"
time.synchronize.resume.disk = "FALSE"
time.synchronize.shrink = "FALSE"

- remove or disable guest’s network capabilities so the OS won’t synchronize as well.

Ah, the joys of presentations based on CTPs.

Hollywood graphics FX

Did you ever watch a Hollywood movie/episode where police/detective/bad guy/alien manages to get a blurry low res photo of a vehicle? And then they enhance the picture to get a readable vehicle’s license plate? Like, for example the picture below:IMG_0081_o

The enhancement in the movie is done by a single click and (through a nice video animation) they get the result below (intentionally hidden two letters):



Notice how much readable and sharper is the second plate?

Is this kind of enhancement really possible? No. You just can’t recreate the information that isn’t available in the source. It can go the other way round but not the way as shown by Hollywood movie makers. In the reality they’d produce a interpolated version of original picture, like the zoomed region in first picture. Can you read that? Nope.

So, has been Hollywood lying to us all the time and movies aren’t real? Perhaps not. I think that reading a blurry low res the license plate is still possible but not as easily as shown in the movies. Most probably there is often enough information there to recreate the letters even when human can’t read them. With proper software you can really read those letters I guess – it still depends on the quality of the photo.

Windows Live Writer doesn’t work well under Windows 7 beta x64

I’ve tried to run Windows Live Writer under Windows 7 beta today. It runs but it can’t upload pictures through FTP. There are two indications of the problem:

  • when you configure FTP connection it will yield this warning
  • The remote server could not be contacted to verify the settings. Do you want to continue anyway?

  • Publish or save draft to server will yield an error:
  • Error occurred while transferring file [picture name here]

    (Publishing Error) A publishing error occurred: The source of the error is unknown.

I wonder whether this bug is related to x64, Windows 7 beta or to both.

VMWare Workstation's Easy Install

When you think that [VMWare] invented everything they push the innovations even further. These days I've finally accomplished Windows 7 beta download and since I don't have a spare computer right now I've though of installing it under Workstation 6.5. I have to admit that I didn't install any new OS for a while now (thanks to Workstation's excellent snapshot management system). So I created a new typical configuration and entered the path to the Windows 7 beta x64 iso file. Workstation recognized it as Vista (W7 is enhanced Vista after all, but I am sure Workstation will be updated to reflect the proper name in the future) and notified me that it will be installed using Easy Install.


I didn't know about Easy Install and I was pleasantly surprised about it. It lets you enter all the required data for the installation in the next next dialog:


and that’s it. After you put in all the required configuration data Workstation will install the OS for you, no interaction required whatsoever. That’s right, after some time you’ll be greeted by running OS. A huge timesaver even if you don’t install a lot.

Stop Israeli slaughter

When I started blogging I've decided not to bore the audience with political or other non-technical content. However, the situation in Gaza is well beyond political or rational - there is an Israeli state led slaughter over Palestinian, mostly civilian population going on. I can't do much to help stop the slaughter but at least I can boycott Israeli companies as well as state clearly my stand to my government and foreign ministry which didn't condemn the Israeli actions and have once again proven Slovene submisive attitude to Israel. They do not represent me, and judging from the public reaction, neither the majority of Slovenes.

Shame on them both, shame on everybody that supports Israel and their slaughter!

A developer diving into microcontroller world part 1

I always wanted to do play with microcontrollers but I lacked hardware knowledge. Actually the last time I wanted to play with them was at the very early stages of the internet (during my university time that is). So I let it go for the time being because of lack of the available informations and other more important tasks (like going out with friends).

Now, 15 years later, the very same idea kicked in my head again. I was still hardware ignorant - more or less like I was 15 years ago. But this time there was a major factor in my advantage: Internet. So I went surfing for microcontrollers and soon found a priceless site for beginners and advanced users: Society Of Robots. The author has written plenty of tutorials that even a beginner can understand. The tutorials are excellent. There are also tutorials and other content provided by the author and community. But tutorials don't answer every question one can come up with - yes, there is a forum as well. And again, the forum is excellent as tutorials are - many skilled users are ready to answer (even beginner's) questions and many questions are already answered. The author of the site has even created its own MCU (microcontroller unit) Axon (it can be ordered on-line) - an advanced microcontroller worth checking out (I'll buy it, just to support his efforts if not for anything else, but not right now).

Now, armed with new the new knowledge I had to decide which microcontroller I am going to start with. The first choice was Axon, mentioned above, ATmega640 based one with plenty of in/out pins. I went browsing for alternatives. Soon it struck me: [MS] .net microframework might be a perfect choice. The drawbacks? Expensive compared to the Axon. It is much more powerfull in terms of CPU though. The thing is that I wasn't looking for a powerful MCU. Rather I was looking for two features:

  1. Bluetooth connection with PC - as a beginner I really didn't want to fry my workstation PC by a shortcircuit. That means no physical connection between two entities can exist to be on the safe side. (so far I didn't manage a shortcircuit anyway). Most of the MCUs communicate with PC via USB or RS232 port.
  2. It should be cheap - because I am a beginner and I don't want to make too much damage from the start.

After a while I've found Arduino - a cheap MCU and again, great site with a great forum and a huge community. Quote form the web site:

"Arduino is an open-source electronics prototyping platform based on flexible, easy-to-use hardware and software. It's intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments."

Society of Robots is friendlier to the beginners while this one has definitely a larger community. The base Arudino MCU (based on ATmega168, a chip from the same family as Axon's.) is dirty cheap (Arduino Duemillenova - 22€) and there is even DIY documentation (how to build it from the scratch). There is plenty of Arduino versions and even variations (Roboduino, RainbowDuino, etc.) The bluetooth Arduino BT (built in bluetooth Class I reciever - 100m range) version is cheap as well - 79€ from Smart Projects. Perfect. I went with it. You can buy from various on-line sellers found here.

Arduino BT
Arduino BT

So Arduino BT for the start it is. Next, for bringing it to live I needed an energy source. While it runs perfectly well on batteries (5.5V max for this particular version) I opted for a power supply instead. I bought a Voltcraft VLP 1602pro from Conrad in Slovenia. It is a dual channel thing with short circuit protection, voltage and current limitator - meaning it is very safe to use and can provide two different voltages at the same time. I'll use batteries when I'll need to move around Arduino.

Voltcraft VLP 1602pro
Voltcraft VLP 1602pro

At that point I was able to power up Arduino and open the communication with PC via bluetooth.

To be continued...

Lost Windows Live Writer

Today I lost my Windows Live Writer. I was doing a Windows Live update of installed WL applications. The update performed an uninstall first and install after. But the install failed and fails with an error 0x80070643. Of course it didn't rollback the original installation.

Quick googling for the solution doesn't help as well. Great error message and hidding installation log file is a great feature, [MS]. Damn, I'll just use Sysinternals to figure out what goes wrong.

Calling WCF services from within Sql Server

It is possible to create a managed .net stored procedure for SQL Server that acts like a WCF client. SQL Server 2005 at least is required. But I won't talk about how to. I'd rather discuss an odd error you can encounter while performing this stunt.

On development machines one can encounter this odd error when WCF client is being initialized, after managed stored procedure is being invoked through T-SQL.

Msg 6522, Level 16, State 1, Procedure CalcAdd, Line 0 A .NET Framework error occurred during execution of user-defined routine or aggregate "CalcAdd": System.Configuration.ConfigurationErrorsException: The type 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior, Microsoft.VisualStudio.Diagnostics.ServiceModelSink, Version=, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' registered for extension 'Microsoft.VisualStudio.Diagnostics.ServiceModelSink.Behavior' could not be loaded. (C:\Windows\Microsoft.NET\Framework\v2.0.50727\Config\machine.config line 192) System.Configuration.ConfigurationErrorsException: at System.Configuration.BaseConfigurationRecord.EvaluateOne(String[] keys, SectionInput input, Boolean isTrusted, FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult) at System.Configuration.BaseConfigurationRecord.Evaluate(FactoryRecord factoryRecord, SectionRecord sectionRecord, Object parentResult, Boolean getLkg, Boolean getRuntimeObject, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSectionRecursive(String configKey, Boolean getLkg, Boolean checkPermission, Boolean getRuntimeObject, Boolean requestIsHere, Object& result, Object& resultRuntimeObject) at System.Configuration.BaseConfigurationRecord.GetSection(String configKey, Boolean getLkg, Boolean checkPermission) at System.C...

Note that everything is configured properly and WCF client inside stored procedure should initialize just fine. The problem is somehow connected to machine.config file or better, to some initialization of types defined there.

After few google searches I've come across this post from MS' Jason Pang. Looks like the exception is linked to WCF debugging feature, usually installed on development machines - this debugging service has problems with WCF client running under SQL Server.

Workaround: (Temporary) disable WCF debugging by invoking this command line utility:

[Program Files]\Microsoft Visual Studio 9.0\Common7\IDE\vsdiag_regwcf.exe -u

Now the WCF client inside SQL Server runs just fine. After you've done you can re-enable WCF debugging services by calling same exe with different parameter:

[Program Files]\Microsoft Visual Studio 9.0\Common7\IDE\vsdiag_regwcf.exe -i

Note that administrator privileges are required to disable/enable it.