Joe Maller.com

IE6, IE7 and IE8 Compatibility testing with Microsoft Virtual PCs

Or: How to covert Microsoft’s Internet Explorer Application Compatibility Virtual PC images for testing on a Mac with Parallels Desktop or VMware Fusion. (but that’s kind of a mouthful)

To help with web development and testing, Microsoft provides several compatibility environments for past versions of Internet Explorer. These are time-limited, pre-configured Virtual PC disk images, intended for use with Windows Virtual PC.

That’s great, except Virtual PC doesn’t really run inside another virtual environment like VMware Fusion or Parallels Desktop. Since so much web development is done on Macs these days, this makes testing difficult. But, the VPC images are just virtual hard drives, so they can be easily converted to the native format of either Parallels or VMware.

Below are instructions for converting Microsoft’s .VHD files to native Parallels Desktop or VMware Fusion virtual machines. The goal is to do everything without using another Windows machine or digging out your old WinXP CD.

Get the IE Compatibility VMs

Download one or all of the Internet Explorer Application Compatibility VPC Images. Self-extracting EXEs can be decompressed on a Mac with The Unarchiver. The VHD is all that’s needed, one or all of these:

  • IE6Compat.vhd
  • IE7Compat.vhd
  • IE8Compat.vhd
  • Vista Business with IE7.vhd
  • Vista SP1 x86 with IE8 2009-Apr.vhd

Convert the VHD image to Parallels’ or VMware’s native virtual disk format

Currently, Parallels Desktop 6 can’t convert VHDs through it’s GUI, but it does include a hidden command-line utility which works perfectly. Create a new Parallels VPC in the default location (~/Documents/Parallels) with this command:

$ /Library/Parallels/Parallels\ Service.app/Contents/PlugIns/Parallels\ VM\ Converter.app/Contents/MacOS/prl_convert IE7Compat.vhd 

For VMware Fusion, use one of the components in Q (qemu-img, details) to convert the .VHD files to VMware’s .vmdk format.

$ /Applications/Q.app/Contents/MacOS/qemu-img convert -O vmdk -f vpc IE7Compat.vhd IE7Compat.vmdk 

Create a new Virtual Machine using the vmdk as the disk. I could not get Vista to work dependably with VMware.

XP: Fix Windows Drivers

On first boot, the VM will attempt to re-activate Windows. This will fail because the networking drivers haven’t been installed yet.

Next the VPC_EULA will open and the first of many “Files Needed” dialogs and “Found New Hardware” wizards will appear. Close and cancel everything until you’re back at the Windows XP desktop.

If you’re running Parallels Desktop, it will take over and install its tools. If you’re using VMware, choose Install VMware Tools from the Virtual Machine menu. VMware also asks for a handful of drivers during tools installation, cancel these, they’ll be fixed later. The VM will reboot when the tools and drivers finish installing.

After the initial reboot, Windows requires WGA activation. Since this is a Microsoft-provided license, the VM will pass WGA and Windows will be activated. There’s no point in registering, so skip that. Everything from here forward is cleanup.

The easiest way to fix a bunch of drivers is to install XP Service Pack 3. Download the ISO from Microsoft here: Windows XP Service Pack 3 – ISO-9660 CD Image File

Any lingering driver issues can be resolved in Device Manager (Control Panel > System > Hardware tab > Device manager). The problem items should either have their drivers updated or, if that doesn’t work, disabled altogether. VMware’s audio driver failed to load initially but updated successfully. Mystery USB devices were a problem in both, but can be disabled.

Ironically, I had much more trouble getting these VMs running natively under Virtual PCs on a Windows box. Many of these steps are necessary there too.

Other stuff I install:

VMware or Parallels?

For years I’ve been bouncing back and forth between the two. It seems that with each major release, one leapfrogs the other. After testing VMs in both, I’ve decided to switch back to Parallels. At the moment, it just seems more full-featured and seamless. According to a recent MacTech virtualization comparison test, Parallels is also faster.

Disclaimer

The above process may violate the second paragraph of the “Installation and Use Rights” section of Microsoft’s XP EULA:

You may install and use one copy of the software on your device of which you are running a validly licensed copy of Microsoft Virtual PC or Microsoft Virtual Server. You may not change or convert the virtual hard disk image from the VHD format.

However, no such clause appears in the Vista EULA which seems to contradict the above and fully supports virtualization:

