`
sarstime
  • 浏览: 20423 次
  • 性别: Icon_minigender_1
  • 来自: 上海
最近访客 更多访客>>
社区版块
存档分类
最新评论
文章列表
1, module   If a third programwants to use these modules, it can simply load the two files (using the Ruby require statement, which we discuss on page 116) and reference the qualified names.   At a stroke, they pretty much eliminate the need for multiple inheritance, providing a facility call ...
Operator Expressions If you enclose a string in backquotes (sometimes called backticks), or use the delimited form prefixed by %x, it will (by default) be executed as a command by your underlying operating system.   1.8 In Ruby 1.8, the value of the assignment is always the value of the pa ...
D1 上海-长沙(1048.8公里,11小时39分钟 , 路桥费445元) D2 长沙-昆明(1325公里,14小时15分钟 , 路桥费575元) D3 昆明-丽江--(497.4公里,7小时45分钟 , 路桥费135元)1天+玩1天 D4-5 丽江-香格里拉(173.9公里,4小时8分钟)(虎跳峡) D6 香格里拉-德钦(180.5公里,6小时32分钟)(住宿飞来寺,可以看梅里雪山) D7 德钦-芒康(217公里 4小时) D8 芒康-八宿(360公里 9小时)(邦达加油站) D9 八宿-波密(然乌镇、米堆冰川、来古冰川)(219公里、5小时)(然乌加油站、吉祥加油站) D10 ...
1, about method Methods that act as queries are often named with a trailing ?, such as instance_of?.   Methods that are “dangerous,” or modify the receiver, may be named with a trailing !.   And methods that can be assigned to (a feature we discussed on page 29) end with an equals sign (=). ...

programming ruby - 2

1, about closure If the last parameter in a method definition is prefixed with an ampersand (such as &action), Ruby looks for a code block whenever that method is called. That code block is converted to an object of class Proc and assigned to the parameter. You can then treat th ...
1, Ruby has a shortcut: %w does what we need as below: a = [ 'ant', 'bee', 'cat', 'dog', 'elk' ] a[0] ! "ant" a[3] ! "dog" # this is the same: a = %w{ ant bee cat dog elk } a[0] ! "ant" a[3] ! "dog"   2, change hash default value: ...
我的这个朋友把这篇文章取名叫Build Your Programming Technical Skills,我实在不知道用中文怎么翻译,但我在写的过程中,我觉得这很像一个打网游做任务升级的一个过程,所以取名叫“技术练级攻略”,题目有点大,呵呵,这个标 ...
为了说明技术改变和社会改变之间的有机关系,波茨曼引用了一位荷兰社会学家的发现。当一个非洲部落引入火柴后,整个部落的通奸行为就发生了极大的变 化。因为这个部落的人们在进行房事前需要熄火,房事后需要重新生火而不得不向邻居去借一根已经烧着的木棍。于是性事成为了一个公开化的事件而导致通奸难以 掩盖。而火柴的引入,一切,便都变了,因为人们不再需要跑隔壁邻居家借那根烧着的火棍了。   波兹曼这样评价道:“随着信息供应量增加,信息控制机制就受到很大压力。为了对付新的信息,就要增补控制机制。而控制机制本身就是技术,又反过来增 加信息的供应量。”而“失去效用之后的信息就成了混乱之源,而不是秩序之源 ...
``? '' and ``! '' are the only weird characters allowed as method name suffixes. everything is an expression 多行注释可以用=begin 和 =end Ruby中用分号“ ; ”来表示一个语句的结束。一行如果有多个语句,每个语句用分号隔开,而最后一个语 ...
重复一下,Ruby中没有“基本类型”。 不同于Java或C++拥有公有的字段(成员变量),Ruby对象的接口只有方法。 直接写出Ruby表达式就是程序,不必像Java或C++那样定义main()。 拥有顶层是Ruby作为脚本语言的一大特征。 以小写字母或下划线开头的表示局部变量。 变量名以大写字母开头的是常量。因为是常量,只能对它进行一次(第一次)赋值 对于条件表达式,只有两个对象——false和nil——为假,其余所有对象都是真。0和空字符串也是真。 nil表示一个“没有”的对象。 模块似乎比超类的优先级更高。 一般说来,在Ruby中,如果包含了模块的话,就像夹 ...
Finally, you can index arrays using ranges, in which start and end positions are separated by two or three periods. The two-period form includes the end position, while the three-period form does not. Index an array with a negative integer, and it counts from the end. Arrays have a large number ...
If a method is protected, it may be called by any instance of the defining class or its subclasses. If a method is private, it may be called only within the context of the calling object---it is never possible to access another object's private methods directly, even if the object is of the ...
There is a nice reverse engineering Java code into UML diagrams just drag and drop. Also the class diagrams are color coded using Eclipse icons. You can quickly export to JPG or other formats. Very nice UML2 tool. However free version cannot finished installation coz dependency issue. Resolution: - ...
宝宝现在很乖,晚上我基本最多起来两次,所以白天的锻炼就一直坚持了下来。 上个星期尝试了下椭圆机,但是那个机器上的热量显示不知道是不是准确,感觉没怎么费力,可是显示消耗热量确是很多的。 报名参加了11月底马拉松的健康跑,呵呵,也为慈善出点力量。 最近体重处在平台期,一直在85 - 87之间晃悠,部分原因也可能是饮食控制稍微差点了。 目前每次跑步在上量,6.5 - 7.5km之间,而且跑起来基本没觉得太累,看来体能是比以前好多了。最近4次踢球保持最少一个进球的状态,作为中后卫算可以的了,哈哈。 继续,继续,目标是80kg!!!
基本坚持了下来,除了上周因为宝宝出生耽误了两次。 锻炼项目基本不变,集中在腰,胸,背部肌肉的锻炼。 记录下现在的体重,跑完步,体重是86.5kg,已经减重11斤。上个月穿不进去的牛仔短裤现在可以派上用场了。 宝贝女儿降临了,7斤7两,也是小胖妞,不过她不用减肥,呵呵。
Global site tag (gtag.js) - Google Analytics