Posts

GRUNT- The JavaScript Task Runner

Image
Grunt helps developers automate the task of javascript deployment. In our development cycle, every javascript deployment used to be 1. Code 2. Minify 3. Upload We were missing out two important phases which ensures code quality and reliability 1. Lint 2. Testing As our code became larger and larger, as anyother dev we also considered a refactor. The refactor resulted in splitting our large code base to manageable modules. Now, Deployment has to go through 1. Unit test independent modules 2. Merge Modules to a shippable target 3. Lint 4. Minify 5. Deploy Ooops... Nice but how? It's true that developers love things automated, and so we were. We arrived at a one stop solution GRUNT. This blog post is a Let Them Know Types. As, I felt that the instructions on grunt setup is kind of scattered :) To hav a better introduction with the hero, you should meet him at his place Grunt has two parts: 1. Using it 2. Customizing it How to start using it? Installation: G...

A Run for World without Leprosy - Run to remember

Image
And My First 10K Marathon [ TCS World 10K ] - A run for world without leprosy Was yet another usual day to work post my work out session @ Music&Metals . Reached my workstation and booted my ubuntu to start with the proceedings of the day. The moment I logged in to my user, my mouse pointer rushed towards the Chrome Icon in unity launcher. Guess what? It's just to see if there are any updates in my FB home. And there it was, nice red color icon over the world of FB. It was a post from Dr. Manimozhi Natarajan, in our Gym's [Music & Metals] closed group. Urged to read what it is about, and it was an invite to all fiddles in M&M to participate in a 10K Marathon for a cause which was about to happen two week from then. And there you go.. I was realizing my wish to go for a long distance run coming true. And a pause [Ooops]. In my previous trip to our Mumbai Dev Center, I got to know that 4 of our team mates are participating in a 4*5Km relay and they are practicing ...

Headless Chrome/Firefox Selenium Java in Amazon EC2

Setting up chrome/firefox in linux based x86_64 EC2 instance In this post we'll see how to setup chrome/firefox in EC2 instance. Further we'll discuss the way to setup chromedriver with selenium [java] in EC2 instance aswell. Why is that difficult? Linux based EC2 instances lack gtk+ , which is a must to launch any GUI enabled applications. How to solve? Compile gtk+ from source. This gist by joekiller has the complete dependency tree resolved for installing gtk+ for x86_64 machines. Line 77 Basically installs firefox from its tarball. You can comment it out incase if you don't wish to. Incase Line 42 fails. Do a wget for direct tarball from here , instead the complex recursive wget. For Ex: wget http://releases.mozilla.org/pub/mozilla.org/firefox/releases/latest/linux-x86_64/en-US/firefox-18.0.2.tar.bz2 So, All done? Nopes, Now we can't run either of the browsers as we lack X11 server which does graphics operations & screen outputing. As our envir...

Backbone JS + Chrome App [manifest version 2]

Hello World!!, YAJSBP :) QUOTE: Getting to know a library or a technology is pretty easy, but things get reversed when you want to apply the same which you felt you knew :) In this blog post I'll take you through some integration challenges I faced while developing a chrome app along with backbonejs So, I got to know about this guy Backbone.js an year before at jsFoo 2011. The moment I noticed him, I visited his birthplace and got an overview of him. Then I felt that I could claim I know backbone.js. Later realised it was too early to say that. An year after I decided to try this guy and started developing a chrome app[ Features Recorder ]. Then I faced the following small challenges[on integerating backbone with chrome app] which I solved my own way :P Problem: 1 Chrome App manifest version 2 doesn't allow eval or new Function Error: Uncaught Error: Code generation from strings disallowed for this context Take a look at Chrome app Content Security Policy Why ...

Asynchronous Javascript & jQuery Deferred Why?

Using jQuery Deferred In this post I'll try to cover an overview of promises and deferred. Further how to use them in nodejs. Define Deferred? Google Define: Put off (an action or event) to a later time; postpone Deferred in javascript? Javsacript being an event driven scripting [and a developing programming] language, there is obvious need for developers to defer things awaiting events. For ex: window.addEventListner("load", function () { console.log("Defer my execution till window load"); }, false); $.ajax({ url: 'data.html', success: function () { console.log("Defer my execution till ajax load is successful") }, error: function () { console.log("Defer my execution till ajax load fails") } }); So? This is nothing unusual!!! Ya, obviously it is nothing unusual and obviously a beginner level fact. Deferred: As a programming paradigm, is a design pattern which solves the problem of code nea...

Cassandra Composite Types - A Overview [with CQL & Cassandra-Cli examples]

Just felt like sharing what is composite type in cassandra and How can we make use of it After so many discussions in Stackoverflow and PHPCassa forums, I hope I have got a clear picture over the topic What are composite types? Composite types are like structures in C or C++ For ex: The way we define a linked list [basic] struct LLNode { int data; char name[20]; struct LLNode *next; } Which means every member of this struct will have data of type int, name of type char array and a next pointer of type LLnode The struct is a composite of basic datatypes[not exactly in this case] Also you can't initialize value to any of these attributes when you define a struct The same way Cassandra Composite Type is a dataType derived from existing basic supported dataTypes . Why do we need this? Cassandra initially had and still has the concept of super columns. The basic use of them is maintaining an inverted index . Consider a data model in cassandra ColumnFamily: UserMast...

Varnish Cache Purge, Ban and Ban Lurker

Lets walk through some basics of varnish before understanding purge and ban Varnish? From DOC : Varnish is a web application accelarator. Varnish can cache & serve all your static properties [css, js, images, parsed PHP pages, HTML] Reduces load on the webservers even on high traffic. Can act as a load balancer even [provided with proper director configurations]. Varnish uses VCL [Varnish Configuration Language] to override the defaults and tweak varnish based on usecase Varnish caches contents [cache object] against a key. By Default the key is Hash(HostName and Request URL) We can override the defaults by editing vcl_hash sub-routine in vcl file Do Cache objects live long in varnish? In varnish every cache object is stored against a ttl value. Every object will be auto-magically removed out of cache once they reach the expiry. TTL can be configured globally as default while starting varnishd with -t option . Also can be overridden in VCL using bresp.ttl va...