You may install and use one copy of the software on your device of which you are running any virtualization software able to run Virtual Hard Disk (VHD) formats, including Microsoft Virtual PC or Microsoft Virtual Server.

Anyway, I assume no responsibility for what anyone does with this information.


iTunes Store DNS Connection Problems

Recently I’d been having some bizarre network problems, the most consistent of which was that I couldn’t connect to the iTunes Store. After a short round of testing, I was quickly able to determine that the problem was DNS servers I was using.

Yes, I’m one of those people who uses those 4.2.2.x DNS servers, for probably 10 years they’ve worked perfectly.

Methodology
While DNS servers can be set in the Mac’s System Preferences, that requires a lot of clicking and it’s faster to just use the networksetup command line tool. Since we’ll also be flushing the Directory Services cache with dscacheutil, switching servers can be condensed to one line making testing faster. Here’s an example of the command I’m using:

sudo networksetup -setdnsservers "AirPort" 4.2.2.1 && \
dscacheutil -flushcache

I repeated the above for each of the six known 4.2.2.x DNS servers. After individually setting each DNS server, I switched over to iTunes and attempted to access a different section of the iTunes Store.

Results
4.2.2.1, 4.2.2.2, 4.2.2.3, 4.2.2.4, 4.2.2.5 and 4.2.2.6 all failed to connect to iTunes. Each of the servers appeared to be online and responded to pings with an average response time of about 12 ms.

When I switched to any of the top three recommended DNS servers on DNSServerList.org, I was able to connect to the iTunes Store instantly.

There have been a few tweets with similar problems, but I couldn’t find anything related to upgrades or other problems with the 4.2.2.x servers. I haven’t yet been able to test this on other connections but will post an addendum once I have.

Share |

link: Mar 22, 2009 6:18 pm
posted in: misc.
Tags: , , ,

Last Minute Macworld SF ’09 Predictions

If this isn’t the last Macworld Expo, in 2010 everyone will say it should have been.

What I think we’ll see

  • New Mac Minis. [ wrong ] I don’t even care what the specs are, I’m buying at least one for the office. I’ve been putting this purchase off forever waiting for a newer revision, the current model has been unchanged since August ’07.
  • Unibody 17″ MacBook Pros. [ right ] This just seems obvious. I don’t know how much stock I put in the non-removable battery rumors, though it’s not inconceivable that battery access was reducing rigidity in the aluminum and was dropped for structural reasons. [ wrong ]
  • iLife and iWork 09. [ right ] I just hope Apple looked long and hard at Mobile Me and then ran as fast as they can in the opposite direction.
  • A new 30″ Cinema Display with Mini DisplayPort connectors and a camera. [ wrong ]
  • Phil Schiller will be wearing buttons. [ right ] Consensus will be that he was boring because he didn’t do anything insane.
  • Steve Jobs will not appear. I get the impression he’s so far past completely annoyed with the media attention that there’s no chance he’ll iChat in just to bump the stock a few dollars. [ right ]
  • The stock market is just too erratic these days to call any dependable reaction. I have some feeling that the stock will be punished for less than earth-shattering announcements, [ right ] but it all depends on the broader market. I’m going to be watching the UltraShort tech ETFs.

What I’d like to see

  • I’m hoping for a significant update to the AppleTV. If Apple don’t start taking this product seriously, they’re going to lose this market — if they haven’t already. Roku and Tivo are cutting deals with Amazon and Netflix for huge libraries of TV and movies on demand. These alternates are tempting, especially compared with the often anemic rental selection available from iTunes.

    There’s a lot to hate about the current AppleTV, the movie browsing interface, where you have to scan movie poster thumbnails with text that only appears when active is just horrible. AppleTV doesn’t have to suck like this, make it awesome, just don’t break Boxee.

  • Time Capsule, the Mac Mini and Apple TV… seems like there’s a lot of crossover there.
  • iTunes needs some fresh thinking regarding some interface and usability features, especially regarding video content and large libraries. I’d love to have a media server where I could create playlists from any of the computers in the house, all accessing the same media library. I also would love to be able to sync a subset of my library onto my portable for traveling.
  • iPhoto: Faster please, with less sucking. And share movies already. I’m definitely going to be checking out Picasa and I hope the competition pushes Apple to make iPhoto really shine.

Is Apple pulling out of MWSF so they can attend CES in Las Vegas? I just don’t see it. No matter how much of the Consumer Electronics Show revolves around the iPod ecosystem, CES just feels kind of lowbrow for Apple. Besides, these days Apple can get a gaggle of media assembled in Cupertino on a moment’s notice with five-words and a picture of a light beam. Whenever they want.

