2014年3月20日 星期四

echo close file wildcard

Problem:
If you want to separate a string the contain the wildcard such as start *,  in the bach it will display it


Method:
a. Use the quote. echo "*.sh"
b. use the set  -f operator:   (set -f; echo *.sh; set +f)

2014年3月4日 星期二

rsync

USAGE:

rsync -avP /source /destination/
will copy the source folder into destionation.

but  

if rsync -avP /source/ /destination/

will copy the data in source into destionation



Reference
Rsync example

2014年2月6日 星期四

Eclipse java update setting

1. Problem:
We want to update the java 1.6 to java 1.7 and appear error:
java compiler level does not match the version of the installed java project facet


2. Solution:
step a: Install the java jdk 1.7
step b: right chlick -> properties -> choose project facets -> java item (default 1.6, please click the 1.6 icon and choose 1.7)


Reference:
Youtube Solution

2014年1月20日 星期一

Struts2 if tag for string and char comparison

Explanation: 
There are tow tag using in charater: String , character , and there are different in judge, if you using the character you will get false:


Result:
1. String example for work
 
<s:set name="webFramework" value="framework"/>
<s:if test="%{#webFramework=='Struts 2'}">
    This is Struts 2
</s:if>
<s:elseif test="%{#webFramework=='Struts 1'}">
    This is Struts 1
</s:elseif>
<s:else>
    Other framework
</s:else>

2. Character for work
<s:if test='%{#session.IsLogin== ("T")}'>
    Login
</s:if>
<s:else>
    LogOut
</s:else>




Reference:
String compare
character compare


























struts2 session login

Reference:
Sessions in struts2 application

Simple Struts login in example

2014年1月16日 星期四

Eclipse update

For WPT

For Juno :
http://download.eclipse.org/webtools/repository/juno/
For Indigo :
http://download.eclipse.org/webtools/repository/indigo/
 
 
Reference: 
WTP-update 

2013年11月11日 星期一

Virtual Box 上 安裝 CentOS Guest Additions


Problem:

1. "building the virtualbox guest additions kernel modules [失敗]"
2. "Building the OpenGL support module FAILED "


1. Solution: (內容為參考 竹林小屋 Virtual Box 上 安裝 CentOS Guest Additions )
所需套件:
1.gcc
2.kernel-devel
3.kernel-headers

安裝流程:
yum install gcc    #安裝gcc,會同時安裝很多相依套件
yum install kernel-devel    #安裝kernel-devel
yum install kerner-headers    #安裝kernel-headers

安裝完成之後,還必須注意一點........
kernel、kernel-devel、kernel-headers三個套件版本要一樣!
否則人生失敗句可能還會再重現XD
rpm -qa | grep kernel    #檢查三個套件的版本是否一樣

筆者遇到kernel版本比其他兩個還要低,所以還要升級一下。
yum update kernel    #升級kernel版本

升級好之後,重新開機使用新的kernel。(不曉得有沒有不用重開的方法)

2. solution (http://it.oyksoft.com/post/6568/):

cd /media/VBOXADDITIONS_4.1.8_75467/
export MAKE='/usr/bin/gmake -i'
./VBoxLinuxAdditions.run


"make -i" , -i, --ignore-errors   Ignore errors from commands.忽略错误

3. 如果 kernel update 後, 程式
要從新 recompile 程式, 但會出現 /etc/init.d/vbox setup
yum install -y  kernel-devel