RobertMayo.com

Monday, July 24, 2006

QuickTime & Windows Server 2003 - The Secret

I was just happy as a clam until a couple of weeks ago when my iTunes told me "There is a new version of iTunes. Would you like to download it?" Dunce that I am, I replied yes.

iTunes is bundled with QuickTime, and as you may or may not know, the latest version of QuickTime (version 7.0.3) from Apple is fairly incompatible with Windows 2003 Server. Ordinarily, I could care less, but iTunes requires QuickTime to run. The only reason I EVER use iTunes is to put music onto my iPods, and since iTunes was to ONLY thing that I could use, you can imagine how angry I was.

After doing a little research, I came across several threads like this one in the Apple support forums. It seems that one of the Security patches (KB908531) for Windows Server 2003 issued by Microsoft, creates a situation where parts of QuickTime's normal operation (including install) are now "privileged instructions".

You could uninstall this security patch and the latest versions of QuickTime and iTunes will work just fine. The problems with this are that 1) you leave your Windows 2003 Server vulnerable to attack, and 2) If you have your Windows Update set to automatically download, you will be consatntly downloading and re-installing this security patch.

The latest version of QuickTime claims to have corrected a vulnerability as well. Personally I would rather go with a secure Windows server and a vulnerable older version of QuickTime, so that's what I did.


So here's how to clean and revert QuickTime.

First, let's get down to the uninstall. Since the latest version of QuickTime fouls up the install, it fails to make the registry entries that would allow the uninstall to show up in Add/Remove Programs. OK, so then what? You could try using the Start Menu item to uninstall QuickTime (Start -> All Programs -> QuickTime -> Uninstall QuickTime). For the same reason (the catastrophic failure during install), it fails to make registry entries that would allow the InstallShield kernel to run the MSI package which would uninstall QuickTime.

Download the Windows Installer CleanUp Utility from Microsoft. This will find the MSI installer package and allow you to uninstall its contents fairly quietly.

It may still leave the files in place so be sure to delete those files manualy. Usually they are stored in C:\Program Files\QuickTime

Here is the step that is really important and must be done before proceeding any further. Open your system folder (usually C:\Windows\system32) and find 2 files, QuickTime.qts and QuickTimeVR.qtx. You must delete these files. They are Apple extensions for QuickTime that function like DLLs. Any QuickTime installer will search for the existence of these files and read the version information out of these files. Don't believe me? Run a file monitor during the install process.

OK, so now you have successfully cleaned off QuickTime. If you inadvertently uninstalled iTunes, you must install the latest version of iTunes (which will attempt to reinstall the latest version of QuickTime) and repeat the process.

QuickTime 7.0.1 Reinstaller

So now you should have the latest version of iTunes and the not so latest version of QuickTime.

Friday, July 07, 2006

HTML/Javascript: Wait for an asynchronous function to complete.

I happened to have a moment of inspiration today. I was building an HTML page which had some AJAX-based validation. Me personally, I'm in love with AJAX. It's a concept I've been doing myself, thousands of different ways, since long before anything was ever standardized. The problem sometimes with AJAX is the first letter, A, which stands for Asynchronous. The page will not wait for the AJAX-based function to complete before moving on to the next line of execution.

I had some validation routines in this page which needed to call some AJAX methods to do their work. Unfortunately one was dependent on the prior one completing.

Ordinarily, I use a global javascript variable which tells me that I'm currently validating. If I call an AJAX function, I check whether the variable is set. If it is set, I leave the function. This works in a scenario where the AJAX function is triggered by some user action; a button-click, a textbox change, etc. I make it so the user simply can't perform the 2nd action until the first completes.

In the scenario I was working with today, the user would trigger a synchronous action, which subsequently called 2 asynchronous AJAX actions. In theory, the synchronous method could finish executing before the two asynchronous methods even start.

The first thought I had would be to loop indefinitely in the synchronous method until the first asynchronous method completes. I know from experience that will not work. When the asynchronous method attempts to execute any script in the calling page, it will not be able to because the synchronous method still has control of the execution while it's looping.

I created a little solution that would allow me to block execution until a given condition changes. I use window.setInterval() to periodically check if a condition is set. If the condition is set, I then execute code. In my application, I continued to set the global variable at the beginning of each AJAX function. In the synchronous method, I call one AJAX method, use window.setInterval() to block until the global variable is unset, then call a method which executes the second AJAX method and blocks until it is complete. When the final blocking is complete, another method is called which continues the validation.

Voila! Synchronous from asynchronous. An fairly elegant solution which only took me a few minutes to create. I thought I'd share it with the world.

You may download sample source here.
 WaitThread 2006-07-07.zip

Labels: , ,