Saturday, August 30, 2008

Separate Installs for Service and Desktop Application

The install originally lumped a Windows Service and a Desktop application together in one install.


This created a problem in the Install for Everyone. The Resilency was firing because of items in the Desktop application install. Specifically, Shortcuts installed per user were causing the Resilency install to fire when the second user logged in.

The Windows Service Installer does not handle this situation. And testing for the existence of the service causes a corrupt install state.

The less than ideal solution was to have separate installers for the two components.

Tuesday, August 26, 2008

Link: MSDN Windows Installer Deployment

MSDN: Windows Installer Deployment

Monday, August 25, 2008

Fixing: Error 1001. The specified service already exists

Fixing: Error 1001. The specified service already exists

Description: This error occurred during a per user install. The install was using the installer classes for services. The application was installed for all users. When a second user ran the installer classes tried to install the service again. This is fixed by testing for the existence of the service and skipping the service install if it already exists.

Sunday, August 24, 2008

Code: Test For Service Existence

Code To Test For Service Existence


bool serviceExists = false;
foreach ( System.ServiceProcess.ServiceController serviceController in System.ServiceProcess.ServiceController.GetServices())
{
if (serviceController.ServiceName == "TwentyTwentyLiveService")
{
serviceExists = true;
}
}

Saturday, August 23, 2008

Code: Determining If A User Is An Admin

There are several built in roles to help determine if the user is an Admin, User or Guest.


 WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();

WindowsPrincipal currentPrincipal = newWindowsPrincipal(currentIdentity);
AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
if (currentPrincipal.IsInRole(WindowsBuiltInRole.Administrator))
{
  //Administator code
}
if (currentPrincipal.IsInRole(WindowsBuiltInRole.User))
{
 // User code
}
if (currentPrincipal.IsInRole(WindowsBuiltInRole.Guest))
{
 // Guest or anonymous code
}

Friday, August 22, 2008

Level 2 Ignorance

"You do not know what you do not know."

This quote travels in IT/IS communities. The humor lies in the second of the double meanings. Not only do you not know some thing. But there are also things you don't know and you are unaware of what they are. These are the Level 2 in The Five Levels Of Ignorance.

There are two dynamics at work here on the one hand your Level 2 Ignorance is like a minefield of problems. On the other hand simply learning the name of things which you do not know transforms them into Level 1 Ignorance.

These dynamics illuminate why command and control systems, everything from communism to waterfall, fail. And methods which stress grassroots bottom up development, like Agile, have shown stunning results.

The command and control tries to plan everything beforehand while all the participants are in their highest states of Level 2 Ignorance. In fact because the organization is making no attempt to discover Level 2 Ignorance it is operating at Level 3 Ignorance.

In contrast, the bottom up methods stress experimenting and thus gaining knowledge of the problem space. This will result in ignorance being discovered. Which means these methods guard against Level 3 Ignorance and thus are eliminating Level 2 Ignorance as well.

Thursday, August 21, 2008

Fixing: Access to the path 'Global\.net clr networking' is denied

Fixing: Access to the path 'Global\.net clr networking' is denied


Description: The problem occurred in an application that leverages 'WindowsFormsApplictionBase' to create a singleton application. It occurs when logged in as 'Guest'


Resolution: We test for 'Guest' and display a form stating the application must be run with a non Guest account. Guest is severely restricted.


Comments: The application "Shared View" does not display this problem when log in as the Guest account. Since "Shared View" was deployed as a ClickOnce, it likely is using 'WindowsFormsApplictionBase'. It is possible they are using Impersonation to give the code a different execution context.

Wednesday, August 20, 2008

Reflecting On Browser Properties


