如果iReport 發生下列錯誤,可能是PDF字型沒有裝好
Error exporting print... Could not load the following font
1. 網址 : http://prdownloads.sourceforge.net/itext/iTextAsian.jar 下載 iTextAsian.jar
2. 網址 : http://sourceforge.net/projects/itext/ 下載 iText.jar
2. 將 iText.jar 及 iTextAsian.jar存放至 iReport\ireport\modules\ext 目錄中
3. 打開iReport,進入Tools -> Options內的iReport選項設定
4. 先在Classpath頁,點擊Add JAR,將ireport/modules/ext/iTextAsian.jar 及 iText.jar 列入Classpath清單
5. 完成以上步驟後,才能在Fontpath頁上看到iTextAsian.jar 還有 iText.jar , 勾選它,再重開iReport 就完成了。
資料參考網址:http://blog.cjcht.com/index.php/henry/2009/04/
2009年9月16日 星期三
2009年9月10日 星期四
SQL 2005 Connection timeout 連線逾時處理
DBA’s Quick Guide to Timeouts
by Chris Kempster
The author of: SQL Server 2000 for the Oracle DBA
Click here for more information, sample chapters, or to purchase this e-book.
The application development DBA needs a good understanding of the overarching application architecture and subsequent technologies (COM+, MSMQ, IIS, ASP etc) to more proactively debug and track down database performance problems. A good place to start is common timeout error. This article will provide a brief overview of where to look and how to set the values.
ADO
Within ADO, the developer can set:
connection timeout (default 15 seconds)
if the connection cannot be established within the timeframe specified
command timeout (default 30 seconds)
cancellation of the executing command for the connection if it does not respond within the specified time.
These properties also support a value of zero, representing an indefinite wait.
Here is some example code:
Dim MyConnection as ADODB.Connection
Set MyConnection = New ADODB.Connection
MyConnection.ConnectionTimeout = 30
MyConnection.Open
- and -
Set MyConnection = New ADODB.Connection
<>
MyConnection.Open strMyConn
Set myCommand = New ADODB.Command
Set myCommand.ActiveConnection = MyConnection
myCommand.CommandTimeout = 15
Take care with command timeouts are described by Microsoft:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q188858
文件原文 http://vyaskn.tripod.com/watch_your_timeouts.htm
by Chris Kempster
The author of: SQL Server 2000 for the Oracle DBA
Click here for more information, sample chapters, or to purchase this e-book.
The application development DBA needs a good understanding of the overarching application architecture and subsequent technologies (COM+, MSMQ, IIS, ASP etc) to more proactively debug and track down database performance problems. A good place to start is common timeout error. This article will provide a brief overview of where to look and how to set the values.
ADO
Within ADO, the developer can set:
connection timeout (default 15 seconds)
if the connection cannot be established within the timeframe specified
command timeout (default 30 seconds)
cancellation of the executing command for the connection if it does not respond within the specified time.
These properties also support a value of zero, representing an indefinite wait.
Here is some example code:
Dim MyConnection as ADODB.Connection
Set MyConnection = New ADODB.Connection
MyConnection.ConnectionTimeout = 30
MyConnection.Open
- and -
Set MyConnection = New ADODB.Connection
<
MyConnection.Open strMyConn
Set myCommand = New ADODB.Command
Set myCommand.ActiveConnection = MyConnection
myCommand.CommandTimeout = 15
Take care with command timeouts are described by Microsoft:
http://support.microsoft.com/default.aspx?scid=KB;en-us;q188858
文件原文 http://vyaskn.tripod.com/watch_your_timeouts.htm
2009年7月29日 星期三
java mail sample
文章引用來源:http://hyh.mis.dwu.edu.tw/jsp/mail.htm
要先下載並安裝java mail 元件.
http://developers.sun.com/downloads/

下面是java mail 的範例
InternetAddress[] address = null;
request.setCharacterEncoding("big5");
String mailserver = "192.168.0.101"; // <=此處所設必須和寄件人的信箱同一台伺服器,
String From = request.getParameter("From"); 並且必須考慮伺服器是否會mail-rely
String to = request.getParameter("To");
String Subject = request.getParameter("Subject");
String messageText = request.getParameter("Message");
boolean sessionDebug = false;
try {
// 設定所要用的Mail 伺服器和所使用的傳送協定
java.util.Properties props = System.getProperties();
props.put("mail.host",mailserver);
props.put("mail.transport.protocol","smtp"); // <=設定所使用的protocol為SMTP(Small Mail Transfer Protocol)
// 產生新的Session 服務
javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
// 設定傳送郵件的發信人
msg.setFrom(new InternetAddress(From));
// 設定傳送郵件至收信人的信箱
address = InternetAddress.parse(to,false);
msg.setRecipients(Message.RecipientType.TO, address);
// 設定信中的主題
msg.setSubject(Subject);
// 設定送信的時間
msg.setSentDate(new Date());
// 設定傳送信的MIME Type
msg.setText(messageText);
// 送信
Transport.send(msg);
out.println("郵件己順利傳送");
}
catch (MessagingException mex) {
mex.printStackTrace();
}
要先下載並安裝java mail 元件.
http://developers.sun.com/downloads/

