Small Stuffs I learned today: For Android, Eclipse, Unix Shell Copy, SVN Revert
In last couple of days on my day today work, I got an opportunity to know about these simple tips or solution, which I thought would share in my blog post.
Android: android update sdk in headless mode
I was actually setting up hudson to run the android emulator so that we could test and build our application regularly using CI. As result, I had to install Android SDK on a linux box through ssh. But as I was installing, I realized that I had to install the additional package in order for the hudson to create an AVD and use it for testing our application. Had it been eclipse, we would have done the same through the Android plug-in’s Android SDK & AVD Manager wizard. Since I was connected via SSH, I had to update the SDK with the required add-ons in a headless mode. As I ran the command ‘android update sdk’, the android tool was throwing some series of errors saying it could launch the AVD Manager as it could find a GUI support.
After some look through I figured out that using
ssh -X user@ip-address
would allow me to bring up the required GUI for updating the SDK. It was a pretty useful tip I learnt.
eclipse: Navigate to the next error or warning locations
If you had used Intellij IDEA for your J2EE development, you would have probably realized by now how useful was ‘F2’ shortcut key to navigate across the errors in the code. But as I am forced to use eclipse in recent times, I have been deliberately looking for a similar option. Finally I figured it out, how could I achieve the it. In eclipse the errors and warnings are marked as Annotations. In order to navigate from one error to next/previous error’s occurrence, they short cut keys are
Ctrl+. (move to next occurance) Ctrl+, (move to previous occurance)
the same short keys can be used to navigate across the code to find the occurrences of a declared variable. It was pretty useful to know these shortcuts.
Linux shell command: Copying the hidden files along with regular files.
I had been using a desktop machine with Ubuntu running on it for quite sometime now. Recently, I’d been provided with a laptop and hence because of that move, I had to take the complete backup of my home folder. When I say complete backup, I wanted to even copy all the hidden files under my home folder. (files starting with .). But when I do normal recursive copy the hidden files doesn’t seemed to get copied along with rest of the regular files and folders. I couldn’t find a straight-forward way to do the same using the ‘cp’ command. Then finally the following commands did the trick.
$ mkdir /media/THUMBDRIVE/backup $ shopt -s dotglob $ cp -r /home/myhome/ /media/THUMBDRIVE/backup $shopt -u dotglob
SVN: Command to revert a single file to the previous version
I had this file changes which I am not supposed to check-in into the svn repository. But unfortunately, I did the mistake of check it in along with rest of the files. Now I realized that I had to revert my changes which is already committed into the svn. Basically, I had to revert the changes as it was in the previous version. As I was working with the command prompt, I had to figure out to do the same. ‘svn revert’ will not help me to achieve the same, finally I figured out that I have to do reverse-merging with the previous version of the files and commit the changes again using the following command.
svn merge -r 89:88 myfile.txt
This help me to revert myfile.txt to the previous version (89 => 88).
I know most of these information is easily available on net in some place somewhere. To be honest, I got to learn all the above tricks via net. But I still wanted to record these information here just for a back reference. I hope these information would be of any use to somebody out there.