HTC Windows Phone 8X is a mess on T-Mobile

I purchased the HTC HD7 shortly after it came out so I develop for a phone in a language I knew. Out the gate, the WP7 phone had Bluetooth issues, but these were largely fixed with the Mango update. So despite the big crack in the screen, I was happy with my Windows 7 Phone.

Two years later, and contract renewal time arrives – along with the release of the Windows Phone 8 platform. Time to upgrade! WP8 should be at least as good as WP7, right?

… Wrong.

At present T-Mobile has two Windows Phone 8 options – the HTC 8X, and the Nokia Lumia 810. The lumia wins hands-down in most categories – it includes navigation, has expandable storage, has a replaceable battery. But it is ugly, clunky, has a low resolution screen, and poor battery life.

So if you want a “nice” phone you are left with the HTC 8X – which is good enough for Gwen Stefani, so it should be pretty good, right?

Wrong. It is plagued by bugs and software ommisions, and HTC is dragging their feet to fix.

1. There is no turn-by-turn navigation.
Microsoft removed the turn-by-turn directions / navigation feature from bing maps, with the idea that nokia would pick up the slack. Despite reading that Nokia opened up Nokia Drive to all WP8 devices, this phone doesn’t have it. There is no navigation. There are no turn-by-turn directions. You can get directions in a list, but they are not suited to use while driving. I have been thrown back into the pre-GPS days, and it isn’t pleasant…
2. Internet Sharing is buggy
This may be T-Mobile specific, but for the first week after activating the phone, Internet Sharing didn’t work, claiming I had to “upsell” to a $15/month extra tethering plan. Not true – the $35/month 5-gig plan I have includes tethering. This phone likes to err on the side of “no soup for you,” and for whatever reason assumes you are not authorized to share your internet half the time. Real annoying, and a real step backwards = the HD7 never rejected me, even using a grandfathered 2-gig plan.
3. Bluetooth is a travesty of bugs and incompatibility.
It seem that HTC has real problems with Bluetooth on Windows phones. This thing cannot maintain a reliable handsfree connection for more than maybe 15 minutes before the sound cuts out. Everything appears to still be connected and working, but there is no sound. You’ll be talking, an all of a sudden – silence. You must disable the Bluetooth to resume your conversation.
The A2DP (music) profile doesn’t do this, but the phone locks up entirely for a good minute after the music connection is established. I don’t know what it’s doing, but after connecting for music in my car, there is silence for a minute, and the phone will not respond to input (although the windows button still causes haptic feedback). When it does finally unlock, it responds to all your keypresses in one batch, which is pretty annoying in is self (for example, if you held down the home button trying to wake it up and pressed the power button, when it does wake up you will be prompted for a voice command as well as a “slide down to turn off”) The Bluetooth is practically unusable in this state.
3a. While the Bluetooth technically “can” support serial and PAN, this is not supported by the OS as must be implemented on an app-by-app basis. Meaning no Toyota Entune (without significant effort my Toyota), no Bluetooth tethering. This is ridiculous. All developers shouldn’t have to implement portions of the Bluetooth stack, it should be is a shared library… oh wait, Windows phone apps cannot include or use shared libraries.
4. Custom Roms may be impossible (This applies to Windows RT as well). Microsoft was wise to require the use of a standardized boot method – the phones use a UEFI bootloader. That is awesome. What is not awesome: Microsoft requires SecureBoot be used to require roms be signed by Microsoft or the manufacturer, and does not provide the user the ability to import trusted keys. Windows phones (and rt devices) could have been the future of mobile computing – the ability to dual boot as easily as a PC – but greed and paranoia ruined it for everybody. Now we must hope that some hacker find an exploit to SecureBoot that will allow malicious software… in addition to the freedom to run what you want. Really stupid move from Microsoft.

Some of these issues can be resolved by HTC with firmware updates – and likely will in time. Others will require Microsoft to get off the pedestal of greed – and who knows when or if this will happen.

