How to replace a installed buggy .MSI file with a fixed one.

Aaron listed a couple of ways of removing a buggy .msi file that was installed, but would not uninstall. This is why I test all of my .msi files with VMWare. Being able to rollback changes to a virtual machine is priceless.

  1. Forcibly install a fixed version of the MSI – for this option, I took my newly fixed MSI that no longer had the uninstall bug and ran the following Windows Installer command line to force it to be installed over the top of the buggy one that was stuck on my system: msiexec.exe /fvecmus my_product.msi.  This command line forcibly replaced the old installation with the new one by running from the source MSI and recaching the copy of the MSI in %windir%\installer.  This removed the bug that blocked uninstall, and after that I was able to launch uninstall from Add/Remove Programs and everything worked as expected for me.
  2. Manually edit the cached MSI – for this option, I found the locally cached copy of the MSI in %windir%\installer (by looking at timestamps and finding the most recently created file in that folder), opened it in the Orca MSI editing tool, and then manually removed the entries from the LaunchCondition table that were blocking uninstall from running.  This option can be used to fix simple errors, but complex errors will likely be difficult to manually fix in an MSI editor such as Orca.

 

from [Aaron Stebner’s WebLog]

Prototype vs. Atlas

I came across an interesting blog posting about the Prototype Javascript package and how it compares with Atlas. It boils down to they try to do similiar things, but come from different directions. Atlas is server-side centric and is designed to bolt into Visual Studio and Prototype is client-side oriented and isn’t a .NET tool (100% Javascript). Check out the links to moo.fx and Rico in that article, they are doing some cool UI things with Prototype.

Great, now they are targetting VMWare

http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=2000

A vulnerability has been discovered in vmnat.exe on Windows hosts and vmnet-natd on Linux systems. The vulnerability in this component affects VMware Workstation 5.5, VMware GSX Server 3.2, VMware ACE 1.0.1, VMware Player 1.0, and previous releases of these products. The vulnerability makes it possible for a malicious guest using a NAT networking configuration to execute unwanted code on the host machine.

VMware believes that the vulnerability is very serious and recommends that affected users update their products to the new releases available at www.vmware.com/download or change the configuration of the virtual machine so it does not use NAT networking.

from [Spyware Warrior]

Iv’e been using VMWare for years. I implement the installers for most of our companies products and there is no way I could test the installers with running various combinations of Windows inside VMWare sessions. I could use Virtual PC as it comes with my MSDN subscription, but I think VMware is still a better product.

The joy of editing the Mac OS X hosts file

I have a G4 iMac on my desk. You know, one of the ones that looks like a desk lamp. It competes for space with my two XP boxes. I do my development under XP, the iLamp is for testing our web apps. The ilamp more or less sees our network, but it can’t resolve workstation WINS names to actual IP addresses. Since I know zip about configuring Mac OS X networking, I figured I would cheat and just add the workstation IP addresses to the hosts file on the iLamp. In a normal OS, you just edit the hosts file and be done with it, not with the iLamp. No sir, you have to mix the cutting edge of 1978 technology with arcane Mac OS X commands. After some googling, I found what I needed here at macosx.com. You have to run a unix/linix/whatever shell, edit or create the hosts file, then load it with niload. And that’s the simple way to do it. If you want to do it with the GUI tools, it’s pretty damn tedius.

Launch netinfo, located at /Applications/Utilities/NetInfoManager
Under the Domain menu, select Security, and Authenticate. Type a username and password with admin prividledges.

Select, in the Directory Browser, / and then ‘machines’.

Either press apple-n, the icon that looks like ‘new folder’ or go to the Directory menu, and select ‘new sub directory’.

This should insert a flag at /machines/net_directory

Unless you are creating an entry for a host named ‘new_directory’ you’ll want to rename it.

Select, in the ‘Directory: new_directory’ plane that has ‘property and Value(s)’ stuff the first, and only entry (“name | new_directory”).

Under the ‘Directory’ menu, select ‘Delete value’.

The entry should now read ‘name | ‘. Which is good.

