91视频一区二区,在线色视频网,第一福利在线http://www.aygfsteel.com/parable-myth/category/12073.html慢慢的度過zh-cnSun, 02 Mar 2014 17:29:51 GMTSun, 02 Mar 2014 17:29:51 GMT60kettle ETL java 調(diào)用 kettle job 或 transferhttp://www.aygfsteel.com/parable-myth/archive/2014/03/02/410499.html無聲無聲Sun, 02 Mar 2014 00:20:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2014/03/02/410499.htmlhttp://www.aygfsteel.com/parable-myth/comments/410499.htmlhttp://www.aygfsteel.com/parable-myth/archive/2014/03/02/410499.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/410499.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/410499.html
http://blog.csdn.net/chen978616649/article/details/9063695


代碼如下:調(diào)用kettle 4.2版本


package test;


import org.apache.commons.lang.StringUtils;
import org.apache.commons.vfs.FileSelector;
import org.pentaho.di.core.KettleEnvironment;
import org.pentaho.di.core.database.DatabaseMeta;
import org.pentaho.di.core.exception.KettleException;
import org.pentaho.di.core.util.EnvUtil;
import org.pentaho.di.job.Job;
import org.pentaho.di.job.JobMeta;
import org.pentaho.di.repository.RepositoryDirectory;
import org.pentaho.di.repository.RepositoryDirectoryInterface;
import org.pentaho.di.repository.kdr.KettleDatabaseRepository;
import org.pentaho.di.repository.kdr.KettleDatabaseRepositoryMeta;
import org.pentaho.di.trans.Trans;
import org.pentaho.di.trans.TransMeta;


import com.longtech.configuration.BaseConfiguration;
import com.platform.common.util.LoggerUtil;


/**
 * 
 * @Description:  java調(diào)用kettle 數(shù)據(jù)庫型資料庫中的轉(zhuǎn)換
 * @author chen 此類是調(diào)用kettle 4.2版本的測(cè)試類
 * @version 1.0, 
 * @date 2013-5-23 下午02:40:50
 */
public class ExecRepositoryTrans {
/**
* 本測(cè)試類慎用?。。。。。?!
* @param args
*/
public static void main(String[] args) {
//D:\java\workspace\sics\src\config\kettle
String classesdir = BaseConfiguration.getString("classesdir");
String jobName = BaseConfiguration.getString("kettle.path.file");
if(StringUtils.isNotEmpty(jobName)){
LoggerUtil.info(ExecRepositoryTrans.class, "執(zhí)行kettle job start-------------------");

runJob(classesdir + jobName);

LoggerUtil.info(ExecRepositoryTrans.class, "執(zhí)行kettle job end -------------------");
}else{

LoggerUtil.info(ExecRepositoryTrans.class, "請(qǐng)配置kettle.path.file job 的路徑文件");
}

}
/**
*java 調(diào)用kettle 轉(zhuǎn)換 
*/
public static void runTransfer(){
Trans trans=null;  
FileSelector f = null;
try {
// 初始化  
            String fName= "D:\\kettle\\informix_to_am_4.ktr";
            // 轉(zhuǎn)換元對(duì)象  
        KettleEnvironment.init();//初始化
        EnvUtil.environmentInit();
            TransMeta transMeta = new TransMeta(fName);
            // 轉(zhuǎn)換  
            trans = new Trans(transMeta);  
            // 執(zhí)行轉(zhuǎn)換  
            trans.execute(null);   
            // 等待轉(zhuǎn)換執(zhí)行結(jié)束  
            trans.waitUntilFinished();  
            //拋出異常  
            if(trans.getErrors()>0){  
                throw new Exception("There are errors during transformation exception!(傳輸過程中發(fā)生異常)");  
            }  
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* java 調(diào)用 kettle 的job
* @param jobname 如: String fName= "D:\\kettle\\informix_to_am_4.ktr";
*/
public static void runJob(String jobname){  
try {   
KettleEnvironment.init();   
//jobname 是Job腳本的路徑及名稱   
JobMeta jobMeta = new JobMeta(jobname, null);   
Job job = new Job(null, jobMeta);   
//向Job 腳本傳遞參數(shù),腳本中獲取參數(shù)值:${參數(shù)名}   
//job.setVariable(paraname, paravalue);   
 job.start();   
 job.waitUntilFinished();   
 if (job.getErrors() > 0) {   
 throw new Exception("There are errors during job exception!(執(zhí)行job發(fā)生異常)");  
 }   
} catch (Exception e) {   
e.printStackTrace();
}   
}
/**
* 配置數(shù)據(jù)源 調(diào)用資源庫中的相關(guān)job 、transfer
*/
public static void dbResource(){
String transName="t1";  
         
       try {  
           KettleEnvironment.init();  
           DatabaseMeta dataMeta = new DatabaseMeta("KettleDBRep","MSSQL","Native","127.0.0.1","etl","1433","sa","bsoft");  
           KettleDatabaseRepositoryMeta repInfo = new KettleDatabaseRepositoryMeta();  
           repInfo.setConnection(dataMeta);  
           KettleDatabaseRepository rep = new KettleDatabaseRepository();  
           rep.init(repInfo);  
           rep.connect("admin", "admin");  
             
           RepositoryDirectoryInterface dir = new RepositoryDirectory();  
           dir.setObjectId(rep.getRootDirectoryID());  
             
           TransMeta tranMeta = rep.loadTransformation(rep.getTransformationID(transName, dir), null);  
           Trans trans = new Trans(tranMeta);  
           trans.execute(null);  
           trans.waitUntilFinished();  
       } catch (KettleException e) {  
           e.printStackTrace();  
       }  
}


}



無聲 2014-03-02 08:20 發(fā)表評(píng)論
]]>
轉(zhuǎn)win8 64位+Oracle 11g 64位下使用PL/SQL Developer 的解決辦法http://www.aygfsteel.com/parable-myth/archive/2013/09/02/403545.html無聲無聲Mon, 02 Sep 2013 01:42:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2013/09/02/403545.htmlhttp://www.aygfsteel.com/parable-myth/comments/403545.htmlhttp://www.aygfsteel.com/parable-myth/archive/2013/09/02/403545.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/403545.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/403545.html1)安裝Oracle 11g 64位
2)安裝32位的Oracle客戶端( instantclient-basic-win32-11.2.0.1.0)
下載 instantclient-basic-win32-11.2.0.1.0.zip (一定得是32位的,不要下錯(cuò)了版本,Oracle官網(wǎng)有下載),將其解壓至Oracle安裝目錄的Product下(本機(jī)命名為:instantclient_11_2):D:\Oracle\app\YM\product\instantclient_11_2。
拷貝數(shù)據(jù)庫安裝根目錄下的一個(gè)目錄D:\Oracle\app\YM\product\11.2.0\dbhome_1\NETWORK到Oracle客戶端目錄下D:\Oracle\app\YM\product\instantclient_11_2(其實(shí)只需要 NETWORK\ADMIN\tnsnames.ora,最好是直接拷貝這個(gè)文件到D:\Oracle\app\YM\product\instantclient_11_2目錄下)
3)安裝PL/SQL Developer
安裝 PL/SQL Developer,在perference->Connection里面設(shè)置OCI Library和Oracle_Home,例如本機(jī)設(shè)置為:
Oracle Home :D:\Oracle\app\YM\product\instantclient_11_2
OCI Library : D:\Oracle\app\YM\product\instantclient_11_2\oci.dll
 
4) 設(shè)置環(huán)境變量(修改PATH和TNS_ADMIN環(huán)境變量)


對(duì)于NLS_LANG環(huán)境變量, 最好設(shè)置成和數(shù)據(jù)庫端一致, 首先從數(shù)據(jù)庫端查詢字符集信息:
SQL> select userenv('language') nls_lang from dual;
NLS_LANG
----------------------------------------------------
SIMPLIFIED CHINESE_CHINA.ZHS16GBK


右擊"我的電腦" - "屬性" - "高級(jí)" - "環(huán)境變量" - "系統(tǒng)環(huán)境變量":
1>.選擇"Path" - 點(diǎn)擊"編輯", 把 "D:\Oracle\app\YM\product\instantclient_11_2;" 加入;
2>.點(diǎn)擊"新建", 變量名設(shè)置為"TNS_ADMIN", 變量值設(shè)置為"D:\Oracle\app\YM\product\instantclient_11_2;", 點(diǎn)擊"確定";
3>.點(diǎn)擊"新建", 變量名設(shè)置為"NLS_LANG", 變量值設(shè)置為"SIMPLIFIED CHINESE_CHINA.ZHS16GBK", 點(diǎn)擊"確定";
最后點(diǎn)擊"確定"退出.


啟動(dòng) PL/SQL Developer ,運(yùn)行無問題。

無聲 2013-09-02 09:42 發(fā)表評(píng)論
]]>
Java 獲取當(dāng)前日期和時(shí)間http://www.aygfsteel.com/parable-myth/archive/2013/01/17/394364.html無聲無聲Thu, 17 Jan 2013 10:47:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2013/01/17/394364.htmlhttp://www.aygfsteel.com/parable-myth/comments/394364.htmlhttp://www.aygfsteel.com/parable-myth/archive/2013/01/17/394364.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/394364.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/394364.html有兩種方法:

方法一:用java.util.Date類來實(shí)現(xiàn),并結(jié)合java.text.DateFormat類來實(shí)現(xiàn)時(shí)間的格式化,看下面代碼:

import java.util.*; 
import java.text.*;
//以下默認(rèn)時(shí)間日期顯示方式都是漢語語言方式
//一般語言就默認(rèn)漢語就可以了,時(shí)間日期的格式默認(rèn)為MEDIUM風(fēng)格,比如:2008-6-16 20:54:53
//以下顯示的日期時(shí)間都是再Date類的基礎(chǔ)上的來的,還可以利用Calendar類來實(shí)現(xiàn)見類TestDate2.java
public class TestDate { 
   public static void main(String[] args) { 
      Date now = new Date(); 
      Calendar cal = Calendar.getInstance(); 
      
      DateFormat d1 = DateFormat.getDateInstance(); //默認(rèn)語言(漢語)下的默認(rèn)風(fēng)格(MEDIUM風(fēng)格,比如:2008-6-16 20:54:53)
      String str1 = d1.format(now);
      DateFormat d2 = DateFormat.getDateTimeInstance(); 
      String str2 = d2.format(now); 
      DateFormat d3 = DateFormat.getTimeInstance(); 
      String str3 = d3.format(now); 
      DateFormat d4 = DateFormat.getInstance(); //使用SHORT風(fēng)格顯示日期和時(shí)間
      String str4 = d4.format(now);

      DateFormat d5 = DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL); //顯示日期,周,時(shí)間(精確到秒)
      String str5 = d5.format(now);
      DateFormat d6 = DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG); //顯示日期。時(shí)間(精確到秒)
      String str6 = d6.format(now);
      DateFormat d7 = DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT); //顯示日期,時(shí)間(精確到分)
      String str7 = d7.format(now);
      DateFormat d8 = DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM); //顯示日期,時(shí)間(精確到分)
      String str8 = d8.format(now);//與SHORT風(fēng)格相比,這種方式最好用

 


      
      System.out.println("用Date方式顯示時(shí)間: " + now);//此方法顯示的結(jié)果和Calendar.getInstance().getTime()一樣
      
      
      System.out.println("用DateFormat.getDateInstance()格式化時(shí)間后為:" + str1);
      System.out.println("用DateFormat.getDateTimeInstance()格式化時(shí)間后為:" + str2);
      System.out.println("用DateFormat.getTimeInstance()格式化時(shí)間后為:" + str3);
      System.out.println("用DateFormat.getInstance()格式化時(shí)間后為:" + str4);
      
      System.out.println("用DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL)格式化時(shí)間后為:" + str5);
      System.out.println("用DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG)格式化時(shí)間后為:" + str6);
      System.out.println("用DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT)格式化時(shí)間后為:" + str7);
      System.out.println("用DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM)格式化時(shí)間后為:" + str8);
   }

}

運(yùn)行結(jié)果:

用Date方式顯示時(shí)間: Mon Jun 16 20:54:53 CST 2008
用DateFormat.getDateInstance()格式化時(shí)間后為:2008-6-16
用DateFormat.getDateTimeInstance()格式化時(shí)間后為:2008-6-16 20:54:53
用DateFormat.getTimeInstance()格式化時(shí)間后為:20:54:53
用DateFormat.getInstance()格式化時(shí)間后為:08-6-16 下午8:54
用DateFormat.getDateTimeInstance(DateFormat.FULL,DateFormat.FULL)格式化時(shí)間后為
:2008年6月16日 星期一 下午08時(shí)54分53秒 CST
用DateFormat.getDateTimeInstance(DateFormat.LONG,DateFormat.LONG)格式化時(shí)間后為
:2008年6月16日 下午08時(shí)54分53秒
用DateFormat.getDateTimeInstance(DateFormat.SHORT,DateFormat.SHORT)格式化時(shí)間后
為:08-6-16 下午8:54
用DateFormat.getDateTimeInstance(DateFormat.MEDIUM,DateFormat.MEDIUM)格式化時(shí)間
后為:2008-6-16 20:54:53

 

方法二:用java.util.Calendar類來實(shí)現(xiàn),看下面:

import java.util.*; 
import java.text.*;
//以下是利用Calendar類來實(shí)現(xiàn)日期時(shí)間的,和Date類相比較比較簡(jiǎn)單

public class TestDate2 { 
   public static void main(String[] args) { 
      
      Calendar ca = Calendar.getInstance();
      int year = ca.get(Calendar.YEAR);//獲取年份
      int month=ca.get(Calendar.MONTH);//獲取月份 
      int day=ca.get(Calendar.DATE);//獲取日
      int minute=ca.get(Calendar.MINUTE);//分 
      int hour=ca.get(Calendar.HOUR);//小時(shí) 
      int second=ca.get(Calendar.SECOND);//秒
      int WeekOfYear = ca.get(Calendar.DAY_OF_WEEK); 
      
      
      System.out.println("用Calendar.getInstance().getTime()方式顯示時(shí)間: " + ca.getTime());
      System.out.println("用Calendar獲得日期是:" + year +"年"+ month +"月"+ day + "日");
      
      System.out.println("用Calendar獲得時(shí)間是:" + hour +"時(shí)"+ minute +"分"+ second +"秒");
      System.out.println(WeekOfYear);//顯示今天是一周的第幾天(我做的這個(gè)例子正好是周二,故結(jié)果顯示2,如果你再周6運(yùn)行,那么顯示6)
      
   }

}
運(yùn)行結(jié)果是:
用Calendar.getInstance().getTime()方式顯示時(shí)間: Mon Jun 16 21:54:21 CST 2008
用Calendar獲得日期是:2008年5月16日
用Calendar獲得時(shí)間是:9時(shí)54分21秒
2


