Wednesday, May 30, 2012

Eclipse & TFS ~ Ignoring file from commit

The TFS plugin for Eclipse doesn’t have a direct way to support ignoring the files from committing directly from IDE just like SVN does. For example, we prefer not to commit the “bin” directory. In order to ignore certain files or directory, we will have to create a file with the name .tpignore and save it in the root directory of the project. For example, to ignore bin directory and all of its files, the content of the .tpignore file should be as follows:


Generating Hashkey for Android Facebook Application Integration

Step 1

Step 2

Extract to a folder (in my case d:\android\openssl)

Step 3

Copy your debug.keystore file to the Java JDK folder where keytool.exe is present
In my case debug.keystore was in C:\Users\hemant\.android\debug.keystore
keytool.exe was in D:\Program Files\Java\jre7\bin folder

Step 4

Open the command prompt in the jdk bin folder where keytool.exe is and execute the following command:
keytool -exportcert -alias androiddebugkey -keystore debug.keystore > d:\android\openssl\bin\debugkey.txt
Provide password as android when prompted

Step 5

Navigate to openssl\bin folder (here we have debugkey.txt) in the command prompt and execute the following commands:
a.       openssl sha1 -binary debugkey.txt > debugkey_sha.txt
b.      openssl base64 -in debugkey_sha.txt > debugkey_base64.txt

That’s it! We are done. The debugkey_base64.txt contains the hashvalue. We need to copy paste this key to the Basic Settings page of our facebook application as shown below using the green arrow.

Friday, May 25, 2012

Android ~ Manually terminating an application or an activity

Best Practice recommended for Android development is to leave memory management to Android OS itself. What this means is when user moves out of our activity/application, we need not call the finish method to destroy it and release memory rather leave the application running without “finishing” it. When Android OS runs low in memory, it may decide to terminate the running activities.

Ok having said that and during development, assume we are interested to start the application fresh. In order to achieve this, we have four ways to do it and they are as follows:

1.       Restart the emulator    
This will take longer time but you can achieve your expectation

2.       Re-run the application 
This too will take longer time but comparatively less than that of restarting the emulator and you will achieve your expectation

3.       Stop Process from DDMS view 
This is quickest method and can be done only from the Eclipse studio
Eclipse Studio -> DDMS Perspective view -> Devices panel -> select process -> click stop button

4.       Force stop from Settings             
This is also the quickest and the safest method you can do directly from the Android device.
                Android Emulator -> Settings -> Applications -> Manage Applications -> Running Tab -> Select Application -> Force Stop

Android LogCat does not show anything !!!

Sometimes when working with Android applications, we may come across a situation where we will not see anything showing up the log no matter even if we select application specific log or all verbose messages. So what went wrong and how can this be fixed.

Here is the easiest way to fix this….

Open the DDMS perspective view. From the top left panel (Devices panel), select your application and that’s it…You will see the next moment logs get pouring in the logcat window.