100% found this document useful (3 votes)
12 views

JavaScript Unlocked 1st Edition Sheiko download

The document provides information about the book 'JavaScript Unlocked' by Dmitry Sheiko, which focuses on improving code maintainability, performance, and security in JavaScript. It covers various topics including modular programming, DOM scripting, HTML5 APIs, asynchronous JavaScript, and large-scale application architecture. The book is available for download in PDF format and includes practical code recipes for both classical and modern JavaScript.

Uploaded by

machaibersu82
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (3 votes)
12 views

JavaScript Unlocked 1st Edition Sheiko download

The document provides information about the book 'JavaScript Unlocked' by Dmitry Sheiko, which focuses on improving code maintainability, performance, and security in JavaScript. It covers various topics including modular programming, DOM scripting, HTML5 APIs, asynchronous JavaScript, and large-scale application architecture. The book is available for download in PDF format and includes practical code recipes for both classical and modern JavaScript.

Uploaded by

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

JavaScript Unlocked 1st Edition Sheiko pdf

download

https://ebookfinal.com/download/javascript-unlocked-1st-edition-
sheiko/

Explore and download more ebooks or textbooks


at ebookfinal.com
We believe these products will be a great fit for you. Click
the link to download now, or visit ebookfinal
to discover even more!

Functional Light JavaScript Balanced Pragmatic FP in


JavaScript 1st Edition Kyle Simpson

https://ebookfinal.com/download/functional-light-javascript-balanced-
pragmatic-fp-in-javascript-1st-edition-kyle-simpson/

JavaScript Creativity 1st edition Edition Hudson

https://ebookfinal.com/download/javascript-creativity-1st-edition-
edition-hudson/

JavaScript bible Danny Goodman

https://ebookfinal.com/download/javascript-bible-danny-goodman/

Mentorship Unlocked The Science and Art of Setting


Yourself Up for Success 1st Edition Janice Omadeke

https://ebookfinal.com/download/mentorship-unlocked-the-science-and-
art-of-setting-yourself-up-for-success-1st-edition-janice-omadeke/
Learning JavaScript 2nd Edition Shelley Powers

https://ebookfinal.com/download/learning-javascript-2nd-edition-
shelley-powers/

Test Driven JavaScript Development 1st Edition Christian


Johansen

https://ebookfinal.com/download/test-driven-javascript-
development-1st-edition-christian-johansen/

Pro JavaScript Design Patterns 1st Edition Ross Harmes

https://ebookfinal.com/download/pro-javascript-design-patterns-1st-
edition-ross-harmes/

JavaScript Essentials for Dummies 1st Edition Paul


Mcfedries

https://ebookfinal.com/download/javascript-essentials-for-dummies-1st-
edition-paul-mcfedries/

Jasmine JavaScript Testing 2nd Edition Test your


JavaScript applications efficiently using Jasmine and
React js Paulo Ragonha
https://ebookfinal.com/download/jasmine-javascript-testing-2nd-
edition-test-your-javascript-applications-efficiently-using-jasmine-
and-react-js-paulo-ragonha/
JavaScript Unlocked 1st Edition Sheiko Digital Instant
Download
Author(s): Sheiko, Dmitry
ISBN(s): 9781785881572, 1785881574
Edition: 1
File Details: PDF, 2.10 MB
Year: 2015
Language: english
JavaScript Unlocked

Improve your code's maintainability, performance,


and security through practical expert insights and
unlock the full potential of JavaScript

Dmitry Sheiko

BIRMINGHAM - MUMBAI
JavaScript Unlocked

Copyright © 2015 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval
system, or transmitted in any form or by any means, without the prior written
permission of the publisher, except in the case of brief quotations embedded in
critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy
of the information presented. However, the information contained in this book is
sold without warranty, either express or implied. Neither the author, nor Packt
Publishing, and its dealers and distributors will be held liable for any damages
caused or alleged to be caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the
companies and products mentioned in this book by the appropriate use of capitals.
However, Packt Publishing cannot guarantee the accuracy of this information.

First published: December 2015

Production reference: 1011215

Published by Packt Publishing Ltd.


Livery Place
35 Livery Street
Birmingham B3 2PB, UK.

ISBN 978-1-78588-157-2

www.packtpub.com
Credits

Author Project Coordinator


Dmitry Sheiko Izzat Contractor

Reviewer Proofreader
Durgesh Priyaranjan Safis Editing

Commissioning Editor Indexer


Wilson Dsouza Tejal Soni

Acquisition Editor Graphics


Meeta Rajani Abhinash Sahu

Content Development Editor Production Coordinator


Priyanka Mehta Aparna Bhagat

Technical Editor Cover Work


Mohita Vyas Aparna Bhagat

Copy Editor
Kausambhi Majumdar
About the Author

