Ray's playground

 

2009年11月9日

C++ templates chapter 13(Future Directions)

摘要: This chapter is full of little things that need to beimproved in the future.I don't fullyunderstand some of them. 阅读全文

posted @ 2009-11-09 20:39 Ray Z 阅读(120) 评论(0) 推荐(0) 编辑

Recipe 1.9. Processing a String One Word at a Time

摘要: [代码]Output: dogs3dog2[代码]Output: dogs3dog2   quite1f.b.i1the1fella1that1man-about-town1he's1 阅读全文

posted @ 2009-11-09 12:34 Ray Z 阅读(179) 评论(0) 推荐(0) 编辑

2009年11月6日

Recipe 1.8. Processing a String One Character at a Time

摘要: If you're processing an ASCII document, then each byte corresponds to one character. Use String#each_byte to yield each byte of a string as a number, which you can turn into a one-character string:[代码... 阅读全文

posted @ 2009-11-06 23:22 Ray Z 阅读(232) 评论(0) 推荐(0) 编辑

2009年11月5日

Recipe 1.7. Converting Between Strings and Symbols

摘要: To turn a symbol into a string, use Symbol#to_s, or Symbol#id2name, for which to_s is an alias.[代码]Output:a_symbol    AnotherSymbol    Yet another symbol!You usually reference a symbol by just typing ... 阅读全文

posted @ 2009-11-05 22:57 Ray Z 阅读(183) 评论(0) 推荐(0) 编辑

Writing and Mapping classes(Chapter 3 of NHibernate In Action)

摘要: Mapping class inheritanceA simple strategy for mapping classes to database tables might be “one table for every class.” This approachsounds simple, and it works well until you encounter in... 阅读全文

posted @ 2009-11-05 19:38 Ray Z 阅读(211) 评论(0) 推荐(0) 编辑

2009年11月4日

Recipe 1.6. Converting Between Characters and Values

摘要: To see the ASCII code for a specific character as an integer, use the ? operator:[代码]Output: 97To see the integer value of a particular in a string, access it as though it were an element of an array:... 阅读全文

posted @ 2009-11-04 12:49 Ray Z 阅读(175) 评论(0) 推荐(0) 编辑

2009年11月3日

Recipe 1.5. Representing Unprintable Characters

摘要: Ruby gives you a number of escaping mechanisms to refer to unprintable characters. By using one of these mechanisms within a double-quoted string, you can put any binary character into the string.[代码]... 阅读全文

posted @ 2009-11-03 22:40 Ray Z 阅读(173) 评论(0) 推荐(0) 编辑

2009年11月1日

Recipe 19.4. Unpacking a Few Items in a Multiple Assignment

摘要: [代码][代码][代码] 阅读全文

posted @ 2009-11-01 17:24 Ray Z 阅读(214) 评论(0) 推荐(0) 编辑

2009年10月31日

Recipe 19.3. Generating the Fibonacci Sequence

摘要: It's worth reflecting on why a generator is so perfectly suitable for implementing an unbounded sequence and letting you work with it. Syntactically, a generator is "just" a function containing the ke... 阅读全文

posted @ 2009-10-31 20:57 Ray Z 阅读(175) 评论(0) 推荐(0) 编辑

2009年10月30日

Recipe 19.2. Building a List from Any Iterable

摘要: [代码]Output: 2 阅读全文

posted @ 2009-10-30 23:06 Ray Z 阅读(183) 评论(0) 推荐(0) 编辑

导航