Sunday, August 31, 2014

Javascript Prototypal Inheritance

Everything in JavaScript is an object. There are no classes. So when we talk about inheritance, we are talking about objects directly inheriting from other objects. To achieve inheritance, broadly speaking, we need to store the reference of the parent in the child somewhere. When a property look-up happens in the child, the child is searched first, and if the property is not found there, we move to its parent and search. And so on, until we hit the end of the inheritance chain.

Wednesday, June 4, 2014

Live reload with grunt-express and grunt-contrib-watch

Making frequent changes to your static content and constantly refreshing your browser to see them take effect can get frustrating at times and sometimes the cache plays a party pooper. If your project uses grunt then can configure it to set up live reload of your changes to your browser. You can set up a watch task that constantly monitors your files for any changes and when it detects a change, it publishes it and refreshes your browser automagically. You can try this bare minimum Gruntfile.js configuration required to setup live reload using 'grunt-express' and 'grunt-contrib-watch'.

Tuesday, June 18, 2013

What are mappings in elasticsearch

Elasticsearch defaults most of the parameteres for you to reduce setup time, and you can change things as and when the need arises. So far we haven't bothered about the document schema and have been pushing in documents to be indexed as it is. We've let ES process the fields of our documents as per its own wish and yes it has done a really good job, thanks to its neat set of defaults, but ofcourse as things start getting complicated, one would crave for greater control.

Saturday, June 1, 2013

Querying elasticsearch

In the previous post on 'Indexing into elasticsearch', we tested our index using curl as a quick alternative. Lets try to replicate the four curl GET operations we used back there, using the java api of ES. We’ll use the same superheroes data we used in the previous post. Just a quick glance through it.

Wednesday, April 17, 2013

Indexing into elasticsearch

This is a 10 minute tutorial that demonstrates how to build a java app that indexes data into elasticsearch and the use of curl to query the index.

Making any changes to the default elasticsearch configuration will not be required, but if you would like to tweak a few options here & there, you might want to go through an earlier post on configuring elasticsearch.

Friday, April 5, 2013

Setting up elasticsearch

Built over apache lucene, elastic search delivers amazing power as a search and analytics engine. It allows for JSON based interactions over RESTful HTTP, which is really convenient. It has a robust distributed structure and becomes an ideal solution for the cloud. Make it open source and you are staring at a beast. (Wipe that drool off your face!)

All this power is bound to make souls wanting to experiment with it a little queasy. Specially if you have no background in data mining, or any experience with lucene, it can take longer than usual to get things rolling. I fall in that very category. Moreover, the Java api doc is scanty and leaves much to imagination.

If elasticsearch teases you too, then read on, maybe it'll make the road smoother for you.