2006-12-03
Windows自動啟動程序的十大藏身之所
Windows啟動時通常會有一大堆程序自動啟動。不要以為管好了「開始→程序→啟動」菜單就萬事大吉,實際上,在Windows XP/2K中,讓Windows自動啟動程序的辦法很多,下文告訴你最重要的兩個文件夾和八個註冊鍵。
一、當前用戶專有的啟動文件夾 這是許多應用軟件自動啟動的常用位置,Windows自動啟動放入該文件夾的所有快捷方式。用戶啟動文件夾一般在:\Documents and Settings\<用戶名字>\「開始」菜單\程序\啟動,其中「<用戶名字>」是當前登錄的用戶帳戶名稱。
二、對所有用戶有效的啟動文件夾 這是尋找自動啟動程序的第二個重要位置,不管用戶用什麼身份登錄系統,放入該文件夾的快捷方式總是自動啟動——這是它與用戶專有的啟動文件夾的區別所在。該文件夾一般在:\Documents and Settings\All Users\「開始」菜單\程序\啟動。
三、Load註冊鍵 介紹該註冊鍵的資料不多,實際上它也能夠自動啟動程序。位置:HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Windows\load。
四、Userinit註冊鍵 位置:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Userinit。這裡也能夠使系統啟動時自動初始化程序。通常該註冊鍵下面有一個userinit.exe,如圖一,但這個鍵允許指定用逗號分隔的多個程序,例如「userinit.exe,OSA.exe」(不含引號)。 圖一
五、Explorer\Run註冊鍵 和load、Userinit不同,Explorer\Run鍵在HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE下都有,具體位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run。
六、RunServicesOnce註冊鍵 RunServicesOnce註冊鍵用來啟動服務程序,啟動時間在用戶登錄之前,而且先於其他通過註冊鍵啟動的程序。RunServicesOnce註冊鍵的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce。
七、RunServices註冊鍵 RunServices註冊鍵指定的程序緊接RunServicesOnce指定的程序之後運行,但兩者都在用戶登錄之前。RunServices的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices。
八、RunOnce\Setup註冊鍵 RunOnce\Setup指定了用戶登錄之後運行的程序,它的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\Setup。
九、RunOnce註冊鍵 安裝程序通常用RunOnce鍵自動運行程序,它的位置在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce和HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce。HKEY_LOCAL_MACHINE下面的RunOnce鍵會在用戶登錄之後立即運行程序,運行時機在其他Run鍵指定的程序之前。HKEY_CURRENT_USER下面的RunOnce鍵在操作系統處理其他Run鍵以及「啟動」文件夾的內容之後運行。如果是XP,你還需要檢查一下HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx。
十、Run註冊鍵 Run是自動運行程序最常用的註冊鍵,位置在:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run。HKEY_CURRENT_USER下面的Run鍵緊接HKEY_LOCAL_MACHINE下面的Run鍵運行,但兩者都在處理「啟動」文件夾之前。
一、當前用戶專有的啟動文件夾 這是許多應用軟件自動啟動的常用位置,Windows自動啟動放入該文件夾的所有快捷方式。用戶啟動文件夾一般在:\Documents and Settings\<用戶名字>\「開始」菜單\程序\啟動,其中「<用戶名字>」是當前登錄的用戶帳戶名稱。
二、對所有用戶有效的啟動文件夾 這是尋找自動啟動程序的第二個重要位置,不管用戶用什麼身份登錄系統,放入該文件夾的快捷方式總是自動啟動——這是它與用戶專有的啟動文件夾的區別所在。該文件夾一般在:\Documents and Settings\All Users\「開始」菜單\程序\啟動。
三、Load註冊鍵 介紹該註冊鍵的資料不多,實際上它也能夠自動啟動程序。位置:HKEY_CURRENT_USER\Software\Microsoft\WindowsNT\CurrentVersion\Windows\load。
四、Userinit註冊鍵 位置:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\WindowsNT\CurrentVersion\Winlogon\Userinit。這裡也能夠使系統啟動時自動初始化程序。通常該註冊鍵下面有一個userinit.exe,如圖一,但這個鍵允許指定用逗號分隔的多個程序,例如「userinit.exe,OSA.exe」(不含引號)。 圖一
五、Explorer\Run註冊鍵 和load、Userinit不同,Explorer\Run鍵在HKEY_CURRENT_USER和HKEY_LOCAL_MACHINE下都有,具體位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer\Run。
六、RunServicesOnce註冊鍵 RunServicesOnce註冊鍵用來啟動服務程序,啟動時間在用戶登錄之前,而且先於其他通過註冊鍵啟動的程序。RunServicesOnce註冊鍵的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServicesOnce。
七、RunServices註冊鍵 RunServices註冊鍵指定的程序緊接RunServicesOnce指定的程序之後運行,但兩者都在用戶登錄之前。RunServices的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunServices,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunServices。
八、RunOnce\Setup註冊鍵 RunOnce\Setup指定了用戶登錄之後運行的程序,它的位置是:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce\Setup,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\Setup。
九、RunOnce註冊鍵 安裝程序通常用RunOnce鍵自動運行程序,它的位置在HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce和HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce。HKEY_LOCAL_MACHINE下面的RunOnce鍵會在用戶登錄之後立即運行程序,運行時機在其他Run鍵指定的程序之前。HKEY_CURRENT_USER下面的RunOnce鍵在操作系統處理其他Run鍵以及「啟動」文件夾的內容之後運行。如果是XP,你還需要檢查一下HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx。
十、Run註冊鍵 Run是自動運行程序最常用的註冊鍵,位置在:HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run,和HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run。HKEY_CURRENT_USER下面的Run鍵緊接HKEY_LOCAL_MACHINE下面的Run鍵運行,但兩者都在處理「啟動」文件夾之前。
2006-09-04
Insert New Row To Table
var obj=document.getElementById("tableId");
var row=obj.insertRow(obj.rows.length);
var cell0=row.insertCell(0);
cell0.innerHTML="2006-04-09";
var cell1=row.insertCell(1);
cell1.innerHTML="China Holiday";
scrollable table
scrollable table
<div style="overflow:auto;width:200px;height:100px">
<table>
<tr style="position:relative;top:expression(this.offsetParent.scrollTop);background-color:white">
<th>Date</th>
<th>Holiday Type</th>
</tr>
<tr>
<td>2006-10-01</td>
<td>HK Holiday</td>
</tr>
</table>
</div>
<div style="overflow:auto;width:200px;height:100px">
<table>
<tr style="position:relative;top:expression(this.offsetParent.scrollTop);background-color:white">
<th>Date</th>
<th>Holiday Type</th>
</tr>
<tr>
<td>2006-10-01</td>
<td>HK Holiday</td>
</tr>
</table>
</div>
2006-08-19
DB2 JDBC Connection
DB2 Connection Methods
// COM.ibm.db2.jdbc.app.DB2Driver uses db2java.zip and create dbname ODBC in OS
String JDBC_DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver";
String CONNECTION_URL = "jdbc:db2:dbname";
// com.ibm.db2.jcc.DB2Driver uses db2jcc.jar
String JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
String CONNECTION_URL = "jdbc:db2://172.0.0.1:50000/dbname";
Class.forName(JDBC_DRIVER).newInstance();
Connection con = DriverManager.getConnection(CONNECTION_URL,CONNECTION_USERID, CONNECTION_PASSWORD);
//Using Connection pool. Config "jdbc/dbsource" in Application Server
InitialContext ctx = new InitialContext();
DataSource ds =(DataSource)ctx.lookup("jdbc/dbsource");
con = ds.getConnection();
//Using Connection pool with Ref Resource. Config "jdbc/dbsource" in Application Server
1.Config resource ref. in application server. following will be generated in web.xml
<resource-ref id="ResourceRef_1156216203871">
<description></description>
<res-ref-name>dbsource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
2.
InitialContext ctx = new InitialContext();
DataSource ds =(DataSource)ctx.lookup("java:comp/env/dbsource");
con = ds.getConnection();
// COM.ibm.db2.jdbc.app.DB2Driver uses db2java.zip and create dbname ODBC in OS
String JDBC_DRIVER = "COM.ibm.db2.jdbc.app.DB2Driver";
String CONNECTION_URL = "jdbc:db2:dbname";
// com.ibm.db2.jcc.DB2Driver uses db2jcc.jar
String JDBC_DRIVER = "com.ibm.db2.jcc.DB2Driver";
String CONNECTION_URL = "jdbc:db2://172.0.0.1:50000/dbname";
Class.forName(JDBC_DRIVER).newInstance();
Connection con = DriverManager.getConnection(CONNECTION_URL,CONNECTION_USERID, CONNECTION_PASSWORD);
//Using Connection pool. Config "jdbc/dbsource" in Application Server
InitialContext ctx = new InitialContext();
DataSource ds =(DataSource)ctx.lookup("jdbc/dbsource");
con = ds.getConnection();
//Using Connection pool with Ref Resource. Config "jdbc/dbsource" in Application Server
1.Config resource ref. in application server. following will be generated in web.xml
<description></description>
<res-ref-name>dbsource</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Application</res-auth>
<res-sharing-scope>Shareable</res-sharing-scope>
</resource-ref>
2.
InitialContext ctx = new InitialContext();
DataSource ds =(DataSource)ctx.lookup("java:comp/env/dbsource");
con = ds.getConnection();
2006-07-26
Associates a path with a drive letter.
Associates a path with a drive letter.
SUBST [drive1: [drive2:]path]
SUBST drive1: /D
drive1: Specifies a virtual drive to which you want to assign a path.
[drive2:]path Specifies a physical drive and path you want to assign to virtual drive.
/D Deletes a substituted (virtual) drive.
Type SUBST with no parameters to display a list of current virtual drives.
e.g.
subst z: c:\temp
subst z: /d
SUBST [drive1: [drive2:]path]
SUBST drive1: /D
drive1: Specifies a virtual drive to which you want to assign a path.
[drive2:]path Specifies a physical drive and path you want to assign to virtual drive.
/D Deletes a substituted (virtual) drive.
Type SUBST with no parameters to display a list of current virtual drives.
e.g.
subst z: c:\temp
subst z: /d
2006-07-13
XmlHttpRequest Object for non-ActiveX browser
function validate() {
var idField = document.getElementById("userid");
var url = "validate?id=" + escape(idField.value);
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
var idField = document.getElementById("userid");
var url = "validate?id=" + escape(idField.value);
if (window.XMLHttpRequest) {
req = new XMLHttpRequest();
} else if (window.ActiveXObject) {
req = new ActiveXObject("Microsoft.XMLHTTP");
}
req.open("GET", url, true);
req.onreadystatechange = callback;
req.send(null);
}
2006-07-08
Locale Setting Tips
1. For Sametime to show chinese character
"Regional and Laugage Options" --> "Advanced" --> "Language for non-Unicode programs"--> "Chinese (Taiwan)"
2.For ES in Websphere
"Regional and Laugage Options" --> "Regional Options" --> "Standards and formats" --> "English (United States)"
3.For DB2 Configuration Assistant
"Regional and Laugage Options" --> "Advanced" --> "Language for non-Unicode programs"--> "Chinese (Taiwan)/English (United States)"
"db2jds.exe problem" will be happened while the language is "Chinese (Hong Kong S.A.R.)"
"Regional and Laugage Options" --> "Advanced" --> "Language for non-Unicode programs"--> "Chinese (Taiwan)"
2.For ES in Websphere
"Regional and Laugage Options" --> "Regional Options" --> "Standards and formats" --> "English (United States)"
3.For DB2 Configuration Assistant
"Regional and Laugage Options" --> "Advanced" --> "Language for non-Unicode programs"--> "Chinese (Taiwan)/English (United States)"
"db2jds.exe problem" will be happened while the language is "Chinese (Hong Kong S.A.R.)"
2006-06-28
Usage of CLOB
public String generatePaymentNotice(String pEmail_status, String pInclude_header_ind) throws Exception {
Vector lvParaValue = new Vector();
String lvSQL = "select pkg_cg_enrolment.Sf_Cg_Gen_Payment_Notice(?,?,?,?,?) as result from dual";
lvParaValue.add(this.getYear());
lvParaValue.add(this.getOrg_id().toUpperCase());
lvParaValue.add(this.getOrg_name());
lvParaValue.add(pEmail_status);
lvParaValue.add(pInclude_header_ind);
ResultSet lvRs = db.executeSelect(lvSQL, lvParaValue);
// CHING. use oracle.sql.CLOB instead of java.sql.Clob for WebSphere Deployment.
// java.sql.Clob tempClob = null;
oracle.sql.CLOB tempClob = null;
if (lvRs != null && lvRs.next()) {
tempClob = (oracle.sql.CLOB) lvRs.getObject("result");
}
lvRs.close();
if (tempClob.length() > 1) {
sun.io.CharToByteConverter
fromUnicode = sun.io.CharToByteConverter.getConverter("Big5");
return new String(fromUnicode.convertAll(tempClob.getSubString(1 , (int) tempClob.length()).toCharArray()));
} else {
return "";
}
}
Vector lvParaValue = new Vector();
String lvSQL = "select pkg_cg_enrolment.Sf_Cg_Gen_Payment_Notice(?,?,?,?,?) as result from dual";
lvParaValue.add(this.getYear());
lvParaValue.add(this.getOrg_id().toUpperCase());
lvParaValue.add(this.getOrg_name());
lvParaValue.add(pEmail_status);
lvParaValue.add(pInclude_header_ind);
ResultSet lvRs = db.executeSelect(lvSQL, lvParaValue);
// CHING. use oracle.sql.CLOB instead of java.sql.Clob for WebSphere Deployment.
// java.sql.Clob tempClob = null;
oracle.sql.CLOB tempClob = null;
if (lvRs != null && lvRs.next()) {
tempClob = (oracle.sql.CLOB) lvRs.getObject("result");
}
lvRs.close();
if (tempClob.length() > 1) {
sun.io.CharToByteConverter
fromUnicode = sun.io.CharToByteConverter.getConverter("Big5");
return new String(fromUnicode.convertAll(tempClob.getSubString(1 , (int) tempClob.length()).toCharArray()));
} else {
return "";
}
}