100% found this document useful (2 votes)
8 views

FXRuby Create Lean and Mean GUIs with Ruby Pragmatic Programmers 1st Edition Lyle Johnson pdf download

FXRuby: Create Lean and Mean GUIs with Ruby is a comprehensive guide by Lyle Johnson that teaches readers how to build graphical user interfaces using the FXRuby toolkit. The book covers everything from installation to advanced topics, making it suitable for both beginners and experienced programmers. It includes practical examples and insights from industry professionals, emphasizing a fun and engaging learning experience.

Uploaded by

gulevjheny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (2 votes)
8 views

FXRuby Create Lean and Mean GUIs with Ruby Pragmatic Programmers 1st Edition Lyle Johnson pdf download

FXRuby: Create Lean and Mean GUIs with Ruby is a comprehensive guide by Lyle Johnson that teaches readers how to build graphical user interfaces using the FXRuby toolkit. The book covers everything from installation to advanced topics, making it suitable for both beginners and experienced programmers. It includes practical examples and insights from industry professionals, emphasizing a fun and engaging learning experience.

Uploaded by

gulevjheny
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 53

FXRuby Create Lean and Mean GUIs with Ruby

Pragmatic Programmers 1st Edition Lyle Johnson


pdf download

https://ebookfinal.com/download/fxruby-create-lean-and-mean-guis-
with-ruby-pragmatic-programmers-1st-edition-lyle-johnson/

Explore and download more ebooks or textbooks


at ebookfinal.com
We have selected some products that you may be interested in
Click the link to download now or visit ebookfinal.com
for more options!.

Pragmatic Unit Testing in C with NUnit Pragmatic


Programmers 1st Edition Andy Hunt

https://ebookfinal.com/download/pragmatic-unit-testing-in-c-with-
nunit-pragmatic-programmers-1st-edition-andy-hunt/

Programming Ruby 1 9 2 0 The Pragmatic Programmers Guide


Fourth Edition Dave Thomas

https://ebookfinal.com/download/programming-ruby-1-9-2-0-the-
pragmatic-programmers-guide-fourth-edition-dave-thomas/

Getting MEAN with Mongo Express Angular and Node 1st


Edition Simon Holmes

https://ebookfinal.com/download/getting-mean-with-mongo-express-
angular-and-node-1st-edition-simon-holmes/

Distributed Programming with Ruby 1st Edition Mark Bates

https://ebookfinal.com/download/distributed-programming-with-ruby-1st-
edition-mark-bates/
Continuous Testing with Ruby Rails and JavaScript 1st
Edition Ben Rady

https://ebookfinal.com/download/continuous-testing-with-ruby-rails-
and-javascript-1st-edition-ben-rady/

Scripted GUI Testing with Ruby 1st Edition Ian Dees

https://ebookfinal.com/download/scripted-gui-testing-with-ruby-1st-
edition-ian-dees/

Lean Thinking Banish Waste and Create Wealth in Your


Corporation Revised and Updated 2nd Edition James P.
Womack
https://ebookfinal.com/download/lean-thinking-banish-waste-and-create-
wealth-in-your-corporation-revised-and-updated-2nd-edition-james-p-
womack/

Raven Scripting Java Builds with Ruby 1st Edition Matthieu


Riou

https://ebookfinal.com/download/raven-scripting-java-builds-with-
ruby-1st-edition-matthieu-riou/

Everyday Scripting with Ruby For Teams Testers and You 1st
Edition Brian Marick

https://ebookfinal.com/download/everyday-scripting-with-ruby-for-
teams-testers-and-you-1st-edition-brian-marick/
FXRuby Create Lean and Mean GUIs with Ruby
Pragmatic Programmers 1st Edition Lyle Johnson Digital
Instant Download
Author(s): Lyle Johnson
ISBN(s): 1934356077
Edition: 1
File Details: PDF, 1.91 MB
Year: 2008
Language: english
What readers are saying about FXRuby

Learning a GUI framework should be easy, but it’s usually hard.


Reading this book, I realized by contrast that the reason it’s usually
hard is that it’s no fun. Lyle’s results-oriented approach to teaching
makes learning FXRuby fun, and therefore easy. This book is a moti-
vating, well-written tutorial about getting things done in one of Ruby’s
most established widget toolkits from its most authoritative source.
Chad Fowler
CTO, InfoEther
Founding Co-director, Ruby Central

FXRuby is a rich, mature GUI toolkit that Lyle has maintained and
documented very well for years. With the addition of this excellent
book, this toolkit becomes only that much more usable.
Hal Fulton
Author, The Ruby Way

I was paid to develop a GUI app using Ruby back in 2003, and I
quickly settled on FOX/FXRuby as the right toolkit because of the
exceptional quality of the bindings and the high level of support Lyle
provided. My only regret? That I didn’t have this book! With it open on
your desk and the online references loaded in your browser, nothing
should be stopping you from building an amazing desktop application
using Ruby.
Nathaniel Talbott
Founder and Developer, Terralien, Inc.

Lyle’s deep knowledge of FXRuby ensures that this engaging book will
prepare you to make cross-platform GUIs in very little time at all.
Austin Ziegler
Software Designer and Developer
FXRuby: Create Lean and Mean GUIs with Ruby is a well-written
text straight from the horse’s mouth: a book about FXRuby from the
author of FXRuby. You can’t get better than that, unless, of course,
the library wrote the book itself.
Jeremy McAnally
Developer/technical writer, ENTP

This book is an excellent introduction to FXRuby programming. Lyle


does a good job of getting you started with the basics and moving on
to more advanced topics at just the right pace.
Daniel Berger
Software Engineer, Qwest, Inc.
FXRuby
Create Lean and Mean GUIs with Ruby

Lyle Johnson

The Pragmatic Bookshelf


