Vinit Kumar

Senior Backend & Systems Engineer at Socialschools B.V

© 2016 Vinit Kumar

Four years of Full time job

So on 1st February 2017, I completed my fourth year working for Socialschools.

I joined Socialschools(then Changer) at the same date in 2013. It’s has been quite an honor working with many awesome people. Then, I was only a fresh graduate dreaming of making a dent in the universe. Today, I am writing code for one of the fastest growing Communication platform for Education in The Netherlands.

First I would like to thank Ruben, Jonathan, Jos for giving me the chance to work at Changer. Next, the four years at Socialschools would have never been possible if it was not for my colleagues. I had worked with Robert for the most of the time during this journey. He has always been the most friendly person and shares the same passion and fire to do amazing work for Socialschools. Aashish has been a great mentor, friend, and guide and we have spent countless hours building new features, fixing nasty bugs and coffee. Bert has been a great part of Socialschools and has been a driving force is growing us to the next level. Marieke has been pretty amazing at implementation and putting users interest and perspective in the product. And of course, Jos has been an amazing mentor and technical guide in my growth as an Engineer. The newer team members like Edwin, Harry, Shanice & Trui have been great too and are doing a great job in their field.

I would also like to thanks to my Ma, Moma, Papa, Baba, Jhunu and especially my wife Rituparna who have supported me at each and every step and shared the joys and difficulties together. I wouldn’t be here if it wasn’t for them.

I would also like to summarize the core of what I have learned during this four years:

  • Any work you do, You do it with pride. This is something I learn from Ruben early on in my career. We sometimes run after big achievements and stop enjoying small jobs that are always there. Never shy away from work, however small and do it with utmost pride. Even a small CSS change that brings joy to your customer is worth it and you should be happy to do it. Thanks, Ruben :)

  • Think of users perspective and build for your users and use what you build.
  • Writing clean, maintainable, testable code requires thinking and it is a very good investment.
  • You need to have passion and vision when building a product. It will have its lows too and you need someone to motivate, innovate and think out of the box for the product.
  • You need to be pragmatic while writing code and it’s not only the quantity of code that matters but what you deliver as a product is what really matters.
  • Enjoy what you do and do what you enjoy!

Some New Learnings

Software Engineering comes with a lot of good learning opportunities. First you learn how to write something by reading tutorials, watching videos etc, Then down the time you learn some new ways to do the same thing and you are blown by it. But only after some days you actually encounter the real hard problem in Computer Science. Some of them are:

  • Race conditions
  • Caching

I have had some very nasty experiences with race conditions. But it opened my eyes to a new set of bugs that could be introduced. Your code to work fine 99% of the time but that remaining 1% could only happen under very rare circumstances. I think being aware and looking out for ways where conditions might occur could be a good way to minimise if not totally prevent race conditions.

About Caching, it is very important that you understand what you are caching, why you are caching and how exactly your caching is going to work. Just setting up memcached and using a plugin will not help when you encounter a nasty bug caused by caching and you only realise after wasting hours debugging the issue.

Lately, I have been hacking a lot on new things and writing some Goand Node.js. I mostly do that in my late evenings after dinner and it is good fun. I am thinking of documenting my learning process as I learn these new things in a better way. I think it works best for me. I will probably do a 15 or 30 day challenge, pick up a language and learn as much as I could about that language. The goal here is to learn it deeply and clearly.

Open Source

I joined github in 2010 and it has been my primary source for reading and writing code. I took my baby steps doing open source programming reading others code and it has been a good source of knowledge for me. Since then I have written quite some open source software. I have written some javascript, python and go code and shared those projects in github. Open Source has quite some good benefits as it gives you a nice place to hack on things that fancy your imagination.

But there is certain downside to this as well. Sometimes your primary work(paid job) takes up all the time and you don’t have any time and energy left to spend on side projects. This is something that has happened to me since last 1.5-2 years. I have tackled very nice hard and challenging problems at work. I worked on complex scaling issues, performance tuning and lots of new features that really added value to the product. But I hardly found any time for myself. I have struggled for properly managing my time and it makes me a bit sad. But these days, I am writing some amount of code regularly.

I hope to write some more open source code in the coming time.

Why I Write Code

I think I was hardly 10 years old when I wrote my first line of code. It was probably some IBM PC and the language was LOGO. It was so much fun. Next, It was GW Basic, then Java and then C/C++/Python. I have been writing code professionally for 5 years now and I still enjoy writing code.

I enjoy solving tough problems with code. It gives such a great high when I solve something that seems very difficult at the moment.

Last year has been very hectic and I haven’t given much time on writing code on things I enjoy personally the most(side projects).

Well, I am still figuring out my dreams at the moment but very soon I will have a clear idea of how and what I want to become in future.

But there is one thing that is sure, I would change the world for better than how I found it.

Clean Up Your Mac From Other Files

screenshot

Sometimes, your mac is filled up with files and you can’t seem to understand what really is taking much space. Here is how you can find out.

  • First of all find disk usage and save it to a log file. Also, find all big files that are there. Grepping using ‘G’ would find all files that are in GB.

Also, save the second list to another file so that we are only doing it once.

du -h > ~/space.log
cat ~/space.log | awk '{print $1}' | grep 'G' >  ~/highspace.log

Next, open a split window and do

cat ~/highspace.log

And Now, start finding the ones which are big one by one.

Let’s say one of the entry was 5.6G, Let’s find which one was it.

 cat ~/space.log | fgrep -f highspace.log
 
 #It will give something like this:
 
