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!!

Sunday 18 August 2013

The joys and woes of my first project

In my college, students pursuing B.Tech are required to make a project in the summer break following their second year. I was excited about it as it was perhaps the first time in college that we were expected to do some 'real' engineering, and not merely cram textbooks and vomit its contents on sheets in exam.

I'm quite an enthusiast but don't have much experience, or knowledge for that matter. So this project presented a great opportunity for learning while building. Choosing the topic for the project was easy, as I was determined to take up something of my interest. Having loved movies for most part of my childhood, teenage, and whatever adulthood I've lived through so far, this decision was easy.

Next came the language, and having scratched the surface of Python, I knew it was a powerful language and was eager to dig deeper into it. I decided to make a 'Movie Organiser & Recommendation Generator'. Quite a mouthful, I know, but hey, it was based on movies and working on something I enjoy was a constant motivator.

This application allowed the user to log in via his/her Facebook account and on the basis of their 'likes', suggested movies to them. It was immense fun to make, and I did and learnt a lot from my mistakes. Having started the project with the wrong methodology, I stumbled upon the correct way of doing things.

I realised that the beginning was the most difficult. You just don't know which way to go! The first thing to do is draw an outline of the idea, and decide the features to put in. Now in theory, you should have a clear road map ahead, but if you try to figure out a problem before even facing it, then you'll probably never reach the execution stage. Its empirical to keep developing as you plan, or else all you'll have in the end will be plans and no results.


Then comes learning a new language, which was the case here. Knowledge without application always seemed like a waste of time to me. So I was determined to learn something I could use in reality. And with that in mind, I set of to Dive Into Python. Learning Python was fun as I was able to get things done in no time and even automate the whole process! I needed to make a database by scraping contents off a website. So I wrote a script that parses the contents of the site and feeds it to a sqlite database. This was perhaps the best script I had made till now, and it took around 80 lines of code!!

After finishing the project I proudly went to see my Project Guide, who told me to make a GUI for the application. Now, this was unsettling, as this was going to take  a lot of time and I had no idea how to make one, but then I had no idea how to make the whole app, and I had already done it. So how hard can the User Interface can be? But this was about to become a major Woe in the timeline of my project. The GUI alone took half as much time as the entire app took. The reason perhaps was not the mere lack of knowledge, but also the lack of will. I thought of it as a waste of time, but later realized that besides the back end, one must also know a little about the front end development.

But that wasn't all. The worst job was to document the whole process and by 'document', I don't mean a blog post like this, but a complete report on the project. To be honest it wasn't the documentation that stung me that much, but it was the strict format in which the documentation was to be done.

But then at the day of the presentation, the external examiner was quite impressed by my project and I guess that was a Job Well Done.

As they say, it's the journey that is more important than the destination. I certainly enjoyed my journey and now am confident enough to take on more sophisticated projects.


Saturday 17 August 2013

Hello Null!

This would probably look like a desperate attempt not to seem cliché, and maybe it is. The act of using "Hello World" while testing a program, or while learning a new language, has become more of a tradition.

So here is to the Null, the nothingness, the emptiness, and in short, the cumulative of all those words you have for, well, 'Nothing'!

Hello Null!!!

P.S: This was an inaugural post, posted simply for the sake of posting something. Kindly don't try to find any meaning in this, simply for the reason that it doesn't have any!