Ruby Data Processing: Using Map, Reduce, and Select 1st Edition Jay Godse instant download
Ruby Data Processing: Using Map, Reduce, and Select 1st Edition Jay Godse instant download
https://textbookfull.com/product/ruby-data-processing-using-map-
reduce-and-select-1st-edition-jay-godse/
https://textbookfull.com/product/biota-grow-2c-gather-2c-cook-
loucas/
https://textbookfull.com/product/earth-systems-data-processing-
and-visualization-using-matlab-zekai-sen/
https://textbookfull.com/product/practical-data-science-cookbook-
data-pre-processing-analysis-and-visualization-using-r-and-
python-prabhanjan-tattar/
https://textbookfull.com/product/python-data-analysis-perform-
data-collection-data-processing-wrangling-visualization-and-
model-building-using-python-3rd-edition-avinash-navlani/
Practical object-oriented design: an agile primer using
Ruby Second Edition Metz
https://textbookfull.com/product/practical-object-oriented-
design-an-agile-primer-using-ruby-second-edition-metz/
https://textbookfull.com/product/data-processing-with-optimus-
supercharge-big-data-preparation-tasks-for-analytics-and-machine-
learning-with-optimus-using-dask-and-pyspark-leon/
https://textbookfull.com/product/scientific-data-analysis-using-
jython-scripting-and-java-advanced-information-and-knowledge-
processing-2010th-edition-chekanov-sergei-v/
https://textbookfull.com/product/a-common-sense-guide-to-data-
structures-and-algorithms-1st-edition-jay-wengrow/
https://textbookfull.com/product/processing-big-data-with-azure-
hdinsight-building-real-world-big-data-systems-on-azure-
hdinsight-using-the-hadoop-ecosystem-1st-edition-vinit-yadav-
Ruby Data
Processing
Using Map, Reduce, and Select
—
Jay Godse
Ruby Data Processing
Using Map, Reduce, and Select
Jay Godse
Ruby Data Processing: Using Map, Reduce, and Select
Jay Godse
Kanata, Ontario, Canada
Index���������������������������������������������������������������������������������������������������97
iv
About the Author
Jay Godse is an active software and web applications developer with
expertise in Ruby, Rails, various databases, and Ansible. He also is
active on Stack Overflow as an active contributor. He graduated with an
engineering degree and then went to work as a digital circuit designer.
After a year of that, he switched to software development, and he has
been there ever since in some form. His early work was mostly real-time
telecommunication device control and provisioning using languages
such as C and Protel. He then transitioned into designing distributed
computing systems using languages such as C++. After that, he moved into
web applications. Along the way, he did stints as a software development
manager and a software architect. But for the last nine years, he has
written web applications in Ruby and DevOps applications in Ansible and
Powershell.
v
About the Technical Reviewer
Massimo Nardone has more than 24 years
of experience in security, web/mobile
development, cloud, and IT architecture. His
true IT passions are security and Android.
He has been programming and teaching
how to program with Android, Perl, PHP, Java,
VB, Python, C/C++, and MySQL for more than
20 years.
He holds a Master of Science in Computing
Science from the University of Salerno, Italy.
He has worked as a project manager, software engineer, research
engineer, chief security architect, information security manager, PCI/SCADA
auditor, and senior lead IT security/cloud/SCADA architect for many years.
Technical skills include security, Android, cloud, Java, MySQL, Drupal,
Cobol, Perl, web and mobile development, MongoDB, D3, Joomla,
Couchbase, C/C++, WebGL, Python, Pro Rails, Django CMS, Jekyll,
Scratch, and more.
He worked as visiting lecturer and supervisor for exercises at the
Networking Laboratory of the Helsinki University of Technology (Aalto
University). He holds four international patents (PKI, SIP, SAML, and Proxy
areas).
He currently works as chief information security officer (CISO) for
Cargotec Oyj and is member of ISACA Finland Chapter Board.
Massimo has reviewed more than 45 IT books for different publishers,
and in addition to reviewing this book he is also the coauthor of
Pro Android Games (Apress, 2015).
vii
Acknowledgments
I would like to acknowledge a few people who helped make me a better
programmer and a better writer. Thanks go to Kevin Szabo and Ronnie
Taylor, both of whom helped me be a better programmer, and to Christina
Hardy, who helped me to become a better writer. And thanks also go to
Mark Powers and the publication team at Apress who helped produce this
book.
ix
Introduction
I wrote mostly reactive software for many years, but there was always
a user interface or reporting component that had string manipulation,
data synthesis, or data formatting. Since I was not trained as a computer
scientist, I did not learn of higher-order functions such as map(), reduce(),
and select() that were found in languages like Lisp or Smalltalk. Also,
Ruby, Python, C++, and JavaScript were not around when I was in school.
As a result, I struggled with cumbersome, error-prone imperative code for
some tasks.
A few years after learning Ruby, but while still using the imperative
programming style for data processing, I discovered the Ruby Enumerable
library and started using its higher-order functions, such as map(),
reduce(), and select(). What happened to my data-processing code?
However, I couldn’t find any but the most trivial examples of how to
use these functions to solve data-processing problems. It took me a lot
xi
Introduction
of time-consuming trial and error with map, reduce, and select to solve
these kinds of problems.
I decided to write this book to
I’ll also admit that I was forced to learn many of the programming
nuances of these functions as I wrote the examples.
xii
Introduction
xiii
Prerequisites
You should be familiar with some Ruby programming or at least some
programming in another language. If you don’t know Ruby, search out
the book Learn Ruby the Hard Way1 and go through it as prescribed by its
author, Zed Shaw.
If you are fluent with Python, you might benefit from this book if you
go slowly and look up Ruby information online as you move through
this book.
An internet connection helps if you want to search for online help
using Google, Bing, or another search engine.
You should have a computer with Ruby 2.2.x installed. Windows works,
as do Linux and Mac OSX.
You should have a good syntax-highlighting text editor. I recommend
Notepad++ on Windows or gedit on Linux or Macintosh, both of which are
free. Sublime works on Windows, Linux, or Macintosh and is slightly better,
but costs about $70 at the time of this writing.
1
http://learnrubythehardway.org/book/
xv
CHAPTER 1
Basic Ruby
This section will acquaint or refresh you with basic ways to use the Ruby
command line, as well as some relevant Ruby coding.
If you are comfortable programming in Ruby and understand the Ruby
Enumerable Library reasonably well, you can skip this section.
C:\> irb
irb(main):001:0>
For brevity, I won’t write the full irb prompt every time.
You can execute Ruby statements line by line. The value returned by
each expression is preceded by ⇒.
irb> a = 4
=> 4
irb> a
=> 4
irb> a + 7
=> 11
You can put the code into a file called sample.rb, located in the same
directory or folder from which you ran irb.
1 [2,3,4,5].each do |n|
2 if n%2 == 0
3 puts "even"
4 else
5 puts "odd"
6 end
7 end
2
Chapter 1 Basic Ruby
You could also copy the code block from your text editor and paste it
directly into your command line and get the same result, as long as you use
only spaces for indentation. (Using tabs for indentation will work fine if
you load the file from the command prompt, but if you paste tabs directly
into irb, it will generate errors).
You can either type the code samples from this book into irb directly
or type them into a text editor and then load the file as just shown.
Object Scope
When you are in a Ruby program, the general method of executing a
method f on an object obj is as follows:
obj.f
3
Chapter 1 Basic Ruby
String
Strings are basic constructs in all languages. Let’s look at a few basic
operations used in this book. Try them out on the irb command line for
yourself.
length or size
This yields the size of the string.
downcase
This converts all letters to lowercase.
upcase
This converts all letters to uppercase.
capitalize
This capitalizes the first letter of a string.
split()
This searches a substring for the argument string
and splits the string into a array comprising
substrings on both sides of the split argument,
while the substring of the split argument is
discarded. If there are no matches, an array is
returned with the whole string:
irb> base_string = "abc def ghi"
irb> base_string.split(" ")
=> ["abc","def","ghi"]
irb> base_string.split(" ")
=> ["abc def","ghi"]
irb> base_string.split(" d")
=> ["abc","ef ghi"]
irb> base_string.split("efghi")
=> ["abc def ghi"]
4
Chapter 1 Basic Ruby
join()
string interpolation
5
Chapter 1 Basic Ruby
Array
Arrays in Ruby are like arrays in other languages. They are a collection of
things indexed by a whole number (e.g., 0,1,2,…). In Ruby, an array can
contain any Ruby object at an index. Array indices in Ruby start at 0.
Arrays implement the Ruby Enumerable interface, so they will have
key methods such as each, map, reduce, select, and others.
Special Methods
compact()
irb> [1,nil,2,nil,nil,3,nil,[]].compact
=> [1,2,3,[]]
flatten()
irb> [[1,[2,3]],4,[5,6]].flatten
=> [1,2,3,4,5,6]
push()
irb> [1,2,3,4,5].push(666)
=> [1,2,3,4,5,666]
6
Chapter 1 Basic Ruby
pop
unshift()
shift
7
Chapter 1 Basic Ruby
Hash
Another term for hash is an “associative array,” or even a “dictionary”,
Hashes are indexed by a key object, and there is a value (another object)
for each key object.
These are two ways of creating a new hash. The key of a hash can be
any object or symbol.
8
Chapter 1 Basic Ruby
=> ["The key is a and the value is 1", "The key is b and the
value is 2", "The key is c and the value is 3"]
Block-passing Syntax
Ruby is one of many languages that allow lexical closures, otherwise
known (kind of ) as anonymous functions or blocks. These functions are
dynamically created. The function can take the form of a defined function.
For example:
9
Chapter 1 Basic Ruby
Now, suppose you want to print each element of a range. You will call
each on the array, which will run the block passed to each for each element
of the array.
irb> (1..5).each(&printit)
1
2
3
4
5
=> (1..5)
You could also pass an actual block of code to run. The block is
surrounded by do and end or { and }. Objects between the vertical bars are
optionally passed to the block (depending on the definition of the block),
and they are used by the block to execute. The return value of a block is the
value of the last expression in the block.
10
Chapter 1 Basic Ruby
You will get the same output as earlier. Ditto for the following:
In Ruby, map, reduce, and select all take a code block as a parameter,
and the code block is executed as defined by the function. In this book,
I will use the do-end syntax most often, and sometimes the { } syntax.
1,John
2,Jack
3,Jim
4,Jared
5,John
irb> names.split("\n")
or
11
Chapter 1 Basic Ruby
irb> "John\r".chomp
=> "John"
irb> "John".chomp
=> "John"
So, for our array, just to ensure that we don’t pick up stray line feeds,
we do the following:
I assume that the examples in this book don’t use “\r\n”, but rather
just “\n”. If that doesn’t work on your operating system, use the chomp()
method as shown before working with the array.
12
CHAPTER 2
Function Overview
and Simple Examples
The Ruby library includes the module Enumerable. This library contains
map(), reduce(), select(), and other functions. This section will outline
the syntax and meanings of the different parts of code that use these three
functions.
If you can get through this section comfortably, both typing the code
into irb and understanding the results, then you will be in a good position
to deepen your understanding with the complex examples and reverse
engineering that follow in the next chapters.
M
ap
This function of the Ruby Enumerable library is simple but profound. The
map() method is applied to an array or a hash. The job of map() is to apply
a function or block to each member of the array and return a new array.
So, when you see
def f(x)
x*x
end
output_array =
[1,2,3,4,5].map do |number|
f(number)
end
you read, for each number in [1,2,3,4,5] apply f(x) to return the array
[f(1), f(2), f(3), f(4), f(5)]. In this case, the answer is [1,4,9,16,25].
One could encode it in traditional imperative programming as follows:
output_array = []
for number in 1..5
output_array.push( f(number) )
end
output_array =
[1,2,3,4,5].map do |number|
number*number
end
output_array =
[1,2,3,4,5].map{|element| element*element}
[1,4,9,16,25]
14
Chapter 2 Function Overview and Simple Examples
In this case, each “point” is a tuple (array) with an element and its
square. This returns the following:
[[1,1],[2,4],[3,9],[4,16],[5,25]]
The difference is that the block returns an array each time with the
number and its square, so the result is an array of arrays.
Since map returns an array, you can cascade map calls. For example,
you could have a map block square each element, and then a second map
block add 100. For example:
[1,2,3,4,5].map do |number|
number*number
end.map do |square|
square + 100
end
Reduce
This function of the Ruby Enumerable library is more complex than map()
and is quite powerful. The method is applied to a collection (for example,
an array or a hash). The job of reduce() is to apply a function cumulatively
to each member of the collection and then return an object (which could
be an array, a single value, a hash, or anything).
15
Chapter 2 Function Overview and Simple Examples
For example:
[1,2,3,4,5].reduce(0, :+)
This is like saying for each member of the list, add (:+) the member to
memo and save the memo for the next element. The initial value of memo is 0
(the first parameter). Another way to code it is as follows:
memo = 0
[1,2,3,4,5].each{|element| memo = memo.+(element)}
Or, you can pass reduce a block of code to run. The block comes after
the closing parenthesis and is surrounded by a do-end construct, or a {}
construct. The emitted variables are always the memo first and the element
second. (In this case, the initial value of memo is 33).
=> 48
(You don’t have to call them “memo” or “element,” but that is how they
behave). After each iteration, the memo takes the value of the last object in
the block. For example:
=> 77.7
This returned 77.7, because that was the last object in the block.
16
Chapter 2 Function Overview and Simple Examples
Another thing to remember is that the memo returned by the block has
to be of the same class as the memo emitted by the reduce function. For
example, when you are using reduce() to build a Hash object, you must
return the whole Hash object:
This worked because memo is a Hash class and was returned every time.
You can think of the reduce operation as operating on each element
and saving some kind of memo to carry forward to the operation on the
next element. In the preceding example, where you calculate the sum of
five numbers,
[1,2,3,4,5].reduce(0,:+)
or
17
Exploring the Variety of Random
Documents with Different Content
The Project Gutenberg eBook of The Yazoo
Mystery: A Novel
This ebook is for the use of anyone anywhere in the United States
and most other parts of the world at no cost and with almost no
restrictions whatsoever. You may copy it, give it away or re-use it
under the terms of the Project Gutenberg License included with this
ebook or online at www.gutenberg.org. If you are not located in the
United States, you will have to check the laws of the country where
you are located before using this eBook.
Language: English
Minor punctuation inconsistencies have been repaired. Variable spelling has been
retained. A list of the changes made can be found at the end of the book.
YAZOO MYSTERY
A Novel
BY
IRVING CRADDOCK
NEW YORK
Copyright, 1919, BY
BRITTON PUBLISHING COMPANY, INC.
MADE IN U.S.A.
CHAPTER I
The harbor-master entered briskly but dubiously the room of the
ship's first officer.
"What about the five men for the Domus?" he bellowed.
"All ready to sign, sir," assured the manager of the employment
agency, pointing toward two saddle colored negroes, a Spaniard,
and a limp figure half asleep, slouching in the corner on a narrow
bench, one hand clutching an expensive leather bag.
"It is the best I could do on such short notice," assured the agency
man in an undertone, noticing that the first officer's inventory was
not very encouraging.
"Get them up here to sign. We're anchored in the stream, losing two
thousand dollars every hour we stay here. We need five more
firemen—anything that looks human," he added impatiently,
spreading the ship's articles on the counter that reached across the
smelly water-front den.
"Come on and sign up, boys," said the agency man with assumed
good nature.
While the two negroes and the Spaniard were signing, the ship's first
officer went to the sleeping figure in the corner, took up his free
hand and felt of the palm, then dropped it disgustedly as he took the
man by the shoulders and shook him vigorously.
"Come on and sign up, Strong," he shouted into his ear.
Strong labored with himself, still holding to his bag, half staggered to
the counter and signed on the line indicated—"Hiram Strong, Jr."
The signature was plain and businesslike. Evidently the Candidate
had known better days.
"He's been kicked out or disowned," muttered the first officer to me
while he was signing up. "He won't be worth a cuss. Look—those
hands never did a lick of work—but he will fill the list," he added,
walking about nervously and sizing me up with apparent
approbation.
The agency man came up at once and held the pen towards me, and
without hesitation I signed "Ben Taylor" on the line beneath. While I
was thus engaged Hiram leaned against the counter weak and
listless, his bag between his feet. We had both signed as firemen or
stokers on the steamship Domus for a round trip to an unnamed
Gulf, or Mexican port.
Although pretty well awake by this time Strong did not resent my
taking his arm and helping him a bit. He made no comment at first,
but after he got used to the lively walk along the dock, he began to
show signs of saying something.
"Old pal," he began, without turning his head, "I—I've got a
headache—top's coming off—and my stomach is all jelly. It shakes
as I walk and makes me sick," he ended under his breath.
"You'll be all right after you get some sleep."
"Y-e-s—I think—I h-h-ope so——I've had an awful time—an awful
time, pardee—but this is my last—this is my last," he added, more to
himself.
His bloodless face and lips, pink lids and bloodshot eyes indicated a
disordered system urgently rebelling against recent abuses.
After we got aboard the harbor-master's tug, although very weak, he
refused to sit down. Noting that I had found a seat, he lurched over
to me.
"Old pal, everything looks yellow to me, even the sun looks yellow—
sort of faded. Does it look yellow to you?" he asked, blinking at the
clear setting sun, and although his power to realize was at low ebb,
he picked me out evidently as being different from the others. By
that act he exercised a discrimination that predestined an exciting
and almost unbelievable career.
"The sun looks all right to me," I told him, smiling up in sympathy.
"I guess it's me—it's terrible—but this is the last—I'm going to work
now. Little Hiram is going to work for the balance of his life—I got
to, that's all," he ended, with a dogged determination that I hoped
would survive after he recovered from his unsettled and polluted
condition. I steadied him a little when climbing the ladder from the
tug to the ship, which attention he seemed to appreciate.
"Old pal, I must go to bed. If I don't I will die," said he as we went
forward to the firemen's sleeping quarters. There he tumbled into a
lower bunk, not stopping to remove even the cheap cap he wore. In
an incredibly short time he was "dead to the world" and snoring at a
lively clip.
Upon returning to the deck I heard a loud grunt from the Siren and
at once the ship began to swing out into the stream, heading toward
the Statue of Liberty and that great sea beyond the Narrows.
The captain still leaned over the bridge, taking stock of his
nondescript crew of firemen that loitered about, forward. His bulk
evidenced a growing appetite and his almond shaped eyes
suggested the prenatal influence of a Chinaman. It was hard to
understand how so much tallow and bone, in a florid lumpy skin,
ever became master of a big ship. Such luggage as Hiram Strong, Jr.
and I had brought aboard might have told him a story, but he didn't
care; all he wanted was thirty-five human machines, capable of
shoveling coal—in four-hour shifts—in a temperature of a hundred
and twenty-five degrees. He knew that his ship was marked as a
"hell," and that no fireman would ship for a second trip.
While standing beside the rail and studying the retreating outlines of
Battery Park and its wonderful skyline, I was approached by the
firemen's mess steward, who wore a dirty white jacket and apron.
"I don't suppose that young feller will want anything to eat?"
"No—I guess sleep is better now," I replied, interpreting in his round
greasy face evident good-will.
"The firemen are eating and you had better go in," he said, but
seemingly in no hurry for me to tear myself away. The tip seemed a
good one, so I made an opening for a better acquaintance.
"Where are we bound, steward?"
"We're bound out and back to this port, but at how many places we
will call, God knows. I don't! When we start, lately, we never know
when we'll get back. Sometimes we call at Key West, and usually at
Galveston or New Orleans. Don't you know what you signed for?" he
asked, without surprise, but grinning significantly.
"Yes," I replied, hesitating somewhat. I wondered why he continued
to grin. Then he again asked:
"Are you coming down to mess yourself?"
"Yes, I will come right down."
Following him below, I crowded over on one of the nondescript crew
to a seat on the end of a bench at a narrow, bare table, and
received from the steward a half-gallon of thick soup dished up in an
enameled pan from a galvanized-iron wash-tub. Later I was supplied
from the same laundry utensil a liberal portion of what was intended
for a meat stew, and a war allowance of bread. I was wondering
how Hiram Strong, Jr., accustomed to uptown dining, would relish
this atmosphere with its filthy service and coarse food. The men
along the bench beside me consumed the soup noisily, like Bowery
bums, and bit from chunks of meat on the ends of their forks like
swine with their forefeet in a trough.
Sitting at one end, I was able to size up my fellow-firemen, twenty-
five of whom were devouring food with great relish as they
chattered like magpies, mostly in a foreign tongue. Negroes of all
shades, Mexicans, Poles, Italians, Greeks, all sweated out, thin and
bleached to the shade of a cadaver. I speculated again as to how
young Strong would mix with this motley crew, and why he had
allowed himself to choose stoking as a means of livelihood.
After eating I went below, but Strong had not moved and it seemed
that his thin white hands and expensive footwear were more out of
place than ever. I wondered if he had any money left. Usually were
to be found some light-fingered gentry among tramp-steamer
firemen, so I took a small chain and padlock from my bag and
chained his grip with mine to a bunk stanchion.
Returning to the deck, it was something of a shock to note the ship
in complete darkness, no light visible save the red and green signals
on either side. Later I learned that the globes were removed from
the passenger cabins to prevent even a flash from the rooms of any
one disinclined to obey "Lights out" at seven p. m. by order of the
Naval authorities.
After clearing Sandy Hook and rounding Scotland lightship, by
locating the North Star I saw that the skipper was heading a little
east of south against a sharp, cold wind, close in to the Jersey coast,
where lights were plainly visible. I was rather astonished to see all
lifeboats lowered from their davits to the level of the steerage deck,
and by edging down that way, saw they were provisioned with water,
biscuits, lanterns and all necessary equipment for immediate use.
Then I realized that young Strong had not only chosen an unusual
occupation but a rather unpropitious time in which to sign up for
duty on the high seas.
But with visions of four o'clock in the morning, the hour assigned us
to begin our work, I returned to the bunkroom to go to bed.
Hiram Strong had moved neither hand nor foot, but his breathing
was more normal. A dark blue light was the only illumination in the
place, giving to everything a mere shadowy appearance. I was glad
to notice that the place was well ventilated, fairly clean, and likely to
be free from vermin.
At three-thirty in the morning a heavy hand was laid on us, and we
were told to roll out to go on watch. To my surprise, young Strong
responded at once, with much yawning and stretching. Now and
then he would sigh deeply, ending in a sort of dismal moan, hard to
tell whether from resignation or abandon. He spoke for the first time
after I had tumbled out and had begun pulling on my shoes. He
seemed to recognize me in the uncertain light.
"Do we get anything to eat before we go to work?" he asked,
leaning against his bunk dressed in the correct street attire in which
he had slept.
"Yes, I think by going aft to the ship's kitchen we can get
something; coffee, anyhow," I replied, stripping down to my
underwear.
"Is that the way you go to work?" he asked, quickly noticing my
matter-of-fact preparations.
"Yes."
"Why?" he asked, surprised.
"Well, it's pretty hot down there; and besides, it's very dirty," I
replied, pleasantly but convincingly. "Shoes, pants and undershirt are
about all you can stand," I added.
I had to wait a while for him to remove all but those needful
garments before starting for the kitchen, there to find good hot
coffee and a dish of that same thick soup.
He followed my lead again, silently, deliberately drinking two cups of
coffee and eating the soup. Then it was time for us to go.
He negotiated the several narrow iron stairs leading down to the
boiler-room like a cat avoiding water, and looked ruefully at his
hands blackened by contact with the greasy handrail. A pink silk
undershirt and polished shoes contrasted strangely with the coarse,
black pull-on's and dingy brogans of those at work. He must have
noticed the contrast. Stripped, he showed a compact figure, with
good lung capacity and likely a good heart, that being an absolute
necessity in order to tolerate the extreme heat of a boiler-room.
The engineer on watch asked me if I had ever fired, as though
expecting an affirmative.
"Yes," I replied.
"But this young fellow is a 'greeny'?"
"Yes—I think so."
"You and him take the two end boilers on the left—they are as cool
as any—and give him a few tips, will you, till he gets his hand in?
Two hundred and eighty pounds on the gauge," he added, as a hint
to keep the dial at that notch. He then told Strong I would show him
what to do.
As we moved down over the piles of coal between a battery of
boilers facing the rather narrow corridor between them, Strong
remarked to me, "I'll do the best I can, sir!"
It did not seem so very hot when we first went in, but I noticed
there was only one ventilator, which came down about midway.
Strong followed me over to the end and watched me with interest
when I took the twelve-foot poker—a one-inch steel bar with a big
eye bent on one end and spatula shaped at the other—for the
purpose of freeing the clinkers from the grates before shaking them
down into the ash pan.
"I will clean your fire for you this time and you can see how it's
done," I suggested, and proceeded to do so. "You know, the first
thing you do when going on watch is to clean the fire, but it must be
done quickly to keep the steam from going down too much." He
listened attentively and good-naturedly, but still silent, as one about
to be initiated into a college fraternity and was waiting for something
to happen.
I handed him a scoop and told him to put in a half dozen scoop-
loads at a time and to be sure and get it well back on the grates. I
then proceeded to clean my own grate.
Taking up the scoop, he filled it brimful, and started for the furnace
door like a girl shoveling snow. He missed the narrow opening and
the coal fell off into the ashes. He did not swear as I had expected
but glanced sheepishly at me, then about him, to see if others
noticed it, but we were all too busy with our own back-breaking jobs
to pay heed to his worries.
Determined to be successful, he walked close to the furnace door,
exposing his face and hands to the glaring fire, and succeeded in
getting the next shovelful pretty well back on the grates. After
repeating this a half dozen times his face took on a "Turkey red" and
he puffed like a lizard.
After a few more trials and a little more instruction the novelty of
doing it well seemed to interest him, and two hours wore away. He
soon learned to watch the steam gauge above him and kept it
pointing at the requisite two hundred and eighty.
At the end of the shift he leaned heavily against the bulkhead next
to his furnace, panting like a race-horse. The perspiration rolled off
of him until even his well-tailored trousers were wet and his pink silk
undershirt a sight to behold. His face was the shade of pickled beets
mixed with coal dust, and his hands the color of the lobsters he was
accustomed to eat after midnight, his palms blistered and sore, from
the friction of the shovel handle.
His neat black shoes, now grimy and rough, were full of water and
pinched his feet. I did not give him the extra pair of soft cotton
flannel gloves I had brought along for him until he asked me where I
had got mine. Then I showed him how to cool off by standing under
the ventilator, for which he seemed very grateful. He looked
curiously at me, evidently discovering that he and I were the only
ones down in the furnace room not of a hardened class. He seemed
inclined to stay under the refreshing ventilator, and I noted the
hands of his steam gauge drop back to two hundred and seventy, so
I opened the door, cleaned the grates and spread over a fresh bed of
coal.
He came over while I was doing this, and I gave him some little
tricks on how to spread the fuel and not expose his hands and face
to the heat.
He seemed to appreciate this and surprised me by his cleverness in
making use of my tips. For a time he revived and I thought he was
going to pull through his first watch all right, but at the end of
another hour he became shaky on his legs, and his arms scarcely
supported the empty shovel. The intense heat and effort had a
telling effect on him and it did not surprise me when he toppled over
on the coal pile in a dead faint.
CHAPTER II
When Hiram Strong collapsed it did not surprise the other firemen. It
was not a rare occurrence for even seasoned firemen to faint. But it
did amaze the engine-room crew at the ease with which I took him
in my arms, for he weighed at least one hundred and sixty pounds. I
laid him down beneath the ventilator, where the others had prepared
a place for him. I then removed his cap and dashed a pail of cold
water over his face and chest, coal dust and dirt having washed up
in his black, wavy hair.
For the first time since I had met him I got a good look at the
youngster's face. Even during this temporary lapse the slightly
upturned corners of his mouth and the red of his lips showed,
lending the impression that he was about to break out into a sunny
smile. There was nothing about his features to indicate the
confirmed inebriate or debauchee. He had a good, honest ear, a
clean neck and a generous breadth of shoulder. After making sure of
his respiration and heart action, I returned to my post to feed his
furnace and mine. To maintain two hundred and eighty pounds of
steam on the gauge required constant, back-breaking shoveling. In a
few minutes both furnaces were roaring, with one blowing off a
notice to the engineer that, although one of the crew had fainted,
the boilers were hot.
It was perhaps a quarter of an hour before Strong raised himself to
a sitting posture and looked over toward me. He was dazed, and
blinked like an owl. I waved to him to stay where he was and rest.
For answer he made a "cat's cradle" by clasping his hands before his
knees, unmindful of the fact that he was seated in a pool of water
and saturated coal dust.
We evidently had a good head wind outside, for it rushed down
through the big ventilator as though driven by an exhaust fan, thus
rapidly reviving Strong. However, it would not be well for him to
remain in the draft too long, so I crossed over and helped him to
regain his feet. He reeled and stumbled as he walked back to his
station, which took grit, but there was no evidence of self-pity.
For the remainder of the watch Strong was unable to do much work.
First he tried to shovel coal, but found he couldn't lift it. However, he
insisted on staying around while I shoveled, occasionally opening
and closing the furnace doors. All the while he maintained his
attitude of silence, apparently taking it for granted that I understood
the situation and was willing to help him. At last the eight o'clock
relief crew came, and although still weak, he made the narrow iron
stair to the deck much easier than when he descended four hours
before. He was adapting himself to the conditions the best he could.
Strong soon washed up and donned clean wear, which seemed to
refresh him, but coal dust still showing about his eyes, ears and
brow gave him the appearance of an actor made up for his part. At
mess he devoured soup with relish, but when he tried the stew,
made up of overdone neck, cuts of fried beef and cold potatoes, he
tossed the pan and its contents overboard.
"I need sleep more than that stuff," he said, and straightway made
for his bunk.
Six hours later I found him standing beside me at the rail in the
waist of the ship and he appeared to be much improved. His fine
skin glowed, but his hands looked as though they had been
parboiled, with palms badly blistered. His trousers were dirty, dry,
stiff, baggy and wrinkled. On the upper part of his body he wore
nothing but a silk undershirt, and for his overworked feet he had
pulled on a pair of sandals.
It is quite as impossible to disguise a real man as it is for a make-
believe to pass himself off for a gentleman. Though unaware of how
to go about it, he began taking my measure quite as coldly as I was
his, after which he spoke his first connected words since we came
together.
"It was mighty decent of you to help me out last night," he said,
affably, holding a lighted cigarette contemplatively. Evidently his
decision favored me.
"Every one has to make a beginning; you did very well to stay there
during the whole of your first watch," said I, ignoring his thanks.
"Is it always as hot down there as it was last night?"
"Yes; sometimes more so. You see, last night we had a head wind."
"After my hands harden, and my stomach becomes accustomed to
the food, I guess I'll be able to stand it all right." As he said this he
looked at the palms of his hands ruefully. The backs were scarlet
and glossy.
"You can if you want to," I replied. "You have the build. The food is
coarse, but perhaps the best for that kind of work. Four hours is not
very long to stand anything; you have not worked lately?"
"Lately?—never!" Then as though frightened at my reference to his
past or even himself, he surprised me by asking, "How soon do we
eat again?—I believe I could eat some of that horse-meat now."
"You think it's horse-meat?"
"Well, if it's not horse-meat, it came off a bull just behind the horns.
However, my grates are clean and there's a good draft; I believe I
can get up steam on it now," he ended with a reckless laugh,
indicating that, although languid from his final fling in New York, he
had noted fully how to proceed with his work in the boiler-room.
"Perhaps by going back to the galley we can get a bite. It's nearly
two hours before we go on watch, but it's better to give the stomach
a chance before doing hard work," I suggested, leading the way to
that mysterious quarter of the ship where the cook is king.
This time we inherited mutton stew and the usual bread allowance,
which we ate as we sat on the edge of a hatch.
Looking across the water, I noted that we were still hugging shore,
but were now far enough south to be free from the chill November
winds of New York. We were now favored with a balmy, invigorating
breeze.
Strong's first question was not unexpected after he glanced at some
curious passengers on the deck above us, amused at our sumptuous
meal and manner of taking it.
"How do you happen among this gang?" he asked, laying his bread
allowance on the hatch and poising a knife and fork that came with
the ship direct from the builders twenty years before.
I looked at him squarely and knew I had to give a logical reply. His
straight nose showed the power of logical analysis. The thought
came to me that he had somehow robbed a marble image of
Cleopatra of its nose and clapped it on his own face. There could be
no question of his inherent refinement. Such a person one usually
answers civilly, though the questions be frivolous.
"Well, you see, in order to get a marine license you must do a
certain amount of sea duty in the fire room."
"Is a marine license so very desirable?"
"Chief engineer is a pretty good berth, especially now. Those
running in the war zone get good pay and a big bonus besides, you
know."
"Are we in the war zone?" he asked with some surprise.
"Yes—don't you see those lifeboats swung out? One of the firemen
told me last night that this line had lost two ships—both torpedoed."
"And I suppose the firemen get the worst of it on account of being
so far below?" he queried, glancing nervously at the dim shore line.
"Yes. Then, you know, there are supposed to be mines all along the
coast."
Without comment he gnawed the last piece of meat from the bone
and tossed the refuse overboard. Two young girls among the
passengers above giggled at that. Strong flushed, but gave no other
outward sign of annoyance.
"Then we are liable to be plugged any time?" he asked.
"Yes; there is a possibility."
"Well, if I get another dose like I got last night I believe I would
welcome it," he laughed, looking at his blistered hands.
"You will soon learn how to favor yourself, and the work won't be so
hard."
"But you say the men who do the actual work get the worst of
things."
"Yes—I think so. Firemen are the feet of the ship, you know."
"I think I was all feet last night," he replied, smiling dolefully. "I have
heard professors rant about the dignity of labor," he replied, arising
with the empty pan, having enjoyed the first full meal he had ever
actually earned. "However, I have signed for a round trip and I'm
going to stick if it kills me," he added, half to himself, as he went
below.
When he came on watch at four the fire of adventure had taken the
place of Hiram Strong's glassy stare of debauchery. He cleaned and
shook his grates without coaching, heaving the coal well back in the
fire-box. I knew that every bone and muscle of his body was crying
out in protest. Later I saw blood from the blisters show through the
cotton gloves, but he worked stolidly, silent and grim. Surely he was
game.
We were getting farther south, the wind coming hot and the boiler-
room an inferno. As Strong worked he perspired to the point of
melting. I saw him grit his teeth, determined not to show another
white feather, and when we were washing up at the end of that
four-hour watch, there was something of unction in his remark, to
himself: "Thank God, it didn't get me this time!" Sensibly he went to
his bunk without eating.
CHAPTER III
Our shift was off at eight p. m. with duty ahead at four o'clock in the
morning. But not feeling disposed to sleep just then, I began to
study our position. Twenty-four hours ago we had cleared Scotland
lightship, and I figured we were something like three hundred miles
south of New York, off the Virginia capes.
The ship, as on the previous night, was wrapped in complete
darkness as we emerged from the boiler-room, and I could just
make out the shadowy form of the officer on the bridge, who moved
about nervously. I glanced across the expanse of water but no light
could be seen in any direction. The only activity was the sounding
lead which was thrown overboard occasionally.
We still had the southern head wind which made it too hot for
sleeping below, so I decided to bunk on deck, and went below for a
blanket. Young Strong slept as though dead, even though the
quarters were close and stuffy. I was glad to escape to the deck with
my covering. As I laid down, expecting to doze off at once, I began
to hear subdued voices. I heard some one say: "You know, we
passed him this afternoon at three. He couldn't be over two hours
behind us." At first I wasn't sure I was awake, for the voices were
almost inaudible. I was sure I had slept some time.
"Did the wireless say all were taken off?"
I could now make out two officers talking near me, but they were
unaware of my proximity. Then came the answer to the question:
"Yes; the report came from the shore station where the lifeboats
landed, but if the subs are operating up there, we're probably safe."
Manifestly they referred to some ship that was torpedoed two or
three hours behind us.
"That's all right, but you know well enough that mines have been
sown here for the Chesapeake traffic."
"We're not due there yet, and it's a thousand-to-one shot that we'll
get by. We've passed that spot many times. I believe that talk about
mines is all bunk. Anyway, you know the Old Man changes his course
at that point to keep the supposed mine field shoreward. Go to bed:
you'll be bawled out quick enough if we hit anything."
Then all became quiet, but now thoroughly awakened, I went down
to the galley to cajole some food from the cook. There, to my
surprise, I found young Strong on the same errand.
"You had a good sleep?" was my greeting. I needn't have asked, for
he looked rested and bright, even jaunty.
"Five hours; it's past one now. Where did you sleep?—I did not see
you in your bunk." His voice sounded rather chummy, as the cook
relented and helped us liberally. We told him we had both gone off
watch without eating.
We took the food into the firemen's messroom, lighted by a single
dark blue bulb, and sat opposite each other, a long, narrow, oak
plank between us, picnic style. The cook enjoined us to shut the
door, to cover even the dim illumination. The closed windows of the
messroom were painted black so that not the slightest trace of light
could escape.
"How do you feel this morning?" I asked.
"I am surprised at how well I do feel. If it wasn't for my hands I
would feel fine," he replied cordially, sort of self-congratulatory, a
half smile creeping about his non-secretive mouth.
"Moisten the inside of your gloves with petroleum, and your hands
will soon heal if you are careful," I advised quietly. "The oilers will
give you some."
"It is the first time in my life that my system has had the nicotine
and other bug juices washed out of it; a cigarette tastes different
now," he exulted, though evidently looking for sympathy.
"Do you know," he continued, as he cornered a chunk of meat in the
bottom of the pan and tried to sever it with the ancient cutlery, "I
always thought I could work, and now I know it."
"Then this is really your maiden labor sweat?" I asked, seemingly
incredulous.
"Say," he began, still laboring with the meat, "I think this ship
bought a job lot of sheep, and there were some granddaddies in the
lot." I smiled an assent.
"If any one had told me a few days ago that I would be sitting on
board a ship before an oak plank, eating old ram with relish, and out
of a laundry vessel at that, I would have believed him insane."
I laughed outright and mumbled something about "crises in every
one's life."
"My crisis came, all right, the other day. It was like the sidewalk
coming up and hitting me in the face, it so upset me—oh, it was
terrible. I am surprised that I can talk about it so soon." There was a
ruefulness and disappointment in his tone.
I smiled encouragingly as he went on.
"I knew there was trouble ahead when the Governor called me into
his office—there always was—but I expected, as usual, to win him
over. I found for the first time why men called him a 'Gold-Beater.' I
sat across a long table from him, never before realizing how big a
man he was, his chest seemingly as broad as those of two ordinary
men. He wasn't mad, just cold and immovable. He gave me some
money and told me that was the last. I had to get out and work or
starve. What I decided to do did not interest him. He said he didn't
want to see me again and that he didn't care whether I went to hell
or to work." Strong spoke as one recalling a nightmare.
"I suppose you have not been able to figure out yet who is right?" I
asked.
"Oh, I think there is little doubt who is right, but just how long it will
take me to recognize the fact is the question. You see, the Governor
was never stingy or tight with me. That's why he was called a 'Gold-
Beater'; he has made money, but he owns the money instead of it
owning him—at least that's what his cronies say. And there's no
doubt about the fact that I should go to work, but in the two or
three days I have had to think about it I can't see why he waited so
long. It's downright wrong to allow a fellow to believe he's got
nothing to do but spend money and get into trouble for years at a
stretch, then stop everything all of a sudden. I think that's where the
Governor's wrong. But, you see, I can work, and I'm going to fool
the old man." Bending over toward me, he added, "But I don't know
how I would have come out on my first try if it hadn't been for you."
"Oh—I have done nothing but pass on to you what was done for me
when I started. Later on you will perhaps admit that men who work
with their hands, if approached right, are more kindly disposed and
even more generous than others. But I am glad you speak English,
to say nothing of finding a good fellow," I replied, approvingly.
"Well, I am not only glad to find some one who uses English, but,
like the kid I really am, I am glad you listen to me. I got such a jolt.
You see, it was the first time I ever felt the lash of the paternal whip,
and one or two cuts were enough. I now know why the Governor is
such a power among men—he does things so thoroughly and
quietly. There wasn't any row—he was ready for me and I don't
realize yet how well he prepared things, or how much he apparently
knows of my movements——" He hesitated with a sorrowful shake
of his head and resumed eating.
"You found he was checking you up pretty close?" said I, to urge him
on.
"He must have known just how many breaths I took. He said I was a
poor investment: that since my mother died when I was three I had
cost him about two hundred thousand, and he was closing out a
poor proposition. He informed me that I was to consider myself no
more a son of his; was even sorry I would have to use his name.
And the two thousand, his share of fixing up a man that I, and three
others, ran down in the park with an auto, was the last assessment
he would stand; and before I knew what was really happening I was
leaving without even a good-by. I knew I was going to work, but
thought I would have a last grand night and then pull out. But do
you know, that in less than an hour, wherever I went, every one
knew that Hiram Strong, Jr., had been disinherited and kicked out. I
then learned what New York thinks of a 'has-been.' I tried to drown
the thought in liquor, but it floated in spite of my most frantic efforts.
I guess there was a good deal of the last pickle in me when you saw
me first?"
I laughed and Strong continued:
"Oh, I'm going to beat it—I've got to beat it," he said, closing his
mouth savagely and tossing the empty pan down toward the other
end of the table. "I guess it's about time for us to go to hell, isn't it?"
he added, lighting a cigarette.
"Yes—all we need down in that hole is the boss with a pitch-fork tail;
we've got the shovel, coal and heat."
"Say, Ben—I believe I heard them call you Ben—do you think the
'Old Boy' with the forked tail gives his furnace men four hours on
and eight off, and great granddaddy sheep stew for eats and makes
'em sleep in tiers?" he asked, as we laughed our way to the boiler-
room.
CHAPTER IV
Hiram Strong was in need of oil for his gloves, and, left to myself, my
mind reverted to the conversation I had overheard between the
ship's officers. Shoreward, about a half-mile, I could make out a
lightship. Being somewhat familiar with the coast, I decided it must
be the Cape Charles light. As soon as we were abreast of it, our ship
changed its course several points to the west and seaward, just as
the officer said it would. I observed this and recalled the other
officer's cocksureness that the ship had been running by or through
the supposed mine field for months. Nevertheless I confessed to
myself a distinct feeling of anxiety as we went down into the region
Hiram had properly designated as "Hell," to begin another four-hour
draft on endurance and vitality. Though silent, Strong remained
cheerful and never for a moment allowed his steam gauge to drop.
The draft was good, making the work easier.
There is something about labor in intense heat that calls for silence,
but after an extended stillness there comes an oppressive feeling
that makes one want to break out into a yell. Often in a steel mill a
weird howl will be started by some one, to be taken up by others
until a bedlam is created among the thousands of workers. There is
a certain rhythm in it, a sort of boisterous chant, a good-natured
protest against conditions. Then, suddenly, it will die out just as
quickly as it started and quiet will reign for an hour or two.
Such a yell had been started by an Italian standing under the
ventilator. Then it was that I learned that Hiram Strong had a voice,
and although more than half our watch had passed, he felt vigorous
enough to join in the general outbreak.
As though in protest against the riotous exhibition, the engines
stopped, a circumstance that regular firemen secretly desire, for it
means a respite in their conflict with the blazing furnace and grates,
with the excitement of uncertainty added. The pause may continue
for a minute or an hour. At any rate the trouble in this case had been
shifted to the engine room.
Before the engines first stopped I thought I heard a noise, but it
wasn't loud enough to attract the attention of others, so concluded it
must have been a slight shift in the cargo near us and gave it no
further thought.
Hiram accompanied me to the far end of the furnace room for water,
after which we returned and sat down on the hot, iron-sheeted floor
against the bulkhead that flanked our station, from which point we
viewed the whole length of the narrow corridor between the battery
of blazing furnaces that generated the ship's power.
"Did you ever read Dante's Inferno?" he surprised me by asking.
"Yes, but not recently."
"A tutor made me read it as punishment. You know, I never would
study. I guess that's what makes the Governor so sore. I tried three
colleges and flunked. I was so infernally worthless that I wouldn't
even go in for athletics; but what I started to say was that I believe
Dante must have known about the furnace room of a steamship,
when the engines were at a standstill." He said all this with a sleepy
grin.
I could see what he meant. The engines had been stopped but a few
minutes when the entire fire-room crew succumbed to a lethargic
sleep. A serrated ridge of coal two feet high extended the entire
length of the room, on which they had disposed themselves in all
sorts of postures—some curled up like animals going into
hibernation, others sprawled out full length, and there were many
who lay as though stricken dead while in a reclining position. Most of
the crew who worked in overalls, with bodies bared above the waist,
black and grimy to the tousled hair now matted with sweat, laid
carelessly about as in death from convulsions. In some cases they
were in such a position that the fierce light from the cracks in the
furnace doors gave their faces a weird, deathly appearance, and
Welcome to our website – the ideal destination for book lovers and
knowledge seekers. With a mission to inspire endlessly, we offer a
vast collection of books, ranging from classic literary works to
specialized publications, self-development books, and children's
literature. Each book is a new journey of discovery, expanding
knowledge and enriching the soul of the reade
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com