您的位置:首页 > 数据库

SQL SERVER XML 学习总结

2015-08-19 14:24 465 查看


Notation Conventions

Throughout this book, we use the following typographic notations.

Literal code examples are shown using a typewriter-like font.

class SampleCode

def run

#...

end

end

Within the text, Fred#do_something is a reference to an instance method (in this case

do_something) of class Fred, Fred.new2 is a class method, and Fred::EOF is a class

constant. The decision to use a hash character to indicate instance methods was a tough

one: it isn’t valid Ruby syntax, but we thought that it was important to differentiate

between the instance and class methods of a particular class. When you see us write

File.read, you know we’re talking about the class method read. When instead we

write File#read, we’re referring to the instance method read.

2

install ruby(cvs install)

For those who just have to be on the very latest, hot-off-the-press

and untested cutting edge (as we were while writing this book), you

can get development versions straight from the developers’ working

repository.

The Ruby developers use CVS (Concurrent Version System, freely

available from https://www.cvshome.org) as their revision control

system. You can check files out as an anonymous user from their

archive by executing the following CVS commands:

% cvs z4

d

:pserver:anonymous@cvs.rubylang.

org:/src←֓

login

(Logging in to anonymous@cvs.rubylang.

org)

CVS password: ENTER

% cvs z4

d

:pserver:anonymous@cvs.rubylang.

org:/src←֓

checkout ruby

The complete source code tree, just as the developers last left it, will

now be copied to a ruby subdirectory on your machine.

This command will check out the head of the development tree. If you

want the Ruby 1.8 branch, add r

ruby_1_8 after the word checkout

in the second command.

If you use the CVSup mirroring utility (conveniently available from
http://www.cvsup.org), you can find Ruby supfiles on the rubylang

site at http://cvs.rubylang.
org/cvsup/.

Interactive Ruby

One way to run Ruby interactively is simply to type ruby at the shell prompt. Here

we typed in the single puts expression and an end-of-file character (which is Ctrl+D

on our system). This process works, but it’s painful if you make a typo, and you can’t

really see what’s going on as you type.

% ruby

puts "Hello, world!"

^D

Hello, world!

For most folks, irb—Interactive Ruby—is the tool of choice for executing Ruby interactively.

irb is a Ruby Shell, complete with command-line history, line-editing capabilities,

and job control. (In fact, it has its own chapter beginning on page 174.) You run

irb from the command line. Once it starts, just type in Ruby code. It will show you the

value of each expression as it evaluates it.

Prepared exclusively for Yeganefar

3

  Control Structures

if count > 10

puts "Try again"

elsif tries == 3

puts "You lose"

else

puts "Enter a number"

end

while weight < 100 and num_pallets <= 30

pallet = next_pallet()

weight += pallet.weight

num_pallets += 1

end
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: