Developing Your First Android Application with IntelliJ IDEA on Ubuntu

Developing Your First Android Application with IntelliJ IDEA on Ubuntu
Developing Your First Android Application with IntelliJ IDEA on Ubuntu
If you are a programmer or have just started learning programming and you are loving the Smart-phone technology, then you would definitely love Android Programming as Android is the Future of Mobile Technology. If you know Java than things will be lot easier to learn. Although people with knowledge of other Programming languages can also learn it easily. You just need to enjoy it, because Programming is Fun and to create something makes us feel great, no matter what it is and Android makes it more beautiful.

So lets start with developing a basic android application with IntelliJ IDEA  which is an official Android IDE. Most of the tutorials on Internet are about using the Eclipse IDE, but IDEA is better in terms of performance as Eclipse really slows down the system. But an IDE should not be a constraint for you for developing the application. So if you enjoy working on Eclipse, you keep going with it. But try to work on IDEA also, you can feel the difference.

Let start with developing our first application on Ubuntu, but before that we need to set up the environment for application development. Two basic platforms required for starting Android Application Development are:

1. Java SDK:       You can get it Here
2. Android SDK: You can get it Here

Follow the required installation instructions to get the system ready for Android Development. You can skip the Eclipse ADT plug-in part as we are Using a Different IDE. Once you are done with the Required platform setup, you need to install the IntelliJ IDEA IDE which you can get it Here. Since we are working on Ubuntu, you need to get the Linux version of the IDE. Download and Extract the requited gz file and then inside the bin folder, run the idea.sh file to start the application. You should see the page like this:

Click on Create New Project and the following should be displayed.


Click Next and you should see below Screen. Enter the Project Name as shown
 and Select Module Type as Android.

  

Click Next and you should see below screen and by default create Source directory radio button should be selected. Leave it as it is. You src directory will contain files related to the application source.


Click Next and you should see below screen or before that you could one more screen where the application will ask for JAVA SDK path. Select that path and after that you have to select path for the Android SDK path which you can see in the top in below screenshot.


You should be prompted to select the SDK path as shown below:


Also in the previous screen-shot you can see the option for selecting the Target device where you will run your application.  We will be using the Emulator to run our application. So we will create a Virtual Device to run the application. A Virtual device is same as Physical device and it will show us the behavior of the application on the physical device. Select Emulator and click on Prefer virtual Device selection box to create the Virtual Device. You should see screen like below:


Give your virtual device a name and target platform for which you are simulating the behavior. After adding the details Click Create AVD and then you can choose the created Virtual Device in the Emulator option and then click Finish. You just created your first Android Project. :). 

Under Project Explorer, you can see the Project just created. And Click under src directory, you could see that the package created has the activity file created automatically, which is the main file for your application. 


Click the Green arrow button on the top to run your application. The IDE will launch the virtual Device and will run your application and the output should look like below.



Your first Android Application is ready!!









Why We Should Thank Google

Why We Should Thank Google

Google has changed the way we search things. Now even for physical things we expect Google to search them for us. Like, If we loose keys, sleepers, clothes we ask ourselves why can't i Google it. From the time Google presence is known, its is evolving a lot faster and helping us evolve too. If Google is growing then it is helping others grow too, whether its affiliates program for earning or things related to learning, Google has always come forward in the best way it can.Can you image the situation if Google Search had been paid and you are paying them for every search they are making for you?

I believe Internet Would not have been so much fun or a knowledge repository as it is now. Before you get indebted completely to Google I would like to delineate it with some solid reasons which i hope you too would agree.

1) As of now, Google Free Translate Service can translate in 64 languages. It means your thoughts on Internet can reach to the remotest person in this Universe who has no Idea about your language, or you can put your thoughts on the net in your language and let Google take care of the travel part in any language people want to read it.

2) Google AdWords and Ad-Sense etc. kind of affiliate programs are making Millionaires out of kids in the Garage and they don't have any kind restriction on anyone, and so who ever has told you that you can't be anything in life and you are good for nothing, let your skill speak openly and if they are good, people will reach you eventually and you can make dream life out of it.

3) Every Year Google organizes Coding Competitions where minds from all over the world participate win lots of Cash Prizes. Google is helping programmers to create and innovate and and also contributing to Open Source Development at the same time.

4) Google started the whole Social Networking thing with Orkut. Although we are into Facebook world today but there was a time when Orkut was a way to meet our old lost friends and get to know the new ones.

5) Google books or Google Digital Library is another innovative concept where Idea is to Index the book contents and so that people can find the relevant books and can determine the usefulness by citations from other books. Also Google Docs and Spreadsheets are there to share you knowledge and can be accessed from any where.What else do you want..

6) With Google Maps and tools like Google Earth you can never be lost. They have data for almost every place in this world and even if you are alone in this world roaming around, you don't need much guidance to search a place because the maps are self explanatory. Also Google Earth has installed satellites which help in recovery effort for areas impacted with natural calamities like earthquakes etc. which indeed is a great help.

