http://lydawen.blog.163.com/blog/static/18668342008102772434661/
2009年6月8日 星期一
2009年5月4日 星期一
使用JCIFS存取samba folder
JCIFS web site: http://jcifs.samba.org/
Sample code:
jcifs.Config.setProperty("jcifs.smb.client.domain", "APNET");
jcifs.Config.setProperty("jcifs.smb.client.username", "apuser");
jcifs.Config.setProperty("jcifs.smb.client.password", "appassword");
java.io.FileInputStream input = new java.io.FileInputStream("d:/temp/test.txt");
jcifs.smb.SmbFileOutputStream output = new jcifs.smb.SmbFileOutputStream(
"smb://hostname/upload$/test.txt");
byte[] b = new byte[8192];
int n;
while ((n = input.read(b)) > 0) {
System.out.write(b, 0, n);
output.write(b, 0, n);
}
input.close();
output.close();
2009年3月13日 星期五
用 Spring 取得 Oracle Sequence 及 Hibernate 的設定
Oracle:
create sequence ORDER_SEQ
start with 1
increment by 1
nomaxvalue;
Spring:
使用Spring提供的org.springframework.jdbc.support.incrementer.OracleSequenceMaxValueIncrementer:
OracleSequenceMaxValueIncrementer incr = new OracleSequenceMaxValueIncrementer(dataSource, "ORDER_SEQ");
int seq = incr.nextIntValue();
Hibernate:
<id name="id" column="ID" type="java.lang.Long">
<generator class="sequence">
<param name="sequence">ORDER_SEQ</param>
</generator>
</id>
2009年3月11日 星期三
Find which process has occupied which port
lsof – list open files
The syntax for using "lsof" is:
lsof -i tcp:3480
or
lsof -i udp:3480
if you are interested in port 3480, over the appropriate protocol, TCP or UDP...
In Windows:
C:\>netstat -abno
使用中連線
協定 本機位址 外部位址 狀態 PID
TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 1932
[httpd.exe]
TCP 0.0.0.0:113 0.0.0.0:0 LISTENING 3580
[ident.exe]
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 800
RpcSs
[svchost.exe]
TCP 0.0.0.0:1025 0.0.0.0:0 LISTENING 472
[wininit.exe]
In AIX:
netstat -Aa | gret 8080
rmsock xxxxxxxx tcpcb
ps -ef|grep thepid
2009年3月10日 星期二
Transaction strategies: Models and strategies overview
The Java platform supports six types of transaction attributes, regardless of whether you are using EJB or the Spring Framework:
Required, Mandatory, RequiresNew, Supports, NotSupported, Never.2009年3月5日 星期四
Running servlet container behind IIS
Installing and Configuring the Microsoft IIS Weblogic proxy Plug-In
http://e-docs.bea.com/wls/docs92/plugins/isapi.html
The Apache Tomcat Connector - Reference Guide - Configuring IIS
http://tomcat.apache.org/connectors-doc/reference/printer/iis.html
Running Tomcat behind IIS
http://www.boplicity.net/confluence/display/Tomcat/Running+Tomcat+behind+IIS
Windows2003下完美配置整合IIS 6+Jre 1.6+Tomcat 6.0.18 - windows 服务器
http://blog.chinaunix.net/u2/69106/showart_1417949.html
整合 IIS 5.1 和 Tomcat 5.5 的步驟
http://xml.nchu.edu.tw/blogs/?p=48
ONJava.com Configuring Tomcat with IIS Web Server
http://www.onjava.com/lpt/a/2829
2009年3月4日 星期三
Tomcat 5.5 SSL Configuration
keytool -genkey -alias tomcat -keyalg RSA
and specify a password value of "changeit".
keytool -delete -alias tomcat
Change the password from “changeit” to “newpass”:
keytool -keypasswd -alias tomcat -keypass changeit -new newpass
The keystore is by default stored in a file named .keystore in the user's home directory, as determined by the "user.home" system property.
Read http://java.sun.com/j2se/1.3/docs/tooldocs/win32/keytool.html for more information about keytool.