- #uninstall svn 1.6 (yum installs old versions)
- yum remove svn
- cd /usr/local/
- #download 1.7
- wget http://opensource.wandisco.com/centos/5/devel/RPMS/x86_64/subversion-1.7.14-1.src.rpm
- #install
- rpm -ivh subversion-1.7.14-1.src.rpm
- #remove backup(your choice)
- rm -f subversion-1.7.14-1.src.rpm
- #check installation success
- svn --version
CentOS : upgrading subversion(svn) 1.6 to subversion(svn) 1.7 Script(.sh)
CentOS : Maven install Script(.sh)
- #download maven tar
- wget http://mirror.cc.columbia.edu/pub/software/apache/maven/maven-3/3.0.5/binaries/apache-maven-3.0.5-bin.tar.gz
- #untar
- tar xzf apache-maven-3.0.5-bin.tar.gz -C /usr/local/
- #delete unnecessary back-up
- rm -f apache-maven-3.0.5-bin.tar.gz
- #install
- cd /usr/local
- #create symlink
- ln -s apache-maven-3.0.5 maven
- #create environment vars
- export M2_HOME=/usr/local/maven
- export PATH=${M2_HOME}/bin:${PATH}
- #check installation
- mvn -version
Download CentOS Maven Install Script(.sh) from Here.
Getting started with PhoneGap/Cordova with CentOS, First Helloworld android app using PhoneGap/Cordova
Install Cordova:
On Linux/CentOS:To install Cordova you will first need to install the npm utility of Node.js.
- yum install nodejs
- yum install npm
- npm install -g cordova
Install Android-SDK:
If you haven't yet installed Android SDK do the following:
Install prequisite libs:
- yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686
(For CentOS 32bit:
Unzip it to a directory.It will be a good idea to rename it.(e.g. /usr/local/android/).Run the following commands:- cd /usr/local/
- wget http://dl.google.com/android/adt/22.6.2/adt-bundle-linux-x86-20140321.zip
- unzip adt-bundle-linux-x86-20140321.zip
- #backup can be deleted now, your choice
- rm adt-bundle-linux-x86-20140321.zip
- mv adt-bundle-linux-x86-20140321/ android/
/usr/local/android/sdk/platforms
/usr/local/android/sdk/platform-tools
/usr/local/android/sdk/tools
Now add path variables to environment:
- echo "export PATH=$PATH:/usr/local/android/sdk/platforms" >> ~/.profile
- echo "export PATH=$PATH:/usr/local/android/sdk/platform-tools" >> ~/.profile
- echo "export PATH=$PATH:/usr/local/android/sdk/tools" >> ~/.profile
- source ~/.profile
Uninstall previous old ant version:
- #uninstall if already old versions are there
- yum remove ant
Run the script from here to install ant 1.9:
http://mohiplanet.blogspot.com/2014/06/centos-ant-19-install-scriptsh.html
You will also need ant apache regex utility.Install it by running :
- yum install ant-apache-regexp
Create Helloworld Cordova Project:
cd to a convenient directory and run:
- cordova create hello com.example.hello HelloWorld
- cd hello/ && ls
config.xml hooks merges platforms plugins www
- cordova platform add android
Run the follwing command to see what platforms are already added in the project:
- cordova platforms ls
Installed platforms: android 3.5.0
Available platforms: amazon-fireos, blackberry10, firefoxos, ubuntu
Build the project:
Build the project by following command:
- cordova build
Run the following command to run the app on android emulator:
- cordova emulate android
YOUR_PROJECT_ROOT_DIR/www/index.html
You can edit the file and run 'cordova emulate android' again to see the changes.
Debugging the application (Seeing logs):
You can run:
- adb logcat
on a seperate window to see android logs.This will produce huge logs, so I would recommend using:
- adb logcat|grep Cordova
adb logcat|grep Cordova
- waiting for device -
I/CordovaLog( 958): Changing log level to DEBUG(3)
I/CordovaLog( 958): Found start page location: index.html
D/CordovaActivity( 958): CordovaActivity.onCreate()
D/CordovaWebView( 958): CordovaWebView is running on device made by: unknown
D/CordovaActivity( 958): CordovaActivity.init()
D/CordovaWebView( 958): >>> loadUrl(file:///android_asset/www/index.html)
W/System.err( 958): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:457)
W/System.err( 958): at org.apache.cordova.CordovaWebView.loadUrlIntoView(CordovaWebView.java:444)
W/System.err( 958): at org.apache.cordova.CordovaWebView.loadUrl(CordovaWebView.java:414)
W/System.err( 958): at org.apache.cordova.CordovaActivity.loadUrl(CordovaActivity.java:395)
D/CordovaWebView( 958): >>> loadUrlNow()
Distributing your app(Generating .apk):
When you run:
- cordova build
A distributable .apk is genarated at YOUR_PROJECT_ROOT_DIR/platforms/android/ant-build/
In this example the auto-generated .apk will be YOUR_PROJECT_ROOT_DIR/platforms/android/ant-build/HelloWorld-debug.apk
But this a debug version.To build release version simply do:
- cordova build --release
This will generate an unsigned release version of your app like YOUR_PROJECT_ROOT_DIR/platforms/android/ant-build/HelloWorld-release-unsigned.apk
To sign your app with your company profile please visit:http://developer.android.com/tools/publishing/app-signing.html
References:-
http://cordova.apache.org/docs/en/3.0.0/guide_cli_index.md.html
https://wiki.echocat.org/display/ECHOCAT/2012/08/17/Configure+Android+SDK+on+CentOS+6+x86_64
Linux/CentOS : Ant 1.8 / 1.9 / install script(.sh)
Because yum will always download old versions.Let's download Ant 1.9 with .sh script.This will do the work:
- #make sure opt directory exists
- cd /opt/
- #download
- wget http://mirrors.ispros.com.bd/apache//ant/binaries/apache-ant-1.9.4-bin.zip
- #unzip and remove zip(you choice)
- unzip apache-ant-1.9.4-bin.zip && rm apache-ant-1.9.4-bin.zip
- cd apache-ant-1.9.4/
- #create symlinks
- ln -s /opt/apache-ant-1.9.4 /opt/ant
- ln -s /opt/ant/bin/ant /usr/bin/ant
- #add environment variable
- echo 'ANT_HOME=/opt/ant' >> /etc/environment
- #apply changes on current session
- source /etc/environment
Be sure to download wget before running the script
Google App Engine(GAE) : Rolling back previous incomplete deployment(running appcfg roolback)
While deploying Google App Engine web app you may face:
"GAE appcfg rollback not working: 409 Conflict Another transaction by user is already in progress for app".
To fix this got to APP_ENGINE_SDK_DIRECTORY/bin where the appcfg.sh is located:
Run this command there:
sh appcfg.sh rollback GAE_APP_DIR/
where GAE_APP_DIR: your project directory where the WEB_INF foler is located example:
sh appcfg.sh rollback GAE_APP_DIR/web/
"GAE appcfg rollback not working: 409 Conflict Another transaction by user is already in progress for app".
To fix this got to APP_ENGINE_SDK_DIRECTORY/bin where the appcfg.sh is located:
Run this command there:
sh appcfg.sh rollback GAE_APP_DIR/
where GAE_APP_DIR: your project directory where the WEB_INF foler is located example:
sh appcfg.sh rollback GAE_APP_DIR/web/
Spring MVC + JSON : fixing error 406 (Not Acceptable)
This may happen while using Spring controllers like this:
- @RequestMapping(value = "/getbirds", method = RequestMethod.GET, produces = "application/json")
- public @ResponseBody
- List<Bird> getBirds(@RequestParam("term") String term) {
- List<Bird> lst;
- //..........
- return lst;
- }
@ResponseBody
annotations don't use normal view resolvers, they use their own.Put this in your dispatcher-servlet:- <bean id="jacksonMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"></bean>
- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
- <property name="messageConverters">
- <list>
- <ref bean="jacksonMessageConverter"/>
- </list>
- </property>
- </bean>
You may need to put this dependency in your pom.xml:
- <dependency>
- <groupId>org.codehaus.jackson</groupId>
- <artifactId>jackson-mapper-asl</artifactId>
- <version>1.8.0</version>
- </dependency>