Sponsored Link

Tuesday, March 27, 2012

git:: how to undo changes to a single file

undo changes in a single file, using git

To get rid of the stupid changes you have made in a single file, without effecting important changes in other files use,
git checkout filename
Yes, that is the same command used to switch between branches. If the branch name is same the filename, do this
git checkout --filename
Note:
git checkout --hard
will reset all the files. Use that when you are certain about that.

Wednesday, March 7, 2012

How to take screenshot of Android device (developer edition)

Older versions of Andriod doesn't give a simple option to take screen shot directly from the device. Apple's iPhone has a handy feature which allows to take screen shots by pressing Power+Home button. From Android 2.2 (Froyo) onwards Android devices gives and option to take screenshot from the device itself by using Home + Power button combo. This post is android developers method for getting screen shot from Android devices.

It took some time and searches to figure out how to take screen shots from Android device. You need to have a android development kit installed and configured to take screen shots using the official method.

It was easy for me once I figured out the method, as I had already installed android-sdk in my machine. I am using SpringSource Tool Suite with ADT plugin for development which is a Spring flavoured Eclipse. If you already have them installed great otherwise you might want to get these installed in your machine. Download and installation instructions can be found in the following links
By optional I mean, Eclipse and ADT is not required for taking the screen shot, which is the purpose of this blog post

Once you have it ready follow these steps
  1. Enable USB debugging in the android device, by going to Settings > Applications > Development > and checking the check box that says USB debugging.

  2. Connect your Android device to your machine

  3. Start ddms(Dalvik Debug Monitor Server) either from Android-SDK/tools folder or from Eclipse



  4. That will open ddms screen like this


  5. Here your will be able to see the device that you have connected. You can ignore the messages and warnings that are continuously updated at the bottom.

  6. Click on the camera icon or screen capture option under the Device menu


  7. Now you will get the Device Screen Capture window.


  8. You can directly save the screen shot from this. Go to a different screen or application and click 'refresh' option to get a updated screenshot. It also gives rotate and copy to clipboard options. Click done to close the window.

The images are saved in PNG format and are small in size. I have tried screenshots of Youtube videos being played and it worked very well.
Related Posts Plugin for WordPress, Blogger...