Typically story prologue with this, and I decided to use it as my first post title, so when I review my weblog in my old age, I would have a feeling of reading a story book 🙂
Author: dicksonkho
Netbeans cannot find cordova or git on your PATH but your have already set it ?
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 :
http://gauravkohli.com/2014/09/28/building-native-hadoop-v-2-4-1-libraries-for-os-x/
http://glebche.appspot.com/static/hadoop-ecosystem/hadoop-hive-tutorial.html
http://www.csrdu.org/nauman/2014/01/23/geting-started-with-hadoop-2-2-0-building/
http://hadoop.apache.org/docs/r2.5.0/hadoop-project-dist/hadoop-common/SingleCluster.html
Next generation search engine ?
The name sounds so “Disney” cartoon, but their search is competence to Google search. They claim to emphasise on protecting searchers privacy, smarter search and more.
Have a try, maybe we will say “duckduckgo” instead of googling in near future…
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:
|
| 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).![]() |
| 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.
- Deploy your application war/ear via web console. eg : http://localhost:9060/ibm/console
- Find out where is the location after application deployed. eg :<WAS_INSTALL_DIR>/runtime/profiles/installapps/<NODES>/<YOUR_APP>
- Create an ant script for copying the compiled src or jsp to target found as step 2 above.
<project> <project> <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/"> </exclude></exclude></fileset> </copy> </target> <target name="Publish Library"> <copy flatten="true" todir="${target.lib}"> <resources> <file file="${service.lib}"> </file></resources> </copy> </target> </property></property></property></property></project> </project> - Enable debug mode in Websphere (follow steps 1..2..3), then restart server.

- Try on your netbeans (follow steps 1..2..3..4)

- 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~) :
- Skype
sudo add-apt-repository “deb http://archive.canonical.com/ $(lsb_release -sc) partner”
sudo apt-get update && sudo apt-get install skype - Skype chinese character input (credited to mrxuri.com)
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 - ISync (Google drive replacement)
sudo apt-add-repository ppa:trebelnik-stefina/insync
sudo apt-get update && sudo apt-get install insync-beta-ubuntu - 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 - Compiz Manager (Desktop effect)
sudo apt-get install compizconfig-settings-manager - 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]
Name=Screensaver
Type=Applicaton
Exec=xscreensaver -nosplash - Synaps (Dash of unity)
sudo apt-get install synapse - 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 - English to Chinese dictionary
sudo apt-get install dict-stardic - 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 - StarDict (Chinese – English) dictionary
Download and install StarDict here
Download dictionary file here and untar it to /usr/share/stardict/dic/ - GDebi (install *.deb package with dependency management)
sudo apt-get install gdebi-core - Media Codec
sudo add-apt-repository ppa:gstreamer-developers/ppasudo apt-get update
sudo apt-get install gstreamer1.0* - 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 - Chinese input
Refer here for more info - If wine does not show Chinese application font properly
Run : export LANG=zh_CN.UTF-8 before run wine xxxx.exe - 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
// SENARIO 1
List<Animal> animalList = new ArrayList<Animal>(); // YES
List<Animal> animalList = new ArrayList<Dog>(); // NO : Reason 1
// SENARIO 2
List<Animal> animalList = new ArrayList<Animal>();
animalList.add(new Dog()); //YES
animalList.add(new Cat()); //YES
// SENARIO 3
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){
...
}
// SENARIO 4
void sendBackHome(List<? extends Serializable> animals) {} //YES
void sendBackHome(List<? implements Serializable> animals) {} //NO
// SENARIO 5
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
// SENARIO 6
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
}
}
// SENARIO 7
public class Zoo<T extends Serializable> {} // YES
public class Zoo<T implements Serializable> {} // NO
// SENARIO 8
public class Zoo<T extends Animal> {} // YES
public class Zoo<? extends Animal> {} // NO
// SENARIO 9
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
}
}
// SENARIO 10
public class Zoo {
public <T> void addAnimal(T t) {
List<T> animals = new ArrayList<T>(); // YES
animals.add(t);
}
}
public class Zoo {
List<T> animals = new ArrayList<T>(); // NO
public <T> void addAnimal(T t) {
animals.add(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:
- Open
/conf/httpd.conf. - Enable mod_rewrite module by removing the # for LoadModule rewrite_module modules/mod_rewrite.so.
- Change AllowOverride rules from “None” to “All” as section below.
- Restart Apache http server.
- Remove .htaccess file in your WordPress installation directory.
- Change your permalinks setting again in your WordPress after login.
- Have a cup of coffee.




