Saturday, August 28, 2004

New Look (aka the joys of CSS)

I changed the look of the blog today. I was getting tired of the "default" look and decided to customize it a bit. I started with the default Blogger "TicTac" theme, and then customized it.

I now have a banner image that randomly rotates on each page reload. The featured images (for now) are some excellent panoramic pictures of the City of Pittsburgh. Some are modern, some are from the early 1900's.

I also adjusted the feeds through FeedBurner. If anyone has problems subscribing, please let me know - it should be able to handle most RSS/Atom clients with a single subscribe link. If you are a blogger, give FeedBurner a try. See the sidebar for a link.

As for CSS, I think today is the longest amount of time I spent with it, and that was only a couple of hours. It was fairly easy to pick up. What is really interesting is how you can use CSS or HTML to define STYLES at design time, and at runtime you can change 99% of them. The :hover property of the 'A' object is not accessible from script.

One of the more interesting problems I had to solve was handling text coloring for the items that need to overlay the new banners. Of course, I need to specify certain things for each image - the color of the text/links, the color of hovers over the links, and the height of the image. At runtime, I randomly select an image, and the styles are changed to match. The title of the blog becomes a hyperlink to the main page if you are on an anchored article or in the archives. Since I couldn't change the :hover, I ended up cheating with handling onmouseover and onmouseleave events.

Anyway, if you want to check out the modifications to the modified CSS, you will have to view source, since I have no idea what the direct link to the CSS file is. If you want to use it, just send me a note or something!

Monday, August 23, 2004

COM+ in an MSI - Of Trials and Tribulations

I recently answered a question on installing COM+ applications in an MSI on one of the newsgroups. I promised that I would go into a bit more depth on the subject here, specifically on the different methods of installation I have tried and why they didn't work (and of course, what did work).

I had an application that consisted of about 200 COM+ components. These components were to be installed into three different directories, essentially separated by their tier (DB, Business, Common). The naming convention was related to the purpose of the DLL. As an example the Business component was "CurrentCustomerListBus.dll" and the DB component was "CurrentCustomerListDB.dll." The build output mimicked the actual desired installation directory structure. Several of these DLL's required configuration by means of adjusting the activation string and timeouts. These settings were different for each installation.

The first approach tried is the Microsoft suggested approach of exporting the COM+ application as an MSI. This pretty much populates an MSI with the files and TypeLibraries, plus adds a blob of undocumented stuff to the ExpType column of the Complus table of the MSI. When this is done, the output was less than desirable:

  1. MSI Validation fails due to short file name (SFN) clashes. Not really a big deal, but worth mentioning. This is due to point 2 below.
  2. The destination directory is a single directory. When exporting the application, there were no SFN clashes since they were in separate directories. Note the similarity of the first several filenames above. When the package is deployed they are going to the same directory thanks to the export process, so these clashes now exist. Although the single directory was not according to specs, it was a livable limitation.
  3. The installation specific activation strings could not be configured in the MSI. A Custom Action would still need to be written to programmatically change them after installation in the host MSI. Again, this is a problem we could live with.
  4. Deployment via a nested installation, meaning this exported COM+ MSI would need to be installed as part of another MSI. Nested applications are extremely difficult (if not impossible) to patch (exact words from the above link are "Patching and upgrading may not work with nested installations"). Additionally, to properly assure the application (which in my case was a Web application) would not be accessed until the application was fully installed, the nested approach would not be ideal. This one was a deal-breaker, but as it turned out, not the only one.
  5. Type Library clashes. Although this is not a problem with the export, it does indicate a problem with the construction (programming) of the COM+ application. While the application still functioned OK with these issues, redeployment through the exported MSI was just not possible. Plus, this was not discovered until much later - so I did not know the exported MSI really didn't work.

Approach #2 built upon the first approach. We were using Wise for Windows Installer 3.x which did not have COM+ deployment, so this limited other options. I took the exported MSI and turned it into a merge module using the Windows Installer API's and some tricky scripting. This approach solved problems 1 and 4 above. That is when we found out about problem #5 above, which completely killed this option.

