Tuesday, September 22, 2015

An idea for Grofers

I just got an order delivered from Grofers. It was the second time that I used the service and I already know what I like about it the most. It makes me feel less guilty.

No, I am not the fat, lazy husband that they depict in their ads, feeling guilty about not contributing to the household work. I am an individual who is conscious about the excessive use (or should I say abuse) of plastic bags in our daily lives.

I generally try to avoid using plastic bags as much as I can and am mindful of when I end up asking the shop for one. Most of the time, it when buying groceries that I end up asking for a plastic bag. I have thought about why this happens and it mostly happens because most of my grocery shopping is unplanned spur of the moment thing, which is why I am not always carrying my own bag when I end up at the local kirana store and end up asking for one.

With Grofers, the spur of the moment shopping happens on the app rather than going to the store. And they deliver the goods in nice environment friendly bags. So when the bread and eggs they delivered today did not come in a plastic bag, I was happy. The one use case, the spur of the moment grocery shopping, where I invariably ended up using plastic bags, now had an alternative user experience where I could get what I wanted within a reasonable time without having to use plastic bags. I used the term user experience because from a design perspective buying from an app should be as friction less as buying from a grocery store.

However, as I emptied the environment friendly Grofers bags, I realized that I already had the couple of bags stowed away from the last time that I ordered and that I really did not need the bags from the second order. It made me wonder, why does Grofer not take back the bags and recycle/re use them. I mean the delivery guy is right there and I could have handed it to him. Environment friendly is not simply less plastics but also recycle and reuse. Perhaps, Grofers could hand out reward points to customers who return bags and thus encourage environment friendly behavior.


Monday, September 7, 2015

A Developer Switches from Windows to LAMP Part 3: Project Dagobah

The best way to learn any new language/platform/library etc. is to get your hands dirty playing with it. Build something useful , not merely a todo list, but something similar which has a utility, yet does not have a large scope in terms of use cases. But do it end to end: i.e. don't just have a working version on your development machine, deploy it to a server and make it readily available to the whole world. 

In April, from among the many ideas that I had, I chose to build a tool which would help you number your tweet storms. Even this phrase "number your tweet storms" is a result of multiple revisions. I did not even know what a tweet storm was back in April! Of course, there was a massive and a much needed break from mid April through May as I went back home for my sister's wedding and then went on a trek to the Himalayas. So I really started work on this in mid June after I was back in Bangalore. I will write in more detail about how I went about developing it, but right now I want to announce the first release of TweetSmart. As of today, it is only a web application. But very soon I hope to have built it into a chrome extension as well as an android app. 

This post, however, was not meant just for the announcement of the release of the app. It is meant to be a high level recap of my experience developing and deploying my first app on Linux, or to be more specific, Ubuntu. 

I originally envisioned TweetSmart as only a Chrome extension. Thus I started with Getting Started with Chrome Extension Development. Building a simple Hello World extension was easy. But I now wanted to build the TweetSmart compose box and that meant a a lot of javascript code. An immediate choice I had to make was to choose a javascript framework such as Angularjs, Emberjs etc. to build this. Having a bit of experience with Angularjs I was inclined to choose Ember but had heard a lot of good things about React. I decided to spend sometime familiarizing myself with React and understand its benefits. In the process I learnt about Flux as well. The uni-directional data flow in Flux architecture made sense to me. I also read many posts by people who were astonished by how much cleaner their code was due to using React and Flux. So I decided to proceed with Flux+React and not get bogged down by trying to make the perfect choice of framework. 

Till now, the choice of Flux+React has nothing to do with developing on Linux. I could very well have developed this extension on a Windows machine while using React+Flux. However, the first place that the difference becomes apparent is the choice of the IDE. On Windows, I would be using Visual Studio. On Ubuntu, I had started to learn Vim and thought the terminal and vim are going to be all that I need to code. However, a very important aim while coding is to be fast - i.e. use tools and extensions for productivity. E.g. you can significantly reduce the number of keystrokes in Visual Studio by using code-snippets for common code constructs such as if-else, function(){} etc. I am sure expert vim users would know a way to do that in Vim, but as a newbie, it was taking me time. 

As it is important to ship the MVP as soon as possible,  I looked at options where the learning curve was slightly less. Interestingly, Microsoft had just come out with Code, a new code editor for all platforms, but since it was pretty new on the block I looked at other options - Atom from Github and Brackets from Adobe. Both of them are very similar but it seemed Brackets had a more active plugin development community with much more plugins, which made me select Brackets. 

I felt at home with Brackets and quickly started adding code snippets which I would use frequently, such as rcc for React.createClass. I also installed plugins such as Emmet and Beautify to speed up coding. However, as I later realized, since I was using React, the Emmet plugin did not prove to be very useful there.

Next, I wanted to set up a local web server and chose Apache over nginx for some random reason I don't even remember. However later on, as I was building an API using expressjs, I had to use node behind an nginx server and thus I ended up using nginx and removed apache. I did this on my local system as well as my production server, a micro ubuntu instance running on AWS. It was a nice change from using the Inetmgr to configure the IIS, though not without issues. 

