Saturday 23 August 2014

The weekend of meetups

Attending meetups pertaining to the current developments in technology and the Open Source domain has become more of a habit for me over the years. Though this might have been the first time that I attended two meetups on the same weekend.

Jabong had hosted a MongoDB Meetup at their office in Gurgaon on Friday. It was a good event which witnessed decent participation. The keynote was given by Jabong employees who managed to port part of their website to a RaspberryPi via MongoDB. There were a couple of sessions about the applications & issues of MongoDB. 

While it was great to meet new people, it was equally delightful to see the old faces. One of them happened to be Anshul Sharma, a Jamia Millia Islamia alumnus. He informed me about the Google Summer of Code (GSOC) Meetup that was scheduled for the next day in his (former) college.

Tiring as my day was, I decided to attend the GSOC meetup anyways, and I most definitely don't regret the decision. Soon after reaching the venue in the morning, I was informed by one of the organizers that a slot is open for a speaker, in case I wanted to give a talk. Having already spoken at several of the smaller workshops for students of my own college, I jumped at the chance.

The event began with sessions by several GSOCers (current & former), who talked about their GSOC projects, their respective organizations and their contributions. 

The organizers went the extra mile to make the event as interactive as possible, and to keep the audience interested. For this purpose, they had several goodies from Google. So at the end of each talk, the speaker asked a couple of questions, and the audience members with the correct answers got those goodies.

Right after lunch, Anshul gave a hands-on about Git, which was greatly appreciated by those who were unaware of the awesomeness of version control systems. Next was my turn. I had decided to talk about IPython Notebook and using it, give a tutorial on Python basics. There were around 100 people in the auditorium at that point. 

I was equal parts nervous and excited as my usual audience didn't exceed 40. I began by interacting with the audience for a few minutes to break the ice and avoid making the session too boring.


It turned out that many of them had a basic idea of Python, but not many of them had heard about IPython Notebook. This was kind of good news (for me).

After my talk, I was overwhelmed to see the enthusiasm of the audience, as a lot of people jumped up with questions. It was great to find that people found my talk interesting. After clearing their doubts, I asked a bunch of questions and some lucky guys got some cool Google goodies.




Towards the end of the event, the organizers, several of whom are GSOCers themselves, gave a presentation about making it to GSOC, and explained the whole process in detail.

Then came the lucky draw, and two lucky winners got a GSOC T-shirt each. Also, all the speakers got certificates of appreciation. In the end all the speakers and attendees came together for a group photograph (to be added later).


As the evening came to an end, we left for our homes with the satisfaction of giving back to the community which has guided us so far, and the hope of staying in touch via similar community events.


Beginning programming with Python

It has happened more than once, that I've been asked by several peers and juniors about the first steps towards learning Python. In this blog post, I've tried to enlist & summarize all the possible methods & sources which helped me when I was a beginner, and all those things which I wish I had known.

Don't go reading the syntax

There are many students, who go about reading the syntax & structure of Python, and get completely lost in it. While I don't discourage people from reading literature of a new language, but 'only' reading about a laguage is definitely no way to learn it.

While reading about the syntactical details of a new language or framework, you might feel that you are getting a hang of it, but the moment you see the keyboard, your fingers freeze! This is because the brain can only take so much. Unless you type the code with your own hands, the odds of you getting well versed in that language are almost negligible. Trust me, I learned it the hard way.

Now that I've mentioned, what all you mustn't do, I believe its time to discuss the things you need to do in order to become a Pythonista.

Pick a project and stick to it

The best way to master a new language/framework is to work on it. So pick a small project. It doesn't need to be something too cool or awesome. All you need to have is a clear idea, of what exactly you want your application to do.

Then take a look at the basic syntax from one of these links:

In case you want a cheat sheet, you can use this one.

Now, if you are already familiar with python but are looking for Python libraries for use in a particular field, then head over to this repo on Github. It's a "curated list of awesome Python frameworks, libraries"

What Project??

If you are uncertain about what project you should make, first of all watch this presentation. Then go through the following links, which provide a list of projects you can pursue:

I hope this helps the beginners of today in their journey to becoming the Pythonistas of tomorrow.

Happy Hacking!!

Friday 16 May 2014

Messing around with Elasticsearch


Elasticsearch(ES) is an extremely powerful tool allowing us to deploy a full-text search engine in no time. But unfortunately, this power doesn't come with some decent documentation. Having spend an insane amount of time googling the concepts & issues of Elasticsearch, I've tried to compile all the stuff that helped me deal with ES.

Tools


Before diving into Elasticsearch I'd suggest you use the following tools:
  • Postman: Postman allows you to easily work with APIs. Its a prudent tool for working with ES. If allows you to send requests without even visiting your terminal, eliminating the need to use cURL as most tutorials would have you do.

  • JSON Lint: Its a website that allows you to test the code quality of your Javascript code or JSON objects in our case. Since the queries we write in ES are essentially JSON objects, its prudent to validate the syntax of the JSON object.

  • Play: This is one of the best tools for working with ES. While this JSFiddle inspired utility doesn't allow you to make API calls, it provides a sandbox for messing around with ES queries. You can feed your data & mappings along with the search queries and view the results, all in the same window.

Plugins


There are several plugins for Elasticsearch that can make your life a lot easier.
  • Kibana: Kibana is a powerful tool for visualizing and analyzing your data. It provides a simple yet powerful text search along with a decent UI.

  • Marvel Sense: Sense was a Chrome extension allowing one to make Elasticsearch queries, which was later merged in the Marvel plugin of Elasticsearch. A wise move, considering the ease with which you can execute Elasticsearch queries, which comes along with the goodness of Marvel, a plugin for monitoring and analyzing the health of your cluster.
      Edit: Sense is resumed as a chrome plugin. You can get it here.
  • Head:  Head is the quintessential plugin for Elasticsearch. It provides a frontend for your Elasticsearch cluster, showing the status of your entire cluster, down to each shard. You can also browse the entire index, and execute queries. And ofcourse you can create, flush, and delete indexes with it as well.


Getting started and beyond


First of all get familiar with the terminology from this blog. Now, An Elasticsearch Primer & Querying ElasticSearch are good places to start with ES and get a hold of the basic concepts. And don't forget to go through Elasticsearch's README from the github repo.

Once you move on to searching & querying more complex structures, take a look at Fun With Elasticsearch's Children and Nested Documents.

Now assuming that against all odds you are still not daunted by the complexity of Elasticsearch queries, you are likely to find yourself in some serious mess in the future, probably pulling your hair with frustration (like I did). In order to avoid such misery altogether, refer to Troubleshooting Elasticsearch searches, for Beginners. This is an article by the 'Found Foundation', the same organization behind Play (the tool mentioned above). In fact, they have a whole Foundation series, full of great guides for beginners. I personally haven't been through many of them, but I certainly plan to.

Now a word of caution, ES can be daunting for some, but try not to do it in bits & pieces. ES might take a lot of time, but it's fruitful only if you dig deep. Anyhow, its common for most to forget some stuff about ES. So for a quick reference, take a look at this presentation. Its kind of a cheatsheet for Elasticsearch.

Assuming that all has worked well for you, there still remains the task of optimization. For that, Elasticsearch Indexing Performance Cheatsheet should come in handy.

Hope all these links help you in your battle with the insane amount of data we produce & use everyday.

May the source be with you!!