Till then, I may be stuck sharing my internet with an android device to accomplish what I need. Or I could jailbreak an iPhone to get what I need. How long till I tire of waiting… who knows.

Dynamics CRM 4.0 truly calculated fields

Microsoft has a real gem with Dynamics CRM. It is both an application and a platform, highly customizable without writing a line of code, and once you throw in the code you can do most anything (depending on how unsupported you want to go)

Internally, CRM has a number of calculated fields. The customer lookup, for example is defined in the database as COALESCE(accountid, contactid). If you wanted to be really bold, I supposed you could create a column then modify it to be a function within the database, but that would be an extremely bad idea. The correct way is to use plugins and / or javascript.

Form JavaScript is fine when you are only considered with maintaining the value when a use opens the form, but what if they print? Or use the field in a view? Or another application uses the web services to retrieve the value?

You need a plugin, and that plugin has a lot of work to do.

I recently created a plugin that permits the creation of lookups that target multiple entities. After finally handling (or chosing not to handle) all the contingent scenarios I learned a few things.

1. Your plugin has to handle the Execute message, as this is the message used for FetchXml. You will have to parse the fetchxml, determine if your entity is in it, determine if your column is in it (and you have to recurse through the link-entities).
You can either register on the post stage and perform your own retrievals to get the data for the calculation, or you can sit on the pre and post stages and modify the fetchxml in the pre stage to include the extra columns needed for your calculated field. This is MUCH MUCH faster. You will need to determine what the ResultXml looks like based on how the fetch is designed.
2. Despite what the Microsoft Documentation suggests, you do not have to register the ReteieveMultiple message for all entities – just the entity in question.
(Unless you intend to handle your calculated field being used in a filter condition. This could get extremely complicated and it is better to just make the field non-searchable)
3. You should make sure your calculated field is configured as non-searchable. This prevents it being used as a filter condition from the UI (advanced find and the like)
4. The same performance recommendation holds for the Retrieve message – register pre and post, modify the ColumnSet to contain the fields needed for the calculation, then modify the result set.
5. CRM doesn’t care if extra columns show up in the result set.
6. If your field is editable (the calculation is two-way) you will need to handle the create and update, filtered for your calculated field. Add the changes to the underlying fields to the InputParameters Target propertybag.

A couple notes about CRM 2011:
I haven’t found explicit documentation of this fact, but Fetch requests no longer use the Execute message – they are instead RetrieveMultiple.
There are two reasons I have inferred for this:
1: It is now possible because the QueryExpression in CRM 2011 allows LinkEntities to have a ColumnSet – thus providing feature parity between Queries and Fetch.
2: Plugins generally now execute within the CRM transaction, so most likely the FetchXml is parsed into a QueryExpression before the plugin is fired.
This is good and bad – it reduces the number of messages you have to listen for, but it means you do have to hook the global RetrieveMultiple.

Since CRM 4.0 is pretty dated I’m guessing there isn’t too much demand for a multilookup akin to the Customer lookups – but I have one, and I have managed to retool the basic functionality to work in CRM 2011 as well. (Who knows, it may end up as a solution!)

Windows 8 RT feels like Windows on ARM. Microsoft would be wise to embrace that.

I just got the chance to play with a Surface RT tablet, and I’m actually feeling much more positive about it. My understanding was that RT devices would pretty much only run Windows-Store, aka “Modern”, aka Metro apps, with cursory access to the desktop.

Turns out, Windows RT CAN run desktop apps. It has notepad, it has calculator, it has the command prompt and the administrative command prompt. Office 2013 is a desktop app on RT. It would appear that the infrastructure for windows desktop applications is alive and well on Windows RT, but Microsoft has taken steps to prevent us (us being developers) from using it.

This will inevitably change. Whether Microsoft condones it or not, people will figure out how to compile and load windows apps on ARM. (I’m REALLY hoping Microsoft provides a permitted way of doing it…, but I’ll take a jailbreak if necessary)