7) Google along with other companies started Open Handset Alliance which shares a common goal of fostering innovation on mobile devices and from that day Android has changed the Mobile Market completely and today it is giving tough competition to Apple and being and Open Source, pulling the shares slowly towards itself. Also the end user is getting the best smart-phone technology at a genuine cost.

8) Google is also investing billions in Green Energy Projects showing their concern towards greener and cleaner environment.
You might argue with many things and your opinions may be different but the way Google took everything forward with Innovation and creativity and putting effort in taking Genuine things up is commendable.
And that is just an overview what Google has given to this world. You can call it a Business or whatever you want but i would love to be a part of such Business where life is Fun and i would like to thank Google for everything they have done and hopefully will continue to do in more years to come.

Basic Unix Shell Script: A Tutorial

Shell Scripting is underlying core of Unix Operating System and if you haven't experienced the beauty of command line or shell interface of Unix while using that OS then you haven't seen Unix at all. Unix Shell Script can make your task much easier and fun at the same time as you can modify the way you want it to and you don't have to depend upon particular software do that work for you.
Why do we need a Shell Script for. You have a set of commands which you want your computer to perform and since you don't want to type one by one you combine all the commands in a Single file and you call it a script file and when you run it, Unix shell will run those commands in Sequence. Well it is just a basic to understand the Shell Script in Simple terms. But There are great things that Shell scripting can do and my aim is to make it fun while understanding it so that we will picture it easily in our mind. 


I'll try to write in a way so that any Layman can get it. It feels bad to see people stuck to old Windows system though I don't deny the User friendliness of Windows(because we have been using them from long), but one should try working on Linux or Unix System once and then you'll see the real beauty and power of using Open Source Technologies. If you are quite new to Unix System and just trying learn the Shell Scripting and you have Windows system installed, don't worry, you don't have to format your Windows to install Unix. Just install Virtual Box in your system  which you can get it from here, and install the Guest operating system of your choice.

You need to do the Following:


1. Install Virtual Box Software ( Its Free and Pretty Good)
2.Download Unix or Linux Flavor like Ubuntu,Fedora or Suse etc.. as per your choice(For a starter I would suggest installing Ubuntu.)You can get it from here
3.Install the Guest Operating System in your Virtual Box.

You also have a Choice to use the Windows based Unix Shell Script software to run the commands but i would suggest to install the Linux OS and enjoy it.


A basic introduction to Unix Shell before starting with Shell scripting is that a Unix shell is a command-line interpreter or in easier way its like a Language interpreter which you need when you don't understand any Language. So Shell helps interpreting our language to a Language which Computer understand and work as we command. There are many Shells available in Unix and if you want to go in depth about them you can get it here


We will use the basic terminal to run our shell script and if you want to know a bit about installing some software's in Ubuntu you can check it Here


Ok, lets start discussing scripting right away and we can talk about the commands used in the script on the way. Let's say you login into your Unix Machine and you want to check that how many people are logged in today. We will use different commands for that like who, date:
who: This Shell command tells us how many people are currently logged in. (Just For your Information, Unix is a Multi User Operating system so multiple users can be there at a time and if you are an administrator you may want to check who is currently logged in). The Output of this command is something like this   
pc       pts/0        2012-07-07 23:04 (:0)
Where:
pc:User name of the person Logged in.
pts/0:The Terminal Name of the User from where he is logged into the Shell.
2012-07-07 23:04Date of Login and the Time When User Logged in.
(:0)Terminal from where he is logged(Could be a Remote Machine Also)

Unix uses a system of Pipe where and Output of one Shell command can be used as an Input for other Shell command. You can compare it with multiple Garden Hose pipes tied to each other in a way lie water coming out from one end is entering the other hose pipe. How you want to use that output depends upon you. Like in the above case we need a total count of people logged in and so we apply pipe to our who command like this :
                                                  who | wc -l
Where :
 wc: Word Count and since we want to count the lines as each line tells us the user logged in so we use and option of word count i.e. -l . 

Unix shell give us another beautiful feature of using the options to further tweak the output we want to see. The point is, we need a direct answer to our question rather than all the options which a Unix command is giving us and so we use options and filters etc. And when you run the above command in terminal you'll see the output as number( Number of Users logged into you system) So in above case it will be 1.

Other Shell Command we will use is:
date: It's quite clear from the name itself what it will display and its output without any filter looks like this:
Sun Jul  8 09:06:19 IST 2012
Now lets combine the above two shell command and put them in a script file so that you don't have to run them individually. We will create the file first and you can create that through Unix Shell itself using cat command. Its executed as:
 cat > <file name>   


Name the file whatever you want and run the command like:
                cat > MyFirstShellScrpit.sh
