codocent - Jim O'Neil's mobile app development musings

Global Azure Bootcamp – Two Area Locations

Global Azure BootcampOn Saturday, April 25, the Boston Azure User Group will be hosting the 2015 Global Azure Bootcamp at two separate venues in the area:

Each site will feature Azure experts presenting on various aspects of the Microsoft cloud platform and leading hands-on labs reinforcing those concepts. This free event is an awesome opportunity to get practical experience with Microsoft’s cloud and to network with fellow technologists in a casual environment.

RSVP at the links above, and plan to bring your laptop with the following already setup:

Each event is free of charge, and we’ll have a light breakfast and lunch available!

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!

ICNdb

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

http://api.icndb.com/jokes/random?exclude=[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!

My IoT Weekend – Part 1

What better way to spend Super Pi Day than with 100+ technology geeks at a Hackathon… and that’s just how I started out this past weekend. Intel is hosting an IoT Roadshow at a number of cities across the world, and they were in Somerville this weekend at Greentown Labs for the Boston edition. It was a full house with many – me included – drawn by the free Edison board and Grove-Starter Kit offered to the first 100 attendees in line.

It's mine, ALL MINE!!!

I arrived at just past 8 a.m. and was about 50th in line… a line that didn’t start moving until they opened the space at 9. The photo below was taken about 1 p.m., at which time everyone had boards out, and table space was at a premium.

I’ve noted before a major irony of the wireless (and now IoT) age is that you need more room and more wires to get everything up and running or charged.  The Edison board, for instance, needs two USB cables and a power cord when you’re flashing the firmware.

Full house at Greentown Labs

This event was a hackathon, with cash prizes of up to $1500 being offered, but I knew I wouldn’t have the entire weekend to dedicate. Nor did I have any really inspirational ideas, and none of the few pitches I heard was overwhelmingly compelling to me. For my first foray into this hardware hacking, I was kind of itching to go it alone anyway, and luckily I had a duo of experienced Arduino makers next to me to get me over the few bumps in the road I encountered.

Setting up the board was a great deal simpler than I expected, and Intel has assembled a pretty good set of tutorials and references on their Google docs site to follow. For Windows users, it turns out there’s a new installer that actually makes it even easier to flash the board, set up the drivers on your laptop, etc. – a fact that wasn’t clear until I was 75% through the manual process.

That said, the 90 minutes it took for me to work through the manual process gave me a much better understanding of how it all works together, from flashing the board, to using PuTTY and SSH to connect, to setting up ethernet over USB, to connecting the board to the XDK development environment (which, by the way is pretty slick, and has progressed nicely since I used it over a year ago for cross-platform mobile development demos).

Blinky Lights

XDK comes with a number of template applications for the board, so I started with the on-board LED Blink app,

XDK Templates

which consists of the following bit of Node.js code (yes, it’s JavaScript, Python, or C++ if you’re talking to the Edison):

Blinky Light Code

The mraa reference may look a tad arcane: it’s simply a C++ library with bindings to JavaScript (and Python) that enable low level communications with the board components. Upm is another interface, built on mraa, that provides a higher level interface, with methods and properties that are more specific to the type of sensor. Upm is what’s used in most (if not all) of the other samples on Intel’s Google Docs site).

To get from code to execution, it’s a simple matter of building and uploading the project to the board, which XDK makes pretty easy via its UI (below).

XDK Deployment

The end result of the app isn’t exactly photoworthy, so I’m sparing the bandwidth. Suffice it to say, ahem, the light bulb finally went on (and off… and on… and off).

Using the Temperature Sensor and LCD

The Grove starter kit comes with about a dozen sensors, so I thought I’d kick things up a notch by connecting the (analog) temperature sensor and displaying the current temperature on the LCD (I2C) sensor.

Not much code needed here:

to produce :

Temperature Sensor w/LCD

Adding Internet to my Things

