Saturday, August 27, 2011

Android Emulator and Eclipse

Last year, I bought Google Nexus One to use as my first smartphone. I chose Android over Iphone because it is easier for a casual developer like me to build an application with the current environment (windows and linux). Also, I would better stick with my comfortable programming language, Java.

After getting a phone, I've developed a simple application to help me generate my password for everything. Yes (Nerd Alert!!), I come up with my own algorithm to generate a password from a specific keyword. Therefore, I just need to choose an obvious and easy-to-remembered keyword. Moreover, I can use a different keyword for a different place/websites. For example, the word "Whitehouse" would generate a password "9jk7Gk62". The real algorithm is nothing much; it is built from a simple encryption algorithm, called "ceasar cipher", a bit operation, and a simple hash function.


Password Generator Application on Motorola Atrix 4g


After a long introduction, there is noting wrong with an application. The problem is when I got a new smartphone (Motorola Atrix 4g). The password generator application is working fine, but the screen size of the application is wrong because Atrix has a better resolution than Nexus One. I have to reinstall ADT Plugin for Eclispe and AndroidSDK. After open a project in Eclipse, I cannot start an emulator. The error in the console is


invalid command-line parameter: Files
Hint: use '@foo' to launch a virtual device named 'foo'.
please use -help for more information


After google to find the solution, from many sites[1,2,3], the problem is with R12 SDK. It doesn't allow space in SDK path. But, if you use AndroidSDK windows installer like me, normally default path is "c:\Programs file\android". First, I tried to change the path in the Eclipse configuration from "c:\Program files\android" to "c:\Progra~1\android". This doesn't work for me since Eclipse will tell me that the directory isn't existed. So, The solution for me is to reinstall an AndroidSDK to a location with out space such as "c:\android". This is definitely a bug!!!

Resources:

[1] - http://www.android.net/forum/beginning-developers/62877-invalid-command-line-parameter-eclipse-android.html

[2] - http://www.wallpaperama.com/forums/_wlxpee.html
[3] - http://stackoverflow.com/questions/6638713/android-emulator-is-not-starting-showing-invalid-command-line-parameter

Thursday, June 23, 2011

Adding library in Ubuntu

Installing application in Ubuntu which doesn't come with .deb package is usually required more steps to make it work. When working with Teragrid, I need Globus Toolkit to connect to a cluster. After download and install required tools using

export GLOBUS_LOCATION=/path/to/install
make gsi-myproxy gsi-openssh


when I tried to run gsissh, I encounter " error while loading shared libraries: libglobus_gss_assist_gcc64dbg.so.0 ". The problem is gsissh doesn't link to the installed libraries. We can look up required libraries for application by using

ldd /path/to/application

The libglobus_gss_assist_gcc64dbg.so.0 is actually installed in the same location of Globus Toolkit, but Ubuntu doesn't automatically link it for us. So, we need to add libraries location to our system. Using command

sudo ldconfig /path/to/my/usr/local/lib/


Resources:
[1] - http://ubuntuforums.org/showthread.php?t=496553

Wednesday, May 25, 2011

<code> and <pre> CSS Style

After long time without update, I just realize that Blogger pushed out a new template design. In my opinion, it looks better, so I've changed my template without hesitation. The problem is I used custom style for <pre> and <code> tag to represent a program code. When I've applied the template, I forgot to back up the old style. I had to spend some time find the correct style for it although, it is very easy CSS code. So, I will blog it as my backup.

pre {
  overflow: auto;
  border: solid 1px #9AACAE;
  font-family: courier,Georgia,Serif;
  color: $(body.text.color);
  background: #EFEFEF;
  margin: 5px;
  padding: 5px;
}