Dmitry Sheiko is a passionate blogger and the author of Instant Testing with QUnit.
Dmitry got hooked to computer programming in the late '80s. For the last 18 years,
he has been in web development. His very first open source contribution was an
XSLT-based CMS in 2004. Since then, he has been contributing quite a lot to FOSS.
You can find Dmitry's latest works at https://github.com/dsheiko. Currently,
he is working as a web developer in the lovely city of Frankfurt am Main at
Crytek GmbH.

First, I would like to thank my family for the continuous support


and letting me to realize my potential. A special thank you to my
father, who took me to an industrial computer center when I was 3
years old. In I decade after this, with the advance in PCs, I realized
that computers mean games, and after a while, I became curious
enough to understand how the games are built. This is how I
started learning programming.

Thank you to my team at Crytek, who compliantly follow all


the practices described in the book and adapt to the constantly
evolving technologies to keep up with the pace I set.
About the Reviewer

Durgesh Priyaranjan is a senior software developer who has been working on


various technologies. However, he loves JavaScript programming and interaction
design the most. He is currently based in Bengaluru (India) and is working as a
UI engineer for one of the Indian e-commerce giants, Flipkart.

He loves trying out different technologies without any bias. Of late, he can be found
tinkering around with Raspberry Pi.

I'd like to thank my loving wife for her continuous support of my


work and work-related hobbies.
www.PacktPub.com

Support files, eBooks, discount offers, and more


For support files and downloads related to your book, please visit www.PacktPub.com.

Did you know that Packt offers eBook versions of every book published, with PDF
and ePub files available? You can upgrade to the eBook version at www.PacktPub.com
and as a print book customer, you are entitled to a discount on the eBook copy. Get in
touch with us at service@packtpub.com for more details.

At www.PacktPub.com, you can also read a collection of free technical articles, sign
up for a range of free newsletters and receive exclusive discounts and offers on Packt
books and eBooks.

https://www2.packtpub.com/books/subscription/packtlib

Do you need instant solutions to your IT questions? PacktLib is Packt's online digital
book library. Here, you can search, access, and read Packt's entire library of books.

Why subscribe?
• Fully searchable across every book published by Packt
• Copy and paste, print, and bookmark content
• On demand and accessible via a web browser

Free access for Packt account holders


If you have an account with Packt at www.PacktPub.com, you can use this to access
PacktLib today and view 9 entirely free books. Simply use your login credentials for
immediate access.
Table of Contents
Preface v
Chapter 1: Diving into the JavaScript Core 1
Make your code readable and expressive 2
Function argument default value 2
Conditional invocation 3
Arrow functions 4
Method definitions 5
The rest operator 6
The spread operator 6
Mastering multiline strings in JavaScript 7
Concatenation versus array join 7
Template literal 8
Multi-line strings via transpilers 8
Manipulating arrays in the ES5 way 9
Array methods in ES5 10
Array methods in ES6 12
Traversing an object in an elegant, reliable, safe, and fast way 13
Iterating the key-value object safely and fast 14
Enumerating an array-like object 14
The collections of ES6 15
The most effective way of declaring objects 17
Classical approach 17
Approach with the private state 18
Inheritance with the prototype chain 19
Inheriting from prototype with Object.create 20
Inheriting from prototype with Object.assign 21
Approach with ExtendClass 22
Classes in ES6 23

[i]
Table of Contents

How to – magic methods in JavaScript 24


Accessors in ES6 classes 26
Controlling access to arbitrary properties 28
Summary 29
Chapter 2: Modular Programming with JavaScript 31
How to get out of a mess using modular JavaScript 31
Modules 32
Cleaner global scope 32
Packaging code into files 32
Reuse 32
Module patterns 33
Augmentation 34
Module standards 35
How to use asynchronous modules in the browser 36
Pros and cons 40
How to – use synchronous modules on the server 41
Pros and cons 44
UMD 44
JavaScript's built-in module system 44
Named exports 45
Default export 46
The module loader API 47
Conclusion 47
Transpiling CommonJS for in-browser use 48
Bundling ES6 modules for synchronous loading 53
Summary 54
Chapter 3: DOM Scripting and AJAX 55
High-speed DOM operations 56
Traversing the DOM 57
Changing the DOM 58
Styling the DOM 60
Making use of attributes and properties 62
Handling DOM events 62
Communicating with the server 65
XHR 66
Fetch API 67
Summary 68

[ ii ]
Table of Contents

Chapter 4: HTML5 APIs 69


