Fix for Office 2013 Publisher PIA

So, Office 2013 is out, and out of the box there is an unpleasant surprise: our code driving Publisher via the interop assembly no longer compiles. After much digging, turns out Microsoft managed to screw up the registry entry for the Publisher PIA.

Here's the fix, step by step:

  1. Fire up regedit (usual caveats apply, don't blame me if your computer blows up)
  2. Run a search for "0002123C-0000-0000-C000-000000000046" (without quotes)
  3. The first hit should be HKEY_CLASSES_ROOT\Typelib\{0002123C-0000-0000-C000-000000000046}
  4. Expand the key, observe two subkeys, "2.1" and "2.2" -- you've found the problem!
  5. Note how the 2.1 key has a "PrimaryInteropAssemblyName" string value, and the 2.2 key does not? Well, that value belongs in 2.2 and 2.1 should not be there at all, so let's make it so:
  6. Create a new string value inside the 2.2 key, named "PrimaryInteropAssemblyName" with value set to "Microsoft.Office.Interop.Publisher, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71E9BCE111E9429C"
  7. Delete the 2.1 key
  8. Voila!

Your Visual Studio reference to the Publisher interop assembly should now be happy again.

HttpContext.Current.Profile is null in iis7 (Vista, Windows 7, 2008 Server)

Took an ASP.NET app to an IIS7 and suddenly lost access to Profile. After much trial, error, and Googling, found that the following attribute must be present on the <modules> element inside the <system.webserver> element:

<modules runAllManagedModulesForAllRequests="true">
Hope I saved you some time.

Enable network drive support in Windows Live Movie Maker

Via here and here:

If you'd like to be able to add pictures or video to Windows Live Movie Maker from a network drive without having to copy files over to your local machine, here's a quick registry hack:

  1. Run regedit.exe
  2. Navigate to HKEY_CURRENT_USER\Software\Microsoft\Windows Live\Movie Maker
  3. Add DWORD key named AllowNetworkFiles
  4. Open the key and switch the value to 1

Now you should be able to open Movie Maker and add a source file from a network location.

 

Cure long startup delay of vs2008 debugger

Lately, starting up a debugging session in Visual Studio 2008 has started to take a really long time (as in sometimes minutes!). I was contemplating uninstalling and reinstalling but the prospect didn't excite me. Finally, I did some digging around the Interwebs and found my answer: apparently, large number of breakpoints can significantly impair debugger startup time. No, I don't know what "large" means, but Debug -> Delete All Breakpoints cured my problem and now the debugger starts up instantly. So, posting this here in case someone else runs into this problem.

Add client-side onchange handler to ASP.NET CheckBox control

The ASP.NET CheckBox control offers a convenient abstraction on top of the standard HTML input type="checkbox" control, by marrying a checkbox with a label. Ordinarily, the ASP.NET checkbox works just fine, but if you wanted to have a client-side javascript function triggered when the checkbox is toggled, there is no built-in mechanism to do that.

The usual things to try when one wants to add client-side functionality to ASP.NET controls won't work because the CheckBox control wraps the checkbox input control and the label inside of a span. So, if one were to just add an "onchange" or "onclick" handler either in the markup or in code (via <control>.Attributes.Add("onclick", "blah") call) won't work as these handlers will be attached to the surrounding span.

So what can one do? This will work:

myCheckBox.Attributes.Add("onclick", "foo('" + myCheckBox.ClientID + "');");

What we are doing is adding an onclick handler to the span (which will be processed), and setting it to execute a javascript function foo, passing the client ID of the CheckBox control as the sole parameters. Our foo function may look like this:

<script type="text/ecmascript">
function foo(checkBoxId) {
  var checkBox = document.getElementById(checkBoxId);
  // do something with the checkbox
  // ...
}
</script>

Is this elegant? No!
Is this a leaky abstraction? You better believe it!
Does it work? Yes!

Zenfolio review update

A while back, I posted a review of Zenfolio service, comparing it to Sony ImageStation. I was quite happy with Zenfolio then, and even happier when Sony left thousands of people out in the cold by shutting down its service.

Time passed, Zenfolio matured and added features, and I figured it was appropriate to update my review.

To recap, in my original review I dinged Zenfolio for its lack of an address book for photo sharing, missing a way to track visitors, or for visitors to leave feedback, and finally the ability to print. I am happy to say that most of these have been addressed.

Zenfolio started out as a service dedicated to the needs to serious amateur and professional photographers. It is still that, but they are have focused their attention on the needs of professionals. Features like ability to customize access to albums, limit resolutions, shopping cart for selling prints, analytics, etc. are all targeted towards event and stock photographers looking to earn an income from their craft. These are great, I am sure, for people who need them, but I am not one of them.

Here's a rundown of new features that do excite me:

  • Printing. Zenfolio now offers ability to print to variety of media (and merchandize) by a high quality lab. We've gotten prints, calendars, and mugs and the quality and speed of delivery have both been very impressive. They've shipped within hours of placing an order.
  • Comments. It is now possible for visitors to leave comments on individuals photos and in a guestbook. This was one of the features I missed when I first switched to Zenfolio and I was glad to see it appear.
  • Visitor tracking. Another feature I missed from ImageStation, this lets me see how many people came to take a look at my albums. It makes for an easy way to tell whether I've remembered to share it with family.
  • The interface has seen even further streamlining and polish -- the website is truly a pleasure to use, whether you are storing photos or viewing them.
  • Custom domain name. Another neat addition is ability to have a custom domain name point at your albums (e.g. pics.example.com).
  • Ability to link directly to photos (from your blog, auction listing, etc.). Very handy.

This leaves me with only one feature on the wish list: an address book to store emails of people I often share photo's with. As things stand, I have to track down the list of emails every time I want to share an album. Here's hoping that it will be implemented in 2009.

An update on cost: Zenfolio now offers three tiers of service: Basic, Unlimited, and Premium (at $25, $40, and $100 per year, respectively). If you are not looking to resell your photos, one of the two lessers levels will cover your needs. The main difference is storage (1GB per year with Basic vs. unlimited with Unlimited level). With escalating pixel counts of modern cameras, 1GB limit is pretty easy to hit, and indeed I quickly found myself upgrading to Unlimited.

Overall, after nearly 3 years of use, I am very happy with the service and will continue using Zenfolio for the foreseeable future. If you'd like to try Zenfolio, you can save $5 by using coupon code EMY-8VU-9MT (if you sign up, I will get a credit of $5 as well.)

C# number format expression for large numbers

This expression will format large number with a thousands separator:

.ToString("#,#")

Another problem with Mozy restore

I wrote a few days ago about my experience with Mozy after my main system drive crashed. I have a small update: after finally getting whatever little they had back from Mozy, I was determined not to let this happen again and so I went through and re-configured the MozyHome client to backup every folder I thought I might ever need. That should have added a couple of gigs to over 60Gb already on Mozy (from *other* hard drives). Yes, you guessed it. Mozy did not recognize the fact that it already has 95% of my data on their servers and so it is uploading *everything* all over again. Not only is this a major waste of processing power and network resources, it also leaves me open and vulnerable until this backup completes!

Good idea, horrid implementation!

Mozy review: the restore horror story

Mozy is an online backup service with an attractive pricing model. It competes with the likes or carbonite and offers a range of plans to suit any budget (even no budget). I have been using the MozyHome plan for the past year and today got to test what Mozy is like in disaster recovery mode.

Two days ago I restarted Windows to apply some updates, and when I returned, the computer was stuck at the boot screen complaining about a missing system file. The following evening, when I returned from work, things were worse, the drive would no spin up, and was making metallic noises. As an aside, I must say they don't make hard drives like they used to. I have not had a single hard drive fail on me prior to year 2000, but in the past few years, I have had at least several fail.

No matter, I figured this would be just an inconvenience -- after all, I thought ahead and I am paying for a backup service. A new hard drive and an OS install later, I was up and running and downloading the MozyHome client.

The first bit of bad news came when I launched Mozy and it had none of my backup settings. Apparently these died with the drive, and Mozy was offering to start backing up my now empty documents folder. This gave me the first feeling of unease -- I feared Mozy would kick off backup and lose track of all the past data. I am still not sure whether this suspicion was well-founded, but the experience is certainly not the one you want to have when you are already feeling a tad on edge about the safety of your data.

Next, I figured I would just do a full restore of C: drive. Mozy offered to either overwrite all existing files with those backed up, to rename the restored files, or cancel. No option to skip existing and only restore the missing files. Odd, seems like that would be an obvious feature. Still, I figured I had nothing to lose on the newly set up drive, and told Mozy to overwrite. And then the wait began.

Mozy uses an extremely inefficient process to restore files. It does so one file at a time, first "Finding file on server...", a lengthy process that seems to take an amount of time proportional to the size of the file -- several seconds per file for tiny files, up to an hour for a large file. What it actually does during that time is not clear, but there are several problems with the approach:

  • large numbers of small files take inordinate, ridiculous amount of time to restore. Imagine a directory with a thousand small files. Each file takes 10 seconds to be "found" on the server, that's 3 hours to restore what should take a minute to download.
  • there is no prefetch while files are downloaded. Mozy, in its infinite wisdom saved and was restoring an Outlook .ost file -- a nearly pointless exercise. While this multi-gigabyte file was being restored, it could have prefetched the rest of the backup, but it didn't.

So, after wasting half-a-day on a restore that was nowhere near done, I figured I would just pick the files I wanted and restore them that way. Apparently that's not something you can do with the MozyHome client, only via the web interface. So I fired up the browser and went browsing my saved files, which is when I got the real shock. Of all the AppData files and folders, Mozy *ONLY* saved Outlook, Mozilla (FilreFox), and Thunderbird data. That's ALL!! Countless other data and configuration files, painstakingly organized and tagged photo albums, ALL GONE!

You might argue this is not Mozy's fault, after all I could have reviewed and modified its default selections, but I say this is bull. Mozy preselected my AppData folder, it made it look like it was saving important configuration data, but what it did in fact was plain stupid -- of all the things it could backup by default, the least useful is an outlook .ost file -- a simple cache that would get regenerated anyway when I reconfigure Outlook with my Exchange account info.

And now I am really really pissed and very disappointed. Mozy's "intelligent" defaults are anything but, the restore process is horrendously frustrating, and I am left far short of the data I thought I had safely backed up.

NOT RECOMMENDED!

An error occurred while using the BCP utility

If you are installing Microsoft Dynamics GP on Windows Vista, you may run into this error after starting GP Utilities:

An error occurred while using the BCP utility--data was not correctly copied to the server. Please verify your ODBC settings and that BCP has been correctly installed. Microsoft Dynamics GP Utilities will now exit.

It took quite a while, but I finally got this resolved. The solution is simple: run GP Utilities as Administrator.