博客轉(zhuǎn)移
本博客決定轉(zhuǎn)移,請(qǐng)?jiān)L問(wèn)新地址 http://vincentchan.cn/另外如果有人有blogjava轉(zhuǎn)wordpress的博客搬家工具,可以共享一下~~
posted @ 2010-04-27 19:15 Vincent.Chen 閱讀(249) | 評(píng)論 (0) | 編輯 收藏
2005年12月9日 #
posted @ 2010-04-27 19:15 Vincent.Chen 閱讀(249) | 評(píng)論 (0) | 編輯 收藏
posted @ 2009-04-30 09:34 Vincent.Chen 閱讀(203) | 評(píng)論 (0) | 編輯 收藏
Tomcat+Axis客戶端調(diào)service產(chǎn)生java.lang.reflect.InvocationTargetException錯(cuò)誤
產(chǎn)生這個(gè)文題的原因是
1.server端發(fā)布的webservice程序中調(diào)用了某些jar或class,而服務(wù)器上卻沒(méi)有,解決方法是把jar或class拷貝到tomcat\common\lib或虛擬目錄的web-inf\lib目錄下
2.調(diào)用的方法出現(xiàn)了特殊的exception.但是你服務(wù)器上面沒(méi)有捕獲到
posted @ 2009-03-23 09:09 Vincent.Chen 閱讀(3489) | 評(píng)論 (0) | 編輯 收藏
posted @ 2009-03-14 13:34 Vincent.Chen 閱讀(406) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-07-04 23:42 Vincent.Chen 閱讀(421) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-07-01 00:34 Vincent.Chen 閱讀(262) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-06-24 00:13 Vincent.Chen 閱讀(237) | 評(píng)論 (0) | 編輯 收藏
2、設(shè)置Chart默認(rèn)字體:
如果在非windows系統(tǒng)下使用,可以拷貝windows系統(tǒng)下的simsun.ttc到classes路徑下,重啟服務(wù)器即可顯示中文
然后其他的一些字體大小等都要一個(gè)個(gè)設(shè)置了,因?yàn)槟J(rèn)英文字體大小顯示中文不好看
這樣就可以很完美顯示中文了。比起JFreeChart來(lái)好多了,JFreeChart雖然也可以解決中文顯示問(wèn)題,但是中文字體發(fā)虛,好像目前無(wú)法解決。
posted @ 2008-04-15 20:06 Vincent.Chen 閱讀(5413) | 評(píng)論 (5) | 編輯 收藏
posted @ 2008-04-02 21:38 Vincent.Chen 閱讀(4228) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-02-02 20:49 Vincent.Chen 閱讀(3411) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-02-02 20:41 Vincent.Chen 閱讀(414) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-02-02 20:34 Vincent.Chen 閱讀(849) | 評(píng)論 (0) | 編輯 收藏
posted @ 2008-01-20 22:01 Vincent.Chen 閱讀(36474) | 評(píng)論 (17) | 編輯 收藏
posted @ 2008-01-19 04:08 Vincent.Chen 閱讀(601) | 評(píng)論 (0) | 編輯 收藏
Archetype | Command |
---|---|
JSF Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-jsf -DremoteRepositories=http://static.appfuse.org/repository![]() |
Spring MVC Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-spring -DremoteRepositories=http://static.appfuse.org/repository![]() |
Struts 2 Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-struts -DremoteRepositories=http://static.appfuse.org/repository![]() |
Tapestry Basic | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-basic-tapestry -DremoteRepositories=http://static.appfuse.org/repository![]() |
JSF Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-jsf -DremoteRepositories=http://static.appfuse.org/repository![]() |
Spring MVC Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-spring -DremoteRepositories=http://static.appfuse.org/repository![]() |
Struts 2 Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-struts -DremoteRepositories=http://static.appfuse.org/repository![]() |
Tapestry Modular | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-modular-tapestry -DremoteRepositories=http://static.appfuse.org/repository![]() |
Core (backend only) | mvn archetype:create -DarchetypeGroupId=org.appfuse -DarchetypeArtifactId=appfuse-core -DremoteRepositories=http://static.appfuse.org/repository![]() |
posted @ 2007-07-18 22:58 Vincent.Chen 閱讀(1030) | 評(píng)論 (0) | 編輯 收藏
posted @ 2007-07-02 23:58 Vincent.Chen 閱讀(785) | 評(píng)論 (0) | 編輯 收藏
posted @ 2007-07-02 23:54 Vincent.Chen 閱讀(2125) | 評(píng)論 (1) | 編輯 收藏
Eclipse Europa is the annual release of Eclipse projects. Like last
year’s Callisto release, the Europa release is a coordinated release of
different Eclipse project teams. This year, the annual release includes
21 projects.
By releasing these projects at the same time, the goal is to eliminate
uncertainty about version compatibility and make it easier to
incorporate multiple projects into your environment.
While Europa is about the simultaneous release of twenty one projects,
it is not a unification of the projects - each project remains a
separate open source project operating with its own project leadership,
its own committers, and its own project plan.
posted @ 2007-06-29 00:19 Vincent.Chen 閱讀(563) | 評(píng)論 (0) | 編輯 收藏
posted @ 2007-06-07 00:01 Vincent.Chen 閱讀(4579) | 評(píng)論 (1) | 編輯 收藏
posted @ 2006-06-04 17:02 Vincent.Chen 閱讀(799) | 評(píng)論 (0) | 編輯 收藏
在Connection上調(diào)用close方法會(huì)關(guān)閉Statement和ResultSet嗎?
級(jí)聯(lián)的關(guān)閉這聽(tīng)起來(lái)好像很有道理,而且在很多地方這樣做也是正確的,通常這樣寫(xiě)
Connection con = getConnection();//getConnection is your method
PreparedStatement ps = con.prepareStatement(sql);
ResultSet rs = ps.executeQuery();
……
///rs.close();
///ps.close();
con.close(); // NO!
這
樣做的問(wèn)題在于Connection是個(gè)接口,它的close實(shí)現(xiàn)可能是多種多樣的。在普通情況下,你用
DriverManager.getConnection()得到一個(gè)Connection實(shí)例,調(diào)用它的close方法會(huì)關(guān)閉Statement和
ResultSet。但是在很多時(shí)候,你需要使用數(shù)據(jù)庫(kù)連接池,在連接池中的得到的Connection上調(diào)用close方法的時(shí)候,Connection可能并沒(méi)有被釋放,而是回到了連接池中。它以后可能被其它代碼取出來(lái)用。如果沒(méi)有釋放Statement和ResultSet,那么在Connection上沒(méi)有關(guān)閉的Statement和ResultSet可能會(huì)越來(lái)越多,那么……
相反,我看到過(guò)這樣的說(shuō)法,有人把Connection關(guān)閉了,卻繼續(xù)使用ResultSet,認(rèn)為這樣是可以的,引發(fā)了激烈的討論,到底是怎么回事就不用我多說(shuō)了吧。
所以我們必須很小心的釋放數(shù)據(jù)庫(kù)資源,下面的代碼片斷展示了這個(gè)過(guò)程
Connection con = null;
PreparedStatement ps = null;
ResultSet rs = null;
try {
con = getConnection();//getConnection is your method
ps = con.prepareStatement(sql);
rs = ps.executeQuery();
///...........
}
catch (SQLException ex) {
///錯(cuò)誤處理
}
finally{
try {
if(ps!=null)
ps.close();
}
catch (SQLException ex) {
///錯(cuò)誤處理
}
try{
if(con!=null)
con.close();
}
catch (SQLException ex) {
///錯(cuò)誤處理
}
}
很麻煩是不是?但為了寫(xiě)出健壯的程序,這些處理是必須的。
posted @ 2006-03-15 23:15 Vincent.Chen 閱讀(4375) | 評(píng)論 (0) | 編輯 收藏
Everybody knows that the basic native widgets in swt lack a lot of flexibility and features. An approach to solve these shortcomings is to build custom swt widgets that do not rely on native widgets but are custom drawn - the same approach that swing took. A good example is KTable. The custom swt widgets - custom drawn and aggergated native ones - I currently know of are:
posted @ 2006-02-21 22:39 Vincent.Chen 閱讀(1093) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:27 Vincent.Chen 閱讀(587) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:24 Vincent.Chen 閱讀(574) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:23 Vincent.Chen 閱讀(676) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:18 Vincent.Chen 閱讀(599) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:17 Vincent.Chen 閱讀(391) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:16 Vincent.Chen 閱讀(344) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:15 Vincent.Chen 閱讀(374) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:12 Vincent.Chen 閱讀(342) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-14 21:02 Vincent.Chen 閱讀(499) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-13 18:19 Vincent.Chen 閱讀(346) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-12 22:55 Vincent.Chen 閱讀(504) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-12 12:59 Vincent.Chen 閱讀(515) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-12 11:10 Vincent.Chen 閱讀(1046) | 評(píng)論 (1) | 編輯 收藏
posted @ 2006-02-12 11:08 Vincent.Chen 閱讀(445) | 評(píng)論 (0) | 編輯 收藏
或許你還沒(méi)有用過(guò)它, prototype.js 是一個(gè)由Sam Stephenson寫(xiě)的JavaScript包。這個(gè)構(gòu)思奇妙編寫(xiě)良好的一段兼容標(biāo)準(zhǔn)的一段代碼將承擔(dān)創(chuàng)造胖客戶端, 高交互性WEB應(yīng)用程序的重?fù)?dān)。輕松加入Web 2.0特性。
如果你最近體驗(yàn)了這個(gè)程序包,你很可能會(huì)發(fā)現(xiàn)文檔并不是它的強(qiáng)項(xiàng)之一。像所有在我之前的開(kāi)發(fā)者一樣,我只能一頭扎進(jìn)prototype.js的源代碼中并且試驗(yàn)其中的每一個(gè)部分。 我想當(dāng)我學(xué)習(xí)他的時(shí)候記寫(xiě)筆記然后分享給其他人將會(huì)很不錯(cuò)。
posted @ 2006-02-12 11:06 Vincent.Chen 閱讀(418) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-12 11:04 Vincent.Chen 閱讀(430) | 評(píng)論 (0) | 編輯 收藏
posted @ 2006-02-12 10:53 Vincent.Chen 閱讀(438) | 評(píng)論 (0) | 編輯 收藏
在 c:\mysql\bin\ 下運(yùn)行 winmysqladmin 啟動(dòng)
2、??? 登錄 MySQL
初始情況下默認(rèn)登錄用戶名 root ,密碼為空。
在 c:\mysql\bin 下運(yùn)行 mysql -uroot 即可。當(dāng)我們新建用戶之后按以下方式:
mysql -h(hostname) -u(username) -p(password)
3、??? 使用數(shù)據(jù)庫(kù)
初始安裝之后有一個(gè)保存系統(tǒng)表的數(shù)據(jù)庫(kù)—— mysql ,使用以下命令可以訪問(wèn)數(shù)據(jù)庫(kù)
use mysql;
4、??? 新建 MySQL 用戶
用 root 帳號(hào)登錄后,進(jìn)入 mysql 數(shù)據(jù)庫(kù),執(zhí)行插入語(yǔ)句:
insert into user (host,user,password) values('localhost','mysql',password('mysql'));
insert into user (host,user,password) values('%','mysql',password('mysql'));
flush privileges;
這樣就為 MySQL 建立了一個(gè)名為 mysql ,密碼為 mysql 的用戶,第一個(gè)用于本地登錄,第二個(gè)用于遠(yuǎn)程登錄。
<!
注意
:
在
user
與
(host,user,password)
之間必須有空格隔開(kāi)
>
<! 注意 : 在 values 與 ('','','') 之間沒(méi)有空格隔開(kāi),字符串用單引號(hào) >
5、??? 新建數(shù)據(jù)庫(kù)
create database test;
6、??? 退出
quit;
7、??? 幾個(gè)有用的 SQL 命令:
2??????? show databases :在剛登錄之后、使用數(shù)據(jù)庫(kù)之前查看現(xiàn)有數(shù)據(jù)庫(kù);
2??????? select database : 顯示當(dāng)前數(shù)據(jù)庫(kù)
2??????? show tables : 顯示當(dāng)前數(shù)據(jù)庫(kù)中的所有表
describe table_name :顯示某表的結(jié)構(gòu)8、??? 備份與恢復(fù) :
mysqldump -u username -p --opt? dbname >backupfileName.sql :將數(shù)據(jù)庫(kù)dbname導(dǎo)出到 backupfileName.sql文件中 ;
mysql dbname < backupfileName.sql:做反向工作。
posted @ 2006-02-09 00:06 Vincent.Chen 閱讀(720) | 評(píng)論 (2) | 編輯 收藏
posted @ 2006-01-18 00:34 Vincent.Chen 閱讀(533) | 評(píng)論 (0) | 編輯 收藏
通過(guò)一次小小的實(shí)踐,終于了解如何使用tomahawk中的tree2這個(gè)組件了,并且寫(xiě)了小段程序,從xml中讀取樹(shù)的結(jié)構(gòu),生成一個(gè)tree,不過(guò)tree2不能直接和xml綁定是一個(gè)遺憾,那樣就會(huì)省不少事情了。記下一點(diǎn)心得,以供后來(lái)參考了。
對(duì)tree2的操作分為兩部分,一部分是在頁(yè)面中通過(guò)tag定義樣式相關(guān)的東西,一部分就是通過(guò)編程添加樹(shù)的節(jié)點(diǎn),起初看了sample以后總是以為這東西有多么的復(fù)雜,其實(shí)邏輯是很簡(jiǎn)單的,只是sample中定義了多種不同的樣式的節(jié)點(diǎn),看上去很復(fù)雜而已。
下面附上我對(duì)sample簡(jiǎn)化過(guò)的這段tag來(lái)說(shuō)明一下。
<t:tree2 value="#{catalog.node}" var="node" id="clientside" varNodeToggler="t" >
<f:facet name="folder">
<h:panelGroup>
<f:facet name="expand">
<t:graphicImage value="images/yellow-folder-open.png" rendered="#{t.nodeExpanded}" border="0"/>
</f:facet>
<f:facet name="collapse">
<t:graphicImage value="images/yellow-folder-closed.png" rendered="#{!t.nodeExpanded}" border="0"/>
</f:facet>
<h:outputText value="#{node.description}"/>
</h:panelGroup>
</f:facet>
</t:tree2>
tree2的主tag定義了tree的根節(jié)點(diǎn)和一些相關(guān)的參數(shù)。嵌套的那個(gè)facet定義了一種節(jié)點(diǎn)的樣式,包括展開(kāi)與關(guān)閉時(shí)的圖片,以及顯示的文字內(nèi)容。
在程序里面,我們root TreeNodeBase = new TreeNodeBase(…)來(lái)創(chuàng)建一個(gè)root節(jié)點(diǎn),然后通過(guò)root.getChildren().add(new TreeNodeBase(…))為其添加子節(jié)點(diǎn),任何一個(gè)節(jié)點(diǎn)都可以添加任意多的子節(jié)點(diǎn),通過(guò)這樣的操作,我們可以很容易的生成一個(gè)tree的結(jié)構(gòu)了,實(shí)際上,這個(gè)tree的結(jié)構(gòu)是通過(guò)遞歸從xml中讀取出來(lái),生成一個(gè)和xml tree完全相同的結(jié)構(gòu)。
除了明白如何去用這個(gè)tree2之外的收獲就是,終于明白了如何去通過(guò)遞歸方法遍歷一個(gè)樹(shù)形結(jié)構(gòu),雖然在學(xué)校里學(xué)過(guò)遍歷的算法,也抄過(guò)例程,但從來(lái)沒(méi)有理解過(guò)是怎么一回事,終于在實(shí)踐中理解了,實(shí)踐才是軟件的根本之道。
查看 解析Tree2 全文
posted @ 2006-01-14 03:43 Vincent.Chen 閱讀(643) | 評(píng)論 (0) | 編輯 收藏
在商界,我們的確通常需要確保始終實(shí)施某些規(guī)則。例如,參與項(xiàng)目的雇員必須被雇用。或者想要某些事件有計(jì)劃地發(fā)生。例如,如果銷(xiāo)售員售出一批商品,則應(yīng)增加其傭金。
DB2 通用數(shù)據(jù)庫(kù)為此提供了一套有用的方法。 唯一約束是禁止在表的一列或多列中出現(xiàn)重復(fù)值的規(guī)則。 參考完整性約束確保在整個(gè)指定的表中數(shù)據(jù)一致性。 表檢查約束是一些條件,它們定義為表定義的一部分,限制一列或多列中使用的值。觸發(fā)器允許您定義一組操作,這些操作通過(guò)對(duì)指定的表進(jìn)行刪除、插入或更新操作來(lái)執(zhí)行或觸發(fā)。觸發(fā)器可用于寫(xiě)入其他表、修改輸入值以及發(fā)布警報(bào)信息。
posted @ 2006-01-10 23:42 Vincent.Chen 閱讀(611) | 評(píng)論 (0) | 編輯 收藏
posted @ 2005-12-31 18:38 Vincent.Chen 閱讀(869) | 評(píng)論 (1) | 編輯 收藏
posted @ 2005-12-11 22:08 Vincent.Chen 閱讀(2510) | 評(píng)論 (3) | 編輯 收藏
posted @ 2005-12-09 00:16 Vincent.Chen 閱讀(360) | 評(píng)論 (0) | 編輯 收藏