Archives / 2012
  • Settings Charm

    One of the nice things about Windows 8 for developers adoption of some clearly defined (and long needed) user experience standards. While in the past we relied on conventions (Help -> About for example) those conventions were not always followed and often didn't make a lot of sense (Help -> About for example). A great example of these UX standards are the Charms. Here we'll take a look at the Charm you're most likely to encounter; the Settings Charm.

    Why is the...
    Read More

  • Windows Store Apps

    I've run into a couple of developers asking where "Metro Style Apps" went in the RTM version of Visual Studio 2012. Don't worry, they are still there. They just have a new name. That term "Metro" was just a placeholder during the beta phase.

    There are two different types of Windows Apps. The first is the classic "Desktop App" which you either buy off the shelf (for those under 20, this is how we "old timers" used to buy our software)...
    Read More

  • Moved to Azure

    Well now I've gone and done it, I've moved this site over to Azure. Overall the experience was pretty painless.

    Created a new Windows Server 2012 VM instance

    Installed WordPress and MySQL via the Web Platform Installer
    Imported my old MySQL Database

    I have run into a few issues around MySQL. I exported my old data from MySQL using the only tool at my disposal, an automated backup from my old hosting provider. The problem with this method is that my character set information...
    Read More

  • Basic HTTP Authentication in WinRT

    I'm on vacation right now, getting some much needed time with the family and preparing for my wedding at the end of the week. So what does a geek do in the midst of 6 kids and the chaos of wedding planning? Why build a Metro style app of course. Duh!

    For my little application I'm working with a REST API that requires Basic HTTP Authentication. This is pretty commonplace and something I've done it many times in the past in web and Silverlight applications. WinRT was very similar but (as with everything in WinRT) has its own nuances.

    If you're using WinRT to call REST APIs (and honestly, who isn't?) you will quickly become familiar the HttpClient class. It is very similar to the older WebClient and it pretty straightforward to use (and very clean thanks to the absolutely awesome await keyboard in .NET 4.5).

    In order to pass along the authentication we'll need to add a AuthenticationHeaderValue. This took a little noodling to figure out so hopefully this saves you a bit of time. Basic HTTP authentication is handled by passing "username:password" in the header. In order to do this I needed to create a new AuthenticationHeaderValue with "basic" for the scheme and "username:password" for the value. This gets added to my HttpClient so that every call includes the Authentication information. To do that I created a method called CreateBasicHeader that generates what I need and then call that from inside my original method.

    As it happens, the particular API I'm calling wants the password in an MD5 Hash rather than plain text. Luckily there was a great sample that showed how to do this. The only change I made was to use EncodeToHexString rather than EncodeToBase64String.

    Here is the full sample:

  • The Internet is for FUD

    Sometimes I think Avenue Q got it wrong; The Internet is for FUD. When it comes to generating Fear, Uncertainty and Doubt the internet reigns supreme. Oh the television was good, but it has limitations. When you need to simultaneously scare the pants off someone in NYC and an uncharted island off the coast of New Guinea, only the internet will do.

  • Windows Azure for Amazon AWS Users

    One hurdle I run across while talking to AWS users about Azure comes down to terminology. Every cloud vendor has their own vernacular and this can be a source of endless frustration when one starts to compare the two services. Developers that have already wrapped their mind around AWS' parlance often find themselves struggle to understand Azure's.

    There is of course a intrinsic difference between the two platforms which contributes to the confusion. And before we draw any lines between the two platforms, we should first address this fundamental difference.

    Infrastructure vs. Platform

    There are three primary Cloud Service Models in the market today - Infrastructure as a Service (IaaS), Platform as a Service (PaaS) and Software as a Service (SaaS).

    IaaS vs PaaSAmazon Web Services is fundamentally an Infrastructure as a Service solution. Azure on the other hand is fundamentally a Platform as a Service solution. While it is true that they both offer some components from each Service Model, they remain primarily influenced by their core model.

    Essentially the difference comes down to where you place the abstraction layer. With IaaS they provide a virtualization infrastructure and leave the rest to the you. PaaS on the other hand includes both the infrastructure and the runtime environment (OS, runtimes, middleware, etc.).

    By further abstracting away from the physical environment, PaaS delivers fantastic scalability with substantially less management overhead. You manage your application and your data, the rest is handled for you automatically.

    Connecting the Dots

    A word of warning (and preemption of the inevitable complaints): I am making certain generalizations to make this more digestible. In doing so, some nuances of the various platforms may be overlooked. AmazonAzureComp

    At the highest level there is some parity between AWS and Azure. They both divide the service into four primary categories Compute, Storage, Database and Networking. As you move down the stack however is becomes muddier. Hopefully the following will help simplify transitioning from Amazon to Azure.

    Elastic Compute Cloud (EC2)

    The closest allegory to EC2 is Azure's VM Role (currently in Beta). Specifically it aligns with an EC2 instance leveraging Local Instance Store. They both are stateless instances (meaning they don't persist data on the root disc). Both also support a file system persistent model to deal with the inevitable files that get generated (see below). Unlike AWS however, Azure uses a user-supplied VHD rather than building the image in the cloud directly.

    Unlike the VM Role, there is no allegory for the Web or Worker Roles. These roles are pure PaaS instances. You publish your application to them and the underlying platform is maintained for you.

    Web Role

    Web roles in Windows Azure are special purpose, and provide a dedicated Internet Information Services (IIS) web-server used for hosting front-end web applications. You can quickly and easily deploy web applications to Web Roles and then scale up or down to meet demand.

    Worker Role

    Worker roles run asynchronous, long-running or perpetual tasks in the background. They are very similar to Windows Services or Daemons. When you separate your application's background processes in a Worker role and host the front-end in a Web role, you can better distribute your application logic and have more fine grain control over how your application scales.

    Elastic Block Storage (EBS)

    Azure Drive aligns quite well with EBS. The Azure Drive is a VHD hosted within Azure Storage (technically within something called a Page Blob). This VHD can be mounted by your Web, Worker or VM Role. This drive looks like any other secondary drive connected to a server. Data written to an Azure Drive will persist outside of the instance that mounted it. You can also mount an Azure Drive Snapshot, providing a read-only data store to a large number of instances.

    DynamoDB (Beta)

    Dynamo is a NoSQL database that is very similar to Azure Table Storage. NoSQL is an excellent way to store unstructured or loosely structured data in a cloud environment. Wile they lack the referential integrity of a relational database, they are extremely efficient. This efficiency allows them to scale incredibly well.

    Simple Storage Service (S3)

    When it comes to storing stuff in the cloud, the examples sited almost always revolve around digital media of some type. AWS S3 is Amazon's answer, Azure Blob Storage is Microsoft's. They both serve the same purpose, storing large binary objects.

    Simple Queue Services (SQS)

    Queuing is vital to successfully scaling out in the cloud. Azure includes a persistent and reliable messaging service called Azure Queue. This is the primary way your machines (AWS) or roles (Azure) relay information to each other.

    Relational Database Service (RDS)

    As sexy as NoSQL is, it doesn't replace traditional relational database. When you need to store structured data with transactional support, turn to SQL Azure. SQL Azure is a high availability clustered SQL platform. It uses the same tooling as SQL Server, making it a relatively easy transition from traditional SQL Server deployments.

    Other Stuff

    Both platforms also have a host of additional services that you can add into the mix as well. I've decided to forgo diving into them at this time rather risk getting stuck in the weeds sorting out things like Rout53 and Traffic Manager. These are more advanced topics and beyond the scope of what I covered here.

  • Windows 8: Sleep, Restart & Shutdown

    Of all the questions I've seen regarding the Windows 8 Consumer Preview, "How do I shutdown?" seems to be the most prevalent. I've spent my share of time on various social networks showing people how to do it but that just doesn't scale. As such, I've decided to instead simply consolidate the various answers to the question. I've broken them down into two categories; Keyboard/Mouse and Touch.

    Keyboard/Mouse Users

    imageWinKey + I
    This key combination will bring up the Settings panel. There are number of options here, including the Power icon in the middle of the bottom row. From here you can Sleep, Restart or Shutdown.

    WinKey + L
    This key combination will Lock your PC. When you clear the wallpaper you are presented with the Login screen. In the lower left of this screen is that handy Power icon again. From here you can Sleep, Restart or Shutdown.

    This option is only available when you're on the Desktop (WinKey+D gets you there). Pressing F4 will bring up a dialog with Sleep, Restart and Shutdown options. This one is a bit obscure given that you have to be on the Desktop but it is there nonetheless.

    The 3-finger solute lives on. When you solute Windows 8 you are taken too a full screen of options and in the lower left is a handy Power icon. From here you can Sleep, Restart or Shutdown.

    Touch Users

    imageimageUsing touch you can getting to the Settings panel (WinKey+I) by bringing up the Charms. To do this, swipe in from the right and then select Settings.

    Push The Button

    Okay, I lied. The following both a 3rd category. I apologize….a little. 

    We have become trained to operate computers in a certain way. Sometime around the mid-90's we learned to never hit the power button and instead click Start to Shutdown. Well, you can stop that silliness. Hit the power button people. Wait, your laptop simply goes to sleep when you do that and you want a full Shutdown? That can be solved. Go into the Control Panel and search for "Button". The first item is called "Change what the power buttons do". In my case I have Close The Lid set to Sleep and Power Button set to Shutdown. Works like a charm for me.


  • I was ahead of my time? (SQL FileTables)

    A long time ago in a land far away (ok, 40 minutes west and 20 years ago but lets not quibble over the details) I started playing with Microsoft Access. I loved I (Yes. I said I loved Access. It was the 90's. Things were different then. We shall never speak of this again. Thank you.). In fact, I over-loved it. I shoved everything into it.  Application data, logging, security and even files. Yes, I said files. I know, I know. It was a bad idea.

    Now fast forward to 2012 and SQL Server 2012 introduces File Tables. That's right, file storage in the database that actually works like I wanted it to. So while you may see my story as a failure to understand basic database principles, I'm choose to believe I was just ahead of my time.

    File Tables is an extremely powerful and cool tool in the SQL Server 2012 arsenal. The description from the documentation says it all:

    The FileTable feature brings support for the Windows file namespace and compatibility with Windows applications to the file data stored in SQL Server. FileTable lets an application integrate its storage and data management components, and provides integrated SQL Server services - including full-text search and semantic search - over unstructured data and metadata.

    In other words, you can store files and documents in special tables in SQL Server called FileTables, but access them from Windows applications as if they were stored in the file system, without making any changes to your client applications. [emphasis mine]

    The only downside is that apps that use memory-mapped files like Notepad or Paint don't work if SQL Server is on the same machine (this isn't a problem if SQL is remote) but that's a edge-case if you ask me. It is based on FileStreams so it carries any limitations over from there as well.

    Pretty slick stuff.

  • Stop! Hammer time…

    For lovers of hyperbolic technology predictions, 2011 was a banner year. Based on media coverage one would assume that right now I'm sitting in front of my 3D TV while I write this blog on my phone. Meanwhile my ceiling is checking the weather while my refrigerator is busy posting to Google+ that I'm low on coconut water.

    My favorite of 2011 was the predicted death of the PC. What makes this one so interesting is that people were eager to jump on the bandwagon, there was little agreement as too why. Some said the Smartphone would replace the PC. Others said we'd all switch to using tablets. Meanwhile we saw millions of PC ship during the holidays.

    This boils down to the old adage that when all you have is a hammer, everything looks like a nail. The reality is that there are screws in the world. And they don't interface with hammers very well.

    While it would be nice to have a 60" resizable 3D touch-screen device that I can put into my pocket and expand while sitting on the couch to better see Angry Birds, it just isn't going to happen any time soon. Instead we'll have different devices for different tasks. There will be room for your hammer in the tool box, but it won't be your only tool.

    My wish list? A Smartphone in my pocket, a 30" monitor docked to my Laptop on my desk, a Tablet on the end table and a big whopping 70" TV in the living room. On top of that, I'd like the Cloud to sync content between all these devices. It would also be nice if they all shared a common interface.

    I already have a lot of this. Okay, I don't have a 70" TV (if anyone knows of a foolproof Wife Acceptance argument for such an item, please share). As I look around the house right now I do see most of this coming together.

    I have a Windows Phone 7 in my pocket. It syncs my documents, photos and OneNote up to the cloud. I've got Windows 8 Developer Preview running on my Laptop which is docked in the office. Next to the Couch is an Asus tablet, also running Windows 8 Developer Preview (I use this Tablet quite a bit, it comes to every meeting I attend and every flight I take). On the TV is my XBOX 360 playing a movie. All of these devices sync to the Cloud, they all run a Metro Style UI. I'm able to share content between them, editing on one and consuming on another effortlessly.

    Now all I need is my fridge to acquire an IP address while I look up what the heck coconut water is and why I'm suppose to care that I'm out of it.