Chuck Norris and the Internet of Things

In my last post I covered my experiences setting up the Intel Edison board and interfacing with the LCD and temperature sensor, but ran into a #fail when trying to make a REST call on site at the Intel IoT Roadshow in Somerville.

The issue was certainly network related and site-specific – a redirection to what would probably have been a network credentials dialog – but it wasn’t happening to everyone.  My resolution then was to call it a day and give it a shot at home… where it just worked.

Chuck NorrisIt occurred to me though that getting the current temperature from a web service was booooring, so rather than show you that, I opted to build the first ever (?) Chuck Norris IoT device!


These days there’s an API for everything, and who’d dare deny Mr. Norris his spot in the cloud! Yes indeed, there is an API targeting – what else – the Internet Chuck Norris Database. It’s a simple RESTful API that requires no registration or API keys making it quite easy to access. For instance, in your browser just navigate to[explicit]

and you should get back a bit of JSON that includes a short joke. Feel free to leave off the query parameter if you’re ok with potentially NSFW material being returned.

Invoking the API in Node.js

Node junkies know this stuff like the back of their hand, but I had to reacclimate myself to the purely async nature of the execution flow. Basically, you provide the URL you want to fetch and then a callback routine that processes once the request has completed.. like:

  • linifyJoke takes the joke string and divides it into an array of strings that are no more than 16 characters each to facilitate display on the LCD.
  • outputLines takes that array and the current line to be output and successively writes the lines to the LCD with a delay so you can read through the joke.

There’s nothing magical about that code (and I covered writing to the LCD in my last post), but if you want to view all the gory detail, I’ve included the entire script in this gist.

On-demand Joke

Once you’ve heard one Chuck Norris joke, you’ll find you can’t get enough of them, so I realized I need to beef up my implementation to allow you to request joke after joke.

Enter the button sensor from the Grove Starter Kit. The button returns a high voltage (1) when pressed and low (0) when released, so getting the button state is a simple read from the GPIO context that’s exposed by the mraa interface.

You’ll need to continuously poll for the press though, and when pressed carried out the desired action – perhaps ignoring, as I do, subsequent presses until the current request is complete.

Here, processingRequest is a sentinel value that prevents reentry to showJoke, with the outputLines method mentioned earlier having the responsibility for resetting the flag once the current joke has finished displaying.

This is not Vaporware!

Get on the Mobile Field Enablement Bandwagon

Merge the ubiquity of mobile devices and the always-on nature of the cloud, and it’s a no-brainer for automating your mobile workforces, whether they comprise insurance agents, home inspectors, delivery personnel, or grade school fundraisers!

Such solutions are slick and modern, but there’s a lot behind the scenes, and that’s why BlueMetal Architects, Xamarin, and Apprenda have partnered for a free, three-city Field Enablement Roadshow, kicking off in Cambridge at the Microsoft MTC on August 28th.

  Cambridge, August 28, 1-6 p.m.
Register for: New York, September 3, 1-6 p.m.
  Chicago, September 17, 1-6 p.m.


BlueMetal Architects - The Modern Application Company image Apprenda

During the 1/2 day event, consultants from these three organizations who have “walked the walk” will discuss strategies for efficiently leveraging mobile devices and the cloud for mobile workforces, with ample case studies and well as lessons-learned on pitfalls to avoid as you embark on your own modernization efforts.

I’m looking forward to attending myself, and hope to see you there!

Happy New Year

Every new beginning comes from some other beginning’s end.

Semisonic / Seneca the Younger

This new year brings a few more changes for me than in the past as today marks my last day as a Technical Evangelist at Microsoft and indeed my last day at Microsoft.

so long and thanks for all the fish

It’s hard to believe that nearly six years, thousands of miles, and gazillions of Meetups, BarCamps, and community events have passed since I joined the audience team of Microsoft’s Developer and Platform Evangelism (DPE) organization. I was drawn to Microsoft by my love of application development, but it was the involvement with community and the hundreds of folks I’ve met and interacted with throughout the years from which I drew my energy, and I thank you all for that.

As I move to the next stage of my career, I’m excited that I’ll be working hands-on with the very same technologies I’ve been espousing, and am looking forward to being part of the community from “the other side.”

Publish Your First Game – Hartford, Sept. 28

I am somewhat of a rarity – a geek that’s not really a gamer (well, unless you count Wordament with my 40 1st place finishes, w00t!), but for those of you that are and/or aspire to bring your own game concepts to life, plan to attend the FREE Windows 8 Game Development for Beginners workshop this Saturday, Sept. 28th, at the Microsoft Farmington Office.

Even if you have no software development background, you’ll be able to quickly grasp how to create a casual game using Construct 2 and package it for submission to the Windows Store. I’ve done that a few times – check out Letterman for instance, but don’t be fooled by how simplistic that one looks. With the same tool, another developer (with considerably more artistic skills than I) created the stunning Mortar Melon app (below) that’s on both Windows 8 and Windows Phone.

Mortar Melon - built with Construct 2

So set aside a few hours this coming Saturday (10 a.m. – 2 p.m.), bring your laptop with Windows 8 (or even Windows 7), and join me and Josh for a fun and informative session.

Lunch is on us!

And if you have teens or preteens that might be interested in taking part bring them along too. At past workshops in Farmington and elsewhere, we’ve had several parent-child teams participate. After all, the family that codes together….

Umm, what’s this Codocent thing?

Opening day!

Welcome to the inaugural post of my new presence on the web. If you were directed here from my MSDN Blog, nothing’s really changed in terms of my role as a Microsoft Technical Evangelist. One of the primary motivators for the move was to gain more flexibility and control over my blog hosting and perhaps most importantly provide a responsive theme for mobile users – something that wasn’t easily achievable on the MSDN platform. By the way, my MSDN Blog and all the past articles will remain in place, and you can get there by clicking the “M” icon on the right sidebar.

What’s with the name – codocent – you ask? Well, my eponymous URL,, was already claimed; the owner wasn’t interested in relinquishing (and from the state of that site apparently not too keen on publishing either); and I didn’t want to settle for just a .net or .me version.

That set me off on a brainstorming mission.

  • I love code. I love the craftsmanship aspect, the discovery of a better way to do things, and the learning along the way. I knew that “code” needed be part of my brand.
  • My other passion is teaching, helping folks understand concepts, seeing the lightbulb come on and learning from them as well as they go through that process.

Many of you know that I have a strong background in the classics, so it’s second nature for me to reach for words with Latin roots. “Teacher” in Latin is “doctor”, which has an patently different connotation in English, but from that I gravitated to “docent”, which literally means “they teach” but in English refers to learned guides in museums, historical sites, and other such attractions.

Codedocent, though, doesn’t quite roll of the tongue: co-dedocent? code-o-cent?

Enter a bit more of my classical training (and some poetic license). In poetry, there’s a device known as elision where you conveniently leave out parts of a word or phrase to fit a meter or make it easier to pronounce. Take the word temperature for instance – not many of us spend time with that second ‘e’.

codocent then is an elision of code and docent and with that comes a bit of serendipity. A co-docent is exactly what I aspire to be. As I explore and write about technical topics like mobile development and cloud architectures, I endeavor to expose others to what I’ve learned.

But it’s not a one-way street. Through every interaction I take away something from the audience that I’m ostensibly there to educate. Each individual comes from a different place, a different context, different experiences, and I learn as much from them as I hope they do from me.

So it’s in that spirit of mutual learning that I’m kicking off this new blog. I hope you’ll join me on the journey and participate in the conversation here and whenever we have the chance to meet in person.