Raleigh, North Carolina Dallas, Texas
Many of the designations used by manufacturers and sellers to distinguish their prod-
ucts are claimed as trademarks. Where those designations appear in this book, and The
Pragmatic Programmers, LLC was aware of a trademark claim, the designations have
been printed in initial capital letters or in all capitals. The Pragmatic Starter Kit, The
Pragmatic Programmer, Pragmatic Programming, Pragmatic Bookshelf and the linking g
device are trademarks of The Pragmatic Programmers, LLC.

Every precaution was taken in the preparation of this book. However, the publisher
assumes no responsibility for errors or omissions, or for damages that may result from
the use of information (including program listings) contained herein.

Our Pragmatic courses, workshops, and other products can help you and your team
create better software and have more fun. For more information, as well as the latest
Pragmatic titles, please visit us at

http://www.pragprog.com

Copyright © 2008 Lyle Johnson.

All rights reserved.

No part of this publication may be reproduced, stored in a retrieval system, or transmit-


ted, in any form, or by any means, electronic, mechanical, photocopying, recording, or
otherwise, without the prior consent of the publisher.

Printed in the United States of America.

ISBN-10: 1-934356-07-7
ISBN-13: 978-1-934356-07-4
Printed on acid-free paper with 50% recycled, 15% post-consumer content.
First printing, March 2008
Contents
Foreword 10

Acknowledgments 12

1 Introduction 13
1.1 What’s in This Book? . . . . . . . . . . . . . . . . . . . . 13
1.2 Who Is This Book For? . . . . . . . . . . . . . . . . . . . 14
1.3 How to Read This Book . . . . . . . . . . . . . . . . . . . 14
1.4 Where to Get Help . . . . . . . . . . . . . . . . . . . . . . 15
1.5 A Word About Versions . . . . . . . . . . . . . . . . . . . 18

I Building an FXRuby Application 19

2 Getting Started with FXRuby 20


2.1 Installing FXRuby . . . . . . . . . . . . . . . . . . . . . . 23
2.2 Instant Gratification . . . . . . . . . . . . . . . . . . . . . 25

3 The Picture Book Application 31


3.1 What Picture Book Does . . . . . . . . . . . . . . . . . . 31
3.2 Application Data . . . . . . . . . . . . . . . . . . . . . . . 33
3.3 Let’s Code . . . . . . . . . . . . . . . . . . . . . . . . . . . 35

4 Take 1: Display a Single Photo 36


4.1 Get Something Running . . . . . . . . . . . . . . . . . . . 36
4.2 Create the View . . . . . . . . . . . . . . . . . . . . . . . . 37
4.3 Construct an Image from a File . . . . . . . . . . . . . . 40

5 Take 2: Display an Entire Album 43


5.1 Add Album View . . . . . . . . . . . . . . . . . . . . . . . 44
5.2 Display Images as Thumbnails . . . . . . . . . . . . . . . 47
5.3 Import Photos from Files . . . . . . . . . . . . . . . . . . 50
5.4 Dynamically Reconfigure the Album View . . . . . . . . 55
5.5 Make the Album View Scrollable . . . . . . . . . . . . . . 58
CONTENTS 8

6 Take 3: Manage Multiple Albums 62


6.1 Create the Album List View . . . . . . . . . . . . . . . . . 62
6.2 Use a Split View . . . . . . . . . . . . . . . . . . . . . . . 65
6.3 Switch Between Albums . . . . . . . . . . . . . . . . . . 67
6.4 Add New Albums . . . . . . . . . . . . . . . . . . . . . . . 70
6.5 Serialize the Album List with YAML . . . . . . . . . . . . 72
6.6 So, What Now? . . . . . . . . . . . . . . . . . . . . . . . . 76

II FXRuby Fundamentals 78

7 FXRuby Under the Hood 79


7.1 Event-Driven Programming . . . . . . . . . . . . . . . . . 80
7.2 Mouse and Keyboard Events . . . . . . . . . . . . . . . . 85
7.3 Timers, Chores, Signals, and Input Events . . . . . . . 87
7.4 Syncing the User Interface with the Application Data . 91
7.5 Using Data Targets for GUI Update . . . . . . . . . . . . 92
7.6 Responsive Applications with Delayed Layout and Repaint 93
7.7 Client-Side vs. Server-Side Objects . . . . . . . . . . . . 95
7.8 How Windows Work . . . . . . . . . . . . . . . . . . . . . 98

8 Building Simple Widgets 100


8.1 Creating Labels and Buttons . . . . . . . . . . . . . . . . 101
8.2 Editing String Data with Text Fields . . . . . . . . . . . 111
8.3 Providing Hints with Tooltips and the Status Bar . . . . 113

9 Sorting Data with List and Table Widgets 115


9.1 Displaying Simple Lists with FXList . . . . . . . . . . . . 115
9.2 Good Things Come in Small Packages: FXComboBox
and FXListBox . . . . . . . . . . . . . . . . . . . . . . . . 118
9.3 Branching Out with Tree Lists . . . . . . . . . . . . . . . 121
9.4 Displaying Tabular Data with FXTable . . . . . . . . . . 126

10 Editing Text with the Text Widget 133


10.1 Adding and Removing Text . . . . . . . . . . . . . . . . . 134
10.2 Navigating Through Text . . . . . . . . . . . . . . . . . . 136
10.3 Searching in Text . . . . . . . . . . . . . . . . . . . . . . 137
10.4 Applying Styles to Text . . . . . . . . . . . . . . . . . . . 139
CONTENTS 9

11 Creating Visually Rich User Interfaces 142


11.1 Using Custom Fonts . . . . . . . . . . . . . . . . . . . . . 143
11.2 Pointing the Way with Cursors . . . . . . . . . . . . . . . 146
11.3 Creating and Displaying Images . . . . . . . . . . . . . . 149
11.4 Manipulating Image Data . . . . . . . . . . . . . . . . . . 151
11.5 Creating and Displaying Icons . . . . . . . . . . . . . . . 155
11.6 One More Thing . . . . . . . . . . . . . . . . . . . . . . . 158

12 Managing Layouts 159