My next step was to use one of the freely available web APIs out there to get the current temperature outside, compare it to the temperature inside, and then display the difference on the LCD.  There are host of APIs and API curators out there (Mashery, Programmable Web, Apigee, etc.), but the free one that caught my eye was WeatherUnderground.  You make a simple REST call and you get back some JSON with a bevvy of information about the current conditions at your location (specified via city name, id or lat-long). Yeah, you do need to sign up for a free account, but that’s pretty much par for the course these days.

The code to make a GET call in Node.js is pretty simple if you use the Request package… or so I thought!  My Node skills are admittedly rusty, but when the “Hello World” example wasn’t working, I knew it wasn’t me, and in fact there seemed to be a network issue that affected some -but not all – of the attendees. Every request being made from my board was getting redirected to what appears would have been a splash screen looking for network credentials, so while my HTTP requests were returning a success code, they weren’t really hitting the intended service.

After about an hour of back and forth with the awesome Intel guys on site, reflashing the board, and waving dead chickens, I decided to call it a day and hope for better connectivity at home.

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!

Global Windows Azure Bootcamp Review

This past Saturday about 40 nephelophiles (cloud enthusiasts) gathered at the BlueMetal office in Watertown, joining technologists across 50+ countries and 138 locations for the 2014 Global Windows Azure Bootcamp (#GWAB).

WP_20140329_006

Attendees were treated to a full day content and hands-on labs covering topics such as virtual machines, cloud services, Windows Azure Websites, DevOps, and mobile services.  One of the labs even contributed to a global effort on diabetes research! Through the support of multiple global sponsors, a number of lucky attendees won licenses to software and services from Cerebrata, JetBrains, myGet, and numerous others.

For the content presented at the Watertown venue, please consult the following link:

Window Azure Overview, by Jim O’Neil

Windows Azure Virtual Machines, by Udaiappa Ramachandran

Windows Azure Cloud Services, by Jim O’Neil

DevOps, by Chris Condo

Mobile Services, by Dmitri Artamanov

Windows Azure Web Sites (slide 43++), by Udaiappa Ramachandran

Labs (and more) can be found in the Windows Azure Training Kit.

Global Windows Azure Bootcamp (x2)

On Saturday, March 29th, cloud enthusiasts in nearly 150 locations within more than 50 countries will gather for Global Windows Azure Bootcamp, an all-day primer on Windows Azure – and the Boston area will host two such opportunities!

Global Windows Azure Bootcamp

Both Microsoft’s New England Research and Development Center (NERD) in Cambridge and BlueMetal Architects in Watertown will be hosting this all day, FREE, lecture/hands-on event at their respective facilities. We’re coordinating content and speakers across the two venues, so simply register on Meetup for the location – Cambridge or Watertown – more convenient to you (space permitting).

We are still finalizing the agenda, but you can expect to hear about – and provision yourself  – Virtual Machines, Cloud Services, Storage, Web Sites, Mobile Services, and more, as well as contribute to a massive compute farm focused on diabetes research.

To make the most of the event, you’ll want to bring a Windows laptop with the following (trust me, it’s easier to have this set up beforehand than tax the bandwidth at the location):

Light breakfast, lunch, and beverages will be available.

New England GiveCamp 2014

Pay no attention to the mounds of snow; spring is on its way and with it comes the 5th Annual New England GiveCamp. Once again – from April 4th through the 6th - Microsoft’s New England Research and Development (NERD) Center will play host to 120 or so software developers, designers, project managers, and non-profit representatives as they convene for a 48-hour “hackathon” focused on projects to help the charitable organizations better meet their goals.

GiveCamp has been the success it is because of three main ingredients, giving each of us a chance to contribute:

Non-profit organizations. Each year around two dozen non-profit organizations are on site with project needs including website creation or redesign, mobile application development, logo and graphic asset creation, database design, and more. This year more than 30  applicants are already in the midst of the vetting process, so at this point any new submissions will be put on a waiting list.

Sponsors. The majority of the expenses for this event are the cost of food (six meals and snacks) and beverages (yes, lots of caffeine) to keep the attendees fueled throughout the event. We’re always looking for additional cash donations or donations-in-kind to defray these costs and enable more organizations and volunteers to participate. Please visit the sponsors page at the GiveCamp website for details on how you or your company can help.

Volunteers. Got the weekend of April 4-6th free and want to lend your talents to some amazing local organizations? Sign up as a volunteer, and you’ll be placed on a team of folks focused on a project for a participating charity. Depending on your background and project needs you might be able to assist on multiple projects! All we ask is that you bring your enthusiasm, willingness to learn (potentially) new things, and the ability to commit to participating for the duration of the event. You can even camp out at the facility – though that’s not a requirement!

It’s a fantastic event; you’ll make new friends and be a part of making a difference in the New England community at large. Be sure to follow the event on Twitter and Facebook, and if you have any questions on the event itself, reach out to the coordinators at negivecamp@hotmail.com.

Lessons from a Night at the Randori

Although my claim to being a software engineer spans two millennia, the recent job change has made me keenly aware that my previous support and evangelism roles, while quite technical in focus, had me writing programs versus really developing software. In terms of processes and development lifecycles, my practical skills hearken back to the days of Ada and DOD-STD-2167A, so I’m making it a priority to dive in to modern techniques like Scrum, TDD, DDD, AOP, etc.

chaos taking

To that end, I attended the Boston Software Craftsmanship meetup this past Monday, where the featured activity was a Randori session. The setup is simple: provide a small programming task (conversion from Roman to Arabic numerals, in this case) and apply a test-driven design approach to solving that problem. The twist here is that you work in pairs (one person coding, one person typing) for 5 minutes before shuffling the typist off and bringing a new coder into the mix. Within that five-minute span the goal is to make progress on the task and leave the system so that test cases are green when the given shift is over.

Kudos to the organizers for keeping the programming environment and details out of the way – JavaScript + Jasmine + Sublime – really provided a minimal logistical barrier to entry. Even so, and as much as I’m used to speaking to audiences, I have to say live coding always makes me feel ‘exposed.’ I jumped in anyway toward the middle of the exercise, and thought I’d reflect on the experience (unfortunately, I had to leave a bit early, so wasn’t able to stay for the post-exercise discussion).

  1. It’s hard to let go.  When the kata was announced, I spent a few moments mentally formulating an approach to the problem; that approach though didn’t match the flow of the first few participants, and when I got to the hot seat, it was harder than I expected to adapt.
  2. It’s ok to fake it (but that doesn’t mean I like it!).  My “do it right the first time” mentality is being challenged by the mantra that passing the test by any means is the goal. For instance, assuming the domain of Roman numerals with values from 1 to 100, the following (pseudo) code would pass the test for the input “I”:
    // romanNumeral is a string input
    int value = getArabicValue(romanNumeral);
     
    function getArabicValue(s)
    {
         if (s.length === 1)
              switch (s[0])  {
                   case "C": return 100;
                   case "L": return 50;
                   case "X": return 10;
                   case "V": return 5;
                   case default: return s.length;
              }
         return s.length;
    }

    I know that seems horribly contrived, but for about half of the exercise, the use of string length in just this context passed muster. Perhaps the contextual error (specifically in the default branch of the switch) would be caught in later testing rounds, but I would submit that it very well might not be. The test passes so all is good right?  That kind of leads me to my next confliction…

  3. It should be ok to think. The Wikipedia TDD entry mentions

    At this point [write some code], the only purpose of the written code is to pass the test; no further (and therefore untested) functionality should be predicted and ‘allowed for’ at any stage.

    but that seems just a tad draconian to me. Certainly you don’t want to go full bore and reduce TDD to a single test of the complete system, but there were times I felt constrained to ignore the obvious and go only where the test guided me. I’ll grant that such singular focus enforces a certain purity in the process, but the dead-ends and thrashing that could have been avoided by just a little bit of a look ahead still nag me. At one point the apocryphal story of monkeys on a typewriter banging out the works of Shakespeare came to mind – I could see we’d eventually get there, but somehow the journey seemed longer than necessary.

  4. Involve domain-savvy users. Our coding scenario (Roman numeral conversion) was pretty simple and well-understood; nevertheless, as the first round of tests went down a (natural) sequential path 1, 2, 3, 4, etc., it became clear to me that domain knowledge should play a part in the test case development. For instance, you need to know a little about the Roman numeral system to realize that 19 is a bit more interesting than 15. Do I even trust myself to create meaningful tests? Might I not project my biases or misunderstanding of the domain into my testing?
  5. Testing is free. Ok, well, not completely free, but it’s kind of cool to see your test suite grow without it seeming like another onerous task. A workflow that doesn’t get in your way is key here: if you have to move from your coding editor to some other system to create a test and run it, it will feel like a hurdle and you won’t do it. I suspect too that’s a main barrier to TDD adoption – not that the tools aren’t there, but that people need to experience the cycle to appreciate it. The legacy of test plans, test procedures, and other onerous (and often meaningless) project documentation probably plays a part as well in unfairly giving “testing” the baggage that it has.

Takin’ the Train

As I’ve been settling in to the new job and new location, I’m finding myself becoming much more of a consumer than a producer – application-wise that is. While I spent a lot of time at Microsoft building my own apps and helping others publish to the Windows marketplaces, I didn’t really have a ton of time to enjoy the devices and the apps out there. With my new job and a commute that has me taking the train and bus, I have to say it’s been kind of fun using Windows 8 and leveraging some of the content-focused apps out there.

MBTA

What I’m carrying…

Not driving gives me the opportunity to stay up to date with blogs, podcasts, and videocasts, and I absolutely love the Dell Venue 8 Pro that I got myself for Christmas.  It has a great form factor, slips easily into a bag while I have the earphones plugged in, and when I occasionally want to, say, review some code I’m working on, I don’t have that “oh yeah, I can’t do that on (Surface) RT moment.”

What I’m reading…

An inbox that went from 100+ work-related emails a day to (for now) single digits has given me a chance to reconnect with the blogosphere. My friend and colleague, Dave Davis, turned me on to Nextgen Reader, which is essentially a client app for Feedly. You’ll need to set up a Feedly account and manage your subscriptions there, but then you can let the app take over. Nextgen Reader makes great use of the share contract too, so you can quickly tweet an article or send it to the Reading List app on your device for later review.  (Feel free to download my OPML file to get started).

What I’m watching/listening to…

I have to admit, I was a bit surprised and disappointed that the built-in XBox music app doesn’t support podcasts, but there are several other options on the Windows Store.  Many are free, but I settled on podscout, which, at $4.99, is decidedly not free! It does have a trial option – a sine qua non for any priced application in the marketplace – but I was drawn to it by three primary factors

  • preponderance of positive reviews,
  • screenshots that evoked some thought to the user experience beyond the built-in Visual Studio app templates,
  • clear indication via the description that there’s been recent work (8.1) on the app and feedback is encouraged via Twitter and e-mail.

I’m still honing my playlist, but you can check out what I’m listening to now, and feel free to let me know if there are additional developer-focused series I’m missing.

What I’m learning…

The project I”m currently on is a fairly mature WPF/Silverlight app with about 40 projects, so suddenly TFS, custom content controls, and new features of Visual Studio 2013 (like Code Lens) are front and center. I’m in the midst of Pluralsight’s Introduction to WPF Custom Controls course now, but since my subscription is streaming only, and the WiFi on MBTA is spotty at best, I’m using the commute time to watch the lectures of the Coursera class on Programming Mobile Applications for Android Handheld Systems.

Where’s Jim?

I wanted to thank folks for the kind e-mails and comments to my last post and give you a quick update on where I landed. I’m a Senior Software Engineer at BlueMetal Architects in Watertown MA, working on the the UX/Mobility team. I just finished week one, and it’s been great to connect again with former co-workers at Microsoft and get involved with real projects leveraging the technologies I’ve been mostly just talking about for the past six years.

BlueMetal Architects

As I’m getting my feet wet in the new role and (re)learning what it is to be a consultant working on external projects, I expect my blog postings and community engagement to lag a bit. I am though looking forward to leveraging what I’m working on to craft deeper tech postings and presentations at user groups and code camps. For those of you looking to connect with me directly, I’ve updated my contact page and look forward to keeping in touch.