Approach #3 was upgrading to Wise for Windows Installer 4.x Pro (Pro edition allowed for COM+ deployment plus build scripting). This approach failed due to all but reason #4 above, which was the only thing the Wise method solved. To blatantly rip-off Wise's new saying that they stole from my former coworkers (yes, you know who you are) "...but it worked on my machine." Yeah, right!

Approach #4 was the final, shipping method that I found to be 100% reliable, extensible, and portable. We started using Wise and moved to InstallShield with very little work (and none related to COM+) because of this method. For the tool migration benefits alone, this is why I prefer not to use vendor or tool-specific MSI extensions (InstallScript especially). But that is a subject for another future blog entry...

One last bit about approach #4 before I give away my secrets. I implemented it not exactly in the manner I am suggesting here. The main reason I didn't is to hit the testing deadlines and be sure what I released would work in the field. My approach is not perfect, and is difficult to move to another install. In other words, it is not a well-written series of CustomActions and tables that are portable enough to move to another installation without some modification. After this release, time became an issue so I couldn't reimplement it in a more extensible and portable manner. Please don't make the same mistake with your implementation.

To use approach #4, you should be familiar with interacting with Windows Installer via custom actions (VB Script if you want to use the many examples floating around - I prefer JScript). Secondly, you should not be afraid of programmatic access to COM+.

  • Create a feature and mark as hidden from the UI. Assure that this feature is always installed via using a Level or a custom action that sets it to be installed based on whatever conditions you require. Note that this feature can not be advertised.
  • Add your COM+ component dlls, and only your COM+ component dlls to this feature. Assure that you do not have them self-register or extract the COM information at install build time.
  • Use the COM+ APIs to construct some CustomAction(s):

    • At uninstall, call ShutdownApplication() on the COM+ Application and remove the COM+ application before the files are being removed. If your COM+ components are used by a service (homebrew, IIS, etc.), make sure you stop the means of access to the COM+ application. I generally place this action after the ServiceControl action in the standard sequence. This will prevent in-use problems at uninstall time.
    • During repair/reinstall/maintenance, you want to restrict access to creating the COM+ application and call ShutdownApplication() on it prior to any file actions.
    • During installation (and I do it as part of repair), delete and recreate the COM+ application and install each component. Essentially, you need to create a COMAdminCatalog, and on it call GetCollection("Applications"). You are returned a COMAdminCatalogCollection object consisting of Applications. Populate it by calling Populate() on it. Iterate the collection, remove/edit/create as necessary a new COMAdminCatalogObject to represent your COM+ application. Set the Name, Description, and ID values appropriately (refer to this) and then call SaveChanges() on the collection. This gets you the configured COM+ Application. To add components to it, call InstallComponent() for each COM+ dll. I make sure to create progress bar information as well so it does not appear to make the installation hang. I would use the information in the FeatureComponents, File, and Component tables to create a query that will ultimately allow you to get the path to each COM+ dll included in the hidden feature to build this list, then pass it as CustomActionData to the deferred action that actually does the work described above. Most of the COM+ stuff can be seen in action at the link I gave earlier. The MSI interaction stuff I expect you to should already know or be able to figure out from the inline links above - if you have specific questions, just ask!
    • Optional - configure component properties as required, such as the activation string, timeouts, etc. on a per component basis. I chose to hard-code this instead of creating a new table in the MSI to store these customizations, but in the future I would use a custom MSI table based approach.

That's all there was to it. It actually took less time to complete approach #4 than approach #2. I am not looking at the source code of my implementation to be sure I'm not missing anything, but this should be complete enough for you to use as a starting point at the very least.

Friday, August 20, 2004

The Case of the Disappearing DLL

Although this is not quite the Sherlock Holmes and Dr. Watson type of mystery, this bug was an interesting one to troubleshoot. After reading the bug report, I suspected what the problem was, but could not reproduce it on purpose in the lab without some hassle.

The bug report stated that some of the DLL's required by our product were deleting themselves. After installation, everything was fine. Sometime weeks later, a DLL or two mysteriously vanished.

