A site devoted to discussing techniques that promote quality and ethical practices in software development.

Thursday, May 17, 2007

Using NUnit without installation

I have been using NUnit 2.2.6 for quite some time now and want to upgrade. The fact that I have to remove my NUnit 2.2.6 and install the new version and then to choose which version, .Net 1 or .Net 2, sort of put me off.

Then I came across this discussion thread on the NUnit forum with a lot of recommendations from Charlie Poole, the key developer/architect of NUnit that completely dispelled my concern and worry. It shows how to 'install' NUnit without installation and supporting both versions.

Essentially, you can use NUnit without installation and you can also have NUnit 2.4.1 for .Net 1.1 and .Net 2 co-existing on your machine without conflict.

This is how to do it:
  1. Download from NUnit project on SourceForge the version you want. Let say NUnit 2.4.1 for .Net 1.1. Instead of downloading the msi version, take the ZIP file (not the source). In this case, it will be NUnit-2.4.1-net-1.1.zip
  2. Create a distinct directory for this file, say NUnit-2.4.1-1.1 and unzip the content to it preserving the folder structure.
  3. Create a short-cut on the desktop to bin\NUnit.exe and label it accordingly.
  4. Then go to the Visual Studio Command prompt and in the bin directory run the GacUtil /I to install the nunit.framework.dll to the GAC.
  5. Repeat steps 1-4 for NUnit 2.4.1 for .Net 2 making sure that this version is placeed in a separate directory.
Because the nunit.framework.dll is in the GAC, as Charlie recommends, VS will not perform local copy.

If you have to develop the project at different places, say at work and at home, where the locations of the NUnit are different, then you are recommended to define the location of the NUnit's bin directory to VS project using the "Reference Path" setting.

Reference Path settings are not saved with the csproj file but is in a user file, csproj.user, and this is not source controlled either. Hence moving the csproj around will not require one to change the csproj file.

Now on my work station I have NUnit 2.2.6 so that old projects continue to work and NUnit 2.4.1 for .Net 1 and .Net 2. The only trouble with this arrangement is that your project source control does not contain a version of the nuit.framework.dll.

This blog message explains why there are two versions of NUnit. In fact, one can simply lauch NUnit.exe with the /framework switch instead of changing the .config file.

Tuesday, May 15, 2007

Ungreyed the OK button in Firefox's download dialog box

Firefox is a great product and I use it wherever a web site does not spill out FF-unfriendly pages.

However, there is a bug in FF (version 2.0.0.3) that calls for some radical way to deal with it. Do not apply this technique to other Windows applications.

In a normal FF, it is set to download to the desktop and that for a file type (more correctly MIME Type) of say PDF, it is set to invoke the viewer automatically. This kind of setting is stored in a file in your Windows profile area under the tree
"Application Data\Mozilla\Firefox\Profiles\[a unique FF profile directory]". For those .Net Programmers, it is kind of like Isolated Storage. FF generates a unique directory name for your FF profile.

In there you will find a file called mimeTypes.rdf.

Now, here are the steps to reproduce the bug. Since this is an experiment and that you may like to restore to the original state, you should take a copy of the file mimeTypes.rdf to a safe place. When you have finished with this experiment, simply overwrite the mimeTypes.rdf with the original copy and you would not know that you have mucked around with FF.

Now open FF and go to the Tools | Options... to bring up the Options dialog box.
  • In the Main section, set the download option to "Always ask me where to save files".
  • In the Content section, click the "Manage..." button for the File Types. You should see a list of types in Download Actions dialog box. Look for PDF type and click on it. The "Remove Action" button is then ungreyed. Click it to delete the PDF from the list.
Now close that dialog box to return to FF. Navigate to a web site where you find a PDF to download.

If you simply click on that link for the PDF, FF will bring up a dialog box asking you what action you would like and it looks like this. If you do not get this, restart FF.


I have actually find this dialog box extremely handy. See the greyed out "OK" button circled in red. According to Mozilla, this is a bug and is caused by some kind of corrupted mimeTypes.rdf file.

Don't be fooled by this greyed button, which in normal Windows UI indicating that it has been disabled. Far from it, in FF-land and is very much alive and kicking.