下面是java mail 的範例
InternetAddress[] address = null;
request.setCharacterEncoding("big5");
String mailserver = "192.168.0.101"; // <=此處所設必須和寄件人的信箱同一台伺服器,
String From = request.getParameter("From"); 並且必須考慮伺服器是否會mail-rely
String to = request.getParameter("To");
String Subject = request.getParameter("Subject");
String messageText = request.getParameter("Message");
boolean sessionDebug = false;
try {
// 設定所要用的Mail 伺服器和所使用的傳送協定
java.util.Properties props = System.getProperties();
props.put("mail.host",mailserver);
props.put("mail.transport.protocol","smtp"); // <=設定所使用的protocol為SMTP(Small Mail Transfer Protocol)
// 產生新的Session 服務
javax.mail.Session mailSession = javax.mail.Session.getDefaultInstance(props,null);
mailSession.setDebug(sessionDebug);
Message msg = new MimeMessage(mailSession);
// 設定傳送郵件的發信人
msg.setFrom(new InternetAddress(From));
// 設定傳送郵件至收信人的信箱
address = InternetAddress.parse(to,false);
msg.setRecipients(Message.RecipientType.TO, address);
// 設定信中的主題
msg.setSubject(Subject);
// 設定送信的時間
msg.setSentDate(new Date());
// 設定傳送信的MIME Type
msg.setText(messageText);
// 送信
Transport.send(msg);
out.println("郵件己順利傳送");
}
catch (MessagingException mex) {
mex.printStackTrace();
}
2009年7月2日 星期四
“Warning: Cannot send session cookie - headers already sent...”或者“Cannot add/modify header information - headers already sent...” 錯誤
大家常看到的 錯誤碼 “Warning: Cannot send session cookie - headers already sent...”或者“Cannot add/modify header information - headers already sent...”
1. 何謂 HEADER :
請參考這篇文章
http://bbs.ecstart.com/viewthrea ... 1%AA%BA%A8%CF%A5%CE
而 PHP 中 SET_COOIE 和 SESSION_START 上方 通常都是不準許 ECHO 出 字串的
原因是因為 它們不容許 在插入 HEADER (表頭) 內容時 , 程式出現 了 HTML 或 空白 或其它字元 .
2. 如何知道 執行 SET_COOKIE 和 SESSION_START 時 出現了 HEADER 以為的語法 :
請參考這篇文章 :
http://tw.php.net/manual/en/function.headers-sent.php
3. 解決方案 :
A. 從程式裡把出現在header前的字元拿掉 ( 慢慢找 )
B. ob_start() << 利用 OB_START ....
簡單的說 OB_START 就是將 要吐出來的內容 先放到記憶體 等記憶體放滿了才會吐出來 .
所以 它會將預吐出來的資料先放入 BUFFER 等 BUFFER 滿了 才會一口氣吐出來 , 這樣就可以避免 HEADER 中間被插入其它字串或字元.
這個解法上述有人提過了 ,
但是你好像還會發生 , 所以我在猜 , 還沒有進入 PHP BUFFER 的控制前 就有東西吐出來了 .
所以上述也有人提到 可能是 BOM 或是 APACHE 本身不知吐了什麼東西出來.
到此都只是猜測...
詳細 OB_START 介紹 : http://bbs.ecstart.com/viewthrea ... ob%5C_start%2BFIEND
C. 將 php.ini 的 output_buffering 改成 : ( BUFFER 上述己跟大家介紹過觀念這裡不多加描述 ); Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = 4096
複製代碼D. 直接改 HTTPD SERVER :
AllowOverride All
如果你是租 主機 ... 在 .htaccess 內加入 :
AllowOverride All
PHP_FLAG output_buffering On
###############################
上述資料出處:
http://bbs.ecstart.com/thread-30347-1-4.html
1. 何謂 HEADER :
請參考這篇文章
http://bbs.ecstart.com/viewthrea ... 1%AA%BA%A8%CF%A5%CE
而 PHP 中 SET_COOIE 和 SESSION_START 上方 通常都是不準許 ECHO 出 字串的
原因是因為 它們不容許 在插入 HEADER (表頭) 內容時 , 程式出現 了 HTML 或 空白 或其它字元 .
2. 如何知道 執行 SET_COOKIE 和 SESSION_START 時 出現了 HEADER 以為的語法 :
請參考這篇文章 :
http://tw.php.net/manual/en/function.headers-sent.php
3. 解決方案 :
A. 從程式裡把出現在header前的字元拿掉 ( 慢慢找 )
B. ob_start() << 利用 OB_START ....
簡單的說 OB_START 就是將 要吐出來的內容 先放到記憶體 等記憶體放滿了才會吐出來 .
所以 它會將預吐出來的資料先放入 BUFFER 等 BUFFER 滿了 才會一口氣吐出來 , 這樣就可以避免 HEADER 中間被插入其它字串或字元.
這個解法上述有人提過了 ,
但是你好像還會發生 , 所以我在猜 , 還沒有進入 PHP BUFFER 的控制前 就有東西吐出來了 .
所以上述也有人提到 可能是 BOM 或是 APACHE 本身不知吐了什麼東西出來.
到此都只是猜測...
詳細 OB_START 介紹 : http://bbs.ecstart.com/viewthrea ... ob%5C_start%2BFIEND
C. 將 php.ini 的 output_buffering 改成 : ( BUFFER 上述己跟大家介紹過觀念這裡不多加描述 ); Output buffering allows you to send header lines (including cookies) even
; after you send body content, at the price of slowing PHP's output layer a
; bit. You can enable output buffering during runtime by calling the output
; buffering functions. You can also enable output buffering for all files by
; setting this directive to On. If you wish to limit the size of the buffer
; to a certain size - you can use a maximum number of bytes instead of 'On', as
; a value for this directive (e.g., output_buffering=4096).
output_buffering = 4096
複製代碼D. 直接改 HTTPD SERVER :
AllowOverride All
如果你是租 主機 ... 在 .htaccess 內加入 :
AllowOverride All
PHP_FLAG output_buffering On
###############################
上述資料出處:
http://bbs.ecstart.com/thread-30347-1-4.html
2009年6月26日 星期五
ORACLE SEQUENCE的簡單介紹
在oracle中sequence就是所謂的序列號,每次取的時候它會自動增加,一般用在需要按序列號排序的地方。
1、Create Sequence
你首先要有CREATE SEQUENCE或者CREATE ANY SEQUENCE權限,
CREATE SEQUENCE emp_sequence
INCREMENT BY 1 -- 每次加幾個
START WITH 1 -- 從1開始計數
NOMAXVALUE -- 不設置最大值
NOCYCLE -- 一直累加,不循環
CACHE 10;
一旦定義了emp_sequence,你就可以用CURRVAL,NEXTVAL
CURRVAL=返回 sequence的當前值
NEXTVAL=增加sequence的值,然返回 sequence 值
比如:
emp_sequence.CURRVAL
emp_sequence.NEXTVAL
可以使用sequence的地方:
- 不包含子查詢、snapshot、VIEW的 SELECT 語句
- INSERT語句的子查詢中
- NSERT語句的VALUES中
- UPDATE 的 SET中
資料來源:http://fanqiang.chinaunix.net/a2/b2/20010514/10150052_b.html
1、Create Sequence
你首先要有CREATE SEQUENCE或者CREATE ANY SEQUENCE權限,
CREATE SEQUENCE emp_sequence
INCREMENT BY 1 -- 每次加幾個
START WITH 1 -- 從1開始計數
NOMAXVALUE -- 不設置最大值
NOCYCLE -- 一直累加,不循環
CACHE 10;
一旦定義了emp_sequence,你就可以用CURRVAL,NEXTVAL
CURRVAL=返回 sequence的當前值
NEXTVAL=增加sequence的值,然返回 sequence 值
比如:
emp_sequence.CURRVAL
emp_sequence.NEXTVAL
可以使用sequence的地方:
- 不包含子查詢、snapshot、VIEW的 SELECT 語句
- INSERT語句的子查詢中
- NSERT語句的VALUES中
- UPDATE 的 SET中
資料來源:http://fanqiang.chinaunix.net/a2/b2/20010514/10150052_b.html
2009年6月4日 星期四
tomcat 6.0 + apache 2.2.4
1.下載mod_jk
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/
存在apache中的modules 目錄
2.產生或修改workers.properties 檔案, 存在apache下的conf 目錄中
#文件內容開始
workers.tomcat_home="C:\AppServ\Tomcat"
workers.java_home="C:\Program Files\Java\jdk1.6.0_12"
ps=\
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps) classes
worker.inprocess.class_path=$(workers.tomcat_home)$(ps) lib$ (ps)jaxp.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$ (ps)parser.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar
worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar
worker.inprocess.cmd_line=-config
worker.inprocess.cmd_line=$(workers.tomcat_home) /conf/jni_server.xml
worker.inprocess.cmd_line=-home
worker.inprocess.cmd_line=$(workers.tomcat_home)
worker.inprocess.jvm_lib=$(workers.java_home) $(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr
worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#文件內容結束
2.產生或修改http-vhosts.conf 檔案, 存在apache下的conf\extra 目錄中
#文件內容開始
ServerAdmin xxx@yahoo.com.tw
DocumentRoot C:/AppServ/www
ServerName localhost
DirectoryIndex index.php index.html index.htm index.jsp index.jspx
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#文件內容結束
3.在apache下的conf 目錄中的httpd.conf 檔最未端加入下列內容
#文件內容開始
LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so
JkWorkersFile "C:\AppServ\Apache2.2\conf\workers.properties"
JkLogFile "logs/mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkMount /examples ajp13
JkMount /examples/* ajp13
JkMount /spadmin ajp13
JkMount /spadmin/* ajp13
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /*.do ajp13
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
#
# ResinConfigServer localhost 6802
#CauchoStatus yes
#
#文件內容結束
4.重新啓動apache 及tomcat 就可以了
http://www.apache.org/dist/tomcat/tomcat-connectors/jk/binaries/win32/jk-1.2.28/
存在apache中的modules 目錄
2.產生或修改workers.properties 檔案, 存在apache下的conf 目錄中
#文件內容開始
workers.tomcat_home="C:\AppServ\Tomcat"
workers.java_home="C:\Program Files\Java\jdk1.6.0_12"
ps=\
worker.list=ajp13
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13
worker.ajp13.lbfactor=1
worker.loadbalancer.type=lb
worker.loadbalancer.balanced_workers=ajp13
worker.inprocess.type=jni
worker.inprocess.class_path=$(workers.tomcat_home)$(ps) classes
worker.inprocess.class_path=$(workers.tomcat_home)$(ps) lib$ (ps)jaxp.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)lib$ (ps)parser.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)jasper.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)servlet.jar
worker.inprocess.class_path=$(workers.tomcat_home)$(ps)common$(ps)lib$(ps)webserver.jar
worker.inprocess.class_path=$(workers.java_home)$(ps)lib$(ps)tools.jar
worker.inprocess.cmd_line=-config
worker.inprocess.cmd_line=$(workers.tomcat_home) /conf/jni_server.xml
worker.inprocess.cmd_line=-home
worker.inprocess.cmd_line=$(workers.tomcat_home)
worker.inprocess.jvm_lib=$(workers.java_home) $(ps)jre$(ps)bin$(ps)classic$(ps)jvm.dll
worker.inprocess.stdout=$(workers.tomcat_home)$(ps)inprocess.stdout
worker.inprocess.stderr=$(workers.tomcat_home)$(ps)inprocess.stderr
worker.inprocess.sysprops=tomcat.home=$(workers.tomcat_home)
#文件內容結束
2.產生或修改http-vhosts.conf 檔案, 存在apache下的conf\extra 目錄中
#文件內容開始
ServerAdmin xxx@yahoo.com.tw
DocumentRoot C:/AppServ/www
ServerName localhost
DirectoryIndex index.php index.html index.htm index.jsp index.jspx
Options Indexes MultiViews
AllowOverride None
Order allow,deny
Allow from all
#文件內容結束
3.在apache下的conf 目錄中的httpd.conf 檔最未端加入下列內容
#文件內容開始
LoadModule jk_module modules/mod_jk-1.2.28-httpd-2.2.3.so
JkWorkersFile "C:\AppServ\Apache2.2\conf\workers.properties"
JkLogFile "logs/mod_jk.log"
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y]"
JkMount /examples ajp13
JkMount /examples/* ajp13
JkMount /spadmin ajp13
JkMount /spadmin/* ajp13
JkMount /servlet/* ajp13
JkMount /*.jsp ajp13
JkMount /*.do ajp13
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
#
# ResinConfigServer localhost 6802
#CauchoStatus yes
#
#文件內容結束
4.重新啓動apache 及tomcat 就可以了
2009年6月2日 星期二
SQL SERVER ODBC
SQL SERVER ODBC 有兩種, 一種是SQL SERVER DRIVER, 另一種是SQL Native Client.
如果SQL SERVER 是SQL 2005以後的(含SQL 2005), 那要用SQL Native Client,
SQL 2003以前的(), 那用SQL SERVER DRIVER就可以了.
如果SQL SERVER 是SQL 2005以後的(含SQL 2005), 那要用SQL Native Client,
SQL 2003以前的(), 那用SQL SERVER DRIVER就可以了.
訂閱:
文章 (Atom)