Handling polymorphism with Jackson

Sometime you need to serialize a hierarchical model to JSON. Jackson offers different ways to handle the problem. Here I will expose two of them. tl;dr; First solution: Annotate the super class with @JsonTypeInfo(use=Id.CLASS). Pros: works with any subtype. Cons: breaks with classes or package renaming. Second solution: Annotate the super class with: @JsonTypeInfo(use=Id.NAME) @JsonSubTypes({ @JsonSubTypes.Type(value=Cat.class, name="Cat"), @JsonSubTypes.Type(value=Dog.class, name="Dog") }) adding a JsonSubTypes.Type for each sub-class. Pros: no problems with renaming if custom names are provided....

November 20, 2016 · 4 min
Run JavaScript on your ESP8266 using Espruino firmware.

Run JavaScript on your ESP8266 using Espruino firmware

In this article I will show how flash your ESP8266 with Espruino and run JavaScript on the board.

June 26, 2016 · 5 min
Build the Smart.js framework.

Build the Smart.js framework

In this article I will show how to build the framework under the Ubuntu’s like OS and flash your ESP8266-01 device with the latest Smart.js framework version.

October 7, 2015 · 4 min
Run JavaScript in your ESP8266 device.

Run JavaScript in your ESP8266 device

In this article I will show how to read the temperature and the humidity from a DHT11 sensor connected to the ESP8266 device and how to send those values to a public site using an HTTP GET request, all using JavaScript code.

October 7, 2015 · 6 min

How to translate a search query into a JavaScript filtering function

In a project I had to translate a search query into a filtering function to apply to a stream of JavaScript objects. The query language was very simple, boolean expressions of property constraints, for example “name:john AND age:52” where the search should return all the objects with property “name” equals to “john” and property “age” equals to 52. The first step was to parse the search query with a parser. You can write a parser by hand or your can use a parser generator like PEG....

July 29, 2015 · 3 min
Arduino digital clock.

Arduino digital clock

As free time project I’ve built a digital clock using Arduino Duemilanove, the DS1307 Real Time Clock, the MCP23017 port expander and a bunch of blue leds.

July 2, 2015 · 6 min
Generate a map-like navigable family tree.

Generate a map-like navigable family tree

In this post I will show you how to generate a navigable map of your family tree starting from an image of your tree.

March 22, 2015 · 5 min
Raspberry Pi talks to Arduino using Dart.

Raspberry Pi talks to Arduino using Dart

This post will show you how a Dart program running in a Raspberry Pi board can communicate to an Arduino board.

November 23, 2014 · 2 min

How to build the Dart SDK for the Raspberry Pi

For a DIY project I’m working on I need to run a Dart project on my Raspberry Pi board, precisely in his Raspbian OS. The Dart team has done a good job publishing a wiki page with all the information to build the SDK. Here I’m summarizing the necessary steps in a handy list, or, if you prefer, at the end of the post you can find a zip file with the SDK already built....

November 21, 2014 · 3 min

Plugin mechanism for GWT application

Cotrix, the RIA I’m working on, is packaged differently depending on the target environment. For each environment we want some features enabled or not, both client and server side. From the client POV I’ve to enable or disable some GWT components, I will call those components plugins. In our case each plugin is bounded in a separate Java library. In GWT to enable a component you need to: include it in the module file:...

March 21, 2014 · 4 min