The Ruby Way. Copyright 2003 by Que Publishing. International Standard Book Number: Warning and Disclaimer

Similar documents
Sams Teach Yourself Java 2 in 21 Days, Fourth Edition. Copyright 2004 by Sams Publishing. International Standard Book Number:

Sams Teach Yourself ASP.NET in 24 Hours

Zend PHP Certification Study Guide. Copyright 2005 by Sams Publishing. International Standard Book Number: Warning and Disclaimer

CCNA Practice Questions Exam Cram 2. Copyright 2004 by Que Publishing. International Standard Book Number: Warning and Disclaimer

Sams Teach Yourself ASP.NET in 24 Hours

Java 2 Programmer Exam Cram 2

MCAD/MCSD Developing and Implementing Web Applications with Visual Basic.NET and Visual Studio.NET Training Guide: Exam

CCNA Security Official Cert Guide First Edition. Copyright 2015 Cisco Systems, Inc. ISBN-10: ISBN-13:

Eclipse Kick Start. Copyright 2005 by Sams Publishing. International Standard Book Number:

Sams Teach Yourself Apache 2 in 24 Hours

MCSE Windows 2000 Network Infrastructure Training Guide Exam (70-216) Dave Bixler, Larry Chambers, and Joseph Phillips

Red Hat Linux 8 Unleashed. Copyright 2003 by Sams Publishing. International Standard Book Number: X. Warning and Disclaimer

Advanced PHP Programming

A+ Exam Cram 2. Copyright 2003 by Que Publishing. International Standard Book Number: Warning and Disclaimer

Introduction to Python

Basic Syntax - First Program 1

15.1 Origins and Uses of Ruby

Understanding the Network: A practical Guide to Internetworking Michael J. Martin

Ruby: Introduction, Basics

CSE 413 Programming Languages & Implementation. Hal Perkins Winter 2019 Ruby Containers, Blocks, and Procs

Ruby: Introduction, Basics

Upgrading BankLink Books

Ruby: Introduction, Basics

Multiple Choice Questions (20 questions * 6 points per question = 120 points)

Your First Ruby Script

XML Primer Plus By Nicholas Chase

Computer Organization & Systems Exam I Example Questions

Mustang Wiring & Vacuum Diagrams

JavaScript Developer's Dictionary

Introduction to Ruby. SWEN-250 Personal Software Engineering

Lecture 12. Lists (& Sequences)

Introduction CMSC 330: Organization of Programming Languages. Books on Ruby. Applications of Scripting Languages

INTEL PERCEPTUAL COMPUTING SDK. How To Use the Privacy Notification Tool

LED Manager for Intel NUC

VB6 MCSD Training Guide

CS 111X - Fall Test 1

CS 115 Lecture 8. Selection: the if statement. Neil Moore

CS1114 Spring 2015 Test ONE ANSWER KEY. page 1 of 8 pages (counting the cover sheet)

Downloaded from

CMSC330 Spring 2015 Midterm #1 9:30am/11:00am/12:30pm

SOFT 161. Class Meeting 1.6

CS 5142 Scripting Languages

CSE 142/143 Unofficial Style Guide

Topics Covered Thus Far CMSC 330: Organization of Programming Languages

Mask Set Errata. Introduction. MCU Device Mask Set Identification. MCU Device Date Codes. MCU Device Part Number Prefixes MSE08AZ32_0J66D 12/2002

Introduction to Python

University of Washington CSE 140 Introduction to Data Programming Winter Midterm exam. February 6, 2013

Introduction to Ruby, part I

CMSC330 Fall 2014 Midterm 1 Grading

Class extension and. Exception handling. Genome 559

S206E Lecture 19, 5/24/2016, Python an overview

How & Why We Subnet Lab Workbook

Exception Handling. Genome 559

Review. Input, Processing and Output. Review. Review. Designing a Program. Typical Software Development cycle. Bonita Sharif

Working with Strings. Lecture 2. Hartmut Kaiser. hkaiser/spring_2015/csc1254.html

Programming in C. Session 7. Seema Sirpal Delhi University Computer Centre