The culprit? On an uninstall of the old version of the software, a DLL was in use, and its removal slated for post reboot. After the uninstall ran, the user promptly ignores the reboot request and installs the new version of the product. The dll is no longer in use at this point, so the installation succeeds and no reboot is prompted for. The next time the user rebooted - blammo - bye, bye DLLs!

I'm not going to give away my solution for this one (other than it involved fixing the uninstall process going forward), but one possible way to prevent this is to disallow installations if there are pending file removals or replacements. You can check the registry at HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations to see if there is some activity scheduled for after reboot. There is a tool that dumps this information and another one that captures that plus some other post-reboot activities. One of these tools should be part of every setup developer's toolbox.

Thursday, August 19, 2004

Why can't I use WScript in my MSI Custom action?

This is a fairly frequent question, and one that deserves a decent answer. VBScript and JScript custom actions run inside of the Windows Installer engine - in technical terms, the MSI engine is the scripting host for all scripts running as a custom action.

The scripting host program can make available objects to the scripts if it so desires. I've written applications that host the scripting engine, so this is familiar to me. In the case of MSI custom actions, the Session object is an example of this. When you run a script from the command line or by double-clicking it, it is hosted by the "Windows Scripting Host" (WSH), and it kindly supplies the WScript object. The main reason these objects are provided is so the script can interact with the host environment. In the case of WSH, you usually need to interact with the user since it is being run from Explorer or the console, hence the "Echo" method. In the MSI world, you are encouraged to interact with the MSI engine and let the MSI engine interact with the user based on the appropriate UILevel settings - this is all handled for you if you use the Session.Message API's to interact with the user or to write log files.

To summarize, if you have a script that contains WScript.something, it will not work in an MSI, as the WScript object does not exist and you cannot create it.

An unrelated issue (but people think it is related...) is the "WScript.Shell" object. You can create the WScript.Shell object (in JScript foo = new ActiveXObject("WScript.Shell")) and use it. In this case, the full name of the object you are creating is merely WScript.Shell by coincidence, and you are not calling a method on the WScript object, as you are in a line similar to WScript.Echo("foo"). An interesting related aside here is an article detailing the differences between CreateObject and WScript.CreateObject.

Danger, Will Robinson! Some antivirus programs and other script blockers will either silently block or loudly proclaim attempts to instantiate the WScript.Shell and/or the Scripting.FileSystemObject. These are commonly used by malware since they can access the registry and filesystem. Write a C++ dll custom action if you need to interact with the system in this way.

A fairly common question posted to the Windows Installer boards is "How do I sleep?" or otherwise delay the script. While I don't have an answer you want to hear, there is an excellent article about the subject here. BTW, the answer you don't want to hear is to write a DLL custom action that merely sleeps, add it to the CustomAction table, and in your CA script call Session.DoAction()

Monday, August 16, 2004

Averatec C3500 Review - Part I

[UPDATE 2/26/05: Since this is my most popular article, I have updated the driver download versions and links, corrected a previous mistake in the CPU speed of the unit, and made several updates to points where Averatec has now provided downloads for items not previously available. Look for these UPDATE tags throughout to see the changes.]

This review pertains to the Averatec C3500 Convertible Tablet PC model as sold at Costco. This Tablet PC has generated a bit of buzz because of its price point and its features. The Costco model differs from the specifications as listed on the C3500's homepage in three ways:

  • 80 GB Hard Drive (Instead of 60 GB)
  • Carry Case
  • $1279.99 Price (no rebate)

This review (Part 1 of at least 2) focuses solely on the hardware and software that can be discovered in one night of ownership. Issues such as heat, usability, battery life, and weight are not something that is easily determined or expressed after a few hours of use, so they will be covered in part II.

To put the review in perspective, I made this purchase on behalf of a student straight out of high-school going to college. Thus, the typical use would be for writing papers, with the bonus feature of note taking in the classroom. After showing a Tablet PC to this student, the features offered by the form factor and the OneNote application made it stand out from the crowd of traditional notebooks. However, my background is that of a software developer and general PC hardware enthusiast. Thus, the first two parts of the review will be mine and highly technical. The last part (assuming the student is willing) will be written from the typical non heavy-duty computer user college student.

