Merry (slightly early) Christmas! Mr. Neighborly's Humble Little Ruby Book is free!

J

Jeremy McAnally

Hello all,
I just switched everything over, and Mr. Neighborly's Humble Little
Ruby Book is now available to download as a PDF or view online
completely free.

If you don't know about my book: "Mr. Neighborly's Humble Little Ruby
Book covers the Ruby language from the very basics of using puts to
put naughty phrases on the screen all the way to serving up your
favorite web page from WEBrick or connecting to your favorite web
service. Written in a conversational narrative rather than like a dry
reference book, Mr. Neighborly's Humble Little Ruby Book is an easy to
read, easy to follow guide to all things Ruby."

You can go check it out at: http://www.humblelittlerubybook.com/

Enjoy,
Jeremy

P.S. - Yes, I know the HTML is ugly. Blame OpenOffice and my mistake
of using it. The XHTML export filter just crashed Oo_Org for some
reason, so I'm stuck with the stupid plain HTML exporter which is
terrible.
 
D

Devin Mullins

Jeremy said:
Hello all,
(Look, ma! No top posting!)

"Unlike some other languages, it doesn't get jealous and give you
"errors" if you break it off with objects and decide to go steady with
closures instead."

Teehee! Thanks for the xmas present! I look forward to checking it out!

(Yes, I'm pretty familiar with Ruby, but I've recently been volunteered
to help teach some coworkers, and any time I can delegate work to
inanimate objects, I'm happy.)

Devin
 
S

Siemen Baader

Really nice! I'm reading it right now.

I found a small typo on p 26 of the pdf version:

Integers are created by entering the number you wish to use without quotes
(lest it become a string).

--> (lets it become a string).

:)

merry christmas
siemen baader
 
J

Jeremy McAnally

Yeah there are a few grammatical gotcha's that I'm aware of. I'll fix
them when I have time...that's one that no one's pointed out yet
though, so thanks! :)

I'm going to put a list of errata up on the site probably sometime
next week; I will correct them all, but it would probably be a good
idea to make you aware of them beforehand. ;)

--Jeremy
 
S

Siemen Baader

I'm going to put a list of errata up on the site probably sometime
next week; I will correct them all, but it would probably be a good
idea to make you aware of them beforehand. ;)

Sure :)
 
W

William James

Siemen said:
Really nice! I'm reading it right now.

I found a small typo on p 26 of the pdf version:

Integers are created by entering the number you wish to use without quotes
(lest it become a string).

--> (lets it become a string).

:)

merry christmas
siemen baader

Now wait just a gosh darn minute! That's not an error. You're simply
not fluent in English. He's saying that to avoid making the number
a string, you must not use quotes.

Examples from the K.J.V.:

Ye shall not eat of it, neither shall ye touch it, lest ye die.

They shall bear thee up in their hands, lest thou dash thy
foot against a stone.

Also take no heed unto all words that are spoken; lest thou
hear thy servant curse thee:

A poem by Samuel Taylor Coleridge:

Hear, sweet Spirit, hear the spell,
Lest a blacker charm compel!
So shall the midnight breezes swell
With thy deep long-lingering knell.

And at evening evermore,
In a chapel on the shore,
Shall the chaunter, sad and saintly,
Yellow tapers burning faintly,
Doleful masses chaunt for thee,
Miserere Domine!

Hush! the cadence dies away
On the quiet moonlight sea:
The boatmen rest their oars and say,
Miserere Domine!
 
S

Siemen Baader

William said:
Now wait just a gosh darn minute! That's not an error. You're simply
not fluent in English. He's saying that to avoid making the number
a string, you must not use quotes.

You're right! I didn't really get that before your explanation - it
makes perfect sense this way. Thanks.
Q. What's long and round and full of siemen?
A. A submarine.

Hm... I think the first part of your post was the more gifted one. But
no hard feelings.

Merry Christmas to you as well,
Siemen
 
M

Martin DeMello

This book is really great! I'm familiar with most of the material already,
but I'm enjoying reading through it all the same. One question I have (a
question of preference more than correctness) is in your example dealing
with blocks and yield, why do you choose to use while with an interator:

def myeach(myarray)
iter = 0
while (iter < myarray.length):
yield(myarray[iter])
iter += 1
end
end
testarray = [1,2,3,4,5]
myeach(testarray) {|item| print "#{item}:"}
$B"*(B 1:2:3:4:5:

Rather than using what seems (to me at least) the more Ruby way:

def myeach(myarray)
for elem in myarray
yield elem
end
end

That way you're not using an extra variable or having to worry about array
length.

A funny way to write it would be using blocks:
def myeach(myarray)
myarray.each { |elem| yield(elem) }
end

but I think that way basically defeats the purpose of your example ;)

"for i in collection" is converted by the parser to collection.each do
|i|, so it comes to the same thing as your last example :)

martin
 
J

Jeremy McAnally

Hey Tyler,
While thats the most Rubyish way to do it, at that point in the text I
hadn't covered those sorts of loops/iterators yet and thought that the
while method would be more familiar to those reading. I may change it
in the next revision, but I'm not sure. :)

--Jeremy
 
D

dblack

---2049402039-1218730451-1167088315=:12643
Content-Type: MULTIPART/MIXED; BOUNDARY="-2049402039-1218730451-1167088315=:12643"

This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.

---2049402039-1218730451-1167088315=:12643
Content-Type: TEXT/PLAIN; charset=X-UNKNOWN; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE

Hi --

This book is really great! I'm familiar with most of the material alrea= dy,
but I'm enjoying reading through it all the same. One question I have (= a
question of preference more than correctness) is in your example dealing
with blocks and yield, why do you choose to use while with an interator:
=20
def myeach(myarray)
iter =3D 0
while (iter < myarray.length):
yield(myarray[iter])
iter +=3D 1
end
end
testarray =3D [1,2,3,4,5]
myeach(testarray) {|item| print "#{item}:"}
=A2=AA 1:2:3:4:5:
=20
Rather than using what seems (to me at least) the more Ruby way:
=20
def myeach(myarray)
for elem in myarray
yield elem
end
end
=20
That way you're not using an extra variable or having to worry about arr= ay
length.
=20
A funny way to write it would be using blocks:
def myeach(myarray)
myarray.each { |elem| yield(elem) }
end
=20
but I think that way basically defeats the purpose of your example ;)
=20
Anyway, I'm just interested in your thoughts about this. You most likel= y
have your reasons and they probably make sense; after all, you're the on= e
out there writing books :)
=20
Hey Tyler,
While thats the most Rubyish way to do it, at that point in the text I
hadn't covered those sorts of loops/iterators yet and thought that the
while method would be more familiar to those reading. I may change it
in the next revision, but I'm not sure. :)

I definitely agree that that -- dealing with forward topic references
as one writes -- is a challenge. My favorite example is: you can't
really explain Enumerable until you've explained arrays, but Array is
Enumerable.... :) It is, though, a good affirmation of the fact that
Ruby is a nicely integrated system and a well-oiled machine.


David

--=20
Q. What's a good holiday present for the serious Rails developer?
A. RUBY FOR RAILS by David A. Black (http://www.manning.com/black)
aka The Ruby book for Rails developers!
Q. Where can I get Ruby/Rails on-site training, consulting, coaching?
A. Ruby Power and Light, LLC (http://www.rubypal.com)
---2049402039-1218730451-1167088315=:12643--
---2049402039-1218730451-1167088315=:12643--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top