Programming Kotlin Applications: Building Mobile and Server-Side Applications With Kotlin Brett Mclaughlinpdf Download
Programming Kotlin Applications: Building Mobile and Server-Side Applications With Kotlin Brett Mclaughlinpdf Download
https://ebookmass.com/product/programming-kotlin-applications-
building-mobile-and-server-side-applications-with-kotlin-brett-
mclaughlin/
https://ebookmass.com/product/frontend-development-with-javafx-and-
kotlin-build-state-of-the-art-kotlin-gui-applications-peter-spath/
https://ebookmass.com/product/beginning-kotlin-build-applications-
with-better-code-productivity-and-performance-ted-hagos/
https://ebookmass.com/product/pro-spring-6-with-kotlin-an-in-depth-
guide-to-using-kotlin-apis-in-spring-framework-6-1st-edition-peter-
spath/
https://ebookmass.com/product/mastering-functional-programming-with-
python-brett-neutreon/
Kotlin for Web Development and Kotlin Collections: A
Beginner's Odyssey in Web Development 2 Books in 1 Jp
Parker
https://ebookmass.com/product/kotlin-for-web-development-and-kotlin-
collections-a-beginners-odyssey-in-web-development-2-books-in-1-jp-
parker/
https://ebookmass.com/product/pro-kotlin-web-apps-from-scratch-august-
lilleaas/
https://ebookmass.com/product/hybrid-cloud-backup-for-dummies-veeam-
special-edition-brett-mclaughlin/
PROGRAMMING
KOTLIN® APPLICATIONS
INTRODUCTION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xxv
INDEX . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 339
Programming Kotlin® Applications
Programming Kotlin® Applications
BUILDING MOBILE AND SERVER-SIDE
APPLICATIONS WITH KOTLIN
Brett McLaughlin
Copyright © 2021 by John Wiley & Sons, Inc., Indianapolis, Indiana
ISBN: 978-1-119-69618-6
ISBN: 978-1-119-69616-2 (ebk)
ISBN: 978-1-119-69621-6 (ebk)
No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means,
electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of
the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923,
(978) 750-8400, fax (978) 646-8600. Requests to the Publisher for permission should be addressed to the Permissions
Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online
at www.wiley.com/go/permissions.
Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect
to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without
limitation warranties of fitness for a particular purpose. No warranty may be created or extended by sales or promotional
materials. The advice and strategies contained herein may not be suitable for every situation. This work is sold with the
understanding that the publisher is not engaged in rendering legal, accounting, or other professional services. If professional
assistance is required, the services of a competent professional person should be sought. Neither the publisher nor the author
shall be liable for damages arising herefrom. The fact that an organization or Web site is referred to in this work as a citation
and/or a potential source of further information does not mean that the author or the publisher endorses the information the
organization or Web site may provide or recommendations it may make. Further, readers should be aware that Internet Web
sites listed in this work may have changed or disappeared between when this work was written and when it is read.
For general information on our other products and services please contact our Customer Care Department within the United
States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002.
Wiley publishes in a variety of print and electronic formats and by print-on-demand. Some material included with standard
print versions of this book may not be included in e-books or in print-on-demand. If this book refers to media such as a CD
or DVD that is not included in the version you purchased, you may download this material at booksupport.wiley.
com. For more information about Wiley products, visit www.wiley.com.
Library of Congress Control Number: 2020947753
Trademarks: Wiley, the Wiley logo, Wrox, the Wrox logo, Programmer to Programmer, and related trade dress are
trademarks or registered trademarks of John Wiley & Sons, Inc. and/or its affiliates, in the United States and other
countries, and may not be used without written permission. Kotlin is a registered trademark of Kotlin Foundation. All other
trademarks are the property of their respective owners. John Wiley & Sons, Inc., is not associated with any product or
vendor mentioned in this book.
for Leigh, as always, my person
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
ABOUT THE AUTHOR
BRETT MCLAUGHLIN has been working and writing in the technology space for over 20 years. Today,
Brett’s focus is squarely on cloud and enterprise computing. He has quickly become a trusted name
in helping companies execute a migration to the cloud—and in particular Amazon Web Services—by
translating confusing cloud concepts into a clear executive-level vision. He spends his days working
with key decision makers who need to understand the cloud as well as leading and building teams of
developers and operators who must interact with the ever-changing cloud computing space. He has
most recently led large-scale cloud migrations for NASA’s Earth Science program and the RockCreek
Group’s financial platform. Brett is currently the Chief Technology Officer at Volusion, an ecommerce
platform provider.
ABOUT THE TECHNICAL EDITOR
JASON LEE is a software developer happily living in the middle of the heartland. He has over 23 years
of experience in a variety of languages, writing software running on mobile devices all the way up
to big iron. For the past 15+ years, he has worked in the Java/Jakarta EE space, working on applica-
tion servers, frameworks, and user-facing applications. These days, he spends his time working as a
backend engineer, primarily using Kotlin, building systems with frameworks like Quarkus and Spring
Boot. He is the author of Java 9 Programming Blueprints, a former Java User Group president, an
occasional conference speaker, and a blogger. In his spare time, he enjoys spending time with his wife
and two sons, reading, playing the bass guitar, and running. He can be found on Twitter at twitter
.com/jasondlee, and on his blog at jasondl.ee.
ACKNOWLEDGMENTS
I USED TO WATCH MOVIES AND STARE in amazement at the hundreds of names that scrolled by at
the end. How could so many people be involved in a single movie?
Then I wrote a book. Now I understand.
Carole Jelen is my agent at Waterside, and she replied to an email and picked up the phone at a time
when I really needed someone to help me find my way back into publishing. I’m incredibly grateful.
On the Wiley side, Brad Jones was more patient than he ever should have been. Thanks, Brad! Barath
Kumar Rajasekaran handled a million tiny details, and Pete Gaughan and Devon Lewis kept the train
on the tracks. Christine O’Connor handled production, and Jason Lee caught the technical mistakes
in the text that you wouldn’t want to stumble over. Seriously, Jason in particular made this a much
better book with his keen eye.
As usual, it’s an author’s family that pays the highest price. Long days, more than a few weekends and
evenings, and a constant support keep us going. My wife, Leigh, is the best, and my kids, Dean, Rob-
bie, and Addie, always make finishing one of these a joy.
Let’s do brunch, everyone! Mimosas and breakfast tacos are on me.
—Brett McLaughlin
CONTENTS
INTRODUCTION xxv
xvi
Contents
xvii
Contents
xviii
Visit https://ebookmass.com today to explore
a vast collection of ebooks across various
genres, available in popular formats like
PDF, EPUB, and MOBI, fully compatible with
all devices. Enjoy a seamless reading
experience and effortlessly download high-
quality materials in just a few simple steps.
Plus, don’t miss out on exciting offers that
let you access a wealth of knowledge at the
best prices!
Exploring the Variety of Random
Documents with Different Content
animal. The purchaser rides the mare about, and makes use of her
for war, the chace, and for his private journeys. If he make a razzia,
three-fourths of the plunder belong to himself, and one-fourth to his
partner. Should the mare be killed in war, in an expedition mutually
agreed upon, the loss falls upon them equally. But should death
overtake her at a fantasia, a wedding, or any other festival, the
purchaser is alone answerable—he has to make good 50 douros to
the vendor. If the animal, however, is killed in front of the tent,
suddenly, or under the horseman, while the latter is defending his
wife, his children, and his flocks,—the circumstances were beyond
his control, and he is not called upon for any reimbursement.
Should the mare produce a colt, it is reared until it is a year old,
when it is sold, and the proceeds equally divided between the
partners. On the other hand, if the mare has produced a filly, the
latter is valued when a year old, and the vendor has the privilege of
choosing the filly or the dam, paying or receiving the difference of
value. This sort of compact is never made with respect to horses.
An Arab who wishes to sell a horse will never consent to be the
first to name a price. Some one comes up and says: "Sell; thou wilt
gain." The vendor replies: "Buy; thou wilt gain."
"Speak thou first."
"No, speak thou."
"Was he purchased, or reared?"
"Reared in my tent, like one of my own children."
"What hast thou been offered for him?"
"I have been offered 100 douros."
"Sell him to me at that price—thou wilt gain. Tell me, then, what
thou asketh."
"See what is written with Allah."
"Come, let us drive away the previous bidder, and do thou take 10
douros over and above his offer."
"I accept. Take thy horse, and Allah grant thou mayst be
successful upon his back as many times as he has hairs upon it."
And should he be desirous to avoid all risk of future annoyance on
the subject of warranty, he adds in the presence of witnesses: "The
separation between us is from this very moment. Thou dost not
know me, and I have never seen thee."
It is not permitted to mount a horse for a trial until after the price
has been agreed upon. Nevertheless, before the bargain is
completely concluded the animal is tested against a horse that has a
certain local reputation. The mode of trial is somewhat singular. The
riders are barefooted, and are not allowed to touch their horse with
the heel during any part of the race.
Horses whose reputation is well established in the country are
never sold in the market-place. It is a positive insult to an Arab to
ask him, "wilt thou sell thy horse?" before he has made known his
intentions. "They must think me then in a miserable condition," he
will say, "that they should dare to make such a proposal to me."
Certain tribes are particularly addicted to traffic in horse-flesh. The
most noted of these Arab horse-dealers are the Beni-Addas. It is
said of them:
With others, horses are mere carrion,
With them, they are youthful brides:
With others, they are asleep,
With them, they dance.
I have stated that the Arab saddle furnishes the rider with such a
firm seat that he does not trouble himself at all about certain vices in
a horse that are apt to cause us uneasiness. I will therefore say a
few words on the subject, though it is one now familiar to every
body.
The Arab saddle consists of a wooden saddle-tree, surmounted in
front by a long kerbouss or pommel, and by a broad troussequin
behind, high enough to protect the loins. The whole is covered and
held together, without nails or pegs, by a plain camel's skin which
gives it great solidity. The bands rest on the animal's back, and are
broad and flat, with a proper regard for the freedom of the withers
and loins, and afford a roomy and commodious seat. This last is very
hard, and it requires long practice to get used to it. The chiefs cover
it with a woollen cushion; but the common horsemen make it a point
of honour to ride on the bare wood, pretending that the use of
cushions is excessive effeminacy, and by diminishing their points of
contact cannot fail to invite them to sleep during a long course, and
consequently expose them to injure their horses. This is all the more
meritorious that for the most part, and especially in summer they
ride without trousers or drawers.
The saddle-tree is concealed by a stara, or covering of red
morocco, without ornament, in the case of individuals who are poor
or not very well-to do; and by a ghrebaria, or covering of cloth or
scarlet velvet, embroidered with gold or silver thread, and
ornamented with fringes, in the case of rich people and chiefs. The
deïr, or breast-piece, is very broad and is placed like that of our
French saddle. Its extremities are provided with two strong buckles
of iron or chased silver, and are fastened to the saddle-tree by small
girth-leathers, so placed as to keep the saddle in its true position.
The Arabs will have nothing to do with a crupper. They say it
interferes with every forward movement by the restraint it imposes
on the animal. They use it only with bat mules and donkeys, and
even then they do not pass it under the tail.
The stirrups are broad and clumsy. Their lateral faces gradually
diminish so as to unite with the upper bar which supports the ring
for the stirrup-leathers. They are used very short, and the whole foot
is thrust into them, and thus shielded from balls or falls. These
stirrups are extremely painful for those who are not accustomed to
them, because in raising oneself on them the eye strikes against the
bone of the leg. After a time the skin hardens and an exostosis is
formed that destroys all sensibility. It is by these exostoses that a
horseman is distinguished from a foot-soldier, and so clearly, indeed,
that in the province of Oran a certain Bey, having resolved to inflict
an exemplary chastisement on a tribe that had revolted, put to
death all who fell into his hands, bearing these marks. He well knew
that his anger was vented only on the horsemen. The stirrups of
wealthy individuals are either plated or gilt, and in former times the
great Turkish officers had them made of solid silver or gold. The
stirrups are suspended by leathers placed behind the girth, which
are simply twisted straps of morocco or camel's skin—when doubled
seven or eight times, they are of great strength. The noble make
their stirrup-leathers of silken cord; but as these, let them be ever so
solid, will not suffice when going at a rapid pace with the whole
weight thrown upon the stirrups, they add what are called maoune,
or stirrup-holders.
By way of horse-cloths the Arabs make use of pieces of felt
fastened to the saddle, to allow of the operation of saddling being
quickly performed. They are seven in number, and dyed blue, red,
and yellow—the blue being uppermost. An eighth one is added, but
white and unattached, so that it can be washed and dried in the sun
if the horse has perspired much. When these pieces of felt are well
shaped, the different colours lying one over the other and slightly
projecting, form an ornament in very fair taste, while they preserve
the horse from wounds and sores. Care is taken that they should
partially cover the loins.
The saddle-girth is placed in front of the stirrups, and is narrower
than ours. The Arabs as a rule girth their horses loosely; and they
can do so without inconvenience, as their saddles never slip round.
The headstall of the bridle is very broad; blinkers are used, and
occasionally, but not often, a throat-band, loose and fastened to the
headband. The Arab of the Sahara, however, does not approve of it,
because if his horse, as may often happen, should be seized by the
bridle in a fight, it deprives him of his usual resource of slipping the
bridle over the head, and so escaping from the enemy, whose prize
is thus reduced to the bridle alone. The blinkers have the advantage
of preventing a horse from being disquieted by external objects, and
are perhaps partly the cause of his not fearing anything. The
headstall and the headband of the bridle are embroidered in silk for
the commonality, and in silver or gold for the rich. The bit is
attached to the bridle, and is never cleaned. The bars are broad,
short, straight, and fashioned à la Condé. The canons are flat, and
the curb is a circular ring fixed to the upper part of the mouth piece.
The Arab bit allows no liberty to the tongue, and its lever-arm is
much shorter than in a French bit: consequently, it is much less
severe than has been hitherto imagined. The advantage it offers in
wartime of being free from those curbs and hooks which are often
so difficult to replace, cannot be too highly appreciated.
The reins are long. Two knots are made in them, one at the length
whence a horse can be kept at a foot pace without impeding the
freedom of his movements, and the other at the point where
experience has shown that the horse, after shortening the muscles
of the neck for a gallop, begins to bear on the hand. They are held
very full, and at times used as a whip to quicken the animal. The
Arabs reject the snaffle as calculated to confuse a horse. Rarely
combatting with the sabre, they have never experienced the
necessity of it.
As with them the horse is constantly fastened by hobbles, the
Arabs do not understand the value of the halter which we employ.
They replace it by a goulada, a thick cord of silk or camel's hair, of a
more or less lively colour according to the coat of the animal. It is
passed round the neck, and from it are suspended small morocco
sachets, inclosing talismans that have the virtue of preserving from
the evil eye, of averting sickness, and of bringing success in war.
This goulada is, in the first place, an ornament, and, besides, it
serves to hold the horse by, when required. To take him by the
forelock to hold or lead him, as we do, is to dishonour him; for the
Prophet has said: "The good things of this world to the day of the
last judgment shall be suspended from the hairs that are between
the eyes of your horses."
The Arabs of the Sahara make use of a whip to correct a horse
when they are breaking him in, or to excite him in war or at the
chace. It is composed of five or six twisted leather thongs, attached
to a ring fixed to a bar of iron six or seven inches long, terminating
in another ring. To the latter is fastened the small leather thong that
is slipped over the wrist. Round the iron rod, but shorter by an inch,
is a hollow cylinder, also of iron, of a diameter that allows the rod to
play easily within it. The whip is used with all their might. It
punishes so severely that after a time it suffices to shake it in order
to make the animal dash forward at full speed—the noise made by
the cylinder coming in contact either with the rings or with the bar
that connects them, recalling to his memory the nearly similar sound
of the tekerbeâa.
In the desert the Arabs carry from the kerbouss of the saddle a
club a cubit in length, and terminating in a large knob garnished
with spikes. It is hung from the wrist by a leather thong. Some
replace this by a longer club terminating in a hook, for the purpose
of picking up booty from off the ground, without alighting from the
saddle. The latter is called el aâraya, or the despoiler. Neither the
Arbâ nor the Harrars would ever mount on horseback without one of
these clubs.
The spurs have only one spike, and are clumsy, solid, and long.
They are kept in their place by a simple leather strap crossed, and
are attached very loosely.
Every Arab carries as a complement of his equipment, suspended
from the kerbouss of his saddle, a kind of sabretache called djebira
or guerab. It contains several compartments, for the purpose of
carrying bread, biscuit, a mirror, soap, cartridges, shoes, a flint,
writing materials, etc., etc., according to the calling of the owner.
Some djebiras are extraordinary rich. I am convinced that the
sabretaches of our Hussars must have come to us from the East.
The common people on an expedition carry also suspended from the
troussequin of their saddle a kind of wallet, which they call
semmâte. They are shorter than ours, so as not to irritate the
animal's flanks.
With the exception of the great chiefs, the Arabs have no holsters
to their saddles. They carry their pistols in their girdles, or in a heart-
shaped case that rests on the left side, and is held in its place by a
leather strap over the shoulder and another round the body. They
prefer this latter mode, because they are sure of having them on
their person if they chance to be separated from their horse.
Those who do not put a throat-band to their bridle generally adorn
their horses with boar's tusks or lion's teeth, or with talismans which
they attach to their necks by means of silk or woollen cords.
To our taste, the less covered a thoroughbred horse may be, the
better are the beauty and elegance of his form displayed. The Arabs
think differently. They say:
Kohol[51] embellishes the bearer of babes,
A tribe embellishes a defile,
And the saddle embellishes horses.
ebookmasss.com