Taking the unit out of the box, I noticed the case first, since the early message board reviews have not mentioned it much. It is a medium thickness, medium hard plastic, that is essentially a glove fit of the tablet. There are no pockets, and no storage space for anything but the tablet itself. It is also a purplish blue color. As this is not mentioned in the Averatec literature, it may be Costco model specific.

There are several images of the unit online, so I won't waste your time with putting more up here. I can confirm that there is a S-Video connector and not a composite video out that was pictured in some of the prototype models.

Plugging it in and turning it on began the typical Windows XP "finalize the setup" type stuff. I did specify an administrator password, which has a potential issue after rebooting the unit there is a logon box with the administrator name and a password error dialog that you must click OK to. Sometimes, this dialog is hidden behind the login screen, and selecting the user to login appears to hang. Use the ALT+TAB key combination to pop that window to the front, click the OK button, and continue the login process. Averatec does have an update on their webpage called "LogonFix" to correct this issue.

After booting for the first time, BEFORE going online/connecting to a network, I enabled the XP Firewall. If you do not know how to do this, I suggest Googling for it. I then grabbed Windows XP SP2 and installed it.

Once Windows was updated to SP2, I made a quick trip to Windows Update to see if there was anything else new. Turns out there are new drivers for the MSI 802.11g wireless card (released June 10, even though it is a Ralink card, see below) and the onboard SiS 900PCI network adapter (released July 11). Looking at the Windows Update history, looks like the person making the image for this tablet likely installed most if not all updates from Windows Update as of June 25th. I should have checked the installed updates previous to this point to have been sure. I installed these driver updates before checking the initial versions.

