Posts

Time range queries with Cassandra and Akka Streams

Image
Apache Cassandra and Akka Streams, a match made in heaven. In this blogpost I hope to explain how the two seamlessly work together by using a real-life example. For a client we'd to use Cassandra as our data store to serve REST requests, one special requirement was that it had to support sorted time range queries over the entire data set or for a specific data producer (in our case, an IoT device recording temperature and atmospheric pressure). Cassandra data modelling is different from Relational modelling, in the former we design our tables around the queries we want to perform disregarding any data normalisation (duplication is in fact encouraged) whereas in the latter we normalise each table, avoid duplication like the plague, and let the DMBS handle how to efficiently query a table. From this fact we must also consider: 1 Queries should target few partitions, only one if possible. Data should be evenly spread across partitions. Now onto the problem presented, let...

Setting HypriotOS on a Raspberry PI 4 PicoCluster

A few weeks ago I ordered a PicoCluster for an upcoming learning project and blogpost series, to my surprise the entire setup wasn't straightforward. The bundled application set couldn't initially see each other node and neither connect to my Wi-Fi network, and after fiddling with the config I gave up on the default image. Having WiFi and Ethernet is important in the setup because I want download and run docker images, and each node can see each other through LAN. Some weeks before buying the cluster I took an Akka Training at Lunatech  where we saw how a similar cluster was used to show Akka Cluster, and having heard of HypriotOS and how easily it could run docker containers I decided to give a shot. Flashing The first step involves flashing the SD cards with Hypriot image, this guys provide a flash tool with convenient configuration parameters. For this step I'm using release 2.4.0, I'd to flash a card several times until I got the WLAN config correctly, mayb...

Configuring applications with Docker

But it worked on my machine! I still remember when I was a young developer and someone introduced me to the environments where an application could be deployed: dev, test, acceptance, production. We as developers need to deal a lot with context, we deal with it on context switches, on variable scoping, and this is yet another context. We need to code our application so it can modify its parameters or behavior based on the place it’s running,  this type of input has roughly three forms: arguments, files and environment variables. 1 For which Docker provides several alternatives to accommodate for these different inputs. With Docker we can configure applications in two moments: during build time , or at runtime . The former includes the configuration right into the image, the latter is given when the container is instantiated. The code for this blogpost can be found here . Configuring at build time Arguments We can provide build arguments with the ARG statement inside the ...

Responsive tinyMCE

On a project that I'm working we're using an old version of tinyMCE ( https://www.tinymce.com/ ), specifically we are using version 3.4.5 (released in 2011). Since last year we've been focusing on making the site responsive, and we've a bunch of legacy stuff that we could improve and use newer version of the libraries that comes bundled with the system. Making this rich-text editor responsive is a little tricky since its header or toolbar is defined as a table, and its buttons as table cells. After tweaking the details I came with the following solution: .mceLayout, .mceToolbar { display: block; height: initial !important; } .mceLayout > tbody, .mceLayout > tbody > tr, .mceToolbar > tbody, .mceToolbar > tbody > tr { display: block; } .mceLayout tr.mceFirst td.mceToolbar { background: #F6F6F6; height: initial !important; overflow: hidden; width: 100% } tr.mceIframeRow td { display: block; float: left; height: 28px; } I'm ...

Books I have read this year (2014)

Image
Well after thinking a little about it I decided to do a post about the books I read this year (2014), I didn't committed to any particular number of books but in the previous year I resumed my reading hobby, and this year started buying books like crazy. So I wanted to write a little about each book: Atlas Shrugged (Ayn Rand) To be fair, I started reading this book in 2013 but finished it this year (it's a big book!) and also wanted to write about it. This is a awesome book, full of details and ideas; Ayn Rand magnum opus is a must read. In it she develops her Objectivism philosophy, each character embodying an archetype around it. It's a lengthy book, even some parts are very boring (for example, the John Galt's monologue is too much, could be shorten very much), but for the most chapters the writing is great and it gets you thinking about some of your values, principles and thoughts about life it self and life in society. I liked that the book is written i...

Processing Augmented Reality Tutorial - Part 1

Image
Introduction For a presentation with a Studio that I'm currently working we decided to do feature an augmented reality show. Something simple for people that had little or none experience with AR. So after doing a little research about what technologies supported AR I decided to use Processing, which I'd never used, but after learning that was a Java environment I supposed that would fit in my confort zone. Searching I found the following tutorial:  Augmented reality tutorial with #Processing To tell you the truth I struggled a lot with the libraries and the code from that tutorial, I don't understand why there is no indentation (seems like the work of a junior programmer, not trying to offende the author), the interaction with the libraries is buggy, and some of the code is incomplete. But none the less serves as generally good introduction, so let's start from there... First, I won't be using Processing in the environment provided, but using direct...

Array/Item problem on JAX-WS - Axis 1.x interation

Image
A few days ago I encountered a little problem with a Webservice that I was asked to interact with. The client in question was on other country, and the permissions on the VPN were not granted already. My normal workflow dealing with WS is first asking for the WSDL for mocking and building the artifacts. So I launched SoapUI and started working on the integration. All worked just well with the mocks, and for a little moment I thought that all will be joy and bliss. The artifacts the JAX Import that I used gave me the following model: Having worked with JAX-WS as a client and server, and only as client with the server being Axis2 for example, I thought that because of the signature of the Webservice Interface I was dealing with a JAX server on the other end. But when the real connection was made (without Mocks) the attribute on CustomerSubscriptionInfo was comming  null  from the server . I tried a few more times with different input data but was the same. The person...