I do not believe that this is caused by a corrupted mimeTypes.rdf file. I have successfully demonstrated with a brand new installation in an environment that I have manually cleaned up every scrap of Mozilla stuff. By following my steps above, I could reproduce this.

I have further proof that it is most likely a coding or logic bug inside Mozilla's GUI engine in dealing with button and activation process. Here are the ways to ungrey that button to get to that PDF file you want.
  1. The simplest of the lot is alt-tab away from FF and alt-tab back. The greyed OK button now become ungreyed and you can select it.
  2. For those using tablet PC, it can be very inconvenient to perform alt-tab. So tap or click on the greyed OK button (didn't I say radical way before as you would be a fool to do that to a Windows application?) once and it will become ungreyed. A second tap or click on the OK button select the action.
In Windows, if a button is greyed (disabled) your program will not receive any button click message. Hence clicking it will not do anything at all. Since I am not familiar with the internals of FF and in particular its GUI engine, I wouldn't know where the fault actually is.

As demonstrated, it is not random and it can be reproduced consistently. So Mozilla engineer should be able to home in to the trouble.

Wednesday, May 9, 2007

IE7 Uptake stagnant - that's obvious.

Recently PC World reports that the uptake of IE7 has stagnant even with the release of Vista.

It does not really need much to work out exactly why. If MS wants everyone to move over to IE7, all it has to do is to remove the WGA check on installation. The slimy thing is that its Windows update downloads IE7 first before asserting if the Windows is WGA compliant.

To me it seems like a deliberate act of wasting people's Internet bandwidth.

Removing that check may restore some fondness to upgrade to IE7. Besides who needs IE7, those failing WGA check are mightily happy with Firefox and I am sure that they are promoting Firefox willingly rather than IE7.

Even on my WGA compliant machine, I do not install IE7 for good reason.

Friday, May 4, 2007

Full mark for thinking outside the box (or rather inside?)

In the cat-and-mouse game of defeating the HD DVD protection reminiscence of the cold war, nice to see some application of thinking outside the square approach:
The latest attack vector bypasses the encryption performed by the Device Keys—the same keys that were revoked by the WinDVD update—and the so-called "Host Private Key," which as yet has not been found. This was accomplished by de-soldering the HD DVD drive's firmware chip, reading its contents, and then patching it. Once that was done, the firmware was soldered back onto the drive.
[...]
"They cannot revoke this hack," said forum member arnezami, who has been at the center of much of the AACS cracking recently. "No matter how many Private Host Keys they revoke we will still be able to get Volume IDs using patched xbox 360 HD DVD drives."
Well done!

Microsoft's UAC & Sudo

Mackenzie recently blogged about the history of Sudo and the similarity to Vista's UAC
What makes this whole thing funny, though, is something I saw a couple days ago. Head over to Builder-AU and listen to Peter Watson from Microsoft. He says, User Account Control is a great idea and strategically a direction that sort of all operating systems and all technology should be heading down Excuse me
My brief encounter with Ubuntu and the chanced encounter of the dialog box seeking my root password stunned me of the close resemblance to ME II's UAC.

All about a GUID

What's such a big deal for a GUID that every COM programmer is so used to?

What's such a big deal with this particular GUID:
09f91102-9d74-e35b-d841-56c5635688c0

Apparently someone, very touchy organisation like AACS LA causes a storm in Digg when someone rewrote the GUID by removing the separators and posted it on the Internet.

If someone like say AACS LA finds publication of a GUlD offensive, every com programmer should better check their GUID with AACS LA before they publish it in the type library or IDL. I suggest every com programmer just sends e-mail to AACS LM requesting permission to publish the GUID in the IDL.

This is stupid. As Ed Fulton rightly says, no one should be allowed to own an integer - a GUID is just a 128 bit integer!

Would they get upset if these special "AACS offensive" numbers were published in the form of a COM type library?

As Bruce Schneier once said in relation to using DRM to protect digital materials: it is like "making water not wet"

Some one is touchy! If they try to take down this kind of stuff, smart people can write materials carrying double, triple or n-possible meaning to conceal the true meaning or intend. How can anyone police that? The Chinese were doing this centuries ago before computer were even in the vocabulary.

Wednesday, May 2, 2007

"Why Software sucks... and what you can do about it"

This happens to be the title of the book by David S. Platt that I have just finished reading. The book's web site is here.

David is an accomplished software developer and authors of many books. He has even been designated by Microsoft a Software Legend in 2002.

The book is written in a light-hearted manner with David wearing the hat of a user of software, who has no a care of the inner working of the software he is interacting with. He has provided several commonly used commercial software packages, including web applications, to illustrate his point that "you're being forced to think like a programmer, even though you're not one and you don't want to be one".

The first chapter sets out the many reasons why user interfaces are so bad and so many software are so hard to use. "Instead of the programmer adjusting her user interface to the user's thought process she forces the user to adjust to hers". He considers this lazy programming. He uses the too-frequently used confirmation dialog box to illustrate the point.

I fully agree with his assessment of the landscape. This sentence at the conclusion of chapter 1 pretty much sums up why:
They suck because they're designed by programmers, who don't realize that their users aren't like themselves.
On his attempt to explain why developer do not use tools/technique to address this problem, David has this to offer:
Unfortunately, usability testing often gets left until late in the development process, just before the product ships.... Usability testing needs to be done early, ideally before any programming takes place.
[...]
... Eating your own dog food before releasing it to users helps your dog food taste slightly better than it otherwise would. But it won't change it into cat food.
For those that scan this book rather than reading it, do not write to David to correct his spelling of Idoit. He has not made any spelling mistake throughout his book. The definition of Idoit is given on page 14 as
...idoit, pronounced ID-oyt (or eed-WAH if you're French), to designate someone so clueless that he doesn't even know how to spell idiot.
So now I have learned one new word!

He called this frequent usage of confirmation dialog box "crying wolf" and I tend to agree with him. It is a pity that he does not cite examples using firewall programs that frequently pop up this dialog box seeking users permission or denial of a transmission. I use the Comodo Firewall and it has this dialog box that pops up so frequently despise my instruction that certain software package is considered safe and trusted.

Just because a user clicks on the "allow" button does it ever make the action any safer or that the firewall is doing the job? If the user does not possess the necessary skill to work through all the highly technical information in the dialog, his action, whether allow or disallow is suspect. Even I have trouble understand the materials.

It is the duty of the program to work that out and advise! That would be a much better example of "Crying Wolf". What happen is that the user becoming so used to clicking the "allow" button just to get work done yet without much harm that he/she would do the same in the presence of a real harmful attack.

He also uses the Web to illustrate that "the web designers don't know their users, and thus they think that by extension, they must be like themselves". David throughout this book constantly reminds the developer that "Your User Is Not You". Another similar saying that I have come across is that "there are more users than developers".

On the web, he points out two very important points that are not in the desktop software packages:
"...viewing a Web site is a very casual interaction.... home page needs to visually explain this in the first two or three seconds they'll spend there before ... go to the next link in the search engine list.
[...]
... The site's navigation structure .... needs to be obvious to the user within a two- or three-second glance, and too few of them are"
I also share his objection to those distracting dancing advertisement or time wastage splash screen. Far too many web designers have been lost their way distracted by the colour & graphics!

The book also touches on issues that are not interacting with user directly but still required to serve a purpose. He examines the issue of developing secure software requiring highly specialised skill by people ill-trained for the job.

I initially thought giving a full chapter devoted to describing the Geek's habitats - the conference and in particular Tech Ed is a bit of a waste of space. I am wondering how that compares with PDC (Profession Developers' Conference). But later on I realise that he is contrasting the behaviour of Geek in groups (in conferences) with Geek as individual.

All in all, this is a very entertaining book from someone that has experiences on both side of the camp and David's knowledge as a developer is found in a number of example in offering counter-arguments that frequently are used to brush off user's complains.

I have also learned one thing unrelated to user interface design or why software sucks and that is that the backdoor to warn user of the presence of a mine in Mine Sweeper game is still alive and kicking.

If you are looking for a recipe on how to avoid making software sucks, you would be disappointed, not so much as the materials are not there but they are not organised in a recipe format!

Blog Archive