I have put .sh in the end for my understanding that its a shell scrpit file. You can choose not to put that extension but i suggest you should do it for future easy reference. After running the above command you will see that terminal is just showing a blinking cursor which means its waiting for you to add the contents to the file you just created. So we will enter the commands we discussed earlier and its like this :
cat > MyFirstShellScrpit.sh
who | wc - l
date
^d
 ^d is used in Unix Shell to tell that its the end of file and please go back to the prompt. And Bingo your first shell script file is saved and ready to run. But before running a shell script we need to make it executable also like we have and .exe or .bat file in windows. So type in Terminal
chmod +x MyFirstShellScrpit.sh
Where : chmod is a Unix command which tells to change the mode of the file. There are three modes of a file which are read, write and Execute written as r, w, x and + means that I want to add this mode to the file( so - means remove that mode). So the above file will make it executable. We can run our shell script now. And we run it as:
./MyFirstShellScrpit.sh
 And the output should be:
1
Sun Jul8 09:06:19 IST 2012
 Congratulations. You have just run your first shell script. So every time you feel like checking how many users are currently logged in, just run the script and bingo, count of people with date will be there on your screen. 


Lets do one thing more to make this script more useful. You want to track the total number of logins on that day for a particular month so its better to save it in a file also. So we do something like this:
./MyFirstShellScrpit.sh > data.txt
 (Where > operator will send the output of the shell script to the file data.txt and if that file doesn't exist , it will create it automatically)
You just need to be a bit cautious with it because if the above file exist already it will overwrite all the contents without giving any warning.
So how to keep adding the data everyday. For that we use the shell script as:

./MyFirstShellScrpit.sh >> data.txt
Where >> means that append my output to the previous output which is there. So check the file data.txt after a some days you will see something like this:

1
Sun Jul  8 09:06:15 IST 2012
5
Sun Jul  9 09:07:19 IST 2012
4
Sun Jul  10 09:07:19 IST 2012
The output will vary as per number of users logged in at the time you checked. So its like you want to track how many people were in office at around 9 a.m. logged in, this basic command will do the purpose.

This is just the basic and you could see the beauty of simple shell script.

We Bought a Zoo: Movie Review

Have you ever thought of buying a Home and turned up buying a Zoo? Sounds a bit weird? But its true and the true story is turned into a beautiful movie which can make you cry with tears of happiness. The simplicity of the characters portrayed in the movie is its best part and that's what makes it a good watch for all ages.
Its a story of Benjamin Mee(Played by Matt Damon), a writer, father and a Husband who is trying to start his life over after his wife died in an accident leaving him with his two kids, a beautiful daughter who as per my understanding is the smartest girl in the movie and a son who is not happy with him and they don't get along well with each other.


While searching for their new Home, they came across a place which they liked and it turned out to be a zoo which was struggling to keep up. So being an adventurous guy by nature he decided to buy the place and thought of reopening it by getting it renovated with the help of few people left in the staff who are trying to keep the Zoo alive.


Its one of those inspirational movie which really teaches you to go and live your dreams. Yes you will face difficulties and hurdles but you will get through eventually because you care and you are ready to fight for it.


Matt Damon has given one of the finest performance and that too in way which makes you feel totally connected to the movie because it seems so real.Scarlett Johansson(Kelly Foster) as a Zoo-keeper has also done a commendable job though the whole movie belongs to Matt demon.


The cutest character in the movie is Maggie Elizabeth Jones. Her character, "Rosie" as a seven year old who is so excited about moving into a Zoo and the way she walks and talks can beat any cutest girl in this Universe.


There's a scene where the Real-tor tells that the house they wanted to buy is also a zoo and Benjamin stood there dumbfounded, Rosie Jumped up and down shouting "Yay!" will make you burst into laughter and tears at the same time.


There's one another scene in movie where an Old Tiger Spar is suffering from pain and Scarlet tells Benjamin that you have to let the tiger go and its time for him to be free. He can no longer take the pain. He can't talk but he can show it to you that he is in pain but Benjamin was not accepting it and like from the time his wife left him, he was never able to come out of it. He kept clinging to the past and he was not letting it go. But sometimes you have to let it go and its a good decision to take sometimes for a better future and that's what movie teaches you.


There are more wonderful quotes which kept the movie alive like one is :
Benjamin Mee: You know, sometimes all you need is twenty seconds of insane courage. Just literally twenty seconds of just embarrassing bravery. And I promise you, something great will come of it.
And Another one:
Kelly Foster: Talking to girls is easy. All you have to do is listen.
Although Movie is not that fast or any thing unexpected is there which keeps you excited about what will happen, but the simplicity of the characters is best about the movie. Its a nice watch with kids and your spouse and I bet you will cry once..


If you ever wanted to do something out of your day to day job and you need motivation, this is one stop for you. Enjoy...