mercoledì 24 dicembre 2014

Apache Cordova development environment tutorial setup

This post will give you in a single place the list of steps you have to perform to setup a Apache Cordova environment with an Android emulator. Follow these steps if you are on Window 7.  There also explained some troubleshooting case I've done to get it working.

Apache Cordova is a platform for building native mobile applications using HTML, CSS and JavaScript

Prerequisite to download and install:

Java7 is required by Android Studio. Nodejs is necessary for server side mobile development but also brings the npm package manager to install Cordova and a lot more. Ant is required to build Cordova projects.Git client will for sure useful if you start learning more tutorial about cordova and mobile development.

After installing all make sure you add the new ANDROID_HOME and the update the PATH variable like these:

set ANDROID_HOME=C:\\dev\\tools\\Android\sdk
set PATH=%PATH%;%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%ANDROID_HOME%\\sdk\\build-tools\\21.1.2;C:\\dev\\tools\\ant\\apache-ant-1.9.4\\bin;C:\\Users\\Administrator\\AppData\\Roaming\\npm;


1- Install Apache Cordova
C:\>npm install -g cordova
2- Create an HelloWorld app project:
C:\>cordova create hello com.example.hello HelloWorld
3- Install Apache Cordova Go in the hello directory and add the android platform for example:
C:>cd hello
C:\>cordova platform add android
If you get error like this:

Error: Please install Android target "android-19".
Hint: Run "android" from your command-line to open the SDK manager.

run the SDK Manager.exe from your ANDROID_HOME folder and make sure you install the SDK Platform for Android 4.4.2 (API 19). Once that is done you just rerun the cordova command above.

4- Build for Android
C:>cordova build android
5- Now before to run in the emulator to increase its speed ensure you have installed the x86 Intel Hardware Accelerated Execution Manager. To check browse the ANDROID_HOME files and open the SDK Manager to check if you have installed the extras package as in the picture below:



And then and run it form this directory: 

ANDROID_HOME\extras\intel\Hardware_Accelerated_Execution_Manager\intelhaxm.exe

More details here: https://software.intel.com/en-us/android/articles/intel-hardware-accelerated-execution-manager

Note:  If during installation you get this error message below you will also need "Virtualization Technology" to be enabled on your BIOS.  For example in my Lenovo Thinkpad W530 VT-settings are located located under "Security | Virtualization", not under "CPU" settings. So google it for your computer.




After enabling BIOS acceleration, finally rerun again the program intelhaxm.exe. Instead if you get the error "VT not supported" during the installation disable Hyper-V on windows features. You can execute this command dism.exe /Online /Disable-Feature:Microsoft-Hyper-V

6-Finally run the test android application
c:>cordova emulate android
The emulator will start and show the splashscreen of the default app just created. If size of the emulator does not fit correctly, close the emulator open the AVD Manager.exe and edit it:

This emulator size worked well on my screen :


Then finally you are ready with Cordova environment with an android emulator!
I suggest you at this point to learn more on developing Cordova with this very good tutorial:

https://ccoenraets.github.io/cordova-tutorial/index.html

Enjoy!

For official Apache Cordova documentation refer to:
http://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface
 add android

martedì 23 dicembre 2014

Cannot login to websphere admin console? Maybe you forgot to start LDAP?

Cannot you login to IBM Websphere administration console and you have not changed the admin password recently?  Then a tipical reason is that LDAP user registry has been not started before to start Websphere. Check on the server SystemOut.log if there is this exception below:

com.ibm.websphere.wim.exception.WIMSystemException: CWWIM4520E The 'javax.naming.CommunicationException: your_ldap_hostname.com:389 [Root exception is java.net.ConnectException: A remote host refused an attempted connect operation.]' naming exception occurred during processing.
at com.ibm.ws.wim.adapter.ldap.LdapConnection.getDirContext(LdapConnection.java:1568)
at com.ibm.ws.wim.adapter.ldap.LdapConnection.search(LdapConnection.java:2731)
at com.ibm.ws.wim.adapter.ldap.LdapConnection.checkSearchCache(LdapConnection.java:2699)
at com.ibm.ws.wim.adapter.ldap.LdapConnection.search(LdapConnection.java:2889)
at com.ibm.ws.wim.adapter.ldap.LdapConnection.searchEntities(LdapConnection.java:3100)
at com.ibm.ws.wim.adapter.ldap.LdapAdapter.login(LdapAdapter.java:2695)



Example of resolution with the IBM Tivoli Directory Server as LDAP server:

1) Restart the db2 database if stopped:
su -dbinstanceuser
db2start

2) Restart the Tivoli Directory Server 6.3 if stopped:

cd /opt/IBM/ldap/V6.3/sbin
./ibmdiradm -I dbinstanceuser
./idsslapd -I dbinstanceuser

3) Restart Websphere

How to simply display Aix remote Gui with Putty and Xming?

Who never struggled with exporting display and failed? I did it.
These steps below save to me a lot of time when I forget how to do:

On the Aix side:

1) edit file/etc/ssh/sshd_config  and set the following properties to yes.

X11Forwarding yes
X11UseLocalhost yes
PermitRootLogin yes

2) Stop the ssh service:
stopsrc -s sshd

3) Restart the ssh service:
startsrc -s sshd

On client side:

4) Start Xming server (you can download it from http://sourceforge.net/projects/xming/)

5) Open a putty and specify "enable X11 forwardingon the X11 options and open the SSH session to the AIX host.

6) Verify the remote graphical panels are displayed on the client side. For the last one on the world that still does not know how to do: open a shell on the Aix box and running the most famous graphical test application "xclock".

Remember with ssh you do not need to export the display on the Aix shell, but just open the graphical application. If you access to the remote system with telnet you have first to export the display on the shell you need to running the graphical application.