Summer of Sockets Part 5: Node, Nanomsg and Websockets

2016 Sep22
Z

eroMQ has its fair share of quirks and oddities. It manages everything in a global state, requires things be manually grouped into `Contexts`, allocates a thread per context (making it not thread-save) , transports are baked into the library, and so on. It can be a bit clunky to work with at times. As a result, one of the original developers on the ZMQ project, [Martin Sustrik](http://250bpm.com/), started a new project that evolved into a complete re-write / re-realization of the ZMQ project, called [nanomsg](http://nanomsg.org/).

Nanomsg aims to resolve many of the underlying short comings of the zeromq library, but remain compliant with the ZMTP spec. It provides many of the messaging patterns ( which are

Read More

Node Style Woes - Domains and Promises

2016 Sep12
D

omains have been the red-headed step child of error handling in Node.js It is a library that has been deprecated since `v0.12` and has been awaiting a suitable replacement ever since ( we are at `v6.5` at the time of writing ). Until one has been implemented by the Node Core team, it is still de-facto way to deal with error propagation. As Node.js supports more and more ES6 features, I have been upgrading my open source projects where it seem appropriate. In my command line tool package, [seeli](https://github.com/esatterwhite/node-seeli), I was doing some updates and came across some exceptionally odd behavior around [ES6 Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/

Read More
filed under:  class es6 promises domain node

Custom Merge Tools Using GIT

2016 Sep09
G
IT has been my [SCM](https://en.wikipedia.org/wiki/Version_control) tool of choice for white a number of years. Along with it, [VIM](http://www.vim.org/) has always been my intermediate editor for doing commit messages, viewing diffs and resolving merge conflicts. Recently, I have made the switch to [Neovim](https://neovim.io/) as modern replacement for VIM. The nice thing with vim is that it came with a number of handy aliases, such as `vimdiff`. Which was unfortunate, because I really liked VIM's diff support for GIT. I wanted to replicate that, but that would require some manual work on my part to get the two to play nice. Luckily, it isn't really that hard Read More
filed under:  git SCM merge

Relational APIs with Node.js Tastypie and RethinkDB

2016 Aug12
O

ne of the more tricky and debated topics in API circles is how to handle relational data. How deep into your data tree should it go, how to accept it from the client and how much to return to the client. One could choose to treat each resource as a silo and force the client to individually create each object and piece all of the relations together. However, that is not a great user experience. It also leads to a very large number of requests and data transfer, which has been a blemish on the idea of a REST API for a while. The emergence of modern mobile devices which limited bandwidth and performance profiles need a more streamlined

Read More
filed under:  api tastypie hapi rethinkdb node

CoreOS: A Year In Review

2016 Jun29
M

icroservices are becoming the de-facto way of building out large applications. If you haven't worked on a project that has migrated monoliths to micro-services, you are most likely working on a microservice of some flavor or another. And as you might imagine, [Docker](https://docer.com) / containers are the preferred way of delivering these services. Managing all of these containers and services is no easy task and has lead to the rise of private PAaS projects, operating systems, and orchestration framewoks like [Dies](https://deis.com/), [Mesos](http://mesos.apache.org/), [Kubernetes](http://kubernetes.io/) - A new one is popping up every month.

Choosing a framework, or a stack is, in it of itself, no simple task. Personally,

Read More
filed under:  devops coreos linux node

Advanced Data Preparation With Tasypie Resources

2016 Jun16
O

ne of the major components of a tastypie resource is the data preparation cycle, or `hydration` cycle. The hydration cycle is the aspect of a resource that is responsible for massaging raw user input into data objects suitable for saving to a data source, and vice versa.

The hydration cycle also encompasses the serialization machinery of the resource which is responsible for converting data object into standard data formats ( JSON, xml, etc ) and vice versa.

Serializtion Cycle

Each Tastypie resource has a Serializer instance which it uses internally to convert data between well formatted string and javascript objects. This behavior is defined in the serialize and deserialize resource methods A serializer class defines how
data is converted to and

Read More
filed under:  tastypie REST node

Ubiquitous Fine Grained Access Control With Node.js and RethinkDB

2016 May30
A

cess control is apart of virtually every application. Certain users should be able to see / do **X**, but never be able to do **Y**. Usually these kind of requirements are expressed in overly simple terms, such as:

Admin users should see that button but regular users should not.

--Every Product Manager. Ever

With traditional RDBM Systems, the direct approach is to set up a Many-To-Many relation ship between Users and Roles Where roles are basically like tags. Subsequently code paths are created to check if a user has a role named admin . Which gets very ugly as these sorts of simple checks quickly have to cover increasingly complex logic for users with multiple roles and for roles that

Read More
filed under:  javascript rethinkdb acl node

Timeseries APIs on a dime with Node, Tastypie and MySQL

2016 Mar11
T

ime series data is quickly becoming all the rage in big data circles. The primary use case for large amounts of time series data tends to be visualization of collected metrics. This could be the temperature of our house, CPU usage of a remote server, the oil levels of your car, etc. In a nut shell, time series data is:

  • Data over a continuous time interval
  • Data contains successive measurements across that interval
  • Data uses equal spacing between every two consecutive measurements
  • Each time unit within the interval has at most one data point

It might look something like this

[
    {
        time: '2016-01-01 00:00:00', // minute 0
        value: 1
    },{
        time: '2016-01-01 00:01:00', // minute 1
        value: 2
    }
]

The

Read More

Docker for Dummies, I mean Developers

2016 Feb12
I

mages, Containers, and Tags! Oh My! **Docker** is the new hotness in the software world. Dockerize all of the things! For my tastes, [Docker](https://docs.docker.com) is really more of an operations tool for packaging and deploying self contained apps. However, it is making its way into the development circles. I have been finding that, sometimes, developers have a hard time understanding all of the pieces and how the fit together. They tend to copy and paste commands from docs and tutorials and pray to the gods that there app is running. Confusion between containers, and images, building and running and what tags are just has them typing themselves in circles. But fear **not**! There is a

Read More
filed under:  class oop docker

Override Nested Dependencies With NPM 3

2016 Jan25
N

pm is one of the primary reasons that the node community is so strong today. It makes it easy to write, package and publish code. This is primarily because of how it solves the package version and dependency crisis - Every package has a version and it's own set of dependencies which are organized into a directory tree. It sounds so simple, but it took over twenty years of developers pulling their hair out over package manager dependency soup, it is a wonder why it hadn't been done sooner. Even more so, NPM's [package manifest](https://docs.npmjs.com/files/package.json) is a simple json file that lets fine tune the specificity of the modules in your package

Read More
filed under:  modules npm packages node.js