1.2G	./.android/avd/Nexus_6_API_21.avd
2.7G	./.android/avd
2.7G	./.android

Now, if you feel the file is not needed and you want to delete it. Do the following:

sudo rm -rf Documents/Movie.avi

Voila! Repeat this process and remove all files and directories that you no longer need.

Disclaimer:

Do it very patiently and backup everything that’s important. This guide is for very advanced users and you should only do it if you know what you are doing. I am not responsible for any data loss. Do it at your own risk.

GPS Tracking on Android

Like everybody else, I have an Android phone too. If you are a developer you must have noticed a file called as GPS.LOG. It is the one file which has all your GPS logs in it. This weekend I spend couple of hours hacking with it. He is the outcome.

How you get tracked

First of all, connect your Android device to your computer and copy the gps.log file into your desktop:

cp /Volumes/NO\ NAME/GPS.LOG ~/projects/gps.log

Now, we need to find the good data that contain gps coordinates:

cat ~/projects/gps.log | grep 'position' > ~/cleangps.log

The cleangps.log file contains only data that has coordinates on it.

Now, create a log file that only contains coordinates:

cat ~/cleangps.log | awk '{print $3, $4}' > ~/gpscord.log
# notice the new file is nothing but values seperated by commas, hence write them as csv
cat ~/gpscord.log > ~/gps.csv

This csv file is the basis we use to find that location the GPS log was taken.

Prepare virtualenv and install googlemaps:

mkvirtualenv maps
pip install -U googlemaps

Also, follow the clear instructions at https://github.com/googlemaps/google-maps-services-python#api-keys to find your API key.

Here is the python file track.py that would find what these coordinate means and how they related to your daily life and place you are frequent to.

#! /usr/bin/python
import googlemaps
import csv

gmaps_client = googlemaps.Client(key='<Your Server Key Here>')

with open('~/gps.csv') as csvfile:
    gps = csv.reader(csvfile, delimiter=',')
    for row in gps:
        lat = float(row[0])
        longit = float(row[1])
        reverse_geocode_result = gmaps_client.reverse_geocode((lat, longit))
        formatted_address = reverse_geocode_result[0]['formatted_address']
        print row[0], row[1], formatted_address
        print "=" * 150

Run this file in your terminal by and check out the output, you will get freaked out for some moment.

python track.py

How it went?

Hello People!

It has indeed been very long since I last wrote a blog post. It sure feels good to start it again. Firstly, if you enjoy my writing, I am sorry for this big gap. I was very busy in writing code at my work.

Here are some important updates about what happened:

  • I got married! Yay :) I got married in December with my lovely girlfriend. It has been pretty amazing last three months with her.
  • I wrote various features for my product and there are more than 20k users using those features right now and the feedback has been quite good actually.
  • I write less code these days and spend more time thinking. I think it is better this way. I felt burnout with my previous lifestyle. Now, I wait to write code every morning.
  • I feel less annoyed with stupidity around me and have a better coping mechanism.

I have decided to be more consistent with my reading habits. I hope to be more sincere this time. That’s it for now. Will write another post soon.

Better Time Management At Work

Time management is a key quality of any successful person. I have been working pretty hard these days to improve me efficiency. Today, I have decided to follow this pattern while at work.

Here is the breakdown. Let’s assume the net hour spent at work is 8.

  • 50% Time (4 hrs) - Writing Code.
  • 5% Time (24 min) - Documentation of the Code I wrote.
  • 5% time (24 min) - Writing test on the Code I wrote.
  • 10% time (48 min) - QA and testing the work I produced.
  • 20% time (96 min) - Planning and Studying about the topic I need to work on.
  • 5% Time (24 mins) - Working with colleagues and helping out in case they need any assistance.

I felt the need to this timetable because it is really necessary to control the time when you are on tight deadlines. I like giving my all to the work and definitely have very limited time to execute that. So only if my planning and time management is solid I would be able to produce quality work on time.

I will produce a analysis of how this goes and how much success I achieve using this methodology. Also, today I have completed my 41 day streak at GitHub.

On Writing Good Code

Whether you are working for a big software company or a small sized startup, writing good code is pretty much critical to your success. But the catch is it is not very easy to achieve without proper motivation from your side.

I have been coding professionally for almost 4 years now. First two years were as a freelancer and I mostly followed Get Things Done mode during that time. It was okay then because it was mostly a one time gig and once done you didn’t had to do anything with it. Though I never wrote really bad code even at that time but the amount of maturity and knowledge required to write code that is maintainable, DRY and has some documentation was clearly not there.

While I joined my first company back in 2013, I really struggled against my bad habits. I was able to solve tough technical problems as problem solving is always close to my heart but there were serious issues with my code quality. Sometimes there was some indentation issue and something there were some code repetition. I was lucky to have my Mentor “Ruben” to closely look at my code and review it sharply and give his most honest feedback. Upon pondering about the review I realized most of the issues were coming because a certain amount of thinking and carefulness that was missing from my workflow. I didn’t had my editor configured properly. Mix of tabs and spaces will obviously come back to bite you and code will look ugly on browser even though it looked fine on your editor. (Sublime Text, I am looking at you).

Now, after almost an year later I am a improved and mature programmer than what I was at this point of time last year. So what changed?