12.1 Understanding the Packing Model . . . . . . . . . . . . . 160
12.2 Arranging Widgets in Rows and Columns with a Matrix
Layout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172
12.3 Dynamically Resizing Layouts with a Splitter Layout . . 176
12.4 Managing Large Content with Scrolling Windows . . . . 178
12.5 Organizing Windows with Tabbed Notebooks . . . . . . 179
12.6 Strategies for Using Different Layout Managers Together 181

13 Advanced Menu Management 187


13.1 Creating Cascading and Scrolling Menus . . . . . . . . . 187
13.2 Adding Separators, Radio Buttons, and Check Buttons
to Menus . . . . . . . . . . . . . . . . . . . . . . . . . . . 190
13.3 Adding Toolbars to an Application . . . . . . . . . . . . . 192
13.4 Creating Floating Menu Bars and Toolbars . . . . . . . 193

14 Providing Support with Dialog Boxes 196


14.1 Selecting Files with the File Dialog Box . . . . . . . . . . 197
14.2 Selecting a Directory with the Directory Dialog Box . . . 198
14.3 Choosing Colors with the Color Dialog Box . . . . . . . . 200
14.4 Selecting Fonts with the Font Dialog Box . . . . . . . . . 201
14.5 Alerting the User with Message Boxes . . . . . . . . . . 203
14.6 Creating Custom Dialog Boxes . . . . . . . . . . . . . . . 204
14.7 Looking Ahead . . . . . . . . . . . . . . . . . . . . . . . . 209

Bibliography 211

Index 212
Foreword
The FOX Toolkit is a library for designing user interfaces and has been
under development for more than ten years. FOX got its start as my
hobby project, called Free Objects for X (FOX), because my initial target
environment was the X Window system.
One of the early FOX adopters was CFD Research Corporation, where
Lyle and I worked. The user interface developers at the company were
pleasantly surprised with the concise coding needed to lay out their
interfaces, having been used to Motif, where placing a single button
would often require a dozen lines of code. The same task would often
require only a single line of code in FOX. Bolstered by this success,
the FOX library rapidly went through a number of changes; the library
got ported to Microsoft Windows, and support for 3D programming was
added. All the key ingredients were in place to transfer the company’s
GUI applications to the FOX platform.
FOX has now reached a point where developers can write code and be
reasonably confident that it will compile and run on numerous plat-
forms, from PCs running Windows to “big-box” Unix machines from
Sun and IBM. FOX continues to grow. In the past few years, the focus
has been on internationalization and localization, as well as multipro-
cessing support.
The FOX Toolkit is written in C++, and until other language bindings
became available, you had to program in C++ to use FOX. Now, with
the creation of the FXRuby library, the capabilities of the FOX Toolkit
have become available in the Ruby programming language.
In this book, you’ll learn how to build FOX-based graphical user inter-
faces within Ruby. In Part I, you’ll write your first small FXRuby appli-
cation, starting with detailed instructions on how to get FXRuby exten-
sions installed in your Ruby programming environment. You’ll work
through several iterations toward a functional application that illus-
trates many critical features of FXRuby programs.
F OREWORD 11

In Part II, the book goes into more detail on event-driven programming
and how to connect the user interface to useful executable Ruby code.
Moving on to the available controls and widgets, you’ll learn how to use
layout managers to place your user interface elements (this is a par-
ticularly useful chapter, because automatic layout is a foreign concept
even to many seasoned Windows programmers).
After you’ve read this book, you’ll be able to design great user interfaces
for your Ruby programs!

Jeroen van der Zijp (Principal FOX Toolkit Developer)


January 2008
Acknowledgments
I’ve been wanting to write a book about FXRuby development for a long
time. When I decided I was finally ready to do that, I knew I wanted to
work with the Pragmatic Programmers to make it happen. Many thanks
to Dave and Andy for giving me this opportunity.
Obviously, FXRuby would not exist were it not for the FOX Toolkit. I’d
like to thank my friend and former co-worker Jeroen van der Zijp for
letting me play a small part in FOX’s development over the years and
for all that I’ve learned from him in the process.
This book could easily have run off the rails if it weren’t for the hard
work and dedication of my editor, Susannah Davidson Pfalzer. Susan-
nah, thanks so much for your attention to detail and your expert guid-
ance as we worked through all of those revisions. The result is so much
better than it would have been without your help.
One of the realities of working on a book like this for months at a
time is that you get way too close to the text to be objective about it,
and you become unable to spot its flaws. For that reason, I owe many
thanks to the book’s reviewers: Dan Berger, Joey Gibson, Chris Hulan,
Sander Jansen, Chris Johnson, Joel VanderWerf, and Austin Ziegler.
Their comments and suggestions were invaluable. Thanks are likewise
due to the numerous beta book readers who took the time to point out
problems with the early releases of the book.
Finally, thanks to my wife, Denise, for her support and encouragement
and for putting up with a frequently distracted husband over the past
nine months. We are so going to the beach now that this is done.

Lyle Johnson
January 30, 2008
lyle@lylejohnson.name
Chapter 1

Introduction
FXRuby is a library for developing powerful and sophisticated cross-
platform graphical user interfaces (GUIs) for your Ruby applications.
It’s based on the FOX Toolkit, a popular open source C++ library devel-
oped by Jeroen van der Zijp. What that means for you as an application
developer is that you’re able to write code in the Ruby programming
language that you already know and love, while at the same time tak-
ing advantage of the performance and functionality of a fully featured,
highly optimized C++ toolkit.
Although FOX doesn’t have the same level of name recognition as some
other GUI toolkits, it has been available since 1997 and is still under
continuous development. FXRuby has been under development since
late 2000, and the first public release was in January 2001. I’ve been
the lead developer during that entire time, with a number of community
volunteers contributing patches along the way. It’s a tricky proposition
to guess the size of the user community for an open source project, but
according to the RubyForge statistics there have been close to 45,000
downloads of FXRuby since the project was moved there (and almost
18,000 before that, when it was hosted at SourceForge). Questions
posted to the FXRuby users mailing list are often answered by myself,
Jeroen van der Zijp (the developer of FOX), or one of the other longtime
members of the FXRuby community.