When Microsoft allows people to freely develop and install apps of all kinds on their Windows 8 devices (ARM or x86), Windows may just reach the holy grail of platform independence… on their flagship desktop operating system.


I’m really hoping they realize how huge this could be – sure they make a lot of money taking a 30% cut from the Microsoft Store, but restrictions and fees will only slow platform adoption. Restricted, closed platforms is the norm on tablets. An open, familiar platform… THAT would be game changing.


Keeping my fingers crossed…

CRM 4.0: Programmatically Upload a Mail Merge Template



The Mail Merge Facility in Microsoft Dynamics CRM 4.0 works fairly well in most cases. It is at the same time a bit to complicated for casual users, and a bit too simplistic for power users, but at least in our environment it has been tweakable enough to be useful.

Like everything in CRM the Mail Merge Template is an Entity, and thankfully Microsoft permits it’s customization (without unsupported tweaking).


You can add custom attributes and relationships; you can customize the form and the views; you can trigger workflows when attributes change (although you cannot register a plugin against it without unsupported tweaking). The tricky fields – body, filename, documentformat – they are all read/write through web services ( Meaning you can programmatically upload new templates… but how?


After Google failed me, I initially chose the reverse engineer approach. The contents of the body field looked like Base64 (ended with equals signs), and indeed was. I create a tool to download the existing templated, modify them slightly, then add them back.  I had a working solution, but as we approached golive I got cold feet about messing things up in production- what if I’m doing it wrong and something breaks?

A bit of digging with reflector led to the solution: internally, the attachment on a mail merge template is treated the same as the annotation entity, and Microsoft has an article explaining the correct way to upload an attachment here : Upload an Attachment

The paraphrased money line: “updateTemplate.body = System.Convert.ToBase64String(byteData)”;

Changing a Word Mail Merge Field in C#

The mail merge fields in Microsoft Word are actually just a specific type of the more general Fields. Fields can be used to make fill-in forms, autogenerated text, dates, etc… They typically are displayed surrounded by funny looking square brackets, like <<first_name>>.

Inside the Word Xml, the Field and the display value are stored separately – the field looks like “ MERGEFIELD User_Title “, then in a separate range, the display of “«User_Title»” is stored.

Using the Word Object Model, Document.MailMerge.Fields contains MailMergeField objects for each instance of a merge field. The .Code member contains the range object, of which the .Text member will contain the field code (aka “ MERGEFIELD User_Title “). If you do a replace on this text field, it will update the merge field, but the display will remain the same.

You next have to call Document.Fields.Update() to get the display matching.

Here is some code:

        private void RenameMergeField(Word.Document doc, string oldName, string newName)
            foreach (Word.MailMergeField field in doc.MailMerge.Fields)
                if (field.Code.Text.Contains(oldName))
                    field.Code.Text = field.Code.Text.Replace(oldName, newName);

The internets agree: Visual Studio 2012 is a usability disaster

“Don’t put it out with your boots, Ted!”


Visual Studio is the fundamental tool used to create a good majority of the software for Microsoft’s operating systems, and has been for, well, a very long time. New releases tend to be inexorably linked to new language features or versions. Also typically, each new release has brought new features, and improvements to performance and usability.

With every new release of Visual Studio I have been party to, the upgrade was an improvement. .NET (aka 2003), 2005, 2008, 2010… I upgraded and never looked back (with the exception of the loss of VB6 perhaps… but it really did need to go).

Until Visual Studio 2012.

Maybe Microsoft thought forcing developers to develop in a low-fi tool would encourage good low-fi app design. Maybe they thought we needed a break from being productive. I don’t know.

They have removed WIDELY used features (setup projects anyone?), and dramatically uglified the interface. They have reduced the number of things that get code highlighting, and reduced the number of colors used to highlight. HOW COULD THAT POSSIBLY BE CONSIDERED A GOOD THING?

Go ahead, try searching Google for “Visual Studio 2012 looks”… here is what you will find:

(FYI: I’m pretty sure BING is filtering such suggestions – I just checked)

Top suggestions:
“Visual Studio 2012 looks horrible”
“Visual Studio 2012 looks like crap”

Top results?
“Visual Studio 2012 is ugly as hell” (Funny, because it’s a “deferred” Microsoft connect bug
Visual Studio 2012 is so ugly, I actually cried.


Does anybody know who is to blame for this? Given the pervasiveness of ugly in all of Microsoft 2012 products (seriously Microsoft, a touch-centric interface on a server operating system? What were you thinking?), you would think there must be somebody high up that deserves a flaming bad of poop…

Let’s just hope he (or she) takes it better than Sasquatch

“History Spam” driving me nuts

Lately I’ve noticed that the back button on my browser seems to not work. I hit back, and nothing happens. So I check the history, and see something like this:


A whole bunch of instances of URLs. I’m not sure what advertising company this it, but it is strange that it got me while using YouTube.

I did a quick search, and I’m not the only one bothered by this:

It seriously needs to stop. Advertisers don’t want people blocking ads, but then they do crap like this. I for one have no problem with non-intrusive, relevant ads. I will never click on a popup, or pop-under ad (and I would suggest you do the same)

Microsoft .NET Framework 4.5 final is available; avoid the RC

For some reason searching for .Net 4.5 on  Google brings up the link to the .NET 4.5 Release Candidate download, when the final is available.

You can grab it here:

(I seem to recall this happening back when .NET 4 was released – you would think MS would put a big note that the Final is out, but instead I found it in the “What other’s are downloading” below.

While you’re at it, check out the new features:

Probably my favorite new functionality is the async / await pattern for asynchronous coding. It is so ridiculously much better than the delegate / callback pattern you have NO idea. Seriously, we’re talking an order of magnitude reduction in code complexity.

Locking down a Virtual Machine with BitLocker

BitLocker is Microsoft’s volume encryption solution built into several versions of Windows since Windows Vista. (There is an excellent Open Source alternative in TrueCrypt, but it just has that 3rd party feel to it. That and this particular task is easier with TrueCrypt so you wouldn’t need my help)

Normally, BitLocker use the TPM (i.e. Trusted Platform Module – see Wikipedia) to use your physical hardware as a factor in the encryption key, and leverages the key-toting abilities of the TPM at boot time. So long as your hard drive remains inside your machine it can boot. Take it out, and it’s just a mess of encrypted junk (Although your backup key can still unlock it).

I’m guessing that if you landed here, you are keenly aware of Bitlocker and it’s uses. You may have already tried to use BitLocker on a Virtual Machine and failed. This article is for you. – read on!

Continue reading “Locking down a Virtual Machine with BitLocker”

Fixing the gigantic header on Twenty Eleven WordPress theme

Out of the box, the 2011 WordPress default theme is very visual… but it also requires a heavy bit of scrolling to reach the content.

Have a look at a sample:


That banner image is 1000 x 288 pixels.

The first step I took toward reigning in this space consumption was to use a shorter banner image – mine is 1000 x 170:

(It is a macro photo of the inside of an old 2gb SCSI hard drive)

This helps, but now the banner is about the same height as the white space above.

The first step toward fixing this comes from a blog post here:

Essentially, you customize the css for the site (which can be done without creating a fullblown child template by clicking the “Edit CSS” link from the Manage Themes page. You then paste this in:

#site-title {
position: absolute;
left: 7.2%;
top: 0.125em;
#site-description {
position: absolute;
left: 7.6%;
top: 6.625em;
#branding #searchform {

Note: I modified Roy’s code a little to force the search box to have a white background, and the description text to be white.

You can change the Title text from the Themes Page –> Header.


With the applied changes, my header now looks like so:


Much shorter.