We are armpit deep in Mobile Development and facing multiple Level 2 Ignorance traps.
One area concerns browsers. As each Mobile Platform has a unique browser and browser settings.
To help with this, we have a page where we use Reflection to dump out the browser properties.
Note the code has a "evil" empty try catch, our code is similar (read much improved).
But I though it would be handy to provide the essence of the solution.
Type
browserType = Request.Browser.GetType();
foreach (PropertyInfo propertyInfo in
browserType.GetProperties())
{
try
{
Response.Write(propertyInfo.Name +
" : " + propertyInfo.GetValue(Request.Browser, null).ToString()
;
}
catch
{
}
}

Tuesday, August 19, 2008

Sorted HashTable

Recently, I wanted a sorted HashTable.

After struggling with the System.Collections.HashTable, I remembered the definition of hash table.

What I really needed to use was the SortedList. So this is more a reminder that I need to find (or write) a users guide for the System.Collections part of the Framework.

Monday, August 18, 2008

Automated Builds Closing The Door On Ignorance

Arguably the Automated Builds and Integration Builds (2 of the 12 Basic Software Development Practices) form the hinge upon which software development succeeds or fails.

By having an integration build which is automated you are in the position to close the door on some Level 2 Ignorance. To recap Level 2 Ignorance is when you do not know something and at the same time you are unaware of it. (For more see Five Levels Of Ignorance).

The automated integrated build informs you immediately when certain bugs have been introduced. As such you are no longer Level 2 Ignorant of those bugs because you know of them. Granted you may not be able to fix them and so you are at Level 1 Ignorance, but this is an improvement.

Either you caused them, in which case you will learn something you are doing wrong, which remedies something that would otherwise be Level 3 Ignorance. The same is true if someone else caused the bug, they are not aware of the bug and they are not aware they are doing something wrong which is causing bugs.

Absent this build process, your team would be at Level 3 Ignorance of things that cause bugs. A very dangerous place to be. If you remain there your project will fail.

Sunday, August 17, 2008

Web Application and Web Site Development Models

Web Application and Web Site Development Models

History

Visual Studio 2003 introduced the Web Application model. Visual Studio 2005 introduced the Web Site model and initially did not allow the Web Application model. Developers complained and a plug-in was released to allow Visual Studio to do Web Applications. Developer Express Supports only Web Site model originally but will add support in WDE 2008 SP1.

Web Application

A Web Application is project based. If the resource is not in your project it does not exist.
It must be deployed to be used.
Easier to work with Source Control since the projects expose source control syncronization files.
By default, all code is compiled, class files, code behind files, designer files, into a single assembly.
Content files, .ASPX and .ASCX, are compiled dynamically.
With Web Applications you have control over the names of assemblies.
Web Applications also have the ability to create a Web Application from multiple Web Projects.
Web Applications have the ability to run pre-build and post-build steps during compilation.

Web Site

A Web Site is folder based, if it is in the folder it is part of the Web Site.
Web Sites automatically deploy site using HTTP, FTP or File System.
Web Sites run on IIS, they do not run locally for HTTP and FTP.
If you specify local file system the site will run with the local development server.
A Solution file gets created but does not have any information.
Web pages and code files are compiled dynamically. (There are precompile options)
Gives you the ability to open and edit any directory as a Web Project without a project file.
Ability to generate one assembly for each page which could result in a performance gain.

Saturday, August 16, 2008

Blackberry Visual Studio Plugin

Blackberry provides for free a plug-in for Visual Studio. The current version is a beta for Visual Studio 2008. There is a prior version for VS2005.

After installing, you can launch the blackberry emulator directly. Also after selecting File->New -> Project... , you will see there is a new installed template for Blackberry. Running the template results in a working project without any additional code.

This plug-in is a great start as it provides an excellent Blackberry emulator and an environment for starting Blackberry mobile device development.

Friday, August 15, 2008

Three Persons Of Ignorance

Me, You and the Organization.

This is based on the Five Levels Of Ignorance which I recap the bullet points:

Level 0: Knowledge
Level 1: Ignorance with Awareness
Level 2: Ignorance without Awareness
Level 3: Ignorance without Awareness or even a means of becoming aware
Level 4: Ignorance of the Five Levels

Not stated is that, these levels apply to an individual person and were described in the first person. That is the First Person of Ignorance, oneself. The Second Person of Ignorance is another person. Before stating last and controversial entity, lets digress.

The first and second persons are people, they are capable of ignorance because they are capable of knowledge. This is because ignorance is the lack of knowledge. Only something capable of knowledge could be ignorant. A rock is not ignorant simply because it cannot know.

Which brings us to the controversial Third Person of Ignorance, the organization. That is any company, group or collection of people where the members identify themselves as part of the company, group or collection. I will gloss over the difficulty here by contending while an organization may not be capable of knowledge, but it often acts as if it does.

Thursday, August 14, 2008

Changing The Default View For Web Pages In Visual Studio

To change the default view of web pages in Visual Studio select from the menu:
Tools->Options...

On "Options" dialog select from the left side tree control:
HTML Designer->General

In the "Start pages in" groupbox you have three options:
Source View, Design View, Split View

Wednesday, August 13, 2008

When Greenfield Is The Solution To Brownfield

Not once but several times I have witnessed or had direct knowledge of Greenfield projects successfully replacing or improving Brownfield projects.

This would run counter to the general rule that Greenfield is not the solution to Brownfield. Both are true, which can be understood by realizing that these special cases will not generalize across all efforts. These special cases share one common characteristic. They accepted limitations and often tried to accomplished only one limited objective.

One effort that occurred at a company I worked at set out to merely reorder and make more sensible the object hierarchy common to all items. The actual functionality was not changed, just the implementation details. The language used was not changed. No new methodologies were introduced. The objective was limited and a success. A success even though it was late, because it actually did result in an improved product.

Tuesday, August 12, 2008

Five Levels Of Ignorance

Philip Armour enumerated Five Levels Of Ignorance.

He enumerated them starting at Level Zero which corresponds to having no ignorance and proceed up (or rather down ) to Level Four a comprehensive or complete level of ignorance.

Level Zero: Knowledge

At level zero you have a lack of ignorance. To be at level zero you must be able to demonstrate your knowledge. Consider the particular skill of tying a Square Knot. To be at level zero of ignorance of a Square Knot you must be able to tie one.

Level One: Ignorance, With Awareness

At level one you have ignorance but you know you are ignorant. In the case of the Square Knot, if you do not know how to tie one but are aware there is such a thing as a Square Knot, you are at level one ignorance of Square Knot.

Level Two: Ignorance Combined with Lack of Awareness

At level two, you do not even know that you do not know something. Whatever you know of the Square Knot, there is without a doubt some knot that you do not even know the name. For this knot you are at level two. It is amusing and seemingly paradoxical that as soon as you learn the name of the knot, you rise to level one for that particular knot.

Level Three: Unknowable Ignorance

Level three is composed of level two ignorance combined with a lack of means of identifying those level two items. In the case of all of those knots that you are at level three, you are at level two and not three since you have a way of finding them. If all else fails you could use a combination of Google and Wikipedia to find their names. Once again, in a paradoxical fashion if I could provide a description of individual level three items they would be identified and thus not even level two.

Level Four: Meta Ignorance

This level Armour defined as ignorance of the five levels of ignorance. There is humor to this level but it serves a purpose. Chances are you are not in the business of tying knots. But if it were the five levels provide a road map. Constraints of time and the demands of opportunity will cause you to search for and move items through the various levels. Now lets take your actual business, Widgets. To start you should see if Google and Wikipedia are sufficient, and so on through the levels.

Monday, August 11, 2008

Sunday, August 10, 2008

First Look at Shared View

Currently Microsoft's Shared View is free. So if you use Webex or a similar desktop sharing software you should consider Shared View.

But it is not cost that will drive Shared Views success, rather it is the simple and viral way it works and spreads.

Starting with a user with a Microsoft Live account, the user can do a click once install from the web:
http://www.connect.microsoft.com/content/content.aspx?SiteID=94&ContentID=6415

Then after logging in with their Live account they can create a sharing session. A simple way is provided to invite other users. Your email client is invoked with the invitation text, including link to session, already populated. You simply type in the email address.

When the invited party clicks on the link, the shared view comes up if they have it installed. Or if they do not have the Shared View installed, the web page for the click once install is brought up. Microsoft has really nailed the quick once install, it is quick and simple. After the install the shared session is launched.

At this point the original user approve the invitee and the session continues. The controls are both simple and intuitive.

What is interesting is the viral nature of Shared View. The only requirement is the coordinator of a sharing session must have a Microsoft Live ID. All other users will download the software, which is similiar to the Webex experience. This then puts them in the postion of hosting Shared View sessions. Simple, Easy, Viral.

Saturday, August 9, 2008

Why Greenfield Development Is Not The Solution To Your Brownfield

Facing a Brownfield project, the obvious solution is to start over. As a general rule this does not work. Which does not mean it cannot work in isolated instances.

Consider those Brownfield projects that are so bad you or your client are willing to abandon everything and start over and do it all again. There must be multiple problems in the Brownfield. These problems have probably reached an unworkable state. Working on one problem creates other problems. One problem prevents working on another problem. Perhaps the source code for a COM component has gone missing. (I do not know what it is about COM but since it's widespread use, every company seems to have a COM component with missing source). Or perhaps knowledge of the inner workings of the system is missing. Perhaps the original perpetrators of the code have fled the scene of the crime.


So the motivation for fixing the Brownfield is the ability to fix the multiple problems. This is also why the Greenfield approach will fail. You have a mandate to fix everything in the Brownfield. But this is too much to be attempted at once.


It is not that you can not fix each of the problems in isolation. It is the combination of problems makes it exponentially more difficult. If lack of knowledge (like missing source code or fled perpetrators) is added to the mix, you will be flying blind. You may think you know what the component is supposed to do but there is tribal knowledge embedded in the source code.


But lets suppose you have jumped off and started the Greenfield to fix your Brownfield. As you solve the problems, the solutions will start to compete with each other and to a certain extent some hard trade offs will emerge. Some of these trade offs are what caused the original nest of problems in the original Brownfield. Thus the Greenfield becomes a Brownfield.


So it then becomes a race. Can you get all of the features implemented in the new Brownfield before being overwhelmed by the toxins being created.

Friday, August 8, 2008

Metropolis Is The Future Of Work

For those who have not seen Metropolis, work in the future is presented as an individual standing in front of a dial and moving two hands to connect the dots indicated by blinking lights. This appears laughable these days as we can clearly see that we would build a machine to automate even that task.
But consider the "Games With A Purpose" movement. A typical game puts two humans in competition to categorize something, like an image of a puppy. At this time, we cannot devise a program that will reliably label images in a way that humans would find useful. So by turning this into a game we can extract these labels as byproduct of humans playing the game.
This dynamic has a precedent, hackers have set up adult themed sites where access is gained by solving CAPTCHA logins. The CAPTCHA logins are used on sites which are trying to prevent automated access.
In both cases the thing which only the human can do is extracted and presented in isolation. All the other work has been automated. It is important to point out that in both cases there is "pay", in the one it is access to a game, in the other it is the adult material.
Now as to Metropolis, of course they got the minor detail wrong, which is the clock dial and the moving of the two arms in response to blinking lights. But as a metaphor it is dead on. Labeling images disembodied from their context. Solving CAPTCHA. The work is dull and lifeless. But what Metropolis tried to capture, it is work that requires the essential human.

Thursday, August 7, 2008

Prerequisite Package Location In Visual Studio

In order to use Prerequisite Packages in Visual Studio you must place them in the appropriate Bootstrapper directory.
For Visual Studio 2008 on 32 bit:
%PROGRAMFILES%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\
For Visual Studio 2008 on 64 bit:
%PROGRAMFILES(X86)%\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\
For Visual Studio 2005 on 32 bit:
%PROGRAMFILES%C:\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\
For Visual Studio 2008 on 64 bit:
%PROGRAMFILES(X86)%\Microsoft Visual Studio 8\SDK\v2.0\BootStrapper\Packages\

Wednesday, August 6, 2008

Buzzword: Greenfield Brownfield

It has become common to refer to new development projects as Greenfield. This obviously conjures images of an untouched patch of land with no previous work impeding progress.

Of late, a new term Brownfield  has become trendy to describe the rest of software development. Here there is the obvious contrast with Greenfield in the sense that the ground has been torn up and there is dirt and mud everywhere. But in addition, Brownfield had a prior meaning in commercial real estate. Brownfield referred to a property contaminated by one or more toxins.

In the case of software development, these toxins are prior decisions or implementations which have gone bad or never worked in the first place.

Tuesday, August 5, 2008

Device Emulator Manager and Internet Access

Device Emulator Manager and Internet Access

These steps were tested with:
"Pocket PC 2003 SE Emulator"
"USA Windows Mobile 5.0 Pocket PC R2 Square Emulator"

Launch "Device Emulator Manager"

1. Select Emulator From Tree control
2. Right click selection and select "Connect" from context menu
3. After Emulator Launches, Right click selection and select "Cradle"

On Emulator Window

1. Select from Menu: File->Configure…
2. Select Network Tab
3. On Network Tab, check box "Enable NE2000 PCMCIA network adapter..."
4. Click OK

On Window Menu of the mobile device

1. Select "Settings" from menu
2. Select "Connections" tab on Settings screen
3. Select "Connections" icon on "Connections" tab
4. Select "Advanced" tab
5. Select Networks
6. Select "My Work Network" from menu
7. Click "Edit" button below menu
8. Select "Proxy Settings" tab
9. Check box "This network connects to the Internet"
10. Exit all screens and menus with "ok" in upper right corner
11. Browse to google.com

Monday, August 4, 2008

Fixing: Virtual PC 2007 error "Reboot and Select..."

Description: When creating a virtual machine using Virtual PC 2007, the following error occurs on the first use:

"Reboot and Select proper Boot device or Insert Boot Media in selected Boot Device"

Solution: The root problem is the hard drive has been created as an empty hard drive, as such it has no operation system. So you will need to install the OS.



Sunday, August 3, 2008

Hail The Reference Implementation, Slayer Of Gurus

If you work in software development, gurus with silver bullet suggestions are around every corner. In a previous post, I mentioned how effectively, asking for a Reference Implementation can resolve the angst caused by these suggestions.
While I did not connect the dots at the time, I experienced this effect first hand in a prior project. I was in a liason role and there was an all powerful consultant (APC) from venerated Vendor (Microsoft, not that it matters all vendors do this). No matter what the problem was the APC always had that combination of Vendor silver bullets would fix the problem.

The scary side of the equation was no one knew what he was talking about and we were not sure if he was brilliant or just making stuff up. At one point, he had convinced us that a critical problem with one part of the Vendors stack could be resolved be a particular combination of silver bullets in other Vendor items.
At the following meeting with my consulting company, I brought up a particular silver bullet festooned boondogle and asked what should I do. Fortunately there was an older and wiser consultant advising us and he said, "Just ask for a simple reference project showing the ideas implemented". This I did.

For a while I waited eagerly for the demo. When it never came, I realized I could ignore the suggestion and what was better, I have been using this management trick ever since.

Saturday, August 2, 2008

Buzzword: Hatless

When talking about security there are two well worn buzzwords.

The White Hat is the good guy. He is the security guy who works for the company or it is used to refer to an ethical hacker. He pursues security exploits in order to make systems more secure.

The Black Hat is the evil hacker. Since both can and do use the same practices the terms white and black hat arose.

Now what about the rest of us? We are just the Hatless. (You can say it with the same emphasis you would give to "the great unwashed", only it is shorter.)

Needless to say in the battle between the Hats, white and black, we the Hatless are often the victims.

Friday, August 1, 2008

CORBA Shot To Death With Silver Bullets

The current "Communications of ACM" (2008 08) has two articles that combined are greater than their parts.

In "Software Development Amidst the Whiz of Silver Bullets", Alex Bell explains how we must be ever vigilant against silver bullet solutions. While it is not in the article, I can almost here a paraphrased common wisdom, "if the silver bullet worked, it would be the standard practice."

In "The Rise and Fall of CORBA", Michi Henning provides the Post Mortem Analysis of the CORBA effort. There is a nice auditory illusion that takes place if you read "...Whiz of Silver Bullets" right before reading "...Fall of CORBA", as Henning details the effect of too many specifications, contradictory specifications and unimplementable specifications, you hear the silver bullets whiz followed by the dull thud as they hit and kill developers and companies.

But there is more, Henning provides critical lessons learned. A good Post Mortem is interested in placing blame only to the extent that it allows for the illumination of what could be done to avoid the failure. In the case of the multiple contradictory and perhaps dubious specification one recommendation rings out "PROVIDE A REFERENCE IMPLEMENTATION".

Once again Waterfall and BDUF (Big Design Up Front) take a hit. In the CORBA project, specifications could be approved without anyone having to provide a reference implementation. That is classic Waterfall, all the design at the beginning and no feedback from the experience of having to implement the initial design.

Now if you go back to the first article "...Whiz of Silver Bullets", you have a new tool for dealing with the next silver bullet that is proposed at your company. Simply ask for a Reference Implementation. Often that silver bullet will show it's warts as soon as you get past the boilerplate code.