1.1 What’s in This Book?


The purpose of this book is to give you a head start on developing GUI
applications with Ruby and FXRuby through a combination of tutorial
exercises and focused technical information.
W HO I S T HIS B OOK F OR ? 14

This isn’t a comprehensive book on FXRuby programming, and it’s not


a reference manual.1 A nearly complete reference manual is available,
and it’s included with the standard FXRuby distribution. What this
book will do is get you over the initial conceptual hurdles and equip
you with the practical information that you need to build your own
applications.

1.2 Who Is This Book For?


This book is for software developers who want to learn how to develop
GUI applications using the Ruby programming language. If you’re new
to Ruby programming in general, you should understand that while
we’ll highlight certain Ruby programming techniques along the way,
this book isn’t intended to teach you how to program in Ruby. You don’t
need to be a Ruby guru, but it is important that you’re comfortable with
programming in Ruby, and object-oriented programming concepts in
general, before diving in.
Having said that, it’s not necessary for you to have any prior experience
with GUI programming to read this book. As new topics are introduced,
we’ll take the time to explain how they fit into the bigger picture and
how they might relate to things you’ve encountered in other contexts.
If you do have some previous experience with GUI application devel-
opment, you’ll be able to use this book to quickly identify similarities
and differences between this and other GUI toolkits that you’ve used in
the past. Regardless of your experience level, this book will provide a
means for you to get over the initial “hump” and learn the fundamen-
tals that you need to understand so that you can move on to developing
powerful user interfaces for your applications.

1.3 How to Read This Book


The first part of this book starts with installation instructions and then
moves on to an extended example, in which we incrementally build up
a full-fledged FXRuby application. This is the place to start if you’re
looking to get a feel for FXRuby programming. In fact, most folks seem
to enjoy building the application along with the book.

1. Let’s face it, you don’t have time to read a book that long, what with all of those books
about Rails that you haven’t gotten around to reading yet.
W HERE TO G ET H ELP 15

If you don’t want to do all of that typing, you can cheat and download
the source code (a compressed tar archive or a zip file).2
In the second part of the book, we’ll revisit some of the topics that
we covered while developing the example application, and we’ll go into
more detail about why things work the way they do. We’ll also cover
some additional topics that wouldn’t have fit neatly into the example
application but that are still important for you to be familiar with.
Along the way, you’ll see various conventions we’ve adopted.
Live Code
Most of the code snippets we show come from full-length, running
examples that you can download. To help you find your way, if a
code listing can be found in the download, there’ll be a bar above
the snippet (just like the one here):
Download hello.rb

require 'fox16'

app = Fox::FXApp.new
main = Fox::FXMainWindow.new(app, "Hello, World!" ,
:width => 200, :height => 100)
app.create
main.show(Fox::PLACEMENT_SCREEN)
app.run

This contains the path to the code within the download. If you
are reading the PDF version of this book and your PDF viewer
supports hyperlinks, you can click the bar, and the code should
appear in a browser window. Some browsers (such as Safari) will
mistakenly try to interpret some of the templates as HTML. If this
happens, view the source of the page to see the real source code.

1.4 Where to Get Help


The best places to get help on FXRuby (other than this book, of course)
are the mailing lists and the various sources of online documentation.

Mailing Lists
Two different mailing lists are dedicated to FXRuby. The announce-
ments list is a very low-traffic list that’s primarily used to notify users

2. http://www.pragprog.com/titles/fxruby has the links for the downloads.


W HERE TO G ET H ELP 16

of new releases of FXRuby, while the users list is a higher-traffic list


where general discussion of FXRuby programming issues takes place.
You can find instructions on how to subscribe to these lists, as well as
the mailing list archives, at the RubyForge project page for FXRuby.3
In addition to the FXRuby lists, you may find it valuable to subscribe to
the regular FOX users mailing list. Many of the issues you’ll encounter
when developing FXRuby applications are the same as those faced by
developers working with the FOX library for C++ GUI applications. For
instructions on how to subscribe to the FOX users mailing list and for
archives of that list, see the SourceForge project page for FOX.4

Online Documentation
Despite rumors to the contrary, there is actually a good deal of online
documentation for both FOX and FXRuby, if you know where to look
for it.

FOX Documentation Page


The Documentation page at the FOX website has a number of articles
with in-depth information on topics such as layout managers, icons
and images, fonts, and drag and drop.5 These articles tend to have
more hard-core technical details and are of course aimed at users of
the C++ library, so they aren’t necessarily appropriate for beginning
users of FXRuby. Once you’ve finished this book, however, you may
want to turn to these articles to obtain a deeper understanding of some
of the mechanics of FOX programming.

FOX Community Wiki


The FOX Community6 is a wiki written by and for FOX developers. It
features an extended FAQ list, and it’s a great source of tutorials and
other kinds of documentation. A lot of the sample code is geared toward
C++ developers who use FOX in their applications, but most of the
information there is also relevant to FXRuby application development.

3. http://rubyforge.org/mail/?group_id=300
4. http://sourceforge.net/mail/?group_id=3372
5. http://www.fox-toolkit.org/doc.html
6. http://www.fox-toolkit.net/
W HERE TO G ET H ELP 17

FXRuby User’s Guide


The FXRuby User’s Guide 7 is really a hodgepodge of information about
FXRuby, but it does provide fairly comprehensive information on how to
install FXRuby. It also provides tutorials on working with the clipboard
and how to integrate drag and drop into your FXRuby applications.

API Documentation
As you (probably) knew before you bought this book, it’s not a refer-
ence manual. The API documentation for FXRuby is fairly comprehen-
sive and freely available, so there’s no point in trying to duplicate that
material here. To view the latest and most accurate API documentation,
point your web browser to the copy hosted at the FXRuby website.8 If
you installed FXRuby via RubyGems, you should have a local copy of
the documentation as well. To view the HTML documentation that RDoc
generated when you installed the gem, first start the gem server:
$ gem_server
[2007-05-09 17:18:04] INFO WEBrick 1.3.1
[2007-05-09 17:18:04] INFO ruby 1.8.6 (2007-03-13) [i686-darwin8.8.1]
[2007-05-09 17:18:04] INFO WEBrick::HTTPServer#start: pid=427 port=8808

