The World According to Marc
-
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).
Amazon 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.
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
WinKey + 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.ALT-F4
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.CTRL-ALT-DEL
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
Using 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.
-
Office 2010 Helps Me Out
I stink at proof reading. I miss a slew of grammatical and spelling errors. Okay, slew is an understatement.
When I started working heavily with speech technology a few years ago I discovered something interesting. If I used text-to-speech to read what I wrote I caught all the errors. My completely unprofessional diagnosis - my brain is filtering the data stream from my eyes but not my ears. I immediately started using this new trick to improve my proof reading.
The one problem I had however was that almost nothing has built-in TTS support. I was able to add it to Word using a macro and copy and paste everything into Word but this was prone to errors and frankly a pain in the butt.
Today I happen to be digging through Outlook and discovered a new command in 2010 that I hadn't seen before –> Speak. It is detailed here but essentially it reads the selected text and works throughout Office (finally giving me TTS functionality for my emails).
-
SQL Denali Makes Even Fast Look Slow
I've seen a lot of performance testing over the years, every so often I'm even impressed a bit by the results. Here is one however that will melt the mind of anyone working against large SQL databases: SQL Denali + 1.4 billion with a b rows = 455x increase from 2008 R2. No, I didn't fat finger an extra 5 there. It was that big.
How? By using a new feature called a Column Store Index (aka Column Indexing). For those wanting the details on how it works and how they tested it you can find the PDF here. Not interested? You sure? I promise, its really short.
One major caveat however is that not all data types are supported within it. Most wouldn't make sense for this type of use anyway but one in particular was a pain –> uniqueidentifier. I've long used uniqueidentifier as my ID for tables (makes n-tier, replication and merging databases a lot easier). The other gotcha types are the (max) text columns. If you thought you could get away with just setting everything to (max) then you can mark today as when you found out that was a bad idea. You can find the other limitations and restrictions here.
Looking at the performance I really could have used this feature more than once in the past.
-
Welcome! Support group meets Wednesdays at the Library...
Popularity has its downsides. My favorite bit is "Independent Mac security experts believe there is enough security built into the OS X operating system to protect users, given the current level of risk." This raises a question for me. If there is no need to protect OS X because of its built in security, why would there be a need for "Independent Mac Security Experts" in the first place?
-
Blue Badge
I've been very lucky in my career so far. I've had the pleasure of working on some amazing software with many brilliant people over the years. And starting in two weeks, I'll be continuing that trend. Starting at the end of the month, I'll be joining Microsoft. The official title is "Senior ISV Architect Evangelist" but, as with most titles, it doesn't really tell you much. Basically I'll be helping ISVs leverage the Microsoft stack. I'm excited because it means I'll be knee-deep in the latest and greatest bits. And given the number of cool toys coming to the developer's toy box, there will be plenty to wade through. Back in the early 90's I read Guy Kawasaki's "Selling the Dream" and thought this sounded like a dream job. And beginning next month, I get to start doing it.
-
Implementing InstanceDependencyProperty
If you were looking to the UCMA 3.0 documentation for information on how to use InstanceDependencyProperty, don't. Its incomplete and what is there is incorrect. In an effort to implement my custom activities in the same way as Microsoft, I wanted to ensure that property values didn't get destroyed when you moved on to the next activity in your workflow. This is vital if you plan on returning values from a Workflow Activity for another Activity to make use of. For example, you likely want the Recognition Result from the question you asked them so you can act on it. The InstanceDependencyProperty allows you to keep property changes you made within an Activity. Without it, the second the instance of that Activity is finished executing, the property changes are discarded. If you checked them from another activity, all you'd get are the default values. Not very useful if you ask me. So here is an stripped down example of an Activity that implements InstanceDependencyProperties properly: [csharp] using System.Workflow.ComponentModel; using System.Workflow.ComponentModel.Serialization; using Microsoft.Rtc.Workflow.Activities; namespace AudioRecordingActivity { public partial class Activity1 : Activity, IInstanceDependencyContainer { private static System.Collections.Generic.Dictionary _instanceDependencyProperties; public Activity1() { _instanceDependencyProperties = new System.Collections.Generic.Dictionary(); } public System.Collections.Generic.Dictionary InstanceDependencyProperties { get { return _instanceDependencyProperties; } } public readonly static InstanceDependencyProperty MyStringProperty = InstanceDependencyProperty.Register("MyString", typeof(string), typeof(Activity1), "Empty"); public string MyString { get { if (base.DesignMode) return InstanceDependencyHelper.GetValue(this, MyStringProperty).ToString(); else return InstanceDependencyHelper.GetValue(this, this.WorkflowInstanceId, this.MyStringProperty).ToString(); } set { if (base.DesignMode) InstanceDependencyHelper.SetValue(this, MyStringProperty, value); else return InstanceDependencyHelper.SetValue(this, this.WorkflowInstanceId, MyStringProperty, value); } } protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { MyString = "Test String"; return base.Execute(executionContext); } } } [/csharp] Here the key things to know:
- Your Activity needs to implement the IInstanceDependencyContainer interface
When you impement the interface, the private _instanceDependencyProperties dictionary must be static- Your properties must implement both prototypes of GetValue/SetValue. One is used for design-time, the other for run-time.
One other important note. In the documentation example they use a property with a TimeStamp type. You need to decorate this property with [TypeConverter(typeof(TimeSpanConverter))] or it will give you a very vague error at compile time. UPDATE: I had initially thought I had this fully working until I attempted to drop more than one of my custom activities on my workflow. I quickly found an issue with the static _instanceDependencyProperties however. Because it was static, changes to properties on Activity1 were reflected on Activity2. After some time with Reflector, looking at how Microsoft's activities were built, I noticed they used two different versions of InstanceDependencyHelper, one for design time and one for run time. Low and behold, if you implement both versions and remove the static statement you get the correct behavior. Its very unfortunate that the documentation doesn't explain this.
-
Building a New Record Audio Activity
One of the key activities missing from UCMA that we used in Speech Sever 2007 is the Record Audio Activity. This was one of my "go to" tools in the Speech Server arsenal, so I've been hurting without. So to eliminate my pain, and hopefully some other's, I've started building a replacement. While what I've built so far isn't nearly feature-complete, it will hopefully provide a suitable starting point for those looking to simply record some audio. Trust me, starting from scratch wasn't much fun. It may seem simple (and it really is) but it was extremely unclear when I started. A special thanks to Marshall Harrison who helped me put this together. What's Included
- InitialSilenceTimeout – How long should we record silence before we decide the calling isn't going to start talking
- EndingSilenceTimeout – How long should we record silence before we decided the caller has stopped talking
- FilePath – Full path where we should save the file (this is new, it wasn't definable in Speech Server)
- AudioEncoding – Format to encode the saved file as (Wma16Kbps,Wma48Kbps, Pcm16Khz or Pcm8Khz)
- RecordedLength - The length of the recorded made
What's Not Included
- LeadingSilenceTrimmedLength – We're just saving the raw audio, there is no post-processing of the file
- TrailingSilenceTrimmedLength – See above
- PlayBeep – This object simply records audio, it doesn't play any prompts or tones
- Prompts - See above
- TerminationDigits - The only method used for stopping recording at this point is silence from the caller
- CanBargeIn – Given the lack of prompts, there was nothing to "barge in" on
I've included the full project (and the compiled Debug and Release versions) here:Â AudioRecordingActivity1.2
UPDATE: I've fixed a few issues and updated the download to v1.1.Update: We're now at v1.2. This version solves some problems with Properties when multiple copies of the activity are in the same workflow