<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年9月10日
    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 閱讀(1060) | 評論 (0)編輯 收藏
    其實一直想學ruby,總是拖拖拉拉推了幾年。 很多ruby的教材要么老厚一本 要么是東一榔頭西一斧頭,邏輯性不清楚 ruby語法還沒說清楚就上rails了 這個教材挺好。 今天才發(fā)現argument 是實參,parameter是形參
    posted @ 2014-07-07 22:20 huohuo 閱讀(239) | 評論 (0)編輯 收藏
    小新看到媽媽用訂書機訂了一個盒子,他就從打印機上面拿了幾張a4紙,釘了一個像盒子的東西,當作他的百寶箱,把他的一些零零碎碎的東西放到他的百寶箱中。 有一天他看到了媽媽的首飾盒,他覺得很漂亮,就和媽媽說:媽媽,我把你這個盒子里面的東西放到我的那個百寶箱里面,你這個盒子給我當百寶箱吧。 媽媽當然不同意。小新很希望要個百寶箱,爸爸就問他:“你需要一個多大的百寶箱?” 小新比劃了一個大小,他希望大一點,能裝很多東西。爸爸問他是不是希望箱子能有很多分隔? 小新說不要分隔,但是百寶箱要有鎖。 爸爸明白了---你就是要個能鎖住的箱子嘛,我給你找個皮箱,帶密碼鎖的。 第二天,爸爸上班回來,發(fā)現他平時用的筆記本電腦被小新鎖在他的"新百寶箱"----密碼鎖皮箱里面了,密碼是小新設的。 爸爸不知道密碼,打不開皮箱,爸爸就和小新說:"幫爸爸把電腦拿出來,爸爸要給你查一個睡覺前講的故事,不然今天就沒故事聽了"。 小新說:“你用手機也可以查的嘛,別以為我不知道”
    posted @ 2014-01-20 21:49 huohuo 閱讀(227) | 評論 (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 閱讀(501) | 評論 (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 閱讀(606) | 評論 (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 閱讀(331) | 評論 (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,似乎雙核系統只能建倆,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
    看狀態(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 閱讀(1335) | 評論 (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 閱讀(5393) | 評論 (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
    因此執(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 閱讀(16395) | 評論 (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的光驅做安裝。
    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

    參照網上文件
    安裝了kernel-devel ,還是碰到問題,,又安裝了kernel-desktop-devel*.rpm
    再試用 rpm -ql kernel-desktop-devel,
    發(fā)現這個包的文件都安裝的 /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,透明色經常被它變?yōu)楹谏@樣很不好。

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


    具體看代碼吧,沒有太多空解釋
    posted @ 2009-09-10 19:53 huohuo 閱讀(2131) | 評論 (0)編輯 收藏
    主站蜘蛛池模板: 久久精品国产亚洲香蕉| 亚洲av无码成人精品区| 亚洲成Av人片乱码色午夜| 国产男女爽爽爽免费视频 | 亚洲国产精品无码专区影院| 免费国产va在线观看| 免费观看午夜在线欧差毛片| 亚洲A∨精品一区二区三区下载| 成年人免费网站在线观看| wwwxxx亚洲| 日韩精品视频免费观看| 国产精品亚洲专区无码牛牛| 亚洲精品岛国片在线观看| 久久99精品免费一区二区| 亚洲国产精品无码中文字| 亚洲视频免费观看| 亚洲中文字幕久久无码| 免费一级毛片清高播放| 国产日韩精品无码区免费专区国产| 亚洲色精品aⅴ一区区三区| 91精品免费观看| 亚洲精品无码专区| 免费人成网站7777视频| 国产成人无码区免费内射一片色欲| 亚洲国产一区二区三区青草影视| 91成人在线免费视频| 亚洲娇小性色xxxx| 亚洲福利在线播放| 久久精品免费电影| 亚洲人成网站看在线播放| 四虎影视永久免费观看网址| 日韩免费的视频在线观看香蕉| 亚洲国产精品午夜电影| 国产jizzjizz免费视频| 免费网站观看WWW在线观看| 亚洲va成无码人在线观看| 亚洲日韩中文字幕日韩在线| 麻豆高清免费国产一区| 羞羞视频在线免费观看| 亚洲视频在线播放| 四虎影视永久免费观看|