As I realized that to integrate with twitter I would have to build my own api, the question of which framework/language to use came up. The options in my mind were ruby with sinatra and python with flask. But I had a conversation with a friend who suggested to go with node and expressjs. And I happy that I did. 

So that is a high level recap of some of the decisions that were made when using ubuntu/linux. These might seem very trivial to many, but for a person who has been coding using the IIS, Windows, ASP.NET and Visual Studio, these were new choices which took a bit of time to research and arrive at a decision. 

I am definitely now more at home using ubuntu, desktop as well as server. I have much more confidence that I can quickly get up to speed with a team working on a variant of the LAMP stack.  I can only get better from here. 

Upwards and onwards. 


When learning something new

As a developer with some experience, many questions come up in my mind when learning something new. e.g. How do I write tests and automate builds? What are the shortcuts I can use to speed up my development? What are some expert level tricks that I can learn to churn out code faster?

However, it is important to realize that all of these things cannot be learnt in the first attempt itself. The goal should be to get the MVP out and not worry too much about learning everything there is to learn about the new platform/technology. That is because often, such information is not compiled and presented in one spot but is present at various blog posts, stackoverflow questions, google group threads etc. and one cannot expect to learn many of the tricks of the trade right at the beginning. It takes time and practise to become a master.

However, by not shipping the MVP a disappointing sense of lack of accomplishment/results starts to set in. This is very dangerous as this sometimes leads one to abandon the pursuit one had undertaken. And all the mighty tricks that one tried to learn on the way become useless and eventually forgotten, as one discovers when trying to take another shot at the failed project.

So, the right balance between learning and shipping has to be kept. Of course, I am assuming that one is working hard and that lack of progress in learning or shipping is not because of lack of hard work. But if you are in a dilemma, always err on the side of shipping. The motivation and sense of accomplishment that one gets after shipping can help speed up the process of learning as well.   

Tuesday, May 19, 2015

Posting from Android

I dropped my Lumia for the umpteenth time and after months of working on a cracked screen,  the device finally gave up and stopped  responding.  As I am currently travelling,  I did not have the time to get it repaired and this forced me to finally do what I have been contemplating for months.

I bought an android device - Xiaomi to be specific. I am quite liking the variety of apps on the play store.  I am writing this post using the blogger app while I wait for a doctor at a Dehradun hospital. This is  also the first time I am writing a blog post by swiping rather than the usual typing. 

Posting to this blog via the phone might open up interesting possibilities,  perhaps leading to shorter but frequent posts.  We will have to wait and see.  For now,  I am excited that I finally have an android phone which I can use for  developing apps.  

My trek begins this weekend and I am really looking forward to it.  Once done,  I look forward to getting back to finishing some of the hacks/mini projects that I started. 




Wednesday, April 15, 2015

A developer switches from Windows to LAMP Part 2 : Project Dagobah

It has been an interesting past few days familiarizing myself with Ubuntu. As I had written in my previous post, the best way to do this is, is to code a small project on ubuntu and make it live. The obstacles one comes across in the process really help in the learning process.  

I also intend to learn Android programming so I thought I would start first with a couple of simple Android apps. I downloaded Android Studio and unpacked it and was following the lectures of the Udacity course UD853 - Android Fundamentals. In the process, another simpler idea popped up in my head, to allow people to compose tweets of the form 1/n, 2/n .... n/n easily. This could be a nice Google Chrome extension. Since the idea is to make these hacks public, I also bought a domain. I bought another domain for my Android app idea as well. 

I always used ZnetLive to buy domains, but they seem to have made changes where for you to buy a domain, you have to buy hosting from them as well. This is a pain. So I tried GoDaddy to buy my first domain. But I found the domain control panel confusing and somewhat limiting for a person like me. I want to be able to make all kinds of changes that I deem fit. But many vendors do not expose all the options on their Control Panels, for fear that a noob user may end up inadvertently changing something that may cause issues later. I have faced similar issues with Znet and Yahoo earlier.

Amazon AWS provides an option to buy domains and since I intend to use AWS for hosting and its Route53 service for DNS management, I decided to buy the domain directly using AWS. The price of the domain on AWS per year was the same as on GoDaddy, but GoDaddy did provide a discounted price if you bought for multiple years. But for me the hassle of free experience of AWS is worth the discount that I am losing out.

After buying the domains, I decided to start work on the tweetsmart Chrome extension. I installed git and set up a git repository and successfully checked in a Readme.md file to the remote repository I set up on github. To make changes to the Readme.md I used vim and I realized that this was something new and I needed to learn this.

I spent time learning vim. For this I went through a few tutorials and also played the game vim-adventures.com which I felt was very useful in getting started with an understanding of vim and saved a lot of time for me.

However, when I eventually got to putting my learnings to practice I realized I had just touched the tip of the iceberg and that there was so much more to learn. For example, the simple operation of copy from a webpage and paste in vim is not easy. Being used to writing code in an IDE with Intellisense, I also wanted similar benefits in vim and came across this post which suggested some plugins to install to make javascript coding in vim easier.