總結(jié):中的來說,方法二是最方便的,方法一顯得分笨拙,不過看個(gè)人喜歡了。

 

轉(zhuǎn)自:http://student.csdn.net/space.php?uid=122120&do=blog&id=14681

 

方法三:

SimpleDateFormat 24小時(shí)制時(shí)間顯示

關(guān)鍵字: java基礎(chǔ)

 

字母日期或時(shí)間元素表示示例
GEra 標(biāo)志符TextAD
yYear199696
M年中的月份MonthJulyJul07
w年中的周數(shù)Number27
W月份中的周數(shù)Number2
D年中的天數(shù)Number189
d月份中的天數(shù)Number10
F月份中的星期Number2
E星期中的天數(shù)TextTuesdayTue
aAm/pm 標(biāo)記TextPM
H一天中的小時(shí)數(shù)(0-23)Number0
k一天中的小時(shí)數(shù)(1-24)Number24
Kam/pm 中的小時(shí)數(shù)(0-11)Number0
ham/pm 中的小時(shí)數(shù)(1-12)Number12
m小時(shí)中的分鐘數(shù)Number30
s分鐘中的秒數(shù)Number55
S毫秒數(shù)Number978
z時(shí)區(qū)General time zonePacific Standard TimePSTGMT-08:00
Z時(shí)區(qū)RFC 822 time zone

-0800

 


它有個(gè)優(yōu)點(diǎn)就是支持兩位月份,兩位日期。帶前綴0.
Date date = new Date();
SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm");
String sDateSuffix = dateformat.format(date);
System.out.println("[+]sDateSuffix:"+sDateSuffix);


無聲 2013-01-17 18:47 發(fā)表評(píng)論
]]>
清除目錄下的SVN信息http://www.aygfsteel.com/parable-myth/archive/2012/08/31/386680.html無聲無聲Fri, 31 Aug 2012 05:07:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2012/08/31/386680.htmlhttp://www.aygfsteel.com/parable-myth/comments/386680.htmlhttp://www.aygfsteel.com/parable-myth/archive/2012/08/31/386680.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/386680.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/386680.html今天想清除目錄下的SVN信息,在網(wǎng)上找了找,說是有三種方法:

一、在linux下 

刪除這些目錄是很簡(jiǎn)單的,命令如下 
find . -type d -name ".svn"|xargs rm -rf 

或者 

find . -type d -iname ".svn" -exec rm -rf {} \;   


二、在windows下用以下法子: 

1、在項(xiàng)目平級(jí)的目錄,執(zhí)行dos命令: 
xcopy project_dir project_dir_1 /s /i 

2、或者在項(xiàng)目根目錄執(zhí)行以下dos命令 
for /r . %%a in (.) do @if exist "%%a\.svn" rd /s /q "%%a\.svn" 

其實(shí)第二種方法可以用來干很多事的,比如把代碼中的.svn替換為任意其他文件名并在硬盤根目錄下執(zhí)行,就可以從硬盤上刪除所有的這個(gè)文件啦。 

3、添加注冊(cè)表(親自動(dòng)手測(cè)試過) 
可以將“快速刪除SVN版本信息”命名增加到資源管理器的右鍵上,這樣,鼠標(biāo)點(diǎn)兩下就能把選中目錄下的所有.svn目錄干掉了。 

代碼為: 

Windows Registry Editor Version 5.00 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN] 
@="快速刪除SVN版本信息" 

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command] 
@="cmd.exe /c D:\工具\(yùn)批處理文件刪除SVN版本信息.bat" 
將這段代碼保存為一個(gè).reg文件,雙擊確認(rèn)導(dǎo)入注冊(cè)表中不完整,后來自己手工添加。注意:文件“批處理文件刪除SVN版本信息.bat”不能放 在有空格的文件夾下,確認(rèn)刪除時(shí)請(qǐng)看一下當(dāng)前目錄不要?jiǎng)h除不該刪的目錄下的SVN版本信息。不知道怎么改進(jìn)“cmd.exe /c D:\工具\(yùn)批處理文件刪除SVN版本信息.bat”。 


批處理文件刪除SVN版本信息.bat文件內(nèi)容如下: 
@echo off 
echo *********************************************************** 
echo 清除SVN版本信 息                                                                                               
echo *********************************************************** 
:start 
::啟動(dòng)過程,切換目錄 
:set pwd=%cd% 
:cd %1 
echo 工作目錄是:& chdir 
:input 
::獲取輸入,根據(jù)輸入進(jìn)行處理 
set source=: 
set /p source=確定要清楚當(dāng)前目錄下的.svn信息嗎?[Y/N/Q] 
set "source=%source:"=%" 
if "%source%"=="y" goto clean 
if "%source%"=="Y" goto clean 
if "%source%"=="n" goto noclean 
if "%source%"=="N" goto noclean 
if "%source%"=="q" goto end 
if "%source%"=="Q" goto end 
goto input 
:clean 
::主處理過程,執(zhí)行清理工作 
@echo on 
@for /d /r %%c in (.svn) do @if exist %%c ( rd /s /q %%c & echo    刪除目錄%%c) 
@echo off 
echo "當(dāng)前目錄下的svn信息已清除" 
goto end 
:noclean 
::分支過程,取消清理工作 
echo "svn信息清楚操作已取消" 
goto end 
:end 
::退出程序 
cd "%pwd%" 
pause

注:最后一種方法,如果出現(xiàn)錯(cuò)誤,就打開注冊(cè)表,找到對(duì)應(yīng)的項(xiàng),吧“cmd.exe /c D:\工具\(yùn)批處理文件刪除SVN版本信息.bat “直接寫入注冊(cè)表中即可使用

我只用了最后一種方法:

報(bào)文件沒有關(guān)聯(lián)錯(cuò)誤,找到這個(gè)注冊(cè)表項(xiàng):[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Folder\shell\DeleteSVN\command] 
寫入:“cmd.exe /c D:\工具\(yùn)批處理文件刪除SVN版本信息.bat “,注意路徑

還有一個(gè)要注意的:在使用的時(shí)候,不要在要清除的文件夾上右擊,在要清除的文件夾里面的子文件夾上右擊--》快速刪除svn版本信息



無聲 2012-08-31 13:07 發(fā)表評(píng)論
]]>
Linux下使用gzip壓縮與解壓文件http://www.aygfsteel.com/parable-myth/archive/2011/12/04/365495.html無聲無聲Sun, 04 Dec 2011 02:44:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2011/12/04/365495.htmlhttp://www.aygfsteel.com/parable-myth/comments/365495.htmlhttp://www.aygfsteel.com/parable-myth/archive/2011/12/04/365495.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/365495.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/365495.html

Linux下gzip命令是用來壓縮文件的。gzip不僅可以用來壓縮大的、較少使用的文件以節(jié)省磁盤空間,還可以和tar命令一起構(gòu)成Linux操作系統(tǒng)中比較流行的壓縮文件格式。據(jù)統(tǒng)計(jì),gzip命令對(duì)文本文件有60%~70%的壓縮率。

gzip命令的格式是:

gzip [option] [file]

gzip很容易使用。如果想壓縮某個(gè)文件或者磁帶檔案文件,可輸入下面的內(nèi)容:

gzip mydir.tar

在缺省的狀態(tài)下,gzip 會(huì)壓縮文件、再加上一個(gè).gz擴(kuò)展名,然后刪除掉原來的文件。如果想解壓縮文件,可以使用gzip的對(duì)應(yīng)程序命令gunzip或者gzip命令的-d解壓 縮參數(shù)。但是必須保證這個(gè)用于解壓縮的文件有.gz(或者.Z、-gz、.z、-z、或者_(dá)z)擴(kuò)展名,否則gzip命令和gunzip命令都會(huì)顯示出錯(cuò) 信息。如果想使用自己的擴(kuò)展名,可以使用-S后綴參數(shù),如下所示:

gzip -S .gzipped mydir.tar

gzip 還可以處理用zip命令、compress命令和pack命令壓縮的文件包。如果想在壓縮或者解壓縮的過程中看到更多的信息,可以使用-l列清單參數(shù)看到 文件在被壓縮或解壓縮的時(shí)候的文件長(zhǎng)度。在前一個(gè)例子中,壓縮完子目錄mydir之后,可以使用gzip命令按照下面的方法得到有關(guān)的數(shù)據(jù):

# gzip -l mydir.tar.gz

compressed uncompr.ratio uncompressed_name
312 21330 98.2% mydir.tar

此外,gzip還有一個(gè)很有用的參數(shù)-t,可以用來測(cè)試壓縮文件的完整性。如果文件正常,gzip不會(huì)給出任何顯示。如果想看到OK這兩個(gè)字母,可以在測(cè)試某個(gè)文件時(shí)使用-tv參數(shù)。



無聲 2011-12-04 10:44 發(fā)表評(píng)論
]]>
Linux 下ftp自動(dòng)登錄http://www.aygfsteel.com/parable-myth/archive/2010/12/29/341858.html無聲無聲Wed, 29 Dec 2010 02:53:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/12/29/341858.htmlhttp://www.aygfsteel.com/parable-myth/comments/341858.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/12/29/341858.html#Feedback1http://www.aygfsteel.com/parable-myth/comments/commentRss/341858.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/341858.htmlLinux 下ftp自動(dòng)登錄 
 
 
操作系統(tǒng):linux
說明:使用了expect,參數(shù)為ftp服務(wù)器地址和要下載的文件名
參數(shù):lindex $argv 0  讀取ftp服務(wù)器ip地址
     lindex $argv 1  讀取要下載的文件名
編輯:
#vi ftp.sh
spawn ftp [lindex $argv 0]
expect "Name (*):"
send "anonymous\r"
expect "Password:*"
send "\r"
expect "ftp>"
send "binary\r"
expect "ftp>"
send "hash\r"
expect "ftp>"
send "get [lindex $argv 1]\r"
expect "* Transfer complete."
send "exit\r"
執(zhí)行方法:expect ftp.sh 服務(wù)器ip地址  文件名稱
        (expect ftp.sh 192.168.0.1 filename.txt )
 
擴(kuò)展:可以根據(jù)需要把用戶名和密碼也作為參數(shù)輸入里邊,這個(gè)根據(jù)個(gè)人需求去做
 
 
使用Shell腳本來實(shí)現(xiàn)FTP的自動(dòng)上傳下載
1. FTP自動(dòng)登錄批量下載文件。

#####從ftp服務(wù)器上的/home/data 到 本地的/home/databackup####

#!/bin/bash

ftp -n<<!

open 192.168.1.171

user guest 123456

binary

cd /home/data

lcd /home/databackup

prompt

mget *

close

bye

!
 
2. FTP自動(dòng)登錄上傳文件。

####本地的/home/databackup to ftp服務(wù)器上的/home/data####

#!/bin/bash

ftp -n<<!

open 192.168.1.171

user guest 123456

binary

hash

cd /home/data

lcd /home/databackup

prompt

mput *

close

bye

!
 

 
3. FTP自動(dòng)登錄下載單個(gè)文件。

####ftp服務(wù)器上下載/home/data/a.sh to local /home/databackup####

#!/bin/bash

ftp -n<<!

open 192.168.1.171

user guest 123456

binary

cd /home/data

lcd /home/databackup

prompt

get a.sh a.sh

close

bye

!
 

4. FTP自動(dòng)登錄上傳單個(gè)文件。

####把本地/home/databachup/a.sh up ftp /home/databackup 下####

#!/bin/bash

ftp -n<<!

open 192.168.1.171

user guest 123456

binary

cd /home/data

lcd /home/databackup

prompt

put a.sh a.sh

close

bye

!
 

使用.netrc文件方式自動(dòng)登錄

在用戶目錄下下建.netrc的文件
.netrc文件的內(nèi)容如下:
        machine         host2        :host2作為登陸用的主機(jī)名
        login        username        :ftp用戶名
        password         userpwd        : host2用戶的口令
        macdef                init        :定義一個(gè)名為init的宏,它將在自動(dòng)注冊(cè)進(jìn)程的最后被執(zhí)行
        bin                        :文件以二進(jìn)制傳輸
        lcd                /backup        :進(jìn)入本地目錄/backup
        cd                /pub        :進(jìn)入遠(yuǎn)程主機(jī)目錄/pub
        mput                        :將/backup目錄下的所有文件傳輸至遠(yuǎn)程主機(jī)
        bye                        :退出ftp
并修改文件屬性:$chmod 600 .netrc即該文件只能被該用戶訪問

無聲 2010-12-29 10:53 發(fā)表評(píng)論
]]>
struts1.x防止重復(fù)提交http://www.aygfsteel.com/parable-myth/archive/2010/12/23/341396.html無聲無聲Thu, 23 Dec 2010 07:44:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/12/23/341396.htmlhttp://www.aygfsteel.com/parable-myth/comments/341396.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/12/23/341396.html#Feedback1http://www.aygfsteel.com/parable-myth/comments/commentRss/341396.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/341396.html

無聲 2010-12-23 15:44 發(fā)表評(píng)論
]]>
C#正則表達(dá)式小結(jié) http://www.aygfsteel.com/parable-myth/archive/2010/11/26/339109.html無聲無聲Fri, 26 Nov 2010 02:31:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/26/339109.htmlhttp://www.aygfsteel.com/parable-myth/comments/339109.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/26/339109.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/339109.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/339109.html

地址: http://www.cnblogs.com/maxianghui/archive/2006/05/11/397747.html

確實(shí)不錯(cuò),感謝這位朋友

