“The specified file is not a registry script” – How encoding can ruin your morning

If you’re like me, you spend a lot of time dealing with files and text files are no exception. Doing anything powerful while editing a text file usually isn’t handled by basic programs like Notepad. What editor to use is a bit of a holy war that I won’t get into since it has little to do with this blog entry. Having said that, I prefer to use a powerful editor when dealing with text files because I find that all too often Notepad just doesn’t get the job done as quickly, so I use TextPad. It has several features that I find myself using all too often, so I’ve set it as my default text editor.

This morning I was doing some development and I had to quickly create a (.reg) registry file with which I could quickly set some values in the registry when I needed to. This seemed like a simple enough operation. For the sake of speed, I already had regedit open to the path that I was interested in, so I chose to export it from regedit. Doing so saved a .reg file where I specified and I was free to edit it. I opened up TextPad and make the changes that I needed. In my case I was only changing a single key so I cut everything else out and saved the file. To test things out, I double-clicked on the .reg file and got the typical prompt:

Registry File Import Prompt

I just made this file, so I did in fact trust it and by clicking “Yes” I expected to get a valid message like this:

Registry File Import

However, instead I got this:

Registry File Import Failed

What the heck? That’s not good! This simple was dirt simple. After all it only had 3 lines in it. What could have happened? Turns out that encoding can ruin your morning. Taking a look at the message I saw the “… only import binary registry files from …” and I thought “Why does this thing think it’s binary?”. Why, indeed. I opened the file back up in TextPad and rather than just hitting Ctrl+S or Save, I chose "Save As". Doing so presented this menu, and I’ve highlighted my problem:

Registry File Textpad Save As

That’s right. Without me doing anything, TextPad was going to save this file as Unicode. Regedit expects to get .reg files that are ANSI encoded. So I changed the Encoding to ANSI, saved the file, ran it again, and everything worked fine. It caused me some frustration for a good 20 minutes, so hope this helps someone else out.


Microsoft Internet Explorer provided by me? Why not!

It’s been a busy summer for me, but I wanted to make sure I got something out there so I thought I’d drop a quick one for you guys and hopefully it helps someone else who possibly annoyed by it.

I had a friend who bought a Dell laptop (great laptop by the way), but it came with one annoyance that he wanted help with. Here’s a picture of his browser, let’s see if you can pick out the issue. Go ahead, I’ll wait.

If you said the annoyance was that the homepage was set to http://www.dell.com that is a bit of an annoyance, but that’s easy enough to deal with. If you said that the window title for every web page you go to ends with ” – Microsoft Internet Explorer provided by Dell, Inc.” you’d be right. It is annoying isn’t it? The good news is that it’s pretty easy to fix if you have the appropriate rights on your box. 

Specifically, you’ll need to have the ability to modify your registry. You can screw your machine up pretty quickly by tinkering around in the registry, but this is very straightforward. Basically, all you have to do is follow these steps:

1. Run regedit.exe to view the contents of your registry. The machine’s registry is a hierarchical structure details all sorts of stuff that you can mess up so be careful!

2. Browse through the hierarchy to Computer\HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

3. Once you’re there on the hierarchy on the left, you’ll see a list of keys and thier values on the right. Find the key labeled “Window Title”. When I saw his, it read “Microsoft Internet Explorer provided by Dell, Inc.”. Change that value to whatever you want.

4. If you have any Internet Explorer windows open, close them all and re-open IE. Voila! The text you had has been replaced. No muss, no fuss!

Hope this helps someone.

CRM deployment errors courtesy of SQL

Quick little post here, but not every CRM developer is a SQL developer and sometimes errors that come through the CRM interface aren’t actually CRM errors at all. A great example of this came my way during a deployment when I was importing some customizations. Now normally that’s my “push and pray” moment. Fortunately I have to pray less these days thanks to Hyper-V (take snapshot, got problems? revert and you’re A-OK – gotta love it!), but back to the story. So, I pressed the button and didn’t get the “all clear” from CRM. Uh-oh. Instead I got an error message that baffled me for a minute.

Cannot alter the table 'accountExtensionBase' because it is being used for replication.

What? There’s some replication in CRM that I didn’t know about? Then I thought for a second. This isn’t CRM at all. This was in fact an error message brought back from SQL who wasn’t happy about the fact that  I was changing the schema of a table that it was replicating. For the CRM developers out there who aren’t familiar with SQL, it’s best said by the MSDN library:

Replication is a set of technologies for copying and distributing data and database objects from one database to another and then synchronizing between databases to maintain consistency.

Basically we use it to make sure that when changes are made we save the changes to another server almost real-time. This can save our behinds should something really bad happen. You can find more detail about the error here.

To solve this problem, it was a simple matter of tearing down replication, importing again, and replication could be setup again. Hopefully this helps anyone else who gets caught off guard by this message.

VS2010 Launch – The Big Tease

First off for anyone who thinks this is a post to bash Microsoft, you’re reading the wrong blog.

So what’s this about? It’s a little about VS2010, a little about bad design, and a little about JavaScript. Ready? Good.

Alrighty then, today’s the big day when a few products were launched. Nothing big, just most of Microsoft’s developer toolset. Let’s see, there’s:

  • .NET Framework 4
  • ASP.NET 4
  • Silverlight 4
  • Visual Studio 2010

ASP.NET MVC 2 released about a month ago, but those guys are a little off, right Phil?

But I digress. The main lead-up to this was a launch event that is happening in several places around the world and perhaps most notably in Las Vegas in conjunction with DevConnections. Go to Microsoft’s website more than an hour before the keynote and you were presented with a countdown timer to help build the suspense. I for one was in suspense. I had held my laptop in a pristine state since I didn’t want to worry about any hassles associated with previously installed betas or release candidates. So I watched the countdown go to 0, and nothing happened. OK, I’ve seen this happen before and I know how conferences go, so I check back every 5 minutes or so. 5 minutes later, nothing. 10 minutes later, nothing. 45 minutes later, nothing! What the heck?

The final countdown!
Biggest. Tease. Ever.

How could I be watching this timer for over an hour and not the keynote? About then my brain kicked in where someone else’s didn’t. Since this thing was straight HTML and not Silverlight or Flash, I decided to view the page source and see if my suspicions were right. Now, I had the page source ready to show you, but unfortunately my browser crashed while watching the keynote (ironic, I know), so I lost that. However, the gist of it is this. Whoever made this page decided to embrace jQuery (smart move #1) and avoid writing some ad-hoc code when something else existed (smart move #2). Unfortunately that’s where Smart Move Rd. intersected with Not Quite Blvd.

The code that they chose to make use of was a simple jQuery plugin to count down the time left until a specified date. The JavaScript/jQuery code (per Keith Wood’s site and my memory) was setup something like this:

var keynoteTime = new Date();
keynoteTime = new Date("April 12, 2010 08:30:00");
$('#countdown').countdown({until: keynoteTime});

That seems straightforward enough, doesn’t it? Of course it does, and it is. This plugin is great for certain uses, there was just one little detail that they didn’t consider. You see, the conference was in Las Vegas and I’m in Florida. JavaScript is a client side technology, and my client was on Eastern Time Zone time, hours ahead of Las Vegas time. So, I would have been staring a “0 hours, 0 minutes, 0 seconds” for another 3 hours before finally viewing the launch webcast. It sounded like a great idea at the beginning though, didn’t it? Oh well, I only had to wait another 5 hours to have Akamai serve me the VS2010 bits, but I’ve got ’em!

NOTE: I don’t know for sure that the code used was Keith Wood’s Countdown jQuery plugin, just a hunch. Either way, you get the idea.