Here is a short summary of things I did in order to get better at writing code:

  • I started reading classic books on programming. Understanding programming and computer science is pretty much vital to your growth as a software developer. Dreaming about making big in this field without having solid basics is a fools errand.
  • Read a lot of good code. Discuss about it, blog about it and finally incorporate those into your own code. This is pretty much most important to improve the code you are writing. I started reading a lot of good code, on an average of 1 hour daily. With loads of Open Source projects available on Github and bitbucket it is pretty easy to do so.
  • Follow strict mode in almost every language your code on. Use Pep-8, JSHINT, CSSLint, Grunt. This might be painful at beginning but it would cover a lot of ground that you might not know as you are not an experienced developer.
  • Learn and use Travis CI and Jenkins system that would automate a lot of these things in your code.
  • Write a lot of code and open source it. Also, contribute to a good number of OSS projects. I have done a lot of this in the past year and believe me it has really helped in improving.
  • Read the f**king documentation - This is kind of most important if you want to really use the power the language or the framework provides. Otherwise, you will keep writing shitty code because you were never aware better way exists.

  • Use version control- Version control gives you an opportunity to look at your code before committing. Use this powerful feature. Always review your code before your commit. Always review a pull request and merge.

How To Get Readonly Mode In Django

Last week, I came across an interesting problem at work. The problem was:

To get read only users in a Django based application.

But doing so was not very simple because there is no read only mode for users in Django. In order to solve this, I first started reading answers on stack overflow. Some of those links did pointed me to a correct route. Here, I will document the whole process so that it could help others and serve as a reminder for me as well.

First of all, the whole system of authentication in any system originates from permissions. The basis permissions are. Read, Write, Execute. in Unix (chmod is used to set permissions).

Django has a cool way of adding the permissions in the meta class. Let’s say we have a model class named Cars.

class Cars(model.Model):
  name = models.Charfield()
  year = models.DateField()

  class Meta:
    permissions  = (
      ('readonly', 'Can Read Only Cars')
    )

Just like this, Any permission could be added to the Model. Now in order to get these permissions in the database. You need to run syncdb management command.

python manage.py syncdb --all

So this just sets the background in place. The real job is getting this permissions to work.

Now, I began to wonder what all things were required to develop this complete functionality ?

The first thing that came to my mind naturally was to override templates and hack ground admin.py.

So, I created a new class in Admin.py that was inherited from the admin class I was earlier using:

from model import Cars


class CarAdmin(admin.ModelAdmin):
    date_hierarchy = 'date'
    list_filter = ('status', 'event_instance',)
    actions = ['accept', 'reject', 'pending']

class ReadonlyCarAdmin(CarAdmin):
    def __init__(self, model, admin_site):
      super(ReadonlyCarAdmin, self).__init__(model, admin_site)
      self.model = model

    def has_delete_permission(self, request, obj=None):
      if request.user.has_perm('car.readonly') and not
      request.user.is_superuser:
        return False
      else:
        return True

    def has_add_permission(self, request, obj=None):
      if request.user.has_perm('car.readonly') and not
      request.user.is_superuser:
        return False
      else:
        return True

     def has_change_permission(self, request, obj=None):
        if request.user.is_superuser:
            self.readonly_fields = () # make sure to remove caching.
            return True
        elif request.user.has_perm('car.readonly'):
            # make the fields readonly for only users with readonly permissions.
            self.readonly_fields = [field.name for field in filter(lambda f: not f.auto_created, self.model._meta.fields)]
            return True
        else:
            return False


     def get_actions(self, request):
        actions = super(ReadOnlyCarAdmin, self).get_actions(request)
        if request.user.has_perm('car.readonly') and not request.user.is_superuser:
            # This ensures that that user doesn't not have any actions
            if 'delete_selected' in actions:
                del actions['delete_selected']
                del actions['accept']
                del actions['reject']
                del actions['pending']
            return actions
        else:
            return actions


admin_site.register(Car, ReadonlyCarAdmin)

Okay, so now we have a robust system in place to ensure whichever user has readonly permission on Cars Model would only be able to see the model data in Readonly mode.

But this is not it. Here is the part where templates are overridden.

First of all save and cancel button on buttom needs to go as we don’t need them.

For that, create a new template in templates folder.The templates name is ` change_form.html. Hence the full pathname is carapp/templates/admin/change_form.html`.

Copy the content from the default django template (/admin/change_form.html) in django project add replace this content with this gist:

This will ensure that the selected user with this readonly only permissions won’t be able get the submit button on his admin page.

Now, you have a fully functioning Django Admin with readonly mode. The main effort was to make it very easy to use and ensure that this feature could run across future versions.

Hope this post help anyone else who has to implement something similar.

Setting Up Emacs for Development

I always wanted to use Emacs. Yesterday, I wanted to have a good JavaScript/Node REPL in my editor. Though I had always used Vim since last 5 years still setting up a REPL in Vim is not very easy. So I decided to give Emacs a try and till now I am enjoying using Emacs.

Here is a guide that would help you to setup emacs.

First of all, If you are on Mac install emacs for OSX from here. you could easily install the GUI version of Emacs for other platforms too.

My Emacs config

This is my Emacs config which could be used for development in following technologies:

  • Ruby / Ruby on Rails
  • CSS / LESS / SASS / SCSS
  • HAML / Markdown / Textile / ERB
  • Clojure (via nrepl)
  • Javascript / Coffeescript
  • Python
  • PHP
  • Haskell
  • Erlang
  • Common Lisp (with Slime)

In particular, there’s a nice config for tab autocompletion, and flycheck is used to immediately highlight syntax errors in Ruby, HAML, Python, Javascript, PHP and a number of other languages.

Demo

This is my emacs live in action:

Requirements

  • Emacs 23 or greater (note that Emacs 24 is required for some functionality, and will likely become the minimum required version some time soon.)

Installation

