Mac shortcuts

September 8, 2010

Recently i switched from windows to mac at home and the prime reason for this switch is , i wanted to develop for tiny,shiny little aluminium cased toy ‘iPhone’. First few days of Mac use is kind of frustrating since i have never used a Mac before and used Windows for last decade, i missed the shortcuts like win+D to see my desktop and win+L to lock the screen etc. Every time i felt like i missed a shortcut, i immediately google for the same to find equivalent key combination on Mac. I would like to put the knowledge that i gain from various forum at one place for reference, so this post is meant for aggregating the information that i find over google about the Mac shortcuts. Content of this post will be updated now and then. These shortcuts are applicable to Macbook pro.

  1. Page-up and Page-down on Macbook pro : function key + up/down arrow
  2. Deleting a line in xcode : control + k
  3. Screen shot : cmd+shift+3, current screen is captured and png image is saved to desktop
  4. Switch between iChat windows cmd+`

If you know any interesting and useful shortcut on Mac , just leave a comment.


IP address of android phone using ADB

August 3, 2010

Few days back i was doing a project based on TCP sockets for android phone and repeatedly needed me to know the current IP address of the phone using ADB. It is as easy as a breeze, IP address can be determined by using just couple of shell commands.

Android phone can connect to internet using one of the multiple available interfaces,  for example  it can connect over cellular interface,wifi,bluetooth, wimax etc ( haven’t seen any other interface till now, if you see any other leave a comment about it ). When phone connects using an interface , IP address will be assigned to it.  In order to know the available network interfaces on the android phone below command can be used :

“adb shell netcfg”

Output of the above command will be

usb0     DOWN         0x00001002
sit0     DOWN         0x00000080
ip6tnl0  DOWN         0x00000080
gannet0  DOWN         0x00001082
rmnet0   UP       0x000000c1
rmnet1   DOWN         0x00000080
rmnet2   DOWN         0x00000080

Current network interface used by the phone will have the IP address , in the above output rmnet0 is used to connect to internet ( UP signifies link is up and active in the above output ) . You can use the ifconfig command with the network configuration name to get the details :
“adb shell ifconfig rmnet0”

Output will look like this :
rmnet0: ip mask flags [up running]

Leave a comment if you know of  find a better way of doing the same.

Working with Android LinearLayout

June 1, 2010

Now i am officially started doing and learning Android application development. Started reading various hello world applications and tutorials from

Last week started with rather complex Notepad application tutorial which touches various concepts of android framework, like views,databases,passing extra bundles using intents,starting other android Activities for result and posting the data across the Activities using bundle extras.This Notepad tutorial consists of 4 or 5 exercises that you need to run through to complete the tutorial. I find it nice and very easy way to learn Android using these tutorials.Completed the first exercise and launched the emulator to test it, first surprise on its way, application crashes and “Force close” dialog is displayed on my macbook pro. I was not disappointed by this and continued to do next exercise in spite of the dis-encouraging   start, another surprise followed i couldn’t run the application and with low in spirits i stopped this Notepad exercise and started checking other tutorials.

You can find the notepad tutorial at

Yesterday started with linear layout tutorial , very easy tutorial but sadly nothing to code but just to modify the layout xml to arrange the views horizontally/vertically using “android:layout_orientation”, to specify the importance of the view using “android:layout_weight”. I find it easy to follow the most of the LinearLayout and TextView attributes explained in the tutorial except layout_weight.This is my attempt to explain the way i understood it.

a view occupies the screen based on layout_width, layout_height attributes. If view attributes value says to fill the parent using “fill_parent” it occupies the entire parent (width/height).By default layout weight for a view is zero. If layout weight is changed then the amount of real estate that the view occupies changes according to the weight. For example:

If there are two TextViews in a linear layout oriented horizontally

Layout xml snippet:

<?xml version=”1.0″ encoding=”utf-8″?>
<LinearLayout xmlns:android=”;
With the default layout weight views will appear like this
If the view layout weight is assigned a number then the remaining space in the layout is distributed according to the weight. In the above example if the first TextView is assigned weight 1 then the remaining space is assigned to first TextView and the views will appear like this :

If the TextView 1 assigned weight of 2 and TextView 2 is assigned a weight of 3 then the remaining space of the layout is divided into 5 parts and TextView 1 is assigned 2 parts and TextView 2 is assigned 3 parts. In terms of percentage TextView 1 gets ((2/(2+3))*100)40% of remaining space and TextView 2 gets ((3/(2+3))*100) 60% of remaining space.Resulting layout will appear like this :

That’s all for now! Feel free to leave any comments or suggestions .

Installing Android SDK on Ubuntu 10.04 LTS ( Lucid Lynx )

May 12, 2010

This post is to explain steps required to setup Android SDK on Ubuntu 10.4 (Lucid Lynx). has most of the information required to do this setup, but i still faced not so significant problems in setting the environment.I hope this small write up can help you not to run into the problems i faced with latest Ubuntu installation.

Following packages/software needed to be present  to start with Android development.

  1. JDK 6
  2. Eclipse (Ganemyde/Galelio)
  3. Android SDK tools

Setting up Sun’s JDK 6 on Ubuntu 10.04 is not straight forward(at least with just installed Ubuntu 10.04 machine). Sun’s JDK 6 package name is sun-java6-jdk.“sudo apt-get install sun-java6-jdk” doesn’t work as this package could not be found with the repositories present in /etc/apt/source.list. It is required to update the sources.list with following lines

deb-src lucid partner
After adding the above lines do an “sudo apt-get update”, after this steps “sudo apt-get install sun-java6-jdk”  should install the latest Sun’s Java Development Kit. You don’t have to modify PATH or add JAVA_HOME to .bashrc as the java binaries are installed to /usr/bin and /usr/lib. If you download the jdk installable form Sun’s website and extract it on your own, you need to update PATH and add JAVA_HOME to you environment variables, instead of doing this you can update the sources.list and follow the above steps.Post in techgyan by Aditya ( helped me to do this.Thanks to Aditya.

Next step will be downloading the right version of Eclipse IDE.To keep the setup simple i downloaded Eclipse JAVA IDE from Just unzip the tar ball you can see the eclipse folder.
Now download the Android SDK tools from, extract it and add android-sdk-linux_86/tools to PATH variable, so that android tools will be located by Eclipse.Start the eclipse and install the ADT plugin by following instructions at window->Android SDK and AVD manager to download latest android platform and google maps API ( detailed steps are at ).

Now the setup is complete, you can create HelloAndroid application and start developing the applications. If you are behind a proxy/firewall start the emulator and run the following command from android-sdk-linux_86/tools:
./adb shell sqlite3 /data/data/ “\”INSERT INTO system VALUES(99,’http_proxy’,'[HOST]:[PORT]’);\””
*replace the HOST:PORT with valid proxy details.

Steps to retrieve the IMSI number

May 10, 2010

IMSI stands for Inernational Mobile Subscriber Identity and this can be used to uniquely identify the SIM and mobile phones use it to register with mobile network.

If you can enumerate your mobile phone as a modem and using the corresponding COM port in the Hyperterminal utility in windows you can retrieve the IMSI number.It is required to use AT ( stands for attention ) commands to get the IMSI of the SIM in the device.

You can google for the AT command list, I don’t want to keep this post in drafts anymore, so I have to ask you to google for AT commands 🙂

Test post

March 30, 2010

My first post

Hello world!

March 30, 2010

Welcome to This is your first post. Edit or delete it and start blogging!