Blog Archives

Logstash 101 with Docker

We, at Shippable, are using Docker extensively and ALL of our services(frontend, backend, messaging, etc) are now successfully running inside containers. The latest addition to this is Logstash, which is an awesome tool to store, manage and make sense of tons of logs that are spewed out by a typical application. Its for the same use case we decided to use Logstash which basically collects the data from all our containers to make it easier for us to track down exceptions and some important events. I’ll start by defining a simple Logstash setup to do this and then conclude by wrapping everything into a neat Dockerfile which, in essence, will be all you need to then run Logstash successfully.

1. Download the logstash jar

2. Create the config file (name it ls.conf) to be used by Logstash which defines how(and from where) Logstash takes the input data and how(and where) it dumps the output. The simplest config is something like this (taken from logstash getting-started tutorial). There are two sections in the config file by the name “input” and “output”. In each section, we can … Read the rest

Tagged with: , ,
Posted in Blog, Technical, Tutorials

Node.js(Part-5)Login-Logout Flow

In this tutorial, I will be making a simple authentication flow using the technologies that we have already discussed. By the end  of this tutorial, you would have made a flow similar to the one indicated by the diagram below. This will also help you see how you can make your views more intelligent, readable and easy to build.

In the PREVIOUS POST we build the application views. To give some intelligence to those views
we are going to use some of the amazing features of JADE. I recommend you go through the
documentation of JADE to get an idea how decision making can be done in the views only.

This will be required, for example, while rendering a ‘Logout’ button. This button should only be shown if the user is logged in. So, instead of checking on each render call, we will put the logic to check and then render the appropriate view in the views(topbar.jade, in this case) only.

Lets go one step at a time here. We are assuming here that the user credentials are already present in the database. If you are referring to the project’s CODE, then just run the file named ‘insertUser’ … Read the rest

Tagged with: , , , , , ,
Posted in NodeBlox, Nodejs, Projects, Technical, Tutorials

Node.js(Part-3) Jade + Bootstrap

Moving on with the next part of this series of tutorial, today I will give an introduction about the Jade template engine for Nodejs and Bootstrap tookit provided by twitter. In the PREVIOUS post, I have described about the basic layout of a nodejs application based on express engine and we have till now run a very basic(and mostly useless) server. By the end of this tutorial, we would’ve made a nice looking container that will hold the various parts of our application.

What I have in mind is basically something like following diagram.

This is the most simplistic layout and we will work with it for some time before changing it.

Lets start with Jade first.

Jade :

According to Jade’s github page : Jade is a high performance template engine heavily influenced by Haml and implemented with JavaScript for node.

For an extensive list of jade features, visit the jade github page.

What jade does basically is clean up the HTML content of the page and hence improves the readability.  It provides a lot of functionalities on top of that like ‘partials’ and easily mix javascript and HTML code. We will see how that happens in the course … Read the rest

Tagged with: , , , , ,
Posted in NodeBlox, Nodejs, Projects, Technical, Tutorials

Node.js(Part-2) Application Layout

Continuing from the last post  , this tutorial will give a short description of Jade, using partials with Jade and Twitter Bootstrap.

If you have looked at the directory structure of the application that express has automatically created, you will notice a structure similar to something like this:

|—- app.js
|—- package.json
|—- public
|        |—- stylesheets
|                |—- style.css
|—- routes
|       |—- index.js
|—- views
|       |—- index.jade
|       |—- layout.jade
|—- node_modules/…

1. app.js :

the main configuration and boot file for the application. This will describe the global includes, the server configurations(deployment/test/production, etc), the available routes and any other data that is required by the application for initial bootstrap. The current app.js file only includes ‘express’ (huh).

var express = require('express');

After this we create a server by issuing the following statement

var app = module.exports = express.createServer();

This creates a new server object for us and also makes it available outside this file by exporting it.… Read the rest

Tagged with: , , ,
Posted in NodeBlox, Nodejs, Technical, Tutorials

Node.js(Part -1) : Getting started

