Netbeans cannot find cordova or git on your PATH but your have already set it ?

You have already set the cordova and git in your PATH, but still facing above mention problem.
Try to rename .bash_profile to something else and restart netbeans.
If that helps, means you have some “dirty” code in your .bash_profile which you may remove it.
(as in my case, I have an echo statement which prevent me to create cordova application)

If it doesn’t, continue google ūüôā

p/s: To confirm you have cordova and git in your PATH, there must be version number return when you issue command below in terminal (line by line):
cordova –version
git –version


Install Hadoop 2.5.0 in OSX & Ubuntu

Having multiple issue when installing hadoop in macbook last few of days, hence decided to build/package from hadoop source for my Ubuntu 14.04 and customise some configuration for OSX 10.10.1.
Here are the binary package if you need quick access:

Reference :


Build Android app on Netbeans in OSX

Prerequisite: Have Netbeans installed in box.

1. Download Andorid SDK from Android developer site.
2. Extract SDK it to any place you prefer, eg: /usr/local/android-sdk
3. Create Android AVD emulator by running [SDK_PATH]/tools/android as below:

Click New and fill in virtual device field, then click OK

4. Setup NBAndroid plugin following NBAndroid wiki.
5. Create New Android project in Netbeans by goto File–> New Project –> Android
6. Fill in project detail and add target sdk platform if you haven’t, then click Finish to create a sample Android project (it will have some syntax warning upon project created).
7. Build the project will clear those syntax warning.
8. Run the sample Android app.

Websphere Auto Deployment with Websphere Rapid Deployment

After my post Netbeans with Websphere, I found there is an easier way to deploy/update your application by just drooping your ear or war or ejb (not tried yet) file into a pre-set directory, and that’t it. Websphere will do the rest for you.

Here we go :

1. Open command prompt / terminal, and locate your path to <WAS_INSTALL_DIR>/runtime/profiles/bin
2. Execute set WORKSPACE=C:autoDeploy (prior create folder)
3. Execute WRD-config.bat -project “project_name” -style “autoappinstall”
4. WRD configuration launch, and you need to input required field. (as image below).wrd-config
5. Workbench shutting down when WRD done it’s configuration.
6. Execute wrd.bat to start wrd.
7. You can drop your application ear/war/etc into C:autoDeploy<project_name>, and enjoy !Resource from : ibm info center



Websphere With Netbeans

After using eclipse for couple of months due to the reason it has websphere plugin which easier for publishing ¬†code changes, I come back to netbeans as I feel I still love it. After hours of googling, I can’t really find an one stop setup, and decided to pen down here for sharing.

  1. Deploy your application war/ear via web console. eg : http://localhost:9060/ibm/console
  2. Find out where is the location after application deployed. eg :<WAS_INSTALL_DIR>/runtime/profiles/installapps/<NODES>/<YOUR_APP>
  3. Create an ant script for copying the compiled src or jsp to target found as step 2 above.

        <property name="source.web" value="C:/work/TestApp/target/TestApp">
        <property name="target.web" value="C:/IBM/SDP/runtimes/base_v7/profiles/was70profile1/installedApps/Node01Cell/TestEAR.ear/TestWeb.war">
        <property name="service.lib" value="C:/work/TestApp/Service/target/Service.jar">    
        <property name="target.lib" value="C:/IBM/SDP/runtimes/base_v7/profiles/was70profile1/installedApps/Node01Cell/TestEAR.ear/lib">
        <target name="Publish Web Module">
            <copy todir="${target.web}">
                <fileset dir="${source.web}">
                    <exclude name="META-INF/">
                    <exclude name="WEB-INF/lib/">
        <target name="Publish Library">
            <copy flatten="true" todir="${target.lib}">
                    <file file="${service.lib}">
  4. Enable debug mode in Websphere (follow steps 1..2..3), then restart server.
    websphere debug
  5. Try on your netbeans (follow steps 1..2..3..4)
    netbeans debug
  6. Enjoy and let me know if I miss out anything ūüėČ

P/S : I have attached the ant script which I use to restart server and publish the changes, you may change accordingly to suite your need. Click here to download


Ubuntu and cool package