Now, point your web browser to http://localhost:8808/. Scroll through the


listing of installed gems until you find the entry for FXRuby, and then
click the [rdoc] link to view the documentation.
Another nifty trick you can use to look up information about an FXRuby
class or one of its methods is to ask the ri command-line tool:
$ ri Fox::FXCheckButton#checked?
------------------------------------ Fox::FXCheckButton#checked?
checked?()
----------------------------------------------------------------
Return +true+ if this check button is in the checked state.

The ri command is awfully convenient and is of course usable for any


Ruby libraries that you’ve installed, including the core and standard
library classes and methods. If you installed FXRuby using RubyGems,
it should have automatically generated and installed the ri documenta-
tion for FXRuby at that time. If you installed FXRuby directly from the
source tarball, or via some other means, you may need to generate and
install the ri documentation yourself before you can successfully use
the ri command to look up the FXRuby documentation.

7. http://www.fxruby.org/doc/book.html
8. http://www.fxruby.org/doc/api/
A W ORD A BOUT V ERSIONS 18

Regardless, if for some reason ri isn’t properly installed on your system,


do yourself a favor and get it working!

1.5 A Word About Versions


The discussion and examples in this book are based on FXRuby 1.6,
the current release at the time this book was written.
Generally speaking, it’s in your best interest to use the latest available
versions of FOX and FXRuby, because those versions will have the lat-
est bug fixes and enhancements. Note, however, that the major version
number for a given FXRuby release indicates the major version number
of the FOX release that it’s compatible with; for example, FXRuby 1.6
is intended for use with FOX 1.6. This is important because the latest
release of FOX is often tagged as an unstable or “development” release,
and those versions aren’t guaranteed to work with the latest release of
FXRuby.
Now that we’ve got that squared away, let’s get started!
Part I

Building an FXRuby Application


Chapter 2

Getting Started with FXRuby


This chapter is your jump start to FXRuby application development.
We’ll spend a few pages looking at FXRuby and how it works with FOX
before moving on to instructions for installing FXRuby on several of the
most popular operating systems. We’ll wrap up the chapter by building
a simple “Hello, World!” application so you can learn how FXRuby appli-
cations are typically structured and verify that the software is properly
installed.
FXRuby is packaged as an extension module for Ruby. That means
that it’s a C++ library that the Ruby interpreter loads at runtime, intro-
ducing a bunch of new Ruby classes and constants in the process.
Figure 2.1, on the following page, illustrates the relationship between
your application code (written in Ruby), the FXRuby extension, the
FOX library, and the operating system. From the application devel-
oper’s perspective, FXRuby looks like any other “pure Ruby” library
that you might use; the difference is that this library’s source code isn’t
actually written in Ruby.1 FXRuby exposes all the functionality of the
FOX library, but it’s more than just a simple “wrapper” around the API.
FXRuby takes advantage of Ruby language features and uses them to
provide an even higher-level interface to FOX. For example, it’s some-
what tedious to write all the C++ code required to map user interface
events to executable code in traditional FOX applications. In FXRuby,
you’re able to connect a Ruby block directly to a widget with just a few
lines of code.

1. Actually, a good bit of FXRuby is written in Ruby, but that doesn’t change how you
use it.
Discovering Diverse Content Through
Random Scribd Documents
then ironically advises his readers to place in such their entire
happiness.
So palpable is the bitter irony of the author throughout the book,
and even in the twenty-first verse of the third chapter, yet by no
manner of interpretation can this specialized text be made to mean
that beasts are annihilated after death, while men rise again and
soar above earthly things to honor and glory. Ironically the writer
assumes in it that his readers do not know the difference between
the spirit of man and that of beast, and, reasoning from that
position, advises them that “there is nothing better for a man than
that he should eat and drink, and that he should make his soul enjoy
good in his labor.”
From what has been shown, it is evident that the passage from
Psalms does not even contain the idea of annihilation as regards
beasts, and that the one from Ecclesiastes is entirely
misapprehended. That they have no bearing upon the subject must
now be manifest. We cannot, therefore, resist the conclusion that
the Scriptures do not deny future life to the inferior animals.
This admission gives courage for a step still further forward. Man’s
latest achievement is to conceive that all existence is a unit. One
spirit pervades the whole natural world, an emanation from the Spirit
of Him who sitteth enthroned in the Eternal Heavens, and who not
only is, as Moses declares, “God of the spirits of all flesh,” but God of
the spirits of all animate nature. We cannot divorce the two great
kingdoms of nature. If there is a futurity of existence for man, whom
we are told was “made a little lower than the angels,” but who in
these latter days seems to have deteriorated, and who in thousands
of instances displays a character far less noble and honorable than
that of the dog which he kennels and feeds, then there must be for
the so-called brute, the companion of his joys and his sorrows. If for
beast, bird, reptile, fish and insect, and none can be so foolish in the
face of the most indubitable evidence to deny it, then there must be
for tree, shrub and flower, for God, who is infinite in love, mercy and
charity, would not be God if solely concerned with the future of the
smallest fractional part of His children. Man is psychically related to
all life. There is soul, in some sort of development, in everything;
and certainly God meant in His grand scheme of redemption to lift
the world, not a portion of it, but the entire world, out of its lower
ideas into its higher beauties and realities.
FUTURE LIFE.