As promised, I now begin the series of tutorials on the amazing new technology called Node.js which I have started working on some time back. Though I don’t promise that the methods I suggest are the best way to achieve the required goal, but I can guarantee that they work.

To start with, I assume that the reader at least knows what node.js is about. To quote the official node website Node.js – Node is an “Event-driven I/O server-side JavaScript environment based on V8.”

There… thats it. In its entirety, node has a minimalistic core which provides it the amazing flexibility to be extended. There are many amazing features in node that you can read about in its official documentation.

Before you proceed, I strongly recommend you read THIS tutorial and TRY all the examples given in it to get the idea of how node works with asynchronous callbacks. Though it would be better if you did the whole thing step by step yourself, below is the link to my github profile where you can download the completed example :P .

In this series, I will be emphasizing on building a full fledged web-application with following features:

1. Basic design … Read the rest

Tagged with: , , ,
Posted in NodeBlox, Nodejs, Technical, Tutorials

GWT Event Bus

This tutorial is inspired by the screen-cast HERE and is a more basic version than shown there.

Basics: GWT event-bus, as the name suggests is used for passing events between panels and other widgets so that they can communicate with each other. For this, a widget specifies what event it is going to fire and any widget or class that is interested in receiving that event registers themselves with that particular event.  The event bus is the entity that facilitates this. It can be thought of as a common stream that broadcasts events as they are fired and anyone who is attached to it receiving the events which they specified they were interested in at the time of registering themselves with the bus.

With this short introduction,I will proceed to give an example.

1. Create a project in Eclipse: File -> New -> Project -> Google -> Web Development Project. It is assumed that the user has GWT plugins installed for eclipse. This example was made using Gwt 2.2. Give the Project Name as ‘GwtEventBus’ and package name as ‘’. Leave the rest of the settings as they are and create the project.

2. Test this example: The project creates … Read the rest

Tagged with: , , ,
Posted in Technical, Tutorials

How NOT to partition your disks (and how to).

Well, I have been doing this the moment I decided to use linux which is quite a few years back, but I can that I have never found a perfect way to partition my disks in a way that will take care of all the future requirements of adding/deleting an os. I had Ubuntu and windows 7 before this weekend and I wanted fedora 14- 64bit as a third os and hence I was stuck to figure out how to manipulate my disks now. The following was the partition layout before adding fedora.

—————————————–500 Gig——————————————-

| [windows 7]  |  [Extendended partition {swap}{root}{home}] | [DATA]


where the [] defines primary partitions. I thought that if I wanted to add another linux partition, I would just shrink the last DATA partition and make that.

Now the problem with that is we can only make 4 primary partitions and ONE extended partition (More on partitions here and here). So that meant that I had to first free up some space, which was the easy part, and then somehow use that space as an extended partition to install fedora. By this time you must have envisioned the problem this led to. I … Read the rest

Tagged with: , ,
Posted in Technical, Tutorials

Adding a Radio Button Group to views

This one turned out to be a tough one and I had to spend quite a lot of time to figure it out and eventually got to know that there is no straight way to achieve this.

The problem was that I wanted to have a layout in which there was a text at the top, and five options for selecting the answer with radio buttons in front of each options to select one of those. Everything is straight till the time you get to the last part, i.e. selecting ONE of the options.

In android, you need to put the radio buttons in a radioGroup to enable single selection among that group. But its MANDATORY that the radiobuttons have the radio group as the immediate parent and hence if you are looking for any sort of a layout other than the one in which your radiobuttons are immediate children of a radiogroup, you have to go down the hard way.

The links this and this will give you a fairly nice idea as to how to approach this issue. In short, just create an onClickListener() and attach it to each of the buttons in your layout. In the onClick() … Read the rest

Tagged with: , ,
Posted in Technical, Tutorials

Extensive Android Examples

This is one blog that has really helped me to understand how many things work in android. The language is good, and the examples work more often than not. Just a heads up, do the basic android research before getting into this one. the rest

Tagged with: ,
Posted in Technical, Tutorials


test post for tutorial tab… Read the rest

Tagged with: ,
Posted in Tutorials