發表文章

目前顯示的是 八月, 2010的文章

Encrypt / Decrypt weblogic password

網路上找到好用的程式: /*  *Source URL:  http://gustlik.wordpress.com/2008/08/06/decryption-of-configuration-passwords-in-weblogic/    */ import java.util.*; import java.io.*; import javax.xml.parsers.*; import javax.xml.xpath.*; import org.w3c.dom.*; import weblogic.security.internal.*; // requires weblogic.jar in the class path import weblogic.security.internal.encryption.*; public class WebLogicDecryptor { private static final String PREFIX = "{3DES}"; private static final String XPATH_EXPRESSION = "//node()[starts-with(text(), '" + PREFIX + "')] | //@*[starts-with(., '" + PREFIX + "')]"; private static ClearOrEncryptedService ces; public static void main(String[] args) throws Exception { if (args.length < 2) { throw new Exception("Usage: [domainDir] [configFile]"); } ces = new ClearOrEncryptedService(SerializedSystemIni.getEncryptionService(new File(args[0]).getAbsolutePath())); File file = new File

Using weblogic environment to generate encrypt password

There has a simple way to using weblogic environment to generate encrypt password... 1. Set environment... ./setDomainEnv.sh 2. Generate password... java weblogic.security.Encrypt [YOUR PASSWORD]
Oracle的byte與中文字換算 FOR UTF8: 英文字 1 byte 常用中文字 3 bytes 非常用中文字 6 bytes FOR UTF16: 英文字 2 bytes 常用中文字 2 bytes 非常用中文字 4 bytes

備份script

這是一個小shell script,可以讓你把某各位置上的檔案壓縮起來,並依照日期給定檔名postfix 我把他用來做我server端部署程式時,備份舊程式用 :D #!/bin/bash export SERVER_FOLDER=PTWESAPP01 export BK_FOLDER=/data/backup export BK_TARGET=/home/weblogic/ export BK_TMP_DEST=$BK_FOLDER/$SERVER_FOLDER/tmp/weblogic export BK_DEST=$BK_FOLDER/$SERVER_FOLDER/archive/weblogic-`date +"%Y%m%d"`.tgz rsync -av $BK_TARGET $BK_TMP_DEST cd $BK_FOLDER/$SERVER_FOLDER/tmp tar --exclude *.log --incremental -czf $BK_DEST weblogic/ cd -

window.showModalDialog 範例

使用範例: window.showModalDialog('http://xxx.xxx.xxx....','dialogHeight: 200px; dialogWidth: 200px; dialogTop: 10px; dialogLeft: 10px; edge: Raised; center: Yes; help: Yes; resizable: Yes; status: Yes;') 如果是用 showModalDialog的話, 在子視窗中要存取母視窗的函數的話, 要注意兩個地方, 1.(母視窗中)開啟視窗: window.showModalDialog("openwin.html", self ,'modal=yes,width=775,height=700,resizable=no,scrollbars=no'); 在第二個參數(vArguments),改成self. 2.(子視窗中)調用母視窗的函數: window.dialogArguments .ShowMsg(obj.value); ShowMsg為母視窗中的函數. 而使用window.open的話, 則是要注意一個地方, 1.(子視窗中)調用母視窗的函數: window.opener .ShowMsg(obj.value); 使用window.opener去接母視窗的物件.

MySQL create account

建立Account: mealadmin@localhost (@localhost代表可以在local登入) 並且給予密碼12345 並給予所有的權限 CREATE USER 'mealadmin'@'%' IDENTIFIED BY 'xxxxxxxx'; GRANT ALL PRIVILEGES ON *.* TO 'mealadmin'@'%' WITH GRANT OPTION; FLUSH PRIVILEGES; 初次建立的DB會有預設的root帳號 請先把root帳號的密碼設定好 必要的話,移除root@%的設定 SET PASSWORD FOR 'root'@'localhost' = PASSWORD('xxxxxxxx'); SET PASSWORD FOR 'root'@'tucson' = PASSWORD('xxxxxxxx'); SET PASSWORD FOR 'root'@'%' = PASSWORD('xxxxxxxx');

平均下去

一位朋友遇到的問題,如果專案有12各月份~ 在某計各月份填進去完成百分比 怎麼樣計算出每各月份完成的百分比呢?? 我的方式是切~切~切~ 只要有填的地方就切一刀~然後去算每各月做的百分比~ 有需要看月份的總百分比~就把前面的加起來就好啦 :D 程式碼如下:         List<String> oriList = new ArrayList<String>();         oriList.add("");//一月         oriList.add("");         oriList.add("30");         oriList.add("");         oriList.add("");         oriList.add("");         oriList.add("");         oriList.add("");         oriList.add("80");//九月         oriList.add("");         oriList.add("");         oriList.add("100");//十二月                 int i = 0;                 BigDecimal theCnt = new BigDecimal(0);         BigDecimal lastCnt = new BigDecimal(0);         List<List<BigDecimal>> sumList = new ArrayList<List<BigDecimal>>();         for(String s : oriList){             i++;             if(s != null && !"".equ

Hibernate Find By Example

當TB_FD_USER裡面的PK=USER_NO時候 只有放PK到findByExample會被忽略喔... eStoreService dao = (eStoreService)SpringService.getService(SpringService.USE_JDBC, "eStoreService"); TbFdUser user = new TbFdUser(); user.setUserNo(new Long(1)); Collection c = dao.getUserByExample(user); System.out.println("result size:"+c.size()); Result... Hibernate: select this_.USER_NO as USER1_4_0_, this_.ADDRESS as ADDRESS4_0_, this_.AREA_CODE as AREA3_4_0_, this_.BANK_ACCOUNT as BANK4_4_0_, this_.BIRTHDAY as BIRTHDAY4_0_, this_.CITY as CITY4_0_, this_.COMPANY_NAME as COMPANY7_4_0_, this_.COUNTRY_CODE as COUNTRY8_4_0_, this_.CREATE_BY as CREATE9_4_0_, this_.CREATE_DATE as CREATE10_4_0_, this_.EMAIL as EMAIL4_0_, this_.FAX_NO as FAX12_4_0_, this_.FLAG as FLAG4_0_, this_.ID_NO as ID14_4_0_, this_.INTRODUCED_BY as INTRODUCED15_4_0_, this_.LOGIN_ID as LOGIN16_4_0_, this_.LOGIN_PWD as LOGIN17_4_0_, this_.MOBILE_NO as MOBILE18_4_0_, this_.PROVINCE_CODE as PROVINCE19_4_0_, this_.SEX as SEX4_0_, this_.STATUS a

jython sample for using database

# -*- coding: utf-8 -*- from com.ziclix.python.sql import zxJDBC import commands def main(): commands.getoutput('set CLASSPATH=D:\\09_Workspace\\Develop-lib\\MySQL\\JDBC\\5.1.5\\mysql-connector-java-5.1.5-bin.jar;%CLASSPATH%') d, u, p, v = "jdbc:mysql://localhost:3306/meals?useUnicode=yes&characterEncoding=UTF-8", 'mealadmin', 'mealadmin123', "org.gjt.mm.mysql.Driver" db = zxJDBC.connect(d, u, p, v) c = db.cursor(1)  # this gets a dynamic cursor c.execute("select id_no, login_id, login_pwd from tb_fd_user") print c.description for aa in c.fetchall(): print aa print aa[1].encode('utf-8') c.close() db.close() main()