Alexa, add ‘Hack Amazon Echo’ to my TODO list!

So I gave in and got one of those black Pringles cans called Amazon Echo a couple of months ago and I got to say, it’s been an eye opening experience. I’ve played around with Siri, Google Now and lately, Cortana and Project Oxford but I never really felt an emotional connection to any of them like I have with Alexa. Not sure why. It could be that, thru Echo, she virtually sits in my kitchen all day long telling my family jokes and maintaining our shopping list. It could also be her potential to become a great virtual assistant. I’m also not sure why I refer to Alexa as “her” instead of it. Why the immediate bond? I just can’t put my finger on it but for some reason, I actually feel bad when I say “Alexa, shut up!” which is an actual alternate command to “Alexa, stop.”

It could also be that Alexa probably has the simplest SDK and API I was able to play with… what can I say, I love API’s!

I know what you’re thinking… “enough ranting and tell me just how simple!”

First step (after you read this post in it’s entirety of course), is to go to http://developer.amazon.com/alexa and read up on as much of the documentation as you can. Familiarize yourself with all the lingo like “Skills”, “Slots” and “Utterances” for example. Also download the code samples they have for node.js and Java. Try to get those running and take it from there or if you prefer C#, just fire up Visual Studio, create a Web API project and create a new Web API controller called AlexaController.cs for example, then drop in the following code…

[HttpPost, Route("api/alexa/helloworld")]
public dynamic HelloWorld(dynamic request) {
 return new {
  version = "1.0",
  response = new {
   outputSpeech = new {
    type = "PlainText",
    text = "Hello, World!"
   },
   card = new {
    type = "Simple",
    title = "My Alexa Hello World demo app.",
    content = "Hello, World!"
   },
   shouldEndSession = true
  }
 };
}

A quick rant on dynamics, if you don’t like em’, don’t use em! I’m a big fan of dynamics when it comes to creating PoC’s and prototypes. Other than that, strong type to your hearts content!

