Event-Driven Architectures with AWS DynamoDB Streams

November 2nd, 2018 | Greg Straw | Development,Engineering

We’ve been working with AWS DynamoDB Streams on our customer projects, and we’ve found it to be a really powerful solution for creating event-driven pipelines. DynamoDB is one of the more recent features added to DynamoDB and can help address some of the common challenges when migrating from a relational schema to DynamoDB.

What are DynamoDB Streams?

If you don’t know the basics around DynamoDB, there are many good articles, blogs, and of course the AWS Documentation. I’d like to focus on some of the use cases, and the benefits of using one of its more recent features: DynamoDB Streams.

DynamoDB Streams enable you to trigger downstream actions based on the activity occurring in a DynamoDB table. Every time an item is added, changed, or removed, a stream event is triggered by capturing that change. This feature is very powerful when integrated with other AWS components.

When streams are enabled for a given table, AWS stands up a new service endpoint for making API requests specific to stream events. You can select from four options for the stream events:

  1. KEYS_ONLY – the key attributes of the changed item
  2. NEW_IMAGE – what the item changed-to
  3. OLD_IMAGE – what the item changed from
  4. NEW_AND_OLD_IMAGES

Read more

Protocol Buffers in Swift: A Use Study in Brushing Your Teeth

December 29th, 2017 | Sean Hamstra | Development

When dealing with the Internet of Things (IoT), developers are faced with many technical hurdles connecting multiple devices together over a computer network. Each of these devices is likely to speak its own language and require specific code to translate data from the other devices. More device, more languages, more work, more money.

For example, let’s say you just bought a connected toothbrush. You get it all set up and decide to take it for a spin. According to the instructions, all you as the user needs to know is how to brush your teeth. There’s obviously a lot more happening within the device, however. As you brush, sensors are working to track things like battery power, usage time, and perhaps even motion with a gyroscope and accelerometer. Embedded code in the toothbrush, written in C, is used to track all of this data and upload it to the cloud. Then a cloud app, perhaps written in Ruby, accepts and stores this data while running some analysis on the motion and timing of your usage.

You set your toothbrush down and whip open your Android phone and fire up the app, eager to see your progress and get your brushing rating. Once again, there’s much more happening than meets the eye. Triggered by you opening the app, the Java code in the Android app fetches the data from the cloud and displays it on a nice graph for you….

Read more

Internet of Things

Hack the Train: SpinDance Shares Holiday Spirit with Interactive Window

December 19th, 2017 | Tom Miller | Development,IoT Notes,SpinDance

Storefront displays have come a long way since the Miracle on 34th Street. At SpinDance’s Holland, MI, headquarters, we think of it more as the Technology on River Avenue, as we’ve recently installed an interactive display to allow passersby of all ages the opportunity to touch the future of IoT development.

When you visit, you’ll notice that the first step in our display is an AWS IoT button attached to the company’s first floor office window, which allows you to control the lights on a Christmas tree. We used the popular NeoPixel platform to create the lights, and there are number of festive patterns you can cycle the lights through. The buttons runs some code in Amazon’s cloud, which then runs the commands on the tree.

After you’re done playing with the Christmas tree, you can scan the QR code on the window to access a web app which gives users the ability to control the speed and sound of a model train in the winter village. The train’s sound is amplified by a surface transducer that transforms the entire window into a large speaker.

As an IoT (Internet of Things) company, SpinDance is committed to using the same technology we implement for our customers in our own day-to-day lives. One way we do this is through our hackathons,…

Read more

Smart Consumption for Smart Products: Understanding MQTT

December 12th, 2017 | Sean Hamstra | Development

In this day and age, we consume just about everything digitally. The explosion of smart products that are connected to the internet is just hitting its stride. We are looking everywhere to see where we can add new conveniences and advancements to our daily lives through smart devices. With all of these smart products filling our homes, offices, and everyday lives, the last thing we want to worry about is this little, convenient device eating up all of our bandwidth.

We think family meetings about data overages should be a thing of the past, too.

Smart Product Architecture and HTTP

As developers, we should be good stewards of the network, building products that are conservative and use the least amount of bandwidth. At SpinDance, we always suggest ensuring the development of efficient communication methods and the architecture of compact, flexible data models.

HTTP is the most popular and widely used protocol for the digital world, and it’s document-centric model created for client-server computing is a great solution for software and the World Wide Web, but what if there was a faster protocol with less overhead and battery usage for these mobile smart products?

Enter MQTT.

What is MQTT?

MQTT is a connectivity protocol designed for Internet of Things (IoT) devices. It uses an extremely lightweight publish/subscribe (pub/sub) messaging transport with a data-centric model that is perfect for saving battery life….

Read more

Patching the Internet of Things: IoT Software Update Workshop 2016

July 29th, 2016 | Bob Ensink | Development,Systems

“There’s a huge problem with the Internet of Things and we need to do something about it.” That was the invitation that brought participants to the Internet of Things Software Update Workshop (IoTSU) held at Trinity College, Dublin on June 13 and 14.

The Workshop was organized by the Internet Architecture Board (IAB), a standing committee of the Internet Engineering Task Force (IETF).  Based on our deep involvement in the IoT space spanning multiple industries, SpinDance was invited to submit a position paper to contribute to the workshop.  Our paper was one of several used to set the agenda for the workshop.  I was fortunate to attend as one of the SpinDance representatives along with Eric Smith, SpinDance’s VP of Engineering, and authored a blog post about the workshop for IETF.org.  You can read the full blog post here.

