2008年8月20日 星期三

GP materials

1. GP - how to implement Service Level of Agreement in GP

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/5929

2. Cross-application alerts in processes: An example based on Guided
Procedures

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/9119

3. Guided Procedures Explorations: Process Runtime Dashboard

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6271

4. How To Create Dynamic Approval Process Using Conditional Loop Block
in Guided Procedure

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/6664

5. A Tale of Two Brothers: Guided Procedures and the SAP NetWeaver BPM
Product

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/10050

2008年8月10日 星期日

在WinXP開機、關機時自動執行指令碼

1.先從開始 » 執行... 輸入 gpedit.msc 然後按下 Enter,開啟群組原則。
2.然後找到本機電腦 原則 » 電腦設定 » Windows 設定 » 指令碼 - (啟動/關機)
3.在啟動及關機處,新增指令碼名稱及指令碼參數

2008年7月8日 星期二

Weblogic 10 ANTLR issue

Due to the issue of ANTLR that weblogic 10 uses internally, we need to add a file WEB-INF/weblogic.xml with the following contents to solve the conflict:


<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app
xmlns="http://www.bea.com/ns/weblogic/90"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/ns/weblogic/90
                    http://www.bea.com/ns/weblogic/90/weblogic-web-app.xsd">

   <container-descriptor>
      <prefer-web-inf-classes>true</prefer-web-inf-classes>
   </container-descriptor>
</weblogic-web-app>


This file make Weblogic use classes and libraries in the web application before other libraries in the classpath.

2008年7月7日 星期一

Struts Download File Example

public ActionForward doViewAttachFile(ActionMapping aMapping, ActionForm aForm,
HttpServletRequest aRequest, HttpServletResponse aResponse) throws Exception {
Efp136Form efp136Form = (Efp136Form) aForm;
Efp136m efp136m = (Efp136m) efp136Form.getEntity();

String fileName = URLEncoder.encode(efp136m.getAttachFileName(), "UTF-8");
aResponse.setHeader("Content-disposition", "attachment; filename=" + fileName);
aResponse.setContentType(efp136m.getAttachFileType());
aResponse.setContentLength(efp136m.getAttachFileSize().intValue());

ServletOutputStream servletOutputStream = aResponse.getOutputStream();
BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(servletOutputStream);
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(efp136m.getAttachFileData());
BufferedInputStream bufferedInputStream = new BufferedInputStream(byteArrayInputStream);
byte[] bytes = new byte[2048];
while (bufferedInputStream.read(bytes) != -1) {
bufferedOutputStream.write(bytes);
}

servletOutputStream.flush();
byteArrayInputStream.close();
servletOutputStream.close();
return aMapping.findForward(VIEW_ATTACH_FILE_SUCCESS);
}

2008年7月6日 星期日

根據hibernate configuration file建立table schema

程式範例如下:

package mytest;

import org.hibernate.cfg.Configuration;
import org.hibernate.tool.hbm2ddl.SchemaExport;

public class SchemaExportTester {

public static void main(String[] args) {
new SchemaExportTester().createSchema();
}

private void createSchema() {
Configuration cfg = new Configuration().configure();
SchemaExport schemaExport = new SchemaExport(cfg);
schemaExport.setOutputFile("schema.sql");
schemaExport.create(true, true);
System.out.print("ok");
}
}


其中
schemaExport.create(true, true);
第一個參數是表示是否要產生schema.sql,第二個參數是表示是否要在database立建立table。

2008年6月2日 星期一

MySQL Character Encoding Configuration

It's common practice that the MySQL configuration file, in *nix systems is located in /etc/mysql/my.cnf
in windows, which is located in %MYSQL_HOME%\my.ini

[client]
default-character-set=utf8
[mysqld]
default-character-set=utf8
character-set-server = utf8
collation-server = utf8_general_ci