只能輸入數(shù)字:"^[0-9]*$"。
只能輸入n位的數(shù)字:"^"d{n}$"。
只能輸入至少n位的數(shù)字:"^"d{n,}$"。
只能輸入m~n位的數(shù)字:。"^"d{m,n}$"
只能輸入零和非零開頭的數(shù)字:"^(0|[1-9][0-9]*)$"。
只能輸入有兩位小數(shù)的正實(shí)數(shù):"^[0-9]+(.[0-9]{2})?$"。
只能輸入有1~3位小數(shù)的正實(shí)數(shù):"^[0-9]+(.[0-9]{1,3})?$"。
只能輸入非零的正整數(shù):"^"+?[1-9][0-9]*$"。
只能輸入非零的負(fù)整數(shù):"^"-[1-9][]0-9"*$。
只能輸入長(zhǎng)度為3的字符:"^.{3}$"。
只能輸入由26個(gè)英文字母組成的字符串:"^[A-Za-z]+$"。
只能輸入由26個(gè)大寫英文字母組成的字符串:"^[A-Z]+$"。
只能輸入由26個(gè)小寫英文字母組成的字符串:"^[a-z]+$"。
只能輸入由數(shù)字和26個(gè)英文字母組成的字符串:"^[A-Za-z0-9]+$"。
只能輸入由數(shù)字、26個(gè)英文字母或者下劃線組成的字符串:"^"w+$"。
驗(yàn)證用戶密碼:"^[a-zA-Z]"w{5,17}$"正確格式為:以字母開頭,長(zhǎng)度在6~18之間,只能包含字符、數(shù)字和下劃線。
驗(yàn)證是否含有^%&',;=?$""等字符:"[^%&',;=?$"x22]+"。
只能輸入漢字:"^["u4e00-"u9fa5]{0,}$"
驗(yàn)證Email地址:"^"w+([-+.]"w+)*@"w+([-.]"w+)*"."w+([-.]"w+)*$"。
驗(yàn)證InternetURL:"^http://([/"w-]+".)+["w-]+(/["w-./?%&=]*)?$"。
驗(yàn)證電話號(hào)碼:"^("("d{3,4}-)|"d{3.4}-)?"d{7,8}$"正確格式為:"XXX-XXXXXXX"、"XXXX-XXXXXXXX"、"XXX-XXXXXXX"、"XXX-XXXXXXXX"、"XXXXXXX"和"XXXXXXXX"。
驗(yàn)證身份證號(hào)(15位或18位數(shù)字):"^"d{15}|"d{18}$"。
驗(yàn)證一年的12個(gè)月:"^(0?[1-9]|1[0-2])$"正確格式為:"01"~"09"和"1"~"12"。
驗(yàn)證一個(gè)月的31天:"^((0?[1-9])|((1|2)[0-9])|30|31)$"正確格式為;"01"~"09"和"1"~"31"。
利用正則表達(dá)式限制網(wǎng)頁表單里的文本框輸入內(nèi)容:

用正則表達(dá)式限制只能輸入中文:onkeyup="value=value.replace(/[^"u4E00-"u9FA5]/g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^"u4E00-"u9FA5]/g,''))"

用正則表達(dá)式限制只能輸入全角字符: onkeyup="value=value.replace(/[^"uFF00-"uFFFF] /g,'')" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^"uFF00-"uFFFF]/g,''))"

用正則表達(dá)式限制只能輸入數(shù)字:onkeyup="value=value.replace(/[^"d]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^"d]/g,''))"

用正則表達(dá)式限制只能輸入數(shù)字和英文:onkeyup="value=value.replace(/["W]/g,'') "onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^"d]/g,''))"

得用正則表達(dá)式從URL地址中提取文件名的javascript程序,如下結(jié)果為page1

s="http://www.9499.net/page1.htm"
s=s.replace(/(.*"/){0,}([^".]+).*/ig,"$2")
alert(s)

匹配雙字節(jié)字符(包括漢字在內(nèi)):[^"x00-"xff]

應(yīng)用:計(jì)算字符串的長(zhǎng)度(一個(gè)雙字節(jié)字符長(zhǎng)度計(jì)2,ASCII字符計(jì)1)

String.prototype.len=function(){return this.replace([^"x00-"xff]/g,"aa").length;}

匹配空行的正則表達(dá)式:"n["s| ]*"r

匹配HTML標(biāo)記的正則表達(dá)式:/<(.*)>.*<"/"1>|<(.*) "/>/

匹配首尾空格的正則表達(dá)式:(^"s*)|("s*$)

String.prototype.trim = function()
{
    return this.replace(/(^"s*)|("s*$)/g, "");
}

利用正則表達(dá)式分解和轉(zhuǎn)換IP地址:

下面是利用正則表達(dá)式匹配IP地址,并將IP地址轉(zhuǎn)換成對(duì)應(yīng)數(shù)值的Javascript程序:

function IP2V(ip)
{
 re=/("d+)".("d+)".("d+)".("d+)/g  //匹配IP地址的正則表達(dá)式
if(re.test(ip))
{
return RegExp.$1*Math.pow(255,3))+RegExp.$2*Math.pow(255,2))+RegExp.$3*255+RegExp.$4*1
}
else
{
 throw new Error("Not a valid IP address!")
}
}

不過上面的程序如果不用正則表達(dá)式,而直接用split函數(shù)來分解可能更簡(jiǎn)單,程序如下:

var ip="10.100.20.168"
ip=ip.split(".")
alert("IP值是:"+(ip[0]*255*255*255+ip[1]*255*255+ip[2]*255+ip[3]*1))
符號(hào)解釋:

字符
描述

"
將下一個(gè)字符標(biāo)記為一個(gè)特殊字符、或一個(gè)原義字符、或一個(gè) 向后引用、或一個(gè)八進(jìn)制轉(zhuǎn)義符。例如,'n' 匹配字符 "n"。'"n' 匹配一個(gè)換行符。序列 '""' 匹配 """ 而 ""(" 則匹配 "("。

^
匹配輸入字符串的開始位置。如果設(shè)置了 RegExp 對(duì)象的 Multiline 屬性,^ 也匹配 '"n' 或 '"r' 之后的位置。

$
匹配輸入字符串的結(jié)束位置。如果設(shè)置了RegExp 對(duì)象的 Multiline 屬性,$ 也匹配 '"n' 或 '"r' 之前的位置。

*
匹配前面的子表達(dá)式零次或多次。例如,zo* 能匹配 "z" 以及 "zoo"。* 等價(jià)于{0,}。

+
匹配前面的子表達(dá)式一次或多次。例如,'zo+' 能匹配 "zo" 以及 "zoo",但不能匹配 "z"。+ 等價(jià)于 {1,}。

?
匹配前面的子表達(dá)式零次或一次。例如,"do(es)?" 可以匹配 "do" 或 "does" 中的"do" 。? 等價(jià)于 {0,1}。

{n}
n 是一個(gè)非負(fù)整數(shù)。匹配確定的 n 次。例如,'o{2}' 不能匹配 "Bob" 中的 'o',但是能匹配 "food" 中的兩個(gè) o。

{n,}
n 是一個(gè)非負(fù)整數(shù)。至少匹配n 次。例如,'o{2,}' 不能匹配 "Bob" 中的 'o',但能匹配 "foooood" 中的所有 o。'o{1,}' 等價(jià)于 'o+'。'o{0,}' 則等價(jià)于 'o*'。

{n,m}
m 和 n 均為非負(fù)整數(shù),其中n <= m。最少匹配 n 次且最多匹配 m 次。例如,"o{1,3}" 將匹配 "fooooood" 中的前三個(gè) o。'o{0,1}' 等價(jià)于 'o?'。請(qǐng)注意在逗號(hào)和兩個(gè)數(shù)之間不能有空格。

?
當(dāng)該字符緊跟在任何一個(gè)其他限制符 (*, +, ?, {n}, {n,}, {n,m}) 后面時(shí),匹配模式是非貪婪的。非貪婪模式盡可能少的匹配所搜索的字符串,而默認(rèn)的貪婪模式則盡可能多的匹配所搜索的字符串。例如,對(duì)于字符串 "oooo",'o+?' 將匹配單個(gè) "o",而 'o+' 將匹配所有 'o'。

.
匹配除 ""n" 之外的任何單個(gè)字符。要匹配包括 '"n' 在內(nèi)的任何字符,請(qǐng)使用象 '[."n]' 的模式。

(pattern)
匹配 pattern 并獲取這一匹配。所獲取的匹配可以從產(chǎn)生的 Matches 集合得到,在VBScript 中使用 SubMatches 集合,在JScript 中則使用 $0…$9 屬性。要匹配圓括號(hào)字符,請(qǐng)使用 '"(' 或 '")'。

(?:pattern)
匹配 pattern 但不獲取匹配結(jié)果,也就是說這是一個(gè)非獲取匹配,不進(jìn)行存儲(chǔ)供以后使用。這在使用 "或" 字符 (|) 來組合一個(gè)模式的各個(gè)部分是很有用。例如, 'industr(?:y|ies) 就是一個(gè)比 'industry|industries' 更簡(jiǎn)略的表達(dá)式。

(?=pattern)
正向預(yù)查,在任何匹配 pattern 的字符串開始處匹配查找字符串。這是一個(gè)非獲取匹配,也就是說,該匹配不需要獲取供以后使用。例如,'Windows (?=95|98|NT|2000)' 能匹配 "Windows 2000" 中的 "Windows" ,但不能匹配 "Windows 3.1" 中的 "Windows"。預(yù)查不消耗字符,也就是說,在一個(gè)匹配發(fā)生后,在最后一次匹配之后立即開始下一次匹配的搜索,而不是從包含預(yù)查的字符之后開始。

(?!pattern)
負(fù)向預(yù)查,在任何不匹配 pattern 的字符串開始處匹配查找字符串。這是一個(gè)非獲取匹配,也就是說,該匹配不需要獲取供以后使用。例如'Windows (?!95|98|NT|2000)' 能匹配 "Windows 3.1" 中的 "Windows",但不能匹配 "Windows 2000" 中的 "Windows"。預(yù)查不消耗字符,也就是說,在一個(gè)匹配發(fā)生后,在最后一次匹配之后立即開始下一次匹配的搜索,而不是從包含預(yù)查的字符之后開始

x|y
匹配 x 或 y。例如,'z|food' 能匹配 "z" 或 "food"。'(z|f)ood' 則匹配 "zood" 或 "food"。

[xyz]
字符集合。匹配所包含的任意一個(gè)字符。例如, '[abc]' 可以匹配 "plain" 中的 'a'。

[^xyz]
負(fù)值字符集合。匹配未包含的任意字符。例如, '[^abc]' 可以匹配 "plain" 中的'p'。

[a-z]
字符范圍。匹配指定范圍內(nèi)的任意字符。例如,'[a-z]' 可以匹配 'a' 到 'z' 范圍內(nèi)的任意小寫字母字符。

[^a-z]
負(fù)值字符范圍。匹配任何不在指定范圍內(nèi)的任意字符。例如,'[^a-z]' 可以匹配任何不在 'a' 到 'z' 范圍內(nèi)的任意字符。

"b
匹配一個(gè)單詞邊界,也就是指單詞和空格間的位置。例如, 'er"b' 可以匹配"never" 中的 'er',但不能匹配 "verb" 中的 'er'。

"B
匹配非單詞邊界。'er"B' 能匹配 "verb" 中的 'er',但不能匹配 "never" 中的 'er'。

"cx
匹配由 x 指明的控制字符。例如, "cM 匹配一個(gè) Control-M 或回車符。x 的值必須為 A-Z 或 a-z 之一。否則,將 c 視為一個(gè)原義的 'c' 字符。

"d
匹配一個(gè)數(shù)字字符。等價(jià)于 [0-9]。

"D
匹配一個(gè)非數(shù)字字符。等價(jià)于 [^0-9]。

"f
匹配一個(gè)換頁符。等價(jià)于 "x0c 和 "cL。

"n
匹配一個(gè)換行符。等價(jià)于 "x0a 和 "cJ。

"r
匹配一個(gè)回車符。等價(jià)于 "x0d 和 "cM。

"s
匹配任何空白字符,包括空格、制表符、換頁符等等。等價(jià)于 [ "f"n"r"t"v]。

"S
匹配任何非空白字符。等價(jià)于 [^ "f"n"r"t"v]。

"t
匹配一個(gè)制表符。等價(jià)于 "x09 和 "cI。

"v
匹配一個(gè)垂直制表符。等價(jià)于 "x0b 和 "cK。

"w
匹配包括下劃線的任何單詞字符。等價(jià)于'[A-Za-z0-9_]'。

"W
匹配任何非單詞字符。等價(jià)于 '[^A-Za-z0-9_]'。

"xn
匹配 n,其中 n 為十六進(jìn)制轉(zhuǎn)義值。十六進(jìn)制轉(zhuǎn)義值必須為確定的兩個(gè)數(shù)字長(zhǎng)。例如,'"x41' 匹配 "A"。'"x041' 則等價(jià)于 '"x04' & "1"。正則表達(dá)式中可以使用 ASCII 編碼。.

"num
匹配 num,其中 num 是一個(gè)正整數(shù)。對(duì)所獲取的匹配的引用。例如,'(.)"1' 匹配兩個(gè)連續(xù)的相同字符。

"n
標(biāo)識(shí)一個(gè)八進(jìn)制轉(zhuǎn)義值或一個(gè)向后引用。如果 "n 之前至少 n 個(gè)獲取的子表達(dá)式,則 n 為向后引用。否則,如果 n 為八進(jìn)制數(shù)字 (0-7),則 n 為一個(gè)八進(jìn)制轉(zhuǎn)義值。

"nm
標(biāo)識(shí)一個(gè)八進(jìn)制轉(zhuǎn)義值或一個(gè)向后引用。如果 "nm 之前至少有 nm 個(gè)獲得子表達(dá)式,則 nm 為向后引用。如果 "nm 之前至少有 n 個(gè)獲取,則 n 為一個(gè)后跟文字 m 的向后引用。如果前面的條件都不滿足,若 n 和 m 均為八進(jìn)制數(shù)字 (0-7),則 "nm 將匹配八進(jìn)制轉(zhuǎn)義值 nm。

"nml
如果 n 為八進(jìn)制數(shù)字 (0-3),且 m 和 l 均為八進(jìn)制數(shù)字 (0-7),則匹配八進(jìn)制轉(zhuǎn)義值 nml。

"un
匹配 n,其中 n 是一個(gè)用四個(gè)十六進(jìn)制數(shù)字表示的 Unicode 字符。例如, "u00A9 匹配版權(quán)符號(hào) (?)。



無聲 2010-11-26 10:31 發(fā)表評(píng)論
]]>
jbpm4 java.lang.LinkageError: loader constraint violation 包沖突http://www.aygfsteel.com/parable-myth/archive/2010/11/17/338246.html無聲無聲Wed, 17 Nov 2010 04:52:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/17/338246.htmlhttp://www.aygfsteel.com/parable-myth/comments/338246.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/17/338246.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/338246.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/338246.html

無聲 2010-11-17 12:52 發(fā)表評(píng)論
]]>
c#web定時(shí)任務(wù)http://www.aygfsteel.com/parable-myth/archive/2010/11/11/337775.html無聲無聲Thu, 11 Nov 2010 01:22:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/11/337775.htmlhttp://www.aygfsteel.com/parable-myth/comments/337775.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/11/337775.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337775.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337775.html轉(zhuǎn)自:http://www.programbbs.com/doc/3003.htm 另外可參考http://developer.51cto.com/art/200909/149829.htm

想在Web中定時(shí) 處理某些任務(wù)吧?ITPUB個(gè)人空間T?b}N9W8_ e]w;`8B
可以在Global.asax 中定義,直接上例子:

<script runat="server">
    
void Application_Start(object sender, EventArgs e) 
    {
YN~MB DdY.w `#D0       
       
// 應(yīng)用程序啟動(dòng)時(shí)
       System.Timers.Timer timer = new System.Timers.Timer();
       DateTime sTime 
= DateTime.Now;
       
int sHour = sTime.Hour;
       
int sMin = sTime.Minute;
       
int sSecond = sTime.Second;
       
int sHourInterval = 15 - sHour;
       
int sSecondInterval = sHourInterval * 60 * 60 * 1000;
       
//timer.Interval = 1000*5;//5秒發(fā)送一次
       timer.Interval = sSecondInterval;
       
//timer.AutoReset;
       timer.Elapsed += new System.Timers.ElapsedEventHandler(timer_Elapsed);
       timer.Enabled 
= true;

    }
    
void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
    {
        
string s_from = "fengsheng@xxx.com";
        
string s_to = "fengsheng@xxx.com";
        
string pwd = "1234567";
ww"l9BF ?$^0        
string s_body = "test";
        
string s_smtp = "mail.xxx.com";ITPUB個(gè)人空間!V @-K*DR xM Jr
        
int i = s_from.IndexOf("@");ITPUB個(gè)人空間XI@A L"?|
        
string s_subjetc = "test";
        
string username = s_from.Substring(0, i);
        System.Net.Mail.MailAddress from 
= new System.Net.Mail.MailAddress(s_from);ITPUB個(gè)人空間 dvT*IPZDs+I
        System.Net.Mail.MailAddress to 
= new System.Net.Mail.MailAddress(s_to);
        System.Net.Mail.MailMessage mailobj 
= new System.Net.Mail.MailMessage(from, to);
QE.~ gN0W[0        mailobj.Subject 
= s_subjetc;
        mailobj.Body 
= s_body;ITPUB個(gè)人空間Z FoC `'z LV

        mailobj.IsBodyHtml 
= true;
        mailobj.BodyEncoding 
= System.Text.Encoding.GetEncoding("GB2312");
        mailobj.Priority 
= System.Net.Mail.MailPriority.High;
u8KJ#M a0T ^0        System.Net.Mail.SmtpClient smtp 
= new System.Net.Mail.SmtpClient();
        smtp.Host 
= s_smtp;
        smtp.UseDefaultCredentials 
= true;ITPUB個(gè)人空間*SL m K Q f^}#G
        smtp.Credentials 
= new System.Net.NetworkCredential(username, pwd);
        smtp.Send(mailobj);
    }ITPUB個(gè)人空間 sP P+Is/E
</script>
ui?g"z4"5o9kAzmo!p0

上面 是一個(gè)定時(shí)發(fā)郵件的小例子,一舉兩得,還給大家了一個(gè)發(fā)郵件的例子 ,呵呵
建議最好是把需要啟動(dòng)的事項(xiàng) 做成 web Service 這樣 應(yīng)用范圍會(huì)更廣~



無聲 2010-11-11 09:22 發(fā)表評(píng)論
]]>
Integrating JDBC with Hibernatehttp://www.aygfsteel.com/parable-myth/archive/2010/11/10/337728.html無聲無聲Wed, 10 Nov 2010 08:17:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/10/337728.htmlhttp://www.aygfsteel.com/parable-myth/comments/337728.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/10/337728.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337728.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337728.html

Integrating JDBC with Hibernate

from http://www.informit.com/guides/content.aspx?g=java&seqNum=575

Last updated Jun 25, 2010.

One of the powerful things about Hibernate is that you do not typically need to manually write SQL: you build a domain model that represents your data model in an object-oriented manner and then interact with your domain model. This is the ideal, but sometimes you need to model a legacy data model or a data model that is not object-oriented in nature, which leads to either complicated Hibernate mappings or the inclusion of manual SQL. When this occurs, you do not want to have to build separate data access object classes but rather you would like to find a way to seamlessly integrate SQL into your existing data access object classes in a way that your consumers do not even realize that you're not using Hibernate Query Language (HQL) under-the-hood.

Fortunately you do not need to jump through too many hoops to integrate manual JDBC into your Hibernate classes, you just need to perform the following steps:

  1. Obtain access to your Hibernate's Session object
  2. Create a class that implements org.hibernate.jdbc.Work, or create an anonymous inner class that implements the Work interface, and implement the execute() method using the supplied Connection object to execute your SQL
  3. Pass the Work class to Hibernate's doWork() method, which in turn invokes your Work's execute() method

Listings 1 and 2 illustrate how to use the Work interface to execute a simple SQL statement.

Listing 1. MyDao.java

...
public class MyDao
{
...
public String getValue( long id )
{
// Create a SQL order of work, which we will use to execute a manual SQL statement
MyWork myWork = new MyWork( id );

// Gain access to the underlying Hibernate session
Session session = getSessionFactory().openSession();

// Ask the Hibernate session to execute the unit of work
session.doWork( myWork );

// Obtain the results of the unit of work
return myWork.getValue();
}
..
}

Listing 1 defines a getValue() method that accepts an id and returns a String. It creates a new MyWork instance, passing it the id as an initialization parameter, locates a Hibernate Session, and passes the MyWork instance to the Sessions doWork() method. After the query is complete, it retrieves the value from the MyWork class.

The mechanism that you use to obtain a Hibernate Session will be dependent on the technology with which you are building your data access object. If you're using Spring by extending HibernateDaoSupport, you can invoke getSessionFactory().openSession() to create a new Session object.

Listing 2 shows the source code for the MyWork class.

Listing 2. MyWork.java

public class MyWork implements Work
{
private long id;
private String value;

public MyWork( long id )
{
this.id = id;
}

public String getValue()
{
return value;
}

@Override
public void execute( Connection connection ) throws SQLException
{
PreparedStatement ps = null;
ResultSet rs = null;
try
{
ps = connection.prepareStatement( "SELECT * FROM table WHERE id = ?" );
ps.setLong( 1, id );
rs = ps.executeQuery();
while( rs.next() )
{
value = rs.getString( 1 );
}
}
catch( SQLException e ) { }
finally {
if( rs != null )
{
try {
rs.close();
}
catch( Exception e ) {}
}
if( ps != null )
{
try {
ps.close();
}
catch( Exception e ) {}
}
}
}
}

The MyWork class implements its data access logic in its execute() method. The execute() method is passed a java.sql.Connection object that you can use as you normally would to create a Statement, PreparedStatement, or CallableStatement. The doWork() method returns void, so it is up to you to develop a mechanism to return a value from your unit of work.

If you are executing SQL from which you do not necessarily need to retrieve results, you can accomplish the same results by creating an anonymous inner class:

       // Gain access to the underlying Hibernate session
Session session = getSessionFactory().openSession();

// Ask the Hibernate session to execute the unit of work
session.doWork( new Work() {
@Override
public void execute( Connection connection ) {
// Implement your SQL here
}
} );

In this example we create the Work() implementation in the doWork() method invocation and override the execute() method. Depending on your background this might look a bit strange, but once you get used to it, this is a fairly elegant way to implement your solution because it reduces the number of explicit classes you need to create and it couples the logic being executed with the invocation of that logic. For complicated cases you want to loosely couple things, but for a SQL statement it is overkill to create additional classes if you do not need to. The challenge here, however, is that if you need to obtain results from the query, you're limited because the doWork() method returns void.

Hibernate offers a simple mechanism to execute SQL inside your Hibernate data access object classes by defining a unit of work and passing it to your Hibernate Session's doWork() method. You can define your unit of work explicitly by creating a class that implements org.hibernate.jdbc.Work or by creating an anonymous inner class that implements the Work interface on-the-fly. The best solution, if you are building your domain model from scratch, is to model your objects as simply as you can (remember the KISS principle: keep it simple, stupid), but if you have to create a domain model that does not lend itself easily to an object-oriented representation then you can integrate manual SQL in this manner.



無聲 2010-11-10 16:17 發(fā)表評(píng)論
]]>
hibernate lock modehttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337351.html無聲無聲Fri, 05 Nov 2010 07:44:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337351.htmlhttp://www.aygfsteel.com/parable-myth/comments/337351.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337351.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337351.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337351.html LockMode.READ :直接從數(shù)據(jù)庫讀,不使用緩存數(shù)據(jù)
LockMode.WRITE :在insert update數(shù)據(jù)的時(shí)候,HIBERNATE內(nèi)部使用的。
以上3種均為HIBERNATE級(jí)別的鎖,也就是緩存級(jí)別的鎖。

下面2種為數(shù)據(jù)庫級(jí)別的鎖:
LockMode.UPGRADE:相當(dāng)于SQL語句select for update,被select的數(shù)據(jù)都被數(shù)據(jù)庫鎖住了,不能被其他事務(wù)修改。
LockMode. UPGRADE_NOWAIT :是ORACLE數(shù)據(jù)庫特有的select for update nowait


無聲 2010-11-05 15:44 發(fā)表評(píng)論
]]>
select for update nowait 與 select for update 區(qū)別http://www.aygfsteel.com/parable-myth/archive/2010/11/05/337350.html無聲無聲Fri, 05 Nov 2010 07:42:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337350.htmlhttp://www.aygfsteel.com/parable-myth/comments/337350.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337350.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337350.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337350.html

轉(zhuǎn)自:http://blog.163.com/yiyun_8/blog/static/100336422201031505832337/

nowait的含義很多人都會(huì)誤解為“不用等待,立即執(zhí)行”。但實(shí)際上該關(guān)鍵字的含義是“不用等待,立即返回”
如果當(dāng)前請(qǐng)求的資源被其他會(huì)話鎖定時(shí),會(huì)發(fā)生阻塞,nowait可以避免這一阻塞,因?yàn)?br /> If another user is in the process of modifying that row, we will get an ORA‐00054
Resource Busy error. We are blocked and must wait for the other user to finish with
it.
可以實(shí)驗(yàn)下,我用pl/sql developer鎖定表game
SQL> select * from game where game_id =1;
返回一條記錄
 

SQL> select * from game where game_id=1 for update nowait;
select * from game where game_id=1 for update nowait
             *
ERROR位于第1行:
ORA-00054:資源正忙,要求指定NOWAIT
使用NOWAIT關(guān)鍵字,會(huì)報(bào)ORA‐00054的錯(cuò)誤
 

如何來查看是什么資源造成這樣的情況呢?并且怎么解決呢?
查看鎖定的對(duì)象,用戶和會(huì)話
SQL> select lo.oracle_username,do.object_name,s.logon_time,lo.process,s.sid as s
ession_id
 2 from v$locked_object lo,v$session s,dba_objects do
 3 where lo.session_id = s.sid and do.object_id = lo.OBJECT_ID
 4 /
ORACLE_USERNAME
------------------------------
OBJECT_NAME
--------------------------------------------------------------------------------
 

LOGON_TIME         PROCESS     SESSION_ID
------------------- ------------ ----------
NBA---用戶名稱
GAME---操作的對(duì)象
2009-08-04 10:55:15---登錄的時(shí)間     840:5176   10
 

使用as sysdba
根據(jù)sid查看具體的sql語句
selectsql_textfromv$session a,v$sqltext_with_newlines b
whereDECODE(a.sql_hash_value,0, prev_hash_value, sql_hash_value)=b.hash_value
 anda.sid=10;
begin :id := sys.dbms_transaction.local_transaction_id; end;
 

kill session
SQL> select sid,serial# from v$session where sid =10;
 

      SID   SERIAL#
---------- ----------
       10        23
SQL> alter system kill session '10,23';
 

系統(tǒng)已更改。
 

select * from game where game_id=1 for update nowait;
有數(shù)據(jù)返回了

當(dāng)兩個(gè)用戶同時(shí)更新同一條記錄是, 使用select for update,后執(zhí)行者,會(huì)被阻塞,而使用select for update  nowait 則會(huì)拋出:ORA-00054 resource busy and acquire with NOWAIT specified 異常,告之用戶這一行已經(jīng)鎖定。



無聲 2010-11-05 15:42 發(fā)表評(píng)論
]]>
org.springframework.orm.hibernate3 http://www.aygfsteel.com/parable-myth/archive/2010/11/05/337315.html無聲無聲Fri, 05 Nov 2010 05:27:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337315.htmlhttp://www.aygfsteel.com/parable-myth/comments/337315.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/05/337315.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337315.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337315.html 最近在研究spring 2.5.6 hibernate3.3.1 時(shí),hibernate.current_session_context_class這個(gè)配置默認(rèn)是org.springframework.orm.hibernate3.SpringSessionContext,SpringSessionContext是Hibernate 3.1's CurrentSessionContext接口實(shí)現(xiàn)類。
你可以打開日志觀察后臺(tái)信息
hibernate.current_session_context_class=org.springframework.orm.hibernate3.SpringSessionContext



無聲 2010-11-05 13:27 發(fā)表評(píng)論
]]>
struts2 if標(biāo)簽和枚舉比較http://www.aygfsteel.com/parable-myth/archive/2010/11/04/337236.html無聲無聲Thu, 04 Nov 2010 07:19:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/04/337236.htmlhttp://www.aygfsteel.com/parable-myth/comments/337236.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/04/337236.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/337236.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337236.html  pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>顯示用戶信息</title>
</head>
<body>
<s:iterator id="it" value="list" status="st">
 <s:property value="username" />---<s:property value="password" />--<s:property
  value="gender" />-----  
    <s:if test="gender.toString()==@cn.ssh.domain.Gender@MAN.toString()">男</s:if>
 <s:else>女</s:else>
 --
 <s:if test="gender.toString()=='MAN'.toString()">男</s:if>
 <s:else>女</s:else>
 <br>
list是action中的
</s:iterator>
<s:debug></s:debug>
</body>
</html>

也可以采用如下方式

public enum Gender {
 MAN {
  public String getSex() {
   return "男";
  }
 },
 WOMEN{
  public String getSex() {
   return "女";
  }
 };
}

<%@ page language="java" contentType="text/html; charset=UTF-8"
 pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>顯示用戶信息</title>
</head>
<body>
<s:iterator value="list">
 <s:property value="username" />---<s:property value="password" />--<s:property value="gender.sex" /> 
   
 <br>
</s:iterator>
<s:debug></s:debug>
</body>
</html>

struts2標(biāo)簽真是強(qiáng)大

無聲 2010-11-04 15:19 發(fā)表評(píng)論
]]>
Struts2 標(biāo)簽庫講解http://www.aygfsteel.com/parable-myth/archive/2010/11/04/337235.html無聲無聲Thu, 04 Nov 2010 07:17:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/04/337235.htmlhttp://www.aygfsteel.com/parable-myth/comments/337235.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/04/337235.html#Feedback3http://www.aygfsteel.com/parable-myth/comments/commentRss/337235.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/337235.html

轉(zhuǎn)自:http://blog.163.com/hzd_love/blog/static/131999881201082111852520/
要使用Struts2的標(biāo)簽,只需要在JSP頁面添加如下一行定義即可:

<%@ taglib prefix="s" uri="/struts-tags"%>

struts2的標(biāo)簽共分為五大類:

一、邏輯控制標(biāo)簽

用于進(jìn)行邏輯控制輸出。主要分以下幾類:

1)條件標(biāo)簽:用于執(zhí)行基本的條件流轉(zhuǎn)

<s:if>:擁有一個(gè)test屬性,其表達(dá)式的值用來決定標(biāo)簽里內(nèi)容是否顯示。<s:if test="#request.username=='hzd'">歡迎h(huán)zd</s:if>

<s:elseif>:同上。

<s:else>

2)迭代標(biāo)簽:用于遍歷集合(java.util.Collection)或者枚舉值(java.util.Iterator)類型的對(duì)象,value屬性表示集合或枚舉對(duì)象,status屬性表示當(dāng)前循環(huán)的對(duì)象,在循環(huán)體內(nèi)部可以引用該對(duì)象的屬性

<s:iterator value="userList" status="user">

姓名:<s:property value="user.userName" />

年齡:<s:property value="user.age" />

</s:iterator>

3)組合標(biāo)簽:用于將多個(gè)枚舉值對(duì)象進(jìn)行疊加,形成一個(gè)新的枚舉值列表

如將3個(gè)列表對(duì)象進(jìn)行了組合,形成新的列表對(duì)象:

<s:append var="newIteratorList">

<s:param value="%{myList1}" />

<s:param value="%{myList2}" />

<s:param value="%{myList3}" />

</s:append>

輸出:

<s:iterator value="%{#newIteratorList}">

<s:property />

</s:iterator>

4)分割標(biāo)簽:用于將一個(gè)字符串進(jìn)行分隔,產(chǎn)生一個(gè)枚舉值列表

下面的代碼將分隔為3個(gè)字符串,然后循環(huán)輸出

<s:generator val="%{'aaa,bbb,ccc'}">

<s:iterator>

<s:property />

</s:iterator>

</s:generator>

5)合并標(biāo)簽:用于將多個(gè)枚舉值按照數(shù)組的索引位置進(jìn)行合并

<s:merge var="newMergeList">

<s:param value="%{mylist1}">--設(shè)mylist1列表中有a,b,c三個(gè)元素

<s:param value="%{mylist2}">--設(shè)mylist2列表中有1,2,3三個(gè)元素

</s:merge>

合并后新的列表的元素及其順序?yàn)椋篴,1,b,2,c,3

<s:iterator value="%{#newMergeList}">

<s:property />

</s:iterator>

6)排序標(biāo)簽:用于對(duì)一組枚舉值進(jìn)行排序,屬性comparator指向一個(gè)繼承自java.util.Comparator的比較器,該比較器可以是對(duì)應(yīng)Action頁面中的一個(gè)比較器變量,source指定要排序的列表對(duì)象

<s:sort comparator="myComparator" source="myList">

<s:iterator>

<s:property value="..."/>

</s:iterator>

</s:sort>

7)子集標(biāo)簽:用于取得一個(gè)枚舉列表的子集,source用于指定檢索的列表對(duì)象,start用于指定起始檢索的索引位置,count用于指定檢索的結(jié)果數(shù)量,decider屬性必須是一個(gè)org.apache.struts2.util.SubsetIteratorFilter.Decider類的子類實(shí)例,用以指定檢索的條件。例如在Action中提供了以下方法用來取得一個(gè)Decider對(duì)象:

public Decider getDecider()

{

return new Decider(){

public boolean decide(Object element) throws Exception{

int i=((Integer)element).intValue();

return (((i%2)==0)?true:false);

}

};

}

然后引用該對(duì)象篩選子集:

<s:subset source="myList" decider="decider">

</s:subset>

或者不使用Decider對(duì)象:

<s:subset source="myList" count="13" start="3">

</s:subset>

 

二、數(shù)據(jù)輸出標(biāo)簽

數(shù)據(jù)輸出標(biāo)簽用以輸出頁面中的元素、屬性、隱含變量等,即包括靜態(tài)文本的輸出,也包括struts2集成的各種變量的輸出。

1)鏈接標(biāo)簽:用于創(chuàng)建一個(gè)<a>標(biāo)簽,errorText用于顯示錯(cuò)誤信息,priInvokeJS表示該鏈接執(zhí)行時(shí)的javascript提示函數(shù),href表示跳轉(zhuǎn)地址.

<s:a errorText="刪除錯(cuò)誤" preInvokeJS="confirm('確認(rèn)刪除?')" href="test.jsp">

<img src="/image/delete.gif" />

</s:a>

2)Action標(biāo)簽:可以直接調(diào)用Action類中的函數(shù),前提是該Action類在struts.xml中有定義,name屬性用于指向映射文件中配置的Action函數(shù),executeResult屬性表示是否執(zhí)行結(jié)果集的跳轉(zhuǎn)

<s:action name="LoginAction" executeResult="true" />--表示執(zhí)行LoginAction的默認(rèn)處理方法execute()

<s:action name="LoginAction!login" executeResult="true" />--表示執(zhí)行LoginAction的處理方法login()

3)JavaBean標(biāo)簽:用于創(chuàng)建一個(gè)JavaBean對(duì)象,name表示JavaBean類全名,var表示變量的實(shí)例名,并可以包含<s:param>設(shè)置實(shí)例化輸入?yún)?shù)

<s:bean name="xxx,xxx,xxx" var="xxx">

<s:param name="name" value="hzd" />--為該JavaBean的構(gòu)造方法傳遞參數(shù)

</s:bean>

4)日期標(biāo)簽:用以輸出一個(gè)格式化的日期對(duì)象,name表示要輸出的對(duì)象,format表示輸出的日期格式

 <s:date name="user.birthday" format="dd/MM/yyyy" />

<s:date name="user.birthday" format="%{getText('some.i18n.key')}" />

<s:date name="user.birthday" />--默認(rèn)格式

5)調(diào)用標(biāo)簽:用以輸出頁面的值棧調(diào)試信息,通常在進(jìn)行程序調(diào)用時(shí)使用,便于查找JSP頁面中的錯(cuò)誤

6)引用資源文件標(biāo)簽:用于加載資源包到值棧,它可以允許<s:text>標(biāo)簽訪問任何資源包的信息,而不只是當(dāng)前action相關(guān)聯(lián)的資源包。name屬性用以指定資源包的類路徑

如xxx.xxx.xxx.ApplicationMessages中定義了標(biāo)簽:HelloWord=歡迎您!

則可以這樣引用:

<s:i18n name="xxx.xxx.xxx.ApplilcationMessages">

<s:text name="HelloWord" />

</s:i18n>

7)包含頁面標(biāo)簽:用來包含一個(gè)Servlet的輸出(Servlet或JSP頁面),使用value屬性指定包含頁名稱,可以使用<s:param>傳遞參數(shù)給子頁

<s:include value="/test.jsp">

<s:param name="username">hzd</s:param>--參數(shù)username=hzd給test.jsp頁面

</s:include>

8)傳遞參數(shù)標(biāo)簽:用來為其他標(biāo)簽提供參數(shù),所以一般是嵌套在其它標(biāo)簽的內(nèi)部,name屬性用來指定參數(shù)名稱,value(可選)屬性用來指定參數(shù)值

<s:param name="username" value="hzd" />--這種方式的參數(shù)值會(huì)以String格式放入stack

<s:param name="username">hzd</s:param>--這種方式的參數(shù)值會(huì)以O(shè)bject的格式放入stack

9)值棧標(biāo)簽:用以加入一個(gè)值到值棧中

<s:push value="user">

<s:property value="name" />--為user指定name屬性

<s:property value="age" />--為user指定age屬性

</s:push>

10)變量賦值標(biāo)簽:賦予變量一個(gè)特定范圍內(nèi)的值,name屬性表示變量的名字,scope表示變量的作用域(application.session.request.page.action),value變量的值

<s:set>

11)國際化標(biāo)簽:用于輸出國際化信息,name屬性指定國際化資源文件中消息文本的key,可以與<s:i18n>標(biāo)簽結(jié)合使用

<s:text name="HelloWord" />--它會(huì)按照一定的順序查找資源文件,直到找到定義HellowWord標(biāo)簽的資源文件為止

12)鏈接標(biāo)簽:用于創(chuàng)建一個(gè)URL鏈接,并可以通過<s:param>標(biāo)簽提供request參數(shù)

<s:url id="url" value="/test.jsp">

<s:param name="username">hzd</s:param>

</s:url>

13)屬性標(biāo)簽:用以輸出value屬性的值,并擁有一個(gè)default屬性,在value對(duì)象不存在時(shí)顯示。escape屬性為true,來輸出原始的HTML文本

<s:property value="getText('some.key')">

 

三、HTML表單標(biāo)簽

HTML標(biāo)簽都擁有以下3個(gè)設(shè)置樣式的屬性。

templateDir:執(zhí)行模板路徑

theme:指定主題名稱,可選值包括simple、xhtml、ajax等

template:指定模板名稱

使用HTML表單標(biāo)簽會(huì)生成大量格式化的HTML代碼,這些代碼是由struts2的模板生成的,這樣的好處是可以讓我們的jsp代碼十分簡(jiǎn)單,只需要配置使用不同的主題模板,就可以顯示不同的頁面樣式。

struts2默認(rèn)提供了5種主題(在此不做詳細(xì)介紹):

simple主題:最簡(jiǎn)單的主題

XHTML主題:默認(rèn)主題,使用常用的HTML技巧

CSS XHTML主題:使用CSS實(shí)現(xiàn)的XHTML主題

archive主題:使用文檔生成主題

AJAX主題:基于AJAX實(shí)現(xiàn)的主題

通過在struts.properties文件中改變struts.ui.theme,struts.ui.templateDir,struts.ui.templateSuffix三個(gè)標(biāo)簽來自由切實(shí)可行換主題

由于HTML表單標(biāo)簽也不少,所以還是要用的時(shí)候在網(wǎng)上找吧...

 四、HTML非表單標(biāo)簽

主要用來輸出各種錯(cuò)誤和消息。

1)錯(cuò)誤標(biāo)簽:用以輸出Action錯(cuò)誤信息

<s:actionerror />

2)消息標(biāo)簽:用以輸出Action普通消息

<s:atcionmessage />

3)字段錯(cuò)誤標(biāo)簽:用以輸出Action校驗(yàn)中某一個(gè)字段的錯(cuò)誤信息或所有字段的錯(cuò)誤信息

<s:fielderror />--輸出所有字段的錯(cuò)誤信息

<s:fielderror>

<s:param>username</s:param>--輸出字段username的錯(cuò)誤信息

<s:param>password</s:param>--輸出字段password的錯(cuò)誤信息

<s:fielderror>

4)DIV標(biāo)簽:用以輸出一個(gè)<div>標(biāo)簽

 

五、AJAX標(biāo)簽

AJAX標(biāo)簽是struts2專門提供的一組進(jìn)行AJAX操作的標(biāo)簽,在使用這些標(biāo)簽之前,需要在JSP頁面中添加如下引用:

<%@ taglib prefix="sx" uri="/struts-dojo-tags"%>

1)鏈接標(biāo)簽:用于創(chuàng)建一個(gè)<a>鏈接,并且在單擊該鏈接時(shí)執(zhí)行異步的請(qǐng)求,該標(biāo)簽的url屬性必須使用<s:url/>標(biāo)簽進(jìn)行設(shè)置,target屬性指向要被更新的頁面組件,showLoadingText屬性決定是否顯示文本,indicator表示異步請(qǐng)求時(shí)要顯示的圖片

使用form標(biāo)簽:

<s:div id="targetDiv">

<s:form action="LoginAction">

<sx:a targets="targetDiv" showLoadingText="false" indicator="loadingImage" />

</s:form>

</s:div>

使用url標(biāo)簽:

<s:div id="targetDiv">

<s:url id="ajaxTest" value="/LoginAction.action">

<sx:a targets="targetDiv" href="%{ajaxTest}" showLoadingText="false" indicator="loadingImage" />

</s:div>

2)自動(dòng)完成標(biāo)簽:是一個(gè)組合框組件,在文本框中輸入文本,能夠給出一個(gè)下拉的提示列表。list屬性用以指定一個(gè)自動(dòng)提示檢索的列表集合(可以是Action中的List類型的屬性),autoComplete屬性為true時(shí)表示進(jìn)行自動(dòng)提示

<sx:autocompleter name="test" list="{'上海','湖南',廣東}" autoCompleter="true" />

3)自動(dòng)事件綁定標(biāo)簽:該標(biāo)簽可以為多個(gè)對(duì)象的多個(gè)事件進(jìn)行監(jiān)聽,并能夠發(fā)送異步請(qǐng)求。src屬性指定監(jiān)聽的對(duì)象源,events屬性指定監(jiān)聽的事件類型(JavaScript事件),target屬性指定異步返回內(nèi)容填充的目標(biāo),indicator屬性表示執(zhí)行異步請(qǐng)求時(shí)顯示的圖片

<s:div id="targetDiv">

<s:form action="login">

<s:submit id="bin" />

<s:bind src="bin" events="onclick" targets="targetDiv" showLoadingText="false" indicator="%{getText('loadingImage')}" />

</s:form>

</s:div>

4)日期選擇標(biāo)簽:用以彈出一個(gè)日期和時(shí)間的選擇窗口,displayFormat屬性指定要選擇日期的格式,name表示當(dāng)前組件的屬性的對(duì)象,value表示默認(rèn)值,label表示顯示的文本

<sx:datetimepicker name="order.date" label="Order Date" displayFormat="yyyy-MM-dd" value="%{'2006-01-01'}" />

5)樹標(biāo)簽:用以輸出一個(gè)樹形結(jié)構(gòu)

<sx:tree>

6)Tab頁標(biāo)簽:使用AJAX的方式顯示多個(gè)Tab頁

<s:tabbedpanel>



無聲 2010-11-04 15:17 發(fā)表評(píng)論
]]>
java 回調(diào)http://www.aygfsteel.com/parable-myth/archive/2010/11/03/336907.html無聲無聲Wed, 03 Nov 2010 02:57:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/11/03/336907.htmlhttp://www.aygfsteel.com/parable-myth/comments/336907.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/11/03/336907.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336907.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336907.html

回調(diào)函數(shù)還真有點(diǎn)像您隨身帶的BP機(jī):告訴別人號(hào)碼,在它有事情時(shí)Call您
回調(diào)用于層間協(xié)作,上層將本層函數(shù)安裝在下層,這個(gè)函數(shù)就是回調(diào),而下層在一定條件下觸發(fā)回調(diào),例如作為一個(gè)驅(qū)動(dòng),是一個(gè)底層,他在收到一個(gè)數(shù)據(jù)時(shí),除了完成本層的處理工作外,還將進(jìn)行回調(diào),將這個(gè)數(shù)據(jù)交給上層應(yīng)用層來做進(jìn)一步處理,這在分層的數(shù)據(jù)通信中很普遍。
其 實(shí)回調(diào)和API非常接近,他們的共性都是跨層調(diào)用的函數(shù)。但區(qū)別是API是低層提供給高層的調(diào)用,一般這個(gè)函數(shù)對(duì)高層都是已知的;而回調(diào)正好相反,他是高 層提供給底層的調(diào)用,對(duì)于低層他是未知的,必須由高層進(jìn)行安裝,這個(gè)安裝函數(shù)其實(shí)就是一個(gè)低層提供的API,安裝后低層不知道這個(gè)回調(diào)的名字,但它通過一 個(gè)函數(shù)指針來保存這個(gè)回調(diào),在需要調(diào)用時(shí),只需引用這個(gè)函數(shù)指針和相關(guān)的參數(shù)指針。
其實(shí):回調(diào)就是該函數(shù)寫在高層,低層通過一個(gè)函數(shù)指針保存這個(gè)函數(shù),在某個(gè)事件的觸發(fā)下,低層通過該函數(shù)指針調(diào)用高層那個(gè)函數(shù)。

關(guān)于回調(diào)的總結(jié):
在Java中,通常就是編寫另外一個(gè)類或類庫的人規(guī)定一個(gè)接口,然后你來實(shí)現(xiàn)這個(gè)接口,然后把這個(gè)接口的一個(gè)對(duì)象作為參數(shù)傳給別人的程序,別人的程序必要時(shí)就會(huì)通過那個(gè)接口來調(diào)用你編寫的函數(shù)。

 

下面使用java回調(diào)函數(shù)來實(shí)現(xiàn)一個(gè)測(cè)試函數(shù)運(yùn)行時(shí)間的工具類:
如果我們要測(cè)試一個(gè)類的方法的執(zhí)行時(shí)間,通常我們會(huì)這樣做:
java 代碼
public class TestObject {   
    /**  
     * 一個(gè)用來被測(cè)試的方法,進(jìn)行了一個(gè)比較耗時(shí)的循環(huán)  
     */   
    public static void testMethod(){   
        for(int i=0; i<100000000; i++){   
               
        }   
    }   
    /**  
     * 一個(gè)簡(jiǎn)單的測(cè)試方法執(zhí)行時(shí)間的方法  
     */   
    public void testTime(){   
        long begin = System.currentTimeMillis();//測(cè)試起始時(shí)間   
        testMethod();//測(cè)試方法   
        long end = System.currentTimeMillis();//測(cè)試結(jié)束時(shí)間   
        System.out.println("[use time]:" + (end - begin));//打印使用時(shí)間   
    }   
       
    public static void main(String[] args) {   
        TestObject test=new TestObject();   
        test.testTime();   
    }   
}   

大家看到了testTime()方法,就只有"http://測(cè)試方法"是需要改變的,下面我們來做一個(gè)函數(shù)實(shí)現(xiàn)相同功能但更靈活:
首先定一個(gè)回調(diào)接口:
java 代碼
public interface CallBack {   
    //執(zhí)行回調(diào)操作的方法   
    void execute();   
}   

然后再寫一個(gè)工具類:
java 代碼
public class Tools {   
       
    /**  
     * 測(cè)試函數(shù)使用時(shí)間,通過定義CallBack接口的execute方法  
     * @param callBack  
     */   
    public void testTime(CallBack callBack) {   
        long begin = System.currentTimeMillis();//測(cè)試起始時(shí)間   
        callBack.execute();///進(jìn)行回調(diào)操作   
        long end = System.currentTimeMillis();//測(cè)試結(jié)束時(shí)間   
        System.out.println("[use time]:" + (end - begin));//打印使用時(shí)間   
    }   
       
    public static void main(String[] args) {   
        Tools tool = new Tools();   
        tool.testTime(new CallBack(){   
            //定義execute方法   
            public void execute(){   
                //這里可以加放一個(gè)或多個(gè)要測(cè)試運(yùn)行時(shí)間的方法   
                TestObject.testMethod();
            }   
        });   
    }   
       
}

 

通過上面的文字和代碼我們可以理解了什么叫做java的回調(diào)。那么我們具體在什么時(shí)候使用回調(diào)函數(shù)呢?

在進(jìn)行JDBC編程的時(shí)候,我們經(jīng)常要寫到try catch語句塊,而如果采用回調(diào)技術(shù),那么完全可以避免重復(fù)的去寫,將自己的方法體使用一個(gè)回調(diào)接口的方法來實(shí)現(xiàn),每次都傳到同一個(gè)try catch當(dāng)總,但是每一個(gè)方法的內(nèi)容是不相同的。

再比如算法比較多的情況下,也可以采用這種實(shí)現(xiàn)模式來實(shí)現(xiàn)。最近看了SWT,發(fā)現(xiàn)里面好多的事件驅(qū)動(dòng)都是采用回調(diào)來實(shí)現(xiàn)的。比如給按鈕添加事件:

                            Button okButton = createButton(buttons, "&Ok", "Process input",
                                       new MySelectionAdapter(){
                                           public void widgetSelected(SelectionEvent e) 
                                           {
                                               System.out.println("Name:         " + nameField.getText());
                                               System.out.println("Address:      " + addrField.getText());
                                               System.out.println("Phone number: " + phoneField.getText());
                                           }
                                       });

匿名內(nèi)部類最常用的情況就是在回調(diào)當(dāng)中的精彩表現(xiàn)。

 

回調(diào)是一種雙向調(diào)用模式,也就是說,被調(diào)用方在接口被調(diào)用時(shí)也會(huì)調(diào)用對(duì)方的接口.



無聲 2010-11-03 10:57 發(fā)表評(píng)論
]]>
jbpm4.4安裝(tomcat-mysql)http://www.aygfsteel.com/parable-myth/archive/2010/10/29/336444.html無聲無聲Fri, 29 Oct 2010 02:03:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/29/336444.htmlhttp://www.aygfsteel.com/parable-myth/comments/336444.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/29/336444.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336444.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336444.html 1.JBPM4.4下載(http://sourceforge.net/projects/jbpm)
2.ant安裝:jBPM下載包install目錄中有一個(gè)ant的build.xml文件,使用ant -p你可以看到所有的安裝
3. 安裝數(shù)據(jù)庫
 
   1)MySQL中創(chuàng)建一個(gè)庫,庫名:jbpmdb
    2)修改install"build.xml
    <!-- DEFAULT PROPERTY VALUES -->
      <property name="database" value="hsqldb" />,value值更改為value="mysql"
    3)修改"install"jdbc"mysql.properties中的數(shù)據(jù)庫配置(有時(shí)候安裝別的數(shù)據(jù)庫時(shí)缺少相應(yīng)的jar包,需要將相應(yīng)的jar包c(diǎn)opy到j(luò)bpm-4.4"lib目錄下
    4)ant create.jbpm.schema
4.安裝服務(wù)器
   1)ant install.tomcat
   2)ant install.jbpm.into.tomcat:把jBPM安裝到tomcat中,這時(shí)候在jbpm-4.4目錄下生成apache-tomcat-6.0.26
   3)ant load.example.identities:讀取實(shí)例用戶和用戶組數(shù)據(jù)到mysql數(shù)據(jù)庫.生成用戶名與密碼:
      用戶名    密碼
     alex     password
     mike    password
     peter   password
     mary   password
   4) 啟動(dòng)tomcat
    Signavio web(web版流程設(shè)計(jì)器)地址http://localhost:8080/jbpmeditor/p/explorer(注意在IE7不行,firefox3可以)
    jBPM控制臺(tái)地址http://localhost:8080/jbpm-console


無聲 2010-10-29 10:03 發(fā)表評(píng)論
]]>
jbpm_springhttp://www.aygfsteel.com/parable-myth/archive/2010/10/29/336443.html無聲無聲Fri, 29 Oct 2010 02:00:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/29/336443.htmlhttp://www.aygfsteel.com/parable-myth/comments/336443.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/29/336443.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336443.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336443.html

無聲 2010-10-29 10:00 發(fā)表評(píng)論
]]>
Form action defaulting to 'action' attribute's literal valuehttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336387.html無聲無聲Thu, 28 Oct 2010 07:50:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336387.htmlhttp://www.aygfsteel.com/parable-myth/comments/336387.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336387.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336387.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336387.html警告信息內(nèi)容如下:

警告: No configuration found for the specified action: 'ShowMessage' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
2008-9-6 11:35:47 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
警告: No configuration found for the specified action: 'ShowMessage' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

showmsg.jsp代碼如下

<%@ taglib prefix="s" uri="/struts-tags" %>
......
<div>
hello world
<s:form name="ShowMessage" method="post" action="/hello/ShowMessage.action" >
<s:textfield label="user name" name="username"></s:textfield>
<s:submit></s:submit>
</s:form>
</div>
......

struts.xml配置如下:
......
<struts>
 <package name="hello" extends="struts-default" namespace="/hello">
 <action name="ShowMessage" class="com.historycreator.strutstest.ShowMessage">
 <result>/digg/showmsg.jsp</result>
 </action>
 </package>
</struts>

打開showmsg.jsp頁面時(shí),就出現(xiàn)上述異常。嘗試了各種配置和訪問方法,均出現(xiàn)警告。搜索網(wǎng)絡(luò)給出的答案幾乎都說把<s:form name="ShowMessage" method="post" action="/hello/ShowMessage.action" >中的.action去掉就可以解決了,做了測(cè)試,問題仍然沒有解決。更有人讓把<s:去掉,不用tag,直接寫<form>這個(gè)當(dāng)然不會(huì)有問題,但是一會(huì)用標(biāo)記,一會(huì)不用,很雜亂,并且不是解決問題的根本之道。

解決方法:
經(jīng)過測(cè)試發(fā)現(xiàn),是沒有正確使用tag的原因,這種情況下,正確的寫法應(yīng)該是,<s:form name="ShowMessage" method="post" action="ShowMessage" namespace="/hello" >

原因分析:

因?yàn)殚_始使用的struts2標(biāo)簽(form)并未指定namespace屬性。所以struts2會(huì)默認(rèn)從根命名空間"/" 搜索action '/hello/ShowMessage.action',如搜索不到則進(jìn)入默認(rèn)命名空間''搜索action串,在默認(rèn)命名空間中是肯定找不到自己定義的action的,所以,struts2拋出一個(gè)警告信息。

現(xiàn)在我們指定了namespace為/hello,則struts2會(huì)直接在/hello命名空間尋找。可以想象,如果在這么命名空間里找不到請(qǐng)求的action,也會(huì)拋出一條類似的信息。

注意,<s:form name="ShowMessage" method="post" action="ShowMessage" namespace="/hello" >
不能寫成<s:form name="ShowMessage" method="post" action="ShowMessage.action" namespace="/hello" >

這樣仍然有對(duì)應(yīng)的警告信息,并且提交后出現(xiàn)無法訪問的結(jié)果。因?yàn)闆]有ShowMessage.action這樣一個(gè)action,這個(gè).action不能由我們手工添加,Struts2會(huì)自動(dòng)為你完成這個(gè)工作,并且手工添加是不行的,就不必多此一舉了。但是在其他的場(chǎng)合,比如使用超級(jí)鏈結(jié),則可以加上這個(gè).action。

轉(zhuǎn)載請(qǐng)注明 historycreator.com



無聲 2010-10-28 15:50 發(fā)表評(píng)論
]]>
struts2.2.1做例子的時(shí)候發(fā)現(xiàn)的問題,在此記錄http://www.aygfsteel.com/parable-myth/archive/2010/10/28/336368.html無聲無聲Thu, 28 Oct 2010 04:43:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336368.htmlhttp://www.aygfsteel.com/parable-myth/comments/336368.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336368.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336368.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336368.html <?xml version="1.0" encoding="UTF-8"?> 原例子中沒有這段,但我建xml文件的時(shí)候會(huì)有這段,運(yùn)行時(shí)驗(yàn)證不好用,當(dāng)把這段去掉后
程序可以正常驗(yàn)證,我再加上后也可以正常驗(yàn)證,不知道什么緣故。
<!DOCTYPE validators PUBLIC
        "-//OpenSymphony Group//XWork Validator 1.0.2//EN"
        "http://www.opensymphony.com/xwork/xwork-validator-1.0.2.dtd">

<validators>
    <field name="username">
        <field-validator type="requiredstring">
            <message key="requiredstring"/>
        </field-validator>
    </field>
    <field name="password">
        <field-validator type="requiredstring">
            <message key="requiredstring"/>
        </field-validator>
    </field>
</validators>




無聲 2010-10-28 12:43 發(fā)表評(píng)論
]]>
OGNL表達(dá)式struts2標(biāo)簽“%,#,$”http://www.aygfsteel.com/parable-myth/archive/2010/10/28/336353.html無聲無聲Thu, 28 Oct 2010 02:25:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336353.htmlhttp://www.aygfsteel.com/parable-myth/comments/336353.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/28/336353.html#Feedback3http://www.aygfsteel.com/parable-myth/comments/commentRss/336353.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336353.html
  • 一、什么是OGNL,有什么特點(diǎn)?   
  •   
  • OGNL(Object-Graph Navigation Language),大概可以理解為:對(duì)象圖形化導(dǎo)航語言。是一種可以方便地操作對(duì)象屬性的開源表達(dá)式語言。OGNL有如下特點(diǎn):    
  •   
  • 1、支持對(duì)象方法調(diào)用,形式如:objName.methodName();   
  •   
  • 2、支持類靜態(tài)的方法調(diào)用和值訪問,表達(dá)式的格式為@[類全名(包括包路)]@[方法名  值名],例如:   
  •   
  • @java.lang.String@format('foo %s''bar')或@tutorial.MyConstant@APP_NAME;   
  •   
  • 3、支持賦值操作和表達(dá)式串聯(lián),例如:   
  •   
  • price=100discount=0.8calculatePrice(),這個(gè)表達(dá)式會(huì)返回80;   
  •   
  • 4、訪問OGNL上下文(OGNL context)和ActionContext;   
  •   
  • 5、操作集合對(duì)象。   
  •   
  •     
  •   
  • 二、使用OGNL表達(dá)式   
  •   
  • OGNL要結(jié)合struts標(biāo)簽來使用。由于比較靈活,也容易把人給弄暈,尤其是“%”、“#”、“$”這三個(gè)符號(hào)的使用。由于$廣泛應(yīng)用于EL中,這里重點(diǎn)寫%和#符號(hào)的用法。   
  •   
  • 1、“#”符號(hào)有三種用途:   
  •   
  • (1)、訪問非根對(duì)象(struts中值棧為根對(duì)象)如OGNL上下文和Action上下文,#相當(dāng)于ActionContext.getContext();下表有幾個(gè)ActionContext中有用的屬性:   
  •   
  •     
  •   
  • 名稱   
  •  作用   
  •  例子   
  •     
  • parameters   
  •  包含當(dāng)前HTTP請(qǐng)求參數(shù)的Map   
  •  #parameters.id[0]作用相當(dāng)于request.getParameter("id"   
  •     
  • request   
  •  包含當(dāng)前HttpServletRequest的屬性(attribute)的Map   
  •  #request.userName相當(dāng)于request.getAttribute("userName"   
  •     
  • session   
  •  包含當(dāng)前HttpSession的屬性(attribute)的Map   
  •  #session.userName相當(dāng)于session.getAttribute("userName"   
  •     
  • application   
  •  包含當(dāng)前應(yīng)用的ServletContext的屬性(attribute)的Map   
  •  #application.userName相當(dāng)于application.getAttribute("userName"   
  •     
  •   
  • 注:attr 用于按request session application順序訪問其屬性(attribute),#attr.userName相當(dāng)于按順序在以上三個(gè)范圍(scope)內(nèi)讀取userName屬性,直到找到為止。用于過濾和投影(projecting)集合,如books.{?#this.price<100};構(gòu)造Map,如#{'foo1':'bar1''foo2':'bar2'}。   
  •   
  •     
  •   
  • (2)、用于過濾和投影(projecting)集合,如: books.{?#this.price>35    
  •   
  • books.{?#this.price>35}   
  •   
  • (3)、構(gòu)造Map,如: #{'foo1':'bar1''foo2':'bar2'    
  •   
  • #{'foo1':'bar1''foo2':'bar2'}這種方式常用在給radio或select、checkbox等標(biāo)簽賦值上。如果要在頁面中取一個(gè)map的值可以這樣寫:    
  •   
  • <s:property value="#myMap['foo1']"/>     
  •   
  • <s:property value="#myMap['foo1']"/>   
  •   
  • 2、“%”符號(hào)的用途是在標(biāo)簽的屬性值被理解為字符串類型時(shí),告訴執(zhí)行環(huán)境%{}里的是OGNL表達(dá)式。   
  •   
  • 這是一開始最讓我不能理解的符號(hào),原因是一些相關(guān)資源在表述時(shí)不太準(zhǔn)備,經(jīng)過一翻痛苦的探索,終于明白了它的用途。實(shí)際上就是讓被理解為字符串的表達(dá)式,被真正當(dāng)成ognl來執(zhí)行。很有點(diǎn)類似javascript里面的eval_r()功能,例如 :   
  •   
  • var oDiv eval_r("document.all.div"+index)     
  •   
  • var oDiv eval_r("document.all.div"+index)   
  •   
  • 當(dāng)index變量為1時(shí),語句就會(huì)被當(dāng)作var oDiv document.all.div1  var oDiv document.all.div1來執(zhí)行。%{}就是起這個(gè)作用。舉例:    
  •   
  • <s:set name="myMap" value="#{'key1':'value1','key2':'value2'}"/>      
  •   
  • <s:property value="#myMap['key1']"/>      
  •   
  • <s:url value="#myMap['key1']" />    
  •   
  • <s:set name="myMap" value="#{'key1':'value1','key2':'value2'}"/>   
  •   
  • <s:property value="#myMap['key1']"/>   
  •   
  • <s:url value="#myMap['key1']"/>   
  •   
  • 上面的代碼第2行會(huì)在頁面上輸出“value1”,而第3行則會(huì)輸出"#myMap['key1']"這么一個(gè)字符串。 如果將第3行改寫成這樣:    
  •   
  • <s:url value="%{#myMap['key1']}"/>     
  •   
  • <s:url value="%{#myMap['key1']}"/>   
  •   
  • 則輸出為“value1”。   
  •   
  •     
  •   
  •     
  •   
  • 這說明struts2里不同的標(biāo)簽對(duì)ognl的表達(dá)式的理解是不一樣的。如果當(dāng)有的標(biāo)簽“看不懂”類似“#myMap['key1']”的語句時(shí),就要用%{}來把這括進(jìn)去,“翻譯”一下了。   
  •   
  • 3、“$”有兩種用途   
  •   
  • (1)、在國際化資源文件中,引用OGNL表達(dá)式。   
  •   
  • (2)、在Struts 2配置文件中,引用OGNL表達(dá)式:    
  •   
  • <action name="saveUser" class="userAction" method="save">   
  •   
  • <result type="redirect">listUser.action?msg=${msg}</result>   
  •   
  • </action>   
  •   
  • <action name="saveUser" class="userAction" method="save"      
  •   
  • <result type="redirect">listUser.action?msg=${msg}</result>   
  •   
  • </action> 


  • 無聲 2010-10-28 10:25 發(fā)表評(píng)論
    ]]>
    eclipse修改啟動(dòng)參數(shù)http://www.aygfsteel.com/parable-myth/archive/2010/10/27/336315.html無聲無聲Wed, 27 Oct 2010 12:04:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/10/27/336315.htmlhttp://www.aygfsteel.com/parable-myth/comments/336315.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/10/27/336315.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/336315.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/336315.html -Dfile.encoding=UTF-8
    -Duser.name=ly


    無聲 2010-10-27 20:04 發(fā)表評(píng)論
    ]]>
    Delphi開發(fā)時(shí)經(jīng)常會(huì)用到窗體全屏,現(xiàn)找到了解決辦法記錄一下http://www.aygfsteel.com/parable-myth/archive/2010/09/15/332031.html無聲無聲Wed, 15 Sep 2010 01:20:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/09/15/332031.htmlhttp://www.aygfsteel.com/parable-myth/comments/332031.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/09/15/332031.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/332031.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/332031.html begin
      Frm_Main.Left := 0;
      Frm_Main.Top := 0;
      Frm_Main.windowstate := wsmaximized;
      SetWindowLong(Frm_Main.Handle, GWL_STYLE,
        GetWindowLong(Frm_Main.Handle, GWL_STYLE) and not WS_CAPTION);
                  //FForm.windowstate:=wsmaximized;
      Frm_Main.clientHeight := screen.Height;
      Frm_Main.Refresh;
    end;

    參考 http://www.cnblogs.com/uws2056/archive/2010/06/23/1763988.html



    無聲 2010-09-15 09:20 發(fā)表評(píng)論
    ]]>
    C# 獲取數(shù)據(jù)庫表信息與列信息的方法 GridView inserthttp://www.aygfsteel.com/parable-myth/archive/2010/09/07/331320.html無聲無聲Tue, 07 Sep 2010 08:12:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/09/07/331320.htmlhttp://www.aygfsteel.com/parable-myth/comments/331320.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/09/07/331320.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/331320.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/331320.html

    無聲 2010-09-07 16:12 發(fā)表評(píng)論
    ]]>
    在Delphi中開發(fā)使用多顯示器的應(yīng)用程序http://www.aygfsteel.com/parable-myth/archive/2010/08/06/328116.html無聲無聲Fri, 06 Aug 2010 04:23:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/08/06/328116.htmlhttp://www.aygfsteel.com/parable-myth/comments/328116.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/08/06/328116.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/328116.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/328116.html

    無聲 2010-08-06 12:23 發(fā)表評(píng)論
    ]]>
    Delphi多顯示器編程http://www.aygfsteel.com/parable-myth/archive/2010/08/06/328102.html無聲無聲Fri, 06 Aug 2010 02:23:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/08/06/328102.htmlhttp://www.aygfsteel.com/parable-myth/comments/328102.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/08/06/328102.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/328102.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/328102.html 這兩者的區(qū)別在于TScreen代表的是一個(gè)虛擬的桌面,它可以擁有N個(gè)Monitor
    ,也就是物理的顯示器.

    這是大富翁上抄下來的代碼 :-)

    //將一個(gè)窗體顯示到指定的顯示器上
    procedure SetWindowToMonitor(Form: TCustomForm; //你想操作的窗體
                                 MonitorIndex,      //你想要顯示窗體的顯示
                                                    //  器索引, 0為主顯示
                                                    //  器,1為第二顯示器
                                 Left, Top: Integer //窗體在顯示器上的位置
                                );
    begin  
      if not Assigned(Form) then Exit;
      if MonitorIndex >= Screen.MonitorCount then Exit;
      with Screen do
      begin
        Inc(Left, Monitors[MonitorIndex].Left);
        Inc(Top, Monitors[MonitorIndex].Top);
      end;
      Form.SetBounds(Left, Top, Form.Width, Form.Height);
    end;

    無聲 2010-08-06 10:23 發(fā)表評(píng)論
    ]]>
    使用Eclipse的Axis1.4插件開發(fā)Web Service及客戶端http://www.aygfsteel.com/parable-myth/archive/2010/08/03/327802.html無聲無聲Tue, 03 Aug 2010 03:09:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/08/03/327802.htmlhttp://www.aygfsteel.com/parable-myth/comments/327802.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/08/03/327802.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/327802.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/327802.html 所使用的Eclipse版本Eclipse JEE 3.3,JDK版本1.5,Tomcat6.0。在這個(gè)Eclipse版本里已集成了Axis1.4的插件,無需安裝任何插件就可以開發(fā)Web Service應(yīng)用程序了,利用圖形化的向?qū)Э梢蚤_發(fā)Web Service服務(wù)端和客戶端程序。
        建立一個(gè)項(xiàng)目AxisServerDemo,寫一個(gè)簡(jiǎn)單的類:
    package demo.axis;

    public class User
    {
        public String sayHello(String userName)
        {
            return "hello " + userName;
        }
    }
        下面用Axis向?qū)О堰@個(gè)bean發(fā)布為Web Service:
        1、選擇File|New|Other,選擇新建Web Service。
    圖1  選擇新建Web Service
        2、在第一步的界面上點(diǎn)擊“next”,出現(xiàn)一個(gè)界面:
    圖2  指定對(duì)哪個(gè)類生成Web Service
        點(diǎn)擊“Web service Apache Axis”,出現(xiàn)以下界面:
    圖3  選擇Axis版本
        此處選擇Apache Axis。
        對(duì)圖2界面上選擇要生成的類,點(diǎn)擊“next”。
        3、選擇要生成Web Service的方法,如下圖:
    圖4  選擇要生成Web Service的方法
        4、在如下界面,啟動(dòng)應(yīng)用服務(wù)器。
    圖5  啟動(dòng)應(yīng)用服務(wù)器
        在應(yīng)用服務(wù)器啟動(dòng)后,點(diǎn)擊“next”。
        5、在Web Service發(fā)布界面上,因?yàn)閮H僅是一個(gè)測(cè)試,不選擇發(fā)布,點(diǎn)擊“finish”。
    圖6  選擇發(fā)布Web Service
        按步驟完成以后,會(huì)在項(xiàng)目中生成一些文件,web.xml也已被修改,在lib中會(huì)多出來幾個(gè).jar文件,最后目錄結(jié)構(gòu)如下:
    圖7  生成Web Service后的目錄結(jié)構(gòu)
        把項(xiàng)目部署到tomcat中,啟動(dòng)后在瀏覽器中輸入“http://localhost:8080/AxisServerDemo/services /User?wsdl”,能夠看到xml格式wsdl就說明成功了。
        剛才完成的Web Service發(fā)布了一個(gè)簡(jiǎn)單的功能,如何利用它呢,利用這個(gè)功能的就是Web Service 客戶端。下面利用Axis1.4插件自動(dòng)生成訪問Web Service的代碼。
        新建一個(gè)項(xiàng)目AxisClientDemo,用以下步驟生成Web Service客戶端代碼:
        1、選擇File|New|Other,選擇新建Web Service Client。
    圖8  選擇新建Web Service Client
        2、在接下來的界面中,輸入Web Service所在的URL,此處是“http://localhost:8080/AxisServerDemo/services /User?wsdl”。
    圖9  輸入Web Service的wsdl所在的路徑
        3、選擇生成代碼所在的路徑。
    圖10  選擇生成代碼所在的路徑
        4、點(diǎn)擊“Finish”,就會(huì)生成幾個(gè)java文件,lib目錄下面會(huì)多出幾個(gè).jar文件。生成之后的代碼結(jié)構(gòu)如下:
    圖11  生成Web Service客戶端代碼后的目錄結(jié)構(gòu)
        為了測(cè)試Web Service客戶端代碼是否工作正常,在建立一個(gè)jsp文件:
    <%@ page language="java" contentType="text/html; charset=UTF-8"
        pageEncoding="UTF-8"%>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <%@page import="demo.axis.User"%>
    <%@page import="demo.axis.UserProxy"%>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Insert title here</title>
    </head>
    <body>
    <form method="POST">
    <input type="text" name="username"/>
    <br/>
    <input type="submit" value="ok"/>
    </form>
    <%
    String userName = request.getParameter("username");
    if (userName != null && !"".equals(userName))
    {
        User user = new UserProxy();
        out.print(user.sayHello(userName));
    }
    %>
    </body>
    </html>
        啟動(dòng)tomcat,在瀏覽器中運(yùn)行上面的jsp文件,就可以看到效果了。


    無聲 2010-08-03 11:09 發(fā)表評(píng)論
    ]]>
    簡(jiǎn)述MPEG動(dòng)態(tài)圖象壓縮編碼的運(yùn)動(dòng)補(bǔ)償技術(shù)http://www.aygfsteel.com/parable-myth/archive/2010/07/30/327533.html無聲無聲Fri, 30 Jul 2010 02:16:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/07/30/327533.htmlhttp://www.aygfsteel.com/parable-myth/comments/327533.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/07/30/327533.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/327533.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/327533.html
    1 MPEG:



    MPEG是Motion Picture Experts Group 的縮寫,它是視頻編碼格式中的一個(gè)大家族,也是我們平時(shí)所見到的最普遍的一種視頻格式。從它衍生出來的格式非常多,包括以mpg、mpe、mpa、m15、m1v、mp2等等為后綴名的視頻文件都是出自這一家族。MPEG格式包括MPEG視頻、MPEG音頻和MPEG系統(tǒng)(視頻、音頻同步)三個(gè)部分,MP3(MPEG-3)音頻文件就是MPEG音頻的一個(gè)典型應(yīng)用,視頻方面則包括MPEG-1、MPEG-2和MPEG4。



    MPEG-1壓縮算法被廣泛應(yīng)用在 VCD 的制作和一些視頻片段下載方面,其中最多的就是VCD——幾乎所有VCD都是使用Mpeg-1格式壓縮的(*.dat格式的文件)。MPEG-1的壓縮算法可以把一部 120 分鐘長(zhǎng)的電影(原始視頻文件)壓縮到1.2 GB左右大小。利用這種壓縮算法制成的文件格式一般為mpg和dat文件。



    MPEG-2壓縮算法則應(yīng)用在DVD的制作上(*.vob格式的文件),同時(shí)也在一些HDTV(高清晰電視廣播)和一些高要求視頻編輯、處理有相當(dāng)?shù)膽?yīng)用。使用MPEG-2的壓縮算法制作一部 120 分鐘長(zhǎng)的電影(原始視頻文件)在4GB到8GB大小左右,當(dāng)然其圖像質(zhì)量方面的指標(biāo)是MPEG-1所無法比擬的。利用這種壓縮算法制成的文件格式一般為vob文件。



    MPEG-4是一種新的壓縮算法,使用這種壓縮算法可以將一部120分鐘長(zhǎng)的電影(原始視頻文件)壓縮至300MB左右?,F(xiàn)在,MPEG的這種壓縮算法被許多編碼格式沿用,例如ASF、DivX、Xvid、mp4(Apple公司的mpeg-4編碼格式)等等都采用了MPEG-4的壓縮算法。







    2 AVI編碼格式



    AVI是 Audio Video Interleave 的縮寫,這種格式在微軟WIN3.1 時(shí)代就已經(jīng)出現(xiàn)了。它最直接的優(yōu)點(diǎn)就是兼容好、調(diào)用方便而且圖像質(zhì)量好,因此也常常與DVD相并稱。但它的缺點(diǎn)也是十分明顯的:體積大。2小時(shí)影像的AVI文件的體積與MPEG-2相差無計(jì),不過這只是針對(duì)標(biāo)準(zhǔn)分辨率而言的:根據(jù)不同的應(yīng)用要求,AVI的分辨率可以隨意調(diào)。窗口越大,文件的數(shù)據(jù)量也就越大。降低分辨率可以大幅減低它的體積,但圖像質(zhì)量就必然受損。與MPEG-2格式文件體積差不多的情況下,AVI格式的視頻質(zhì)量相對(duì)而言要差不少,但制作起來對(duì)電腦的配置要求不高,經(jīng)常有人先錄制好了AVI格式的視頻,再轉(zhuǎn)換為其他格式。



    這里簡(jiǎn)單提一下nAVI。nAVI是newAVI的縮寫,這是一個(gè)名為 ShadowRealm 的地下組織發(fā)展起來的一種新視頻格式。它是由 Microsoft ASF壓縮算法的修改而來的(并不是想象中的AVI,視頻格式追求的無非是壓縮率和圖像質(zhì)量,所以 n AVI為了追求這個(gè)目標(biāo),改善了原始的ASF格式的一些不足,讓nAVI可以擁有更高的幀率(frame rate)。當(dāng)然,這是犧牲ASF的視頻流特性作為代價(jià)的。概括來說,nAVI就是一種去掉視頻流特性的改良型ASF格式。







    3 REAL VIDEO格式



    Real公司一開始定位的就是在視頻流應(yīng)用方面的,也可以說是視頻流技術(shù)的始創(chuàng)者。它可以在用 56K MODEM 撥號(hào)上網(wǎng)的條件實(shí)現(xiàn)不間斷的視頻播放,當(dāng)然,其圖像質(zhì)量和 MPEG2、DIVX 等相比確實(shí)要差好多。RM主要用于在低速率的網(wǎng)上實(shí)時(shí)傳輸視頻的壓縮格式,它同樣具有小體積而又比較清晰的特點(diǎn)。RM文件的大小完全取決于制作時(shí)選擇的壓縮率。在2002年Real公司又推出了它的Real Video9編碼方式,使用該技術(shù)同上一版相比,畫質(zhì)提高了30%。使用Real Video9編碼格式的文件名后綴一般為rmvb,RMVB中的VB是VBR即Variable Bit Rate的縮寫,中文是“可變比特率”。它比普通的RM文件有更高的壓縮比(同樣畫質(zhì))和更好的畫質(zhì)(同樣壓縮比)。rmvb文件一般用realone播放器播放,當(dāng)然也可以用安裝了相應(yīng)插件的realplay播放(不過播放的時(shí)候要將rmvb改成rm)。以前的real video文件名后綴多為RM、RA、RAM。







    4 ASF



    ASF是 Advanced Streaming format 的縮寫,它是Windows Media技術(shù)的核心,采用的是MPEG-4壓縮算法,由于它使用了 MPEG-4 的壓縮算法,所以壓縮率和圖像的質(zhì)量都很不錯(cuò)。因?yàn)?ASF 是以一個(gè)可以在網(wǎng)上即時(shí)觀賞的視頻“流”格式存在的,所以它的圖像質(zhì)量比 VCD 差一點(diǎn)點(diǎn)并不出奇,但比同是視頻流格式的 RAM 格式要好。利用這種編碼方式制成的文件名后綴一般為asf。







    5 Quicktime格式



    QuickTime(MOV)是Apple公司專有的一種視頻格式。在開始一段時(shí)間里,他都是以qt或mov為擴(kuò)展名的,使用他們自己的編碼格式。但是自從MPEG4組織選擇了Quicktime作為MPEG4的推薦文件格式以后,它們的mov文件就以mpg或mp4為其擴(kuò)展名,并且采用了MPEG4壓縮算法。Quicktime6將mp4文件作為它的第一選擇,利用quicktime6可以制作出專業(yè)級(jí)質(zhì)量的、ISO兼容的MPEG4音頻和視頻文件,而且這些文件也可以被任何兼容MPEG4的播放器播放。







    6 DivX



    DivX視頻編碼技術(shù)可以說是針對(duì)DVD而產(chǎn)生的,同時(shí)它也是為了打破 ASF 的種種約束而發(fā)展起來的。正如上面所提到的那樣,它采用的是MPEG-4算法,這樣以來,壓縮一部DVD只需要2張VCD,而且播放這種編碼,對(duì)機(jī)器的要求也不高。目前DivX有兩個(gè)版本,第一個(gè)DivX版本以DivX3.11為例,而第二個(gè)版本就是后來的DivX5,但是實(shí)際上第二個(gè)編碼格式的作者跟divx3.11的作者根本不是同一個(gè)人,這兩種編碼格式的設(shè)計(jì)思路也不同。所以,如果要解壓縮按照DivX3.11編碼的媒體文件時(shí),最好采用DivX3.11的解碼器,而不要用DivX5的解碼器來解碼。目前大部分的DivX視頻采用的是.avi的文件后綴,當(dāng)然也有以DivX和Div為后綴名的。







    7 Xvid格式



    Xvid編碼格式是由一些精通視頻編碼的程序員(包括原DivX 3.11的開發(fā)者)設(shè)計(jì)開發(fā)出來的,它也是使用的MPEG4壓縮算法。XviD這種全新的編碼平臺(tái),實(shí)際上與DivX 5是屬于同一技術(shù)核心,可解碼幾乎所有的DVDrip。這里需要解釋一下DVDrip,DVDrip就是指的經(jīng)過DivX技術(shù)壓縮至原來DVD文件大小的1/10左右的媒體文件,其核心的技術(shù)主要分成三部分:用Mpeg4來進(jìn)行視頻壓縮,用MP3或AC-3等壓縮音頻,同時(shí)結(jié)合字幕播放軟件來外掛字幕。所以一般來說,你只要安裝了Xvid解碼器,你的機(jī)器就能播放所有的DivX媒體文件。目前用Xvid技術(shù)編碼的文件大多以avi為擴(kuò)展名。







    8 MPEG-4標(biāo)準(zhǔn)(ISO,1999)



    MPEG-4初衷是針對(duì)視頻會(huì)議、可視電話的超低比特率編碼的。但隨著芯片性價(jià)比的提高使得基于軟件平臺(tái)的壓縮編碼具有實(shí)用的可能,且人們?cè)趯?duì)視頻信息的應(yīng)用需求從播放型逐漸轉(zhuǎn)到基于內(nèi)容的訪問和操作型,所以它制定的新目標(biāo)為支持多媒體應(yīng)用(側(cè)重于對(duì)多媒體信息內(nèi)容的訪問),可根據(jù)應(yīng)用要求配置解碼器。



    MPEG-4為了支持高效壓縮、基于內(nèi)容交互和基于內(nèi)容分級(jí)擴(kuò)展,引入了AVO(Audio/Video Object)的概念實(shí)現(xiàn)基于內(nèi)容的表示方法。換句話說它就是圍繞AV對(duì)象的編碼、存儲(chǔ)、傳輸和組合而制定的,它是第一個(gè)使用戶在接收端對(duì)畫面進(jìn)行操作和交互訪問的編碼標(biāo)準(zhǔn)。



    MPEG-4提供自然和合成的音頻、視頻以及圖形的基于對(duì)象的編碼工具,它為多媒體數(shù)據(jù)壓縮提供了一個(gè)更為廣闊的平臺(tái),更注重于定義一種格式和框架,而不是具體的算法,這樣可以建立一個(gè)更自由的通信和研發(fā)環(huán)境,可以在系統(tǒng)中加入許多新的算法,為使用計(jì)算機(jī)軟件實(shí)現(xiàn)編碼和解碼提供更大的方便。它還可以將各種各樣的多媒體技術(shù)充分運(yùn)用在編碼中,除包括壓縮本身的一些工具、算法外,還包括圖像分析和合成、計(jì)算機(jī)視覺、計(jì)算機(jī)圖形學(xué)、虛擬現(xiàn)實(shí)和語音合成技術(shù)。但是由于“基于對(duì)象的編碼”尚有技術(shù)障礙,在技術(shù)專利保護(hù)問題上遲遲難以找到有效的收費(fèi)形式,因此該標(biāo)準(zhǔn)目前仍然沒有得到普遍應(yīng)用。


    無聲 2010-07-30 10:16 發(fā)表評(píng)論
    ]]>
    在 Delphi7.0下安裝DSPackhttp://www.aygfsteel.com/parable-myth/archive/2010/07/27/327183.html無聲無聲Tue, 27 Jul 2010 00:57:00 GMThttp://www.aygfsteel.com/parable-myth/archive/2010/07/27/327183.htmlhttp://www.aygfsteel.com/parable-myth/comments/327183.htmlhttp://www.aygfsteel.com/parable-myth/archive/2010/07/27/327183.html#Feedback0http://www.aygfsteel.com/parable-myth/comments/commentRss/327183.htmlhttp://www.aygfsteel.com/parable-myth/services/trackbacks/327183.html一、廢話幾句

    從去年年底起,有幸也轉(zhuǎn)到了DirectShow方面開發(fā)。
    在論壇中也可以為一些初學(xué)者解答一些初級(jí)問題了

    見論壇中有人分不清DirectShow為何物,在這,說明一下:
    DirectShow是DirectX中的一員。
    Dspack是 Delphi用于做DirectShow開發(fā)的一套(免費(fèi))控件。下載地址:http://www.progdigy.com/

    如果是Win2k, 安裝之前,必須先安裝DirectX9.0(DSPack2.3.4默認(rèn)支持DirectX9.0)。

    二、 在Delphi7.0下安裝DSPack

    (又是廢話,原本在DSPack控件中說明的很清楚了,就在這略翻譯一下吧)

    Delphi 5,6 & 7

    1 - Add this paths to your search directory:
           - (DSPackDir)\src\Directx9
           - (DSPackDir)\src\DSPack
    譯:添加查 詢路徑,否則在編譯時(shí)發(fā)生找不到相關(guān).dcu文件錯(cuò)誤。操作:Delphi(菜單) Tools->Envioronment Options->Library. 在Library Path處添加。

    2 - Compile DirectX 9 Package (DirectX9_Dx.dpk) from the "packages" directtory.
    譯:編譯DirectX9_Dx.dpr(x為Delphi版本號(hào)),這個(gè)包只要編譯就可以了。

    3 - Compile DSPack Package (DSPack_Dx.dpk) from the "packages" directory.
    譯:編譯DSPack_Dx.dpr(x為Delphi版本號(hào)),這個(gè)包只要編譯就可以了。

    4- Install Design Package (DSPackDesign_Dx.dpk) from the "packages" directory.
    譯:編譯并安裝DSPackDesign_Dx.dpk(x為Delphi版本號(hào))。

    到這里,安裝已完成。在Delphi控件面板上就可以看到DSPack控件了

    無聲 2010-07-27 08:57 發(fā)表評(píng)論
    ]]>
    主站蜘蛛池模板: 临猗县| 海安县| 浦城县| 策勒县| 衡山县| 汉源县| 桃江县| 墨竹工卡县| 罗江县| 澎湖县| 扎兰屯市| 亳州市| 广德县| 曲阜市| 焦作市| 凤阳县| 来安县| 兴业县| 赤水市| 色达县| 吴川市| 招远市| 来安县| 高台县| 镇雄县| 东兰县| 霍州市| 龙陵县| 蒙城县| 会理县| 邮箱| 北海市| 长治市| 双峰县| 巴青县| 革吉县| 宝坻区| 吉林省| 永兴县| 宝鸡市| 安龙县|