Read more

Reactive REST Services with Akka-HTTP

July 25th, 2016 | Greg Straw | Development

Overview

If you’ve heard of Reactive Application Development, or Reactive Programming, then you’ve likely heard of Akka. As described in our post: Introduction to Akka, it’s one of the most comprehensive tool sets available for developing highly concurrent, reactive applications. Akka comes from the authors of the Reactive Manifesto itself, and comes complete with a wide variety of capabilities. Akka’s actor based concurrency model simplifies the development of highly concurrent and parallel applications, and is one of the foundations of Akka itself. The Akka-HTTP modules provide tools for both providing and consuming HTTP services. This article shows how Akka-HTTP may be used to expose REST services for your reactive application.

Define the Route

For this example, we start with a very simple REST API, initially consisting of a single resource “health” that responds with a 200 response when the service is alive. Akka-HTTP defines a Domain Specific Language (DSL) for describing a set of HTTP routes and the handler for each route. The DSL provides a set of directives that may be used to compose a route’s structure and specify the handling logic. The code below shows an example of an Akka-HTTP route definition in Scala. The route defines a single resource “health”, and a single GET operation on that resource that elicits a response….

Read more

Connecting Electric Imp and SmartThings

June 8th, 2016 | SpinDance | Development

There are a myriad of Internet of Things (IoT) cloud and hardware providers out there, all competing to be the platform upon which you can build your next great gadget. Two of these providers are Electric Imp and SmartThings (now owned by Samsung). These IoT providers have two very different approaches to the world of IoT:

Electric Imp

  • Sells hardware targeted to developers($20)
  • Leverages the Squirrel programming language in an online development environment
  • Leverages Electric Imp hardware modules
  • Does not include tools to build a customer facing UI, but instead allows the developer to implement their own database and front end.
  • Has an offering to run an instance of their cloud on your equipment, protecting you in case they are bought out/go out of business etc.

SmartThings

  • Sells hardware targeted to consumers (the Arduino Shield retails for $35)
  • Leverages the Groovy programming language in an online development environment
  • Is set up to talk to any hardware, provided the customer has the SmartThings hub ($100)
  • Has a cloud solution that is largely geared towards developers, and has tools for designing a mobile UI that will be displayed in their mobile app
  • Privatized platform instances not available

Both systems have strengths and weaknesses,…

Read more

Introduction to Akka

June 7th, 2016 | Brian Ensink | Development

SpinDance has started using Akka to build microservices that add new features to existing cloud applications. Akka is a toolkit for building reactive, message driven distributed applications using the actor model. Our experience with Akka has been very positive so far and we plan to continue using it not just to add features to existing systems but also to build entire distributed, scalable and fault tolerant cloud applications. This is our first blog post about Akka and a brief overview of the topic. We will have more to say about Akka in the coming weeks.

Actor Model

Akka’s foundation is the actor model. An actor is a container for state and behavior. You can think of an actor as a small computing engine. Actors are fairly independent from each other and can only communicate by sending messages to other actors. An actor has a queue, or mailbox, of incoming messages which it will process in order.

An actor does not have its own dedicated thread but instead many actors are executed on a thread pool. Actors may be executed concurrently but an individual actor is only processing one message at a time. The actor views the world as a single thread which eliminates the need for expensive thread safety code within the actor. Actors are also executed in parallel in contrast to other event driven systems….

Read more

Boot Selectors and Loaders for ARM Processors

June 2nd, 2016 | SpinDance | Development

Boot loaders and selectors have long been a part of embedded applications. At their core they are designed to be run for a short period of time before the main application takes over. The responsibility of the boot application is to perform all necessary functionality before the main application is started. This could be loading the main application in preparation for its execution or selecting which application to run. While they usually do not get much attention at design time, it is extremely important to ensure that they are bug free because they are not designed to be updated. If you have a bad boot application you can make it impossible to upgrade your devices, or even worse, make bricks out of them.

Loader vs. Selector – What’s the Difference?

There are two types of boot applications that we will look at here. They differ mainly based on how many versions of the main application can be stored on the device.

If the amount of memory in your design allows for two copies of the application, then the boot application can be simplified by implementing the firmware update process in the application itself. In this approach, one copy of the application can erase the other copy and then download a new version into the empty application slot. The boot application then is just a boot selector that is responsible for checking the application slots to see if an application is present and valid,…

Read more

A Better Way to Search Rake Tasks

February 18th, 2016 | Conor Livingston | Development

Rake is an important part of the Ruby ecosystem. It clocks in at just over 93 million downloads on RubyGems, making it the number one most downloaded gem at the time of writing. Moreover, the Ruby community has worked together to build it—over 100 people have contributed to the project. When using Rake in a project, it is common to list rake tasks. In my experience, the typical way to do this is to use rake -T. This is the abbreviated version of the command rake --tasks. However, this is not always the right tool for the job.

Listing Tasks

Some rake tasks have long descriptions, and rake -T truncates task descriptions based on the width of the terminal window. This gives the output a clean look by avoiding line wrapping. However, if a project has tasks with long descriptions, a task’s full description is not visible using rake -T. There is a way around this. The rake -D command lists rake tasks with their full description. This is the abbreviated version of the command rake --describe. The output of this command is a formatted list of available rake tasks with their full descriptions.

Searching Tasks

At SpinDance, our Rails projects often have many custom rake tasks in addition to the standard rake tasks that come baked-in with Rails. As a part of my work, I frequently need to run rake tasks….

Read more