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

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




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

          plink -l user -pw pass   hostname

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

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

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

          zookeeper集群安裝

          測試環境redhat5.5:
          vmware建兩臺虛擬機(btw,似乎雙核系統只能建倆,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代碼 復制代碼 收藏代碼
          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代碼 復制代碼 收藏代碼
          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
          對應zoo.cfg里面的
          注意一定是數字


          然后zkServer.sh start 
          啟動
          zkServer.sh status
          看狀態
          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 閱讀(1337) | 評論 (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轉換之后的負數部分。
            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)));
           }
           
           /**
            * 打印二進制數組
            * @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數據,用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 閱讀(5397) | 評論 (0)編輯 收藏
          1.修改當前的hostname可以用
          hostname  myname
          此時只是修改了內存內部的,下次啟動又恢復了
          2.機器在啟動的時候會調用/etc/rc.d/boot.localnet
          腳本看后面的附錄,這個腳本會判斷當前的$HOSTNAME變量是否設置,沒有設置就會讀取/etc/HOSTNAME
          來設置主機名。
          3.因此要修改hostname,
           3.1 修改/etc/HOSTNAME文件
           3.2 修改當前的$HOSTNAME變量
           3.3 停掉/etc/rc.d/boot.localnet
           3.4 啟動 /etc/rc.d/boot.localnet
          因此執行腳本如下:
           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 閱讀(16396) | 評論 (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 閱讀(188) | 評論 (0)編輯 收藏
          /Files/lijinglin/LINUX_SHELL.part2.rar
          /Files/lijinglin/LINUX_SHELL.part1.rar
          /Files/lijinglin/diveintopython3.rar
          posted @ 2011-10-25 06:45 huohuo 閱讀(186) | 評論 (0)編輯 收藏
          1.安裝suse
          裝好vmware workstation8,跑到open suse,下載suse11的光盤iso文件,將iso文件映射到vmware的光驅做安裝。
          2.安裝vmwaretools,用root用戶執行
          vmware安裝目錄中的linux.iso中帶有的VMwareTools*.gz
          執行vmware-install.pl
          一路回車,中途碰到問題,提到找不到kernel header文件,
          The path "" is not a valid path to the 2.6.37-1-1.2-desktop kernel

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

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

          雖然jdk6支持gif的讀寫,但是很多系統沒有升級到jdk6,不可能為了一個gif讀寫伸縮功能就要升級到jdk6.

          這個例子里面使用了開源的gifdecoder animatedgifencoder。
          開源的gifdecoder有個bug,透明色經常被它變為黑色,這樣很不好。

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


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

          李運新 發表相片:

          蹲下玩


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

          李運新 發表相片:

          這是什么


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

          李運新 發表相片:

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

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


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

          李運新 發表相片:

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

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


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

          李運新 發表相片:

          唔...

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


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

          李運新 發表相片:

          在路上


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

          李運新 發表相片:

          錦母角的船上


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

          李運新 發表相片:

          錦母角的船上


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

          李運新 發表相片:

          錦母角的船上

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


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

          李運新 發表相片:

          錦母角的船上

          錦母角的船上


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

          李運新 發表相片:

          紅沙蛋家魚排

          和爸爸媽媽在一起


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

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

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

          -d是指定目標路徑

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

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

           

          jad的網站

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

           

          新版jad下載路徑

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

           

           

          今天轉換了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,設置了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 閱讀(839) | 評論 (0)編輯 收藏

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

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

           

          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  經度  113。93 屬于熱帶,在北京西南面

           

           

          兩個軟件

          javascript plus,上面帶了和js相關的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 閱讀(168) | 評論 (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上取,取出來的結構和原來oracle的區別很大。

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

           

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

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

           

          5 adf-facs-impl.jar!META-INF/faces-config.xml 定義了UIComponent 和Render的對應關系。

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

           

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

           

           

           

           

           


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

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

           

          經驗如下:

          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對應的字符集是utf8,要出現中文,就得用utf8


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

           

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

           

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


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

           

          (其實伴侶盤里面也是有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.網上鄰居-》本地連接-》屬性-》高級—》Wins標簽-》去掉啟用LMhosts查詢
          前的勾就可以了.

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

          c。關閉一些vpn之類的軟件,一些網絡程序,如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)提供了一個無效的參數。:
          setup_inherited_listeners: WSASocket failed to open the inherited socket.

          表示端口被占用,檢查是否啟動了其他特別的vpn軟件,或者軟件占用了apache server的端口,使用有其他網絡程序干擾.
          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 閱讀(1040) | 評論 (0)編輯 收藏

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

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

           


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

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

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

           

          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

          中文翻譯:

          我的爸爸

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

           


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

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

          做了個網頁例子,和.net對比速度,發現速度比不過.net

           

          用jprofile 跟蹤多并發情況,發現在

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

          WriteTag.retrieveFormatString

            TagUtils.getInstance().message

                 PropertyMessageResource.getMessage(Locale locale, String key)

           

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

              


          文章來源:http://stocknewbie.bokee.com/viewdiary.15201750.html
          posted @ 2009-05-01 10:52 huohuo 閱讀(158) | 評論 (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"/>

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

           
           <!-- 單元測試的代碼,這部分代碼不生成覆蓋率數據,因此和待測試代碼要分開-->
           <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 閱讀(676) | 評論 (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 閱讀(151) | 評論 (0)編輯 收藏

          性能測試經驗總結
          1.要有信心
          2.要有穩定,干凈的環境,要停掉服務器上不必要的進程和服務

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

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

          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工具,判斷在多并發情況下,時間的分配狀況,抓住主要矛盾,解決最影響性能的地方

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

          內存配置:
          這次測試只配置了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會導致測試結果是多個線程訪問一個用戶的會話.
          實際應用中是一個用戶一個會話一個線程

          8 日志分析,分析日志中出現的異常,異常發生的時候,往往性能會降低,也會引發失敗事務.

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

          10.最好調優人員學會使用 loadrunner測試工具,先自己使用loadrunner測試通過再給測試人員,提高效率

           

           


           


          文章來源:http://stocknewbie.bokee.com/viewdiary.17160571.html
          posted @ 2009-05-01 10:52 huohuo 閱讀(118) | 評論 (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 閱讀(127) | 評論 (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 閱讀(182) | 評論 (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自身設置了width和height,可以將iframe的width,height設置成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 閱讀(238) | 評論 (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文件,注意要編譯提示錯誤的文件名要在同一行
               * 可以設置命令提示窗口的緩沖區大小實現
               * @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;

              }
             
             
             
              /**
               * 根據一個文件名,讀取完文件,干掉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();
              }

              /**
               * 根據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 閱讀(1864) | 評論 (0)編輯 收藏

          執行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' 表示表格是用戶表

           

          返回結果:

           

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

           

           

          syscolumns 中 id 表示對應的表格在sysobjects中id, cdefault表示在syscomments中的缺省值注釋id

           

           

          缺省值可能會出現函數, 例如  default getdate(),

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

           

           


          文章來源:http://stocknewbie.bokee.com/viewdiary.31463433.html
          posted @ 2009-05-01 10:52 huohuo 閱讀(491) | 評論 (0)編輯 收藏
          主站蜘蛛池模板: 平江县| 县级市| 百色市| 松江区| 武安市| 木里| 鹰潭市| 杭州市| 凤庆县| 黄大仙区| 锦屏县| 北安市| 建德市| 东安县| 龙门县| 丹凤县| 彭州市| 志丹县| 西乡县| 乐山市| 新和县| 宜宾县| 靖西县| 海阳市| 三明市| 门源| 平凉市| 麻江县| 呼玛县| 古浪县| 临朐县| 昌宁县| 邳州市| 通海县| 方城县| 达日县| 土默特左旗| 彩票| 浙江省| 宜春市| 奇台县|