Hardware and Drivers
I always assure the latest drivers are installed before evaluating anything, so I checked with the hardware component manufacturers web sites to be sure. I hope this hardware and driver version list answers some questions related to the Averatec hardware components I have seen asked and not answered. Links are provided for the listed hardware for the geeks reading this (* means after the updates described above). [Update: Check Averatec's C3500 download site for potential updates to the below list.]

  • SiS Northbridge chipset M741
  • SiS Southbridge Chipset 963/963L (multiple chipsets listed at this link, make sure you are at the correct section)
  • SiS Video - Mirage - Driver version 3.60a [UPDATE: 3.65 is available from SiS dated 1/11/2005 - also, a version (which might be older than the SiS one previously mentioned) is on the Averatecs web site and purports to fix some issues. If updating to SiS's latest version doesn't do the job, try the version at Averatec's download site.] The on board video uses 32 MB of the total system RAM.
  • SiS AGP version (SiS's 1.17e), 7/18/2003 [UPDATE: 1.19a is available from SiS dated 1/25/2005]
  • SiS 5513 IDE The Microsoft SiS IDE driver comes installed [UPDATE: (v2.04a is available from SiS, dated 11/18/2003) CAUTION: Be prepared to roll back the driver, as an earlier SiS version prevented a successful resume from hibernate mode.]
  • *SiS 900 Fast Ethernet Controller v1.16.0.8, 7/11/2003 [UPDATE: v1.18 is available from Sis, dated 12/6/2004) ]
  • UC-Logic Serial Pen Tablet to HID Driver v5.1.3.2, 5/4/2004. This means the digitizer is likely this model. The pen is likely similar to this one. The drivers on UC-Logic's website appears to be for their tablets, not for these modules. [Update: Check Averatec's C3500 download site for an update to v. which may fix the disappearing floating input panel bug. One poster also claimed that a fix for this was posted on Windows Update.]
  • LCD Screen - 12.1" LCD that is identified as a Generic type ("Default Monitor"). The max resolution is 1024 X 768. I remember seeing a post where someone states they could take it to 1280 X 1024, but the only thing that does is make the screen scroll.
  • Hard Drive - Hitachi TravelStar 80GN (ATA-6, 4200 RPM, 12.0MS, 8MB Cache)
  • DVD/CD-RW Slimtype COMBO SOSC-2483K, likely manufactured by Lite-On
  • Alps Pointing device (12/5/2003, v5.5.1.2) [UPDATE: Version 6.0.305.5 is available from Toshiba.] Even though the driver is provided by another vendor, the control panel is much improved.
  • Modem - Motorola SM56 Data/Fax modem (v6.07.06, 4/27/2004) [UPDATE: v6.08.01 is available from Motorola's website.]
  • *Wireless - Ralink Technology 11g-RT2500 MiniPCI (6/10/2004 v [UPDATE: v3.0.1.0 (1/20/2005) is available from Ralink's website]
  • PCMCIA is identified as a generic cardbus controller
  • Processor - Mobile AMD Athlon XP-M 2200+, runs at speeds between 400 Mhz to 1.667 GHz depending on AC vs. battery and system load. [UPDATE: Thanks to the anonymous poster for correcting my mistake here.]
  • Sound - Realtek 650 chipset AC97 Audio (v5.10.0.5580 5/14/2004) [UPDATE: Version A3.69 dated 2/1/2005 is available at Realtek's website]
  • USB - SiS 7001 PCI to USB Controller using Microsoft drivers
  • RAM - 512 MB physical, 480 MB available to Windows (remember that 32 MB is set aside for the video RAM)
  • built-in microphone which is located towards the base of the screen below the pen holder. This feature is not mentioned in the Averatec specifications.

Sadly, none of these drivers are posted on Averatec's website, nor provided on a disc with the Tablet. Although most of the drivers are available from the manufacturer of the component, some of them (ALPS touchpad and UCLogic's screen/pen) are not available from the component manufacturer. This makes restoration or a "from scratch" installation of Windows XP impossible. This same issue exists with the included applications, which I will cover later. [Update: Check Averatec's C3500 download site - the digitizer and touchpad drivers are now available there - Kudos to Avertec for posting most of them. See above for an update to the touchpad driver]

As for included software, the Averatec has a basic configuration. It does not include the Office suite - just the OneNote application which is a part of the Office 2003 product suite. A complete listing of software is below:

  • OneNote 2003 (w/o SP1)
  • 1stMenuApplet (by FIC) 3.0 Alpha8 (Can't find this application or updates anywhere) [UPDATE: Check Averatec's C3500 download site - this is possibly what is in the Tablet Buttons download]
  • Roxio Easy CD/DVD Creator 6 Basic [UPDATE: Check Roxio's site for newer patches]
  • Adobe Acrobat Reader 6.0.0 [UPDATE: Please update this application, as 6.0.0 has some security issues. The latest version is 7.0. I highly recommend grabbing the PDF SpeedUp program after updating to reduce load times.]
  • Cyberlink Power DVD 5.0 (Update available to build 1203 7/26/2004)
  • Norton Antivirus 2004 (6 month trial edition)
  • Windows XP SP1 Tablet PC Edition
I upgraded the Antivirus software prior to applying XP SP2. This update included Symantec's WMI fix, which is supposed to make Norton Antivirus integrate with the security center feature of the latest Microsoft Operating System upgrade. Sadly, this did not seem to work correctly. I would advise people to install SP2 then run LiveUpdate to upgrade Norton. This may make the two play nicer together. I would be careful on sending this to college with the 6 month Antivirus subscription. Look at some sale flyers to find a deal on an antivirus program - usually you can find Norton or similar in free-after-rebate deals. Alternatively, you can grab a free copy of AVG or Avast. [UPDATE: I also highly recommend an antispyware application, such as Microsoft's free solution. To prevent spyware in the first place (although as the popularity grows, the spyware will follow) try Firefox as your new default browser.]

It goes without saying you should update Windows to SP2 ASAP. This upgrades your Tablet OS to the "Lonestar" or 2005 version, in addition to the security and reliability enhancements in Windows XP SP2. At the time of this posting, this should be available to all users via Windows Update.

Likewise, Microsoft has made tons of enhancements to OneNote. Going to the Office Update site should allow you to easily update this to the latest version. However, Averatec left us with a problem - early models of this Tablet do not include the CAB files this update requires, nor is there a stand alone installation CD. Since I am a MSDN subscriber, and have access to this application, I was able to update it. However, those of you that do not have the same luck as myself will need to try downloading the full file version of the service pack (larger of the two downloads at the bottom of the page). Please leave some feedback as to if this worked for you.

The 1stMenuApplet program is what is used to control the hardware buttons. Unfortunately, it resides in the startup folder. Some people like to remove applications from there, but don't remove this one if you want the HW buttons to work! Also, don't uninstall it by accident, as this is not provided separately. This application is completely unusable due to its horrendous UI, and the readme found in the program directory indicates it is written by FIC and is an alpha version. I'm hoping that a newer and more usable version of this software is provided at a later time. [UPDATE: Check Averatec's C3500 download site - this is possibly what is in the Tablet Buttons download, although it states it is the initial shipping version, I am not 100% certain that this is the case.]

Lastly, the BIOS (Yes, I'm calling it software) is made by Insyde. This is the most plain-looking BIOS I have ever seen. Virtually no settings can be altered aside from boot device order. Some people have speculated the video is capable of 64 MB shared memory, and the chipset specs appear to confirm this. However, the BIOS does not allow you to configure this amount. Perhaps future revisions of the BIOS will allow this.

I'm not a fan of benchmarks, but they can be a rough way to make comparisons. The methodology is simple: Two runs of the benchmark are done. One run with the AC power plugged in, one with the battery power. The software used is the PCMark 2004 Free edition. Drivers, applications, and OS are updated to the latest version as described above.
  • AC power: 2013 PCMarks
  • Battery: 2019 PCMarks
General Construction and layout
I found the unit to have a solid feel. The hinge also feels solid. The keyboard feels like most notebook keyboards, and I was able to type on it w/o missing keystrokes (My hand would be classified as "large" bordering on "extra-large" if you go by the manufacturer of most types of gloves).

There is nothing horrible about the layout, like most notebooks, the special keys are fairly inconsistent and reside in different places.

Wireless Networking
The wireless networking component can be turned on or off by using a switch. I believe this is to reduce the battery consumption of the receiver continuously scanning for an Access Point. One thing I noticed is even when the C3500 is near the AP (Excellent signal strength) Windows continuously pops up the " now connected" message. I am not sure if this is because the connection is constantly being broken and re-established or because Windows likes to annoy us with useless messages (ala Clippy). I will run a socket test application I wrote eons ago to determine what the problem is (if any) and report back in part II.

Overall initial impressions
I am quite disappointed that Averatec has not made the drivers and applications that are part of the restore image available as stand-alone install executables. This limits the end user's ability to repair themselves in the situation where inadvertent circumstances end up destroying the installed drivers or applications. Thus, the only way to recover from this is a fresh recovery image of the tablet with the user losing installed applications and data. [UPDATE: These are now available on Averatec's C3500 download site]

Secondly, although this is related to the first point, the Windows CAB files and OneNote cab files (installation files for reinstallation or patching) are extremely important, yet they are not provided. Averatec would do well by providing CD's containing these missing bits to the customers who bought early models without these installed. If the student were a web designer, IIS (the web server that ships with the OS) could not be installed with the CDs and computer as provided by Averatec.

On the plus side, the Averatec customer support rep I spoke with appeared to speak English as his primary language (contrary to some other posts I have read), and was able to answer the OneNote update question regarding the missing CAB files after a short delay. He did not point me to the full file download, although I am not sure if this will work or is an acceptable workaround (please let me know if this is the case). 24 hour tech support is provided.

In Part II of this review (expect it inside a week), I will cover more specifics of the performance of the hardware. Factors such as heat, boot time, battery life, included microphone performance, wireless networking distance and reliability, digitizer/pen sensitivity, and weight will be addressed. If there are any further questions as to the hardware or software not addressed in this article, please leave a comment as to what you want addressed and I will update Part I and add it to the Part II review. As a side question, what software should I add to this in addition to Microsoft Office student edition that would be useful for a college student?

Instant Insanity Follow-up

Nothing interesting has happened regarding this topic as of late. I did have one entry from a developer who used C# to create "Block" classes. The Object Oriented nature of this solution intrigues me, although I have not actually looked at the code yet. It should be interesting to profile from a performance factor. I have some other coworkers who have started this puzzle, but have not submitted final code. I'll have to try to get them to finish and I'll publish the results and more analysis at a later time...