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!

Sunday, April 13, 2014

Focus

Take your time figuring out what is your next mission. What is the objective? What are you targeting? Know the constraints within which you work. Think about the calculated risks you would want to take.

And once you have a picture where you think you can proceed - START and FOCUS.

Weed out the things around you that distract you. Even though it may seem counter intuitive. Just focus on reaching your target.

You try and you fail - but the failure is the worst when you did not focus, because without focus you will not be able to identify the finer points that lead to failure. That closing of your eyes when the opponent hits a ball for a smash while playing ping pong, resulting in you always losing a point on smash. You missing plucking the 5th string while strumming the guitar, wondering why doesn't your strumming though good, doesn't quite sound the way you want it to.

You will identify these minute but important lapses, only if you have focus.

Otherwise, you can keep trying and keep working hard, but you won't make much progress.

So focus - try and repeat. Keep at it. You are getting better!

Wednesday, August 21, 2013

The impact of Babajob

Just heard this story from a friend of mine, Raj.

Raj's friend wanted to discontinue the services of his driver and asked him to stop coming to work. The driver taken aback and worried about his future asked for a month's notice to search for a job. Raj when hearing of this, suggested the driver to register on Babajob.com so that he will be able to search for driver jobs.

Within a fortnight, the driver had multiple job offers and took up an offer at a business which was paying him 14,000 per month plus food. This was a significant increase from the 10,000 per month that the driver was earning. The driver, Raj told me, was super happy in finding such a better job so easily without running around too much.

It was heartening to hear this story from my friend. In our day to day work, keeping the servers up, fixing bugs, developing new features etc, we don't always get a first hand account of the impact of the work that we are doing. One of the goals at Babajob is to create a radical efficiency in the informal job market, so that people like that driver also have the power of easily searching and finding jobs which they like.

To talk about such goals is one thing. But to hear a story from someone, that your work is indeed making a difference, is just simply amazing.

Sunday, July 28, 2013

A feature request for Web Based Email

Its July and the last to file IT Returns is around the corner. My bank emails me the bank statements every month, so to look at my transactions for the past year, I am trying to download all the statements for the last financial year from email.

I was able to select all the emails for last year which have the statements as an attached PDF. Now instead of going to each individual email, I want to be able to download all the attachments from the emails that I have selected.

This does not seem possible right now. You can download all attachments in an email but not across emails.

It would be great to have this.

Tuesday, March 5, 2013

What I thought of when buying a cycle?

Cycling was something which I enjoyed as a kid. Even though I had the option to take the bus, I sometimes rode to school on my Hero Impact. It was fun. Even in Manipal, where either you had a motorbike or you walked, I was among the very few who tried their hand at cycling. So back in 2010, when I used to work out of Jaaga, I was inspired by Deepan of Hashcube, who went on long weekend rides to places like Ooty, Mysore etc.

I thought, I should buy a cycle sometime. Having joined Babajob in 2011, I was in a slightly better position to buy a cycle.  I was thinking of buying a Hero Hawk or some other simple geared cycle. I thought the max I would spend on my cycle would be 6 grand. Surely, I could not afford anything more expensive than that.  So I started asking around - which one should I buy?

Random cyclists I met on the road at the traffic signal, or outside a snack shop etc. all suggested to go for a good cycle.  "You mean like Firefox, which is about 9 grand?" I asked. "Well it depends on you, but I would recommend to go for something better. It may cost you, but this is a one time purchase. If you think you will start with a low end model and then move onto a better one later, that will just not happen. You will never get started with a low end model. Your enthusiasm will fade and you will give up." Hmm..now that was the response I had heard from three random strangers, so I started giving it a thought. Maybe I could increase my budget a bit.

