2012年12月16日 星期日

Eclipse 啟動時卡住問題

Eclipse在啟動時卡住 停在loading org.eclipse.debug.core

解決方法

刪除
.metadata\.plugins\org.eclipse.core.resources\.root\.markers.snap

不行在刪除

.metadata\.plugins\org.eclipse.core.resources\.projects\<project>\.markers.snap
如果還不行刪除 
.metadata\.plugins\org.eclipse.core.resources\.snap

2012年8月5日 星期日

Deploy Error : A composition unit with name already exists. Select a different application name


from: http://turanunes.wordpress.com/2011/09/21/deploy-error-a-composition-unit-with-name-already-exists-select-a-different-application-name/

When installing an application or performing other administrative actions in WebSphere Application Server version 7.x, the following error is received:
”A composition unit with name already exists. Select a different application name”
Resolving the Problem :
There are some temp file s on the Websphere server , you can delete them…
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/(CellName)/blas/(AppName)
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/(CellName)/cus/(AppName)
and also you can delete
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/wstemp/*.*
/opt/IBM/WebSphere/AppServer/profiles/Dmgr01/config/cells/isprodwas61Cell01/blas/(AppName)


window==>
C:\Program Files (x86)\IBM\SDP75\runtimes\base_v7\profiles\was70profile1\config\cells\lunayccleo-VAIONode01Cell\blas
C:\Program Files (x86)\IBM\SDP75\runtimes\base_v7\profiles\was70profile1\config\cells\lunayccleo-VAIONode01Cell\cus


C:\Program Files (x86)\IBM\SDP75\runtimes\base_v7\profiles\was70profile1\wstemp

2012年4月30日 星期一

Open multiple eclipse workspace in Mac

1. use command line to go to your eclipse folder
cd /Documents/eclipse

2. open eclipse as follow
./eclipse &

2012年4月29日 星期日

Eclipse configure reference project

when your web project in eclipse need to use classes from java project

then you need to set up your java project as  your reference project










1 configure project dependency















2.add require project

2012年4月14日 星期六

setting up apache-solr in eclipse with tomcat

1.download apache solr
http://lucene.apache.org/solr/index.html

2.import apache-solr-xx.war into your eclipse

3.copy solr config (apache-solr-3.5.0\client\ruby\solr-ruby\solr\conf) into your dynamic web project
  your project should look something like this

4. define solr home in your web.xml
    add the following in your web.xml
    the marked text is the location of your solr config in your web project

    <env-entry>
       <env-entry-name>solr/home</env-entry-name>
       <env-entry-value>C:/LeoProject/apache-solr-3.5.0/solr</env-entry-value>
       <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>

5. now you can run your solr in eclipse with tomcat

2012年4月7日 星期六

Tomcat SSL support for Spring Security and CAS

最近為了整合Spring Security 和 CAS (Central Authentication Service)
(HTTPS是CAS SERVER的默認訪問通道,由於考慮到安全性,數據都經過通過SSL通道加密傳送)
在本機開發時須配置Tomcat支持SSL服務


以下為配置步驟:


生成SSL證書
Window
1.刪除 %JRE_HOME%/lib/security/cacerts 
2.生成證書
keytool -genkey -alias tomcat -keyalg RSA -keystore C:/tomcat
3.匯出證書
keytool -export -file C:/tomcat.crt -alias tomcat -keystore C:/tomcat
4.導入證書
keytool -import -keystore C:/"Program Files"/Java/jre6/lib/security/cacerts -file C:/tomcat.crt -alias tomcat


Mac
1.生成證書
keytool -genkey -alias tomcat -keyalg RSA -keystore /Users/lunayccleo/Documents/keys/tomcat
2.繪出證書
keytool -export -file /Users/lunayccleo/Documents/keys/tomcat.crt -alias tomcat -keystore /Users/lunayccleo/Documents/keys/tomcat
3.導入證書
sudo keytool -import -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts -file /Users/lunayccleo/Documents/keys/tomcat.crt -alias tomcat
ps:刪除憑證讓你可以重新匯入相同名字的憑證
 sudo keytool -delete -keystore /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/security/cacerts -alias tomcat

Default password is changeit
jdk 憑證 (cacerts)預設密碼: changeit 

Tomcat 
server.xml 加入
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" clientAuth="false"
sslProtocol="TLS" keystoreFile="C:/tomcat"
keystorePass="changeit" />




2012年3月21日 星期三

Eclipse Indigo 字型設定

Window --> Preferences --> General --> Appearance --> Colors and Fonts --> Basic --> Text Font

2012年2月28日 星期二

enable Spring Transaction Annotation

enable Spring Transaction Annotation

in your springConfig.xml
add the following  


<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean"> 
        <property name="jndiName"> 
            <value>${jndi}</value> 
        </property> 
</bean> 

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">     
<property name="dataSource" ref="dataSource"/>
</bean> 
 
<!-- enable transaction annotation -->
<tx:annotation-driven transaction-manager="transactionManager"/>  

  

2012年2月7日 星期二

Linux 底下MySQL 指令


# /etc/init.d/mysqld start
啟動 MySQL

# mysql -u root
初次使用是不用輸入密碼。

要離開只要輸入quit就行了。
mysql>\ quit

# mysqladmin -u root password 'password'
從此以後 MySQL 的 root 帳號就需要密碼了!
如下所示:
# mysql -u root -p 
password: 密碼

mysql>update user set password=password('password') where user='root';
設定root的密碼。

mysql>\ show databases;
顯示all databases。

mysql> \use database's name;
選擇指定的database。

mysql>\ show tables;
顯示all tables in database。

# /etc/init.d/mysql stop
關掉MySQL。


如果你想進行遠程訪問或控制,那麼你要做兩件事:
1.

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'password' WITH GRANT OPTION;


授權讓遠端登入,可以把 '%' 改成主機的IP
2.

老的版本中
>skip-networking => # skip-networking
新的版本中
>bind-address=127.0.0.1 => bind-address= 你機器的IP

2012年2月1日 星期三

JSP 防止快取

在程式開頭加入以下
response.setHeader("Cache-Control","no-cache"); //HTTP 1.1
response.setHeader("Pragma","no-cache"); //HTTP 1.0
response.setDateHeader ("Expires", 0); //prevent caching at the proxy server

2012年1月15日 星期日

IE6,IE7 position absolute問題

在IE6,IE7 CSS設定position:absolute;時需要加上left:0px;
,顯示時才會和其他瀏覽器一致
FireFox/Chrome預設為left:0px;但IE6,IE7預設似乎是置中
導致沒有設定left:0px;時IE6,IE7看起來和其他瀏覽器不同

2012年1月2日 星期一

JAVA讀取資料換行

讀取檔案時(文字檔,EXCEL等等)
換行的符號 '\n'
ENTER的符號 '\r'

可以用String.replace("\n","替代的文字"), String.split("\n") 等等來做對應處理