Storing data in web-browser 69
Web Storage API 70
IndexedDB 73
FileSystem API 75
Boosting performance with JavaScript workers 77
Creating the first web component 82
Learning to use server-to-browser communication channels 86
Server-Sent Events 87
Web Sockets 89
Summary 93
Chapter 5: Asynchronous JavaScript 95
Nonblocking JavaScript 96
Error-first Callback 99
Continuation-passing style 100
Handling asynchronous functions in the ES7 way 103
Parallel tasks and task series with the Async.js library 104
Event handling optimization 106
Debouncing 107
Throttling 108
Writing callbacks that don't impact latency-critical events 109
Summary 109
Chapter 6: A Large-Scale JavaScript Application Architecture 111
Design patterns in JavaScript 111
Understanding concern separation in JavaScript 115
MVVM 117
Using JavaScript MV* frameworks 118
Backbone 118
Angular 122
React 124
Summary 127
Chapter 7: JavaScript Beyond the Browser 129
Levelling up the coding of a command-line program in JavaScript 129
Building a web server with JavaScript 136
Writing a desktop HTML5 application 137
Setting up the project 138
Adding the HTML5 application 138
Debugging 143
Packaging 144

[ iii ]
Table of Contents

Using PhoneGap to make a mobile native app 145


Setting up the project 145
Building the project 146
Adding plugins 147
Debugging 147
Summary 147
Chapter 8: Debugging and Profiling 149
Hunting bugs 149
Getting the best from a console API 151
Tuning performance 154
Summary 156
Index 157

[ iv ]
Preface

Preface
JavaScript was born as a scripting language at the most inappropriate time—the time
of browser wars. It was neglected and misunderstood for a decade and endured six
editions. And look at it now! JavaScript has become a mainstream programming
language. It has advanced literally everywhere: in large-scale client-side
development, server scripting, desktop applications, native mobile programming,
game development, DB querying, hardware control, and OS automating. JavaScript
acquired a number of subsets such as Objective-J, CoffeeScript, TypeScript, and
others. JavaScript is marvelously concise and an expressive language. It features
prototype-based OOP, object composition and inheritance, variadic functions,
event-driven programming, and non-blocking I/O. However, to exploit the true
power of JavaScript, we need to have a deep understanding of language quirks.
Moreover, while developing in JavaScript, we will become aware of its numerous
pitfalls, and we will need a few tricks to avoid them. The project formerly known
as EcmaScript Harmony, was just recently finalized in the specification named
EcmaScript 2015, which is more often referred to as ES6. This not only brought the
language to the next level, but also introduced a number of new technologies that
require attention.

This book aims to guide the reader in understanding the upcoming and existing
features of JavaScript. It is fully packed with code recipes that address common
programming tasks. The tasks are supplied with solutions for classical JavaScript
(ES5) as well as for the next generation language (ES6-7). The book doesn't focus
only on in-browser language, but also provides the essentials on writing efficient
JavaScript for desktop applications, server-side software, and native module
apps. The ultimate goal of the author is not just to describe the language, but also
to help the reader to improve their code for better maintainability, readability,
and performance.

[v]
Preface

What this book covers


Chapter 1, Diving into the JavaScript Core, discusses the techniques to improve
the expressiveness of the code, to master multi-line strings and templating, and
to manipulate arrays and array-like objects. The chapter explains how to take
advantage of JavaScript prototype without harming the readability your code.
Further, the chapter introduces the "magic methods" of JavaScript and gives a
practical example of their use.

Chapter 2, Modular Programming with JavaScript, describes the modularity in


JavaScript: what modules are, why they are important, the standard approaches
for asynchronously and synchronously loaded modules, and what ES6 modules
are. The chapter shows how CommonJS modules are used in server-side JavaScript
and how to pre-compile them for in-browser use. It elaborates how asynchronous
and synchronous approaches can be combined to achieve a better application
performance. It also explains how one can polyfill ES6 modules for production
by the means of Babel.js.

Chapter 3, DOM Scripting and AJAX, introduces Document Object Model (DOM),
shows the best practices to minimize browser reflow, and enhance application
performance while operating with the DOM. The chapter also compares two
client-server communication models: XHR and Fetch API.

Chapter 4, HTML5 APIs, considers the persistence APIs of the browser such as
Web Storage, IndexDB, and FileSystem. It introduces Web Components and gives
a walk-through of the creation of a custom component. The chapter describes
server-to-browser communication APIs such as SSE and WebSockets.

Chapter 5, Asynchronous JavaScript, explains the nonblocking nature of JavaScript,


elaborates the event loop and the call stack. The chapter considers the popular
styles of chaining asynchronous calls and handling errors. It presents the async/
await technique of ES7 and also gives examples of running tasks in parallel and
in sequence using the Promise API and the Async.js library. It describes throttling
and debouncing concepts.

Chapter 6, A Large-Scale JavaScript Application Architecture, focuses on code


maintainability and architecture. The chapter introduces the MVC paradigm and its
derivatives, MVP and MVVM. It also shows, with examples, how concern separation
is implemented in popular frameworks such as Backbone.js, AngularJS, and ReactJS.

[ vi ]
Preface

Chapter 7, JavaScript Beyond the Browser, explains how to write command-line


programs in JavaScript and how to build a web server with Node.js. It also covers the
creation of desktop HTML5 applications with NW.js and guides the development of
native mobile applications with Phongap.

Chapter 8, Debugging and Profiling, dives into bug detection and isolation. It examines
the capacities of DevTools and the lesser-known features of the JavaScript console API.

What you need for this book


It's enough if you have a modern browser and a text editor to run the examples
from the book. It maybe helpful, however, to use a browser tool similar to Firefox
Scratchpad (https://developer.mozilla.org/en-US/docs/Tools/Scratchpad)
to edit the sample code directly in the browser. The books also contains ES6/ES7
code examples that rely on features not yet available in browsers. You can run these
examples in Babel.js's online sandbox available at https://babeljs.io/repl/.

You will find detailed instructions of how to set up your development environment
and install the required tools and dependencies in the chapters where we refer to
Node.js, NW.js, PhoneGap, JavaScript frameworks, and NPM packages.

Who this book is for


This book is for the developers who are already familiar with JavaScript and want to
level up their skills to get the most out of the language. The book is practice-oriented
and would be helpful for those who are used to the "learn by doing" approach, as the
topics are thoroughly covered with real-life examples and tutorials.

Conventions
In this book, you will find a number of text styles that distinguish between different
kinds of information. Here are some examples of these styles and an explanation of
their meaning.

Code words in text, database table names, folder names, filenames, file extensions,
pathnames, dummy URLs, user input, and Twitter handles are shown as follows:
"We can include other contexts through the use of the include directive."

[ vii ]
Preface

A block of code is set as follows:


var res = [ 1, 2, 3, 4 ].filter(function( v ){
return v > 2;
})
console.log( res ); // [3,4]

When we wish to draw your attention to a particular part of a code block, the
relevant lines or items are set in bold:
/**
* @param {Function} [cb] - callback
*/
function fn( cb ) {
cb && cb();
};

Any command-line input or output is written as follows:


npm install fs-walk cli-color

New terms and important words are shown in bold. Words that you see on the
screen, for example, in menus or dialog boxes, appear in the text like this: "As soon
as Enter is pressed, the console outputs I'm running."

Warnings or important notes appear in a box like this.

Tips and tricks appear like this.

Reader feedback
Feedback from our readers is always welcome. Let us know what you think about
this book—what you liked or disliked. Reader feedback is important for us as it
helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail feedback@packtpub.com, and mention


the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing
or contributing to a book, see our author guide at www.packtpub.com/authors.

[ viii ]
Preface

Customer support
Now that you are the proud owner of a Packt book, we have a number of things
to help you to get the most from your purchase.

Downloading the example code


You can download the example code files from your account at http://www.
packtpub.com for all the Packt Publishing books you have purchased. If you
purchased this book elsewhere, you can visit http://www.packtpub.com/support
and register to have the files e-mailed directly to you.

Errata
Although we have taken every care to ensure the accuracy of our content, mistakes
do happen. If you find a mistake in one of our books—maybe a mistake in the text or
the code—we would be grateful if you could report this to us. By doing so, you can
save other readers from frustration and help us improve subsequent versions of this
book. If you find any errata, please report them by visiting http://www.packtpub.
com/submit-errata, selecting your book, clicking on the Errata Submission Form
link, and entering the details of your errata. Once your errata are verified, your
submission will be accepted and the errata will be uploaded to our website or added
to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/


content/support and enter the name of the book in the search field. The required
information will appear under the Errata section.

Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all
media. At Packt, we take the protection of our copyright and licenses very seriously.
If you come across any illegal copies of our works in any form on the Internet, please
provide us with the location address or website name immediately so that we can
pursue a remedy.

Please contact us at copyright@packtpub.com with a link to the suspected


pirated material.

We appreciate your help in protecting our authors and our ability to bring you
valuable content.

[ ix ]
Preface

Questions
If you have a problem with any aspect of this book, you can contact us at
questions@packtpub.com, and we will do our best to address the problem.

[x]
Diving into the
JavaScript Core
You may have owned an iPhone for years and regard yourself as an experienced
user. At the same time, you keep removing unwanted characters one at a time while
typing by pressing delete. However, one day you find out that a quick shake allows
you to delete the whole message in one tap. Then you wonder why on earth you
didn't know this earlier. The same thing happens with programming. We can be
quite satisfied with our coding until, all of sudden, we run into a trick or a lesser-
known language feature that makes us reconsider the entire work done over the
years. It turns out that we could do this in a cleaner, more readable, more testable,
and more maintainable way. So it's presumed that you already have experience with
JavaScript; however, this chapter equips you with the best practices to improve
your code. We will cover the following topics:

• Making your code readable and expressive


• Mastering multiline strings in JavaScript
• Manipulating arrays in the ES5 way
• Traversing an object in an elegant, reliable, safe, and fast way
• The most effective way of declaring objects
• How to magic methods in JavaScript

[1]
Diving into the JavaScript Core

Make your code readable and expressive


There are numerous practices and heuristics to make a code more readable,
expressive, and clean. We will cover this topic later on, but here we will talk about
syntactic sugar. The term means an alternative syntax that makes the code more
expressive and readable. In fact, we already had some of this in JavaScript from the
very beginning. For instance, the increment/decrement and addition/subtraction
assignment operators inherited from C. foo++ is syntactic sugar for foo = foo + 1, and
foo += bar is a shorter form for foo = foo + bar. Besides, we have a few tricks that serve
the same purpose.

JavaScript applies logical expressions to so-called short-circuit evaluation. This


means that an expression is read left to right, but as soon as the condition result is
determined at an early stage, the expression tail is not evaluated. If we have true
|| false || false, the interpreter will know from the first test that the result is true
regardless of other tests. So the false || false part is not evaluated, and this opens
a way for creativity.

Function argument default value


When we need to specify default values for parameters we can do like that:
function stub( foo ) {
return foo || "Default value";
}

console.log( stub( "My value" ) ); // My value


console.log( stub() ); // Default value

What is going on here? When foo is true (not undefined, NaN, null, false, 0, or
""), the result of the logical expression is foo otherwise the expression is evaluated
until Default value and this is the final result.

Starting with 6th edition of EcmaScript (specification of JavaScript language) we can


use nicer syntax:
function stub( foo = "Default value" ) {
return foo;
}

[2]
Chapter 1

Conditional invocation
While composing our code we shorten it on conditions:"
var age = 20;
age >= 18 && console.log( "You are allowed to play this game" );
age >= 18 || console.log( "The game is restricted to 18 and over" );

In the preceding example, we used the AND (&&) operator to invoke console.log
if the left-hand condition is Truthy. The OR (||) operator does the opposite, it calls
console.log if the condition is Falsy.

I think the most common case in practice is the shorthand condition where the
function is called only when it is provided:
/**
* @param {Function} [cb] - callback
*/
function fn( cb ) {
cb && cb();
};

The following is one more example on this:


/**
* @class AbstractFoo
*/
AbstractFoo = function(){
// call this.init if the subclass has init method
this.init && this.init();
};

Syntactic sugar was introduced to its full extent to the JavaScript world only
with the advance in CoffeeScript, a subset of the language that trans-compiles
(compiles source-to-source) into JavaScript. Actually CoffeeScript, inspired by Ruby,
Python, and Haskell, has unlocked arrow-functions, spreads, and other syntax to
JavaScript developers. In 2011, Brendan Eich (the author of JavaScript) admitted
that CoffeeScript influenced him in his work on EcmaScript Harmony, which was
finalized this summer in ECMA-262 6th edition specification. From a marketing
perspective, the specification writers agreed on using a new name convention that
calls the 6th edition as EcmaScript 2015 and the 7th edition as EcmaScript 2016. Yet the
community is used to abbreviations such as ES6 and ES7. To avoid confusion further
in the book, we will refer to the specifications by these names. Now we can look at
how this affects the new JavaScript.

[3]
Discovering Diverse Content Through
Random Scribd Documents
However young, however weak, dear children, you may be, know
that the youngest, the weakest, have some power here to give
either pleasure or pain. A generous spirit shrinks from inflicting
suffering on the smallest insect or the feeblest worm; and I trust
that no reader of my little tale will hesitate which part to take for his
own, or leave it doubtful whether he ought to be classed under the
title of Wings or Stings.

·FINIS·

FOOTNOTES:
[A] Naturalists doubt whether the violet-bee is a native of Britain.
It is known that one species of carpenter-bee is to be found in
England, but the one described above probably belongs to foreign
lands.

TRANSCRIBER’S NOTE:
Obvious typographical errors have been corrected.
*** END OF THE PROJECT GUTENBERG EBOOK WINGS AND
STINGS: A TALE FOR THE YOUNG ***

Updated editions will replace the previous one—the old editions will
be renamed.

Creating the works from print editions not protected by U.S.


copyright law means that no one owns a United States copyright in
these works, so the Foundation (and you!) can copy and distribute it
in the United States without permission and without paying
copyright royalties. Special rules, set forth in the General Terms of
Use part of this license, apply to copying and distributing Project
Gutenberg™ electronic works to protect the PROJECT GUTENBERG™
concept and trademark. Project Gutenberg is a registered trademark,
and may not be used if you charge for an eBook, except by following
the terms of the trademark license, including paying royalties for use
of the Project Gutenberg trademark. If you do not charge anything
for copies of this eBook, complying with the trademark license is
very easy. You may use this eBook for nearly any purpose such as
creation of derivative works, reports, performances and research.
Project Gutenberg eBooks may be modified and printed and given
away—you may do practically ANYTHING in the United States with
eBooks not protected by U.S. copyright law. Redistribution is subject
to the trademark license, especially commercial redistribution.

START: FULL LICENSE


THE FULL PROJECT GUTENBERG LICENSE
PLEASE READ THIS BEFORE YOU DISTRIBUTE OR USE THIS WORK

To protect the Project Gutenberg™ mission of promoting the free


distribution of electronic works, by using or distributing this work (or
any other work associated in any way with the phrase “Project
Gutenberg”), you agree to comply with all the terms of the Full
Project Gutenberg™ License available with this file or online at
www.gutenberg.org/license.

Section 1. General Terms of Use and


Redistributing Project Gutenberg™
electronic works
1.A. By reading or using any part of this Project Gutenberg™
electronic work, you indicate that you have read, understand, agree
to and accept all the terms of this license and intellectual property
(trademark/copyright) agreement. If you do not agree to abide by all
the terms of this agreement, you must cease using and return or
destroy all copies of Project Gutenberg™ electronic works in your
possession. If you paid a fee for obtaining a copy of or access to a
Project Gutenberg™ electronic work and you do not agree to be
bound by the terms of this agreement, you may obtain a refund
from the person or entity to whom you paid the fee as set forth in
paragraph 1.E.8.

1.B. “Project Gutenberg” is a registered trademark. It may only be


used on or associated in any way with an electronic work by people
who agree to be bound by the terms of this agreement. There are a
few things that you can do with most Project Gutenberg™ electronic
works even without complying with the full terms of this agreement.
See paragraph 1.C below. There are a lot of things you can do with
Project Gutenberg™ electronic works if you follow the terms of this
agreement and help preserve free future access to Project
Gutenberg™ electronic works. See paragraph 1.E below.
1.C. The Project Gutenberg Literary Archive Foundation (“the
Foundation” or PGLAF), owns a compilation copyright in the
collection of Project Gutenberg™ electronic works. Nearly all the
individual works in the collection are in the public domain in the
United States. If an individual work is unprotected by copyright law
in the United States and you are located in the United States, we do
not claim a right to prevent you from copying, distributing,
performing, displaying or creating derivative works based on the
work as long as all references to Project Gutenberg are removed. Of
course, we hope that you will support the Project Gutenberg™
mission of promoting free access to electronic works by freely
sharing Project Gutenberg™ works in compliance with the terms of
this agreement for keeping the Project Gutenberg™ name associated
with the work. You can easily comply with the terms of this
agreement by keeping this work in the same format with its attached
full Project Gutenberg™ License when you share it without charge
with others.

1.D. The copyright laws of the place where you are located also
govern what you can do with this work. Copyright laws in most
countries are in a constant state of change. If you are outside the
United States, check the laws of your country in addition to the
terms of this agreement before downloading, copying, displaying,
performing, distributing or creating derivative works based on this
work or any other Project Gutenberg™ work. The Foundation makes
no representations concerning the copyright status of any work in
any country other than the United States.

1.E. Unless you have removed all references to Project Gutenberg:

1.E.1. The following sentence, with active links to, or other


immediate access to, the full Project Gutenberg™ License must
appear prominently whenever any copy of a Project Gutenberg™
work (any work on which the phrase “Project Gutenberg” appears,
or with which the phrase “Project Gutenberg” is associated) is
accessed, displayed, performed, viewed, copied or distributed:
This eBook is for the use of anyone anywhere in the United
States and most other parts of the world at no cost and with
almost no restrictions whatsoever. You may copy it, give it away
or re-use it under the terms of the Project Gutenberg License
included with this eBook or online at www.gutenberg.org. If you
are not located in the United States, you will have to check the
laws of the country where you are located before using this
eBook.

1.E.2. If an individual Project Gutenberg™ electronic work is derived


from texts not protected by U.S. copyright law (does not contain a
notice indicating that it is posted with permission of the copyright
holder), the work can be copied and distributed to anyone in the
United States without paying any fees or charges. If you are
redistributing or providing access to a work with the phrase “Project
Gutenberg” associated with or appearing on the work, you must
comply either with the requirements of paragraphs 1.E.1 through
1.E.7 or obtain permission for the use of the work and the Project
Gutenberg™ trademark as set forth in paragraphs 1.E.8 or 1.E.9.

1.E.3. If an individual Project Gutenberg™ electronic work is posted


with the permission of the copyright holder, your use and distribution
must comply with both paragraphs 1.E.1 through 1.E.7 and any
additional terms imposed by the copyright holder. Additional terms
will be linked to the Project Gutenberg™ License for all works posted
with the permission of the copyright holder found at the beginning
of this work.

1.E.4. Do not unlink or detach or remove the full Project


Gutenberg™ License terms from this work, or any files containing a
part of this work or any other work associated with Project
Gutenberg™.

1.E.5. Do not copy, display, perform, distribute or redistribute this


electronic work, or any part of this electronic work, without
prominently displaying the sentence set forth in paragraph 1.E.1
with active links or immediate access to the full terms of the Project
Gutenberg™ License.

1.E.6. You may convert to and distribute this work in any binary,
compressed, marked up, nonproprietary or proprietary form,
including any word processing or hypertext form. However, if you
provide access to or distribute copies of a Project Gutenberg™ work
in a format other than “Plain Vanilla ASCII” or other format used in
the official version posted on the official Project Gutenberg™ website
(www.gutenberg.org), you must, at no additional cost, fee or
expense to the user, provide a copy, a means of exporting a copy, or
a means of obtaining a copy upon request, of the work in its original
“Plain Vanilla ASCII” or other form. Any alternate format must
include the full Project Gutenberg™ License as specified in
paragraph 1.E.1.

1.E.7. Do not charge a fee for access to, viewing, displaying,


performing, copying or distributing any Project Gutenberg™ works
unless you comply with paragraph 1.E.8 or 1.E.9.

1.E.8. You may charge a reasonable fee for copies of or providing


access to or distributing Project Gutenberg™ electronic works
provided that:

• You pay a royalty fee of 20% of the gross profits you derive
from the use of Project Gutenberg™ works calculated using the
method you already use to calculate your applicable taxes. The
fee is owed to the owner of the Project Gutenberg™ trademark,
but he has agreed to donate royalties under this paragraph to
the Project Gutenberg Literary Archive Foundation. Royalty
payments must be paid within 60 days following each date on
which you prepare (or are legally required to prepare) your
periodic tax returns. Royalty payments should be clearly marked
as such and sent to the Project Gutenberg Literary Archive
Foundation at the address specified in Section 4, “Information
about donations to the Project Gutenberg Literary Archive
Foundation.”

• You provide a full refund of any money paid by a user who


notifies you in writing (or by e-mail) within 30 days of receipt
that s/he does not agree to the terms of the full Project
Gutenberg™ License. You must require such a user to return or
destroy all copies of the works possessed in a physical medium
and discontinue all use of and all access to other copies of
Project Gutenberg™ works.

• You provide, in accordance with paragraph 1.F.3, a full refund of


any money paid for a work or a replacement copy, if a defect in
the electronic work is discovered and reported to you within 90
days of receipt of the work.

• You comply with all other terms of this agreement for free
distribution of Project Gutenberg™ works.

1.E.9. If you wish to charge a fee or distribute a Project Gutenberg™


electronic work or group of works on different terms than are set
forth in this agreement, you must obtain permission in writing from
the Project Gutenberg Literary Archive Foundation, the manager of
the Project Gutenberg™ trademark. Contact the Foundation as set
forth in Section 3 below.

1.F.

1.F.1. Project Gutenberg volunteers and employees expend


considerable effort to identify, do copyright research on, transcribe
and proofread works not protected by U.S. copyright law in creating
the Project Gutenberg™ collection. Despite these efforts, Project
Gutenberg™ electronic works, and the medium on which they may
be stored, may contain “Defects,” such as, but not limited to,
incomplete, inaccurate or corrupt data, transcription errors, a
copyright or other intellectual property infringement, a defective or
damaged disk or other medium, a computer virus, or computer
codes that damage or cannot be read by your equipment.

1.F.2. LIMITED WARRANTY, DISCLAIMER OF DAMAGES - Except for


the “Right of Replacement or Refund” described in paragraph 1.F.3,
the Project Gutenberg Literary Archive Foundation, the owner of the
Project Gutenberg™ trademark, and any other party distributing a
Project Gutenberg™ electronic work under this agreement, disclaim
all liability to you for damages, costs and expenses, including legal
fees. YOU AGREE THAT YOU HAVE NO REMEDIES FOR
NEGLIGENCE, STRICT LIABILITY, BREACH OF WARRANTY OR
BREACH OF CONTRACT EXCEPT THOSE PROVIDED IN PARAGRAPH
1.F.3. YOU AGREE THAT THE FOUNDATION, THE TRADEMARK
OWNER, AND ANY DISTRIBUTOR UNDER THIS AGREEMENT WILL
NOT BE LIABLE TO YOU FOR ACTUAL, DIRECT, INDIRECT,
CONSEQUENTIAL, PUNITIVE OR INCIDENTAL DAMAGES EVEN IF
YOU GIVE NOTICE OF THE POSSIBILITY OF SUCH DAMAGE.

1.F.3. LIMITED RIGHT OF REPLACEMENT OR REFUND - If you


discover a defect in this electronic work within 90 days of receiving
it, you can receive a refund of the money (if any) you paid for it by
sending a written explanation to the person you received the work
from. If you received the work on a physical medium, you must
return the medium with your written explanation. The person or
entity that provided you with the defective work may elect to provide
a replacement copy in lieu of a refund. If you received the work
electronically, the person or entity providing it to you may choose to
give you a second opportunity to receive the work electronically in
lieu of a refund. If the second copy is also defective, you may
demand a refund in writing without further opportunities to fix the
problem.

1.F.4. Except for the limited right of replacement or refund set forth
in paragraph 1.F.3, this work is provided to you ‘AS-IS’, WITH NO
OTHER WARRANTIES OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PURPOSE.

1.F.5. Some states do not allow disclaimers of certain implied


warranties or the exclusion or limitation of certain types of damages.
If any disclaimer or limitation set forth in this agreement violates the
law of the state applicable to this agreement, the agreement shall be
interpreted to make the maximum disclaimer or limitation permitted
by the applicable state law. The invalidity or unenforceability of any
provision of this agreement shall not void the remaining provisions.

1.F.6. INDEMNITY - You agree to indemnify and hold the Foundation,


the trademark owner, any agent or employee of the Foundation,
anyone providing copies of Project Gutenberg™ electronic works in
accordance with this agreement, and any volunteers associated with
the production, promotion and distribution of Project Gutenberg™
electronic works, harmless from all liability, costs and expenses,
including legal fees, that arise directly or indirectly from any of the
following which you do or cause to occur: (a) distribution of this or
any Project Gutenberg™ work, (b) alteration, modification, or
additions or deletions to any Project Gutenberg™ work, and (c) any
Defect you cause.

Section 2. Information about the Mission


of Project Gutenberg™
Project Gutenberg™ is synonymous with the free distribution of
electronic works in formats readable by the widest variety of
computers including obsolete, old, middle-aged and new computers.
It exists because of the efforts of hundreds of volunteers and
donations from people in all walks of life.

Volunteers and financial support to provide volunteers with the


assistance they need are critical to reaching Project Gutenberg™’s
goals and ensuring that the Project Gutenberg™ collection will
remain freely available for generations to come. In 2001, the Project
Gutenberg Literary Archive Foundation was created to provide a
secure and permanent future for Project Gutenberg™ and future
generations. To learn more about the Project Gutenberg Literary
Archive Foundation and how your efforts and donations can help,
see Sections 3 and 4 and the Foundation information page at
www.gutenberg.org.

Section 3. Information about the Project


Gutenberg Literary Archive Foundation
The Project Gutenberg Literary Archive Foundation is a non-profit
501(c)(3) educational corporation organized under the laws of the
state of Mississippi and granted tax exempt status by the Internal
Revenue Service. The Foundation’s EIN or federal tax identification
number is 64-6221541. Contributions to the Project Gutenberg
Literary Archive Foundation are tax deductible to the full extent
permitted by U.S. federal laws and your state’s laws.

The Foundation’s business office is located at 809 North 1500 West,


Salt Lake City, UT 84116, (801) 596-1887. Email contact links and up
to date contact information can be found at the Foundation’s website
and official page at www.gutenberg.org/contact

Section 4. Information about Donations to


the Project Gutenberg Literary Archive
Foundation
Project Gutenberg™ depends upon and cannot survive without
widespread public support and donations to carry out its mission of
increasing the number of public domain and licensed works that can
be freely distributed in machine-readable form accessible by the
widest array of equipment including outdated equipment. Many
small donations ($1 to $5,000) are particularly important to
maintaining tax exempt status with the IRS.

The Foundation is committed to complying with the laws regulating


charities and charitable donations in all 50 states of the United
States. Compliance requirements are not uniform and it takes a
considerable effort, much paperwork and many fees to meet and
keep up with these requirements. We do not solicit donations in
locations where we have not received written confirmation of
compliance. To SEND DONATIONS or determine the status of
compliance for any particular state visit www.gutenberg.org/donate.

While we cannot and do not solicit contributions from states where


we have not met the solicitation requirements, we know of no
prohibition against accepting unsolicited donations from donors in
such states who approach us with offers to donate.

International donations are gratefully accepted, but we cannot make


any statements concerning tax treatment of donations received from
outside the United States. U.S. laws alone swamp our small staff.

Please check the Project Gutenberg web pages for current donation
methods and addresses. Donations are accepted in a number of
other ways including checks, online payments and credit card
donations. To donate, please visit: www.gutenberg.org/donate.

Section 5. General Information About


Project Gutenberg™ electronic works
Professor Michael S. Hart was the originator of the Project
Gutenberg™ concept of a library of electronic works that could be
freely shared with anyone. For forty years, he produced and
distributed Project Gutenberg™ eBooks with only a loose network of
volunteer support.
Project Gutenberg™ eBooks are often created from several printed
editions, all of which are confirmed as not protected by copyright in
the U.S. unless a copyright notice is included. Thus, we do not
necessarily keep eBooks in compliance with any particular paper
edition.

Most people start at our website which has the main PG search
facility: www.gutenberg.org.

This website includes information about Project Gutenberg™,


including how to make donations to the Project Gutenberg Literary
Archive Foundation, how to help produce our new eBooks, and how
to subscribe to our email newsletter to hear about new eBooks.
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!

ebookfinal.com

You might also like