Then one fine day, I got a call from Ram of Hashcube that he was going to buy a cycle. I said, I am coming with you. He was buying a TREK 3700 MTB from BumsOnTheSaddle (BOTS as its popularly known). I said, well I will go with the same. Basically, I trusted Ram's judgement and if he was spending 19 grand, then the cycle must be a good one. But the question which I still had at the back of my mind was, how do I justify spending 19 grand on the cycle?

So I started doing some calculations. I used to spend around a thousand rupees a month on petrol at that point of time. If I stopped using my bike, I would be saving 1000 rupees a month. That's 12,000 in a year and 24,000 in two years(not accounting for the rising cost of petrol). I also knew that sitting in front of the lappie all day is not good for my health. I did not feel energetic and at 28, the body needed at least some exercise. In the past, I had tried but failed miserably at putting a disciplined exercise regimen as part of my daily routine. I was just never able to sustain it. I had been thinking of joining a gym to force myself to go. After all if you have put in money, then there is some motivation (or should I call it shame) for you to go? A simple gym membership at that time was costing 1200 a month for a one year membership. So that's 14,400 a year. Hmm.. so if I don't take a gym membership for a year and don't buy petrol for a year then I can basically recover the cost of my expensive 19 grand bike in a year!

This deal now seemed pretty interesting. I decided to go with it and bought the bike. Yes, I had been frustrated with the frequent punctures that I had to fix and yes, I ended up spending much more than 19,000 grand on the bike (helmet, backlight, frontlight, water bottle stand, pollution mask etc.) But for a year I did not buy petrol (not kidding) and I did not join a gym.

I am not sure if I was absolutely able to recover my investment by buying the cycle (Yes, think of it as an investment and have a strategy as to how you will recover it) but am sure by the next year, I
would have. I regularly cycle to work - its just over 7 kms one way, and go for longer rides sometimes on the weekends. I feel much more energetic and positive after cycling (though I guess that applies to exercise in general)

The important factors which helped me in cycling regularly were -
1) My commute time and exercise time were clubbed so I was saving time (which was crucial)
2) I worked at a startup, and thus could go dressed to work the way I wanted and at the time I wanted (avoid rush hour traffic) . It is cool to cycle to work.
3) It easily became a part of my daily routine as my flatmate started using my bike and thus I had to cycle or take public transport. 
4)  After getting in the habit of cycling, it was difficult to get out of it.
5) The commute to office was not much (7-8 kms) and I was able to take side roads to avoid traffic. Also it took me just 8-10 mins extra on the cycle as it took me on the motorbike.
6) The Bangalore weather! (of course!!)
7) I loved it.

So as the prices of petrol shoot up, and you think that its time to give cycling a try, I thought of sharing my own experience so that it helps tilts the scale in favor of your bumsonthesaddle. :)

Cheers

Wednesday, January 2, 2013

A simple convention when hosting multiple sites locally

 

Firstly, A very Happy New Year 2013.

I wanted to share a sort of a neat trick/convention which I use to make my life easier when I am hosting multiple sites locally.

Suppose you are working on multiple web applications on the same desktop/laptop. Apart from using the built in Visual Studio Web Development Server, you would typically host your application on your local IIS as well, lets say for easier automated testing on your system.

Suppose you are working on two web applications which are hosted on the domains, earlyadopter.in and imadeitcount.com. Now you want to host these locally on your IIS as well. The typical approach would be to add an application to your IIS so that you may access these sites running locally through your browser by the following urls:

http://localhost/earlyadopter/

http://localhost/imadeitcount/

There are cases I have encountered where this has made life difficult. For example, if you are paring your url, you would have to do it differently for your localhost and for your actual production site.

What I do nowadays in these cases is that I modify the hosts file such that the following domains point to 127.0.0.1

http://earlyadopter.local

http://imadeitcount.local

Now, I can have as many local web applications without worrying about localhost.

What do you think? I think there may be better solutions out there, so if you know, please do leave a comment. I am also not sure how this would apply to LAMP stack solutions, so again, please do leave a comment if you have any insights on that end.

Cheers