Wednesday, August 31, 2011

JSON - Accessing object with hypen/dash

If you encounter json object that have - (hypen/dash) in the key, you will get a reference error if you access the object with dot manner. For example


Assuming the above object is call json_results, you will get an reference error if you

You have to access the value by


JQuery Mobile - Transition Flicker

Some may realize that when you transit from 1 page to the other, there is a flicker during the transition. You may try the following to prevent the flicker

.ui-page {
-webkit-backface-visibility: hidden;

Saturday, August 13, 2011

Android - Read Multimedia File from Assets folder

To read a multimedia file from assets folder via MediaPlayer, you could use the following code

AssetManager am = getAssets();
//Imagine you have a folder assets/mp4
AssetFileDescriptor afd = am.openFd("mp4/test.mp4")
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource(afd.getFileDescriptor(), afd.getStartOffset(), afd.getLength());
//I am assuming that you have knowledge in getting a surfaceHolder from SurfaceView

Wednesday, August 3, 2011

Android - Debug with hardware device in Eclipse

If you want to debug your Android application with Eclipse on real device, this post may help you.

1. Following the information to setup your phone

2. Connect your mobile device to PC via USB

3. Check if your device is attached properly with the following command

4. Open your Eclipse, Run -> Debug configuration

5. Make sure Manual is selected for Deployment Target Selection Mode and click save

6. If you perform normal debugging in Eclipse, the following should appear. Click on the running device and ok.

7. Debugging should start and if you switch to DDMS, you should see debug logging at the LogCat while you play around with the phone

LDAP - Deleting an LDAP entry

To delete an ldif entry, one way is to put an changetype attribute and a value 'delete' in the ldif file For example dn: cn=so...