I haven’t been to a Macworld Expo in years, but I have fond memories of attending the Boston Expo in the mid 90s. I wish I could go this year, the last-hurrah zeitgeist seems like it would be fun to share in.

Share |

link: Jan 06, 2009 2:28 am
posted in: misc.
Tags: , , , ,

Fixing Mail import crashes on Leopard

After restoring from a Time Machine backup, Apple Mail would crash every time I tried to re-import my email archive. The problem seems to be affecting a lot of people who have mail that pre-dates OS X. The same crash also happens after migrating to a new machine.

Quick fix

Copy the following command and paste it into your Terminal. Press return and wait a few minutes. Once the command finishes, Mail should be able to import your messages.

grep -lZr 'Content-disposition: attachment' ~/Library/Mail/Mailboxes/ | xargs -0 ruby -i -pe 'gsub(/(Content-type:[^;]*;\s*name=)"(.*)"/){$1+(if !$2.nil? then $2.dump.gsub(/\\\\/, "\\") end)}'

The problem

The problem is specific to older, MacRoman encoded email messages with attachments whose filename includes non-ascii characters. For whatever reason, that freakshow edge-case combination will crash Apple Mail every time it tries to import those files. If by some stroke of luck you already have these messages in your email archive (I did), they can still crash Mail when trying to rebuild the containing mailbox.

The solution is sort of simple, just rename the attachment in the .emlx file. The harder part is finding which file to edit.

We’ll use grep to recursively search for a common token in these older files, then pass the filenames to a Ruby snippet which will filter the line containing the bad characters. Here is a section of a suspect message’s header:

--B_3113094650_866203
Content-type: application/octet-stream; name="SPWH 4.01ü.sit";
x-mac-creator="53495421";
x-mac-type="53495435"
Content-disposition: attachment
Content-transfer-encoding: base64

The first bolded line contains the attachment name which is causing the problem, who knows what that umlaut was originally. The second bolded line is what we’re telling grep to locate, I couldn’t get anything to dependably match the oddball characters. “Content-disposition” appears to be an older attachment syntax and didn’t appear in any of my messages from after 2001.

While the Ruby script could be run from find’s exec command, it wouldn’t be particularly efficient. Calling the script from find would pass every .emlx file in the Mailboxes directory through Ruby’s gsub, which is almost wholly unnecessary (and much slower). Only 10 of my 57,007 messages needed fixing, 99.98% of them were fine.

Is this safe?

Since the most common way to encounter this bug involves Time Machine restores or migration to a new machine, most users should already be backed up. If something should go wrong, just restore the backup’s Library/Mail folder over the messed up one. You can also copy or zip the Library/Mail folder to another drive to be even safer.

That said, I ran dozens of iterations of this solution against copies of my personal Mail archive without issue. And besides, if you’re reading this, you might not have any of your old mail, so how much worse could it really get?

If you’re still worried, copy your ~/Library/Mail/Mailboxes folder to another drive, run the script, then compare directories with something like Apple’s FileMerge. That will show you exactly which files have changed and what was changed inside them.

Renaming the attachment should be perfectly safe since the full encoded file contents are stored in the message. All the attachment name does is specify the filename, in a sense, it’s totally arbitrary.

I first submitted this bug with Apple back in May, if you have a developer account with Apple, please file a dupe for radar: 5912997


HP Photosmart Pro B9180 “All Print Heads are missing…”

We’ve got an HP Photosmart Pro B9180 printer on the office network. Whenever anyone prints, the printer queue flashes this error message, “All Print Heads are missing. Please install and snap print heads in completely,” then proceeds to print normally.

HP B9180: All Print Heads are missing. Please install and snap print heads in completely.

After going over this for about an hour on the phone with HP’s Tech Support, and after much cable swapping, HP sent a replacement printer. Which, of course, has the same problem.

I’m fairly convinced there’s a bug either in the HP printer’s firmware, or, more likely, in their Mac printer drivers.

Here’s what I know:

  • The error only shows if the printer is connected with an ethernet cable, either over a network or by direct patch to a single machine.
  • The error happens regardless of which application is printing.
  • I’ve seen the error on Intel and PPC Macs, running Mac OS 10.5.3 through 10.5.5.
  • Printer firmware is up to date.
  • Internal printer diagnostics report no problems with the print heads.
  • The printers seem to be working correctly in every other way. Prints look great.

HP’s support has been very good throughout this. My only gripe is that they probably should have sent replacement print heads alongside the replacement printer. The included instructions had me transfer the heads from the old printer to the new one. Since the print heads are, at very least, being reported as a problem, it would be nice if I could test those too. HP did include a full set of ink cartridges, which was generous.

My followup call to HP got me nowhere, which was what I expected. But hopefully that will get the issue promoted up to their engineering bug tracker.

Other references to this problem:

postmortem: After little more than a year, we eventually just gave up on the printer. Software bugs ended up being a small issue compared to internal ink spray, clogs, streaks and general malfeasance. The HP 9180 was replaced with an Epson 3800 which has been flawless for the past 6 months. I think I heard our ten year old HP 8000 LaserJet laughing as the still-too-new inkjet was escorted from the building.


Switching to Git

I resisted Git for a long time. It seemed a cultish thing with devout vocal followers and frequent mentions on Digg. I figured it would probably be a passing fad. I was wrong.

I drank the Kool-Aid and damn, it was tasty.

The first important thing to realize, especially when starting out and considering switching, is that Git works with existing Subversion repositories. That means the transition can be as simple as learning a few new commands, your repositories and servers don’t need to changing. Other team members don’t need to switch. If I had any other team members, this would be huge.

Of course, once you start using Git and see its potential, you’ll probably switch everything, convert your repositories and feel superior whenever you have to work with a Subversion hosted project.

Ultimately, Git is a revision control system and is fundamentally about preserving and protecting your working history. So feel free to experiment, it’s really hard to mess up.

It took me an afternoon to grasp the basic concepts of Git, or at least enough to use it in dumb-SVN mode. After about a week, I started to feel fairly comfortable.

I read a small mountain of weblog posts, documentation and the like, here are the ones I found most valuable:

And definitely watch Linus Torvalds’ Google talk about Git. It won’t tell you how to use Git, but he’s funny and the talk worth seeing.

Getting Git

While Git itself is easy to compile from source, getting the documentation manpages built on Mac OS X Leopard is a pain in the butt. I futzed around with it a little, but gave up halfway through installing a seemingly endless line of dependencies. The Mac binary installer works perfectly well and is kept up to date. I’d rather spend my time using Git than installing it.

Using Git

I was blown away by some of the stuff Git can do.

In the Google talk Linus pointed out how all SCM packages could do branching and branching wasn’t a problem. Merging was. Merging branches with Git is leprechauns and unicorns. It’s almost too easy. After a few days I found myself branching all over the place, constantly creating new branches to test any idea I was having. Folding those branches back in was almost always quick and painless.

Interactive line-by-line commits mean it’s possible to commit single lines from a file instead of the whole thing. This is great if you happen to go off on a bender and change a zillion different things between commits.

Cherry-picking is also great, and saved my butt when I created a pretzel of branch history. Using git-cherry-pick I was able to straighten out my history completely within Git using Git’s tools with no loss of work.

Conclusion

I started writing this post at the end of May, it’s now early July and I’ve been using Git for a few months with no regrets. The only time I hold my breath is when I’m pushing changes back to SVN, though it hasn’t glitched on me since early June. The speed and flexibility of Git are a constant pleasure to work with. The pain of merging branches, which used to take entire afternoons with SVN, has almost become an afterthought.

Share |

link: Jul 07, 2008 11:35 pm
posted in: misc.
Tags: , , ,

Really last minute WWDC predictions

Short this year, but I wanted to get something up.

  • New iPhone demo
  • iPhone not immediately available
  • 10.6 demo. No, this isn’t 10.5 SP1 (really!)
  • No new MacBook Pro, much as I want one
  • A cleaner architectural re-alignment of OS X from a developer perspective
  • Twitter will melt
  • AAPL will be up at the end of the day
  • I don’t see how they can launch the store until next week. Half the people here would be immediately flooded with support and administrative requests. There will be pre-launch resources available, but the store won’t launch right away.

    10.5 is great, but there are a lot of rough edges. The rumors about 10.6 being previewed are probably true, but I don’t think this will be a $129 upgrade. This will essentially be Service Pack 1. Apple isn’t Adobe, they won’t charge money to fix things that are broken.

    Twitter is going to add such a bizarre additional layer to this.

    And we’re walking in… or at least closer.

    Share |

    link: Jun 09, 2008 9:48 am
    posted in: misc.
    Tags: , , ,


Next Page »