Scott Hanselman

Inception-Style Nested Data Formats

September 30, '14 Comments [37] Posted in Musings
Sponsored By

Dan Harper had a great tweet this week where he discovered and then called out a new format from IBM called "JSONx."

"JSONx is an IBM standard format to represent JSON as XML"


Oh my. JSONx is a real thing. Why would one inflict this upon the world?

Well, if you have an existing hardware product that is totally optimized (like wire-speed) for processing XML, and JSON as a data format snuck up on you, the last thing your customers want to hear is that, um, JSON what? So rather than updating your appliance with native wire-speed JSON, I suppose you could just serialize your JSON as XML. Send some JSON to an endpoint, switch to XML really quick, then back to JSON. And there we are.

Storing a BMW inside another

But still, yuck. Is THIS today's enterprise?

In 2003 I wrote a small Operating System/Virtual Machine in C#. This was for a class on operating systems and virtual CPUs. As a joke when I swapped out my memory to virtual memory pages on disk, I serialized the bytes with XML like this:


Hilarious, I thought. However, when I showed it to some folks they had no problem with it.

DTDD: Data Transformation Driven Development?

That's too close to Enterprise reality for my comfort. It's a good idea to hone your sense of Code Smell.

Mal Sharmon tweeted in response to the original IBM JSONx tweet and pointed out how bad this kind of Inception-like nested data shuttling can get, when one takes the semantics of a transport and envelope, ignores them, then creates their own meaning. He offers this nightmarish Gist.

Http Response Code: 200 OK
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "">

<meta name="status" content="409"/>
<body class="X-LProd-API-Response">
{&quot;errorCode&quot;:&quot;ItemExists&quot;,&quot;errorMessage&quot;:&quot;EJPVJ9161E: Unable to add, edit or delete additional files for the media with the ID fc276024-918b-489d-9b51-33455ffb5ca3.&quot;}

Here we see an HTML document returned presumably is the result of an HTTP GET or POST. The response, as seen in headers, is an HTTP 200 OK.

Within this HTML document, is a META tag that says, no, in fact, nay nay, this is not a 200, it's really a 409. HTTP 409 means "conflict," and it usually means that in the context of a request. "Hey, I can't do this, it'll cause a conflict, try again, user."

Then, within the BODY OF THE HTML with a Body tag that includes a CSS class that itself includes some explicit semantic meaning, is some...wait for it....JSON. And, just for fun, the quotes are HTML entities. &quote;

What's in the JSON, you say?

"errorCode": "ItemExists",
"errorMessage": "EJPVJ9161E: Unable to add, edit or delete additional files for the media with the ID fc276024-918b-489d-9b51-ffff5ca3."

Error codes and error messages that include an unique error code that came from another XML document downstream. Oh yes.

But why?

Inception Nested Data FormatsIs there a reason to switch between two data formats? Sure, when you are fully aware of the reason, it's a good technical reason, and you do it with intention.

But if your system changes data formats a half-dozen times from the moment leaves it's authoritative source on its way to the user, you really have to ask yourself (a half-dozen times!) WHY ARE WE DOING THIS?

Are you converting between data formats because "but this is our preferred format?" Or, we had nowhere else to stick it!

Just because I can take a JSON document, HTML encode it, tunnel it with a SOAP envelope, BASE64 that into a Hidden HTML input, and and store it in a binary database column DOES NOT MEAN I SHOULD.

Sometimes there's whole teams who exist only as a data format transformation as they move data to the next team. 

Sound Off

What kinds of crazy "Data Format Inception" have you all seen at work? Share in the comments!

UPDATE: Here's an insane game online that converts from JSON to JSONx to JsonML until your browser crashes!

P.S. I can't find the owner of the BMW picture above, let me know so I can credit him or her and link back!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

How do I set different wallpapers for each monitor in Windows?

September 25, '14 Comments [25] Posted in Tools
Sponsored By

I wanted a different wallpaper (or "screensaver," for the non-technical relatives, because I know you call desktop wallpaper that) for each of my multiple monitors in Windows. To start changing your wallpaper, first right-click on the desktop on click Personalize.

Right click to Personalize

Click the words "Desktop Background" at the bottom of the Personalization dialog.

How to change your Desktop Background

Now, from here, if you LEFT-click a wallpaper you're selecting that wallpaper for ALL your monitors.

BUT, if you RIGHT-click on an image, you can set wallpapers individually.

Right click to set wallpaper individually


About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Towards a better console - PSReadLine for PowerShell command line editing

September 25, '14 Comments [22] Posted in Open Source | PowerShell
Sponsored By

Sometimes textmode is where it's at. I've long blogged about tools and techniques that will make your Windows console experience better. Perhaps you're a *nix person who is using Windows in your day job, or you wish the Windows PowerShell prompt was more nix-y. Or perhaps you're a PowerShell person who wants to take your command-line to the next level.

Well, just as NuGet is how we get .NET libraries quickly, and Chocolately is a kind of apt-get for Windows, PsGet is a way to easily add PowerShell modules to your prompt.

To install PsGet you run this script (feel free to vet it):

(new-object Net.WebClient).DownloadString("") | iex

