其实一直想学ruby,总是拖拖拉拉推了几年。
很多ruby的教材要么老厚一本
要么是东一榔头西一斧头,逻辑性不清楚
ruby语法还没说清楚就上rails了
这个教材挺好。
今天才发现argument 是实参,parameter是形参
			
			
小新看到妈妈用订书机订了一个盒子,他就从打印机上面拿了几张a4纸,钉了一个像盒子的东西,当作他的百宝箱,把他的一些零零碎碎的东西放到他的百宝箱中。 有一天他看到了妈妈的首饰盒,他觉得很漂亮,就和妈妈说:妈妈,我把你这个盒子里面的东西放到我的那个百宝箱里面,你这个盒子给我当百宝箱吧。 妈妈当然不同意。小新很希望要个百宝箱,爸爸就问他:“你需要一个多大的百宝箱?” 小新比划了一个大小,他希望大一点,能装很多东西。爸爸问他是不是希望箱子能有很多分隔? 小新说不要分隔,但是百宝箱要有锁。 爸爸明白了---你就是要个能锁住的箱子嘛,我给你找个皮箱,带密码锁的。  第二天,爸爸上班回来,发现他平时用的笔记本电脑被小新锁在他的"新百宝箱"----密码锁皮箱里面了,密码是小新设的。 爸爸不知道密码,打不开皮箱,爸爸就和小新说:"帮爸爸把电脑拿出来,爸爸要给你查一个睡觉前讲的故事,不然今天就没故事听了"。 小新说:“你用手机也可以查的嘛,别以为我不知道”
			
			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之前.
			
测试环境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 
可以把那个例子考过来 
- # The number of milliseconds of each tick   
- tickTime=2000  
- # The number of ticks that the initial    
- # synchronization phase can take   
- initLimit=10  
- # The number of ticks that can pass between    
- # sending a request and getting an acknowledgement   
- syncLimit=5  
- # the directory where the snapshot is stored.   
- # do not use /tmp for storage, /tmp here is just    
- # example sakes.   
- dataDir=/opt/zookeeper-3.4.0/data/zookeeper   
- dataLogDir=/opt/zookeeper-3.4.0/data/log   
- # the port at which the clients will connect   
- clientPort=2181  
- #   
- # Be sure to read the maintenance section of the    
- # administrator guide before turning on autopurge.   
- #   
- # http:  
- #   
- # The number of snapshots to retain in dataDir   
- #autopurge.snapRetainCount=3  
- # Purge task interval in hours   
- # Set to "0" to disable auto purge feature   
- #autopurge.purgeInterval=1  
- server.1=192.168.229.129:2888:3888  
- server.2=192.168.229.130:2888:3888  
 # The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial 
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between 
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/opt/zookeeper-3.4.0/data/zookeeper
dataLogDir=/opt/zookeeper-3.4.0/data/log
# the port at which the clients will connect
clientPort=2181
#
# Be sure to read the maintenance section of the 
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=192.168.229.129:2888:3888
server.2=192.168.229.130:2888:3888
修改/opt/zookeeper-3.4.0/bin/zkServer.sh 
- status)   
-     # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output   
-     #STAT=`echo stat | nc -q 1 localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`   
-     STAT=`echo stat | nc localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`  
 status)
    # -q is necessary on some versions of linux where nc returns too quickly, and no stat result is output
    #STAT=`echo stat | nc -q 1 localhost $(grep "^[[:space:]]*clientPort" "$ZOOCFG" | sed -e 's/.*=//') 2> /dev/null| grep Mode`
    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