T
hat the Scriptures, contrary to popular tradition, do not deny a
future life to the lower animals has already been conclusively
shown. But do they declare anything in favor of another world
for beast as well as for man? This is a question which we shall now
endeavor to answer. As to man’s immortality, the Old Testament
Scriptures teach the doctrine by inference rather than by direct
assertion, for the reason, as has been presumed, that the writers of
the several books, which were selected at a comparatively late
period from among many others and formed into the volume
popularly designated the Bible, assumed as a matter of course that
man was immortal, and therefore did not concern themselves about
a matter which they supposed everybody knew. But as far as the Old
Testament goes, inference tells more strongly in favor of the beast’s
immortality than that of man. Although in either case there does not
appear to be any definite assertion of a futurity of existence, yet
there is no such denial of the immortality of the beast as has already
been shown in the case of the man.
Beasts, as readers of the Old Testament only too well know, were
included in the merciful provision of the Sabbath, which, in its
essence, was a spiritual and not simply a physical ordinance. And,
again, we find many provisions in the ancient Scriptures against
maltreating the lower animals, or giving them unnecessary pain, and
these provisions stand side by side in the Divine Law with those
which apply to man. All are familiar with the prohibition of “seething
a kid in its mother’s milk,” and the non-muzzling of the ox in treading
out the corn lest he should suffer the pangs of hunger in the
presence of the food which he may not eat. Even bird’s nesting was
regulated by Divine Law. “If a bird’s nest chance to be before thee in
the way in any tree, or on the ground, whether they be young ones,
or eggs, and the dam sitting upon the young, or upon the eggs, thou
shalt not take the dam with the young: But thou shalt in any wise let
the dam go, and take the young to thee; that it may be well with
thee, and that thou mayest prolong thy days.” Moreover, as many
animals must be killed daily, some for sacrifice and others solely for
food, the strictest regulations were enjoined that their death should
be sharp and quick, and that the whole of their blood should be
poured out upon the ground lest they suffer lingering pain.
In keeping with the same consideration felt by Deity towards the
kid and ox and bird, as expressed in the Law, we would refer to the
few concluding sentences of the Book of Jonah:—
“Thou hast had pity on the gourd, for the which thou hast not
labored, neither madest it grow; which came up in a night, and
perished in a night.
“And should I not spare Nineveh, that great city, wherein are more
than six score thousand persons that cannot discern between their
right hand and their left hand; and also much cattle?”
“Every beast of the forest is mine,” saith the Lord, “and the cattle
upon a thousand hills.” And again, “I know all the fowls of the
mountains: and the wild beasts of the field are mine.” Similar
passages, in which God announces himself as the protector of the
beast as well as of man, could be given, for the Scriptures are full of
them. Who does not recall the well-known saying of our Lord
respecting the lives of the sparrows: “Are not two sparrows sold for
a farthing? and one of them shall not fall on the ground without the
notice of your Father.”
Cowper in his “Task,” makes allusion to this branch of our subject
in the following lines:—
“Man may dismiss compassion from his heart,
But God will never. When He charged the Jew
To assist his foe’s down-fallen beast to rise;
And when the bush-exploring boy, that seized
The young, to let the parent-bird go free;
Proved He not plainly that His meaner works,
Are yet His care, and have an interest all—
All in the universal Father’s love?”
One passage there is which certainly does point to a future for the
beast as well as for man, and which places them both on the very
same plane. It is found in Genesis, ninth chapter and fifth verse, and
constitutes a part of the law which was delivered to Noah, and which
was subsequently incorporated in the fuller law given through
Moses. “And surely your blood of your lives will I require,” said God
to Noah and his sons, “at the hand of every beast will I require it,
and at the hand of every man; at the hand of every man’s brother
will I require the life of man.” In Exodus, chapter twenty-one and
twenty-eighth verse, we read, “If an ox gore a man or a woman,
that they die: then the ox shall be surely stoned, and his flesh shall
not be eaten; but the owner of the ox shall be quit.”
While there are no passages of Scripture, as has been seen, which
deny immortality of life to the lower animals, yet there are certainly
some which tend to show it by inference. But the Scriptures were
written for human beings, and not for the lower animals, and
therefore it could hardly be expected that any information could be
gained therefrom on the subject. As we find so few direct references
to the future state of man, it is not at all to be expected that we
should receive direct instruction upon the after-life of the beast.
But just as man has had within himself for untold ages an intuitive
witness to his own immortality, yet there are those, lovers and
friends of the so-called brute, who have an instinctive sense that
animals, some of whom surpass in love, unselfishness, generosity,
conscience and self-sacrifice many of their human brethren, must
share with him in addition to these virtues an immortal spirit in
which they take their rise. No more eminent personage than Bishop
Butler was a believer in this idea. Substantially he asserts that the
Scriptures give no reasons why the lower animals should not possess
immortal souls. Similar sentiments have been voiced by equally
distinguished writers.
Southey, writing of the death of a favorite spaniel that had been
the companion of his boyhood, says:—
“Ah, poor companion! when thou followedst last
Thy master’s parting footsteps to the gate
Which closed forever on him, thou didst lose
Thy best friend, and none was left to plead
For the old age of brute fidelity.
But fare thee well. Mine is no narrowed creed;
And He who gave thee being did not frame
The mystery of Life to be the sport
Of merciless man. There is another world
For all that live and move—a better one!
Where the proud bipeds, who would fain confine
Infinite Goodness to the little bounds
Of their own charity, may envy thee.”
Thus does Lamartine, in “Jocelyn’s Episode,” beautifully express
himself in addressing a faithful and affectionate canine by the name
of Fido:—
“I cannot, will not, deem thee a deceiving,
Illusive mockery of human feeling,
A body organized, by fond caress
Warmed into seeming tenderness;
A mere automaton, on which our love
Plays, as on puppets, when their wires we move.
No! when that feeling quits thy glazing eye,
’Twill live in some blest world beyond the sky.”
Not by man alone have these higher qualities been accorded to
the brute. Women have praised the good within the lower animals,
and been quite as willing to share with them the benefits of an
immortal life. Eugenie de Guérin, a woman distinguished for her
devotional piety, and an author of no mean repute, was, like the
most of her sex, quite passionately fond of pets. Hers was a turtle-
dove. Its voice was the first to greet her in the morning. There was
a pleasure in its soft, gentle cooings, as they fell upon her ear, that
sent a sweet consolation to her busy, thinking soul. But the time
came at last when she must part with her treasure. The morn
dawned bright, an August morning, and the bird was well and
happy, but, with the falling of the shadows at even-tide, its little life
went out. A bitter trial it was for the mistress, who loved with a
perfect love her feathered friend. While wrestling with her intense
sorrow, and after she had sincerely placed its mortal remains in a
dainty cavity beneath the roses, it was that she wrote: “I have a
tolerably strong belief in the souls of animals, and I should even like
there to be a little paradise for the good and gentle, like turtle-
doves, dogs and lambs. But what to do with wolves and other
wicked animals? To damn them?—that embarrasses me.”
Less devotional, perhaps, and looking rather to logic than to
intuition, was the mind of Mrs. Somerville. With such a difference in
constitution between the two women, we would naturally look for
the greatest divergence of opinion upon a matter of this kind, but,
astonishing to relate, there is noticeable a marked unanimity.
Speaking of death, and the accompanying change of environing
objects, this gifted writer, in her eighty-ninth year, says in her
“Memoirs”:—
“I shall regret the sky, the sea, with all their beautiful coloring; the
earth, with its verdure and flowers; but far more shall I grieve to
leave animals that have followed our steps affectionately for years,
without knowing for certainty their ultimate fate, though I firmly
believe that the living principle is never extinguished. Since the
atoms of matter are indestructible, as far as we know, it is difficult to
believe that the span which gives to their union life, memory,
affection, intelligence and fidelity is evanescent.
“Every atom in the human frame, as well as in that of animals,
undergoes a periodical change by continual waste and renovation:
the abode is changed, not its inhabitant. If animals have no future,
the existence of many is most wretched. Multitudes are starved,
cruelly beaten, and loaded during life; many die under a barbarous
vivisection.
“I cannot believe that any creature was created for
uncompensated misery: it would be contrary to the attributes of
God’s mercy and justice. I am sincerely happy to find that I am not
the only believer in the immortality of the lower animals.”
To have given the many opinions that have been expressed by the
good and wise of the past in favor of the belief that animals
received, in common with man, a particle of the divine essence, and
hence became immortal, would have extended this chapter beyond
intended limits. We have room for just another witness. No one is
better known for his convictions upon this subject than the late Dr.
Wood, whose contributions to natural history are known the world
over. Speaking of the death of his dog Rory, a creature that
manifested in the flesh the strongest affection for his keeper, the
Doctor says:—
“I could not believe that an animal which would die of grief, as he
died, for the absence of his master, would have his existence limited
to this present world, and that such intensity of love should
terminate at the same moment that the material heart ceased to
beat.”
When we think of the apparent inequality that is everywhere to be
seen in the lives both of man and beast, we cannot believe, as Mrs.
Somerville has remarked, that any being was “created for
uncompensated misery.” Some human beings are endowed with
everything that a man can desire—health, strength, riches,
accomplishments and capacity for enjoyment—while others are
destitute of all these accessories to happiness. Putting aside the fact
that those whose lots seem to be the most enviable are the least to
be envied, we cannot help acknowledging that this disparity does
exist, and that the earthly lot of some is very hard, while that of
others is very easy. But we must remember that there is taught in
the New Testament the grand doctrine of Compensation. Paul
alludes to this when he remarks that the sufferings of this world are
not to be compared with the glories of the world to come, and that
the troubles, trials and tribulations of this life are but the precursor
of that glorified existence where all these things will be utterly
unknown. That some such arrangement would be nothing more than
justice there can be no question, and that some principle of Divine
Justice must exist was instinctively known long before it was
explicitly declared by the inspired apostle, for references to such
compensation are found throughout the Psalms. Even Job himself,
sunk as he was in the very depth of afflictions, could say: “Though
He slay me, yet will I trust in Him; but I will maintain my own ways
before Him. He also shall be my salvation; for an hypocrite shall not
come before Him.” So far, then, as man is concerned, this problem of
apparent inequality is not so difficult of solution, for he knows only
too well that in spite of his hard and bitter earth-life that Divine
Justice will be more than vindicated in the life beyond the grave to
which he aspires. But in the case of the lower animals, granting that
they have no future existence, what, I ask, becomes of Divine
Justice? In this land of enlightenment we meet with many animals
that are treated with the greatest kindness by their masters, and
others, endowed with capacities that are not a whit inferior to their
more fortunate brethren, that are treated with the utmost cruelty.
While one is petted and pampered, another is abused and given over
to the pangs of hunger and starvation. If there is a future life for
these animals, it is simply impossible to recognize in their Maker that
justice which sensible, reasoning man should expect. Such an
injustice, as shown by the lives which we have contrasted, would be
too flagrant for any human being to perpetrate, unless such a being
was wholly deficient in the ideas of right and wrong. But on the
supposition that these animals possess immortal souls, and that
there is for them a future life in which these souls shall be developed
to their fullest capacities, then these apparent discrepancies can be
reconciled with Absolute Justice and Perfect Love. In His dealings
with the lower animals, as with ourselves, God looks to the spiritual
rather than the material world, and by the means of the one
instructs and prepares his pupils for the other. With Paul I firmly
believe that suffering in the present world has for its object a
preparation for and an introduction to a future life, and therefore am
thoroughly convinced that any creature capable of suffering has in
that capacity its passport to an eternal world.
Another step, that is, the possession of Individuality, as connected
with Immortality, now presses forward for consideration. As for man,
did he not possess Individuality, no diverseness of management
would be needed, for all would be treated in a similar manner. No
two faces in man are precisely alike, for the very simple reason that
no two souls, of which the countenance is an indication, are alike.
The same rule, no matter what may be affirmed to the contrary,
holds good among the lower animals. To the casual observer no
apparent difference can be detected between any two individuals of
a flock of sheep, a portrait of one equally resembling that of any
other. But a shepherd, who understands his business, will readily
distinguish every sheep of his flock, as well as describe the mental
peculiarities of each individual. One ordinary yellow canary looks just
like another yellow canary to the ordinary vision, while in reality the
mental character of each bird is impressed just as strongly upon its
countenance as are human qualities upon that of man. This quality it
is, both in man and beast, that implies a separate treatment for each
individual, and becomes a plea for an immortality of life. I am not
alone in this idea. It is simply astounding how Individuality in the
lower animals is ignored by man. The generality of grooms treat all
horses as though they were just so many machines turned out of
the same mould, and to be treated just like machines. There is in
every species a double kind of Individuality. One kind there is that is
common to the entire species, and then there is in addition to this
common characteristic another that distinguishes each separate
being from its fellows. It is the former that makes a species what it
is, and there can be no doubt that each will exist in the future life,
and that both may be capable of development. The dog, the horse,
the lion and the elephant, and in truth all animals that may be fitted
to survive, will be in the other world what they are in this. They will
be better animals in that world, just as we hope to be better men,
but they will not approach us any nearer than they do in the earth-
life.
Man does not, as some are foolish enough to claim, lower the
condition of humanity the least by granting immortality to the lower
animals. If they be immortal, as the evidence adduces most strongly
shows, there is not the slightest use of denial. We cannot shirk a
fact, and even if we could, we ought not to do it. Such an argument,
which seeks to elevate man by depreciating his lower fellow-
creatures, is not very creditable to humanity. In announcing the
belief that the lower animals share immortality with man in the
higher world, as they share mortality in this, does not claim for them
the slightest equality. Man will be man and beast will be beast, and
insect will be insect, in the next world as they are in this. They are
living exponents of Divine Ideas, as is evident from the Scriptures
and the teachings of science, and will be wanted to continue in the
world of spirit the work which they have begun in the world of
matter. True it is, as has been asserted, that because a man can
transmit his ideas to the lower animals, there is evidence that they
possess a spirit which is able to communicate with the spirit of man.
When a man gives an order to his dog, and is obeyed, there is proof
that both possess spirits, similar in quality, though differing in
degree. We know that to give an order to a plant would be useless
and absurd, because the plant has not the spirit that can respond to
the spirit of the man in the same manner that a dog’s or a horse’s
spirit can, but the inability so to respond does not prove that the
plant is devoid of a spirit. That the spirit of the plant does respond to
the spirit of the man, when it adapts itself to the conditions which
the spirit of the man has imposed upon it, there can be no question,
or the many hundred plants which have been reclaimed from a state
of wildness by a judicious and careful management upon the part of
man would have been among the impossibilities of modern
civilization. The spirit of man must have entered into the spirit of the
plant, and held communion therewith, or the world to-day would not
have been blessed with its manifold cereals, fruits and vegetables,
all of which have been rendered possible for use by the spirit of man
entering into an understanding with the nature, wants and peculiar
dispositions of the plants about him. No less are plants living
exponents of Divine Ideas than worms, insects, beasts and men are,
and as such living exponents, they are as much needed in the future
existence, at least such as are fitted to continue in the spirit-world
the work begun in the world of matter, as are the higher forms of
animal beings. As plants go a great ways towards making this earth-
life a paradise of beauty and delight, and have ever been associated
through the ages with animal life, each of the two great kingdoms of
life from simple beginnings attaining to higher and still higher
development up to the present period—the Era of Mind—it cannot be
possible that the two will have become suddenly divorced when the
temporal or earth-life is about to pass into the eternal or spirit-life.
Heaven would not be Heaven without the plants that we have
cultured, and tended, and admired.
Concluding, then, let me say, I claim not for the lower animals the
slightest equality with man. What I claim for them is a higher status
in creation than is generally attributed to them. I claim for them a
future life, where they will receive a just compensation for the
sufferings which so many of them have to undergo in this world.
Most of the cruelties which are perpetrated upon animals are due to
the habit which man has, in his exalted opinion of self, of
considering them as mere automata, without susceptibilities, without
reason and without the capacity of a future. That I have achieved
the purpose, with which I set out, of proving that all life is immortal,
or that soul exists in plants and animals, I think must be admitted. If
this doctrine of immortality shall have the effect of bringing about a
more humane treatment of the animals over which man has been
given dominion, and thus contribute, be it ever so little, to their well-
being and happiness, even in this life, then the object attained will
be felt to be a just and worthy recompense for the thought and
labor which have been expended in its support and defence. Not
alone are we of the upper walks of being made the possessors of
the inner life, but all nature shares it in common with us, and love is
its expression and the method of its action.