Once you've got PsGet, the purpose of this post is to introduce you to PSReadLine.

To install PsReadLine with PsGet, just

install-module PsReadLine

If you want to install PsReadLine manually, you can from their readme. It does a LOT:

PsReadLine replaces the command line editing experience in PowerShell.exe. It provides:

  • Syntax coloring
  • Simple syntax error notification
  • A good multi-line experience (both editing and history)
  • Customizable key bindings
  • Cmd and emacs modes (neither are fully implemented yet, but both are usable)
  • Many configuration options
  • Bash style completion (optional in Cmd mode, default in Emacs mode)
  • Bash/zsh style interactive history search (CTRL-R)
  • Emacs yank/kill ring
  • PowerShell token based "word" movement and kill
  • Undo/redo
  • Automatic saving of history, including sharing history across live sessions
  • "Menu" completion (somewhat like Intellisense, select completion with arrows) via Ctrl+Space

But it doesn't replace it in a scary "moved my cheese" way, but in a comfortable familiar way, similar to how Bash works now. It will add things that you WILL miss when you move to another machine that doesn't have PsReadline. If you are already comfortable (or learning) PowerShell, this will feel comfortable immediately. It's not Dvorak. ;)

Some cool PsReadLine examples

Syntax coloring for things like keywords (cd) and common commands (git):

Syntax coloring with PSReadline

PowerShell often has you opening parentheses, brackets and things, and then you have to count them to close them. PsReadLine helps with that also:

Not only does it give you nice syntax-highlighting for things like function building, it also shows me with the red > that I haven't closed the block.

Forgot to close the block

When you are editing a multi-line script, you can also now backup to other lines!

multiline editing with PSReadline

If you are typing something like Get-Process and either want to autocomplete switches, or autocomplete results, you can press Ctrl-Space:


If you're advanced, check out get-PSReadlineKeyHandler and not only look at what functions are bound to which hotkeys, BUT also check out all the functions that AREN'T bound. You have a lot of power for customization here!


You can even set Emacs keybindings!

Set-PSReadlineOption -EditMode Emacs

Go check out on GitHub and give it a star!

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Jump-Location - A Change Directory (CD) PowerShell Command that reads your mind

September 18, '14 Comments [27] Posted in Tools
Sponsored By

There's a lovely little utility called autojump for *nix consoles that makes the 'cd' command very smart. More that just auto-completion, it's a kind of "auto guessing." Hence, autojump. There is some beginning Windows support, but instead I turned to Tim Kellogg's open source PowerShell implementation "Jump-Location."

What a joy.

j this and j that

First, I was like "jump-location?" I'm not going to type that. But then, of course, duh. Aliases.

Jump-Location is aliased to just j, which means I can now do awesome stuff like this:

c:\> j sc
c:\users\scott> j g
c:\users\AppData\Local\GitHub> j des

But there's more. It's actually watching how long you are in a directory and keeping stats. You can see the weighted stats with "jumpstat" and the "database" is just a text file in ~\jump-location.txt.

If "j d" isn't enough to get me into C:\GitHub\DisProject then I can do "j g d" and I'm there. It's amazing.

Installation is easy, and I hope it gets on PsGet soon for even easier installation. Just unzip, unblock, ensure that your PowerShell execution policy allows scripts, and run ./install.ps1.

NOTE: Don't run install from your desktop, or a temp folder. Put the Jump-Location folder somewhere where it will live, and it's going to add a line like this to your user profile ("C:\Users\YOU\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1")  like this, so you'll want to install from a final path:

Import-Module 'C:\Users\Scott\Dropbox\utils\Jump-Location-0.5.1\Jump.Location.psd1'

I'm excited about this great little utility. Head over to and STAR it in GitHub, and give it a go! Tim, the author, is on Twitter at @kellogh. Other contributors include Sergey Vorobyev.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

iOS8 3rd Party Keyboards Reviews - SwiftKey and Swype

September 18, '14 Comments [28] Posted in Reviews
Sponsored By

I've been running iOS8 for a while now in Beta, and today all my iDevices are running the released iOS 8. One of the most anticipated new features is the ability to create and add 3rd party keyboards. In the future I anticipate we'll see lots of interesting and creative keyboards, perhaps to draw an emoji with your finger, custom Chinese or Japanese IMEs (input method editors), and others.

Until then, the primary thing folks have been waiting for is what Android and now Windows Phone have had for a while, the ability to type without lifting your thumb. You'll either love it or hate it, but you need to try it for a day. When done well, it's amazing and brilliant.

The Hassle of the Setup Process

3rd Party Keyboards install from the AppStore like any other app. When you run each for the first time they walk you through the process of installing their keyboard. This is easy for a techie, but for your non-Technical Relatives it might take a little coaching as you'll end up 3 or 4 deep inside Settings | General | Keyboards.

Multiple Keyboards

Swype - US$0.99

Swype worked great, exactly as advertised. I enjoyed using it very much and it's swiping feature works as advertised. I did feel its autocorrect somehow left something to be desired. Below you can see it getting confused as I swipe the word "autocorrect."

Swyping Adding new words

