Tuesday, December 27, 2005

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.

Thursday, December 22, 2005

Great, now they are targetting VMWare


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.

Wednesday, December 21, 2005

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.

Monday, December 19, 2005

Jon Galloway has a quick, consise post on how to restore a SQL Server 2000 database from a backup. I have all of this encoded, plus a something things, in ToolMS; but it's good to keep it on on file.

[JonGalloway.ToString()] DOS batch script to restore a SQL 2000 database and grant permission to ASPNET account

Friday, December 16, 2005

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"

Wednesday, December 14, 2005

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


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.

Monday, December 12, 2005

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

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



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]

Multiple remote connections to XP SP2

via [ISerializable - Roy Osherove's Blog]

Friday, December 09, 2005

I love nerd humor

This was from a Saatchi & Saatchi ad campaign. You don't often see CMYK humor.

"This is worse than a Star Trek convention."

That was a comment posted on a Gothamist blog entry about making fake MTA posters. The designer types are arguing over fonts typefaces. It's very much like the Kirk vs Picard arguments found on the Star Trek boards.

Oh, and it would be Kirk.

Set the wayback machine to late 1980's

SteveX posted some tidbits about his work on VirusX, a virus checker for the Amiga. I get Lattice flashbacks whenever he does that.

I learned how to program in C on Lattice. At my first real job, we used the Lattice C compiler for Unix and MS-DOS. I bought the Amiga version and taught myself C with it. Back in the early 80's, Lattice was the only game in town for getting commercial C compilers. Even Microsoft repackaged it as Microsoft C until they came out with their own compiler (MS C 4.0). By the time I was using it (1988), Lattice was being eclipsed by Microsoft's own C compiler and Borland's Turbo C. We eventually dropped it for the Watcom C compiler, a C compiler that ran circles around Microsoft C back then. It's hard to imagine, but Microsoft used to have serious competition in the compiler area. Watcom C was nearly 100% compatible with Microsoft C at the source level, but it would compiler smaller executable that ran faster than the same code compiled with Microsoft C. Mind you, this was back in the early 90's and Visual Studio did not exist. Lattice was eventually bought out by the SAS Institute, who then effectively killed it.

I was surprised to see that Watcom C is still around as Open Watcom C/C++ and FORTRAN. Sybase ended up owning Watcom and realized that maintaining the compilers didn't make a lot of business sense. So they open sourced it about 5 years ago. It looks like you can still build Netware NLM's with it. If you ever needed to write a NLM, this would be the way to do it without having to spend any money.

Cool site for sysadmins

I just came across adminfoo.net, a site with resources for system administrators for Linux, Windows, and Mac.  It’s got a lot of cool stuff.

Tuesday, December 06, 2005

VMware-authd.exe slowing down my PC

I was doing some work on one of my PC's and I had the processes list open in Task Manager. Out of the corner of my eye, I noticed that one process, VMware-authd.exe, was going from 0 to 10% of the CPU. I didn't know what that process did, I went out on a limb and assumed that it was somehow related to VMWare. VMware is one of my favorite tools, but I wasn't running any VMWare sessions. Time to go Googling. Apparently it's a service that provides administrator priviledges to to a running VMWare session if the host use isn't logged in with administrator access rights

If you are logged in with admin rights, you don't need to have this service running. VMware-authd.exe is the name of the executable for the "VMware Authorization Service" service. You can go into Services and shut that service down and then set it's startup type to "manual". There are no other services that depend on that service to be running. You can also stop the service from the Windows command line with the following:

net stop VMAuthdService

[Edited on 3/5/08]

If you need to restart the service from the command line, use the following:

net start VMAuthdService


Today our main app’s help system broke.  I hate that when it happens.  This app is built with Delphi, which supports WinHelp (*.hlp) files for context sensitive help.  A long time ago, I added some code to allow our apps to use HTML Help (*.chm).  It was fairly trivial to implement and once I got it working, we never had to look at that code again.

Until today.  The latest build of the help file didn’t work.  We pressed the help button and nothing happened.  Yet, if we ran the help file outside our app, it loaded up just fine.  Obviously something had changed, the question was what had changed.

The first step was to fire up the app and step through the code.  To use HTML Help with Delphi, I use some open source code that provides a Delphi wrapper for the function calls in hhctrl.ocx.  When I stepped through the code,   I ended up here:

h := HtmlHelp(0, PChar(mHelpFile), HH_HELP_CONTEXT, 5000);  // data = helpcontext id

The mHelpFile variable is the full path the .chm file.  HtmlHelp mapped to HtmlHelpA in hhctrl.ocx.  5000 the context id for the start page in the .chm.  It’s set to 5000 because nothing defaults to that value.  If the context id’s are not defined correctly, it wont have a context ID of 5000.  The code would call HtmlHelp and 0 was being returned.  In this context, 0 means that the context id of 5000 doesn’t exist in the .chm file.  It’s the same thing as calling the HtmlHelp executable, hh.exe, with the -mapid parameter.

hh.exe -mapid 5000 myfile.chm

So that’s my theory, next step is to prove that ID’s are missing or incorrect.  The guy who generated the .chm file was gone for the day and I don’t have to toys used to create the .chm file.  But I did have the .chm file.  Keyworks has a nice (and free) utility called KeyTools for working with HTML Help files.  One of the things it can do is to decompile the .chm file back to the source files.  I did that and opened up the .hhp file and sure enough the context id’s were all wrong.

Delphi Interview Questions

Nick Hodges posted a list of interview questions for Delphi programmers. While I usually like his posts, I didn't agree with this one. I've been using Delphi since version 2 and I would get a brain freeze if I got all of those questions in an interview. I know them all, but to repeat them back in an interview, that's not going to happen. The sole exception would be writing of a function to reverse a string. If I was interviewing someone, I would make them write a function like that. It shows how they think and hopefully what processes they are accustomed to following.

Another thing I do is to describe a wierd bug that would have been submitted that no one could reproduce and ask the interviewee what steps he or she would take. I would describe a real of fictious application (it really doesn't matter) and then describe a loose series of steps that will crash the application, but only on a certain. You can adapt the description to match the perceived skill level of the applicant. This is closer to real life and you can hopefully learn a few things about the applicant. How does he react under stress? How well does he know the debugging tools and methodologies. You'll want to see what steps or directions he would go in order to isolate and reproduce the problem.

I would also ask some generic SQL questions. Every job that I 've had (OK, it's a short list) has involved SQL at some level or another. I don't think you avoid databases and every programmer should have some level of familiarity with SQL.

The rest of the questions in Nick's list show that you have memorized the help system, it doesn't tell you if you actually know to use it. Unless you are writing components, how important is it to enough about how components are read in to repeat it back in an interview. In our shop, we have 7 developers who use Delphi. Only one of us (me) has any real experience in writing a new component from scratch, and doing it the right way. And that's OK. We're not in the component development business, we're in the business of writing applications.

These questions would weed out a skilled programmer who never used Delphi. I would greatly prefer getting an experienced programmer up to speed with Delphi, then dealing a programmer with Delphi experience, but otherwise horrible.

Here are some suggested Delphi interview questions:

  1. Describe how components are loaded from a DFM file at runtime.

  2. What is the difference between TGraphicControl and TWinControl?

  3. Write a function that reverses a string.

  4. If a component has another component as a property (example:  TDatasource has a TDataset component as a property), what happens if the “pointed to“ component is deleted?

  5. Where does TCustomControl fit into the VCL heirarchy?

  6. What is the purpose and significance of the TPersistent class?

  7. What are the three methods required for an implementation of IInterface?  What do they do?

  8. What class in the VCL heirarchy implements IInterface?

from [Nick's Delphi Blog]

Monday, December 05, 2005

Free icon sets from IconBuffet

Thanks to a tip posted on Forevergeek.com, I came across a site that offers free commercial quality icon sets.  IconBuffet.com sells a wide variety of icon sets for app and web work.  What they also offer are free sets.  You register with them and once a month they send you a free set of icons.  To raise it up a notch, they will send different people different sets each month.  You are allowed to send each set up to 5 times to other people through IconBuffet’s web site.  They call it “Free Delivery”.

I just signed up and I have the “Oslo Finance” set.  There are about 10 or 11 different images, in a wide variety of formats: BMP, GIF, Mac ICNS, Win ICO, TIFF, and PNG.

If anyone with an IconBuffet account wants this one, just leave a comment here or email me at anotherlab{at}gmail{dot}com.  I’m looking for the other sets, with my eye on the Shanghai Tech and Shanghai Tech Vector sets.

 [2nd edit]

I just got my first deliveries (thanks Dan!).  It’s the Shanghai Tech Vector and Shanghai Tech sets.  Duncan sent me all 5, I now have a complete set.  I’m not sure what I’m going to do with them, but they are cool.

[Edited on 12/7/05]  I have the following sets left

  • Oslo Atmosphere, 3 deliveries remaining
  • Oslo Finance, 2 deliveries remaining
  • Shanghai Tech, 1 delivery remaining
  • Taipei Buddies 1, 2 deliveries remaining
  • Taipei Buddies 2, 3 deliveries remaining
  • Taipei Night Market, 3 deliveries remaining

Technorati tag:

From the Department of People with way too much time on their hands...

It's just an animated GIF, but it's mesmerizing.

Scott Allen list of ASP 1 to ASP 2 resources

I grabbed this from Scott Allen's blog. I will probably need it sooner than later....

Scott Guthrie: VS2005 Web Project System: What is it and why did we do it? Yes, Microsoft did think about the changes.

MSDN: Step-By-Step Guide to Converting Web Projects from Visual Studio .NET 2002/2003 to Visual Studio 2005. Don’t go in blind, go in with a plan.

MSDN: Common ASP.NET 2.0 Conversion Issues and Solutions. The migration tool is still undergoing some improvements. This document explains some of the pitfalls.

Scott Guthrie: HTML Validation Checking (and how to turn it off). I recommend you turn off HTML Validation checking when migrating a project and concentrate on getting a working application. Once all the migration issues are resolved, turn validation back on.

MSDN: Web Deployment Projects. This is an invaluable tool for moving bits into production. It is still a beta preview. Most of the issues I’ve seen with the tool revolve around merging assemblies.

Rick Strahl: Understanding Page Inheritance in ASP.NET 2.0. Rick provides excellent coverage of the how the new model works, why the new model is an improvement, and what to watch out for.

Scott Allen: Debug & Release Builds in ASP.NET 2.0. This post also covers a lot of the compilation differences.

via [K. Scott Allen's Blog]