ENGR 101 Engineering Design Workshop

Class extension and. Exception handling. Genome 559

Getting Started With Python Programming

Digipass Plug-In for SBR. SBR Plug-In SBR. Steel-Belted RADIUS. Installation G uide

CS 2505 Computer Organization I Test 1. Do not start the test until instructed to do so! printed

A Tour of Ruby.... for Java programmers

CS 111X - Fall Test 1 - KEY KEY KEY KEY KEY KEY KEY

Scribe Monitor App. Version 1.0


VHDL Lexical Elements

DaMPL. Language Reference Manual. Henrique Grando

Part 1 (80 points) Multiple Choice Questions (20 questions * 4 points per question = 80 points)

Static Checking and Intermediate Code Generation Pat Morin COMP 3002

UNIT 6B Organizing Data: Hash Tables. Comparing Algorithms

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

A Small Permutation Group Engine by: Gregory Kip. COMS W4115 Programming Languages and Translators Prof. Stephen Edwards

SYMBOLS. you would not assign a value to a symbol: :name = "Fred" The Book of Ruby 2011 by Huw Collingbourne

PYTHON- AN INNOVATION

Dynamic arrays / C Strings

IEEE Electronic Mail Policy

EXAMINATION INSTRUCTIONS

Introduction. Installation

A First Look at ML. Chapter Five Modern Programming Languages, 2nd ed. 1

Exercise 1.1 Hello world

AmpliFund Applicant User Guide

SOAPScript For squeaky-clean code, use SOAPScript Language Summary Bob Nisco Version 0.5 β

Floating-point lab deadline moved until Wednesday Today: characters, strings, scanf Characters, strings, scanf questions clicker questions

Python review. 1 Python basics. References. CS 234 Naomi Nishimura

Welcome to Python 3. Some history

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE

Note from the Publisher

Oracle Fail Safe. Release for Microsoft Windows E

1. First open a web browser and search for "Bookr". 2. Click on the first link and it will lead you to

C10552: Intro to Computation. Lecture 2 July 17, 2016

Homework 3. OPTIONAL PROBLEMS (No due date)

CMSC330 Fall 2014 Midterm 1 Solution

CSC 148 Lecture 3. Dynamic Typing, Scoping, and Namespaces. Recursion

AIS Cube [THE BLAZINGCORE SERIES] LANGUAGE REFERENCE

Syntax Syntax for file I/O error detection system function (not in Annex A)

DEMO A Language for Practice Implementation Comp 506, Spring 2018

User Guide Dick Eassom. All Rights Reserved

\n is used in a string to indicate the newline character. An expression produces data. The simplest expression

Chapter 9 Subprograms

Modem Command Guidelines HP Notebook Series

Transcription:

The Ruby Way Copyright 2003 by Que Publishing International Standard Book Number: 0672320835 Warning and Disclaimer Every effort has been made to make this book as complete and as accurate as possible, but no warranty or fitness is implied. The information provided is on an "as is" basis. The author and the publisher shall have neither liability nor responsibility to any person or entity with respect to any loss or damages arising from the information contained in this book or from the use of the CD or programs accompanying it. When reviewing corrections, always check the print number of your book. Corrections are made to printed books with each subsequent printing. To determine the printing of your book, view the copyright page. The print number is right-most number on the line below the First Printing line. For example, the following indicates the 4 th printing of a title. First Printing: December 2001 06 05 04 03 10 9 8 7 6 5 4 Page 25 Misprint Third line of code in "A Sample Program" section: exit if not str or not str[0] Delete line str.chomp! Page 32 Delete paragraph beginning with "As a crude example" through code line Repeat (j<10) do { j+=1; print j,"\n"} Correction exit if not str or str.chomp!.empty