THE END.
Transcriber’s Notes

Inconsistent and unusual or archaic spelling, use of


accents and diacriticals, hyphenation and
capitalisation have been retained, except as
mentioned below.
Depending on the hard- and software used and their
settings used to read this text, not all elements
may display as intended.
Page 7, List of Illustrations: the portrait of the
author is not the frontispiece, and is not included
in this edition of the book.
Page 45, "a single red-eye speck": should probably
read "a single red eye-speck".
Page 73, "unutterly unable": as printed in the source
document.
Page 99, Line Below Shows Natural Size: based on
the size of the physical book, this would make the
insect’s natural size around 27 mm (just over 1″).
Page 317/318, paragraph starting "Returning to the
philology ...": a closing quote mark is missing.
Page 464/465, paragraph starting "That there is a
distinction ...": a closing quote mark is missing.
Changes made
Illustrations have been moved out of text
paragraphs.
Some obvious minor typographical and punctuation
errors have been corrected silently.
Lists of illustrations: illustration numbers have been
added.
Page 44: "quiet unable" changed to "quite unable".
Page 62: "plants not natives to this country"
changed to "plants not native to this country".
Page 245: PANDION HALIÆTUS changed to Pandion
haliætus for consistency.
Page 264: caption "Red-eyed Vireo’s Two-Storied
Nest With Cow-bird’s egg beneath" added cf. list
of full-page plates.
*** END OF THE PROJECT GUTENBERG EBOOK INTELLIGENCE IN
PLANTS AND ANIMALS ***

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