Wednesday, February 27, 2013

How to control the screen size of the emulator to fit into your laptop/desktop screen?

The emulator screen size always fit to the laptop/desktop screen size when it is launched. This has caused a lot of inconvenience when I wish to tap on the "Back" button on screen.

From my personal experience, I prefer to resize the emulator screen size to 0.5, instead of 0.75 ratio.

  • Right click on your project, select "Run As" -> "Run Configurations"
  • Select "Target" tab, enter "-scale 0.5" in the "Additional Emulator Command Line Options" textbox, this will scale the screen size to 0.5 ratio. Please refer to the screen as shown below.

Note: Eclipse IDE required you to scroll down your "Target" tab screen to see the "Additional Emulator Command Line Options" textbox.
  • Click on "Run" button, the emulator screen size will be scaled down.


Tuesday, February 26, 2013

How to fix Android emulator problem when encounter error message " Failed to allocate memory: 8"?

With the great demand for Android app, recently I have to pick up the Android skillset again.

First obstacle, when run my Android app in emulator, the error as shown below is displayed in the Eclipse console.
[2013-02-27 12:33:22 - Emulator] Failed to allocate memory: 8
[2013-02-27 12:33:22 - Emulator] This application has requested the Runtime to terminate it in an unusual way.
[2013-02-27 12:33:22 - Emulator] Please contact the application's support team for more information.

How to solve?

  1. Right click on your Android project, select "Run As" -> "Run Configurations"
  2. Select "Target" tab
  3. Select the AVD that your are using, curently I'm using "AVD_for_Nexus_7_by_Google", click on "Manager" button
  4. In the new dialog Window, select "AVD_for_Nexus_7_by_Google" and click on "Edit" button
  5. Change the "Memory Options" RAM from 1024 to 512.
Voila, I have loaded my app on emulator successfully.

Sunday, February 24, 2013

How to check which application is using the port number?

In setting up the Apache Web Server/MySql... etc., we need to make sure that the port number is free and not using by other application. This is to make sure that our installed application can be deployed and run successfully. Below are a quick way to check which application is using which port number
netstat -a -b

How to fix the copy and paste through the remote desktop connection problem?

This is a persistent problem that bother me all the while, especially when I'm doing the remote deployment using remote desktop connection to connect to remote server. This problem become obvious when I need to copy few lines of configuration and paste to the setting file in the remote server. So, I decided to find at least a simple tip that can solve my problem long term or temporarily.

Browsing through the internet and manage to find a simple solution:

1. Open the task manager
2. Click on "Processes" tab and select "rdpclip.exe"
3. Click "End Process" button
4. Click on "Application" tab
5. Click on  "New Task" and enter "rdpclip"
6. Click on "Ok" button
Try to copy some text and paste to the remote server notepad, should be working fine. At least for my case.

Thursday, February 21, 2013

Vulnerability fixes – Web Server Supports Outdated SSLv2 Protocol

If your network engineer again come to you and said that, you need to resolve this vulnerability issue in your Apache server, what will you do? How you so sure that your configuration is working?


Steps:   Edit Apache's httpd-ssl.conf and include these lines at minimum:
SSLProtocol -ALL +SSLv3 +TLSv1
Note: I assume you know where is https-ssl.conf is resided. I assume you know how to turn on SSL :D

How to test?

Run command below to verify SSL3 is enabled
openssl s_client  -connect localhost:443 -ssl3
A success result of retrieving certificate will be displayed.

Run command below to verify SSL2 is disabled
openssl s_client  -connect localhost:443 –ssl2
A failure result is displayed.
Loading 'screen' into random state - done
CONNECTED(00000154)
4460:error:1407F0E5:SSL routines:SSL2_WRITE:ssl handshake failure:.\ssl\s2_pkt.c
:428:

SSLProtocol -ALL +SSLv3 +TLSv1

How to set firewall rule in Window 2008 to allow remote server to connect to MySQL on port 3306?

I have 2 servers, 1 application server and the other 1 is database server. My database server is using MySql which is listening on port 3306. To enable my application server to connect to database server to port 3306, I have tried many effort in setting the Inbound rules and Outbound rules on Window 2008 firewall which I described in my previous post. Anyway, no luck in following the network engineer advice and now is my doubt on his ability...

1 magic tips which I search through the internet and it is great and it just works perfectly
netsh advfirewall firewall add rule name="MySQL Server" action=allow protocol=TCP dir=in localport=3306

Tuesday, February 5, 2013

Xcode: couldn’t launch app – no such file or directory

Recently, I'm facing a problem when I tried to compile my iOS project and sync into my device (iPad) using Xcode. Error message "Xcode: couldn’t launch app – no such file or directory" keep prompting upon sync the app to the device.

I have tried the solution below which normally work

  1. Disconnect the device
  2. Delete the app from the device
  3. Quit XCode
  4. Delete the derive data folder of the app which normally located at "~/Library/Developer/Xcode/DerivedData"
  5. Relaunch XCode
  6. Perform a clean build
However, I can't get it work in my outdated device. I check the iOS version on my device, it is currently running on iOS 5.0.1. When I checked my project, deployment target is iOS 5.1. Hence, I upgrade my iOS to version 6.1 and upgrade my XCode to the latest version so can support iOS SDK 6.1. Finally, manage to get my app sync my device.

Sunday, February 3, 2013

How to write a batch script to run multiple maven command line in Window?

This happened when the developer wish to prepare a batch script for others developer to manually install the third party jar file to the local repository. This is not a problem if only 1 command line is required to be executed in the batch file, for example

mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion={version} -Dpackaging=jar
If the developer wish to run multiple mvn command line as shown below, then only first mvn command line will be getting executed and first jar file is getting installed in the local repository.

mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion={version} -Dpackaging=jar

mvn install:install-file -DgroupId=com.google.gdata -DartifactId=gdata-client -Dversion=1.0 -Dpackaging=jar -Dfile=c:\gdata-client-1.0.jar
If we wish to get all the command line get executed, put the "call" in front of each of the command and your batch file will be looked like below 
call mvn install:install-file -Dfile=c:\kaptcha-{version}.jar -DgroupId=com.google.code -DartifactId=kaptcha -Dversion={version} -Dpackaging=jar

call mvn install:install-file -DgroupId=com.google.gdata -DartifactId=gdata-client -Dversion=1.0 -Dpackaging=jar -Dfile=c:\gdata-client-1.0.jar
Voila, you will get all the jar files installed in your local repository.