Page 70 Third line of code from bottom of page puts "string contains lowercase charcters" Page 71 First line of code puts "string contains uppercase charcters" Third line of code if string =~ /[A-Z]/ and string =~ /a-z Page 105 Line of code immediate before paragraph beginning with "The code shown here" y = b.roundf(2) # 6.12 Page 116 First paragraph, last line: by a sigma ( ) is simply... Page 121 5 th paragraph, second sentence: Thus the U.S. time zones usually in ST (standard time) or DT (daylight saving time). Page 123 Second line of code from bottom day = time.strftime("%a") "Tuesday" Last line of code on page long = time.strftime("%a") #"Tuesday" puts "string contains lowercase characters" puts "string contains uppercase characters" if string =~ /[A-Z]/ and string =~ /[a-z] y = b.roundf(2) # 6.14 by a sigma ( ) is simply... Thus the U.S. time zones usually in ST (standard time) or DST (daylight saving time). day = time.strftime("%a") "Tuesday" long = time.strftime("%a") #"Tue"

Page 140 The method length (or its alias size) will give the number of elements in an array. Note that this is one less than the index of the last item: Page 141 Second paragraph, last sentence in "Comparing Arrays" section The methods == and!= dep on this method. Code example at bottom of page, second line def <=> other) Page 159 Fifth line of code on page musicians = letters.join Page 174 Last sentence on page The corresponding instance methods in the Array class are called shift and unshift, respectively. Page 191 def search(x) if self.data == x else return self ltree = left!= nil? left.search(x) : nil return ltree if ltree!= nil rtree = right!= nil? right.search(x) : nil nil The method length (or its alias size) will give the number of elements in an array. Note that this is one more than the index of the last item: The methods == and!= dep do not on this method. def <(other) musicians = letters.join(" ") The corresponding instance methods in the Array class are called unshift and shift, respectively. def search(x) if self.data == x return self elsif x < self.data return left!= nil? left.search(x) : nil else return right!= nil? right.search(x) : nil

Page 192 temp += left.to_a if left temp << left.to_a if left temp += right.to_a if right temp << right.to_a if right str = tree.to_s # "," # str is now "bongo,grimace,jewel,monoid,ne xus,plover,synergy" arr = tree.to_a # arr is now: # ["bongo",["grimace",[["jewel"],"monoid",[["nexus"],"plover", # [synergy"]]]]] Page 211 Last line of code on page perms = File.stat.mode("somefile") Page 237 Second paragraph in "Interfacing to PostgreSQL" section Assuming you already have PostgreSQL installed and set up (and you have a table named testdb), Page 247 Third line in third code example attr_writer :b1, :b2, # Creates @b1, a1=, @b2, b2= str = tree.to_s # str is now: # "[bongo,[grimace,[[jewel],monoid,[[nexus],plover,[synergy]]]]]" arr = tree.to_a # arr is now: # ["bongo",["grimace",[["jewel"]," monoid",[["nexus"],"plover", # ["synergy"]]]]]" perms = File.stat("somefile").mode Assuming you already have PostgreSQL installed and set up (and you have a database named testdb), attr_writer :b1, :b2, # Creates @b1, b1=, @b2, b2=

Page 259 First line of code def makewithdrawl(amount) Page 264 First line of code in Listing 5.7 class MyMod Page 310 Last sentence on page For instance, the variables $tlab and $temp have to be used inside the blocks passed to various constructors; this implies they can't be local variables. Page 335 Second paragraph This simple application has one widget in its main window- -an instance of FXButton displaying the text Hello, world!: FXButton.new(main, "&Hello, world!", nil, Page 366 Next to last code line in example before "Dealing with Exceptions" section puts "right." Page 495 Second paragraph in "Blocks" section, first sentence, remove (otherwise, it is treated as a hash literal) def makewithdrawal(amount) module MyMod We don't advocate the careless use of globals in real-life programs. This simple application has one widget in its main window--an instance of FXButton displaying a text string: FXButton.new(main, str, nil, puts "wrong."

Page 506 Third paragraph, second line Actually, the self notation can be used in Ruby as well.) Page 514 Third paragraph in "Arrays" section Use <code>include?</code> where you would have used a conditional <code>in</code> in Python. Actually, the self notation can be used for Ruby methods, though not for attributes.) Use include? where you would have used a conditional in in Python. This errata sheet is inted to provide updated technical information. Spelling and grammar misprints are updated during the reprint process, but are not listed on this errata sheet.