The steep learning curve here makes me wonder whether I should look at alternatives such as Sublime Text. However I found quite a few blog posts where
the authors mention how they have been super happy learning vim and how it has made them more productive.  I have to admit that vim has intrigued me and thus I intend to spend more time learning it. Moreover Visual Studio also has an extension, VsVim, which allows for Vim key bindings inside Visual Studio.  Now that is an interesting proposition to be tried in the future. For now, I am learning vim and my next post shall be more specific to things I learnt about vim, the good and the bad.

Monday, April 6, 2015

A developer switches from Windows to LAMP Part 1 : Project Dagobah

One of the objectives that I have set for myself over the course of the next couple of months is to familiarize myself with *NIX environment and become proficient enough to make the switch to the LAMP stack. In the process, I am going to write down some of things which I learn.This is meant for my own reference and does not serve as a tutorial of any sort, though if you find the info here useful, well and good! Of course, I am calling this Project Dagobah, because as Master Yoda put it in his years of exile on The Dagobah System

"You must unlearn what you have learned"

The way I have decided to approach this task is to develop some simple app completely on the LAMP stack. I am not sure which is the app that I will end up building, even though I have a few ideas in mind. However, I have started by installing Ubuntu on my machine.My previous attempts at this involved using a Virtual Machine on top of Windows. That somehow never led to the progress I wished so I thought of being completely radical.

Installing Ubuntu was very easy, though I did view a couple of tutorials on Youtube before I started. I freed up about 40 GB of space on my SSD before I started installation. After installation, I went to Windows and checked how has the disk been used by the Linux setup. I found that Ubuntu seems to have created 2 partitions, a small one where some system level stuff has been put and another where other stuff goes. I wanted to see this on Ubuntu. For this I used the df command.



To capture the above screen shot, I used shutter. When I first tried to install shutter, the package could not be found, so I updated packages using the command

sudo apt-get update

It took a while for this operation to finish and it seemed to me that this should be done once on a new Ubuntu installation.

I had also googled for some Linux tutorials to familiarize myself with some basic bash commands and decided on the one here. I used wget to download the tutorial in my Downloads folder. In my Windows, the Downloads folder is at C:\Users\Shashi\Downloads and after downloading a zip file I usually copy it to D:\ and then unzip it. Since I just have one partition here, I just created another directory /home/works which I thought I will use as the equivalent of D:\.

However, I quickly realized the stupidity of this assumption.





By running the df command with the given path I see that /home/works is on the same partition. D:\ on Windows is a different partition. The one lesson that we learnt while playing with our systems back in our college was to keep the data on a different partition. If one has to reinstall the OS, and that used to be quite frequent back in those days, you do not end up erasing your data. Thus I realized that /home/works needs to be on a different partition. So I decided to partition the current drive into two. I would have ideally done this when installing but the screen where one gets to select the partitions did not show up. I spent some time trying to learn how to partition but I cannot find the tool for that on Ubuntu, Gparted.

So for now, /home/works will have to stay on this partition. I am not too worried about it at the moment as I have played a bit on Aws ubuntu instances with multiple partitions.

I then went through the tutorial that I had downloaded. I opened the tutorial html files from the terminal using

xdg-open

which opens a file in the default program associated with it.

I also came across this Youtube channel which I found has interesting video tutorials for people just getting started with Ubuntu.



Well, that was a start. Next, I have to decide on what app I am going to build and what tools to install to start programming. 

Sunday, March 29, 2015

Coming Back To Life

In the month of Jan, I visited this blog and thought its been a while since I wrote anything here. I was feeling a bit exhausted and low that day and perhaps that's why I spent some time reading some of my very old posts which I had written way back in 2007-08. It felt nice to read those and felt sad that I had stopped writing, specially since I had more to write about now than before. I was heartened to see the curiosity, inquisitiveness, wonder and simplicity that I had back then. Somewhere along the line it seems to have gotten lost. I drew a plot of the frequency with which I posted.

While there is variation between 2007 and 2011, 2012 onwards clearly has been a different picture. And understandably so. With more and more challenges at work, I was in a different zone and never really came to a point where I was in the flow to write. My blogger posts dashboard is filled with draft posts, including this one. So its not as if I never sat down to write, but I never really got in the flow to write and thus many of my draft posts are just one sentence with a headline. Now that I am taking some time off, I realize just how much of my mind was on other issues, both professional as well as personal. I am slowly trying to get back in the zone and getting into a routine, finishing off things which are a distraction (taxes etc.) and trying to focus on my health as well as other things that matter.  One of those is writing. It was so nice to be able to read how the 25 year old me saw the world as well as how the world was at that time. I wont be able to do that 5 years from now about the 32 year old me, if I don't continue to write. Also, writing needs practice and it is a skill where I seem to have lost a bit of touch. So hopefully, with this, I get some practice and discipline going! Cheers!