The deal breaker for me with Swype was two-fold. First, the spacebar is smaller than the default space bar. It's a small thing to be sure (as tiny keyboards are) but it had me adding periods . throughout . my text, as I hit that before I hit the space bar.

Secondly, the lower left corner of the iOS keyboard has always been the little 123 Icon. It lets you switch between ABC and 123, of course. Swype chose to move this over to the second spot. This flummoxed me all day. I'm sure I could train myself as it's just muscle memory, but it was an unusual choice, I thought, and this is just one place where Swype deviated their keyboard design from being "just a swiping solution."  They've moved other things as well.

Opening the proper Swype button in the lower corner with a press and hold brings up the Globe (usually not hidden in other keyboards) as well as the Dial Pad for numbers, and the Settings gear.

Swype has moved some things and this slowed me down quite a lot. This keyboard below moves all my symbols to new locations, with the Asterisk nowhere to be found!

Checking out the Swype menu What's with the random Emoji?

NOTE: One thing that ALL these keyboards thankfully fix is the "shift key problem" with the default iOS keyboard. They show lowercase letters when you're typing lowercase, and change the whole keyboard to uppercase when you press Shift. It's so painfully a problem with the default keyboard, it's really unfortunate that this wasn't changed in iOS8.

Swype also includes funky themes with background images if you're into that level of customization.

SwiftKey - Free, with registration and has optional $ IAPs

SwiftKey is free, but they intend to make money by selling us keyboard things. For now, I'm thrilled with the default, as seen below. It looks almost exactly like the default iOS keyboard, which is what I'm looking for. I don't want to relearn where things are when I just want swiping and a few other features.

SwiftKey keeps all the symbols and numbers exactly where they usually are, and adds a few nice touches like a gentle reminder than I can touch-and-hold on punctuation for additional choices.

SwiftKey Fantastic  swiping is amazing

One odd bug I saw with SwiftKey - If I turn off "Allow all Access," in Settings | General | Keyboards, SwiftKey ignored my white theme choice, showing me only a black keyboard with a reminder to turn on All Access. I presume this is a bug, as it's definitely wrong. Other than this one issue, I'm digging SwiftKey.


There is also a free Chinese keyboard called TouchPal that includes swiping input, keyboards, themes and a focus on Emoji. The Emoji are included in the keyboard, meaning your don't need to switch to the Emoji keyboard. That said, I installed it and my phone locked up. I rebooted and had no keyboard until I removed TouchPal. I think this experience speaks (IMHO) to the larger issue of stability with 3rd party keyboards on iOS, but this is only from my perspective as a user. I was unable to get TouchPal working.

Privacy Concerns

Here's the kicker for a lot of people. In order to make predictive text suggestions, sometimes these keyboards need to send what you're typing to their cloud engine. Be sure to read their privacy policies to make sure you're comfortable with how they use your data.

Here's part of SwiftKey's privacy policy. Note that you can opt out of their cloud service. They try not to collect passwords and payments, basing this on hints like "type=password" in HTML, I presume. They also allow you to delete all your cloud data at a later date if you like.

For users that opt in to SwiftKey Cloud, we will collect your email address, basic demographic information and information concerning the words and phrases that you use (“Language Modeling Data”) to enable services such as personalization, prediction synchronization and backup. We may use data provided by you to develop and improve our Products.

Where a field has been flagged by a website or app as denoting a password field or payment information, SwiftKey does not log, store or learn from this information.

Be educated, but I'm OK with using these keyboards for basic email. Of course, you can (and will) switch keyboards many times a day if you're like me.

Switching Keyboards


If you type technical (or Medical, or Legal, or whatever) things a lot, you'll likely find some very odd predications with these keyboards. Here SwiftKey has clearly looked at my history and is suggesting something totally wrong...and offering to Capitalize it also! Autocorrect has always been a problem, but don't expect a 3rd party keyboard to fix it...although these ones aim to try! Theoretically they'll learn even more from what I type.

Random suggestion More autocomplete

A number of times I've found myself looking at a text box with a flashing insert point waiting for a keyboard to pop up. These keyboards need to LOAD and sometimes that causes a pause, or when things go wrong, they just never show up. In a word, there's bugs all around, in both the Keyboards, I suspect, and in iOS8's handling of them.

Here I am, keyboardless. I had to reboot at this point. Your mileage may vary.

Just Blank, no KeyboardStill no keyboard

Mark my words, I predict bug fixes for a the supporting APIs for 3rd Party Keyboards will be coming in the next minor update to iOS8.

NOTE: Neither of these keyboards includes a Microphone Button to start Siri's built-in dictation. As such, these keyboards won't work with my app, myEcho. This appears to be a limitation imposed by Apple, that won't allow us (developers) to invoke a dictation without using their button. If you want to dictate (which is almost a keyboard on its own...I'd like to see a giant "Dictate now" button, myself) then you'll need to switch to the built in iOS keyboard.
Press Microphone to Dictate to Siri

Final Recommendation

My recommendation? YOU should try them all and see which one makes you happy. If you are very much a touch typist and you want a swiping keyboard that doesn't deviate far from the default, I recommend SwiftKey.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by ORCS Web

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.