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.