Just installed ubuntu on my box recently, found it better than windows 7.
Package I installed as below (will keep updating, ~cheers~) :

  1. Skype
    sudo add-apt-repository “deb $(lsb_release -sc) partner”
    sudo apt-get update && sudo apt-get install skype
  2. Skype chinese character input (credited to
    sudo apt-get install ibus ibus-qt4 ibus-gtk
    sudo vim /etc/X11/xinit/xinput.d/default
    Then paste the text  into editor, save it and restart machine
  3. ISync (Google drive replacement)
    sudo apt-add-repository ppa:trebelnik-stefina/insync
    sudo apt-get update && sudo apt-get install insync-beta-ubuntu
  4. Cairo Dock (Mac OS X looks dock)
    sudo add-apt-repository ppa:cairo-dock-team/ppa
    sudo apt-get update
    sudo apt-get install cairo-dock cairo-dock-plug-ins
  5. Compiz Manager (Desktop effect)
    sudo apt-get install compizconfig-settings-manager
  6. Screensaver 
    sudo apt-get purge gnome-screensaver
    sudo apt-get install xscreensaver xscreensaver-gl-extra xscreensaver-data-extra
    sudo gedit /etc/xdg/autostart/screensaver.desktop
    (Paste 4 lines below and save the file)
    [Desktop Entry]
    Exec=xscreensaver -nosplash
  7. Synaps (Dash of unity)
    sudo apt-get install synapse
  8. Classic menu in Unity desktop (Since unity desktop does not have programs menu)
    sudo apt-add-repository ppa:diesch/testing
    sudo apt-get update
    sudo apt-get install classicmenu-indicator
  9. English to Chinese dictionary
    sudo apt-get install dict-stardic
  10. Cinnamon 1.8 desktop environment
    sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
    sudo apt-get update
    sudo apt-get install cinnamon nemo
  11. StarDict (Chinese – English) dictionary
    Download and install StarDict here
    Download dictionary file here and untar it to 
  12. GDebi (install *.deb package with dependency management)
    sudo apt-get install gdebi-core
  13. Media Codec
    sudo add-apt-repository ppa:gstreamer-developers/ppasudo apt-get update
    sudo apt-get install gstreamer1.0*
  14. Unity tweak tool
    sudo add-apt-repository ppa:freyja-dev/unity-tweak-tool-dailysudo apt-get update
    sudo apt-get install unity-tweak-tool
    Or download here
  15. Chinese input
    Refer here for more info
  16. If wine does not show Chinese application font properly
    Run : export LANG=zh_CN.UTF-8 before run wine xxxx.exe
  17. Install OpenOffice
    Download deb package here
    tar -vxzf filename (unzip it)
    sudo apt-get remove –purge libreoffice* ¬†(uninstall pre-installed libre office)
    sudo dpkg -i *.deb (cd to unzipped dir and install deb package)
    cd desktop-integration (cd to dir mentioned for menu integration)
    sudo dpkg -i *.deb

Java Generic : Can and Can’t

// Assumption : Dog and Cat extends Animal

List<Animal> animalList = new ArrayList<Animal>(); // YES
List<Animal> animalList = new ArrayList<Dog>();    // NO : Reason 1

List<Animal> animalList = new ArrayList<Animal>(); 
animalList.add(new Dog()); //YES
animalList.add(new Cat()); //YES

List<Dog> dogs = new ArrayList<Dog>(); 
dogs.add(new Dog());
sendBackHome(dogs);  // YES
sendBackHomez(dogs); // YES
sendBackShop(dogs);  // YES
sendBackShopz(dogs); // NO : Reason 2

static void sendBackHome(List<Dog> animals){

// Wildcard allow any type pass in as parameter but cannot add
static void sendBackShop(List<? extends Animal> animals) {
    animals.add(new Dog()); //NO : Reason 2

// Wildcard allow any type pass in as parameter but cannot add
static void sendBackHomez(List<?> animals){
    animals.add(new Dog()); //NO : Reason 2

static void sendBackShopz(List<Animal> animals){

static void sendBackShopz(List<Object> animals){

void sendBackHome(List<? extends Serializable> animals) {}    //YES
void sendBackHome(List<? implements Serializable> animals) {} //NO

List<?> animals = new ArrayList<Dog>();               // YES
List<? extends Animal> animals = new ArrayList<Dog>   // YES
List<? super Dog> animals = new ArrayList<Animal>     // YES

List<? super Animal> animals = new ArrayList<Dog>;    // NO
List<Animal> animals = new ArrayList<? super Dog>;    // NO
//Wildcard notation cannot used in object creation

public class Zoo<T extends Animal> {    
    public static void main(String[] args) {
        Zoo<Dog> zoo = new Zoo<Dog>();          // YES
        Zoo<Integer> zoo = new Zoo<Integer>();  // NO

public class Zoo<T extends Serializable> {} // YES
public class Zoo<T implements Serializable> {} // NO

public class Zoo<T extends Animal> {} // YES
public class Zoo<? extends Animal> {} // NO

public class Zoo {
    public <T extends Animal> Zoo(T t){} //Constructor
    public static void main(String[] args) {
        Zoo zoo = new Zoo(new Dog());            // YES
        Zoo<Dog> zoo = new Zoo<Dog>(new Dog());  // NO

public class Zoo {
    public <T> void addAnimal(T t) {
        List<T> animals = new ArrayList<T>(); // YES

public class Zoo {
    List<T> animals = new ArrayList<T>();    // NO
    public <T> void addAnimal(T t) {

-------------------------- APPENDIX --------------------------

Reason 1
Generic type of reference and object must identical.

Reason 2
Due to type erasure, "animals" only recognize it's based type 
which is ArrayList ONLY during runtime, and no other generic type. 

Let's imagine senario below:
When we write this:

    static void sendBackHome(List<Animal> animals){
        animals.add(new Cat());

When runtime, what jvm see is only base type, 
NOT generic type due to type erasure

    static void sendBackHome(List animals){  
        animals.add(new Cat()); // now it content Cat and Dog object

See the problem ? 
List<Animal> animals able to add Cat object.
when we try to process, animals list, which object should we cast?


WordPress permalinks requested URL /reference was not found on this server

If screenshot above look familiar when you try to configure permalinks for WordPress.
Try following:

  1. Open /conf/httpd.conf.
  2. Enable mod_rewrite module by removing the # for LoadModule rewrite_module modules/
  3. Change AllowOverride rules from “None” to “All” as section below.
  4. Restart Apache http server.
  5. Remove .htaccess file in your WordPress installation directory.
  6. Change your permalinks setting again in your WordPress after login.
  7. Have a cup of coffee.