To install, clone this repo to ~/.emacs.d, i.e. ensure that the init.el contained in this repo ends up at ~/.emacs.d/init.el:

git clone https://github.com/vinitkumar/.emacs.d.git ~/.emacs.d

Upon starting up Emacs for the first time, further third-party packages will be automatically downloaded and installed.

Adding your own customization

To add your own customization, use M-x customize and/or create a file ~/.emacs.d/lisp/init-local.el which looks like this:

... your code here ...

(provide 'init-local)

Tips for using these emacs settings

If you want to use my settings straight out of the box, here are some things to note:

  • I recommend starting with a blank emacs + Technomancy’s better-defaults package, and then dig through this repo for useful nuggets, instead of forking it directly.

  • The key bindings are optimized for a norwegian keyboard layout.

  • Start by reading up on all the cool stuff in key-bindings.el.

  • You quit emacs with C-x r q, mnemonic Really Quit.

  • Find file in project with C-x o, in dir with C-x C-f, recent with C-x f

  • Add your user- and project-specific stuff in .emacs.d/users/[machine name]/*.el

  • C-h is rebound to backspace, like in the shell. Get help on F1 instead.

  • Autocomplete with C-. (autocomplete entire lines with C-:)

  • expand-region is your friend. Find its bound key by doing F1 f er/expand-region

  • Undo with C-_ and redo with M-_. Watch the undo-tree with C-x u

  • Quickly jump anywhere in the buffer with C-ø then the starting letter of a word.

  • Indent and clean up white space in the entire buffer with C-c n

  • On a mac, the Meta key M is bound to Command.

  • I recommend rebinding Caps Lock to Ctrl and use that instead of the often badly placed Ctrl-key.

  • Watch emacsrocks.com

Survival guide for the first week of emacs

When you start using emacs for the first time, your habits fight you every inch of the way. Your fingers long for the good old familiar keybindings. Here’s an overview of the most commonly used shortcuts to get you through this pain:

  • C Shorthand for the ctrl-key
  • M Shorthand for the meta-key (bound to cmd on my mac settings)
  • S Shorthand for the shift-key

Files

  • C-x C-f Open a file. Starts in the current directory
  • C-x f Open a recently visited file
  • C-x o Open a file in the current project (based on .git ++)
  • C-x C-s Save this file
  • C-x C-w Save as …
  • C-x C-j Jump to this files’ current directory
  • C-x b Switch to another open file (buffer)
  • C-x C-b List all open files (buffers)

Cut copy and paste

  • C-space Start marking stuff. C-g to cancel.
  • C-w Cut (aka kill)
  • C-k Cut till end of line
  • M-w Copy
  • C-y Paste (aka yank)
  • M-y Cycle last paste through previous kills
  • C-x C-y Choose what to paste from previous kills
  • C-@ Mark stuff quickly. Press multiple times

General

  • C-g Quit out of whatever mess you’ve gotten yourself into
  • M-x Run a command by name
  • C-. Autocomplete
  • C-_ Undo
  • M-_ Redo
  • C-x u Show the undo-tree
  • C-x m Open magit. It’s a magical git interface for emacs
  • C-arrow Move past words/paragraphs
  • C-a Go to start of line
  • C-e Go to end of line
  • M-g M-g Go to line number
  • C-x C-i Go to symbol
  • C-s Search forward. Press C-s again to go further.
  • C-r Search backward. Press C-r again to go further.

Window management

  • C-x 0 Close this window
  • C-x 1 Close other windows
  • C-x 2 Split window horizontally
  • C-x 3 Split window vertically
  • S-arrow Jump to window to the left/right/up/down

Help

  • F1 t Basic tutorial
  • F1 k Help for a keybinding
  • F1 r Emacs’ extensive documentation

Credits & Inspiration

This config is totally based on this repo by Mr. Steve Purcell. But this might diverge with time and my personal taste.

The Survival guide has been taken from .emacs.d project of Mr. Magnar Sveen

Be Awesome

I write a lot about technical jargon even on my personal blog. For a change, this post is nowhere close to it. As time passes by my thinking and maturity level has improved. I am able to see things that were invisible to me before.

I have learned to control my anger and frustration over things I should not have been upset about in the first place. Control over our actions and anger is important. These two things are very easy to loose but with practise these can become your strength.

These days I have realized the worth of good health and fit body. Since the day, I started going to gym i could really feel the difference in my energy level and awareness. Software development is a really hard profession. There are numerous possibility of getting burnout. After working for three direct months from October, somewhere around January it hit me hard. I was shying away form hard issues, felt tired very soon. Then I realized that all I did in past three months is just code, code and code. Nothing else at all. Even on weekends I was busy with my personal projects. It gives a kick when you immerse yourself in programming. But if you ignore your body and mental health. It will come to bite you.

Since then I started paying more attention to my health and hence started making full use of my Gym Membership. Another thing that I am trying to work on these days is to work only 9-5 on normal days. It might sound strange but if I want to maintain a healthy work life balance, this is a must. Wake up early, commute to office, give solid 8 hours of disciplined work, come back up home, relax, go to gym, watch some TV. These are simple things, but with Good impact.

One Year at Job

I joined Changer on Feb 2013. Today I completed my first year at full time employment. It has been nothing but amazing.

As I get to understand, first year is the toughest. It is hard to adjust working with people, communicating properly and keeping your mind sane in lows and highs.

I am very proud of the hard work I put in my projects. I did some mistakes, improved a lot as a person and a programmer.I am totally committed to try harder and do things right in the first time.

Last but not the least, I would like to thank my parents, my girlfriend and my colleagues for being super supportive and nice during this time. I promise, I will make everyone very proud soon. :) :satisfied: @vinitkumar

Setup Macvim for Maximum awesomeness

I have been using vim for almost 5 years now. For some time, I even switched to Sublime text2 but I am finally back home. Well, the following guide is only for macs. Sorry GVIM users! Here is the latest screenshot of my macvim:

Macvim

As you can see, it has a nice Filebrowser that is way more clean and intuitive than NERDTree.

Installation

First and foremost down this build of Macvim from alloy’s fork: Macvim Unzip it and then put the Macvim.app into your Applications.

Follow these instructions to have the same in your Mac.

First of all do this:

git clone [email protected]:vinitkumar/.vim.git
git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
cd .vim
cp vimrc ~/.vimrc
cp vimrc.before ~/.vimrc.before
cp vimrc.bundles ~/.vimrc.bundles
vim +BundleInstall +qall

Install the peepopen app from here: Peepopen. When installed open peepopen and set MacVim as your default editor.

Once you are done with these steps you have a super awesome development IDE optimised for Python/JS/Ruby development.

##Credits

Credit must be given to @alloy and @topfunky for creating these wonderful addons to Vim.

Happy hacking!

2013 Year In Review

2013 is easily one of the most amazing year of my life. In January I interviewed for my current company and was offered to join them in Feb which I did. Well a lot did happen after that. It was my first Full Time job. I used to freelance as a Web/App Developer before which was fun. But I didn’t wanted to just sit alone at home and work. So I joined Changer precisely 11 months and the journey is nothing short of extraordinary.

Well, I did a lot of things first time in my life last year:

  • Went home on a flight. Had never done it before, It’s an amazing experience. Got my B.E. degree in Civil Engineering in the same trip.
  • Travelled to Mumbai. Such an amazing and vibrant city.
  • Owned a Macbook Pro, HTC android phone, Steelseries Headphones, Dell monitor before the year’s end. I am a gadget freak so these things mean a lot to me.
  • Learnt a lot about Software development process and programming in general. Courtesy these amazingly talented people at Office.
  • Bought some classic CS books such as SICP, AOCP. Even reading a couple of chapters gives you so much insight. It is an amazing feeling.
  • With all the happy and not so happy moments last year, I have learnt to appreciate life, time and importance of hard work.
  • I was always an optimist but now I have matured as hard working person.

Well, in the technological field. This year was an amazinging one. I did learnt a lot and grown as a developer. I am a big supporter of OSS and luckily my company has the same outlook.

Here is a small lists of the projects I opened Sourced on Github:

  • Simple - Jekyll theme for hackers. Simple yet very features rich, SEO friendly, Developer oriented theme.
  • ldb.js - Thin wrapper on HTML5 localStorage.
  • pagination.js - jQuery Pagination plugin that is used in SocialSchools.
  • node-modular-demo - A sample demo out of TJ’s video that shows the way of doing modular nodejs development. angular-team-profile - A nice team profile viewer built on AngularJS. It uses Github’s API as backend. Also, built an Android app for the same using Phonegap.
  • node-twitter: A twitter clone written with node, express and mongodb. This was one of the nice project i did. Looking forward to refactor and rewrite this app in this month.
  • offline-sync: This again helps you to build HTML5 apps with offline sync capability.
  • cmsplugin-fbalbum: This was my first attempt at writing Django CMS plugin. This plugin helps you to use Facebook as your media source and image upload service. So you save your valueable money and time.
  • crawler: Rewrote a crawler in Python, that I have written earlier. Much cleaner and maintainable.
  • project boilerplate: Nodejs project boilerplate
  • todoapp: Todoapp built with angularjs in the beginning of year.
  • JSON2XML: A very handy, lightweight and efficient module written in in python to convery JSON data to XML.

You can check all of them on my Github profile. @vinitkumar

During the course of their development, collaborated with a lot of people across the globe and made some nice friendship. In everyway this year has been a really nice and special one for me and I would thank every single person for being nice to me.

Simplicity in things

I have always been a great fan of things around me that are simple to use and understand. Infact, each one of us appreciate things when they are simple. But life ain’t so simple.So what should be done?

Well, we could reduce a lot of clutter on personal level is invading our life. These days I am getting upset or even irritated seeing some people posting crap on their Social Network. Social Networks were a great thing to share knowledge and information, but their over usage has just destroyed their true purpose. Don’t get me wrong, I have nothing against them, just that I don’t appreciate them polluting my life and making it more and more complex.

I started experiencing these things about an year ago. After using Facebook or almost 5 years (joined on 2007) I finally stop using it actively and these days mostly use for work purposes or on Social compulsion. But I don’t enjoy using them a bit. Not even a bit.

I feel life has much higher purpose. We are here to solve problems, create life better. Not to make it depressing or distasteful. I like meeting my friends in person, have a beer or grab some dinner. I don’t just want to keep liking their photos and exhubrant display of their life and get bored. Hell No.

I was meditating about the fact that technology is here to serve us and make our life easier. Not that we are meant to be hopeless retards taking whatever the technology is making us do. It really upsets me seeing that fact people respond so emotionally to all the PR stunts by different sets of people and do things that any sensible person won’t even think about doing.

I realize lot of people from our generation has lost touch with reality and never think deeply about anything.A political party sets up page on Facebook and every goes madly running after them. Why? Because it’s the latest FAD to do so? Do most of the people even understand anything about their agenda. Well, mostly they don’t even have a clue.

Well, I don’t really have any hope for these people who don’t see these things but I would be glad if anyone ponders about these things by reading this post.

Also, I would continue to take measures to stop this information overload and would strive to make my life simple, purposeful and happy to live.

Classes in JS

Here is an interesting example for Classes in JS. Classes in JS don’t have a class keyword.

function Range(from, to) {
  this.from = from;
  this.to = to;
}
 
Range.prototype =  {
  includes: function (x) {
    return this.from <=x && x <= this.to;
  },
  foreach: function (f) {
    for(var x= Math.ceil(this.from); x < this.to; x++)f(x);
  },
  toString: function () {
    return '('+this.from+'.......'+this.to+')';
  }
};
 
var r = new Range(4,20);
r.includes(5);
r.foreach(console.log);
console.log(r);

It is pretty simple and clean way to create a class

Buying New Books

In the span of two days I have ordered three books:

  • The Art of Computer Programming (Volume 1, 2 and 3)
  • SICP
  • The Art of Readable code

These are considered best book in Computer Science and I am waiting eagerly to lay my hands on them. I will also need to brush up my mathematics.

Well, AOCP is considered the toughest book to understand so my plan is to keep reading it slowly and steadily. But I would like to complete TARC and SICP in the coming 6 months.

For solving the exercise in SICP, I would use Clojure since it is the new hotness and runs on JVM. For TARC, I would be using my main programming language I code at work and work( Python and JavaScript).

I hope the coming months to be exciting and informative. It is said that some decisions impact your life in a great manner and I would like this to be one of them.

One Month Hacking

After a lot of meditation about what I have achieved in last one year, I have stumbled upon one fact. I need to hack a lot more on Python and JavaScript. These are two main languages I am comfortable with and almost all my projects and official work is done with them.

Well, here are some small ideas about how I am going to achieve this:

  • Read a lot of Good code. I will spend at least 1 hour everyday reading some really awesome python code.
  • Write a lot of commonly used utilities in Python. For example: Automate at least one of the task I daily do using Python.
  • Read Django Documentation and toy with it.
  • Write PEP8 compliant code.

These were the ideas for Python, Now for JavaScript:

  • Give a solid foundation to my understanding of prototypical inheritance in JavaScript.
  • Write a lot of Backbone and some really good jQuery Code.
  • Read some really good code and write some coffeeScript as well.
  • Learn writing good unit tests in Jasmine and Mocha.

New Theme For My Blog

So this week, I wrote a new theme for my blog. One big reason was that using theme created by others were not fitting my needs and I was not inspired to write anymore. This was odd because in general I love writing posts on my blog.

I felt the design was taking too much attention and the content has taken a back seat.

There are few good things about this new theme i created:

  • More emphasis is given to the content.
  • Good fonts has been applied and it looks pretty on all devices.
  • The structure is pretty simple and there are mainly three tabs.

I like it the way it has come up, though some more improvements such as better responsive navbar and more SEO fields would make it way soon.

I Have Grown

Last few months has been really great for me. I think i am starting to grow as a developer and I know now how important is to keep performing at a certain level. The change started occurring when i gave up my comfort zone and started doing front-end mainly.It was a bit difficult in beginning to understand a design from a designer’s perspective and to convert it into running efficient code.

I also know now that everything is important and every contribution you do in a company is worthwhile and it is worth putting all your energy in doing whatever you are doing.

Now, i am looking forward to get expert level knowledge in whatever stack/technology i get to work on. One need to be always learning and improving. I am definitely more focussed now and my goal is to do some really nice work on the products i work on.

Recently, i made the main website of your product Socialschools with my very talented designer colleague Robert. It was real fun converting his great design into pixel perfect and functional website. I enjoy writing every line of code that i get to code because this is what i love to code.

P.S. I am a Civil Engineer by education, but have always loved computer so naturally was inclined to write softwares.

That’s it for now. Will post more about it later sometimes. You can follow the latest on twitter if you like my posts or what i say. @vinitkme .

Life At A Startup

Last few months has been really exciting for me. Since, i joined Changer on 1st February. Here are some things i learnt in these 5 months:

  • I should try to learn and own the stack i am working on. Trying to do a lot of things at a time is not going to help much.
  • Contributing a lot to open source is a good thing and i am lucky my company encourages me to do so.
  • I should write a lot of code and read a lot more. i should invest time in learning and understanding my product.
  • I should think about code quality and maintainability before i write a single line of code. It is tough things to get right at first, but with hard work i could achieve this.
  • Having good understanding and relationship with the people i daily work with is important. It is must to have a smile on my face.
  • I must have fun with what i do. Period!

This Could Be Some Plan

I recently read a blog by Jeff Atwood that there is no such people as Rock-star programmer.These are people who could write cleaner code, refactor faster than anyone else, write a lot of tested code and methodology. This means each of one has a scope to get better as a developer.

I am in my first software development job and there is a lot of scope for me to improve and get better.

Obviously this is not going to happen overnight and i need to work hard to achieve this.

Here is my plan:

  • For JS server side read Madhu’s code and learn.
  • For JS client side read Ruben’s code and learn.
  • For Python read code from good projects like django.
  • Write loads of code in NOSQL goodness(MongoDB).
  • Incorporate good software development practices.
  • Have a good foundation with algorithms and space-time complexity.
  • Acquire a good grasp at the theoretical aspects of JavaScript and Python.
  • Write a lot of tested and RESTFul APIs.
  • Write tonnes of open source software.
  • Spend an hour at IRC everyday.
  • Work on a crazy project that is impossible to achieve.
  • Work more on Automation and deployments.
  • Estimate, organize and plan my work well in advance.

Well, these are kind of my strict TODO list. At this moment, i think i have a decent understanding of technology and software development process. But, i am far from being a really good developer. There are loads of things to learn and i am really excited about the process.

Work Ethics

Work has a really important part in anyone’s life.These are some of the things i feel is very important part of one’s professional ethos.

  • Arrive on time.
  • Think logically before you make any decision.
  • Keep the communication lines open.
  • You are facing a difficulty admit it, don’t let your ego come in between.
  • There are always things that could be difficult, persistent hard work is the only way to crack them.
  • Don’t fall victim of easy goals, work with full passion whatever you have decided.
  • Don’t think much about other things, just concentrate on your work.

##Most important things:

  • No work is a small work or less important, everything teaches you something new.
  • Life to too small to waste on less important things.
  • Keep your mouth shut when you don’t have something useful to contribute.
  • Read books, improve your skill.
  • Challenge your limits.
  • Read well, write well.

What is on my mind?

These days i had a great time working on some pretty good projects in both office and home. I will talk about my personal projects for obvious reasons. Well, the primary goal currently is to fix the existing projects, test them and add CI support for all of them.

This is single most important thing as of now as these measures improve the code quality.

Also, i am working on different projects and languages so it might be little tough to adapt and plan my work.

Here is what i have planned.

How to get things done?

  • Work in sprint of 30 min + 3 minutes break. ( No distractions+ no phone calls+ no messaging) Do all those in this 3 min break.

How many of these sprints?

  • 16 of them in a 9 hours office time. with 18 breaks in between. Be religious about the count.

When to plan a day and how to plan?

  • Plan one night before the day and also give priorities to new issues or request from Bitbucket, Github.

What shouldn’t be done?

  • Useless arguments.
  • Dart Games.
  • Facebook.
  • Twitter
  • Time-pass stuff in Skype.

How to track my day and goals:

  • Use toggle religiously and also Use Omnifocus.

  • Omnifocus

For Goals as Projects:

  • Milestones as an abstraction of the the strict todolists:
  • Todo Lists could be the Github Issues. Such links could be passed in the omnifocus App.

##Home schedule:

  • Morning : Gym + Breakfast

  • Evening: Dinner + 3 hours of self study in the same time + break as work.
  • Learn something new or re learn something that you forgot.
  • Experiment as much as you, Think, brainstorm. Write every idea that comes in your mind. Create an issue of the idea.

Learn, Work, Debug, Iterate!

My Current Projects

These days i was busy working on an a project called as Node Twitter. As the name suggest it is a twitter clone written on node.

Right now it has following functionalities:

  • Login via Facebook and Github
  • Tweet Add, Modify, Delete
  • Comment on Tweet
  • Favorite a Tweet
  • See own and another user’s profile
  • Follow another User

###Here are some screen-shots:

I am also planning to add all other features present on twitter one by one. Next would be dashboard(timeline), personal profile, retweet and hashtags.

These features might seem simple but most of them are not that simple and requires some good effort. Anyways, you can test it here:

$ npm install nwitter
$ npm start

Then open your browser and open http://localhost:3000.

Good Week Gone By

This week is going to be a particularly good one. I am implementing twitter clone in node.js. It is a great exercise to just take a look at something trying to guess what is going on behind the scenes and reverse engineering it in a different stack.

Well , the basis of attempting this is that a lot of rails devs are shifting to node and a lot of design architecture in node is being borrowed from rails. Say “Fat models, thin controllers.”

I will be posting about some special code segments and problems how i tackled them in future post.

Going to sleep now. Ciao!

My Setup

I am doing The Setup interview for myself. It is basically based on these four questions:

  • Who are you and what do you do?
  • What hardware do you use?
  • And what software?
  • What would be your dream setup?

So here it goes:

Who are you and what do you do?

Hello, I am Vinit and work as a software developer at this awesome Dutch startup,Changer. I mostly write code in JavaScript and Python.

What hardware do you use?

I use a Macbook Pro, Mid 2009, with 8 GB Ram and 256 GB SSD. I use 30-inch BenQ Monitors, apple wired keyboard, Logitech GT400 at work. At home, I have a 22-inch Dell monitor with same keyboard and mouse. I use Steelseries Headphones for listening to Music. For storage and backups, I use a Western Digital 512GB Hard disk.

I also have an old Dell laptop with Windows7 and Ubuntu on it.

I have a HTC Desire X as my headphone with Android Jelly Bean. I like this phone a lot and it does almost everything I required without burning a hole in my pocket.

And What Software?

I use OS X Mavericks as my primary operating system.
Well here is the list of Software I use:

For writing code, I only use Macvim. For browsing I use Chrome, firefox, safari and IE (for testing mostly on VM). For running other OSes I use Virtualbox.

I love Dash. They are really awesome way to read documentation of various stacks.

For tweeting I use default twitter client on both mac and android. I think they are pretty good.

For music, iTunes suffices though I do listen to Winamp too.

My shell consists of a highly optimised Zsh configuration. For Django related work I use PG Commander to view databases. For time tracking I like toggl(https://www.toggl.com/).

What would be your dream setup?

My dream setup would be couple of Big 30-inch monitors. I would also love a room with library and a nice dark corner to work.

Single Machine Work-flow

##benefits

  • More focus, less distraction
  • personal
  • Skill developed for handling lot of things in less resource effectively.
  • Get better in typing and using mac more productively.

###How to:

  • Use 75% to 100% code window in sublime when needed.
  • Use full browser window
  • Music and everything else is minimized.
  • Distraction free mode in sublime when required.
  • Use different desktops for coding, shell and browser.

Refrain from these:

  • Don’t use a monitor to break this rhythm.
  • Don’t use a monitor unless you need to show something that can be shown in laptop.

New projects

In last couple of days, i noticed there was no good planning for my personal projects and there were lots of loose ends. So i finally cleaned up my Github.

Here are some of ground rules for projects on Github:

  • Don’t open source a project until the project has got unit test, wikis and sample application (if it is a application project) hosted.

  • Integrate CI like travis and jenkins with all of them.

  • Do all the immature , experimental projects on Bitbucket.

  • Write good, clean , pragmatic code in the projects on Github.

  • Look for bugs and spend more time on projects seriously.

  • Strictly follow Git-Flow on all your projects.

Blog about your latest work or maintain the wiki for the project every work. At the end of week review your work.

Django plugin open sourced

There are lot of useful plugins for Django CMS. Well, this plugin let you use the images from a Facebook Album. Currently it supports fetching images from Photo Album of a Facebook Page.

All you need to do is to put Facebook Album URL, Access-token and the album name in the plugin fields and you will get a nice thumbnail in the intended place and once clicked big images will open in carousel effects. Sounds nice, take a look at the screen-shots below.

  • Entering the details in plugin form:

Admin Page

  • Thumbnail view of plugin:

![Small View] (http://vinitcool76.github.io/imagessmallview.png)

  • Image slideshow in carousel

Carousel

#Installation

Installation is dead simple. First start your virtualenv

$ workon sample
(sample)$ pip install cmsplugin-fbalbum

You might need to do this if you are getting some sort of database error.

python manage.py syncdb
python manage.py migrate

In case you face any problems, file issues and if you want to contribute take a look at the existing issues and send a pull request.

Django plugin and Google command line project open sourced

Maintaining and contributing to an Open Source Project is a very important part of a developers life. Luckily, i am in a Company that gives me full liberty to contribute and in fact we have a Open Source day(Friday) where we could open source reusable components of project we have been working on to the open source audience.

This is plain awesome, because not only it encourages a healthy culture of giving back to the community, also it improves the overall quality of the project as you just do not open source anything without getting it better.

With that said, I have open sourced two of my projects:

cmsplugin-fbalbum:

This is a django-cms plugin that gives the end user to showcase the photos from their Facebook album without going through any code. Just enter the album name, album URL and access-token and you are good to go. It is also available to everyone on pypi, In order to install just do:

pip install cmsplugin-fbalbum

It is under heavy development and still in beta, but can be used. Any sort of contribution is welcome.

googlecl:

It is another dear project of mine, it was previously being developed by Google Engineer, Tom.H.Miller. Since he is quite busy nowadays and could not contribute actively, I have decided to maintain this project on GitHub and add features/bugfixes and refactoring.

I am happy to have these two projects in progress and will open source more of my stuff in future. Though i regret not blogging that often these days.

My First flight

So finally, I am going for a week long vacation and it has finally begun. On Air India flight to Delhi and From Delhi to Ranchi. Well this vacation is special for a lots of good reason. First of all, this is my first flight. Also , this is first vacation since i have started working at Changer Technologies, Pune.

I have never been to Mumbai and Delhi before, so this trip i will be visiting both of these places. It has been so long since i have been at Home and out of everything i miss my home’s food and family the most.

Well, according to me there is just one way to live life and that is to live life to fullest. Work hard, and go on vacations. Spend good time with family and friends. There are not many chances we get to do those in a lifetime. So, life it to fullest, while it lasts.

Twitter in NodeJS

I am thinking to make a twitter like application as a learning exercise to get better at node. It will on usual nodejs based stack, since i am actively learning that now. More details will be blogged as i progress.

If you are interested to collaborate or discuss, contact me here Edit: I completed the node app in twitter. It is on my github. You could check on my github.

@vinitkme

JavaScript is super awesome

I started programming JavaScript seriously in September 2012 and i never ever wondered that it will affect my life so much. Well, it started with me working on developing a Chrome Extension for a E-commerce/Social media app. Chrome is quite different for development. There are lots of APIs to learn and there are quite a few security restrictions. Also, there is only one language that you can use to develop it i.e JavaScript.

There are quite a few things i learned programming JavaScript:

  • Think before you code, think about the whole problem at once.
  • Keep code clean and use modular structure.
  • Use Linting and follow good guidelines given by experts.
  • Read some good books and be aware of what you are into.

Today i work as a Software Developer at an awesome Dutch startup Changer.

Linux to Mac

A lot of things have changed recently. I converted from a hardcore Linux user to Mac lover. I got a high end Macbook from Office.

There are quite some reasons for my fondness with mac :

  • The OS X is quite good and amazingly stable.
  • UI and UX is quite good once you get used to it.
  • Almost every applications and tools under the sun is available to you.
  • No messing up with hardwares, just connect and play.
  • Awesome battery life, i could easily get 8 hours battery backup with this sweet machine.
  • 13-inch is an awesome form factor.

Also, i recently got myself a HTC Desire X Android Smart phone. It is a lovely piece of hardware. Not big or bulky. At 4-inch screen i have enough screen estate to do whatever i can do. Camera is good as well. All together i am quite satisfied with my phone. Did i mention Beats Audio? It is an excellent addition to my phone. I spend quite some time traveling to office and it seems to be a great feeling to listen to music while traveling.

Though i still love my 2 year old dell and Nokia E5. Some repair and polishing is required and i will sure give them their due in right time.

I love my hardware and doesn’t everyone else does too.