Once you drop in the code above, build, then go ahead and test your new endpoint using Unit Tests or Fiddler. If working locally (I’m assuming you are somewhat familiar with building Web API’s in C#), upload it to either Azure or another Internet accessible host as Alexa will need to be able to access your endpoint from her end.

Then if you haven’t done so already, you will need to open a free Amazon developers account at http://developer.amazon.com/login. Once logged in, click on the Apps & Services > Alexa. Then get started with the “Alexa Skills Kit”. The ASK is Amazon’s SDK for creating Alexa apps or what they call Alexa Skills. On the following screen, you will click on “Add a New Skill” button. This will take you to the first step in the adding new skill process called, “Skill Information”. There, you have the following fields…

  • Name: This is your friendly Skill (app) name. Something like “My App”.
  • Invocation Name: This is the word users will say to interact with your skill. For example, “Alexa, ask myapp to do something.”
  • Version: Just add 0.1 or 1.0 for now, can worry about versioning once you get serious about deploying an Alexa Skill publicly, for now, we’re just having some fun.
  • Endpoint: This is where you drop in the URL to the new endpoint you’ve created in Azure or other Internet accessible host. Here’s the kicker, HTTPS is required! Cool thing about Azure is, they provide SSL on all their URL’s but if you are on another host, keep that in mind. You can also use AWS Lambda for free, only problem there is, no C# 🙁

Click “Next” once you are done with that initial step of the Add New Skill form. On the following screen titled, “Interaction Model”, you will see the following 3 areas…

  • Intent Schema: This is a JSON structure object that contains your intent schema. Since we are just doing a basic Hello World for now, you can simply paste in the following JSON object…

{“intents”: [{“intent”: “HelloWorldIntent”}]}

  • Add Custom Slot Types: This is a recently added feature, can skip for now, but once you get this hello world demo up and running, I recommend reading more about Slots at Defining The Voice Interface.
  • Sample Utterances: This is basically a list of phrases that map to each of your Intents, since we only have one intent for now, you can simply paste in the following…

HelloWorldIntent say hello world
HelloWorldIntent say hi to everyone in the world
HelloWorldIntent say hi to the world
HelloWorldIntent tell the world hello

Once you are done here, click next and you will end up at “SSL Certificate”, where you have 3 SSL options to select from. If you are testing on Azure, go ahead and select “My development environment is a subdomain…”, if not, select the appropriate option for your service.

NOTE: If you opted for AWS Lambda as your host, then the SSL Certificate step does not appear.

The following steps called “Test” and “Publishing Information” can be skipped for now. Note that in the test step, you can test the connection to your endpoint using the Service Simulator which is extremely helpful in debugging your Skill down the road. The publishing step is self explanatory, if we’re going to go “live” with our Skill and submit for certification to have it published in the Alexa Skills store, then fill out the publishing form. None of this is required however to test it on your actual Echo at home.

At this point your skill is up and running. An important thing to remember, something that actually had me stumped for a few minutes, was that I have 2 accounts linked to Alexa, mine as well as my wife’s account and when I kept asking “Alexa, ask HelloWorld to say hello”, I kept getting an error. But when I said, “Alexa, switch accounts”, I verbalized one of my sample utterances again and it worked just fine. Another thing to remember is whatever account you use for Alexa, it should be the same as your developer account. If you already have 2 separate accounts, one for your developer account and another one for your Alexa account, you can easily add your developer account in the Alexa mobile companion app. Otherwise, just use your Amazon account on both Alexa and the developer account to make life a bit easier.

Well like I mentioned earlier, your skill is up and running so go ahead and ask Alexa to ask your app to say hello world and cross your fingers! It should work, “it works on my machine!” (I wonder how many people will get that QA reference!) If it doesn’t, make sure you are in the correct account and the endpoint works in the Service Simulator. Also, make sure your unit tests all pass and that it’s all working in Fiddler as well. If you have passed all these tests, you should be good to go. If you are still running into any problems after all that, reach out.

Next steps?

Keep building off this basic hello world example in C#. Add session management, add Slots and Custom Slots and multiple Intents then just keep going from there. Once you have mastered the SDK, API and everything it has to offer, start thinking about the user experience and creating a killer Skill for Alexa. Then, AVS… post on that coming soon!

And most importantly… have fun!

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

My Google Glass Experience

Google GlassRecently BGT Partners was acquired by PwC and since then I’ve been tasked to work on a Google Glass project for one of PwC’s large clients and it’s been a pretty interesting experience so far. There’s not one but 2 API sets I can tap into. One is called the GDK and the other is called the Mirror API. The latter is a pure services layer where I can build a services oriented application running .NET Web API for example, then I can plug into that via the Glass and like magic I can interact with my custom build services.

The GDK (Glass Development Kit) is a fairly new SDK that allows for more native application development. It’s sits on top of the Android SDK so the development environment is very similar to building an native Android application. With the GDK you have access to device level components that the Mirror API doesn’t have access to such as the camera and sensors.

I’m currently building a hybrid application that involves both the Mirror API and the GDK. It’s currently a prototype and I am documenting issues along the way. I will be posting my findings here soon but in the mean time if you have any questions feel free to contact me.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

DIY iPad Frame

Cut mat 0.5 inch
Cut mat 0.5 inch
Glued eraser slice for button
Glued eraser slice for button
Carved groove with router
Carved groove with router
Almost done!
Almost done!
Nail in backing
Nail in backing
All done! Can use on counter or wall mount.
All done! Can use on counter or wall mount.

Once I got my Surface Pro my old iPad was sitting around collecting dust. At the same time I was still using a pen and paper to make my grocery list, I know, I’m getting old, what can I say. So I decided to step in the 21st century and mount my ipad in the kitchen and use it for a grocery list and other things like looking up recipes and listening to music.

First thing I did was look up “iPad wall mounts” and damn, between $80 and $150 for anything decent that covers all the edges and wires. Guess I’m DIYing it! Next step, find a decent grocery list app. I bing’d “Best grocery ipad app” and found Grocery IQ by coupon.com. It has a ton of features as well as apps for iPad, iPhone which my wife has and Android for me, perfect! I went ahead and downloaded it on all my devices, sync’d the grocery list with the Android and everything works as advertised so far so let’s get mounting.

Next thing I do is go to my garage where I can find just about anything being that I’m a pack rat of sorts. I find an old 4×6 picture frame and discard the glass. The iPad fit great within the frame but the mat had about a half inch overlay on the touch screen, no bueno. After trimming the fat with an old x-acto blade, I realize that I need a hole to hit the ipad button. Now I didn’t want to have to carve out a circle so I sliced the tip off an eraser and hot glued it to the mat, this made it so all we have to do is push on the mat to hit the button, tested it, worked like a charm!

I then plugin the ipad and framed it, another problem, damn plug doesn’t fit! No problem really, I whip out the ol’ router, carve out a nice groove and bam, fits perfectly.

Lastly, I add the picture frame backing, hammer in a few nails to hold it in place and 20 minutes later, I have myself a free iPad frame and wall mount.

Now for the hard part, hit the grocery store, ugh :/

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

At Microsoft Build 2013

Microsoft Build at Moscone Center
Microsoft Build at Moscone Center
Microsoft Build Conference
Microsoft Build Conference
A grand entrance
A grand entrance
Geek fest 6,000 deep
Geek fest 6,000 deep
Day 1 Keynote
Day 1 Keynote
3D Printers
3D Printers
Surface controlled balls!
Surface controlled balls!
More 3D Printers
More 3D Printers

So I was on my flight to San Francisco for the 2013 Microsoft Build Conference and was working on my laptop, totally disconnected from the web, punching in User Stories and Tasks in a Microsoft Excel spreadsheet that I had previously connected to TFS 2012 before heading out. I click on File > Save and it gives me a connection error for obvious reasons, I mean, I am on a plane after all. When I get to my hotel and connect to the WiFi, I click on File > Save again, and bam, all the work I had done on the plane was saved to TFS ready for my team to work on. No double entry required! That alone lead me to believe this was going to be a great trip.

Now, at the Moscone Center in downtown San Francisco, I sit in for the Day 1 Keynote and man, the progress Microsoft has made in the last 8 months since the last Build conference in Seattle is astonishing! I’m blown away with even just the subtle differences between Windows 8.0 and Windows 8.1, just one min version, yet it seems like a major version release. New features such as dual screen support for the modern view (formerly metro), multi-view snapping with variable width support, native 3d printer support, hands free mode, lock screen slide show, Skype call answering from lock screen without having to login and much more. The Search results from the charm are incredible for example, search “New York” from your desktop or device and a pseudo app will be created on the fly with aggregated data from your machine, social accounts, xbox as well as Bing search results and more as the Bing API is now open to developers to build on top of those search results.

One thing I wasn’t happy about was the come back of the start button, I was the only one in the crowd booing that one as everyone else clapped. I personally wish they would just get rid of the desktop altogether. I’ve been looking at it for over a decade, on Windows and various Linux flavors including Macs, it’s all the same, I’m over the whole icons and menu bar on a desktop view! Let’s move on people!

As for tooling, the updates in VS and TFS 2013 are great. There’s finally decent async debugging! In addition, there are over 1,500 new API’s for us to play with. I can go on and on but one thing that really amazed me was Project Spark. Wow! This is definitely a game changer (no pun intended) as it’s a platform that allows anyone to build games on a tablet using touch gestures for example then seamlessly share and play it on an XBox console. My son already develops virtual worlds to play in online via Roblox but what Microsoft has done with Project Spark simply blows Roblox out of the water. The graphics are what you would expect of an XBox game and literally no programming knowledge is required.

If you’re interested in learning more about Project Spark, go to https://joinprojectspark.com.

For videos and other details on the Microsoft Build Conference, go to http://buildwindows.com.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

API? What API? Who needs an API?

I’ve had my fair share of missed opportunities but not seeing the business value in exposing a robust API to your application is beyond comprehension to me. Take Facebook for example, by opening up their API they blew past the competition and was able to embed themselves to every corner of the web cosmos. Third party investments in their API are so great that, to so many companies, it doesn’t make business sense to completely move on to another social platform.

Even older platforms like SAP have embraced exposing a rich API framework that’s so embedded in a vast array of Fortune 500 companies that it’s almost virtually impossible to move away from. I’m not saying it’s completely impossible, just not cost effective. So in a nutshell, yes, done right, API’s are a gold mine for a business.

Now that you know how I feel about API’s, you are going to really understand why I was shaking my head to a response I received from a small project management outfit called Workamajig. I wasn’t a fan of the flash based project management platform to begin with but I gave it chance. I decided it would be much easier to work the tasks in Workamajig from the tools I’m familiar with such as Visual Studio and TFS. I figured I can hook up the TFS API’s for handling work items and send them to the Workamajig API.

Sounds great in theory and working with normal modern platforms this would of been executed beautifully. So I decide to visit the Workamjig web site searching for keywords like “developers” and “api” and nothing. I search Google, searched Bing… nothing. Logically, I decide to send them the following email …

“I was searching all over your site for API information and came up short. Does Workamajig even have an API? I would like to see if I can integrate Workamajig with TFS or Git.”

… and to my delight they responded within the hour. But to my horror, I received the following response…

“Nope!  Workamajig does not have an API.  It is a total end to end system meant to take the place of any other system(s) that you have.  It is not a fill in piece of software or a simple project management tool but more of a way of going. [: ]”

Needless to say I was impressed by them having an emoticon version of their logo, but saying that Workamjig “is a total end to end system meant to take the place of any other system” … wow, that explains a lot. That explains their UX strategy, their choice in a flash based platform, even their business strategy. Not only do they just blatantly dismiss the API opportunity but they claim to replace TFS? Git? I mean that’s what I was asking about integrating with or am I reading too much into it? Either way, that response lacked tact and just lowered my respect for their platform even further.

“It is not a fill in piece of software or a simple project management tool but more of a way of going. [: ]”

Yeah, it’s a way of going alright, going away from Workamajig.

SMH

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

Resolve a Late-Binding Web Forms MVP and Telerik Control Issue

When working with Web Forms MVP framework and Teleriks RadGrid everything runs great up until the point you turn on filtering. Then bam! You’re hit with this beautiful exception … Load(Sarcasm) …

At first we were confused by the exception being that we didn’t have any RadComboBoxes on the page but as it turns out, RadGrid loads RadComboBoxes when you turn on filtering. Now the problem lies with MVP databinding OnPreRender causing the RadComboBox to register a script too late in the page lifecycle.

To fix this issue, you can just set AutoDataBind to false. Oddly enough, that didn’t work neither. We set it in OnLoad, then OnInit and nothing. We didn’t have PreInit available as this was a User Control (.ascx) so we added a constructor and set it in there and viola! It worked.

[[code lang=”csharp[lines]”]]czoyMzU6XCJbUHJlc2VudGVyQmluZGluZyh0eXBlb2YoU3RvcnlMaXN0UHJlc2VudGVyKSldDQpwdWJsaWMgcGFydGlhbCBjbGFzcyB7WyYqJl19U3RvcnlMaXN0Q29udHJvbCA6IFdlYkZvcm1zTXZwLldlYi5NdnBVc2VyQ29udHJvbDxTdG9yeUxpc3RNb2RlbD4sIElTdG9yeUxpc3tbJiomXX10Vmlldw0Kew0KICAgcHVibGljIFN0b3J5TGlzdENvbnRyb2woKQ0KICAgew0KICAgICAgQXV0b0RhdGFCaW5kID0gZmFsc2U7DQoge1smKiZdfSAgfQ0KICAgLi4uDQp9XCI7e1smKiZdfQ==[[/code]]

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit

Provider Pattern for Consuming Feeds

So I started working on a new project where we’re taking the Service-First-Design approach (post on that coming soon!) and it basically consumes feeds such as RSS, Atom and other types of feeds right in the service layer. Since we wanted to allow for any number of feed formats we decided to implement the provider pattern instead of a big ol’ switch or if-else statement. Below are some snippets and pseudo code on how that worked out for us…

IFeedProvider.cs

[[code lang=”csharp[lines]”]]czo2NTpcInB1YmxpYyBpbnRlcmZhY2UgSUZlZWRQcm92aWRlcg0Kew0KICAgdm9pZCBQcm9jZXNzKEZlZWQgZmVlZCk7DQp9XCI7e1smKiZdfQ==[[/code]]

The IFeedProvider interface gives us a nice simple standard interface to start working with. All we added for now is a “Process” method that each class implementing this interface will use to process the feeds.

RssFeedProvider.cs

[[code lang=”csharp[lines]”]]czo2Mzk6XCJwdWJsaWMgY2xhc3MgUnNzRmVlZFByb3ZpZGVyIDogSUZlZWRQcm92aWRlcg0Kew0KICAgcHVibGljIHZvaWQgUHJvY2V7WyYqJl19c3MoRW50aXRpZXMuRmVlZCBmZWVkKQ0KICAgew0KICAgICAgdmFyIHJzcyA9IFJzc0ZlZWQuQ3JlYXRlKG5ldyBVcmkoZmVlZC5VcntbJiomXX1sKSk7DQogICAgICBpZiAocnNzICE9IG51bGwpDQogICAgICB7DQogICAgICAgICBmb3JlYWNoICh2YXIgcnNzSXRlbSBpbiByc3Mue1smKiZdfUNoYW5uZWwuSXRlbXMuV2hlcmUoaSA9PiBpLlB1YmxpY2F0aW9uRGF0ZSA+IGZlZWQuRGF0ZUxhc3RVcGRhdGVkKSkNCiAgICAgICB7WyYqJl19ICB7DQogICAgICAgICAgICBmZWVkLkZlZWRJdGVtcy5BZGQobmV3IEZlZWRJdGVtDQogICAgICAgICAgICB7DQogICAgICAgICAgIHtbJiomXX0gICAgVGl0bGUgPSByc3NJdGVtLlRpdGxlLA0KICAgICAgICAgICAgICAgVXJsID0gcnNzSXRlbS5MaW5rLlRvU3RyaW5nKCksDQoge1smKiZdfSAgICAgICAgICAgICAgRGF0ZUNyZWF0ZWQgPSBEYXRlVGltZS5VdGNOb3csDQogICAgICAgICAgICB9KTsNCiAgICAgICAgIH0NCiB7WyYqJl19ICAgICAgICAvLyB1cGRhdGUgRGF0ZUxhc3RVcGRhdGVkIG9uIGVhY2ggZmVlZA0KICAgICAgICAgZmVlZC5EYXRlTGFzdFVwZGF0ZXtbJiomXX1kID0gRGF0ZVRpbWUuVXRjTm93Ow0KICAgICAgfQ0KICAgfQ0KfVwiO3tbJiomXX0=[[/code]]

The RssFeedProvider implements IFeedProvider interface and the Process method. The Process method simply takes in a Feed entity from our Entity Framework data model and processes it accordingly. In case you’re wondering we are using Argotic on CodePlex to parse out the RSS, Atom and OPML feeds. Works like a charm! Now back to the provider pattern…

AtomFeedProvider.cs

[[code lang=”csharp[lines]”]]czoxNTA6XCJwdWJsaWMgY2xhc3MgQXRvbUZlZWRQcm92aWRlciA6IElGZWVkUHJvdmlkZXINCnsNCiAgIHB1YmxpYyB2b2lkIFByb2N7WyYqJl19ZXNzKEVudGl0aWVzLkZlZWQgZmVlZCkNCiAgIHsNCiAgICAgIC8vVE9ETzogSGFuZGxlIHlvdXIgQXRvbSBmZWVkcyBoZXJlDQogIHtbJiomXX0gfQ0KfVwiO3tbJiomXX0=[[/code]]

This AtomFeedProvider class also implements IFeedProvider (logic stripped for brevity).

FeedHandler.cs

[[code lang=”csharp[lines]”]]czo0NDg6XCJwdWJsaWMgY2xhc3MgRmVlZEhhbmRsZXINCnsNCiAgIHZhciBjb250ZXh0ID0gbmV3IE15RGF0YUNvbnRleHQoKTsNCiB7WyYqJl19ICB2YXIgZmVlZHMgPSBjb250ZXh0LkZlZWRzLlRvTGlzdCgpOzwvZmVlZD4NCiAgIElGZWVkUHJvdmlkZXIgZmVlZFByb3ZpZGVyIHtbJiomXX09IG51bGw7DQogICBmb3JlYWNoICh2YXIgZmVlZCBpbiBmZWVkcykNCiAgIHsNCiAgICAgIGZlZWRQcm92aWRlciA9DQogICAgICAge1smKiZdfSAgKElGZWVkUHJvdmlkZXIpQWN0aXZhdG9yLkNyZWF0ZUluc3RhbmNlKFwiWW91ckxpYnJhcnlcIiwNCiAgICAgICAgIFN0cmluZy5Db3tbJiomXX1uY2F0KFwiWW91ckxpYnJhcnkuTmFtZXNwYWNlLlwiLCBmZWVkLkNsYXNzTmFtZSkpLlVud3JhcCgpOw0KICAgICAgZmVlZFByb3ZpZGV7WyYqJl19ci5Qcm9jZXNzKGZlZWQpOw0KICAgfQ0KICAgY29udGV4dC5TYXZlQ2hhbmdlcygpOw0KICAgY29udGV4dC5EaXNwb3NlKCk7DQp9XCJ7WyYqJl19O3tbJiomXX0=[[/code]]

Once you have your interface done and at least two (for testing purposes) providers ready to go, you can create your class that will call the providers. In this example, using Entity Framework, we simply pull a list of RSS and Atom feeds that are stored in a SQL database. For each feed we are going to call Activator.CreateInstance and pass in the library and namespace of the provider. Don’t forget to call the UnWrap() method at the end to unwrap the instance into your variable declared with the interface type, in this case, “IFeedProvider”.

Finally, once you have your variable containing the instance of your feed provider, you can call the “Process” method implemented in each of the providers. Once you have processed all the feeds, call SaveChanges on your context and commit the feed items to the database. You can also implement caching and return the feed items back out through the service layer as JSON or an aggregated RSS feed which is what we are doing in our project. Sky’s the limit!

Enjoy.

Share on FacebookTweet about this on TwitterShare on Google+Share on LinkedInShare on Reddit