Now, enter the hostname, which can be something simple like myfileserver or as ‘complex’ as files.danz.quons.net or whatever.

So, select the name and line, and go to the directory menu, and select ‘insert value’. (option-apple-i)
Now type the hostname.

Next, we need to input an ip address.

First, insert a new property, called ‘ip_address’.
apple-shift-n or apple-shift-i (eye – look in the directory menu, you’ll see it).

where it says ‘new_property’, click and type ‘ip_address’.

Where it says ‘new_value’, type the ipaddress that goes with the host you inserted.

If you wish, you can enter more than one hostname, so if for example you wish matrixbaby.graphics.ddn.net and matrixbaby both to go to the same IP, just insert an additional value to the name property:

Select ‘name’ and under, the ‘directory’ menu, select ‘insert value’ (apple-option-i).

That should do it, close out of netinfo, and you’re set. If you wish to properly name your computer, either insert/modify the entry called ‘localhost’ and give it a name, in addition to localhost. I think thats what I did. you can also modify the /etc/hostconfig file, change the HOSTNAME= localhost to whatever you wish.

I guess it could be worse, at least Mac OS X has a command line.

I’m in the market for a new 802.11g adapter for my wife’s PC.  I started out with a Linksys USB adapter, but it gets horrible reception. I ended up taking one of the SMC wireless bridges from one our Tivo’s and putting it on here PC. The SMC bridges get incredible reception, but they are twice the price (or more) of a decent 802.11g adapter. One a week, I take the bridge off the PC and slap on the Tivo so it can phone home and get the latest program updates. Hawking just announced a new 802.11g adapter with a directional antenna, the HWU8DD. It looks like a cheap TV antenna but they are claiming a 8dBi gain in signal strength. In comparision, most 802.11 g adapters have a 1 or 2 dBi antenna. As you can see from the picture, the adapter has a small dish on it. This is a directional antenna, you get a better signal because you are aiming the adapter at the wireless access point and/or router. I may have to get of these puppies when they hit the retail market.

I have one of their Hi-Gain laptop cards and it gets an incredible signal, largely due to it’s directional antenna. If you need to add a wireless card to your notebook, you will be hard pressed to find one with better reception than this one.

Adding "Install as…" to context menu

This comes from Michael Willers, by way of Dana Epp. This makes it easier to install .msi packages when logged in as a non-admin use. Too many home PC’s are running in Admin mode, one of the many reasons why we have so many virus attacks out there.

If you run your box with a non admin account the “Run as…” entry in the context menu is very comfortable. Wouldn’t it be nice to have something like “Install as…” for MSI-Packages? This is just a registry hack away

  1. Run regedit.exe under an account with administrative privileges
  2. Create the key HKEY_CLASSES_ROOT\Msi.Package\shell\runas\
  3. Set the default value to Install &as…
  4. Create the key HKEY_CLASSES_ROOT\Msi.Package\shell\runas\command\
  5. Set the default value to msiexec /i “%1”

Disabling the VMWare network adapters

When you are not running a VMWare session, you may want to disable the VMware virtual network adapters. I have found that they can slow down network operations on the host. Anything doing a UDP broadcast that is sentg over all adapters will take much longer to run if they broadcast over the VMWare adapters. The ListAvailableSQLServers function call in the SQLDMO library is one example that I came across that slowed down dramaticly with the VMWare adapters running.

You have at least three ways of enabling and disabling the network adapters. You can open up the Device Manager (click the “Start” button, select “Run…”, enter devmgmt.msc), select the “VMware Network Adapter VMnet1” and “VMware Network Adapter VMnet8” adapters and press the disable button in the tool bar. The second option is to right click on “My Network Places” in the Start menu and select “properties”. You can then right click on the “VMware Network Adapter VMnet1” and “VMware Network Adapter VMnet8” adapters and enable or disable them. The third method is via the command line, so that you can script it.

Microsoft, in it’s infinite wisdom, does not provide a command line means of enabling or disabling network adapters out of the box. For that, you’ll need DevCon.exe, the command line alternative to Device Manager. You can get from Microsoft as Knowledge Base article Q311272. With devcon, you can disable/enable a netwoirk adapter by it’s hardware id. You can get the id from Device Manager, or by running devcon.exe like this:

devcon hwids =net

That will spit out a great deal of information, the ID’s that you are looking for are *VMnetAdapter1 and *VMnetAdapter8. You can disable them individually or do both with a wildcard

devcon disable *VMnetAdapter1
devcon disable *VMnetAdapter8

or

devcon disable *VMnetAdapter*

The former probably executes faster, the latter is simpler. I run with the adapters disabled and I only enable them whem I am running a VMWare session.

If you are running Windows 7, you should head to Windows Driver Kit (WDK) Version 7.1.0 Release N, which includes a version of devcon that will install under Win7 64bit.  If you have an older release of the WDK, you can extract the devcon.exe out manually.  A commenter left a link to a post that included the following instructions:

  1. Download the “Windows Driver Kit (WDK) 7.1.0 from MS, it is an ISO image of several hundreds meg in size.
  2. Using UniversalExtractor (http://legroom.net/software/uniextract) extract the ISO to a temporary folder.
  3. Again using UniversalExtractor, extract the install file “WDK\setuptools_x64fre.msi” to a temporary dir
  4. In that temporary dir you will find “WinDDK\7600.16385.win7_wdk.100208-1538\tools\devcon\amd64\devcon.exe”. It may be in a different folder hierarchy, but it should look like.

Along the way UniversalExtractor will prompt you with some warnings, just click OK. With Windows Vista and Windows 7, it will need elevated administrator rights to run.

Exceptions and Threads

Scott Allen has a good post about a difference in how unhandled exceptions are dealt with in .NET 2 from how they were handled in 1.1 In 1.1, if a thread has a unhandled exception, the app would continue to run and there wouldn’t be any notice of an error. In .NET 2.0, an unhandled exception in a thread will take out the app, just like if it had occurred in the main thread.

I’m not sure how other people will like that, but that’s good news in my book. If an unhandled exception is going to take down an application, then it should happen across the board, not just in the main thread.

One of the projects that I am working on now is a set of services (.NET 1.1) that collect data from 3rd party GPS vendors. They are multi-threaded and I have spent a good deal of time working on the concurrency issues and error handling. If one of the background collection threads goes down, I really want to know about. I have try/catch in all of the places that need it, but if I have missed something, I want it to go down in flames instead of pretending nothing has happened.

Service applications, by their very nature, need to be able to document when an exception occurs. Writing to the Windows event log is pretty much a requirement. When the excrement hits the rotating air displacement device, the event log is your friend. I’ve been using Log4Net and logging error messages to my email account through it’s SmtpAppender.

Log4Net was a pain to getting working, but it’s a much simpler mechanism than the Logging block in Enterprise Library. One of the requirements of the service is that it be easy to configure for the end user. I don’t want the end user to have run or even know about the “Enterprise Library Configuration console” that the Enterprise Library uses to manage the configuration settings. It’s a whole lot of overkill for what I needed.

Saving and restoring a forms location on

Raghavendra Prabhu has the start of some code to save/restore a form’s position.  This requires the Application Settings feature in 2.0, so this is mostly theoretical for me.

 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
     Properties.Settings.Default.MyState = this.WindowState;

if (this.WindowState == FormWindowState.Normal)
{
   Properties.Settings.Default.MySize = this.Size;
   Properties.Settings.Default.MyLoc = this.Location;
}
else
{
   Properties.Settings.Default.MySize = this.RestoreBounds.Size;
   Properties.Settings.Default.MyLoc = this.RestoreBounds.Location;
}

Properties.Settings.Default.Save();

}

private void Form1_Load(object sender, EventArgs e)
{

this.Size = Properties.Settings.Default.MySize;
this.Location = Properties.Settings.Default.MyLoc;
this.WindowState = Properties.Settings.Default.MyState;

}

As noted in the comments to his post, this code doesn’t take handle conditions like multiple instances running (each additonal app should offset it’s location) or if the resultion changed and the app is not off the screen.  But it’s a start.
via [jfo’s coding]