Posts

How to install and switch between multi JDK?

How to install and switch between multi JDK? Table of Contents How to install and switch between multi JDK? Linux Mac OS X Common incompatible errors between different version 1 How to install and switch between multi JDK? I suppose that you are installed both java 7 and 8 into your system. So how to switch between them. 1.1 Linux # !/bin/ bash # java1.7.sh # source java1.7.sh to switch jdk 1.7 export JAVA_HOME = "/opt/tools/jdk1.7.0_60" export CLASSPATH =.:${ JAVA_HOME }/lib:${ CLASSPATH } export JDK_HOME = "/opt/tools/jdk1.7.0_60" export PATH = "/opt/tools/jdk1.7.0_60/bin" :${ PATH } # !/bin/ bash # source java1.8.sh to switch to JDK 1.8 export JAVA_HOME = "/opt/tools/jdk1.8.0_05" export CLASSPATH =.:${ JAVA_HOME }/lib:${ CLASSPATH } export JDK_HOME = "/opt/tools/jdk1.8.0_05" export PATH = "/opt/tools/jdk1.8.0_05/bin" :${ PATH } 1.2 Mac OS X # ~/.bash_profile ...

Android UnitTest

Android UnitTest Table of Contents kinds of Unit Tests in Android Android Instrument Test Junit Test the Demo Unit Test was always the most import part of a project, especially for Object-oriented programming like Java codes, and also was the necessary part of Test-Driven Development technology. But how to process test-driven technology in Android app developement, we all know that android app is based on Java code, and the thought of TDD was in the blood of Java. There are must be some ways to do TDD in Android, and this article will guide you to the Unit test in Android Development. 1 kinds of Unit Tests in Android There are two levels of Unit Test in Android, Android Instrument Test, which running in the Android Devices; and Junit Test, which running without any Android environment. The key difference between two of them are the dependency on the android.jar, in other word, the Android API. We develop android app by import the dependency of android.jar, whi...

Android ViewPager to implement guide page

https://github.com/suzp1984/welcome This demo started up, because one of my former colleague tried our app, and blamed the guide UI, which is a little stuck. I know the viewpager is a convenient and simple substitute for our bad implementation. So I started it. Make your app guide UI smooth and response quickly, use ViewPager.

Customize ubuntu login console by Cowsay, ascii art

Before this article, I wanna introduce cowsay again, cowsay is an ASCII art generator, which is alway the nerd's favorite toy. Cowsay & Fortune I already used cowsay in my email client, gnus. And at that moment, I found out cowsay's closet mate, fortune . And this time is the moment to make some fun to my ssh login terminal. How to decorate your ssh login console? Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-53-generic x86_64)  * Documentation:  https://help.ubuntu.com/  ____________________________ / Expect the worst, it's the least you \ \ can do.                                            /  --------------------------------------         \   ^__^          \  (oo)\_______             (__)\              )\/\ ...

Dig into Https client connection in Android

Dig into Https client connection in Android Table of Contents reference resources Java Keytool Certificate formats Use Https in Android Client Java SSLContext Two ways SSL verification TLSDemo 1 reference resources http://developer.android.com/training/articles/security-ssl.html http://ogrelab.ikratko.com/using-android-volley-with-self-signed-certificate/ http://stackoverflow.com/questions/2138940/import-pem-into-java-key-store http://stackoverflow.com/questions/3685548/java-keytool-easy-way-to-add-server-cert-from-url-port 2 Java Keytool Java keystore is like a database which store certificates and private keys and protect them by a password maybe. There are at least three format s of that, JKS, PKCS12, JCEKS, and many more. But in this tutorial, I only consider two formats of that JKS which is the Java's default format and BKS which is the Android's default format. How to import a certificate to the BKS style KeyStore? First step was to pr...

Merge branches in Git

Merge branches in Git Few days ago, my superior gave a task to make a presentation about the daily usage of git for R&D department, so I resumed the git pro book to prepare this presentation. And the following article is to recognize my former wrong and unclear opinion about branch merging in git, and a little suggestion about branch management. So how to merge two branches? There are two methods to merge two branches, merge and rebase. Merge method is to merge two branch and generate a new commitment, whose parents are the two HEAD of the older branch. This is called a cross in the branch network. While the rebase method is to re-play every commitment of a branch to another branch, and there are no cross between them after two branch's rebase. And the best way to check the branches is working in right way is to check if there are crosses in branches. So the recommended method of combine two branches is to always use rebase instead of the merge. Because If you always u...

How to configure Samba Server in Ubuntu?

How to configure Samba Server in Ubuntu? Table of Contents What is Samba? Target Prepare configure /etc/samba/smb.conf 1 What is Samba? Samba is a linux implementation of file share and transaction protocol for LAN, which mainly used in Windows OS. Samba is more convenient than FTP in my opinion, and it is useful in a small group who works in a same LAN, but its members are familiar with different OS, Bob works in Mac, David works in Ubuntu, while Mars likes Windows more. 2  Target This tutorial is a step to step document of how to build a Samba Server which met the following requirement: Share a Directory with both readable and writable authority for Guest. Share a Directory with both readable and writable authority for certain Users. Share a Directory with only readable authority for Guest. 3 Prepare addgroup smbgrp adduser abc smbgrp smbpasswd -a abc mkdir /xxx/path chown -R abc:smbgrp /xxx/path mkdir /xxx/public chown -R nobody:nogroup...