100% found this document useful (1 vote)
23 views

Download Complete Introducing .NET MAUI: Build and Deploy Cross-platform Applications Using C# and .NET Multi-platform App UI 1st Edition Shaun Lawrence PDF for All Chapters

The document provides information about various eBooks available for download on ebookmass.com, including titles related to .NET MAUI, Google Cloud Platform, and programming with C#. It includes links to specific books, their authors, and a brief overview of their contents. Additionally, it mentions the availability of instant digital products in multiple formats and outlines the copyright and distribution details for the publications.

Uploaded by

oleasismanip
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
23 views

Download Complete Introducing .NET MAUI: Build and Deploy Cross-platform Applications Using C# and .NET Multi-platform App UI 1st Edition Shaun Lawrence PDF for All Chapters

The document provides information about various eBooks available for download on ebookmass.com, including titles related to .NET MAUI, Google Cloud Platform, and programming with C#. It includes links to specific books, their authors, and a brief overview of their contents. Additionally, it mentions the availability of instant digital products in multiple formats and outlines the copyright and distribution details for the publications.

Uploaded by

oleasismanip
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 41

Download the Full Ebook and Access More Features - ebookmass.

com

Introducing .NET MAUI: Build and Deploy Cross-


platform Applications Using C# and .NET Multi-
platform App UI 1st Edition Shaun Lawrence

https://ebookmass.com/product/introducing-net-maui-build-
and-deploy-cross-platform-applications-using-c-and-net-
multi-platform-app-ui-1st-edition-shaun-lawrence/

OR CLICK HERE

DOWLOAD NOW

Download more ebook instantly today at https://ebookmass.com


Instant digital products (PDF, ePub, MOBI) ready for you
Download now and discover formats that fit your needs...

Designing Applications for Google Cloud Platform: Create


and Deploy Applications Using Java Ashutosh Shashi

https://ebookmass.com/product/designing-applications-for-google-cloud-
platform-create-and-deploy-applications-using-java-ashutosh-shashi/

ebookmass.com

Simple and Efficient Programming with C#: Skills to Build


Applications with Visual Studio and .NET 2nd Edition
Vaskaran Sarcar
https://ebookmass.com/product/simple-and-efficient-programming-with-c-
skills-to-build-applications-with-visual-studio-and-net-2nd-edition-
vaskaran-sarcar/
ebookmass.com

Simple and Efficient Programming with C# : Skills to Build


Applications with Visual Studio and .NET 2nd Edition
Vaskaran Sarcar
https://ebookmass.com/product/simple-and-efficient-programming-with-c-
skills-to-build-applications-with-visual-studio-and-net-2nd-edition-
vaskaran-sarcar-2/
ebookmass.com

Harlem: NOLA Rebels MC (Book 4) (NOLA Rebels MC (New


Orleans Series)) Mackenzy Fox

https://ebookmass.com/product/harlem-nola-rebels-mc-book-4-nola-
rebels-mc-new-orleans-series-mackenzy-fox/

ebookmass.com
Re-Imagining Creative Cities in Twenty-First Century Asia
1st ed. Edition Xin Gu

https://ebookmass.com/product/re-imagining-creative-cities-in-twenty-
first-century-asia-1st-ed-edition-xin-gu/

ebookmass.com

College accounting : a contemporary approach Fourth


Edition M David Haddock

https://ebookmass.com/product/college-accounting-a-contemporary-
approach-fourth-edition-m-david-haddock/

ebookmass.com

Medical Surgical Nursing E Book: Concepts for


Interprofessional Collaborative Care 9th Edition, (Ebook
PDF)
https://ebookmass.com/product/medical-surgical-nursing-e-book-
concepts-for-interprofessional-collaborative-care-9th-edition-ebook-
pdf/
ebookmass.com

An Illustrated Guide to Pruning

https://ebookmass.com/product/an-illustrated-guide-to-pruning/

ebookmass.com

Essentials of Strength Training and Conditioning 4th


Edition – Ebook PDF Version

https://ebookmass.com/product/essentials-of-strength-training-and-
conditioning-4th-edition-ebook-pdf-version/

ebookmass.com
McGraw-Hill Education 6 SAT Practice Tests 5th Edition
Christopher Black

https://ebookmass.com/product/mcgraw-hill-education-6-sat-practice-
tests-5th-edition-christopher-black/

ebookmass.com
Introducing
.NET MAUI
Build and Deploy
Cross-­platform Applications
Using C# and .NET
Multi-platform App UI

Shaun Lawrence
Introducing .NET MAUI: Build and Deploy Cross-platform Applications
Using C# and .NET Multi-platform App UI
Shaun Lawrence
St Ives, UK

ISBN-13 (pbk): 978-1-4842-9233-4 ISBN-13 (electronic): 978-1-4842-9234-1


https://doi.org/10.1007/978-1-4842-9234-1

Copyright © 2023 by Shaun Lawrence


This work is subject to copyright. All rights are reserved by the Publisher, whether the whole or
part of the material is concerned, specifically the rights of translation, reprinting, reuse of
illustrations, recitation, broadcasting, reproduction on microfilms or in any other physical way,
and transmission or information storage and retrieval, electronic adaptation, computer software,
or by similar or dissimilar methodology now known or hereafter developed.
Trademarked names, logos, and images may appear in this book. Rather than use a trademark
symbol with every occurrence of a trademarked name, logo, or image we use the names, logos,
and images only in an editorial fashion and to the benefit of the trademark owner, with no
intention of infringement of the trademark.
The use in this publication of trade names, trademarks, service marks, and similar terms, even if
they are not identified as such, is not to be taken as an expression of opinion as to whether or not
they are subject to proprietary rights.
While the advice and information in this book are believed to be true and accurate at the date of
publication, neither the authors nor the editors nor the publisher can accept any legal
responsibility for any errors or omissions that may be made. The publisher makes no warranty,
express or implied, with respect to the material contained herein.
Managing Director, Apress Media LLC: Welmoed Spahr
Acquisitions Editor: Joan Murray
Development Editor: Laura Berendson
Editorial Assistant: Gryffin Winkler
Copy Editor: Mary Behr
Cover image designed by mrsiraphol through Freepik (www.freepik.com)
Distributed to the book trade worldwide by Springer Science+Business Media LLC, 1 New York
Plaza, Suite 4600, New York, NY 10004. Phone 1-800-SPRINGER, fax (201) 348-4505, e-mail
orders-ny@springer-sbm.com, or visit www.springeronline.com. Apress Media, LLC is a
California LLC and the sole member (owner) is Springer Science + Business Media Finance Inc
(SSBM Finance Inc). SSBM Finance Inc is a Delaware corporation.
For information on translations, please e-mail booktranslations@springernature.com; for reprint,
paperback, or audio rights, please e-mail bookpermissions@springernature.com.
Apress titles may be purchased in bulk for academic, corporate, or promotional use. eBook
versions and licenses are also available for most titles. For more information, reference our
Print and eBook Bulk Sales web page at www.apress.com/bulk-sales.
Any source code or other supplementary material referenced by the author in this book is
available to readers on GitHub using this link: https://github.com/Apress/Introducing-MAUI.
Printed on acid-free paper
Table of Contents
About the Author��������������������������������������������������������������������������������xv

About the Technical Reviewer����������������������������������������������������������xvii

Acknowledgments�����������������������������������������������������������������������������xix

Introduction���������������������������������������������������������������������������������������xxi

Part I: Getting to Know .NET MAUI�����������������������������������������������1


Chapter 1: Introduction to .NET MAUI���������������������������������������������������3
What is .NET MAUI?����������������������������������������������������������������������������������������������3
Digging a Bit Deeper����������������������������������������������������������������������������������������5
Where Did It Come From?��������������������������������������������������������������������������������6
How It Differs From the Competition���������������������������������������������������������������7
Why Use .NET MAUI?���������������������������������������������������������������������������������������������8
Supported Platforms����������������������������������������������������������������������������������������8
Code Sharing���������������������������������������������������������������������������������������������������9
Developer Freedom���������������������������������������������������������������������������������������10
Community����������������������������������������������������������������������������������������������������10
Fast Development Cycle��������������������������������������������������������������������������������10
Performance��������������������������������������������������������������������������������������������������11
Strong Commercial Offerings������������������������������������������������������������������������12

iii
Table of Contents

Limitations of .NET MAUI������������������������������������������������������������������������������������13


No Web Assembly (WASM) Support���������������������������������������������������������������13
No Camera API�����������������������������������������������������������������������������������������������13
Apps Won’t Look Identical on Each Platform�������������������������������������������������14
Lack of Media Playback Out of the Box���������������������������������������������������������14
The Glass Is Half Full, Though�����������������������������������������������������������������������������14
How to Build .NET MAUI Applications������������������������������������������������������������������15
Visual Studio��������������������������������������������������������������������������������������������������15
Summary������������������������������������������������������������������������������������������������������������17

Chapter 2: Building Our First application�������������������������������������������19


Setting Up Your Environment������������������������������������������������������������������������������19
macOS�����������������������������������������������������������������������������������������������������������19
Windows��������������������������������������������������������������������������������������������������������27
Visual Studio to macOS���������������������������������������������������������������������������������28
Troubleshooting Installation Issues���������������������������������������������������������������������32
.NET MAUI Workload Is Missing���������������������������������������������������������������������32
Creating Your First Application����������������������������������������������������������������������������33
Creating in Visual Studio�������������������������������������������������������������������������������33
Creating in the Command Line����������������������������������������������������������������������37
Building and Running Your First Application�������������������������������������������������������38
Getting to Know Your Application������������������������������������������������������������������������41
WidgetBoard��������������������������������������������������������������������������������������������������41
Summary������������������������������������������������������������������������������������������������������������42
Source Code��������������������������������������������������������������������������������������������������43

iv
Table of Contents

Chapter 3: The Fundamentals of .NET MAUI���������������������������������������45


Project Structure�������������������������������������������������������������������������������������������������45
/Platforms/ Folder������������������������������������������������������������������������������������������48
/Resources/ Folder����������������������������������������������������������������������������������������51
Where To Begin?�������������������������������������������������������������������������������������������������56
Generic Host Builder�������������������������������������������������������������������������������������������56
What Is Dependency Injection?���������������������������������������������������������������������57
Registering Dependencies�����������������������������������������������������������������������������60
Application Lifecycle�������������������������������������������������������������������������������������������62
Application States�����������������������������������������������������������������������������������������62
Lifecycle Events���������������������������������������������������������������������������������������������64
Handling Lifecycle Events������������������������������������������������������������������������������65
Cross-Platform Mappings to Platform Lifecycle Events��������������������������������66
Platform-Specific Lifecycle Events����������������������������������������������������������������67
Summary������������������������������������������������������������������������������������������������������������72

Chapter 4: An Architecture to Suit You�����������������������������������������������75


A Measuring Stick�����������������������������������������������������������������������������������������������75
Prerequisites�������������������������������������������������������������������������������������������������������76
Model View ViewModel (MVVM)��������������������������������������������������������������������������77
Model�������������������������������������������������������������������������������������������������������������78
View���������������������������������������������������������������������������������������������������������������79
ViewModel�����������������������������������������������������������������������������������������������������80
Model View Update (MVU)�����������������������������������������������������������������������������������83
Getting Started with Comet���������������������������������������������������������������������������84
Adding Your MVU Implementation�����������������������������������������������������������������84

v
Table of Contents

XAML vs. C# Markup�������������������������������������������������������������������������������������������86


Plain C#���������������������������������������������������������������������������������������������������������87
C# Markup�����������������������������������������������������������������������������������������������������88
Chosen Architecture for This Book����������������������������������������������������������������������89
Adding the ViewModels���������������������������������������������������������������������������������90
Adding Views�������������������������������������������������������������������������������������������������96
Viewing Your Widget��������������������������������������������������������������������������������������99
MVVM Enhancements����������������������������������������������������������������������������������101
Summary����������������������������������������������������������������������������������������������������������105
Source Code������������������������������������������������������������������������������������������������107

Part II: User Interface��������������������������������������������������������������109


Chapter 5: User Interface Essentials������������������������������������������������111
Prerequisites�����������������������������������������������������������������������������������������������������111
Models���������������������������������������������������������������������������������������������������������111
Pages�����������������������������������������������������������������������������������������������������������113
ViewModels�������������������������������������������������������������������������������������������������114
App Icons����������������������������������������������������������������������������������������������������������116
Adding Your Own Icon����������������������������������������������������������������������������������116
Platform Differences������������������������������������������������������������������������������������117
Splash Screen���������������������������������������������������������������������������������������������������118
XAML�����������������������������������������������������������������������������������������������������������������119
Dissecting a XAML File��������������������������������������������������������������������������������120
Building Your First XAML Page��������������������������������������������������������������������122
Layouts�������������������������������������������������������������������������������������������������������������124
AbsoluteLayout��������������������������������������������������������������������������������������������124
FlexLayout���������������������������������������������������������������������������������������������������126
Grid��������������������������������������������������������������������������������������������������������������128
HorizontalStackLayout���������������������������������������������������������������������������������131
vi
Table of Contents

VerticalStackLayout�������������������������������������������������������������������������������������132
Data Binding�����������������������������������������������������������������������������������������������������135
Binding��������������������������������������������������������������������������������������������������������136
Applying the Remaining Bindings����������������������������������������������������������������140
MultiBinding������������������������������������������������������������������������������������������������141
Command����������������������������������������������������������������������������������������������������144
Compiled Bindings���������������������������������������������������������������������������������������147
Shell������������������������������������������������������������������������������������������������������������������148
ShellContent������������������������������������������������������������������������������������������������149
Navigation���������������������������������������������������������������������������������������������������150
Flyout�����������������������������������������������������������������������������������������������������������154
Tabs�������������������������������������������������������������������������������������������������������������160
Search���������������������������������������������������������������������������������������������������������160
Taking Your Application for a Spin���������������������������������������������������������������������161
Summary����������������������������������������������������������������������������������������������������������163
Source Code������������������������������������������������������������������������������������������������164
Extra Assignment����������������������������������������������������������������������������������������������164

Chapter 6: Creating Our Own Layout������������������������������������������������165


Placeholder�������������������������������������������������������������������������������������������������������166
ILayoutManager������������������������������������������������������������������������������������������������168
BoardLayout������������������������������������������������������������������������������������������������������169
BoardLayout.xaml����������������������������������������������������������������������������������������169
BoardLayout.xaml.cs�����������������������������������������������������������������������������������172
FixedLayoutManager�����������������������������������������������������������������������������������������177
Accepting the Number of Rows and Columns for a Board��������������������������179
Providing Tap/Click Support Through a Command��������������������������������������181
Building the Board Layout���������������������������������������������������������������������������182
Setting the Correct Row/Column Position for Each Widget�������������������������185

vii
Table of Contents

Using Your Layout���������������������������������������������������������������������������������������������187


Adding a Factory That Will Create Instances of Your Widgets���������������������187
WidgetTemplateSelector������������������������������������������������������������������������������193
Updating FixedBoardPageViewModel����������������������������������������������������������194
Finally Using the Layout������������������������������������������������������������������������������196
Summary����������������������������������������������������������������������������������������������������������197
Source Code������������������������������������������������������������������������������������������������198
Extra Assignment����������������������������������������������������������������������������������������������198

Chapter 7: Accessibility��������������������������������������������������������������������199
What Is Accessibility?���������������������������������������������������������������������������������������199
Why Make Your Applications Accessible?���������������������������������������������������������200
What to Consider When Making Your Applications Accessible��������������������������200
How to Make Your Application Accessible��������������������������������������������������������201
Screen Reader Support�������������������������������������������������������������������������������201
Suitable Contrast�����������������������������������������������������������������������������������������208
Dynamic Text Sizing�������������������������������������������������������������������������������������210
Testing Your Application’s Accessibility�������������������������������������������������������������215
Android��������������������������������������������������������������������������������������������������������215
iOS���������������������������������������������������������������������������������������������������������������215
macOS���������������������������������������������������������������������������������������������������������216
Windows������������������������������������������������������������������������������������������������������216
Accessibility Checklist��������������������������������������������������������������������������������������216
Summary����������������������������������������������������������������������������������������������������������218
Source Code������������������������������������������������������������������������������������������������219
Extra Assignment����������������������������������������������������������������������������������������������219

viii
Table of Contents

Chapter 8: Advanced UI Concepts�����������������������������������������������������221


Adding the Ability to Add a Widget to a Board���������������������������������������������������221
Possible Ways of Achieving Your Goal���������������������������������������������������������222
The Chosen Approach����������������������������������������������������������������������������������224
Styling���������������������������������������������������������������������������������������������������������������230
Examining the Default Styles�����������������������������������������������������������������������232
Creating a Style�������������������������������������������������������������������������������������������234
AppThemeBinding���������������������������������������������������������������������������������������236
Further Reading�������������������������������������������������������������������������������������������236
Triggers�������������������������������������������������������������������������������������������������������������237
Creating a DataTrigger���������������������������������������������������������������������������������238
EnterActions and ExitActions�����������������������������������������������������������������������239
Creating a TriggerAction������������������������������������������������������������������������������240
Further Reading�������������������������������������������������������������������������������������������242
Animations���������������������������������������������������������������������������������������������������242
Basic Animations�����������������������������������������������������������������������������������������243
Combining Basic Animations�����������������������������������������������������������������������245
Cancelling Animations���������������������������������������������������������������������������������246
Easings��������������������������������������������������������������������������������������������������������246
Complex Animations������������������������������������������������������������������������������������247
Combining Triggers and Animations�����������������������������������������������������������������252
Summary����������������������������������������������������������������������������������������������������������254
Source Code������������������������������������������������������������������������������������������������255
Extra Assignment����������������������������������������������������������������������������������������������255
Animate the BoxView Overlay����������������������������������������������������������������������255
Animate the New Widget�����������������������������������������������������������������������������255

ix
Table of Contents

Part III: Behind the Scenes������������������������������������������������������257


Chapter 9: Local Data�����������������������������������������������������������������������259
What Is Local Data?������������������������������������������������������������������������������������������259
File System�������������������������������������������������������������������������������������������������������260
Cache Directory�������������������������������������������������������������������������������������������260
App Data Directory��������������������������������������������������������������������������������������261
Database�����������������������������������������������������������������������������������������������������������261
Repository Pattern���������������������������������������������������������������������������������������262
SQLite����������������������������������������������������������������������������������������������������������270
LiteDB����������������������������������������������������������������������������������������������������������278
Database Summary�������������������������������������������������������������������������������������285
Application Settings (Preferences)��������������������������������������������������������������������285
What Can Be Stored in Preferences?����������������������������������������������������������286
Setting a Value in Preferences��������������������������������������������������������������������286
Getting a Value in Preferences��������������������������������������������������������������������288
Checking if a Key Exists in Preferences������������������������������������������������������290
Removing a Preference�������������������������������������������������������������������������������291
Secure Storage�������������������������������������������������������������������������������������������������291
Storing a Value Securely������������������������������������������������������������������������������291
Reading a Secure Value�������������������������������������������������������������������������������292
Removing a Secure Value����������������������������������������������������������������������������292
Platform specifics����������������������������������������������������������������������������������������293
Viewing the Result��������������������������������������������������������������������������������������������295
Summary����������������������������������������������������������������������������������������������������������296
Source Code������������������������������������������������������������������������������������������������297
Extra Assignment����������������������������������������������������������������������������������������������297

x
Table of Contents

Chapter 10: Remote Data������������������������������������������������������������������299


What Is Remote Data?��������������������������������������������������������������������������������������299
Considerations When Handling Remote Data����������������������������������������������300
Webservices������������������������������������������������������������������������������������������������������302
The Open Weather API���������������������������������������������������������������������������������302
Adding Some State��������������������������������������������������������������������������������������319
Simplifying Webservice Access������������������������������������������������������������������������326
Prebuilt Libraries�����������������������������������������������������������������������������������������327
Code Generation Libraries���������������������������������������������������������������������������327
Further Reading������������������������������������������������������������������������������������������������329
Polly�������������������������������������������������������������������������������������������������������������329
StateContainer from CommunityToolkit.Maui����������������������������������������������330
Summary����������������������������������������������������������������������������������������������������������330
Source Code������������������������������������������������������������������������������������������������331
Extra Assignment����������������������������������������������������������������������������������������������331
TODO Widget������������������������������������������������������������������������������������������������331
Quote of the Day Widget������������������������������������������������������������������������������332
NASA Space Image of the Day Widget���������������������������������������������������������332

Part IV: Utilizing the platforms������������������������������������������������333


Chapter 11: Getting Specific�������������������������������������������������������������335
.NET MAUI Essentials����������������������������������������������������������������������������������������335
Permissions�������������������������������������������������������������������������������������������������336
Using the Geolocation API����������������������������������������������������������������������������341
Configuring Platform-Specific Components������������������������������������������������346
Platform-Specific API Access����������������������������������������������������������������������������352
Platform-Specific Code with Compiler Directives���������������������������������������352
Platform-Specific Code in Platform Folders������������������������������������������������354

xi
Table of Contents

Overriding the Platform-Specific UI������������������������������������������������������������������355


OnPlatform��������������������������������������������������������������������������������������������������355
Handlers������������������������������������������������������������������������������������������������������358
Summary����������������������������������������������������������������������������������������������������������361
Source Code������������������������������������������������������������������������������������������������362
Extra Assignment����������������������������������������������������������������������������������������������362
Barometer Widget����������������������������������������������������������������������������������������362
Geocoding Lookup���������������������������������������������������������������������������������������363

Chapter 12: Testing���������������������������������������������������������������������������365


Unit Testing�������������������������������������������������������������������������������������������������������365
Unit Testing in .NET MAUI����������������������������������������������������������������������������366
Adding Your Own Unit Tests�������������������������������������������������������������������������368
Testing Your View Models����������������������������������������������������������������������������372
Testing Asynchronous Operations���������������������������������������������������������������374
Testing Your Views���������������������������������������������������������������������������������������380
Device Testing���������������������������������������������������������������������������������������������������382
Creating a Device Test Project���������������������������������������������������������������������383
Adding a Device-Specific Test���������������������������������������������������������������������383
Running Device-Specific Tests��������������������������������������������������������������������384
Snapshot Testing�����������������������������������������������������������������������������������������������386
Snapshot Testing Your Application���������������������������������������������������������������387
Passing Thoughts����������������������������������������������������������������������������������������390
Looking to the Future����������������������������������������������������������������������������������������390
Summary����������������������������������������������������������������������������������������������������������391
Source Code������������������������������������������������������������������������������������������������391

xii
Table of Contents

Chapter 13: Lets Get Graphical���������������������������������������������������������393


.NET MAUI Graphics������������������������������������������������������������������������������������������393
Drawing on the Screen��������������������������������������������������������������������������������394
Further Reading�������������������������������������������������������������������������������������������397
Building a Sketch Widget����������������������������������������������������������������������������������397
Creating the SketchWidgetViewModel��������������������������������������������������������397
Representing a User Interaction������������������������������������������������������������������398
Creating the SketchWidgetView������������������������������������������������������������������399
Registering Your Widget������������������������������������������������������������������������������404
Taking Your Widget for a Test Draw�������������������������������������������������������������404
Summary����������������������������������������������������������������������������������������������������������405
Source Code������������������������������������������������������������������������������������������������405
Extra Assignment����������������������������������������������������������������������������������������������406

Part V: Finishing Our Application���������������������������������������������407


Chapter 14: Releasing Our Application���������������������������������������������409
Distributing Your Application�����������������������������������������������������������������������������409
Android��������������������������������������������������������������������������������������������������������410
iOS���������������������������������������������������������������������������������������������������������������412
macOS���������������������������������������������������������������������������������������������������������415
Windows������������������������������������������������������������������������������������������������������416
Things to Consider��������������������������������������������������������������������������������������������416
Following Good Practices����������������������������������������������������������������������������416
Performance������������������������������������������������������������������������������������������������418
Linking���������������������������������������������������������������������������������������������������������421
Crashes/Analytics����������������������������������������������������������������������������������������422
Obfuscation�������������������������������������������������������������������������������������������������424
Distributing Test Versions����������������������������������������������������������������������������������426
Summary����������������������������������������������������������������������������������������������������������427
xiii
Table of Contents

Chapter 15: Conclusion���������������������������������������������������������������������429


Looking at the Final Product�����������������������������������������������������������������������������429
Taking the Project Further���������������������������������������������������������������������������431
Useful Resources����������������������������������������������������������������������������������������������432
StackOverflow���������������������������������������������������������������������������������������������433
GitHub����������������������������������������������������������������������������������������������������������433
YouTube�������������������������������������������������������������������������������������������������������433
Social Media������������������������������������������������������������������������������������������������434
Yet More Goodness��������������������������������������������������������������������������������������434
Looking Forward�����������������������������������������������������������������������������������������������434
Upgrading from Xamarin.Forms������������������������������������������������������������������435
Comet����������������������������������������������������������������������������������������������������������435
Testing���������������������������������������������������������������������������������������������������������436

Index�������������������������������������������������������������������������������������������������437

xiv
Another Random Document on
Scribd Without Any Related Topics
salutation even to their own fathers, when they draw their sabres in
action, wound the heads of their own horses, and thus cover
themselves and their beasts with blood; this awkwardness of theirs
cause those who see it to utter ejaculations of surprise. In short, it is
evident to men of understanding, that as the talents of reading,
writing, riding on horseback, shooting with the bow, playing on an
instrument, and other similar acquirements, will not come
spontaneously to persons unskilled, and uninstructed in them; so
likewise victory cannot be obtained without a knowledge of the art of
war, which is a particular, and noble branch of science, independent
of others.
There are indeed certain considerations which may induce us to
pardon those calumniators of the Nizam-y-Gedid, who are any wise
connected with the old corps; but do those persons who are by no
means attached to them, and who know the difference between alum
and[88]sugar, and between good and evil, show any sense in daring to
abuse so noble a science? Their perverseness and obstinacy are
astonishing, seeing that, notwithstanding the taste which the infidel
race has always had of our raw troops, they do not allow it to be
sufficiently proved, that if a war should break out, these ignorant
beasts pressing together in masses of one or two thousand men, will
be unable to resist the tactic of the enemy.

SECTION V.
Containing a relation of the footing on which the old corps
of troops originally were, and of their present state.

Since so unreasonable a dissension prevails between our old and


new troops, we have undertaken a disquisition on the organization of
the first of these corps. The public are well aware of the conduct
observed by our old corps of troops when they march out to war, or
return from it; but if any persons should be ignorant of this, we will
thus explain it to them. At the time that His Highness Sultan
Suleÿman Khan set on foot these forces, the soldiers whose names
were inscribed on the muster-roll conducted themselves on their
marches with the most perfect propriety; and at the places through
which they passed, whether they moved by land or by water, did not
take so much as the value of an asper, either from rich or poor,
mussulman or Rayah; neither did they eat a single egg without
paying for it, nor injured the honour of any one. Truly the said
troops, yielding implicit obedience to the orders of the emperor of
the times, and of their other commanders, performed their duty well,
and wronged no man in any respect. In their military expeditions
they were wont to subdue forts and countries, and to ruin the
reputation of the infidels, and thus to elevate the glory, fame, and
power of the emperor of exalted splendour, and as they were thought
worthy of the prayers of his Highness and of the people of the true
faith, the whole world held them as objects of praise, and all men
desired their honour. As they were so highly respected a body, they
did not admit into their ranks men of obscure race, such as Franks,
Greeks, Armenians, Jews, or gypsies, or persons belonging to any
other inglorious nation. Being men of true courage, they repressed
these as well as all other insolent and shameless persons, and those
of the description of robbers. As the enemies of our religion were not
pleased with their excellent regulations, they found means to
introduce into their ranks very cunning spies for the purpose of
sowing dissension amongst them. These spies gradually creeping in
amongst the soldiers under pretence of being comrades, insinuated
themselves like Satan, and began by degrees to set on foot practices,
tending to corrupt the valour implanted in their hearts, and their zeal
for religion. “Comrades (said they) the pay which we receive from
government is seven aspers, and they point out to us Paradise as the
reward of martyrdom; they will certainly cause us all to be
slaughtered by the infidels; we have not two lives, why then should
we be destroyed for seven aspers, and without reason?” Having, by
similar and repeated insinuations, corrupted the minds of the
faithful soldiers, these began to care no longer about the concerns
they were intended for, and saying at last, “Useless and destructive
expeditions are only proper for the Russian infidels, let us leave it to
their soldiers to feed upon dry biscuits, as for us we will return home
and eat fine Baklava.”[89] Thus they forgot the stream of benefits in
which they were immersed, and the kind treatment and protection
that they had experienced. As there was nobody, either in the corps
or out of it, who spoke reason to them, they came in process of time
to do whatever they liked, plundering the places that they traversed
on their march, burning and destroying the houses both of
Mussulmans and Rayahs, and stretching forth their hands against
the honour of their families. Besides all this, although the whole body
of men who compose an hundred and ninety six Ortas, being
quartered altogether in one residence, ought to have no differences
one with the other; yet hatred and dissension rose to such a pitch
amongst them, that they no longer considered those who did not
belong to their own Orta, as brothers in religion, but, without
dissembling their sentiments, exchanged bullets, and drank each
others blood; and in the villages, forcing open the houses of the poor,
committed murder, which disorder still prevailing, as none of them
are safe from the others either in war or peace, their well regulated
system of discipline hath perished and gone to decay. They pass their
days in propagating seventy thousand false reports, saying, “When
we were opposed to the infidels, they did not allow us to give them
battle; if we had obtained permission, we could without trouble have
overthrown the crals from their thrones; but the ministers of our
government conspiring with the Ghiaours[90] cause us to be slain and
taken prisoners, and, receiving from the Russian infidels casks of
gold, deliver up the country to them.”
On a day of battle, as soon as they have heard from a distance the
noise of a cannonade, and have seen a few hats, the Mussulman spies
who are in their ranks begin to exclaim aloud: “Community of
Mahomet, why do you stay here? the Ghiaours have forced our camp,
the troops in front of us have turned their faces this way; we shall be
pursued and made prisoners.” As these cries spread in succession
through the army, even the very regiments which since their original
institution never surrendered their kettles to the enemy[91], and
which are at that moment sacrificing a thousand martyrs in their
defence, now estimating their own lives at the price which the others
set upon theirs, abandon in the space of half an hour their tents,
camp equipage, kettles, and baggage of every sort, and repairing
straight to the imperial camp, plunder the treasure, effects, and
military chest, and then adorning their heads with the trophies of
their pillage, walk about in small parties with a presumptuous air, as
though these were inscriptions which made good their pretence of
having beaten the enemy, and overturned their cral. As they are all
mixed and confounded together, there is no way of distinguishing
those who fight with true patriotism from those who do not, and
there are amongst them certain adversaries who begin the attack
against the orders of their Vezier, Agha, Pashahs, and other officers.
When, however, the action is engaged, it is not possible to make
them stand their ground for half a minute, and the following example
is a clear proof of it. During the reign of his Highness Sultan
Moustapha, in the year of the battle of Kartal, when an hundred and
fifty thousand soldiers of Islam were opposed to the infidels, whilst
his excellency, Cogia Abdee Pashah (who hath attained to the mercy
of God,) was engaged in combat on the field of battle, at which time
the people of Islam were not very hard pressed, a mounted spy,
dressed like a Chiaoush, rode hastily along the rear of the
entrenchments of the Janissaries, and cried aloud: “Janissaries, why
do you remain here? the Ghiaours have turned our rear!” having said
these words, he put spurs to his horse and departed. Before he was
out of sight, the whole camp of janissaries, without examining
whether he had spoken truth or falsehood, at once betook themselves
to a precipitate flight. The infidels, availing themselves of the
opportunity, pursued them, and were on the point of completing
their destruction; but his excellency, whom we mentioned above,
saved them by vigorously charging the infidels with another corps;
but while he thus checked the enemy, the fugitives never thought so
much as rallying or coming to his assistance, neither did they stop to
take breath, until they arrived on the banks of the Danube, amongst
the tents which contained the treasure. As they did not see the enemy
at their backs, they ought to have retraced their steps, instead of
which, they plundered the baggage and treasure of the imperial
camp, and not being able to cross the river in open boats, they threw
themselves into the river, so that one third of them, or perhaps more,
were swallowed up in the Danube. Some, who could not swim,
climbed up the willow-trees upon the banks of the Danube, and
many lay hid among the reeds and flags; but when the enemy arrived
and perceived them, they were all put to death by fire and sword. It
was exactly three days before the whole army of the infidels came up,
when they made themselves masters of all the artillery, ammunition,
and military stores of various descriptions, which our bravoes, who
were unable to carry them off, had left on the banks of the Danube.
Towards the conclusion of the Russian war, which had succeeded
the one we have been speaking of, when Cogia Jussuf Pashah was
Grand Vezier for the second time, all the officers of the corps, and the
Janissary-Agha coming up to the Vezier in a body, made to him this
representation: “Although we have upwards of one hundred and
twenty thousand men, yet eight thousand of the Russian troops,
crossing to the higher side of the Danube and attacking us, have
completely routed our army. It is utterly impossible for us, with our
regular troops, to make head against such welldisciplined forces as
those of the Ghiaours; therefore, if you intend to make peace with
them, do it without delay. While our soldiers continue ignorant of
these new military manœuvres, we are not destined to become
victorious, from this time even to the day of judgment.” The
astonished Vezier said in answer to this strong representation, “How
can I lay these points before the Emperor?” To this they replied, “We
will ourselves cause a petition to be drawn up and presented to him.”
At the same time, they caused an humble representation to be
written out by me, and delivered it to the Vezier. It was dispatched to
the Emperor, and his Highness became convinced of their inability of
obtaining success in future. When peace was made, in consequence,
the Sublime Government, considering that the Janissaries
themselves had declared that their state of discipline rendered them
unfit to oppose the tactics of the enemies, thought itself obliged to
use every effort to introduce into the corps of Janissaries a regular
system of exercise, hoping by that means to retrieve their affairs, to
avert defeat, to open the way to victory, and to obtain security from
hostile machinations. The Janissaries, however, contrary to reason
and expectation, would not receive this project, and absolutely
rejected it. But as it became evident that, if it were abandoned to
oblivion, things would become worse, and the infidel race would
certainly encroach more and more, and as the conversation which
had taken place at Petersburgh relative to the reservoirs, was then
generally known, a body of musketeers was formed from among the
Bostangees, and quartered in the barracks newly constructed at the
Levend-Chifflick. As when His Highness Sultan Suleÿman set on foot
the corps of Janissaries, the new recruits deserted next day, so in the
present instance a number of worthless persons set up an opposition
in defence of the Janissaries, although these were no otherwise
connected with it than by the simple reception of pay, and began to
whisper to each other, “Hark ye! a hearth[92] is set open for the
Nizam-y-Gedid; if these new troops, who are practising military
evolutions, should perform any good service in war, the institution of
Janissaries will become obsolete, and our muster-roll will be erased
from the list.” They suggested also, that as the men who were
inscribed in the corps of the Nizam-y-Gedid performed an exercise
similar to that of the Ghiaours, the Mussulman faith is thereby
injured. Although these blockheads had never before given
themselves any concern about our faith or government, and indeed
knew nothing of what belongs to Mussulman purity; yet, on the
present occasion, they showed a mighty anxiety for religion, and by
that means prevented many persons from inscribing their names,
and encouraged many who were already engaged to desert. Behold!
how inscrutable are the decrees of Divine Providence! When the war
with France broke out, at which time these forces consisted only of
three or four thousand men, the new gunners and musketeers were
appointed to serve at Cairo and Acre. The said troops committed no
excesses, either on board the vessels in which they were transported,
or in the places of their destination whither they repaired, nor
robbed any man of the value of an asper; but both in going and
coming, conducted themselves with propriety and modesty. If any
persons have either seen or heard of their having committed the least
fault, we challenge them to declare it. When by the favour of Divine
Providence they arrived at Acre, the French infidels, who had for
sixty-three days pressed very closely Gezar-Pashah and the
inhabitants of the place, were within a hair’s breadth of making
themselves entirely masters of it; for they had already entered that
which is called the Sublime bastion within the fortress; but the
troops of the Nizam-y-Gedid, valiantly exerting their military skill, in
one day slaughtered the infidels to such a degree, that in no part of
Europe did the French nation ever receive so disgraceful an
overthrow; and no man in the world is ignorant that the said fortress
and its inhabitants were delivered by their courage. Is not this also a
proof of their utility, past and future? Wherever they have been
opposed to the infidels, although few in number, they never turned
their faces back, but broke the enemy, or were themselves broken;
and as not one of them dared to mention the word flight, they have
always, in exact obedience to the will of the great and mighty
Prophet, punctually discharged the duties which appertain to a holy
war, and a steady zeal for the faith. If there is any falsehood in my
words, let any one prove it; I am extremely willing that he should do
so, otherwise, for God’s sake, let every body listen to reason. When
our undisciplined forces in Egypt found themselves unable to make
head against the cavalry or infantry of the French infidels, they
retired for protection behind the ranks of our regular troops, who
alone stood their ground, and by that means saved themselves from
the impending danger. Moreover, in the year 1217 they were sent
against the Mountaineers who had rebelled in Rumelia. Since that
insolent race first showed themselves, several Veziers and other
officers had been sent against them without effect.[93] Having formed
the wicked design of destroying the Nizam-y-Gedid institution from
its roots, they now exerted their whole strength and gave battle.
Although the regular troops had with them neither their cannon,
howitzers, or mounted men, and were engaged in the midst of a
severe winter, snow, rain, and mud, and though the rebels were
strongly posted in a town, they nevertheless marched up to the
attack, and without regarding the advantageous position of the
insurgents, while they were themselves up to the knees in mud and
water, they knocked down half of the rebels like rotten pears,
sending their souls to hell, and obliged the rest to fly. In a short time
the field of action was covered with the vile carcases of the rebels,
and those who were taken alive reported that they called out to each
other, “Ah! comrade, these troops which they call Nizam-y-Gedid,
are not what we took them for.” In these exclamations they betrayed
the sense of their own inferiority. Every one knows that at last these
rascals, unable to make a stand on any side, climbed the mountains
by night, and fled. To this we may add, that although the banditti
tried by every means to introduce a spy into the ranks of the new
soldiers, they could not succeed, because, by the regulations of those
forces, an officer is appointed to command every ten privates, and
these officers who have an opportunity of seeing constantly, as well
their own men as those who are on the right and left, are acquainted
with them all, and in the line they never quit each other’s sides; if,
therefore, a stranger from without should get in amongst them, in
what condition would he find himself, being exposed in the middle;
like a broom in a court-yard, he delivers his collar to the first man
that takes him.
Just and intelligent men may readily understand how easily the
Sublime Government can organise these troops, from this
circumstance, that it is utterly impossible for any person, whether
Mussulman or infidel, by passing to and fro to examine the state of
these troops, and learn where they are going, and what they are
about to undertake, without being discovered and punished. The
advantages of the new corps, and their superiority over the old are
infinite; were we to write them all down, we should fill several
volumes. In order, however, to make the people comprehend well, we
will point out to them another of these advantages. The soldiers of
our ancient corps, are not at all clothed alike; from this diversity of
garment, the following bad effect results: if, in time of war, any of
them should desert from the army, as there are no marks by which
we can distinguish whether the deserters belong to the troops, or
whether they are tradesmen, or servants, they have thereby the
opportunities of escaping without being known. Whereas the new
troops have a particular uniform of their own, so that the stragglers
would be soon discovered. Hence it results, that in a large camp of
the new troops, every man will be forced to remain fixed in his
company, and steady in the performance of his duty, whether he
would or no, since it is impossible to desert without greatly incurring
the danger of punishment.
Another of their advantages is this: our old forces, when in
presence of the enemy, do not remain drawn up in a line, but stand
confusedly and promiscuously like a crowd in a place of diversion.
Some load their muskets, and fire once, some twice, or oftener, just
as they think proper, whilst others being at their wits’ end, and not
knowing what they are about turn from side to side like fabulous
story-tellers.[94] If in consequence of any movement which they
perceive on the side of the enemy, the officers endeavour to make the
troops fall back a little, some will obey them, others will not, every
one does just as he likes. If they wish to retire a little, the soldiers
make that a pretence for flying to the distance of some days’ journey.
But the new troops remain drawn up in line as though they were at
prayers, the rear ranks being exactly parallel with the front, and
consisting of the same number of companies, neither more nor less,
so that, when it is necessary, they turn with as much precision as a
watch. The whole body, consisting of many thousand men, observe
attentively the signals given them by the two fuglemen who explain
by signs the commands of the officers, and not one dares so much as
to turn his head. Thus the orders of the officers being communicated
without the least noise, they stand firm, and lend an attentive ear,
whilst not a word issues from their mouths. If, for instance, the
officer whose business it is to give the command, makes the signal
for attention, the whole body are ready in an instant, and not one of
them dares to stand idle, or to make any noise, or to look another
way, thus they are equally prepared for whatever may happen.
Sometimes the signal is given for them to load and discharge their
muskets successively, without regarding order or slacken their fire,
so as to make the balls shower like rain. If, while thus engaged, they
meet with a check, the officers immediately by a signal will cause
them to retire in good order, and will supply their place with fresh
troops from the rear, who likewise scatter their fire in the same
manner. This method of managing troops gives great facility to their
operations. Sometimes they dispose a large body of men in a circular
form, and then cause them to march round in such a manner, that as
the circle turns the soldiers incessantly discharge their muskets on
the enemy and give no respite to the combat, and having prepared
their guns for a fresh discharge before they return to the same place,
they fire the moment they arrive in the face of the enemy. The result
of this circular formation is, that the fire and slaughter do not cease
for an instant. Sometimes, when it is judged necessary, several
thousand men being crowded into a narrow space, form a solid mass
for the purpose of appearing to the enemy to be few in number, then
by opening out, they can execute any manœuvre that they please, and
sometimes, ten thousand men deploying, appear to consist of fifty or
sixty thousand. At other times, when they are hard pressed, the
troops receive the superior officers in the centre, and throwing
themselves into the form of a square castle, pour their fire on every
side, the artillery also being disposed on every face of the square, so
that if the enemy should charge them even on four sides, he will be
unable to make an impression. If the enemy’s cavalry should
endeavour to break in upon them while they are formed in this
manner, on the signal being given, the front rank men kneel
altogether in an instant, and remain in that position keeping their
muskets supported against their breasts, and the ranks who are in
their rear stand upright and make use of their fire-arms, thus
rendering it impossible for the hostile cavalry to break in and create
confusion. Should it happen that the enemy is as skilful and well
trained as themselves, and employs against them the same
discipline, then of the two parties, that will be victorious whose
chiefs are enabled, by the favour of Divine Providence, to put in
practice with superior address, the new science and stratagems of
war which they have learned, because the apostle of the Most High,
our great prophet (on whom be the blessings and peace of God!)
himself condescended to use military stratagems. This sacred
tradition is thus related.
During a holy war which was carried on in the happy time of the
apostle of God, (on whom be peace!) a certain valiant champion of
the enemy’s army came out to offer single combat, and demanded
that the glorious Alli should be opposed to him. Alli, well pleasing to
God, having received the command of the Apostle, girded on his
sword only, and immediately went forth alone to the place appointed
for the combat. When this friend of the Most High met that infidel,
he thus addressed him: “I come on foot having one sword; why come
you out on horseback having two swords and two bows?” The great
Alli spoke to him again, saying “let these things be so; but I come out
alone to give battle on our side, why do you bring another man and
come both together?” The infidel, at this question, looked about him
believing that another man had followed him, when at the same
instant, the great Alli, in the twinkling of an eye, made the vile head
of the reprobate fly off. The death of the said wicked person having
been a source of joy to the followers of Islam, the excellent Alli,
meeting the great prophet on his return, related to him the
admirable stratagem by means of which he had slain that wretch.
This holy tradition has been vouchsafed unto us.
Although many similar stratagems have been employed at various
times, by holy warriors, and leave has been granted to the spies sent
forth amongst the infidels for the purpose of advancing victory to the
people of Islam, to assume any sort of dress; and although the great
Prophet hath given full permission and authority to do any thing
which may conduce to the defeat of the infidels, yet an ignorant
rabble keep chattering like parrots, some of whom do not approve of
the dresses of the new troops, while others say that their exercise
belongs specially to the Kiafers[95], and does not become
Mussulmans.
With respect to the manner in which the provinces of the Sublime
Government are to be defended, and the means by which the
enemies of our faith are to be repressed, and the causes that have
produced victory and defeat, the rabble are utterly ignorant of them,
occupying themselves solely with this question, “shall we lose our
pay of a few aspers?” With this, as with a fishing hook, they draw
from their sack various absurdities, and prevent a number of simple
and foolish men from undertaking the duties of holy warfare. In
truth, is not this a sufficient reason for their being excluded from the
two blessed worlds?
To sum up all in one word: it is evident to men of penetration, that
there is no possibility of introducing this system into our old corps,
for this reason; that as at their first institution they were regulated in
a different manner, every one of them has an aversion to submitting
himself to the new discipline. If, for example, any of the old troops
wish to leave the camp and return, although forty thousand officers
should attempt to turn them back, it is useless; they will do as they
please. If only five or ten individuals should turn their faces, who has
power to say to them “Stop, go not away!” the whole body forthwith
following on their steps; for the most part draws breath in the tents
containing the treasure and baggage of the Imperial camp.
The following is another of the advantages of the new troops. If it
should happen that the enemies have obtained the victory by their
superior numbers, and that the new forces were defeated, they will
not, in consequence, lose courage and disperse themselves; their
captains and other officers will rally them the following day or soon
after, and will again march upon the enemy; and not one of their
soldiers will dare to make the defeat a pretext for quitting his post.
But if our old corps meet with a small check, they run, throw
themselves into the water, and get drowned. Thus they become the
cause of the progress of the enemies of the faith. Which thing having
come to pass in our own times, twice in the Russian, and once in the
Austrian war, and repeatedly in the war with the French, is manifest
to the world, and wants no new proof.[96] Another of the advantages
of the new troops is this; that when a body of them are appointed to
defend any post, they establish an advanced guard round the place in
order to obviate any hostile stratagems. Although this sort of
vigilance and precaution was formerly observed, yet there is a world
of difference between the ancient method and the new. According to
the old system, it is not easy to discover strange soldiers of the
enemies’ army who mix with the posts; but it is utterly impossible for
strangers to pass the guards of the regular troops, and to get into a
fortress which they defend; so that the army is safe from any
surprise.
The following is a description of the manner in which these posts
are arranged. When they are disposed round the camp, a certain
word is given them every night as a sign; the commander-in-chief
first announces in secret this word to the officers, and they
communicate it privately to the officers of the corps de garde; if
therefore they meet with a suspicious person, they immediately
demand the parole, that is to say, the sign word for the night; and if
he does not give the parole of the night, they seize and conduct him
to the captain of the camp. Behold! this is the only method of
discovering spies; and as it is a matter which, above all others,
demands great care, they will pay special attention to it; so that until
their return from any expedition, the parole of one night will never
be the same as that of another, and by this means they are delivered
from the plague of spies. But of all the advantages, the most material
is this. If, under Divine favour, a sufficiently numerous body of these
new troops should be properly disposed along the frontiers of the
Sublime Empire, our enemies will find themselves opposed on every
part of the boundaries of Islam, by expert artillery men, and well
disciplined forces, perfectly acquainted with the rules of the art of
war; nor will they, as heretofore, be able to take advantage of our
unguarded posture, in order to make an attack upon us; for there are
persons still alive who well know that when in the time of Sultan
Mahmoud the German infidels assaulted, and at once made
themselves masters of the fortress of Nissa, it required a great deal of
trouble to drive them out. In fine, His Highness the Emperor, and
the supporters of his power, considering that it is indispensably
necessary to guard against such occurrences by striking terror into
the enemies of our religion, have firmly resolved to take measures for
that purpose, seeing that those enemies who were from the
beginning a troublesome and insolent race, and who, in all times,
had been unable to withstand the power of the people of Islam,
insomuch that they were wont to frighten their bastards in the cradle
by saying “The Mussulman is coming!” and many of them on seeing
one Mussulman, took off their hats through excess of fear, now
venture to resist us, and have with exceeding care and diligence
made themselves so thoroughly masters of the use of fire-arms, that
a body of some thousands of them are able to serve their cannon with
as much precision and celerity as they can their muskets, firing a
single piece of artillery twelve or fifteen times in a minute, and
making a thousand discharges in the space of an hour. By this means
they destroy the people of Islam from a distance, and prevent them
from making use of their sabres. They now say, “At length we have
taught the Ottoman troops what value they ought to set upon
themselves; henceforth they will never set foot in our country; even
the Mussulman provinces are ours.” Thus they never allow victory to
incline to the side of Islam, and especially since the year 1182, they
have continued to afflict the followers of Islam with most disgraceful
usage, bringing under their own power so many of our tributary
subjects. Nevertheless, a crowd of ignorant people of our nation
never bring these things into their recollection, nor can persuade
themselves that the success of the infidels for nearly the space of
forty years over the people of Islam proceeds entirely from their own
inability to resist their fire, and that their own frequent flights are the
cause which disables us from carrying on war. These despicable
wretches have never issued from the castle-gate, nor travelled a
single stage from home, neither do they know what war and peace
mean, nor from what cause the troubles of the world have sprung,
and whence they are likely to arise in future; some of them are so
ignorant of what belongs to pure religion, that in repeating a short
prayer they commit mistakes from beginning to end; men in
appearance only, vulgar of the lowest description, children of
falsehood, who suppose that the Nizam-y-Gedid is the cause of
confusion in the universe, and that if this ordinance were removed,
and the old system restored, the world would be tranquil in five days.
Last year, one of those superlatively ignorant persons was
appointed to the office of receiver of the revenue in one of the
islands. This man, who before was continually uttering curses and
execrations against the authors of the Nizam-y-Gedid, having gained
five thousand piasters by the perception of the imposts, and hoping it
was continued to him for another year that he might gain five
thousand more, upon meeting with his friends and companions, said
to them, “Ha! comrades, there is no harm in this Nizam-y-Gedid; I,
indeed, at first opposed it, but it was from want of sense; for the
impost upon wine is not paid by those who drink it, but is levied
upon the wine which is sent to Russia, so that the money comes out
of the pockets of the Russians; it were better that it was twice as
much; I now understand the matter, and I make vow never to speak
a word against the Nizam-y-Gedid.” See how this man, in
consequence of gaining a few piasters by an institution which he had
been in the habit of abusing, is not ashamed afterwards to praise it.
Such, however, is the nature of all the lower orders. To sum up all in
one word: if the clamour and execrations of a rabble, who makes no
difference between good and evil, obliges us to abandon the said
institution of new troops, (which Heaven forbid!) the enemies of our
religion will find so much the more facility in invading us; and as one
of their kingdoms maintains three hundred thousand regular troops,
they will mount upon our necks on seeing that the Ottomans cannot
discipline a hundred thousand. At that time we shall not derive the
least service from those knaves who disapprove of the Nizam-y-
Gedid; they will merely say that it was thus ordained; that there is no
contending with destiny; and if a great calamity befalls (which
Heaven avert!) they will, without making more words about the
matter, become the authors of trouble and distress.

SECTION VI.
Wherein is explained the purpose for which exercise is
intended.

In the time of his Highness the late Emperor, during the period of
my two captivities, I have often, in the course of conversation with
Russian military men, questioned them, saying, “by what secret
prodigy hath it come to pass, that you Muscovites, who were
formerly a very stupid and easily vanquished nation, have for some
time back obtained such success over the race of Osman?” They, in
reply, said, “Since you are ignorant of the causes of our superiority,
you shall be made acquainted with them. The Russians, in former
times, did not possess the knowledge of tactics, and were therefore
beaten by their enemies. A man called Mad [97]Petro, having in his
travels seen the world, and acquired an intimate knowledge of the
advantages thereof, became Cral of Muscovy, and subjected the
Russians, whether they would or no, to the restraints of discipline. In
order to try what progress they had made in it, he declared war
against the King of Sweden, and avenged himself of him. He then
went in an expedition towards the Crimea, reduced whatever
fortresses he thought proper, and began to break the power of the
Tartars. Afterwards, when we concluded a treaty with you, we
demanded for our Cral the title of Emperor; and as you could not
oppose us, the Sultan Mahmoud Khan (of excellent memory) in
writing to us, granted that title. Then in the war with Sultan
Moustapha, we approached Adrianople, and made peace on our own
terms. And see, in the present war, we have, with very few troops,
defeated your numerous forces; and after taking the fortresses of
Hotim, Bender, Ibraïl, Ismail, and Otchakoff, and conquering
Moldavia and Wallachia from one extremity to the other, we passed
the Danube with eight thousand men, and routed the Ottoman army
consisting of fifty thousand. As you have no troops able to face ours,
know that this time also, after being well beaten, you will make a
worse peace than the former one.” In this manner did they answer
this poor person[98]; and truly before much time had elapsed, it came
to pass that such a treaty was concluded.

SECTION VII.

It is a difficult thing to find out the spies that go to and fro in the
camps of the followers of Islam, and it is necessary to explain how
much injury is done by them. As this matter requires attention above
all others, let us relate some events which have happened to us, with
the consequences resulting from them.
In the war with the Russians, during the reign of the late Emperor,
Sultan Moustapha, two hundred thousand unknown and
undisciplined troops were drawn together. In this multitude no one
knew the other, and if a father had searched for his own son, he
could not have found him. If each day some hundreds separated
themselves and went off, no one knew it, nor even could have said to
them, ‘stop! remain!’ In so disorderly a camp, the spies from the side
of the infidels came and went each day and night, and acquainted the
Russians with every thing that passed in our army, and the secrets of
our government became known to the enemy. For this reason,
whenever a forward movement of our army was resolved upon, they
surprised the camp towards morning, the day before it was to be
executed, and routed so large an army of the Ottoman race, without
allowing them to open their eyes, all being buried in sleep. We have
learned by experience, that as the infidel race are very cunning and
deceitful, they have often effected, merely by wiles and stratagems,
things which we never have been, nor ever will be, able to bring
about with our hundred thousand men. Among all the wiles which
that wicked race have put in practice, there is one extraordinary
stratagem which it is worth while for us to describe. During the said
war, three poor men belonging to the assembly of Janissaries, having
concerted together, went out to gain some information of the
Russians: after it was quite dark they seized, on the Muscovite
borders, a certain Ghiaour, one of those who were employed in
getting forage, and, satisfied with their success, were conducting him
to the camp, when, their prisoner being a cunning hog[99] that
understood Turkish, said to them, “Sirs! if you set me at liberty, my
father, who is a rich man, will recompense you largely.” They,
believing his words, conducted him back to the Russian confines,
where he soon found a surreptitious pimp[99] whom he called father,
to whom they delivered him. This man, who was also a very deceitful
rogue, said to them, “I am greatly pleased at your bringing my son
here and not killing him, and I am very much obliged to you.” With
these and other expressions of gratitude, he gave them five ducats,
and continued thus: “I have not been able to reward you as I ought to
do, but allow me to show you something, and let that be another
recompense.” So saying, he carried them in disguise into his own
camp, and placed them at the edge of a large tent; here the comrades
perceived that there was a great bustle before the tent, and that
within they were weighing gold and silver coin in a large balance, and
were then filling with it some casks placed near. In the tent were men
habited in divers sorts of Mussulman dresses, and the casks filled
with money were continually distributed amongst them. The traitor,
after showing these things to the three comrades, took them to his
own tent, and said to them, “Comrades! see what I have shown you.
Part of this money is to go to your government, and part to the Vezier
and other Generals of your army. We have purchased your country
with money; the sum that has just been given is the price of
Constantinople which we have bought and shall soon enter. My
motive for informing you of this is that you may henceforth look to
yourselves; do not remain in your camp, nor even lose time at
Constantinople; but go to your own country that you may not be
made prisoners. Keep all this secret, and say nothing of it in your
camp.” With these words he led them back to the Ottoman confines.
The comrades returned to our camp, and being all three simple fools,
they gave implicit confidence to the falsehood contrived to deceive
them; and whenever they met their friends and acquaintances they
said to them, “Breh! what did we come here for? Our chiefs have sold
their country and are now receiving the money for it: we have seen it
with our own eyes; why should we stay here? all that passes is but
lost labour.” By this means they struck with consternation many who
were as great asses as themselves, and these spread confusion and
alarm through the whole Imperial camp. Finding this pretext of
going home, a great number of the troops went off and dispersed,
like a flock of young partridges.
The Russian hogs, availing themselves of so favourable an
opportunity, brought the devil among us. But the best of the story is,
that they all laughed at us in relating it to each other, saying that in
order to disperse a Turkish army, they had only to weigh a little gold
in the presence of three of their men, and then send them to inform
the rest of it. Thus, on account of so many ignorant fools, who
understand nothing of the wiles and machinations of the enemy, it is
necessary that we should give our troops such a form of discipline as
may prevent similar disorders, and the danger of the spies who mix
with our men and can never be discovered.
How is it possible for us without such a system, to avenge
ourselves of our enemies, to defend our Empire, or to gain the least
advantage? As the deep cunning of the Russian race was not at first
so well known, our precious heroes of soldiers made use of such
expressions. “The Muscovite infidels are dogs of fishermen, whom
we can suffocate only by spitting upon them; if we each of us throw a
stone, we shall destroy them all.” These Janissaries who are merely
vain boasters, good only for swaggering on the pavements, falling by
thousands into the hands of the Russians through their total
ignorance of military affairs, at length saw and learned the power
and stratagems of the enemies of our faith. But to what purpose?
since the children and daughters of so many noble and pious persons
of the Mahometan community have continued even to this day (a
space of nearly forty years!) in the possession of the Russians; and
the children whom they have produced remain depressed and
afflicted, a weeping prey in the hands of soldiers, officers, and other
reprobates.[100]
If a rabble of men, ignorant of the world, who pass their whole
time in festivity and play, or in buying and selling, or in idleness,
were in the first place to learn thoroughly the things which belong to
purity, and then, in order to preserve their religion unsullied, were to
avoid discourse with infidels and designing men, and examine
whether their own observance of it did not require some correction,
there is no doubt that they might attain to the summit of the good
things, both of this world and of the world to come. If they contend
with us, saying, “We understand questions of purity, we preserve our
religion, and there is no doubt of the validity of our marriage
contract[101]”; in that case, although what they maintain be true, yet,
as the knowledge of the affairs of this world is apt to occasion many
great sins, let them not lengthen their tongues on a subject of which
they certainly know nothing, and to which their understandings
cannot reach. If this business of the Nizam-y-Gedid seem obscure to
them, let them acquire information from men who, like this humble
individual[102], have reached their eighty-seventh year, and have
gained by experience a thorough knowledge of the world, and have
brought to light what things have injured, and what have turned to
the profit of, the Sublime Government. Let them not talk of things
void of sense, for as the troubles of man proceed from his words, so
reason is given him as a defence against his words.

SECTION VIII.

Many simple persons, who do not know why the treasure of the
Nizam-y-Gedid was instituted, and whence this money is collected,
and to what purpose it is expended, say sometimes, “the water of the
old cistern is not exhausted; why then is the new revenue made a
separate treasure?”[103] We have already stated how difficult a thing it
is to explain public affairs to people who are plunged in the darkest
ignorance, and to make those who cannot read the common alphabet
understand science; although we were to labour until the day of
judgment, we should not succeed. If a man is capable of receiving the
words of truth from his outward ears into his mind, we proceed to
relate matters as they really are.
Wars have been carried on for seventy or eighty years in a rude
manner, and with weak and irregular troops, during which time the
followers of Islam having been often defeated, His Highness Sultan
Suleÿman Kannuni thought proper to form the body of the
Janissaries, whom he divided into different divisions, assigning to
each their particular regiments and quarters. He considered,
however, that these troops could not be assembled and kept together
for the love of God only, but that it was also necessary to establish
funds for the purpose of providing meat, drink, &c. for them, as well
as to appoint them a pay suitable to their expenses. After consulting
with the wise and experienced men of the time, he regulated the
administration of the revenue in the following manner. A small part
of the monies drawn from the provinces that had, by right of
conquest, become subject to his illustrious predecessors, was
appropriated to the subsistence of military men who served on
horseback and otherwise. The Emperor appointed by the canon[104]
that, from the annual product of the revenues, and from the sums
which every one who succeeded to the farming of them, paid
according to his means, as an anticipation price, provision should be
made for meeting the expense incident to these corps, whether in
war or in peace. After these arrangements had been made, it
frequently happened that, in good times, no war took place for
twenty years together, during which some of the military men who
belonged to the corps, having turned old, departed in peace. As the
papers granted them to enable them to draw their pay fell into the
hands of their servants, relations, or comrades[105], it was not suffered
that the allowances appointed for several thousand men should be
received by persons who did not belong to the military profession,
who were novices in affairs, or apprenticed to some trade. As few of
them left sons capable of taking the place of their fathers, and
opposing the enemies of our faith, men of war became very scarce,
and it was therefore necessary to levy fresh troops, and assign new
funds for their support, the old revenue being exhausted. Besides
this cause of the impoverishment of the royal treasure, the price of all
commodities had greatly augmented since the time that the canon
was promulgated. For instance, at that period an oke of the flesh of
mutton was sold for four aspers, but in the course of time it rose to
twenty-five paras, and other things were dearer in proportion. Thus
an increase having taken place in the price of the necessaries which
were furnished to the corps at its institution, the royal funds
provided for that purpose were no longer able to meet the expense of
the times, and as they were nevertheless obliged to find some means
of going on, the rents of the Sublime Government began to run into
each other; that is to say, that in order to provide for the expense of
the current year, they sold the revenue of the succeeding one, and so
on. Hence resulted a deficiency in the Imperial finances. Even the
treasures, which had been amassed with a great deal of trouble
previous to the Russian war that broke out during the reign of the
late Sultan Mustapha, were in that war entirely drained and
consumed, although every thing was then very cheap when
compared with present prices, and after peace, the finances could not
recover themselves, but the expense still exceeded the revenue. The
enemies of our religion being informed of our want of money, were
thereby confirmed in their purpose, and obtained complete success.
But besides the difficulties in which our government found itself
involved in peaceable times, owing to the deficiency of the ordinary
revenue which did not suffice for the current expenses, there have
been moments during war in which it stood like a man who has both
his hands tied down to his sides, and knew not which way to turn
itself; for as there was no ready money, nothing could be
accomplished, and nobody showed any inclination to engage in a
holy war; nothing was considered but pay, rations, and the privilege
of being exempted from active service.
Thus hath the want of a well-organised system of finance been
clearly proved, the whole revenue of the state not being sufficient for
the exigencies of these times. The following example will point out
the truth of this to the people at large. Suppose the case of a man,
who twenty or thirty years ago enjoyed an income of one piaster a
day, and regulated his expenses accordingly, if that man continued
on the same scale how could he live at present, when every thing is
four or five times dearer than at that period, and make the two ends
of the year meet with his piaster a day? In like manner, we may apply
this consideration to the actual condition of the Sublime
Government. Behold, while the royal finances are in so great a state
of penury, not a single person, whether rich, poor, or tributary
subject, will give a single piaster to the treasure, under the name of a
voluntary contribution, towards carrying on war; and, in short, no
man will go to war gratis, and at his own expense, only to please God,
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.

Let us accompany you on the journey of exploring knowledge and


personal growth!

ebookmass.com

You might also like