Blog

Some of my recent posts and ramblings.

Setting up Nodejs micro services with Docker, Compose, Nginx and Rethinkdb

There is a lot of excitement around Docker and how incredibly easy it makes deployments. The Docker website is a little lacking in making this clear, besides there are a lot of other blogs which talk about how Docker is not for small apps and it's only for large scale applications which is not at all true. Docker is perfect when you are starting out, it enforces best practices and at the same time makes it so much easier to deploy your services.

I will walk through a simple example, which will provide a good foundation and also allow scaling out as you grow. Our example service has two services, an accounts service which needs to connect to a database(rethinkdb in this case, but you can use any other) and a service which connects to the pagerduty api. Rethinkdb has a very good web interface which we want to be able to access, but protect it via http basic authentication. Since there are multiple services, we will use nginx to proxy the requests through port 80.

You will need to install two things, Docker and Compose, http://docs.docker.com/compose/install/

Here is the setup, there are some comments in the files themselves and a more detailed explanation at the end.

So, there you go. If you haven't noticed, the only thing you have to install on your server is Docker and Compose, every thing else after that is taken care of by docker.  This is incredibly powerful. One limitation here is of course, all of these containers run on the same host. But with Machine and Swarm, this will be resolved very soon.


A simple jQuery plugin pattern

A simple jQuery plugin pattern. I had seen so many different patterns, Addy Osmani has a github repository full of them. This one works best for plugins which don't have a lot of instances created for them. Like it's not a good idea to use it for tooltips, etc (the basic jQuery plugin pattern is great for that) but its a great pattern for layout engines or slideshows which are usually called once or twice. I wrote this to avoid using so many 'this' and 'that' in the code.

The code layout is quite simple. An options and a state variable to keep track of the state and expose that and options, so they can be used for testing. We also expose out all the methods which we want to test or trigger manually in the return block. The 'create' method has all the initialization logic, all your event handlers go in the 'setupEventHandlers' method, the 'destroy' method implementation is optional, its useful to have it for testing which unbinds all the event handlers and clears timeouts.


A Presentation on JavaScript Testing Frameworks

This is a presentation I gave on JavaScript Unit and Integration Testing frameworks at Aol. It covers some, but not all the projects and progress in JavaScript testing. I skipped headless browsers and a few other stuff. I'll be doing a follow up presentation when I've got some test code up and running. I think QUnit and Jasmine are good choices. I like Jasmine's syntax a little more, but QUnit is used by jQuery. I'll probably try both, see which fits best for our needs and report back here.


Visualization of US State birds on a map

An interesting visualization of the US State birds. I got interested after seeing the Virginia Cardinal and the American Goldfinch at the regional park. It was surprising to see that a lot of states share the same state bird. The Cardinal seems to be the most popular followed by the Meadowlark and the Mockingbird.

See the interactive map here

A compilation of Douglas Crockford videos on youtube

I am ashamed to say that I discovered these videos by Doug Crockford so recently. It is a must watch for any web developer. Only a few of the videos are technical, but he explains the history and evolution of the web over the years, the development of javascript and the Microsoft-Netscape browser wars. Very interesting and Crockford makes it very entertaining. more

Wikipedia Skin for Canvas Wiki

I needed a ColdFusion app to document my applications and for the staff to share training material. Canvas, the ColdFusion Wiki (lol, love how it sounds) looked perfect for the job. It was simple and a powerful set of features. … more


Adding LDAP support to Lighthouse Pro

I manage 8 something applications for Office of Sponsored Programs at Mason and managing the bugs and feature requests was being done on e-mail. It was a hassle tracking all of them and setting targets. I needed some kind of … more


Microsoft Office Labs Future Vision

Microsoft has put together a video montage of its plans for the future, OUR future.

more