<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    隨筆-77  評論-5  文章-2  trackbacks-0
      2009年5月1日
    class Square{
    public:
     Square(int x ) :value(x*x){
     }

    Square(const Square& other) = delete;//rule 1

    const Square & operator = (const Square& other) == delete;//rule 2
    const Square & operator = (Square&& other) = delete;//rule3 

    ..
    }

    Square s = 9; //因為s沒有初始化,會先用9 調(diào)用構(gòu)造函數(shù) Square(int x ) , 然后調(diào)用Square(const Square& other),和rule1 違背
    Square s2(8);
     s= s2;//對應(yīng)rule 2
     s= Square(9);//對應(yīng) rule3 
    posted @ 2019-12-31 21:11 huohuo 閱讀(1059) | 評論 (0)編輯 收藏
    其實一直想學(xué)ruby,總是拖拖拉拉推了幾年。 很多ruby的教材要么老厚一本 要么是東一榔頭西一斧頭,邏輯性不清楚 ruby語法還沒說清楚就上rails了 這個教材挺好。 今天才發(fā)現(xiàn)argument 是實參,parameter是形參
    posted @ 2014-07-07 22:20 huohuo 閱讀(239) | 評論 (0)編輯 收藏
    小新看到媽媽用訂書機訂了一個盒子,他就從打印機上面拿了幾張a4紙,釘了一個像盒子的東西,當作他的百寶箱,把他的一些零零碎碎的東西放到他的百寶箱中。 有一天他看到了媽媽的首飾盒,他覺得很漂亮,就和媽媽說:媽媽,我把你這個盒子里面的東西放到我的那個百寶箱里面,你這個盒子給我當百寶箱吧。 媽媽當然不同意。小新很希望要個百寶箱,爸爸就問他:“你需要一個多大的百寶箱?” 小新比劃了一個大小,他希望大一點,能裝很多東西。爸爸問他是不是希望箱子能有很多分隔? 小新說不要分隔,但是百寶箱要有鎖。 爸爸明白了---你就是要個能鎖住的箱子嘛,我給你找個皮箱,帶密碼鎖的。 第二天,爸爸上班回來,發(fā)現(xiàn)他平時用的筆記本電腦被小新鎖在他的"新百寶箱"----密碼鎖皮箱里面了,密碼是小新設(shè)的。 爸爸不知道密碼,打不開皮箱,爸爸就和小新說:"幫爸爸把電腦拿出來,爸爸要給你查一個睡覺前講的故事,不然今天就沒故事聽了"。 小新說:“你用手機也可以查的嘛,別以為我不知道”
    posted @ 2014-01-20 21:49 huohuo 閱讀(226) | 評論 (0)編輯 收藏
    1 解析utf-8的中文字符問題,我修改了 ReportTask類里面的一個方法,增加了一個getJava().setVmArgs("-Dfile.encoding=utf-8")
    2.覆蓋率出不了數(shù)據(jù)   一方面注意制定datafile,把cubertura-instrument和cobertura-report的datafile設(shè)置為一個,另外junit里面也要設(shè)置一個系統(tǒng)屬性,制定cubertura的datafile屬性.  不制定datafile時,可能生成文件在當前運行ant的目錄.但是我們ant任務(wù)中的junit測試任務(wù),可能會使用不同的目錄來作工作路徑.這樣會導(dǎo)致datafile不一致.

    另外一個是要記得將javac 任務(wù)的debug="yes" ,因為只有debug =yes時,編譯的代碼才帶有行信息,能顯示覆蓋.  當然常見的問題是junit的classpath中的instrument class目錄放到原來被測class之前.




    posted @ 2013-08-18 22:37 huohuo 閱讀(500) | 評論 (0)編輯 收藏
    下載putty的安裝版本,安裝之后有一個plink pscp程序。
    plink程序負責調(diào)用ssh命令
    pscp負責上傳文件。

    plink -l user -pw pass   hostname

    但是因為plink會提示是否要保存密碼,不能保證自動批處理運行,此時利用管道的能力來輸入提示的結(jié)果

    echo Y >yes.txt
    plink -l user -pw pass   hostname <yes.txt
    posted @ 2012-03-04 06:31 huohuo 閱讀(604) | 評論 (0)編輯 收藏
    /Files/lijinglin/storm.pdf
    posted @ 2011-12-21 01:27 huohuo 閱讀(294) | 評論 (0)編輯 收藏
    /Files/lijinglin/zookeeper.ppt
    posted @ 2011-12-21 00:33 huohuo 閱讀(330) | 評論 (0)編輯 收藏
    kafka pdf

    /Files/lijinglin/F_1330_Narkhede_Kafka.pptx
    posted @ 2011-12-20 22:53 huohuo 閱讀(320) | 評論 (0)編輯 收藏
    /Files/lijinglin/stormsrc.rar
    posted @ 2011-12-19 02:15 huohuo 閱讀(247) | 評論 (0)編輯 收藏

    zookeeper集群安裝

    測試環(huán)境redhat5.5:
    vmware建兩臺虛擬機(btw,似乎雙核系統(tǒng)只能建倆,3個就死掉了)
    192.168.229.129
    192.168.229.130


    下載2011年12月15日的最新zookeeper
    加壓到
    /opt/zookeeper-3.4.0/
    配置/opt/zookeeper-3.4.0/conf/zoo.cfg
    可以把那個例子考過來
    Java代碼 復(fù)制代碼 收藏代碼
    1. # The number of milliseconds of each tick   
    2. tickTime=2000  
    3. # The number of ticks that the initial    
    4. # synchronization phase can take   
    5. initLimit=10  
    6. # The number of ticks that can pass between    
    7. # sending a request and getting an acknowledgement   
    8. syncLimit=5  
    9. # the directory where the snapshot is stored.   
    10. do not use /tmp for storage, /tmp here is just    
    11. # example sakes.   
    12. dataDir=/opt/zookeeper-3.4.0/data/zookeeper   
    13. dataLogDir=/opt/zookeeper-3.4.0/data/log   
    14. # the port at which the clients will connect   
    15. clientPort=2181  
    16. #   
    17. # Be sure to read the maintenance section of the    
    18. # administrator guide before turning on autopurge.   
    19. #   
    20. # http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance   
    21. #   
    22. # The number of snapshots to retain in dataDir   
    23. #autopurge.snapRetainCount=3  
    24. # Purge task interval in hours   
    25. # Set to "0" to disable auto purge feature   
    26. #autopurge.purgeInterval=1  
    27. server.1=192.168.229.129:2888:3888  
    28. server.2=192.168.229.130:2888:3888  

    修改/opt/zookeeper-3.4.0/bin/zkServer.sh
    Java代碼 復(fù)制代碼 收藏代碼
    1. status)   
    2.     # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output   
    3.     #STAT=`echo stat | nc -q 1 localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//'2> /dev/null| grep Mode`   
    4.     STAT=`echo stat | nc localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//'2> /dev/null| grep Mode`  

    以上這些多臺機器一樣

    log和data都在dataDir下面
    如果找不到log了用大招:
    ps -ef|grep zookeeper
    ls -l /proc/123123/fd
    其中有一個是log
    然后dataDir建立一個文件myid
    在192.168.229.129上
    echo 1 >/opt/zookeeper-3.4.0/data/zookeeper/myid
    在192.168.229.130上
    echo 2 >/opt/zookeeper-3.4.0/data/zookeeper/myid
    對應(yīng)zoo.cfg里面的
    注意一定是數(shù)字


    然后zkServer.sh start 
    啟動
    zkServer.sh status
    看狀態(tài)
    echo ruok|nc localhost 2181         
    //are you ok?
    echo dump|nc localhost 2181
    echo stat|nc localhost 2181
    echo srst|nc localhost 2181
    zkServer.sh stop
    posted @ 2011-12-16 03:48 huohuo 閱讀(1334) | 評論 (0)編輯 收藏

     

    public class Util {
     final static int LINE_COUNT = 16;
     final static int WORD_COUNT = 2;
     public static StringBuffer toHex(byte b)
     {
      byte factor = 16;
      int v = b & 0xff;//去掉byte轉(zhuǎn)換之后的負數(shù)部分。
      byte high = (byte)( v / factor);
      byte low = (byte)(v % factor);
      StringBuffer buf = new StringBuffer();
      buf.append(toHexLow(high)).append(toHexLow(low));
      return buf;
     }
     private static char toHexLow(byte b)
     {
      if(b > 16 || b < 0 )
      {
       throw new IllegalArgumentException("inpt parameter should less than 16 and greater than 0");
      }
      if(b < 10){
       return (char)('0' + (char)b);
      }
      else{
        return (char)('A' + (b-10));

      }
     }
     
     public static StringBuffer toHex(int val)
     {
      StringBuffer buf = toHex((byte)(val >>24 & 0xff)).append(toHex((byte)(val>>16&0xff)));
      return buf.append(toHex((byte)(val>>8&0xff))).append(toHex((byte)(val & 0xff)));
     }
     
     /**
      * 打印二進制數(shù)組
      * @param arr
      * @param off
      * @param len
      */
     public static void printBytes(byte [] arr,int off,int len)
     {
      if(arr == null || len <= 0 || off <0 || off + len > arr.length){
       return;
      }
      
      int count = 0;
      
      for(int i = off; count < len; ++i)
      {
       System.out.print(toHex(arr[i]));
       
       ++ count;
       if(count% WORD_COUNT == 0)
       {
        System.out.print(' ');
       }
       if(count % LINE_COUNT == 0)
       {
        System.out.println();
       }
      }
     }
     
     public static void main(String[] args) {
      byte[] arr = new byte[256];
      for(int i = 0; i < 256;++i )
      {
       
       arr[i] = (byte)i;
       
      }
      
      printBytes(arr,0,256);
      printBytes(arr,240,16);
      
      System.out.println(toHex(1));
      System.out.println(toHex(0xffffffff));
      System.out.println(toHex(0xeeffaacc));
     }
    }




    另外c++寫好的小端序的int數(shù)據(jù),用java讀入如此處理
     private static int convertInt(byte[]  arr)
     {
      if(arr == null || arr.length != 4)
      {
       throw new IllegalArgumentException("bytes array error");
      }
      int val = (arr[0] & 0xff) | (arr[1] & 0xff)<<8 | (arr[2] & 0xff)<<16 | (arr[3]&0xff)<<24;
      return val;
     }


    posted @ 2011-11-02 21:36 huohuo 閱讀(5392) | 評論 (0)編輯 收藏
    1.修改當前的hostname可以用
    hostname  myname
    此時只是修改了內(nèi)存內(nèi)部的,下次啟動又恢復(fù)了
    2.機器在啟動的時候會調(diào)用/etc/rc.d/boot.localnet
    腳本看后面的附錄,這個腳本會判斷當前的$HOSTNAME變量是否設(shè)置,沒有設(shè)置就會讀取/etc/HOSTNAME
    來設(shè)置主機名。
    3.因此要修改hostname,
     3.1 修改/etc/HOSTNAME文件
     3.2 修改當前的$HOSTNAME變量
     3.3 停掉/etc/rc.d/boot.localnet
     3.4 啟動 /etc/rc.d/boot.localnet
    因此執(zhí)行腳本如下:
     export HOSTNAME=myname
     echo $HOSTNAME>/etc/HOSTNAME
      /etc/rc.d/boot.localnet stop
     /etc/rc.d/boot.localnet start


    附錄:/etc/rc.d/boot.localnet

    case "$1" in
      start)
            # clean up old yp bindings
            rm -f /var/yp/binding/*.[12]

            #
            # set hostname and domainname
            #
            XHOSTNAME=""
            test -f /etc/HOSTNAME && {
                read XHOSTNAME < /etc/HOSTNAME
            }
            test -n "$HOSTNAME" -a "$HOSTNAME" != '(none)' && {
                echo Using boot-specified hostname \'${HOSTNAME}\'
                XHOSTNAME="$HOSTNAME"
            }
            test -n "$XHOSTNAME" && {
                echo -n Setting up hostname \'${XHOSTNAME%%.*}\'
                hostname ${XHOSTNAME%%.*}
                rc_status -v -r
            }

            XDOMAINNAME=""
            test -f /etc/defaultdomain && {
                read XDOMAINNAME < /etc/defaultdomain
            }
            test -n "$XDOMAINNAME" && {
                echo -n Setting up NIS domainname \'$XDOMAINNAME\'
            }
            domainname "$XDOMAINNAME"
            test -n "$XDOMAINNAME" && {
            rc_status -v -r
                             


    posted @ 2011-10-27 22:21 huohuo 閱讀(16394) | 評論 (3)編輯 收藏
    http://www.infoq.com/cn/articles/hadoop-config-tip

    http://hadoop.apache.org/common/docs/r0.19.2/cn/cluster_setup.html

    http://wenku.baidu.com/view/be021f3667ec102de2bd8964.html

    這個裝完帶驗證url
    http://wenku.baidu.com/view/373ed21fb7360b4c2e3f64ce.html
    posted @ 2011-10-25 06:50 huohuo 閱讀(187) | 評論 (0)編輯 收藏
    /Files/lijinglin/LINUX_SHELL.part2.rar
    /Files/lijinglin/LINUX_SHELL.part1.rar
    /Files/lijinglin/diveintopython3.rar
    posted @ 2011-10-25 06:45 huohuo 閱讀(184) | 評論 (0)編輯 收藏
    1.安裝suse
    裝好vmware workstation8,跑到open suse,下載suse11的光盤iso文件,將iso文件映射到vmware的光驅(qū)做安裝。
    2.安裝vmwaretools,用root用戶執(zhí)行
    vmware安裝目錄中的linux.iso中帶有的VMwareTools*.gz
    執(zhí)行vmware-install.pl
    一路回車,中途碰到問題,提到找不到kernel header文件,
    The path "" is not a valid path to the 2.6.37-1-1.2-desktop kernel

    參照網(wǎng)上文件
    安裝了kernel-devel ,還是碰到問題,,又安裝了kernel-desktop-devel*.rpm
    再試用 rpm -ql kernel-desktop-devel,
    發(fā)現(xiàn)這個包的文件都安裝的 /usr/src/linux-2.6.37.1-1.2-obj/
    下面,于是我采用這個路徑/usr/src/linux-2.6.37.1-1.2-obj/i586/desktop/include
    結(jié)果安裝成功。這個vmwaretools主要是為了提供一個和主操作系統(tǒng)共享文件目錄的作用吧。
    安裝起來還是比較費勁的。
    posted @ 2011-10-25 05:51 huohuo 閱讀(2268) | 評論 (0)編輯 收藏
     透明gif動畫讀寫伸縮例子

    今天找了第三方的代碼,然后自己修改了部分,實現(xiàn)了透明動畫gif的讀寫,jdk 5下測試通過。

    雖然jdk6支持gif的讀寫,但是很多系統(tǒng)沒有升級到j(luò)dk6,不可能為了一個gif讀寫伸縮功能就要升級到j(luò)dk6.

    這個例子里面使用了開源的gifdecoder animatedgifencoder。
    開源的gifdecoder有個bug,透明色經(jīng)常被它變?yōu)楹谏@樣很不好。

    另外GifUtil類里面有伸縮gif圖的例子,有些人圖伸縮之后存會gif會出現(xiàn)顏色變多了,超過gif的256色,
    因此伸縮也是有特別注意的地方。


    具體看代碼吧,沒有太多空解釋
    posted @ 2009-09-10 19:53 huohuo 閱讀(2131) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    蹲下玩


    文章來源:http://www.flickr.com/photos/liyunxin/3409487358/
    posted @ 2009-05-01 10:57 huohuo 閱讀(122) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    這是什么


    文章來源:http://www.flickr.com/photos/liyunxin/3408678473/
    posted @ 2009-05-01 10:57 huohuo 閱讀(81) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    在朝陽一巷的工商一行宿舍

    在朝陽一巷的工商一行宿舍


    文章來源:http://www.flickr.com/photos/liyunxin/3408678585/
    posted @ 2009-05-01 10:57 huohuo 閱讀(90) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    在朝陽一巷的工商一行宿舍

    在朝陽一巷的工商一行宿舍


    文章來源:http://www.flickr.com/photos/liyunxin/3409487680/
    posted @ 2009-05-01 10:57 huohuo 閱讀(97) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    唔...

    在朝陽一巷的工商一行宿舍


    文章來源:http://www.flickr.com/photos/liyunxin/3409487798/
    posted @ 2009-05-01 10:57 huohuo 閱讀(95) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    在路上


    文章來源:http://www.flickr.com/photos/liyunxin/3408678979/
    posted @ 2009-05-01 10:57 huohuo 閱讀(104) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    錦母角的船上


    文章來源:http://www.flickr.com/photos/liyunxin/3409488100/
    posted @ 2009-05-01 10:57 huohuo 閱讀(95) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    錦母角的船上


    文章來源:http://www.flickr.com/photos/liyunxin/3408679279/
    posted @ 2009-05-01 10:57 huohuo 閱讀(86) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    錦母角的船上

    錦母角的船上,和奶奶在一起


    文章來源:http://www.flickr.com/photos/liyunxin/3409488420/
    posted @ 2009-05-01 10:57 huohuo 閱讀(83) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    錦母角的船上

    錦母角的船上


    文章來源:http://www.flickr.com/photos/liyunxin/3408679495/
    posted @ 2009-05-01 10:57 huohuo 閱讀(80) | 評論 (0)編輯 收藏

    李運新 發(fā)表相片:

    紅沙蛋家魚排

    和爸爸媽媽在一起


    文章來源:http://www.flickr.com/photos/liyunxin/3408680885/
    posted @ 2009-05-01 10:57 huohuo 閱讀(657) | 評論 (1)編輯 收藏

    jad -debug -o -r -sjava -dsrc **/*.class

    由于jad不支持新版本的class文件,使用
    -debug ,可以強制對新版本的class文件反編譯

    -d是指定目標路徑

    **/*.class 表示當前目錄下所有class文件

    xx/**/*.class 表示xx目錄下所有class文件

     

    jad的網(wǎng)站

    http://www.kpdus.com/jad.html

     

    新版jad下載路徑

    http://www.kpdus.com/jad/winnt/jadnt158.zip

     

     

    今天轉(zhuǎn)換了oracle adf的代碼,好多編譯不過,郁悶,寫jad的后來不出版本了啊

    oracle也垃圾,說是公開代碼了,都沒有地方下載

     

     

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.11784700.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(240) | 評論 (0)編輯 收藏

    最近下了oracle adf的 source code,想編譯一下javadoc,用eclipse生成,搞出來out of memory,

    于是翻了一下ant 的幫助,做了一個build.xml,設(shè)置了Xmx

    本來工作正常得,刪除了一點東西,沒有測試,先貼著吧。

    【adf 得代碼還是挺難找的,終于在老外的一個blog上找到,是oracle給apache的,和 jdeveloper 10.1.3上的還是有點差別】

     

    <project name="name of project" default="javadoc" basedir=".">


     <property name="adf-api.home"      value="E:/doc/oracle/apache-drop/adf-faces/adf-faces-api"/>
     <property name="adf-impl.home"      value="E:/doc/oracle/apache-drop/adf-faces/adf-faces-impl"/>
     <property name="dest.home"      value="E:/doc/oracle/apache-drop"/>

     

     

     

      <path id="doc.src.path">


       <pathelement path="${adf-api.home}/src/main/java"/>
         
       <pathelement path="${adf-api.home}/target/maven-i18n-plugin/main/java"/>
         
       <pathelement path="${adf-api.home}/target/maven-xrts-plugin/main/java"/>
         
       <pathelement path="${adf-api.home}/target/maven-faces-plugin/main/java"/>
         
        <pathelement path="${adf-impl.home}/src/main/java"/>
         
       <pathelement path="${adf-impl.home}/target/maven-javascript-plugin/main/resources"/>
         
       <pathelement path="${adf-impl.home}/target/maven-xrts-plugin/main/java"/>
         
       <pathelement path="${adf-impl.home}/target/maven-i18n-plugin/main/java"/>
         
       <pathelement path="${adf-impl.home}/target/maven-i18n-plugin/main/javascript"/>
         
       <pathelement path="${adf-impl.home}/target/maven-faces-plugin/main/java"/>
             
     </path>

      <path id="classes.path" >


      </path>


      <target name="javadoc"
       description="Create Javadoc API documentation">

        <mkdir          dir="${dest.home}/docs/api"/>
        <javadoc sourcepathref="doc.src.path" packagenames="oracle.*"
                    destdir="${dist.home}/docs/api"
              maxmemory="200M">

       


        </javadoc>

      </target>


    </project>


    文章來源:http://stocknewbie.bokee.com/viewdiary.11971386.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(838) | 評論 (0)編輯 收藏

    早就聽說google的map功能,今天在地圖上找到把自己居住和上班的地方

    找到了自己的衛(wèi)星圖,真的很有意思,這個圖還是比較老的,圖中科技園的中興還在施工

     

    http://maps.google.com/maps?f=q&hl=zh-CN&q=china&ie=UTF8&t=k&om=1&ll=22.536976,113.937063&spn=0.009711,0.021458

     

    緯度 22。53  經(jīng)度  113。93 屬于熱帶,在北京西南面

     

     

    兩個軟件

    javascript plus,上面帶了和js相關(guān)的dom,js core reference js client guide 之類的幫助。

    編輯器有code insight 功能

     

    dom inspector 可以查看頁面上某個元素的屬性,style,作為ie的插件,可以用鼠標點選控件來知道其中的dom對象屬性和html代碼

     

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.12043254.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(167) | 評論 (0)編輯 收藏

    目前使用oracle adf 框架 10.1.3 版本

    1 adf 的源代碼 (交付給apache 的)


    http://people.apache.org/~bdudney/apache-drop.zip

    是從http://www.orablogs.com/jjacobi/ 上面看到了

     

    2. 其實我把 adf-faces-api  adf-faces-impl.jar 用jad 解碼出來了,反正許多編譯不過,里面的代碼版本和apache的版本還不是一致的

     

    3. apache 的myface 正在改adf-faces 的代碼,可以去他們的svn上取,取出來的結(jié)構(gòu)和原來oracle的區(qū)別很大。

    懷疑下一個版本的jdeveloper ,如果基于myface的adf 作表示層的話,兼容性很難保證。

     

    4。 adf 空間里面的類層次比較復(fù)雜,oracle原來是使用uix機制,為了遵守jsf規(guī)范使用jsf繪制的時候,很多處理還是有uix概念。我懷疑如果重新設(shè)計的話,adf 完全可以簡單得多。不過目前oracle adf 控件同時支持pda,desktop,

    是了不起的,雖然沒有嘗試過他的pda版本

     

    5 adf-facs-impl.jar!META-INF/faces-config.xml 定義了UIComponent 和Render的對應(yīng)關(guān)系。

    因此如果要修改adf控件的繪制器時,可以干掉jar包下的faces-config.xml,在自己的代碼路徑建立 /META-INF/faces-config.xml  ,修改這個文件來修改控件對應(yīng)的繪制器

     

    唉,混了這么多年,還在表示層打滾,應(yīng)該看看工作流了。

     

     

     

     

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.12098419.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(642) | 評論 (0)編輯 收藏

    上周折騰了幾天,oracle workflow 2.6.3沒有裝好,這周和zg交流了一下,發(fā)現(xiàn)我沒有看installation guide ,他的中間層裝對了,我的數(shù)據(jù)庫裝對了,今天終于整合出來了,雖然他是linux,我是winxp

     

    經(jīng)驗如下:

    workflowserver 2.6.3 依賴 oracle db,oracle db companion cd.oracle httpserver standalone 9.04,

     

    1.裝10g dbserver ,oracle 10g db server 字符集選用中文的UTF-8編碼方式,不能用zhs16gbk,因為
    工作流配置程序WorkflowCA.jar中寫死了zhs對應(yīng)的字符集是utf8,要出現(xiàn)中文,就得用utf8


    2.安裝dbserver 的伴侶盤oracle 10 g companion cd ,安裝第一項.裝了這個才有一些什么owa_util之類的東西,大概是oracle web agent吧

     

    3.裝完dbserver之后就可以裝workflowserver 的服務(wù)器部分,裝到10g服務(wù)器下

     

    4.裝完之后,數(shù)據(jù)庫菜單下面有個 workflow configuration assistant,按照安裝指南設(shè)置一下參數(shù)。


    5. oracle application server 里面的 httpserver ,需要放到不在數(shù)據(jù)庫的那個oracle_home,我裝在d:\oracleApache. 這個httpserver ,將一些請求,轉(zhuǎn)成對數(shù)據(jù)庫的pl/sql procedure的請求,由plsql代碼生成網(wǎng)頁

     

    (其實伴侶盤里面也是有oracle http server ,我剛開始沒有配置好,也許也是可以的,后來就選zg裝成功的as中的httpserver)

     

    6.安裝workflowserver 的middletier 到 httpserver所在的oraclehome

     

    需要修改dads.conf

    <Location /pls/wf>
      SetHandler pls_handler
      Order deny,allow
      Allow from all
      AllowOverride None
      PlsqlDatabaseConnectString 10.16.33.178:1521:ORCL
      PlsqlAuthenticationMode Basic
      PlsqlDefaultPage wfa_html.home

      PlsqlNLSLanguage      "SIMPLIFIED CHINESE_CHINA.UTF8"
    </Location>

     

    7. windows xp 下啟動httpserver時,

    a.網(wǎng)上鄰居-》本地連接-》屬性-》高級—》Wins標簽-》去掉啟用LMhosts查詢
    前的勾就可以了.

    b 控制面板-》windows防火墻-》高級標簽-》網(wǎng)絡(luò)連接設(shè)置-》設(shè)置-》勾選安
    全Web服務(wù)器(HTTPS)"選項,按兩次"確定"即可

    c。關(guān)閉一些vpn之類的軟件,一些網(wǎng)絡(luò)程序,如skype 時才能正常啟動httpserver

    啟動httpserver失敗時,請查看
    D:\oraApache\Apache\Apache\logs\error_log

    和D:\oraApache\opmn\logs\HttpServer~1


    如果D:\oraApache\Apache\Apache\logs\error_log顯示
    [Tue Jul 18 16:27:33 2006] [crit] (10022)提供了一個無效的參數(shù)。:
    setup_inherited_listeners: WSASocket failed to open the inherited socket.

    表示端口被占用,檢查是否啟動了其他特別的vpn軟件,或者軟件占用了apache server的端口,使用有其他網(wǎng)絡(luò)程序干擾.
    netstat -a 和netstat -ab

    8.訪問頁面 http://localhost:7777/pls/wf/wfa_html.home

     

    9.后記: 其實這個版本有bug,在有個腳本里面有 select to_number('10g') from ....

    會提示錯誤,windows下面,這個錯誤似乎不影響,可以一直裝下去,linux下面似乎要改掉。


    文章來源:http://stocknewbie.bokee.com/viewdiary.12103536.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(1039) | 評論 (0)編輯 收藏

    今天看cctv-12的道德觀察,里面講一些百姓英雄。在桂林發(fā)生一起搶包事件,一個女孩背著包在街上走,此時一個小偷從后面沖過來,小偷搶了包就走,女孩在后面追,大叫抓小偷,追了一陣,女孩體力不支,越追越遠。此時前面有兩個女孩,正在散步,小偷從她們前面沖過去了,這是其中一個叫鄧樹花,聽到抓小偷,于是追了出去,小偷本來以為甩掉了失主,打開包的拉鏈一看,就一個老式的三星舊手機,不值什么錢,這個時候后面有又人追來,趕緊跑,后面的mm緊追不舍,他就把包扔了,心想不會追吧,結(jié)果女孩仍然在追,(女孩事后說,我當時好像看見他丟了點什么,但不知道是包),女孩追上去,抓住了小偷的衣領(lǐng)。小偷掏出刀:放了我吧,再不放,我就捅死你,女孩當時一直不肯放手(畫外音說不管小偷怎樣求饒,鄧樹花就不肯放) 鄧樹花后來說:我當時看到刀,嚇懵了,都忘記自己還抓著他的衣領(lǐng)。小偷往她手上割了一刀,她當時感覺麻麻的,沒有放手,又割了兩刀,沒有用,一刀捅在手臂。鄧樹花沒有力氣了,就拉不住小偷,摔到在地上,小偷逃走了,這是鄧樹花大叫抓小偷,幾個在附近的酒吧門口的人發(fā)現(xiàn)了,兩個送鄧樹花去了醫(yī)院,三個追小偷去了(他們說女人都抓小偷,我們怎么能不追呢),追了一陣,前面也有人攔住小偷,小偷拿刀示威,同時求饒,要他們放了他,此時圍住他的人說:你如果就是偷東西還罷了,還拿刀傷人,一定不能放,最后搏斗,抓住小偷,一人負傷。

    我和lp看了覺得好玩,這位女英雄很真實,很有趣。

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.13204052.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(107) | 評論 (0)編輯 收藏
         摘要:    DHTML,Table標簽,固定行頭,固定列頭列   <html> <head> <!--固定行列頭,曲濱200608--> <style type="text/css"> <!-- body,table, td, a { font:9pt; }   /...  閱讀全文
    posted @ 2009-05-01 10:52 huohuo 閱讀(411) | 評論 (0)編輯 收藏

    最近剛結(jié)婚,我媽來了,丈母娘來了,這幾天,發(fā)現(xiàn)自己很傻。以前以為我媽是很直爽的人,最近也發(fā)現(xiàn)媽媽也是有點精明的。岳母更是非常了得的人。 老婆一直以為岳父已經(jīng)比較糊涂,頭腦不清楚,岳母也不是那么精明了。這次來了,才知道,岳父其實也很精的。我們年輕一代,其實不如他們,具體事情就不說了。(老婆說,我這口氣,好像是以前認為比他們精明,其實老婆以為岳父母糊涂,就是自己以為自己清楚)。

    具體事情就不說了,記錄以下以前看到的一個段子

     

    My Father

    When I was:
    Four years old: My daddy can do anything.
    Five years old: My daddy knows a whole lot.
    Six years old: My dad is smarter than your dad.
    Eight years old: My dad doesn't know exactly everything.
    Ten years old: In the olden days, when my dad grew up, things were sure different.
    Twelve years old: Oh, well, naturally, Dad doesn't know anything about that. He is too old to remember his childhood.
    Fourteen years old: Don't pay any attention to my dad. He is so old-fashioned.
    Twenty-one years old: Him? My Lord, he's hopelessly out of date.
    Twenty-five years old: Dad knows about it, but then he should, because he has been around so long.
    Thirty years old: Maybe we should ask Dad what he thinks. After all, he's had a lot of experience.
    Thirty-five years old: I'm not doing a single thing until I talk to Dad.
    Forty years old: I wonder how Dad would have handled it. He was so wise.
    Fifty years old: I'd give anything if Dad were here now so I could talk this over with him. Too bad I didn't appreciate how smart he was. I could have learned a lot from him.

    Writer Unknown

    中文翻譯:

    我的爸爸

    當我四歲的時候:爸爸可以做任何事。
    當我五歲的時候:爸爸知道的很多。
    當我六歲的時候:我爸爸比你爸爸聰明。
    當我八歲的時候:爸爸并不是知道每一件事。
    當我十歲的時候:在爸爸成長的舊日里,事情和現(xiàn)在完全不同。
    當我十二歲的時候:哦,很顯然,爸爸對于那件事什么也不知道。他太老了,回憶不起自己的童年了。
    當我十四歲的時候:別管我爸爸。他太守舊了。
    當我二十一歲的時候:他?上帝,他是無可救藥地過時了。
    當我二十五歲的時候:爸爸對此了解,但是這是他應(yīng)該了解的,因為他已經(jīng)經(jīng)歷了這么多。
    當我三十歲的時候:也許我們該問問爸爸他是怎么想的。畢竟他有很多經(jīng)驗。
    當我三十五歲的時候:除非我和爸爸談?wù)劊駝t我不能做任何事。
    當我四十歲的時候:我想知道爸爸會怎樣處理這件事。他是如此明智。
    當我五十歲的時候:如果爸爸在這,我會把所有的東西都給他。太遺憾了,我沒有意識到他是多么明智。我本來能從他身上學(xué)到更多

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.13391801.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(113) | 評論 (0)編輯 收藏

    最近做性能測試,使用jprofile + microsoft web stress tool  測tomcat上的網(wǎng)頁.

    做了個網(wǎng)頁例子,和.net對比速度,發(fā)現(xiàn)速度比不過.net

     

    用jprofile 跟蹤多并發(fā)情況,發(fā)現(xiàn)在

    bean:write 在寫整數(shù)和日期類型時,會找格式,并且從properties中找不同語言版本的格式.于是會訪問

    WriteTag.retrieveFormatString

      TagUtils.getInstance().message

           PropertyMessageResource.getMessage(Locale locale, String key)

     

    PropertyMessageResource.getMessage(Locale locale, String key) 中有個synchronized 塊,這里導(dǎo)致了代碼的等待時間過長.

        


    文章來源:http://stocknewbie.bokee.com/viewdiary.15201750.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(157) | 評論 (0)編輯 收藏

    <?xml version="1.0" encoding="UTF-8"?>

    <project name="cobertura.examples.basic" default="coverage" basedir=".">

     <description>
        Cobertura - http://cobertura.sourceforge.net/
        Copyright (C) 2003 jcoverage ltd.
        Copyright (C) 2005 Mark Doliner &lt;thekingant@users.sourceforge.net&gt;
        Cobertura is licensed under the GNU General Public License
        Cobertura comes with ABSOLUTELY NO WARRANTY
        </description>

     
     <property name="build.dir" value="${basedir}/build"/>
     <!-- 需要測試的代碼生成的代碼路徑-->
     <property name="classes.dir" value="${build.dir}/classes"/>

     <!-- 為需要測試的代碼生成的對應(yīng)的測量類,用于測量覆蓋率-->
     <property name="instrumented.dir" value="${build.dir}/instrumented-classes"/>

     
     <!-- 單元測試的代碼,這部分代碼不生成覆蓋率數(shù)據(jù),因此和待測試代碼要分開-->
     <property name="test.classes.dir" value="${build.dir}/test-classes"/>
     
     <!-- 所有報告的路徑-->
     <property name="reports.dir" value="${build.dir}/reports"/>

     <!-- junit 生成兩種測試報告的路徑,xml和html-->
     <property name="reports.xml.dir" value="${reports.dir}/junit-xml"/>
     <property name="reports.html.dir" value="${reports.dir}/junit-html"/>
     
     <!-- cobertura生成的兩種測試覆蓋呂的報告,xml和html-->
     <property name="coverage.xml.dir" value="${reports.dir}/cobertura-xml"/>
     <property name="coverage.html.dir" value="${reports.dir}/cobertura-html"/>
     
     
     <property name="src.dir" value="${basedir}/src" />
     <!--測試代碼的路徑-->
     <property name="test.dir" value="${basedir}/test" />

     
     <path id="cobertura.classpath">
      <fileset dir="${basedir}">
       <include name="lib/unittest/*.jar" />
      </fileset>
     </path>

     <taskdef classpathref="cobertura.classpath" resource="tasks.properties"/>

     <target name="init">
      <mkdir dir="${build.dir}" />
      <mkdir dir="${classes.dir}" />
      <mkdir dir="${test.classes.dir}" />
      <mkdir dir="${instrumented.dir}" />
      <mkdir dir="${reports.xml.dir}" />
      <mkdir dir="${reports.html.dir}" />
      <mkdir dir="${coverage.xml.dir}" />
      <mkdir dir="${coverage.html.dir}" />
     </target>

     <target name="compile" depends="init">
      <javac srcdir="${src.dir}" destdir="${classes.dir}" debug="yes">
       <classpath refid="cobertura.classpath" />
      </javac>
     </target>
     
     
     <target name="compiletest" depends="compile">
      <javac srcdir="${test.dir}" destdir="${test.classes.dir}" debug="yes">
       <classpath location="${classes.dir}"/>
       <classpath refid="cobertura.classpath" />
      </javac>
     </target>

     <target name="instrument" depends="init,compile">
      <!--
       Remove the coverage data file and any old instrumentation.
      -->
      <delete file="cobertura.ser"/>
      <delete dir="${instrumented.dir}" />

      <!--
       Instrument the application classes, writing the
       instrumented classes into ${build.instrumented.dir}.
      -->
      <cobertura-instrument todir="${instrumented.dir}">
       <!--
        The following line causes instrument to ignore any
        source line containing a reference to log4j, for the
        purposes of coverage reporting.
       -->
       <ignore regex="org.apache.log4j.*" />

       <fileset dir="${classes.dir}">
        <!--
         Instrument all the application classes, but
         don't instrument the test classes.
        -->
        <include name="**/*.class" />
        <exclude name="**/*Test.class" />
       </fileset>
      </cobertura-instrument>
     </target>

     <target name="test" depends="init,compiletest">
      <junit fork="yes" dir="${basedir}" haltonerror="no" failureProperty="test.failed">
       <!--
        Note the classpath order: instrumented classes are before the
        original (uninstrumented) classes.  This is important.
       -->
       <classpath location="${instrumented.dir}" />
       <classpath location="${classes.dir}" />
       <classpath location="${test.classes.dir}" />
       <!--
        The instrumented classes reference classes used by the
        Cobertura runtime, so Cobertura and its dependencies
        must be on your classpath.
       -->
       <classpath refid="cobertura.classpath" />

       <formatter type="xml" />
       <test name="${testcase}" todir="${reports.xml.dir}" if="testcase" />
       <batchtest todir="${reports.xml.dir}" unless="testcase">
        <fileset dir="${test.dir}">
         <include name="**/*Test.java" />
        </fileset>
       </batchtest>
      </junit>

      <junitreport >
       <fileset dir="${reports.xml.dir}">
        <include name="TEST-*.xml" />
       </fileset>
       <report format="frames" todir="${reports.html.dir}" />
      </junitreport>
     </target>

     <target name="coverage-check">
      <cobertura-check branchrate="34" totallinerate="100" />
     </target>

     <target name="coverage-report">
      <!--
       Generate an XML file containing the coverage data using
       the "srcdir" attribute.
      -->
      <cobertura-report srcdir="${src.dir}" destdir="${coverage.xml.dir}" format="xml" />
     </target>

     <target name="alternate-coverage-report">
      <!--
       Generate a series of HTML files containing the coverage
       data in a user-readable form using nested source filesets.
      -->
      <cobertura-report destdir="${coverage.html.dir}">
       <fileset dir="${src.dir}">
        <include name="**/*.java"/>
       </fileset>
      </cobertura-report>
     </target>

     <target name="clean" description="Remove all files created by the build/test process.">
      <delete dir="${build.dir}" />
      <delete dir="${classes.dir}" />
      <delete dir="${instrumented.dir}" />
      <delete dir="${reports.dir}" />
      <delete file="cobertura.log" />
      <delete file="cobertura.ser" />
     </target>

     <target name="coverage" depends="clean,compile,instrument,test,coverage-report,alternate-coverage-report" description="Compile, instrument ourself, run the tests and generate JUnit and coverage reports."/>

    </project>


    文章來源:http://stocknewbie.bokee.com/viewdiary.15201790.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(672) | 評論 (0)編輯 收藏

    select level, d1.dept_id,d1.dept_code,sys_connect_by_path(dept_code,'/') path from zte_fbp_depts d1
    start with  d1.dept_id=12
    connect by prior d1.dept_id= d1.parent_dept_id


    文章來源:http://stocknewbie.bokee.com/viewdiary.16533973.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(149) | 評論 (0)編輯 收藏

    性能測試經(jīng)驗總結(jié)
    1.要有信心
    2.要有穩(wěn)定,干凈的環(huán)境,要停掉服務(wù)器上不必要的進程和服務(wù)

    3.要在檢查資源是否正常釋放了,
    內(nèi)存是否存在泄漏,內(nèi)存的不斷增長,也會影響請求的相應(yīng)時間
    數(shù)據(jù)庫連接是否在使用后得到釋放.
    可以查看對象的分配狀況

    要檢查查詢的時候是將所有的數(shù)據(jù)查出來了還是只查了一頁數(shù)據(jù)

    4.連接池的配置,可以分配足夠初始連接,同時配置沒有連接時的等待時間,要保證始終是取到連接的
    免得測出的是假相.

    給出一個配置的例子
     <bean id="dataSource" class="com.zte.platform.db.FolDataSource"
           destroy-method="close">
       <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
     <property name="url" value=""/>
     <property name="username" value=""/>
     <property name="password" value=""/>
       <property name="initialSize" value="50" />
       <property name="maxActive" value="200" />
       <property name="maxWait" value="-1"/>
       <property name="maxIdle" value="100"/>
       <property name="removeAbandoned" value="true"/>
       <property name="removeAbandonedTimeout" value="30000"/>
       <property name="logAbandoned" value="true"/>
     </bean>

    5 要用profile工具,判斷在多并發(fā)情況下,時間的分配狀況,抓住主要矛盾,解決最影響性能的地方

    6.服務(wù)器需要配置好,對內(nèi)存和線程都需要配置.
        tomcat配置
        <Connector
    port="8088"               maxHttpHeaderSize="8192"
                   maxThreads="100" minSpareThreads="100" maxSpareThreads="450"
                   enableLookups="false" redirectPort="8443" acceptCount="300"
                   connectionTimeout="20000" disableUploadTimeout="true" />

    內(nèi)存配置:
    這次測試只配置了java vm,  -Xms1024M -Xmx1024M


    有人推薦這樣配置:
    JVM_ARGS= -Xms1408M -Xmx1408M -XX:MaxPermSize=96M -XX:NewSize=500M -XX:MaxNewSize=500M -Xss128k -XX:+UseConcMarkSweepGC -XX:+UseParNewGC


    7.測試腳本中不能帶session標識,如http://..../app/perftest.jsp;jsessionid=D68FC8BDDB954F33AD2626D67553EC8E
    需要去掉 ;jsessionid=D68FC8BDDB954F33AD2626D67553EC8E ,因為帶sessionid會導(dǎo)致測試結(jié)果是多個線程訪問一個用戶的會話.
    實際應(yīng)用中是一個用戶一個會話一個線程

    8 日志分析,分析日志中出現(xiàn)的異常,異常發(fā)生的時候,往往性能會降低,也會引發(fā)失敗事務(wù).

    9. 和其他系統(tǒng)集成了,要先和其他系統(tǒng)分開進行測試,達標一個再集成進來,將問題局部化定位.

    10.最好調(diào)優(yōu)人員學(xué)會使用 loadrunner測試工具,先自己使用loadrunner測試通過再給測試人員,提高效率

     

     


     


    文章來源:http://stocknewbie.bokee.com/viewdiary.17160571.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(117) | 評論 (0)編輯 收藏

    還缺少一個onchange處理,使用正則表達式的處理方式,

    以下是限制文字的輸入
    <style>
     INPUT.num_text
     {
      imme-mode:disabled;
      onkeydown: expression(onkeydown=function ()
      {
       var   k=window.event.keyCode;  
       if(
       k==46||k==8||k==189||k==109||k==190||k==110|| k>=48 && k<=57
       ||k>=96 && k<=105||k>=37 && k<=40 )
       {
        return true;
       }
       else if (k==13)
       {
        window.event.keyCode = 9;
        
        return true;
       }

       else{
        
          return false;
       } 
      });


     }

     

    </style>

     

    <form>
           <input type="text"   class="num_text"  />

        
    </form>


    文章來源:http://stocknewbie.bokee.com/viewdiary.18663505.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(126) | 評論 (0)編輯 收藏

    package com.zte.platform;

    import java.io.IOException;

    import javax.faces.webapp.FacesServlet;
    import javax.servlet.ServletConfig;
    import javax.servlet.ServletException;
    import javax.servlet.ServletRequest;
    import javax.servlet.ServletResponse;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import org.apache.commons.logging.Log;
    import org.apache.commons.logging.LogFactory;

    public class ZteFacesServlet extends HttpServlet
    {

     private static final String INIT_PARAM_ERROR_PAGE = "errorPage";
            private Log log = LogFactory.getLog(getClass());       
           

     private FacesServlet delegate;

     private String errorPage;

     public void init(ServletConfig servletConfig) throws ServletException
     {
      delegate = new FacesServlet();
      delegate.init(servletConfig);
      errorPage = servletConfig.getInitParameter(INIT_PARAM_ERROR_PAGE);
     }

     public void destroy()
     {
      delegate.destroy();
     }

     public ServletConfig getServletConfig()
     {
      return delegate.getServletConfig();
     }

     public String getServletInfo()
     {
      return delegate.getServletInfo();
     }

     public void service(ServletRequest request, ServletResponse response)
       throws ServletException, IOException
     {
      try
      {
       delegate.service(request, response);
      } catch (Throwable e)
      {
                log.error("page exception ,redirect to error page ",e);
                try{
       redirectToErrorPage((HttpServletRequest) request,
         (HttpServletResponse) response);
                }
                catch(Exception ex)
                {
                 log.error("fail to redirect to error page",ex);
                 //throw new RuntimeException("fail to redirect to error page,original exceptioin is", e);
                }
      }
     }

     private void redirectToErrorPage(HttpServletRequest request,
       HttpServletResponse response) throws IOException
     {
      if (!"".equals(errorPage))
      {
       response.sendRedirect(request.getContextPath() + errorPage);
      }
     }

    }


    文章來源:http://stocknewbie.bokee.com/viewdiary.18876476.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(181) | 評論 (0)編輯 收藏

    divHtml = divHtml + "<iframe src='about:blank' style='position:absolute;top:0px;left:0px; visibility:inherit;  width:190px;height:232px;z-index:-1; scrolling='no' frameborder='0' filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';'></iframe>"
      

    document.all.myDiv.innerHTML = divHtml;

     

    這種方式有個問題,就是width和height寫死了,

    如果div自身設(shè)置了width和height,可以將iframe的width,height設(shè)置成100%

    divHtml = divHtml + "<iframe src='about:blank' style='position:absolute;top:0px;left:0px; visibility:inherit;  width:100%;height:100%;z-index:-1; scrolling='no' frameborder='0' filter='progid:DXImageTransform.Microsoft.Alpha(style=0,opacity=0)';'></iframe>"


    文章來源:http://stocknewbie.bokee.com/viewdiary.18876477.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(236) | 評論 (0)編輯 收藏

    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStream;
    import java.io.PushbackInputStream;
    import java.util.ArrayList;
    import java.util.HashSet;
    import java.util.List;
    import java.util.Set;

    public class UtfTool
    {

        /**
         * ant 編譯之后的result文件,注意要編譯提示錯誤的文件名要在同一行
         * 可以設(shè)置命令提示窗口的緩沖區(qū)大小實現(xiàn)
         * @param resultFileName
         */
        public static Set getFileNamesFromCompileResult(String resultFileName)
         throws java.io.IOException
        {
     Set<String> set = new HashSet();
     BufferedReader reader = new BufferedReader(new FileReader(
      resultFileName));
     String start = "[javac] ";
     int startLen = start.length();
     String end = ".java:";
     int endLen = end.length();
     
     String errMsg = "\\65279";
     while (reader.ready())
     {
         String line = reader.readLine();
         int indexStart = line.indexOf(start);
        
         if(line.indexOf(errMsg) == -1)
         {
      continue;
         }
         if (indexStart != -1)
         {
      int indexEnd = line.indexOf(end);
      if (indexEnd != -1)
      {
          String name = line.substring(indexStart + startLen,
           indexEnd + endLen - 1);
          set.add(name.trim());
      }
         }
     }
     return set;

        }
       
        /**
         * 讀取流中前面的字符,看是否有bom,如果有bom,將bom頭先讀掉丟棄
         * @param in
         * @return
         * @throws IOException
         */
        public static InputStream getInputStream(InputStream in) throws IOException
        {

     PushbackInputStream testin = new PushbackInputStream(in);
     int ch = testin.read();
     if (ch != 0xEF)
     {
         testin.unread(ch);
     } else if ((ch = testin.read()) != 0xBB)
     {
         testin.unread(ch);
         testin.unread(0xef);
     } else if ((ch = testin.read()) != 0xBF)
     {
         throw new IOException("錯誤的UTF-8格式文件");
     } else
     {
         //不需要做,這里是bom頭被讀完了
        //// System.out.println("still exist bom");

     }
     return testin;

        }
       
       
       
        /**
         * 根據(jù)一個文件名,讀取完文件,干掉bom頭。
         * @param fileName
         * @throws IOException
         */
        public static void trimBom(String fileName) throws IOException
        {

     FileInputStream fin = new FileInputStream(fileName);
     //開始寫臨時文件
     InputStream in = getInputStream(fin);
     String tmpFileName = fileName + ".tmp";
     FileOutputStream out = new FileOutputStream(tmpFileName);
     byte b[] = new byte[4096];

     int len = 0;
     while (in.available() > 0)
     {
         len = in.read(b, 0, 4096);
         out.write(b, 0, len);
     }

     in.close();
     fin.close();
     out.close();

     //臨時文件寫完,開始將臨時文件寫回本文件。
     in = new FileInputStream(tmpFileName);
     System.out.println("[" + fileName + "]");
     out = new FileOutputStream(fileName);

     while (in.available() > 0)
     {
         len = in.read(b, 0, 4096);
         out.write(b, 0, len);
     }
     in.close();
     out.close();
        }

        /**
         * 根據(jù)ant編譯錯誤來去除bom
         * @param resultFile
         * @throws IOException
         */
        static void trimBomByCompileResult(String resultFile) throws IOException
        {
     Set<String> set = getFileNamesFromCompileResult(resultFile);
     for (String fName : set)
     {
         trimBom(fName);
     }
        }

        public static void main(String[] args) throws IOException
        {
     trimBomByCompileResult("c:/result3.txt");
     
     ///List<String> list = getFileNamesFromCompileResult(resultFile);

    // InputStream in = new FileInputStream(
    //  "D:/cc/SSB_SRC_DEV_lijinglin2/TP_SSB/SSB_CJ203_Component/ProductCode/com/zte/ssb/component/access/implementation/dao/ImplementationDAO.java");
    // getInputStream2(in);
    // in.close();
        }
    }


    文章來源:http://stocknewbie.bokee.com/viewdiary.22061282.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(1860) | 評論 (0)編輯 收藏

    執(zhí)行sql

    select  o.name,cl.name,cm.text from sysobjects o,syscolumns cl, syscomments cm
     where o.id = cl.id and cl.cdefault = cm.id  and o.type='U'
      and o.name='test2' and cl.name like 'col%'

     

    test2是標明, col%是列名通配符, 'U' 表示表格是用戶表

     

    返回結(jié)果:

     

    name                           name                           text                                                                                                                                                                                                                                                           
    ----                           ----                           ----                                                                                                                                                                                                                                                           
    test2                          col1                           DEFAULT (0)                                                                                                                                                                                                                                                    
    test2                          col2                           DEFAULT  2                                                                                                                                                                                                                                                     
    test2                          col3                           DEFAULT  getdate()            

     

     

    syscolumns 中 id 表示對應(yīng)的表格在sysobjects中id, cdefault表示在syscomments中的缺省值注釋id

     

     

    缺省值可能會出現(xiàn)函數(shù), 例如  default getdate(),

    所以我覺得應(yīng)該這個缺省值可以剝離掉default, 如果使用hibernate實現(xiàn),還只能用dynamic insert,dynamic update.

     

     


    文章來源:http://stocknewbie.bokee.com/viewdiary.31463433.html
    posted @ 2009-05-01 10:52 huohuo 閱讀(488) | 評論 (0)編輯 收藏
    主站蜘蛛池模板: 免费大香伊蕉在人线国产| 丁香花在线视频观看免费| 亚洲日韩中文字幕无码一区| 精品亚洲A∨无码一区二区三区| 久久久久亚洲精品无码系列| 亚洲国产精品va在线播放| 亚洲国产精华液网站w| 亚洲激情视频在线观看| 亚洲精品自拍视频| 亚洲国产精品xo在线观看| 亚洲乱码在线视频| 亚洲日产乱码一二三区别 | 成熟女人牲交片免费观看视频| 国产精品久久免费| 91在线视频免费91| 黄网址在线永久免费观看| 一本色道久久88亚洲综合 | 99re这里有免费视频精品| 久久精品无码专区免费青青| 欧洲乱码伦视频免费| 性感美女视频在线观看免费精品 | 99久在线国内在线播放免费观看 | 国产精品1024在线永久免费 | 亚洲欧美日韩一区二区三区| 国产精品亚洲精品久久精品| 无码毛片一区二区三区视频免费播放 | 亚洲午夜在线电影| 亚洲一区免费视频| 亚洲av无码专区首页| 九一在线完整视频免费观看| 你是我的城池营垒免费观看完整版| 久操视频在线免费观看| 亚洲视频在线观看免费视频| 日本免费人成视频播放| 亚洲人成影院在线观看| 久久亚洲一区二区| 亚洲日本在线电影| 国产精品无码免费专区午夜| 91大神在线免费观看| 在线免费观看视频你懂的| 亚洲人成人无码网www电影首页|