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

Web Application Design and Implementation Apache 2 PHP5 MySQL JavaScript and Linux UNIX Quantitative Software Engineering Series 1st Edition Steven A. Gabarró instant download

The document is a comprehensive guide on web application design and implementation using Apache 2, PHP5, MySQL, JavaScript, and Linux/UNIX, authored by Steven A. Gabarro. It covers fundamental concepts, programming languages, and practical steps for developing web applications, including database management and client-server interactions. The book is part of the Quantitative Software Engineering Series and is published by Wiley.

Uploaded by

richiraoliya
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 (1 vote)
37 views

Web Application Design and Implementation Apache 2 PHP5 MySQL JavaScript and Linux UNIX Quantitative Software Engineering Series 1st Edition Steven A. Gabarró instant download

The document is a comprehensive guide on web application design and implementation using Apache 2, PHP5, MySQL, JavaScript, and Linux/UNIX, authored by Steven A. Gabarro. It covers fundamental concepts, programming languages, and practical steps for developing web applications, including database management and client-server interactions. The book is part of the Quantitative Software Engineering Series and is published by Wiley.

Uploaded by

richiraoliya
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/ 86

Web Application Design and Implementation Apache

2 PHP5 MySQL JavaScript and Linux UNIX


Quantitative Software Engineering Series 1st
Edition Steven A. Gabarró pdf download
https://ebookgate.com/product/web-application-design-and-
implementation-apache-2-php5-mysql-javascript-and-linux-unix-
quantitative-software-engineering-series-1st-edition-steven-a-
gabarro/

Get Instant Ebook Downloads – Browse at https://ebookgate.com


Instant digital products (PDF, ePub, MOBI) available
Download now and explore formats that suit you...

Professional LAMP Linux Apache MySQL and PHP Web


Development 1st Edition Jason Gerner

https://ebookgate.com/product/professional-lamp-linux-apache-mysql-
and-php-web-development-1st-edition-jason-gerner/

ebookgate.com

PHP5 and MySQL bible Tim Converse

https://ebookgate.com/product/php5-and-mysql-bible-tim-converse/

ebookgate.com

Apache MyFaces 1 2 Web Application Development 1st New


edition Edition Bart Kummel

https://ebookgate.com/product/apache-myfaces-1-2-web-application-
development-1st-new-edition-edition-bart-kummel/

ebookgate.com

The Apache Modules Book Application Development with


Apache Prentice Hall Open Source Software Development
Series 1st Edition Nick Kew
https://ebookgate.com/product/the-apache-modules-book-application-
development-with-apache-prentice-hall-open-source-software-
development-series-1st-edition-nick-kew/
ebookgate.com
Setting Up LAMP Getting Linux Apache MySQL and PHP Working
Together 1st Edition Eric Filson

https://ebookgate.com/product/setting-up-lamp-getting-linux-apache-
mysql-and-php-working-together-1st-edition-eric-filson/

ebookgate.com

Handbook of Research on Mobile Software Engineering Design


Implementation and Emergent Applications 1st Edition Paulo
Alencar
https://ebookgate.com/product/handbook-of-research-on-mobile-software-
engineering-design-implementation-and-emergent-applications-1st-
edition-paulo-alencar/
ebookgate.com

JavaScript Application Design A Build First Approach 1st


Edition Nicolas Bevacqua

https://ebookgate.com/product/javascript-application-design-a-build-
first-approach-1st-edition-nicolas-bevacqua/

ebookgate.com

Software Specification and Design An Engineering Approach


1st Edition Ph.D.

https://ebookgate.com/product/software-specification-and-design-an-
engineering-approach-1st-edition-ph-d/

ebookgate.com

JavaScript The Web Warrior Series 6th Edition Sasha Vodnik

https://ebookgate.com/product/javascript-the-web-warrior-series-6th-
edition-sasha-vodnik/

ebookgate.com
Web Application Design
and Implementation
•• e T ..

~I t 807 ~
=1~WlLEY:
:12007 ;
-;
• '
. l e . . . T ..... I ...
.
r

THE WILEY BICENTENNIAL-KNOWLEDGE FOR GENERATIONS

<S achgeneration has its unique needsand aspirations. When Charles Wiley first
opened his small printing shop in lower Manhattan in 1807, it was a generation
of boundless potential searching for an identity. And we were there, helping to
define a new American literary tradition. Over half a century later, in the midst
of the Second Industrial Revolution, it was a generationfocusedon building the
future. Once again, we werethere,supplyingthe criticalscientific,technical,and
engineering knowledge that helped frame the' world. Throughout the 20th
Century, and into the :new millennium, nations began to reach out beyond their
own borders and a new international community was born. Wiley was there,
expanding its operationsaround the world to enable a global exchangeof ideas,
opinions, and know-how.

For 200 years, Wiley has been an integral part of each generation's journey,
enablingthe flowof information and understanding necessaryto meet their needs
and fulfill their aspirations. Today, bold new technologies are changing the way
we live and learn. Wiley will be there, providing you the must-have knowledge
you need to imaginenew worlds, new possibilities, and new opportunities.

Generations come and go, but you can always count on Wiley to provide you the
knowledge you need,when and whereyou need it!

Lu~';'~~.~ ~~u~
WILLIAM .... PESCE PETER BaaTH WILEY
PRESIDENT AND CHIEF' EXECUTIVE DFFlCER CHAIRMAN OF" THE BOARD
Web Application Design
and Implementation
Apache 2, PHP5, MySQL,
JavaScript, and Linux/UNIX

Steven A. Gabarro
Stevens Institute of Technology
Hoboken, New Jersey

IEEE
~computer
SOciety
60TH anniversary

"'
BICENTENNIAL

it807~
.
=~WILEY=z
.-
z
:2007~
,.~
BICENTENNIAL

WILEY-INTERSCIENCE
A John Wiley & Sons, Inc., Publication
Copyright © 2007 by John Wiley & Sons, Inc. All rights reserved.

Published by John Wiley & Sons, Inc., Hoboken, New Jersey.


Published simultaneously in Canada.

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


any form or by any means, electronic, mechanical, photocopying, recording, scanning, or
otherwise, except as permitted under Section 107 or 108 of the 1976 United States Copyright
Act, without either the prior written permission of the Publisher, or authorization through
payment of the appropriate per-copy fee to the Copyright Clearance Center, Inc., 222
Rosewood Drive, Danvers, M,A 01923, (978) 750-8400, fax (978) 750-4470, or on the web at
www.copyright.com. Requests to the Publisher for permission should be addressed to the
Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030,
(201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permission.

Limit of Liability/Disclaimer of Warranty: While the publisher and author have used their
best efforts in preparing this book, they make no representations or warranties with respect
to the accuracy or completeness of the contents of this book and specifically disclaim any
implied warranties of merchantability or fitness for a particular purpose. No warranty may be
created or extended by sales representatives or written sales materials. The advice and
strategies contained herein may not be suitable for your situation. You should consult with a
professional where appropriate. Neither the publisher nor author shall be liable for any loss
of profit or any other commercial damages, including but not limited to special, incidental,
consequential, or other damages.

For general information on our other products and services or for technical support, please
contact our Customer Care Department within the United States at (800) 762-2974, outside
the United States at (317) 572·-3993 or fax (317) 572-4002.

Wiley also publishes its books in a variety of electronic formats. Some content that appears
in print may not be available in electronic formats. For more information about Wiley
products, visit our web site at www.wiley.com.

Library of Congress Cataloging-in-Publication Data:


Gabarr6, Steven A., 1979-
Web application design and implementation: Apache 2, PHP5, MySQL,
JavaScript, and Linux/Unix / by Steven A. Gabarro,
p. em.
Includes index.
ISBN-13: 978-0-471-77391-7 (cloth)
ISBN-I0: 0-471-77391-3 (cloth)
1. Web site development. 2. Web sites-Design. 3. Application
software-Development. I. Title.
TK5105.8883.G33 2007
006.7-dc22
2006014999
Contents

Preface xiii
About the Author / xiii
Before We Get Started I xiii
Who Should Read This Book? I xiv
About the Examples I xiv
How to Read This Book I xiv

Acknowledgments xv

Introduction: Web Application Recipe 1


Overview I I
Procedure I I
Step I-Understanding the Problem and Finding the
Solution / 1
Step 2-Designing the Database / 2
Step 3-Major Functionalities / 2
Step 4-Backside / 2
Step 5-Irnprovements on Functionality I 2
Step 6-Irnprovements on Looks / 3
Step 7-Thorough Testing, Hacking Attempts / 3
Step 8-Presentation / 3
Step 9-Publication / 3
Step IO-Celebration (and Maintenance) I 4
v
vi CONTENTS

1. Fundamentals 5
The Origins of the Internet I 5
The World Wide Web I 6
The Web Browsers I 7
The Web Servers I 7
TCP/IP BASICS I 8
The Internet Layer I 9
The Transport Layer I 11
The Application Layer I 11
The Toolbox I 12
Browsers I 12
FTP I 13
Email Clients I 14
Programming Tools I 14
Other Useful Tools I 15

2. The Different Approaches of Web Programming 17


Before We Get Started I 17
The Basics-HTMloJ I 17
The Creator-SGML I 18
Other SGML-Based Languages-XML and XSL I 19
The Good Old Java / 20
Something Different-JavaScript / 21
The Savior-PHP I 22
The Rival-ASP.N]~T I 22
The Myth-CGI I 23
Another Big Option-Perl / 23
The Future?-C# / 24
Client-Side versus Server-Side-Which Side to Pick? I 24
My Choices-PHP, MySQL, JavaScript I 25

3. Introduction to HTML 27
What Do You Need to Get Started? I 27
How Does HTML Work? I 28
Syntax Basics / 28
File Structure I 28
Tag Parameters I 30
Basic Text Formatting I 30
External References I 32
Links I 32
Images I 33
CONTENTS vii

Organizing Data / 34
Lists / 35
Tables / 36
Frames / 39
Special Characters I 43

4. Work Environment 45
Introduction I 45
Downloading the Software I 45
Installing the Apache Server I 46
Installation Steps I 46
Checking the Installation I 47
Possible Errors I 47
Configuring Apache I 48
Installing PHP5 I 48
Testing PHP I 50
Installing MySQL I 50
Adding a MySQL User I 51
How Do I Know if MySQL is Running? I 51
Installing PhpMyAdmin I 51
Installing a Bulletin Board: phpBB I 52
Installation Steps I 52
Basic Security Considerations I 54
Conclusion I 55

5. PHP-A Server-Side Scripting Language 57


How Does It Work? I 57
Some "New" Words on PHP / 57
Syntax Generalities I 58
Instructions I 58
Operators I 61
Mathematical Functions I 61
Data Types I 63
Constants I 64
Variables I 65

6. PUP Arrays and Flow of Control 69


Arrays I 69
Basic Arrays / 69
Associative Arrays I 70
viii CONTENTS

Multidimensional Arrays / 71
Array Functions / 74
PHP Program Structure and Flow of Control / 77
Conditions / 77
Loops / 80
Functions / 82

7. Using Files, Folders, and Strings in PUP 85


Using Files / 85
Folder Manipulation / 89
Basic String Manipulation / 90
Changing a String / 90
Finding and Comparing / 93
Formatting Strings / 94
Manipulating HT~f1L Files / 95
PHP Information Functions / 96
Closing Remarks / 97
Writing a Basic File Explorer / 97
Requirements / 97
Hints / 98
Case Study: An Indexer/Searcher-Step 1 / 98
Overview / 98
The Indexer-Step 1 / 99

8. PUPS and Object-Oriented Programming 101


Overview / 101
Classes and Objects / 101
Classes in PHP / 102
Constructors and Destructors / 103
Visibility / 104
The Scope Resolution Operator / 105
The Static Keyword / 105
Class Constants / 106
Class Abstraction / 106
Object Interfaces / 106
Copying and Cloning Objects / 107
Comparing Objects / 108
Type Hinting / 109
Exceptions / 109
Final Words / 110
CONTENTS ix

9. Creating Some Interactivity 111


Overview / 111
Forms / 111
Writing a Form in HTML / 111
GET versus POST / 115
Retrieving the Form Infomation on a PHP Script / 115
Dynamically Creating Forms / 116
Transferring Data Between PHP Scripts / 117
Cookies / 117
Sessions / 120
One Last Useful Function and Design Techniques I 122
Assignments I 123
File Explorer-Step 2 / 123
Case Study: Indexer/Searcher-Step 2 / 124
10. Making Cleaner Code and Output 127
Cleaning Up Your Code / 127
What You Need / 127
How to Use It?-HTML Side I 128
How to Use It?-PHP Side / 128
Cleaning Up Your Output / 131
The CSS File I 132
Useful Tools / 134
Assignment / 135
11. Using Databases 137
Overview I 137
Database Basics I 137
The Entity Relationship Model / 137
More Practical Examples I 138
Typical Sources of Error / 139
Simplifying the Diagrams I 140
Using MySQL I 140
MySQL Syntax / 141
Data Types / 142
MySQL Numeric Data 1)rpes / 142
Date and Time Data Types / 143
String Data Types / 144
MySQL Operators / 144
MySQL Instructions / 145
Using Functions in MySQL / 150
X CONTENTS

12. Using PhpMyAdmin 151


Overview / 151
Creating a Database / 151
Creating Tables / 152
Accessing an Existing Table / 154
Exporting/Importing a Database Structure and Content / 154
Assignment-Final Project / 157

13. Creating Database-Driven Websites with PHP/MySQL 159


Overview / 159
Connecting to Your MySQL Server with PHP / 159
Submitting SQL Queries / 160
Processing the Results of a Query / 161
Example of Login Procedure / 162
Other Useful Functions / 163
Grouping Our Methods in a Class / 164
Indexer/Searcher-Steps 3 and 4 / 168

14. JavaScript-A Client-Side Scripting Language 171


Introduction / 171
JavaScript Syntax / 173
Types of Data and Variables I 173
Operations and Calculations / 173
Arrays / 175
Decisions / 176
Loops / 176
Using Functions / 177
Using Objects / 178
The String Objects / 178
The Math Class / 179
The Array Objects / 181
The Date Objects / 181

15. Programming the Browser 185


Overview / 185
The Window Object / 185
The Location Object / 186
The History Object / 186
The Navigator Object / 186
The Screen Object / 187
The Document Object / 187
CONTENTS xi

Using Events / 191


Timers / 194
Time to Practice! / 195

16. Windows and Frames 197


Frames and JavaScript / 197
Windows and JavaScript / 201
Assignments / 206
One Last Funny Example / 206

17. String Manipulations Revisited 209


Overview / 209
New Basic String Methods / 209
Regular Expressions in JavaScript / 210
Regular Expressions in PHP / 213
The Set of PCRE / 214

18. JavaScript and DHTML 217


Overview / 217
Positioning Elements / 217
Writing Dynamic Menus in DHTML / 222
Your Turn!! / 225

19. Putting It All Together! 227


Overview / 227
Procedure / 227
Step I-Understanding the Problem and Finding the
Solution / 227
Step 2-Designing the Database / 228
Step 3-Main Functionalities / 230
Step 4-Backside / 231
Step 5-Improvements on Functionality / 231
Step 6-Improvements on Looks / 232
Step 7-Thorough Testing, Hacking Attempts / 232
Step 8-Presentation / 233
Step 9-Publication / 233
Step IO-Celebration © (and Maintenance) / 234
What Language to Use? / 234
xli CONTENTS

Appendix A: Special Characters 237

Appendix B: Installing on UNIX 241


Overview / 241
Installing Apache and PHP / 241
Installing MySQL / 243

Appendix C: Advanced phpBB 247

Appendix D: class.FastTemplate.php 251

Appendix E: File Upload Script 267

Bibliography 269

Index 271
Preface

ABOUT THE AUTHOR

Steven Gabarr6 was born in 1979 and raised in Alicante, Spain. He started
programming early, learning BASIC (Beginner's All-purpose Symbolic
Instruction Code) at age 9. Later on, in high school, he learned Turbo Pascal
and C. At that point it was pretty obvious that he was going to end up as a
computer scientist. He ended up studying for a master's degree in computer
science in the Ecole Pour l'Informatique et les Techniques Avancees, where
he specialized in advanced multimedia and Web technologies, graduating
with honors, finishing third in his class. He went to the United States in
January 2002, enrolling in the Masters of Science in Information Systems at
the Stevens Institute of Technology, in Hoboken, New Jersey. There he quickly
advanced from teaching assistant to full-time instructor. On his appointment
as full-time faculty, he created the first Web programming course at Stevens,
based on his personal experiences. This book is the result of that course, and
is a close reflection of what Steven teaches his students.

BEFORE WE GET STARTED

In my years of programming, I have learned tons of different programming


languages, ranging from Basic to Java, and including C, PHP, JavaScript,
Visual Basic, C++, Assembly 68k, and many others. Because of this variety I
have always been obsessed with utilizing the tools I had available to combine
the best aspects of each programming language.
xiii
xiv PREFACE

With this mentality I decided to create a Web programming course


that would teach the ins and outs of the most commonly used free Web tech-
nologies. I have always supported free software, and as the big UNIX fan that
I am, I had to teach open-source technologies. This book is the result of the
work I did on the course, with added content to take it a step further.

WHO SHOULD READ THIS BOOK?

The way this book is organized, it should be ideal for anyone trying to learn
how to create complete Websites with no previous knowledge of any of the
languages presented. It does require some minimum knowledge of program-
ming in general, as well as object-oriented programming basics to understand
Chapter 8.
It is also a good read for Web designers that know about making pages
look nice, but have no knowledge of how to create dynamic pages built
through a database or anyone who would like to pick up on the art of pro-
gramming pages. Realize: that I have never been a good graphic designer, so
this book will not tell you how to do things like making decisions regarding
the proper colors, fonts, or sizes to use, or other cosmetic details. I will deal
with how to set those features up, but will not tell you how to pick your layout
or color schemes, because I am definitely not good at it. Instead, I will con-
centrate on how to actually program useful pages with loads of functionality.

ABOUT THE EXAMPLES

All the examples have been tested, and if any are not compatible with a spe-
cific browser, this will be stated in the text. You can find all the example files,
as well as an example solution for the mini exercises and the indexer/searcher
case study at ftp://ftp.wiley.com/public/sci_tech_med/web_application. I will
also work on extra examples that I will make available to illustrate other areas
of the book that did not get a full example. I would have included many more
examples, but then you would need two or three volumes this size. Instead, I
will just put everything in a Website for you to download and test. I hope you
enjoy it all!

HOW TO READ THIS BOOK

The book is organized to be read front to back, but you may skip chapters as you
see fit, or use the book as a reference. The Introduction is a summary of Chapter
19 and should be used by people already experienced in Web development. It is
basically meant as a guide to using this book as a "Web programming cook-
book." You may read this Introduction for brief guidelines or go straight to
Chapter 19 if you need an in-depth explanation with a practical example.
Acknowledgments

I'd like to express great thanks to my family first for always being there for
me. I wouldn't be where I am without them, and I'll never manage to thank
them enough for that. To my very close (and special, a.k.a. N.B.) friends, I
thank you for your support and patience over the years; it is not easy putting
up with me for so long, but you have always given me some of the best times
I could hope for. Quick "howdy" to my online friends at COTW and BF2C
for helping me steam off when I had too much work and needed a break.
Thanks to Larry Bernstein for allowing me the opportunity to write this
book, and of course thanks to the people at John Wiley & Sons for getting
my first book published even though I'm still "a kid." Special thanks to
Whitney, Paul and Melissa for all of their help and patience; and to Ben for
the cover image. ©

xv
Introduction

Web Application Recipe

OVERVIEW

You might be wondering why you are reading an "Introduction" chapter and
why this chapter is called "Web Application Recipe." Well, this chapter is
your quick guide to professional Web application design and implementation.
It is in essence a summary of the last chapter of the book (Chapter 19),
created mainly for people with enough experience in Web programming to
skip some of the chapters presented. This chapter will give you the rundown
of the major steps in the lifecycle of a Web project, and will refer to the chap-
ters where you might find more in-depth information on the topics covered.
I call it the "recipe" because it gives you the general layout of what needs to
be done, before getting into the specific details that each individual chapter
will cover. For a more in-depth guideline with a practical example, be sure to
read Chapter 19.

PROCEDURE

Step 1-Understanding the Problem and Finding the Solution


The first step in Web development (and any type of project, to be honest) is
to understand what the problem is, as well as what input will be used and

Web Application Design and Implementation: Apache 2, PHP5, MySQL, JavtiScript, and
Linux/UNIX, by Steven A. Gabarr6
Copyright © 2007 by John Wiley & Sons, Inc.

1
2 WEB APPLICATION RECIPE

what output should be produced. This phase is usually done in meetings


between the project manager and the project sponsor (the person paying for
the project). This is a crucial phase as it defines the scope of the project, such
as the features that need to be implemented, and the feel that the page should
have. The main area of discussion in this step is what the project will do,
without concentrating on the "how."

Step 2-Designing the Database


When creating web applications, chances are your program will need to store
data; hence the use of databases. Many developers create the database as they
implement the program, but this can cause serious troubles as they realize
well into the project that: the initial design of the database is flawed and all
the work needs to be redone. This is why you should always start by designing
the database, keeping in mind what the project needs are. Chapters 11 and
12 will show you how to design and create a database. In a database-driven
project the database is the heart of the project.

Step 3-Major Functionalities


Once the database is created, it is time to program the major functionalities
of your application. Many programmers tend to spend a lot of time making
sure that the pages they create look good, without worrying about whether
they actually do something. Webpage appearance is obviously important, but
you will get more out of an ugly functional Web application than with a pretty-
looking useless page. Most of the work needed in this phase will require
accessing the database. To find out more about how to do so, check Chapter
13. This step is basically like programming the brain of your application,
ensuring that its core runs perfectly well.

Step 4-Backside
Once the core of the project is up and running, you need to implement the
back end of the project. This is the section of the project that will be used by
administrators to manage the Website after it has been published, and it is a
good idea to have it up and running before the regular users start meddling
with the Web application. If you need some information on writing scripts in
PHP, check out Chapters 5-9.

Step 5-lmprovements on Functionality


This is the phase where you start having fun with the project and improve
its functionalities. It is the opportunity to begin improving the client-side
functionalities by adding some JavaScript scripts to your pages, such as form
PROCEDURE 3

verifications. Check Chapters 14-18 for more information on how to program


in JavaScript. Just make sure that the improvements you decide to work on
are within the scope of the project, to avoid what is known as "scope creep"
(see Chapter 19).

Step 6-lmprovements on Looks


Once your project is working, you may start working on the esthetics. Start
by using style sheets (Chapter 10), and do not hesitate to ask your favorite
Web designer for help. In case you wonder about the difference between
a web developer and a Web designer, in essence, a Web designer takes
care of the looks (appearance) of Websites and Web developers write the
scripts that make the pages work. This is the step that adds the skin to the
project.

Step 7-Thorough Testing, Hacking Attempts


This is probably one of the most important phases in the project. The goal of
this phase is to ensure that the project is flawless and that you have made it
hackerproof. The best asset in this phase is imagination and a bit of paranoia.
Never assume that your users will be friendly, using your application for what
it was meant to be. The true secret to a hacker-safe program is to think like
a hacker. Try to think of any security hole that you might not have fixed yet
and fix it! This step is the equivalent of getting some immunizations for your
project. The more time you spend here, the less time you will spend dealing
with attacks.

Step 8-Presentation
Assuming that you are not writing the application for yourself and there is
money involved, you will need to present your final project to your project
sponsor. The key here is to be relaxed and be confident that your project
is rock-solid. If you follow the guidelines in this book, this should not be
a problem. If you are presenting to a nontechnical person, start by showing
the general features of the project, getting into details only when asked to
do so. If you are presenting to a fellow developer, go straight to the
functionalities.

Step 9-Publication
When the project has been approved, it is time to release it. Place it in your
desired host and make sure that everything is set up properly so that users
worldwide can access it. This phase should be fairly fast.
4 WEB APPLICATION RECIPE

Step 10-Celebration (and Maintenance)


Once the project is published, this is your chance for a small break. Enjoy
your favorite brew, have a good night's sleep, and get back to work! Once a
project is published, you need to maintain it, updating the database as needed
or fixing bugs that users might have found.
1
Fundamentals

THE ORIGINS OF THE INTERNET

Not that long ago, in a galaxy pretty close by, men and women used to live
without practical means of communication. Paper was the main medium used
for information sharing and horses the main carrier for that medium. But
science kept working, and in 1831 Joseph Henry invented the first electric
telegraph. Four years later, Samuel Morse invented the Morse code, and
worked on the very first long-distance electric telegraph line, which he fin-
ished in 1843. A bigger leap in communication progress was made by Alex-
ander Graham Bell, who patented the electric telephone in 1876.Long-distance
communication was finally a reality, but still archaic compared to what was
to be achieved. With the arrival of computers in the midtwentieth century,
people realized the potential of storing and processing data in those amazing
new machines. Furthermore, the United States and the Soviet Union were
deep in the Cold War, and the fear of a possible strike was constantly present
in the military's mind. One of the main concerns was the possibility that all
communication between remote locations could be interrupted by an attack.
Telephone and telegraph lines were out in the open, and could be easily
damaged, so the National Security Agency (NSA) thought of a way to
preserve communications. Emulating the principles of telephone commu-
nication, in the 1960s, the NSA thought of connecting computers through

Web Application Design and Implementation: Apache 2, PHP5, MySQL, JavaScript, and
Linux/UNIX, by Steven A. Gabarr6
Copyright © 2007 by John Wiley & Sons, Inc.

5
6 FUNDAMENTALS

wide-area networks (WANs), so that if the phone lines went down, they would
still be able to send orders to detachments across the country, through the
use of computers. In order to make this idea a reality, the Advanced Research
Project Agency (ARPA) created the first computer network in 1969, and
named it the ARPANET. It was composed of only four computers, located
in the University of California at Los Angeles (UCLA), the University of
California at Santa Barbara (UCSB), the University of Utah, and the Stan-
ford Research Institute (SRI). Three years later, in 1972, the use of routers
allowed the ARPANET to have 20 nodes and 50 host computers, which could
all communicate through tools such as the tel net and FTP (File Transfer
Protocol). In 1974 Vincent Cerf, from the SRI, and Robert Kahn, from the
Defense Advanced Research Project Agency (DARPA), presented the Trans-
mission Control Protocol/Internet Protocol (TCP/IP) basics, forever chang-
ing the waycomputers would communicate. In 1983the Defense Communication
Agency (DCA) took control of the ARPANET and separated the military
section to form the MILNET, which would be used for military purposes only.
In the mid-1980s the two main existing networks, the ARPANET and the
NSFNET (created by the National Science Foundation), merged to create a
massive computer network. That merge motivated a trend that brought more
and more computers to the network, and this network of networks was then
named "the Internet." By 1990 the Internet had 3000 subnets and over 200,000
host computers. The estimated number of host computers in the year 2004
was approximately 234 million, and growing.

THE WORLD WIDE WEB

After creation of the Internet, great potential could be seen way beyond the
actual work that was being done. Computers were destined to do more than
utilize telnets and FTP; it was great to be able to link one computer to
another in order to send files, but the problem of communication was not yet
totally solved. Scientists doing research had to connect to a remote computer
and send their research results one at the time through FTP. This was faster
than sending manuscripts through "snail mail," but it was still not the best
option, so in 1989 Tim Berners-Lee presented the World Wide Web project
to the Conseil Europeen de Recherche Nucleaire (CERN; European Orga-
nization for Nuclear Research, based in Switzerland). The idea was to come
up with a set of standards for information sharing that scientists. around the
world would be able to use. The goal was to be able to have all research
documents in a format and location accessible to all interested regardless of
the platform being used . In 1994 the World Wide Web Consortium (W3C)
was created to lead the World Wide Web (WWW) to its full potential by
developing common protocols that would promote its evolution and ensure
its operability. You can find out more about the W3C visiting their Website,
www.w3c.org.
THE WEB SERVERS 7

THE WEB BROWSERS

Right at this point we have seen what lead to the creation of the computer
network known as "the Internet," and the reasoning behind the apparition of
the World Wide Web. But we still have a main problem that we haven't
answered yet-how do we use all this to communicate? First the Internet
brought us the media through which the information would flow, then the
WWW provided a standard format for information formatting, but there
was still the problem of how to read that information. To solve that problem,
some tool had to be created that would use the current standards and decode
Web documents and format them in such a way that would be intelligible
to the user. The Web browsers came to the rescue and solved that pro-
blem. The first graphical user interface (GUI) with the WWW to appear
was Mosaic, created by the National Center of Supercomputer Applications
(NCSA) at the University of Illinois in 1993. In 1994 Norway entered in
the pages of Internet history by creating the still-used Opera. Soon after-
ward Netscape appeared, followed by Microsoft's Internet Explorer, which
appeared along Windows 95. From that point on, the browsing market
has done nothing but evolve and-Fortunately for us, the users-improve.
Nowadays the two main browsers used are Internet Explorer and Mozilla
Firefox.

THE WEB SERVERS

Now that we know what the Internet is, the purpose of the World Wide Web,
and why we use Web browsers, another question may arise: "Where are all
these data stored?" It is definitely enlightening to know how we access all the
information that the World Wide Web has to offer, but where is all that infor-
mation? Well, the answer is pretty simple; it is in all the computers that form
the Internet. Some people become alarmed, believing that any computer con-
nected to the Internet will automatically make all of its files accessible to the
entire world. Not to worry, that is not how it works. In order to share informa-
tion in a specific computer, some software has to be installed on the computer,
making it a "Web server." The server creates a list of folders that will be
shared when someone attempts to connect to the computer using standard
Web protocols. There are two main competitors in the Web server market.
The first one, my personal favorite and the one used throughout this book, is
Apache, developed by the Apache Software Foundation (www.apache.or~).
Apache has the great advantage of being totally free of charge and works on
every platform. It is an open-source program, which means that you can actu-
ally see the code behind the server and even participate in the improvement
of Apache. It is reliable and vastly used around the world, and pretty much
the only reliable option on UNIX/Linux. The other main server is Microsoft's
Internet Information Services (lIS, www.microsoft.com/iis). lIS is not open-
8 FUNDAMENTALS

source and works only on Windows operating systems, although a simplified


free version is available with Windows XP Professional. The latest versions
of lIS run on Windows Server 2003, which obviously is not free. Some of the
differences between lIS and Apache reside in their user interface. Apache,
as most UNIX-based software, is configured entirely through a simple text
file that is loaded when the server starts up, whereas lIS has a GUI that is
meant to be much more user-friendly. Choosing which server to use is based
mainly on knowing which technologies will be used as well as the budget
available. Users on a low budget will probably prefer the use of open-source
technology and free development platforms; hence the use of Apache. If, on
the other hand, you wish to use Microsoft's .NET and you have the money to
afford it, lIS is the best option.

TCP/IP BASICS

As mentioned earlier, the Internet was strongly enhanced by the creation of


TCP/IP by Cerf and Kahn, but how exactly did TCP/IP help in this new era
of communications? When studying network communications, we learn about
the Open Systems Interconnection (OSI) layer model. This model breaks
down all computer networking into seven distinct layers. Computers can com-
municate at the same level through a set of protocols adapted to that particu-
lar layer. The seven layers are as follows (in ascending order):
1. Physical layer-responsible for sending raw bits over the communica-
tion channel. It is specific to the medium [twisted-pair or fiberoptic
cable, wifi (wireless fidelity), etc.].
2. Data link layer-takes a raw transmission and transforms it into a line
free of undetected transmission errors. It also breaks the input data into
data frames and transmits them sequentially. Finally it attaches special
bit patterns at the beginning and end of the frame like the starting frame
delimiter (SFD), cyclic redundancy check (CRe), or the preamble. This
is the layer responsible for flow control and error control.
3. Network layer-concerned with addressing and routing of messages to
their respective final destinations.
4. Transport layer-·provides services that support reliable end-to-end
communications, such as generating the final address of the destination,
establishing the connection, error recovery, and termination of the
session.
5. Session layer-responsible for the dialog between two cooperating
applications or processes. Remote login and spooling operations use the
session layer to ensure successful login and to control the flow of data
to the remote printer. The token management in a token ring configura-
tion is handled by the session layer.
TCPIIP BASICS 9

6. Presentation layer-concerned with the syntax and semantics of the


information transmitted from end to end. For example, X Windows is
considered a level 6 service.
7. Application layer-provides the utilities and tools for application pro-
grams and users, like telnet, FTP, DNS, and HTTP.

TCP/IP is basically a simplification of the OSI layer model that concen-


trates on only four layers: network access layer (Ethernet, FDDI, or ISDN),
Internet layer (IP), transport layer (TCP, UDP), and application layer (FTP,
telnet, SMTP, HTTP).

The Internet Layer


The Internet layer is the equivalent of the network layer in the OSI model. It
contains the Internet Protocol (IP), which provides addressing, datagram
services, data package segmentation, and transmission parameter selection.
In order to function properly, TCP/IP relies on IP addresses, which are
assigned to each computer. An IP address is composed of 4 bytes, and is
usually shown as four numbers separated by dots. Each of these numbers can
range between 0 and 255, since it represents only one of the bytes of the IP
address (and, as you should know, you can represent 256 numbers with only
8 bits). Each IP address is composed of two parts, the network address and
the computer address. To understand how the address is broken down, you
need to know your subnet mask. The way it works is through a basic binary
AND operation between your address and your subnet mask. The result of that
operation represents the network address. For example, let's assume that your
IP is 192.168.1.20, and your subnet mask is 255.255.255.0. Let us see how we
get the network address:
If you are not sure about how to use the binary AND with nonbinary
numbers, start by transforming each number to binary. 192.168.1.20 becomes
11000000.10101000.00000001.00010100, and 255.255.255.0 is 11111111.11111
111.11111111.00000000. Performing the AND operation between those two
numbers gives us 11000000.10101000.00000001.00000000, which is no other
than 192.168.1.0. You can achieve this result faster by realizing that 255 in
binary is written 11111111, and since an AND operation between a 1 and any
other bit will leave the bit unchanged, we can basically keep the numbers of
the IP address that correspond to the 255s of the subnet mask. Then we know
that a binary AND between 0 and anything will always be 0, so where our
subnet mask is 0, we can directly write o. So, if we have an IP of 155.180.24.45
and a subnet mask of 255.255.0.0, our network address will be 155.180.0.0.
This network address lets us know which computers we will be able to
communicate with directly. Only computers that are in the same network can
"see" each other, so a computer in a 192.168.1.0network and another one in
a network 155.180.0.0 will not be able to communicate with one another even
if they are directly linked to each other. The rest of the IP address (20 in the
10 FUNDAMENTALS

first example, 24.45 in the second) corresponds to the particular computer


address. Choosing a network appropriately is important since it will decide
the amount of computers that you can connect. For instance, a network with
a subnet mask of 255.255.255.0 will be able to accommodate only 254 distinct
IP addresses. This type of network is said to be of class C. A network with
subnet of 255.255.0.0 is said to be of class B, and finally 255.0.0.0 will be
subnet of a network of class A. One of the most important things when choos-
ing your computer's IP address is making sure that it is a valid address. You
are not allowed to have an IP that is the same than your network address; for
example, if your network is 192.168.1.0, you cannot have 192.168.1.0 as a
computer's IP address. The other restriction is that your computer address
cannot be all ones in binary; for instance, in the same network as in the previ-
ous example, the address 192.168.1.255 is not authorized (as 255 is 11111111
in binary). This type of address is used by TCP/IP to send broadcast messages
to all computers within the network.
Now that we know how the IP address work, you might be wondering how
you can be in a class C network (with a maximum of 254 computers) and still
be able to access millions of computers worldwide, even though they are not
in the same local network as you are. Well, the answer to that is basically the
use of routers. Routers are small machines that act as a bridge between two
separate networks. To function, they have two network cards in two separate
networks. For example, you could have a router with one of its IP addresses
as 192.168.1.254 in a class C network, and the other IP as 155.180.255.254 in
a class B network. If a computer connected to the class C network attempts
to access an IP that is not part of the 192.168.1.0 network, it sends the IP
requested to the router, which will then try to find that address using its
second branch. The whole principle of the Internet is based on millions of
networks connected through routers. Now, because of the amount of routers
in the world, there is a virtually infinite amount of ways to submit data
between two computers. To avoid taking the wrong path, several protocols
can be used.
Remembering the IP addresses of all the possible computers we would like
to access is pretty difficult, so symbolic addresses were created. Those
addresses work as a set of aliases of real IP addresses, such as .com, .gov,
.net, .es, and .co.uk. To make it even easier, it is possible to assign a name to
a specific address, such as google.com, for example. In order to retrieve the
corresponding IP, the computer accesses something called a Domain Name
Service (DNS), which contains a table with all equivalences between names
and IPs. Every time you see a dot in a name, this means that you are accessing
a subdomain; for example, if you visit the page http://steven.bewchy.com/, you
are looking within all companies (.com) for the one called "bewchy," and once
you find it, you look for the subdomain called "steven" within "bewchy." The
''http://'' section allows the computer to know that you wish to access that
domain using the HTTP protocol. DNS is another protocol residing in the
Internet layer.
TCPIIP BASICS 11

The Transport Layer


The transport layer is home to two main protocols: the User Datagram
Protocol (UDP) and the Transmission Control Protocol (TCP). UDP is a
connectionless protocol, meaning that the order in which messages are sent
by the emitting computer is not necessarily the order in which they will be
received in the destination computer. This protocol is not of interest in this
book, so we will not go any further in the explanation of UDP. TCP, on the
other hand, is very important for Web access; it is a connection-centered
protocol. TCP handles the connection, disconnection, data flow control and
transfer, sequencing, and many other tasks required to establish a proper
communication between two computers. It receives the data flow that needs
to be sent by the user and breaks it down into packets of usually 64 kB (kilo-
bytes; i.e., 65,536 bytes), which are then sent through the IP protocol. In order
to send those packets, TCP needs to open something called a "socket," which
is a couple of the type <IP address, port> which can be used by programs to
access files. Sockets can be opened or closed, and allow both reading and
writing. For example, a character in a TV show who asks the computer techni-
cian to "open a socket on a computer" is actually requesting access to the
computer through its IP address on a specific port. You can imagine "ports"
as electronic gates that reside within your computer and that are needed to
send or receive information. For example, when you access a Webpage, the
information contained in the page is sent to you via your port 80 (generally).
If you access an FTP server, you are using your port 21; if you are connecting
through SSH (Secure SHell; used to connect to remote computers), you're
probably using port 22.

The Application Layer


This layer is responsible for the protocols that most users know or at least have
heard about. The first and uttermost important for this book is the HyperText
Transfer Protocol (HTTP). HTTP was created for the exchange of HTML
documents; it is based on TCP/IP and is the protocol responsible for the com-
munication between Web server and Web client (you and your browser!). This
protocol is meant to be multiplatform, so everything is sent in ASCII (Ameri-
can Standard Code for Information Interchange) format, as plain characters.
We shall talk more about HTML documents in the next chapter.
Many other protocols in the application layer are important in the everyday
life of an Internet user, such as the following ones:
• File Transfer Protocol (FTP)-responsible for transferring files.
• Simple Mail Transfer Protocol (SMTP)-responsible for sending emails.
• Post Office Protocol (POP)-usually seen as POP3 by email clients.this
protocol allows you to retrieve email messages from your mail server.
• Internet Message Access Protocol (IMAP)-another protocol used for
email transfers.
12 FUNDAMENTALS

• Telnet-widely used in the early days of the Internet but fortunately is


now loosing importance. It allows you to remotely connect to a computer,
but the major disadvantage is that it does not encrypt any of the data sent
through this protocol (and that includes your passwords).
• Common Gateway Interface (CGI)-discussed further in the next
chapter; in a nutshell, it allows you to use the output of external applica-
tions in any Webpage. It is not a programming language!!

THE TOOLBOX

To conclude this chapter, I will list some programs that I believe all Web
developers should know about. All opinions are entirely personal, and you
are more than free to disagree with me.

Browsers
As mentioned earlier, browsers are essential in the use of the Internet and
choosing the right one for you is an important decision to make. Throughout
this book we will discuss some of the differences between these browsers,
especially during the JavaScript coverage. The most commonly used by
Microsoft Windows users is obviously Internet Explorer (http://www.micro-
soft.com/ie/), since it comes with the operating system. MSIE is a very user-
friendly browser, and perfect for Mr. or Mrs. Anybody that just wants to
browse the web. As a developer you must know that it is a dangerous tool,
since no matter how disgusting your HTML code might be, MSIE will manage
to make the output look decent, especially when using tables or frames. So
do not assume your page is perfectly written just because MSIE displays it
nicely. One of the advantages of MSIE is that JavaScript works perfectly well
with it, so you will probably love it when we are working on that language. It
also contains many plug-in that are required in many websites, so you might
actually be required to use it to fully appreciate some websites. The major
flaw it has as far as I'm concerned, and a reason why I stopped using it, is the
number of security holes it contains. Granted, in most cases no one will ever
attack your computer using those security holes, but as a computer scientist,
I like being protected.
Another browser that had great influence in the world of browsing is
Netscape (http://browser.netscape.com/ns8/), which had a great growth in the
late 90s. Unfortunately for Netscape, it has been going downhill for few years
now, and personally it will never cross my mind to use it again until they
improve it greatly. I actually stopped using NS when they released their
version 6, mostly due to JavaScript incompatibilities that will be mentioned
in further chapters. But basically Netscape had a set of Netscape-specific
HTML tags that were both useful and necessary for the use of JavaScript on
that browser, but they decided to wipe those out on version 6, which pretty
THE TOOLBOX 13

much was like forcing programmers to reprogram every single JavaScript


code programmed for version 5. When I discovered that, I decided to stop
using Netscape.
Another browser that was quite "cute" for lack of better words was Neo-
Planet (www.neoplanet.com). It was not really a full fledged browser but more
like an add-on for MSIE. Unfortunately it is no longer available for download
in their official website. The fun thing about NeoPlanet was the use of skins and
sounds, which would allow you to have for example a "shaggadelic" skin based
on the movie Austin Powers with nice flashy colors, peace signs instead of the
regular buttons, and the voice of Mike Myers saying "Oh Behave", "Yeah
Baby!" and other catchy phrases from the movie every time you clicked on a
link. There were skins for all tastes, and was definitely the funniest browser I
ever used in my life. It did get boring and repetitive after a while though.
UNIX lovers have been using a browser called Mozilla for quite some time.
It is like a dream come true for UNIX lovers due to its small size, basic
appearance and good functionality. Mozilla evolved and created the Mozilla
Firefox browser (www.getfirefox.com). which I have to say, is my current
browser. It is probably the most secure browser available for free right now,
and has great features like the use of tabs, which allow you to have as many
open websites as you wish on a single browser window. It also has an extensive
set of skins, though I've never really used them. There are many other features
but I'll let you look into it.
Maybe some of you use things like America Online and its built-in browser,
but I'd rather not say what I think about AOL to make sure that I don't offend
anyone. To phrase it very politely, "I, Steven Gabarro, do not like AOL."

FTP
If you are trying to install an FTP server on a Windows machine, I would
have to recommend Serv-U FTP (www.serv-u.com).Itis a great server soft-
ware that will probably allow you to do anything you want to with it. If you
are looking for an FTP server for UNIX, there are so many good, and free,
ones that I won't even bother mentioning them (there was probably one
included in your UNIX/Linux distribution).
If you are trying to get a nice FTP client, one of the most commonly used
(or at least it was when I discovered FTP) is Cute-FTP (www.cuteftp.com).
There are many others free and not free, but my favorite would have to be
LeechFTP, which allows the use of multiple threads, which speeds up the
transfer of multiple files. Unfortunately, the development of LeechFTP has
not been continued for over a year, so there are no really recent (as of 2006)
versions. I still like myoId version, though, since it never gave me any prob-
lems. It would seem (at the time of this writing) that the people working on
LeechFTP are now working on a new client called BitBeamer (www.bit-
beamer.com). I have never tried that software, so I cannot vouch for it, but it
is supposed to have all the features that LeechFTP had.
14 FUNDAMENTALS

Email Clients
One of the most widely used email clients is Outlook Express, which comes
standard with every copy of Windows (since Windows 95). It is simple and
works well, and is preinstalled with Windows, so no need to add extra soft-
ware if that is your platform. There is also the more complicated version
called Outlook, which does all Outlook Express does but adds in a calendar,
nicer agenda, but also heavier software to run. Personally I prefer the Express
version.
Another survivor of the old ages, and the first email client I ever used in
my life, is Eudora (www.eudora.com).Ihaven·tuseditsince19970rso.so I
am not really in a position to tell you how good the latest versions are.
Many users simply like using the clients that come with their browsers,
such as Netscape mail, or directly with Web-based email clients like Hotmail
(www.hotmail.com). or Yahoo (http://mail.yahoo.com), which allow you to
view emails directly on a browser. Personally I'd recommend you use Gmail
(www.gmail.com)createdbythepeoplefromGoogle.Itis by far the best
Web-based email tool I have used in over 10 years of Internet use, and it is
still in its Beta version, so Google can still improve it. The only problem is
that you can create an account only if you are invited to do so by a current
user.
If what you use is lJNIX or Linux, the two main email clients I know
and have used are "Pine" (Program for Internet News & Mail) and "Elm"
(Electronic Mail), but I would have to vouch for Elm. It is a very small simple
application that runs straight from your shell and lets you choose your text
editor. They are both usuallyincludedwith the major UNIX/Linux distributions.

Programming Tools
Whenever you start programming Webpages, you will have to choose which
software to use, and you might think you need a lot of money for licenses and
so on. Well, think again, because you have excellent tools that will be more
than enough to program Websites (and I strongly recommend that you use
these when working with this book). On Windows platform you have two
great tools called Notepad and Wordpad. I personally prefer the first one
because it is much simpler and does not have all the unnecessary things that
Wordpad has. On UNIX you have "vi" and "emacs," which is pretty much
like choosing between Red Sox and Yankees (or between Real Madrid and
Fe Barcelona), since in most cases people that like one hate the other. In my
case it is true: I love emacs and hate vi. But it is only a question of taste.
If you think those tools are too basic for you and you would like to see
some colors in your code when you type it, you might want to choose some-
thing like HomeSite by Macromedia (www.macromedia.com/software/home-
site). It is a simple text editor adapted to Web development, so it recognizes
the syntax and highlights special words and tags. It also allows you to preview
THE TOOLBOX 15

the page and comes with a great tool for the creation of style sheets. Similar
to HomeSite but a bit simpler is UltraEdit (www.ultraedit.com). which allows
you to import or create your own set of syntax rules and colors associated
with those rules.
Another well-known editing tool is Macromedia's DreamWeaver (www.
macromedia.com/software/dreamweaver). The basic way to use Dream-
Weaver is to simply drag and drop the elements you wish to have in the page.
You can also type directly in a "preview" of the page, having DreamWeaver
take care of all the actual coding. Because of this feature, I do not recommend
it for this course, since it promotes laziness, and adds too much useless code.
If you really want to use it, please use the split view and type in the code
directly. (The split view will allow you to see both the preview and code at
the same time).
Finally, we have Microsoft's FrontPage (www.microsoft.com/frontpage).
which is definitely not my favorite tool for Web programming. It creates a
large amount of unnecessary folders and files when you are just trying to
create a simple Website, and adds useless code in the pages that you create.
It might be a great option for people wanting to create a Webpage without
having to understand any of the code, like web designers, for example. If you
are a Web developer, code should be your number one priority, making Front-
Page my last choice. Last, and least, is Microsoft's Word "Export to HTML"
feature, which should be used only by non-Web-savvy people to quickly create
pages from Word documents. It is very problematic, and I discourage its
use.

Other Useful Tools


Finally, there are some tools that are useful for the "cosmetic" part of Web
programming, such as Adobe's PhotoShop and ImageReady (www.adobe.
com/photoshop), probably some of the best image editing software in the
market. They both come as a single bundle, with PhotoShop used mainly for
pictures and ImageReady focused mainly on images for the Web.
Macromedia also offers an array of tools to create animations and facilitate
the design of a Website such as Flash, Fireworks, FreeHand, or Director.
2
The Different
Approaches of Web
Programming
BEFORE WE GET STARTED

Before I head on and start explaining the different languages available in the
Web programming market, let me stress that all the opinions stated are exclu-
sively my personal views. I tend to be very opinionated, but I will try to justify
both my criticism and praises of the different languages presented.

THE BASICS-HTML

The very first programming language that must be mentioned when discuss-
ing Web programming is obviously HTML. The WWW could not be what it
is today if it weren't for this language. The HTML (Hypetrext Markup Lan-
guage) is, as the name indicates, a "markup" language, which generally means
that it is based on the use of tags to provide functionality. The "code" in an
HTML file is simply text containing those tags that provide functionality and
different looks to the page. It is an interpreted client-side language, meaning
that for an HTML page to be viewed, a browser must first download it from
a server into a client machine and then execute the code line by line.
HTML relies strongly on the use of Universal Resource Identifiers (URI).
Each URI represents a way to refer to a page, an image, or even an email

Web Application Design and Implementation: Apache 2, PHP5, MySQL, JavaScript, and
Linux/UNIX, by Steven A. Gabarr6 .
Copyright © 2007 by John Wiley & Sons, Inc.

17
18 THE DIFFERENT APPROACHES OF WEB PROGRAMMING

address. The location of a page is a URI commonly called URL (Universal


Resource Location). For example, an email address URI would look like
mailto:[email protected], a normal URL could be http://www.mydo-
main.com/myfolder/mypage.html#section2. Usually a URL can be of two
types: absolute or relative. An absolute URL is basically a URL that includes
the information on the full path of a file or folder, like domain, subdomain,
file, section, ... A relative URL is one in which you can see not the entire path
of the file, but how to reach it from the current working directory. For example,
if you had the tree structure shown below in your "mydomain.com," and you
were viewing the page "foobar.html," the image mypic.jpg could be accessed
by using either http://www.mydomain.com/images/mypic.jpg (absolute URL)
or ../images/mypic.jpg (lJRL relative to the folder files):

mydomain.com (I)
images

t mypic.jpg
myotherpic.jpg

t
files
foobar.html
otherfile.html
yetanotherfile.html

As you noticed, relative paths usually start with "..1", which means "go to
parent directory" or "'/", which means "current directory." Relative paths
are an easy way to make a Website more portable since they are independent
of the domain that the pages are in. It is especially useful if, like me, you
test all your pages in a local computer before uploading the files to your
host.
The use of URIs is pretty much a necessity in HTML because they allow
you to embed images to a page, send information from a form to a processing
script, create an image map, link to an external style sheet, create frame docu-
ments, cite an external reference, or also refer to metadata conventions to
describe the page.

THE CREATOR-SGML

SGML, or Standard Generalized Markup Language, is a system for defining


markup languages, like HTML. It is a descendant of IBM's Generalized
Markup Language (GML) developed in the 1960s. It relies strongly on the
use of DTDs (Document Type Definitions) to define the syntax of markup
constructs. SGML is not really used on the Web in its full version, but smaller
subsets of SGML are becoming increasingly prevalent in many information
exchange standards.
OTHER SGML-BASED LANGUAGES-XML AND XSL 19

OTHER SGML-BASED LANGUAGES-XML AND XSL

The eXtensible Markup Language (XML) is a simplification of SGML that


relies on the use of tags to organize information in any format that its writer
deems the best. It is a very common language that is at the base of platforms
like .NET. It is used mostly to exchange information through the Web in an
organized manner, making it easy to retrieve information from its files. XML
files are actually interpreted by most browsers nowadays, showing its contents
in a tree format, such as you would see on a file explorer.
Here is an example of an XML file containing information of some games
that I like:

<?xml version="l.O" encoding="ISO-8859-1"?>


<GAMESLIST>
<GAME>
<NAME>Star Wars Galaxies</NAME>
<DEVELOPER>Sony Online Entertainment / Lucas
Arts </DEVELOPER>
<CATEGORY>MMORPG</CATEGORY>
<RELEASED>Summer 2003</RELEASED>
<CLAN>Clan of The Wroshyr</CLAN>
<CHARACTER>Elder Bewchabbacc The Black</CHARACTER>
</GAME>
<GAME>
<NAME>Battleneld 2</NAME>
<DEVELOPER>Electronic Arts / Dice Software</DEVELOPER>
<CATEGORY>FPS</CATEGORY>
<RELEASED>Summer 2005</RELEASED>
<CLAN>lOlst Airborne Division - 160th Special
Operations Aviation Regiment "Night Stalkers"</CLAN>
<CHARACTER>Captain Bewchy</CHARACTER>
</GAME>
<GAME>
<NAME>Pac man - aka Puck-Man</NAME>
<DEVELOPER>Namco </DEVELOPER>
<CATEGORY>Oldie </CATEGORY>
<RELEASED>1980</RELEASED>
<CLAN>Nbuns Team</CLAN>
<CHARACTER>Nica</CHARACTER>
</GAME>
</GAMESLIST>

Because the output produced by browsers when opening a basic XML file
tends to provide too much information, and it does not have a flexible appear-
ance, XSL was created. The eXtensible Style sheet Language is used as a
20 THE DIFFERENT APPROACHES OF WEB PROGRAMMING

perfect complement of XML files, by specifying the appearance that each


section of an XML file should have. It relies on the XSLT (XSL Transforma-
tions), which through a single link of the XSL file on the XML file, will
produce any type of output that the programmer decides to use. It allows a
really quick presentation of the contents of the XML file, with a much nicer
appearance. Note that the XSL file is dependent on the XML file as far as
tags are concerned, but if you have well-formatted XML and XSL files, any
added element to the XML file will still be properly formatted by the XSL.
Here is an example of an XSL file that will allow us to format the previous
XML file:

<?xml version="1.0" encoding="ISO-8859-1" ?>


<html xsl:version="l.O" xmlns:xsl=''http://www.w3.org/1999/
XSL/Transform" xmlns =''http://www. w3. org/1999 /xh tml">
<BODY style="font-family:Arial,helvetica,
sans-serif; font-size: 12pt; background-color: #EEEEEE">
<xsl: for-each select= "GAMESLIST/GAME">
<div style="background-color:grey;color:
white;padding:4px">
<span style="font-weight:bold"><xsl:value-of
select= "NAME"/> </ sl Jan>
by <xsl:value-of select="DEVELOPER"/>
</div>
<div style="Hzargin-left:20px;margin-bottom:lem;font-
size:10pt">
<xsl:value-of select=ICATEGORY"/> game released in
<xsl:value-of select=IRELEASED"/>. I play it with the
<xsl:value-of select="CLAN"/> as
<xsl:value-of select="CHARACTER"/>.
</div>
</xsl : for-each>
</BODY>
</html>

In order to link our .XML file to the XSL file, you would simply add the
following line right after the «Yxml. . . . ?> line of the XML file:

<Zxml-stylesheet type ="text/xsI" href="videogames.xsl" ?>

THE GOOD OLD Java

A language that must be mentioned when studying virtually any program-


ming area is Java. Because of its multiplatform characteristics, this object-
oriented language has been chosen by many developers in the past. The rise
SOMETHING DIFFERENT-JavaScript 21

of technologies such as J2EE (Java 2 Enterprise Edition) or J2ME made the


use of Java a necessity. One problem in using Java in the Web is mostly that
Java applications run as applets embedded in Webpages, not as a working
part of the page itself. Basically, your Java-based Webpages are not really
pages, whose appearance changes depending on the Java code. Instead, the
page itself is like a frame for a full Java application. This means that the code
must be compiled first into "byte codes," which will have to be downloaded
by the client and will start running only after the client has received the entire
program.
Java is currently undergoing some changes and improvements that will
supposedly make it a very strong choice for Web programming, but in my
opinion, it is far from the best option out there. The fact that applets need to
be fully downloaded and then interpreted by a Java virtual machine in the
client's computer makes it slow, and speed is usually a major factor in the
Web. It is also quite complex to use, since it is a full object-oriented program-
ming language, and not really the fastest way to write a scripting page.
I personally do not recommend the use of Java for Web applications unless
you will be working with J2EE or J2ME. If you are attempting any other
project on the Web, I recommend a scripting language instead.

SOMETHING DIFFERENT-JavaScript

Here comes one of the greater sources of confusion among young developers.
Despite the name "JavaScript," this programming language is very different
from Java. First, it is a compact, object-based scripting language, generally
used to develop client-side scripting pages, and sometimes server Internet
applications. In many cases, JavaScript is code that is embedded directly in
the HTML code of a page, to be executed by the client. This means that the
code is downloaded at the same time as is the rest of the page, making it
entirely visible. It is then interpreted line by line at the same time as are the
HTML tags. Again, it is different from Java; some of the major differences
are listed in Table 2.1.

TABLE 2.1 Differences between Java and JavaScript


Java JavaScript
Compiled byte codes are downloaded from Interpreted by the client as it gets
server to the client prior to execution downloaded
Object-oriented; applets consisting of Object-based; uses built-in extensible
classes with inheritance Objects, but there are no classes or
inheritance
Applets distinct from HTML Code integrated with HTML
Variables data types MUST be declared Variables data types are not declared
Static binding; object references must Dynamic binding; object references
exist at compile time checked at runtime
22 THE DIFFERENT APPROACHES OF WEB PROGRAMMING

THE SAVIOR-PHP

Well, you are probably wondering about the title I gave this section, but let
me explain my logic behind it. I am one of those old-school developers who
believe that C language is one of the best programming languages ever,
because of its flexibility and how easy it is to learn. C is a language that, with
a small toolset, can allow you to achieve pretty much anything you wish to
achieve. Well, for me, PHP is pretty much "C for the Web." The syntax is very
similar, with less syntax restrictions, as we will see little by little, but follows
the two concepts of C that I like the most: flexibility and ease of use. It is
really easy to learn; an experienced programmer can pick it up in a couple of
days. Another great asset of PHP is the fact that it runs server-side, meaning
that the code is executed before the client has access to it, but we shall discuss
this later on. Let us talk about the basics.
PHP is a recursive acronym of Hypertext PreProcessor and, as the name
indicates, works like many preprocessors found in other languages. This
means that the code is read line by line and interpreted as it goes, or at least
that was how PHP started. It is an open-source scripting language, so you will
be able to find many sites enhancing its development. It also means that the
PHP project is created and maintained by developers who wish to invest their
free time in making the product better, yet free.
PHP was designed to work for the Web, and its code is embedded directly
in HTML pages, although, as we shall see later, it is possible to separate
HTML and PHP through the use of templates. Interestingly, PHP is not
limited to work on the Web, and can actually be used to create command-line
scripts that you could run from a shell, or even GUI (Graphical User Inter-
face) applications through the use of the PHP-GTK library.
PHP is also designed to work closely with a wide variety of databases,
including Oracle, MySQL, PostgreSQL, ODBC, and Sybase among others,
making it an excellent choice for database-driven Websites, regardless of the
database you wish to use. It also includes an extensive set of libraries that
allows developers to interact with a wide range of other technologies. PHP
developers can write applications that will generate images, PDF documents,
work LDAP authentication servers, communicate with flash animations, and
many other things that unfortunately we will not be able to discuss, since it
would probably take several volumes.

THE RIVAL-ASP.NET'

Active Server Pages (ASP) and now ASP.NET are probably among the major
sources of confusion among developers. ASP used to be an actual program-
ming language developed by Microsoft that worked similarly to PHP; it was
a server-side scripting language, hence the title "the rival." With the arrival
of the .NET platform, ASP.NET received an entirely new meaning, referring
ANOTHER BIG OPTION-Perl 23

to a development platform, rather than an actual programming language; that


is why you will probably see in the markets that teach how to "program in
ASP.net with another programming language." There are many to choose
from, including, for example, Visual Basic.Net. The whole idea is that you can
develop ASP.NET applications in your desired language. It is all based on the
use of the Common Language Runtime (CLR) designed for .NET. It is widely
used with Web services; it is highly efficient and very popular in big corpora-
tions. One main difference from PHP is the fact that it is not open source,
and its development depends exclusively on Microsoft's developer team. This
also means that using it might become quite expensive if you are to work on
the "official" professional version of the developer. I personally like to call
this the "PHP for high class."

THE MYTH-CGI

Now, here is a good source of laughter among recruiters who know about Web
programming. Many people think that CGI (Common Gateway Interface) is
an actual programming language and tend to "beef up" their resumes, adding
it to their list of known programming languages, without really understanding
what CGI is. CGI is a common gateway interface, and is definitely not a pro-
gramming language. It is a standard for interfacing external applications with
information servers, or, if you prefer, a "magical door" that will allow you to
run your normal executable files in a Webpage. CGI applications are executed
in real time, allowing a dynamic output, such as, for example, generating a
Webpage adapted to a set of received inputs. The way it works is simple; you
first write an application in your favorite language and compile it to an execut-
able rename it to "file.cgi" (note that this is technically optional, and many
developers leave script names as "file.exe"; I personally discourage this).
Some of the most common allowed programming languages are etc++,
FORTRAN, Perl, TCL, UNIX Shell script, Visual Basic, and Apple script.
Of course, to make your application more useful for the Web, it is usually
written to receive a set of parameters and produce HTML code that will be
displayed as the page's output on the browser.

ANOTHER BIG OPTION-Perl

Even though I used Perl only when I was a computer science student, and
considering that it is never in my list of languages to use, I have nothing nega-
tive to say about it. Perl is a very powerful programming language, and also
very flexible, if anything, it is more complicated to learn and use than PHP.
It is also open-source, and one of the best options if your application is meant
to work extensively with text manipulation. Some of the most powerful regular
expression tools were created for Perl, and then exported to other languages,
24 THE DIFFERENT APPROACHES OF WEB PROGRAMMING

as we will see when we study PCRE functions in PHP. Websites such as


Amazon.com are partly built in Perl, so you can see that it is not just a little
programming language for small applications. It also has the ability to inter-
face with external CIC++· libraries through the use of XS and SWIG.

THE FUTURE?-C#

C# was a language created to work with .NET as a simple yet powerful object-
oriented programming language, mixing a programming interface similar to
the old Visual Basic, yet having the object-oriented features you could find
in C++. It is Microsoft's answer to Sun's Java. Java became increasingly
popular through J2EE, so Microsoft decided to create a language following
the same principles on their version of the three-tier architecture program-
ming platform, .NET. It strongly relies on XML as information exchange
format, and it is gaining popularity for programming Web services. As do
other .NET languages, it requires code to be compiled, yet it follows the
principle of Java's byte codes, by compiling into a platform-free language,
that will be interpreted by clients.
The reason behind the question mark is that even though C# is a fairly
recent language it is meant to be the flagship in the .NET revolution-or at
least that is what Microsoft representatives were announcing when they pre-
sented .NET. The reality is that its acceptance is still growing, but many .NET
developers prefer relying on older programming languages that they are more
familiar with ..NET is still gaining importance, and who knows, maybe it will
be the most predominant platform for Web services, not only on Microsoft
applications and Websites, but as a more global solution. If that happens,
surely C# will become increasingly popular and will be the first choice of
programming language for new developers.

CLIENT-SIDE VERSUS SERVER-SlOE-WHICH SIDE TO PICK?

As we have seen, most scripting languages are defined as either client-side or


server-side. A client-side program is basically a program that needs to be fully
downloaded by the browser to use it. The code in many cases is embedded in
HTML code, which results in full disclosure of how your program works,
since all users can read it by choosing the "view page source" option in their
browsers. In many cases the code is interpreted by plugins in the client, which
brings us to another problem of client-side applications-they are browser-
dependent. As we will see when studying JavaScript, many features are not
cross-browser, meaning that they can be used only in a specific browser,
sometimes even in a specific version of it. The positive side of client-side
scripting, and the reason for its continued use, is that once the code is down-
loaded, the server has nothing else to do. The client is solely responsible for
MY CHOICES-PHP, MySQL, JavaScript 25

any calculations or actions that might take place, which allows programmers
to create Webpages that will change dynamically as the code is executed.
Server-side applications run in the server, as the term indicates. This means
that when a client attempts to access a script programmed that way, the query
is sent to the server along with any input that the script might need. The script
then runs on the server, utilizing server resources only, and then sends the
final output to the client, who can see only that result, and has no access to
the source code itself. This obviously is a great asset since it protects the code,
which is very important for security reasons. Another great advantage of
having scripts run directly on the server is that you need to worry only
whether the server knows how to run it properly. Unlike the scenario in client-
side applications, the script will run exactly the same way, producing the same
output regardless of the client's platform or browser. On the negative side,
each time you wish to do something dynamic, you must communicate back
and forth between client and server.
Now that we know the differences between both sides, it is generally the
time to choose your preference, by selecting the language to use. Most devel-
opers, and therefore most books out there, tend to choose only one side, but
not me. Even though it is possible to create Websites based on just one tech-
nology, taking advantage of server-side and client-side programming simulta-
neously gives much more flexibility and allows a greater set of functionalities.
Some features run better in client-side, some in server-side, so restricting
yourself to only one will potentially limit your final project. Throughout this
book we will learn when .it is better to use a client-side language such as
JavaScript, or a server-side language like PHP.

MY CHOICES-PHP, MySQL, JavaScript

Now that we have seen some of the most common options that programmers
face when engaging in Web programming, we must choose which technologies
to use. In our case, the choices are obviously known. One question you might
ask is why those choices and not others.
First, we have PHP. It is one of the most powerful and flexible programming
languages for the Web. It is free, is easy to learn (making it ideal for a one-
semester course), and simplifies any database access you might want to use.
JavaScript, although I do not like it as much as a language itself as it is
much more restrictive syntaxwise than PHP, is a really useful programming
language. As we will see, it is important to have a client-side language to
couple with PHP to make our pages more lifelike, dynamically changing
without having to constantly communicate with the server, and JavaScript will
help us fulfill that need.
MySQL, even though we have not discussed it yet, is a free database that
can be installed in any platform, providing a reliable solution for information
handling. It is also extremely easy to use MySQL databases with PHP, which
26 THE DIFFERENT APPROACHES OF WEB PROGRAMMING

will make our job so much easier. My "second best" option for databases
would be PostgreSQL, similar to MySQL with even some extra features, but
again, we shall follow the path of simplicity for this book.
Finally, and pretty much most importantly, these are the languages that I
have been using for years, and I never had any problems with them. Knowing
how to properly mix these three programming languages should allow you to
create any professional database-driven Website you would like to. Also,
although you might use different technologies in the future, mastering these
three will give you the mindset needed for Web development. It is like learn-
ing how to play soccer; you must learn how to kick the ball, regardless of the
shoes you will wear or the team you will support. Web programming is much
the same; if you know how to properly design a Website, the language choice
will be only secondary.
3
Introduction to HTML

WHAT DO YOU NEED TO GET STARTED?

Before we start discussing HTML, let me give you a checklist of things you
should have with you when programming. First, you need a basic text editor
like Notepad or emacs. You can also use more advanced tools, like the ones
mentioned in Chapter 1, but if you really wish to learn the ins and outs of
HTML, you are better off with a basic editor. The next needed thing is a
browser, which will be used to test the pages and make sure that they look
the way you want. Third, you need, obviously, some basic HTML knowledge.
Last but not least, you need good music. People usually think I'm kidding
when I mention music as a necessity, but from my experience, the right music
can activate the brain to work more efficiently. The right music will depend
on your own personal taste, but I would recommend either classical if you
work better in a calm environment or hard rock, punk, and other fast-paced
music if, like me, you prefer the music tempo to drive your fingers into a typing
frenzy. This chapter will try to make sure you have element number three:
basic HTML knowledge.

Web Application Design and Implementation: Apache 2, PHP5, MySQL, JavaScript, and
Linux/UNIX, by Steven A. Gabarr6
Copyright © 2007 by John Wiley & Sons, Inc.

27
28 INTRODUCTION TO HTML.

HOW DOES HTML WORK?

Syntax Basics
HTML is a markup language and, as such, works entirely through the use of
tags. Each tag is used to define different parts of the file, different styles, links,
images, embedded elements, forms, and so on. Each tag starts with the char-
acter "<" and finishes with ">". Keep this in mind because those characters
are restricted for tags, meaning that your page might behave in a strange way
if you attempt to use it in a normal string. If you wish to use that character,
refer to the special characters table shown in Appendix A. Now, some tags
require an opening and a closing tag in order to show the area of effect of the
tag. In those cases the closing tag will always start with "«I", followed by the
name of the tag it is closing (without the attributes list) and ">".
For example, to have some text appearing in white, you could use the
FONT tag, with the attribute color set to "white." To do so, your opening tag
would be <FONT color = "white"> and your closing tag would be </FONT>.
Your final portion of code would look like this:

<FONT color="white"> This text will show up in white</FONT>

Note that HTML is not case-sensitive, so you can mix uppercase and lower-
case letters. Nevertheless, I strongly advise everyone to capitalize all tags
since it makes code reading much easier.
Finally, remember to name your files with either .html or .htm as their
extension.

File Structure
It is very important to understand the basic structure of an HTML file,
knowing exactly where each part of your code must be written in. It is some-
thing fairly easy to remember, but unfortunately there are still people who
claim to be Web programmers but who misuse the file's main areas. Good
Web design and programming demands efficient and effective use of the
available tools. This book is designed to avoid these pitfalls.
The first thing is the full file, which must always start with the tag <HTML>
and finish with </HTMI~>. You should never have HTML tags before the
opening tag, nor after the closing one. One of the reasons for this occasional
error is the fact that most browsers can now ignore major errors like this one
and still manage to create a proper-looking output, but please always start
your files by setting up these two tags.
The next section to know is the header, limited by the tags <HEAD> and
</HEAD>. This section holds all information related to the file, including its
author, its keywords, its title, and sometimes even some JavaScript functions
that will be used in the page. Most basic pages use the header only to specify
HOW DOES HTML WORK? 29

the title that will appear on the browser window.To do so, use the <TITLE> ...
</TITLE> tags. Any text written between the opening and closing tags will
appear in the title bar of the browser.
The final area is the body, starting with <BODY> and finishing with
</BODY>. The body of a page is the actual content of the page, meaning that
the data that will appear inside the browser window. The body tag can accept
a set of properties that allow you to set up a background image (background)
or color (bgcolor); specify font colors for text (color), links (link), visited links
(vlink), active links (alink), and even action scripts to run on load or unload
of the page. There should always be a body section in a Webpage, unless you
are using the page as a frameset definition page (see discussion later).
Here is an example of what a "Hello world" HTML page should look
like:

<HTML>
<HEAD>
<TITLE>Hello World Page</TITLE>
</HEAD>
<BODY>
HELLO WORLD!!! <BR>
And have a nice day!
</BODY>
</HTML>

Note the indentation I have used. This is not required, but will improve the
readability of your code. You will also note the use of the tag <BR>, which
forces a break of line. It is important to realize that any group of white spaces
(whether it is a tab, a new line, or basic spaces) is always translated on the
screen as a single white space. This is important to know since the appearance
your code has will not necessarily be the same as in the output. Check the
following example:

<HTML>
<HEAD>
<TITLE>Hello World Page</TITLE>
</HEAD>
<BODY>
HELLO WORLD!!!
And have a nice day!
</BODY>
</HTML>

You probably noticed that this code is almost exactly the same as the previous
one except that there is no <BR> tag after "Hello World!! L" In this example,
the text "And have a nice day!" would show on the same line as "HELLO
30 INTRODUCTION TO HTML

WORLD!!!," even though it is written a line below it, because the "new line"
will be translated into a single white space.
As a teacher I enforce the use of the basic six tags needed for an HTML
proper structure, so I would recommend everyone to make it a habit to write
them all as soon as a page is created, and then fill in the blanks.

Tag Parameters
As we saw previously with the FONT and BODY tags, it is possible to add
attributes to an opening HTML tag to make it more effective. Each attribute
will affect the area after the opening tag and will finish with the closing tag.
Remember that there is no need to write the attributes in the closing tag.
Checking the W3C website (www.w3c.orG) can get you an exhaustive list of
all the attributes that tags can use, but I will give you the ones I consider most
important for the tags that I will teach you at the end of this chapter.

BASIC TEXT FORMATTING

There are many ways to format text in HTML, but we will discuss only the
real basics right now. There will be more details on styles in Chapter 10. The
tags I am about to show you are considered to be deprecated and should be
replaced with the use of style sheets, but as much as this is true, you probably
want to get started without having to learn advanced formatting features. In
that case, the following tags are ideal.
The first basic tool commonly used for formatting text is the <P> ... </P>
tag, which stands for "paragraph." As the name indicates, it defines an area
that works as a single block, and most browsers will automatically break a new
line at the end of a paragraph. I try not to use this tag when writing normal text
since the output on the screen might be different depending on the browser, so
I prefer to handle my paragraphs manually. On the other hand, paragraphs are
really useful when using style sheets, as we will see in Chapter 10.
A very useful tool in HTML is the different heading styles that can be
used. There are six basic: levels of headings that can be used to easily write
titles, chapters, or sections. Each heading is treated as a paragraph, so a new
line is added automatically when the tag is closed. To use a heading, simply
wrap your title with «Hn» ... <IHn>, where "n" is the level of title you wish
to use from 1 to 6 (with HI the biggest heading and H6 the smallest). If you
wish to add extra linebreaks you can use, as seen earlier, the <BR> tag.
To change the appearance of text, you can use <I» ... <II> to italicize a
text, <B> . . . </B> to make it bold, or <V> . . . <IV> to underline it. As
always, these tags affect the text only between opening and closing tags. It is
also possible to use the <FONT> tag to specify colors, fonts, sizes, and back-
ground colors, for example, but it is considered poor programming practice
to use these in your HTML code since it makes it much more difficult to read.
Instead, you should use styles, which, again, we will see in Chapter 10.
BASIC TEXT FORMATTING 31

Most tags, including <P>, accept an attribute called ALIGN that allows
setting of the horizontal alignment of a block by setting it to "left," "center,"
"right," or "justify." It is also possible to center an area of the page by using
the <CENTER> . . . </CENTER> tag. The advantage of the <CENTER> tag
is that it will act on anything between opening and closing tags, regardless of
the type of element (form input, image, paragraph, button, etc.).
To do a basic enhancement on your page's look, you can use horizontal
rules. These are horizontal lines used mostly to separate sections and para-
graphs. To use it, just write <HR> with any of the following attributes:
ALIGN (left, center, or right), NOSHADE to remove the shade under the
line, SIZE (in pixels) to specify the height of the line, and WIDTH (length
in either pixels or percentage of the page) to specify the linewidth. An example
ofa nice-looking rule could be <HRALIGN=centerSIZE=l WIDTH=75%>,
which would create a line of 750/0 of the page's width, centered in the page,
and with 1 pixel height. Note that this tag does not need to be closed.
Finally, to conclude this set of basic formatting tools, I would have to add
the <BLOCKQUOTE> . . . </BLOCKQUOTE> tag. This tag was created
to be used to quote other people in a text, but it has a nice property. Any
text inside a <BLOCKQUOTE> tag is automatically indented, which is great
for a really fast indentation solution. I personally have used it in the past to
force a blank margin at the beginning of my pages, making the output
cleaner.
Here is an example using all these tags:

<HTML>
<HEAD>
<TITLE>Formatting example</TITLE>
</HEAD>
<BODY>
<BLOCKQUOTE>
All my text will show up with an indentation!
<P ALIGN=right>This is a first paragraph with right
alignment</P>
<P ALIGN=left>And this is a separate left-aligned
paragraph with things written in <I>italic</I>, <B>bold</B>,
<U>underlined</U> and even <U><B><I>all mixed up</I></B></U></P>
<CENTER>
<HR size=l width=75%>
<Hl>Headingl</Hl>
<H2>Heading2</H2>
<H6>Heading6, and like the others I'm centered!</H6>
</CENTER>
</BLOCKQUOTE>
</BODY>
</HTML>
Other documents randomly have
different content
not completed within the 10-day time limit. Mr. Baker said he would take
my 3,000 bushels at the morning bid, and Mr. Lynn’s 10,000 bushels at the
present market (one-half cent less) if he would let it go at that. And in that
case he would give me credit for the half cent, amounting to $50. He said,
rather gruffly, “We don’t owe the farmer anything. There’s the phone. See
what you can do with him.” Mr. Lynn accepted the new offer. And he was
mighty glad that he did. By the time I got around to telling him all about the
deal, corn had dropped several cents. If it had gone up, I don’t believe I
would have ever told him. The Lynn shipment totaled 13,000 bushels, with
only one car off grade.
I used to take an occasional flyer on the Board of Trade—mostly, I believe,
before my good Christian friend, Albert Zabel, told me that it was
gambling. I had 7,000 bushels of corn cribbed, and Albert had 3,000
bushels cribbed on the same lots, which he wanted me to sell. Corn was
cheap then, and getting lower as the new crop promised a good yield. A
good general rain the night before had spurred our desire to sell at once. My
top bid that morning was 17 cents.
Ed Murray, agent at the depot, showed me a wire from the Orthwine people
in East St. Louis, bidding Mike Worthy 18% cents. I had shipped some corn
to the Orthwines. I wired them, offering 10,000 bushels at 18 3/4 cents,
same as their bid to Mr. Worthy. Their reply was slow in coming, and I may
say that when it did come, the market was off nearly five cents.
I had told Albert that evidently the Orthwine people were waiting for the
market to open—and that I was going to sell mine on the Board, and asked
him if I should include his in my sale? He studied a moment, then said,
“That would be gambling, wouldn’t it?”
I said, “No—not when we have the corn to fill the contract. This will be
protection against further loss. We gambled, Albert, when we bought the
corn at the ridiculously low price of eleven to sixteen cents a bushel.”
Albert said, “I don’t know about that. If it wasn’t for them weevil in the
corn, I would hold it over until next year.” We had previously discussed
this, and decided that it would not be advisable to hold it over. He finally
said, “No, I’ll not go in with you. I never gamble.” And just think of it, the
fellow was buying and shipping hogs—continuing in the business until his
finances were “not what they used to be.”
I sold 10,000 bushels anyway, on the Chicago Board — and cleaned up
three cents a bushel by the time we sold our cribbed corn at 14 cents a
bushel. “Them” weevil had us scared. But the damage was not enough to
lower the grade beyond the number three contracted.
In the old days, many of the farmers would shuck their corn early, pile it out
in the open on a grass patch or rocky knoll, and then haul it to market after
it had taken rains and snows—the more, seemingly, the better. More than
once have I gone out to the country, and shoveled drifted snow away for
lots bought on contract. It was such corn as this that brought the weevil,
which worked mostly in the damp spots. Another trick of the old farmer
was to wait for a freeze before shelling and marketing his ground “cribbed”
corn. One such car of mine, billed for “export,” and passed by the
Greenleaf-Baker firm—that is, not unloaded in Atchison, was reported
steaming when it arrived in Galveston. It had passed inspection in Atchison.
Think I should say here—well, really it should be apparent without saying
—that our reputable farmers were not guilty of this practice. It was usually
floater-tenants, irresponsible farmers making a short stay in the community,
who devoted much time to figuring out a way to skin someone. A fellow by
the name of Groves, farming the old Adam Swerdfeger place eight miles
northwest of Wetmore, contracted to deliver to me 800 bushels of “Number
Three, or better” corn at 32 cents a bushel. When the wagons began coming,
in the afternoon, I saw the corn was not up to grade, and I held up the
haulers waiting for the arrival of the seller. In the meantime I learned from
the haulers that it was corn that had been frosted, gathered while immature,
shelled while frozen, and stored in a bin on the farm. The fellow had sent
word by the last hauler in, that there would be two more loads to follow.
When they did not show up at the proper interval, I dumped the loads (in
waiting) and let the impatient farmers go home. I knew now from the way
the fellow was holding back that I would have a tough customer to deal
with—but I would take a chance on him. I felt that I couldn’t afford to keep
the haulers, who were my friends, waiting longer. The seller came in with
the two loads between sundown and dark. I told him the corn was not up to
grade. He said,”Well, you’ve dumped it, haven’t you?” I said, “Yes, for a
fact, I have dumped thirteen loads of it—but here’s two loads I’m not going
to dump.” But I did finally dump them, on agreement with the fellow to
ship the lot separately and give him full returns. The shipment was reported
“no grade” and the price was cut six cents a bushel. I paid the man 26 cents
a bushel, on the basis of our weight—and was glad to be rid of him. Then,
the next day I received an amended report on the car. It was found to be in
such bad condition that the receiving house had called for a re-inspection—
and the price was cut another eight cents a bushel. And this was mine—all
mine.
It seemed to me that nearly everything, in the old days was, in a sense,
touched with that horrible word—gamble. And I know that I really did
gamble in an attempt to grow a crop of corn on my expensively tiled bottom
seed-corn farm down the creek a mile from town, one very dry year.
I hired all the work done, paid out $500 in good money—and got nothing
but fodder.
Another time I filled my cribs with 25 cent corn and held it for the summer
market. When I was bid 49% cents a bushel, I jokingly told Mr. Worthy that
I couldn’t figure fractions very well, and that I would wait for even money.
Fifty cents was considered a high price for corn then—but usually when it
would reach near that figure, the holders would begin to talk one dollar
corn. It was a year when the corn speculators just didn’t know what to do,
after the price began to slip.
Alpheus Kempton, over north of Netawaka near the Indian reservation, had
5,000 bushels stored on the farm. He told me he had been watching my
cribs, and thought that maybe I had inside information of a come-back in
prospect. I too had been watching some cribs, with similar thoughts. The
Greenleaf-Baker firm had 20,000 bushels stored in two long cribs at
Farmington. As I frequently traveled the railroad—on a pass—and noticed
the corn had not been moved out, I thought that maybe, after all, I had not
erred in letting the high bids get away from me. I told Mr. Baker that I had
been watching his Farmington cribs for a reminder as to when it would be
time for me to sell mine. He laughed, saying, “I’ve sold it (on the Board)
and bought it back probably twenty times.”
Well, Alpheus and I—we held our corn over another year—and then sold it
for 301/2 cents a bushel. May I say that by this time I had brushed up on my
arithmetic. And Christian or no, who is there to say I did not gamble that
time? I still maintain that I gambled when I bought the corn. However, there
were times when I sold 25-cent corn for 70 cents—and most of it went back
to the country here. The only advantage that I could see in storing corn
instead of buying it on the Board, was the possibility of striking a local
market.
And again, I bought 5,000 bushels of wheat on the Chicago Board, at 61
cents a bushel, and margined it with $100. As the market advanced, I
bought seven more five thousand bushel lots with the profits, making
40,000 bushels in all. It was a very dry time in Kansas, and wheat was
jumping three to five cents a day—and had reached a fraction under $1.00
on the Thursday before Memorial Day, which of course would be a holiday,
with no market.
My profit on the single $100 investment was now nearly $4,000.00. I had
planned to get out before the close of the market on Thursday, because I did
not want to run the risk of carrying the deal over the holiday. But the
weather map, just in from Kansas City, indicated clear skies for Kansas
over the week-end. This, coupled with the exuberant spirits of the excited
dealers on the Atchison Board, caused me to change my mind. One more
day of dry weather would likely double my earnings.
The weather man was wrong; horribly wrong.
It began raining in Wetmore about 10 o’clock that night. You’ve probably
been lulled to sleep by rain patter on the roof. Believe me, there was no
lullaby sleep in the constant rain patter on the roof over me that night. It
rained off and on here all day Friday. Everyone I met on the street here
exclaimed, “Fine rain, John!” I would say, “Yep”—and think something
else. It was truly a $4,000.00 rain, in reverse—so far as I was concerned.
On Saturday morning, the speculators were back on the Atchison Board of
Trade floor—to a man. The rain had washed their faces clean of all
animation. Mr. Roper, working with telegraph instrument, rose and faced
the weary-laden boys. “Gentlemen,” he said, “I’ve got good news — for
nobody.” The death-like quiet for a fraction of a moment, as if we were
standing in the Salt Lake Mormon tabernacle waiting for the usual pin-
dropping demonstration, gave way to a concerted sigh. It had rained
everywhere.
I sold 50,000 bushels at the opening. My profits were wiped out clean. The
extra 10,000 bushels short sale made me $63.75 in about three minutes. And
this, added to the return of my $100—and relief from liability—made me
feel rich.
Though little or no wheat was grown here at that time, the Kansas wheat
farmer was considered the biggest gambler of them all. Even so, having just
got out of a big wheat deal, by “the skin of my teeth,” would it not be good
business for me to take a “flyer” in some wheat land, and try growing the
stuff?
Land in the wheat country was going begging at $300 a quarter—the same
land that is now selling up to $200 an acre. Land agents were actually
fighting over prospective buyers. Bill Talley, born in Indiana and reared
here, was at this time operating a drink emporium in Wetmore, but had
lived, and dealt in land, at Cimarron, in Gray County. At the depot, the day I
started for the west, Bill told me to go to his friend, Johnny Harper. When I
got off the train at Cimarron at 2 o’clock at night, Johnny was there to meet
me. We by-passed the leading hotel—a rival agent, F. M. Luther, lived at
the hotel—and Johnny took me to a restaurant three blocks away. The next
morning Johnny and his partner, Mr. Emery, ate breakfast with me at the
restaurant. Mr. Emery was to drive me across the river to look at land.
Every parcel of land shown was priced at $300 a quarter. And at every
booster stop we visited, the farmer would reply to Mr. Emery’s inquiry: “I
would not take $25 an acre for mine.” A few sandhill plums, a dilapidated
barn, and weather-beaten three-room house—made the difference. We got
back to Cimarron about four o’clock in the afternoon.
As if he were sure I had seen a plenty to interest me on the side of a quick
purchase, Johnny produced a map, saying, “Now, which piece have you
decided on?” I had made no decision. Mr. Emery then thought I might like
to see a big alfalfa field four miles up the river—not that it was for sale, but
just to show me how good it was. In truth, it was just to get me out of town.
The alfalfa looked good, but you know my mind was fixed on wheat, and
this big field did not interest me.
I had company again for supper, and either Mr. Emery or Mr. Harper stayed
by me until bedtime. It was Saturday. I needed a shave. Mr. Emery took me
through the main business part of the town to a barbershop on the south side
of the tracks. And here I came as near getting a skinning as I ever did in a
business deal. There were, of course, better shops in town—but competitive
real estate agents didn’t go across the tracks for their shaves. In the
meantime Mr. Luther had dropped in at the restaurant. He was introduced
by Mr. Harper. I asked Mr. Luther if he were engaged in business in
Cimarron? He replied, “Yes, the real estate business.” Right away I had a
notion that I should like to have a private talk with Mr. Luther. Likewise,
Mr. Luther. And don’t think that Johnny didn’t catch on, too.
Mr. Luther bid us “good night,” and stepped outside. Mr. Harper bid me
“good night,” and started on his way out—and I went up to my room. We
were to start right after breakfast on a drive to Dodge City, thirty miles
down the river, where I would get a train for home. I did not go to bed
immediately. I went back downstairs for something, I don’t remember what
now. Maybe to pick up a little disinterested information from the restaurant
man. Mr. Luther came back in at the front door. Mr. Harper followed
immediately. I went back up to my room.
The following morning three real estate men ate breakfast with me. Mr.
Harper, Mr. Emery, and I started for the livery stable a block away, while
Mr. Luther lingered awhile over his coffee. Bill Talley’s friends owned their
driving team, and did their own stable work. When they got their fractious
horses partly hitched, I made an excuse to run back to the restaurant. Mr.
Luther said, “You were over in the neighborhood of the Kelly school house
yesterday, I believe. I can sell you three quarters in the same section as the
Kelly school house for $200 a quarter, or $600 for the three quarters.” I
promised to write him—or see him later.
Mr. Emery drove me to Dodge City, showing me a big 30-acre cottonwood
planting on the way, which purportedly was the reason for the drive. It did
not interest me. We had cottonwoods at home. Mr. Emery stabled his
foaming horses at a livery barn on the south side of the tracks, near the
river, a good quarter of a mile from the Santa Fe depot. We ate our dinner at
a restaurant close by the depot. It was Sunday. Mr. Emery showed me the
town. We visited “Boot Hill” Cemetery, the only visible reminder now that
Dodge City was once the wildest and toughest spot in the Old West, and
other semi-interesting and some non-interesting places. After walking our
legs off, we were now near the depot again.
Mr. Emery wished to look in on his erstwhile steaming horses. Yes, I would
go along with him. On passing the depot I dropped out of the line of march
on the pretense of wanting to get a line on the through train I was to take
that evening. This done, I hiked back to the restaurant, inquired for a real
estate office, and was told the Painter Brothers in office above the
restaurant were the men I should see. A poker game was in full swing, but
one of the brothers—I couldn’t for the life of me remember which one now
—took time out to tell me that he could sell me land as good as the best for
$200 a quarter. He gave me some literature. We planned to meet again.
I rushed back to the depot in time to meet Mr. Emery on his return from the
stable. We walked some more. A local train from the west was due at 3
o’clock. Johnny Harper got off this train—and took over. Mr. Emery bid me
“good-by” saying he would now drive his team back to Cimarron. Johnny
proposed a walk. We took in the town again—always by our lonesome. He
saw me off on the train. I did not learn how Johnny planned to get back to
Cimarron. And I didn’t care.
Bill Talley was at the depot when I got back home. He said, “Well, did you
see Johnny Harper? Fine fellow, isn’t he?” And, “Did you find anything to
suit you?” Yes, I had seen Johnny; fine fellow, too. No, I had not bought
anything—yet. But I planned to buy three quarters in the same section as
the Kelly school house, from F. M. Luther, for $600. Bill popped his fist in
the palm of his left hand, and bellowed, “Damn Luther!”—with shocking
prefix.
It is only fair for me to say that ordinarily Bill was not given to the use of
such language. But the exigencies of the situation were very much out of
the ordinary. With prospect of a cut in commission—and his fear that I
might run afoul of Mr. Luther—Bill had gambled the price of a telegram to
Johnny Harper. I did not learn the why of this explosion for a little over one
year. My brother Frank was considering a trade for a quarter of irrigated
land south of the river, two miles from Lakin, and had written from Fresno,
California, asking me to look it over, and report to him. On going through
on the train, I stepped off at Cimarron, and inquired for Johnny Harper. A
by-stander said Johnny was not among the people on the station platform—
but, he said, “Here’s his brother.” Johnny’s brother stepped forward, saying
he was going west on the train. On the train, he said, “You were out here
last year driving with Johnny. Why didn’t you buy, then?”
I told Johnny’s brother that they had “herded” me so closely as to make me
suspicious. He said they had to do that to keep their competitors from
blocking their sales. He said the competitors would quote a low price on
tracts in the neighborhood of the places visited by Johnny’s prospects—and
then, if the prospect decided to buy, the competitor would discover that his
partner had just sold it to another—but he always had other bargains to
show him.
Johnny’s brother also told me that our friend Talley had gotten into an
altercation with Mr. Luther, and that the Cimarron man had knocked the
whey out of our Wetmore boy—all while the latter was connected in the
realty business with brother Johnny.
If I could have gone out there wholly on my own—that is, without any
helpful interference from Mr. Talley, and maybe got lost on the big flat
beyond the sandhills just south of the river for a week, I could have made a
potful of money. I had planned to buy two sections. But, instead, I bought
80 acres of rather swampy bottom land here for the same money, $2400 —
and then spent $1800 more to install five miles of drain tile.
This tiling was a gamble that paid big dividends.
Michael Worthy, my late semi-partner in the grain business, had better luck
than I. He bought Gray County wheat land in the neighborhood of the Kelly
school house — which was to be passed down as a huge profit-making
legacy—even to the third generation.
Oscar Porter was a track buyer at Bancroft until Jim Wilcox, elevator
owner, crowded him out. Being a track shipper, Oscar was not eligible to
come into the Association — nor was I, but somehow I had been roped in.
Porter wanted to know how I did it, that he might do likewise. I could give
him no helpful information. His next step was to start legal action to compel
me to divulge the secret. I was subpoenaed to appear in court—supposed to
be the star witness—in a complaint lodged by Mr. Porter against the
Association.
County Attorney S. K. Woodworth called me aside, said he knew I had the
information to smash the Association, if I would just give. He said I could
tell the truth—he added, “and I know you will,” without fear of having it
used against me. I asked him if he were thinking of the time when I had
slightly stretched the truth—but I really had not done this — in behalf of his
candidacy, in my newspaper? He laughed at that.
I told Sam that he could depend on me to answer his questions truthfully, as
always—he laughed again—but that I would not make a statement. He said
he would not ask me to do that. I was not particularly in sympathy with the
Association, but I did not want to volunteer information against it—and
then, too, my Atchison friends and my partner Michael were entitled to
some consideration.
I answered the County Attorney’s questions truthfully, and I believe
satisfactorily—but still they did not get what they wanted. I had the
information, of course, but Sam and Oscar knew too little about the
business in hand to formulate the right questions. I believe they did not
know about that illegal contract.
If they could have had Michael and our illegal contract, written in violation
of the Sherman Act, brought into court, they would have had a case. But
then it was I, a lowly track buyer comparable to the complainant, who had
by some hook or crook, aided by a swift kick in the pants, bolted through
the barrier that was keeping Oscar out of the Association.

LOCAL “BOARD OF TRADE”


Not Hitherto Published—1947.
By John T. Bristow
This, a continuation of the preceding article, brings us up to the second
phase of my grain dealing experience. The businessmen, and some who
were not so businesslike, organized what they called a Board of Trade,
purportedly for the enhancement of the town’s interest—but, in reality, as
events proved, to locate an outside man in the grain business here.
Goff had two merchants advertising in my newspaper — one a particularly
live businessman—quoting prices, and drawing trade away from this
territory. Even people living right here in town would go up on the noon
train, and come back at four o’clock, loaded with purchases.
There had been discussions as to whether or not it was morally legitimate
for the local paper to accept outside advertising when in competition with
the home merchants—and the publishers all around had decided that it was
quite legitimate, especially when the home merchants did not make liberal
use of the paper’s space. Yet, I doubted if it was wise for me to do so.
However, I do not think I was violating the code of loyalty when I prayed
for a live merchant like Mr. Abbott.
The Board of Trade had come to life in Moulton De-Forest’s office across
the hall from my printing office, on a Thursday night. My name, mentioned
for possible membership—I was told, later—was discussed at length. I was
the culprit, at least it was I who owned the vehicle carrying the price-
smashing ads which were making them unhappy. And though I was at the
time publishing The Spectator, doing job printing, buying and shipping
grain, writing fire insurance, selling real estate, and making more farm
loans than both the other assembled loan agents, there was doubt if I should
be classed as a businessman, in the true sense. Stupid as this may seem, it is
a fact. The reason for it is not apparent—yet.
There were in this organization men who had been at odds, even fighting
mad, over other activities. It seemed as though something nasty was always
brewing then. The man who had not so long before been petitioned to leave
town, and the fellow who had borne the liberally signed document to the
printing office for public exposure, were now working together in an effort
to push me around, simply because I had been so indiscreet as to accept
outside advertisements.
The leading Prohibitionist had been especially active in trying to clean up
the town. It had provoked the imbibers and the “blind-tiger” boys. They got
up a petition asking the Prohib to leave town, and brought it to the Wolfley
printing office, where I was in charge during the editor’s absence. I refused
to print it. They berated me plenty. But they got handbills printed elsewhere
—now signed “Committee.”
The Prohib did not choose to leave town.
One of the “boys” got gloriously drunk—and bragged a little. The Prohib
and the Drunk met in the middle of the main town square. There were a lot
of people on the street. Ed Cawood, quite young then, is the only one now
living that I recall. The Drunk struck at the Prohib, missed, and fell flat in
the street. He had to have help to get up.
Years later, I heard a brother of the Drunk, a highly respected, and
ordinarily very truthful man, in telling the story, say that his brother (called
by name) beat the Prohib up scandalously. You can’t rely on what the old
fellows tell you. You’ve got to know it—or let someone who does know it,
tell it. Hearsay, after it passes through a generation is not reliable.
Here I wish to say that, except the grain business, the sidelines enumerated
herein were acquired from the long established agency of S. C. Shuemaker,
at the same time I bought the newspaper after his death, and that I was not
butting in on anyone’s prior rights. Also, I want to say that the ones having
those unreasonable notions, had axes to grind.
However, a committee came over to my office, and asked me to join them
in Moulton’s office. I gave them $1.00 membership fee, and noted the
freshly written by-laws calling for an additional dime for each and every
time I might be absent from the regular Thursday night meeting. Keep this
in mind.
The members who had no axes to grind were pretty decent. They felt the
need of something to counteract the inroads the Goff merchants were
making on the local merchants’ business, and decided that a full front-page
write-up in The Spectator was desirable. It was promised for the second
week ahead. Nothing was said about paying for this service—and no
payment was expected.
Henry DeForest told those dominating members that they were acting like
spoiled children, or worse—imbeciles. It is really surprising to what absurd
lengths some fairly just people will sometimes go in trying to force their
will upon others.
Now, Thursday night was always a busy night with us — but it was doubly
so the next Thursday night. The Board fellows decided that they could not
wait two weeks for the write-up, and asked me to advance it one week. I
told them that we would accommodate them it we could get Mr. Abbott to
reduce his space, or forgo the advertisement altogether. Mr. Abbott would
oblige. And this was the straw that ultimately broke the spinal column of
the Board of Trade.
Our full office force burned the midnight oil that Thursday night—and then
some. The Board members trudging up to Moulton’s office could have
looked in on us and seen that we were having no picnic. But, by golly, we
were a little proud of our accomplishments, hoping it would please. And it
did. The thing that caused me to lose faith in the Board was that paltry dime
assessed against me for missing the meeting.
The prime purpose of the Board was to locate an outside man in the grain
business here, backed up by a stronger purpose of one of its members to sell
an old canning factory building to be converted into an elevator:—plus one
up-and-coming young doctor who was crying for an opposition paper, with
political slant. The business was delegated to a committee of four—the
canning factory owner, a relatively new doctor, and two other men.
At this time doctors, after petty politicians, were the bane of the local
papers. It was considered by the profession unethical for them to advertise
—yet, too often, they craved top newspaper recognition when only minor
mention or none at all was due. The case in hand was the third, with as
many different doctors, with which I had to contend—in every instance for
what the paper failed to say about them, or what it did say about some other
doctor. But I want to say that our old reliables, Dr. J. W. Graham, and Dr.
Thomas Milam, did not fall into this category.
However, the cases I had t o deal with were really mild — mild indeed to
the one which threatened to do mayhem, or worse, to the whole office force,
when I was printer on T. J. Wolfley’s Spectator. A doctor who had come
down from Granada and located in Wetmore, sent word that he was going to
pay us a visit at 10 o’clock of a Saturday morning for the express purpose
of cleaning out the whole office. The offending item was a week old, and
the demanded retraction in Friday’s paper had, as viewed by the Doctor,
added “insult to injury.”
Theodore Wolf ley really enjoyed a scrap—and managed to have something
on tap nearly all the time. He represented one faction of the local
Republicans, and Moulton DeForest, when not a pronounced Prohibitionist,
essayed to control another faction. The Doctor, a husky farm-bred boy in
the Granada neighborhood, now on honored citizen of Wetmore, was a
rantankerous Republican allied with the De-Forest faction—until he
switched to the Populist party without losing any part of his rantankerous
attributes.
Anticipating in advance the proposed call from the Doctor, Wolfley
procured a revolver, and he and I practiced shooting the thing in the office,
from a distance of ten feet, with target pinned on the leg of the imposing
stone. He never hit the target once, but he broke a window pane all of two
feet above the stone. He always shut his eyes and flinched before pulling
the trigger.
I was supposed to be stationed at the imposing stone, in pretense of
performing my regular duties, with iron side-stick—a lethal weapon when
expertly wielded—in readiness for my part of the defense, if, and when, the
Doctor might extend his belligerence thus far.
The printing office at that time was over the old Morris store on the north
side of the main street. A stairway went up on the outside, with turnback to
the front porch above. At the appointed hour, heavy feet pounded on the
stairs. I had all of one minute in which to visualize my precarious position.
With each step on the stairs my nervousness mounted. The irate intruder
would of necessity be stationed somewhere between the editor and his
foreman. The thing that worried me was my boss’ unpredictable
marksmanship.
But it was not the Doctor’s heavy feet on the stairway. He had sent his
understudy, Joe Eyman, who also was a husky bigfooted farm-bred boy
from up in the Granada neighborhood. Joe fixed matters so that the Doctor
and the Editor could talk it out between themselves. And in good time Joe
became eligible to write MD after his own name. He then married Hattie
Smarr, and they went to Sundance, Wyoming, to hang out his shingle. She
was known in later years, in Wetmore, as Mrs. Stalder.
I am not sure if the belligerent Doctor’s grievance was professional or
political. Probably the latter—but I do know that he was touchy in a
professional way, for he later accounted for one-third of my unfavorable
experience with doctors, as earlier mentioned in this writing. His successor
in the Granada field had sent in by our Granada correspondent, a dollar’s
worth of advertising, in the form of a personal, which had piqued the Old
Doctor, causing him to do a bit of rantankerous snorting at me. But I did not
rush out and buy a gun. I used the weapon I already had. The paper ignored
him—and that whipped him into line in about one year. And he was ever
after that my friend—with full ‘appreciation of the silent power of the press.
He was a good doctor, and a good fellow—when he was good.
As Populist crusader, the Doctor was a success. His advertised meetings
drew big crowds. He always brought in a principal speaker. One time he
had two billed for the same night—”Sockless” Jerry Simpson and “Peruna”
Jerry Botkin—but he got Mary Ellen Lease, instead. The Doctor and his
two very fine little girls, Bertha and Belle, led the singing. The Doctor
himself was not a noted vocalist—but he bore down heavily on the refrain
of his favorite Populist song, “Turn The Rascals Out.”
Also, let me add that any time the editor of a local paper lets the politicians
handle him, he is going to be woefully out of luck. Politics was dirty then.
If an editor was a Republican, he was expected to engage in mud-slinging,
shying the muck at all and sundry Democrats, regardless of their standing as
citizens. The mere favorable mention of Republican candidates was not
enough. And if he were true blue, he must keep up a barrage against editors
of Democratic papers, and vice versa, a sort of nonsensical exchange of
blasts. I steadfastly refused to be drawn into their political scraps. They
called me a “mugwump.” But Gov. E. N. Morrell said—put it in writing—
that inasmuch as I had succeeded in keeping my political skirts clean that I
was a high-minded Republican. My hardest task was to hold down a
brilliant and goshawful sarcastic local politician who wanted to engage in
muck-raking, over the assumed name “Samantha” in my paper.
Politics was something to be shunned by me—that is, from a business
standpoint in connection with the publication of the newspaper. I once went
over to Edgerton, in the Missouri hills beyond Rushville, to investigate an
offer of $1,000 bonus for the establishment of a newspaper. I struck the
town at a time when a teachers’ convention was being held there. The
banker, who was on the committee welcoming the teachers, was also on the
committee pulling for the paper, and he had arranged the appointment with
me. Mistaking me for a professor, he gave me a hearty handshake, and
welcomed me along with the teachers getting off the same train. When I got
up town, I called at his bank—and was “welcomed” again.
“What’s your politics?” he asked.
“Republican,” said I.
“Your train leaves in one hour,” said he.
I did not know Missourians as well then as I do now. The banker laughingly
said, “Stick around awhile—I will talk the matter over with you when I get
a moment’s time.” He told me that there were only two Republicans in the
township; that I could run the paper as an Independent until election time,
and then I would be expected to be a good Democrat—a real old “Missouri
Mossback” and no foolin’, I think the order would have been. I judged they
did not want a newspaper. They wanted a political “organ.”
On invitation of the banker, I attended a meeting in the school house, which
was set in a natural oak grove — and met many sociable and interesting
people. In the gathering, there were a lot of pretty girls—and all in all, it
looked to me as if it would be a swell place for a young fellow to settle
down. But—while I wouldn’t know why I was a Republican, I couldn’t
pretend to be something that I was not.
A young doctor from Goff had come here to make his professional start. He
first took his old schoolmate, Ecky Hamel, to task for calling him by his
given name, demanding that he be addressed as “Doctor.” Ecky had
gravitated from country school teacher to printer and reporter, and thought
he himself was some pumpkins, too. But I don’t think this was held against
the Doctor when Ecky wrote the five-line item that touched off the
explosion—caused the Doctor to whoop-it-up for a competing paper.
The offending item merely said that “Dr. Jermane of Holton, who had
operated on Lyman Harvey here last week for appendicitis, had died of a
like operation at Holton this week.” A Philadelphia lawyer could have
found no fault with this—but the local doctor thought it was a reflection on
his professional ability. Knowing that he had brought the Holton doctor
here to do the job, and knowing also that the local doctor had been duly
recognized in the item reporting the Harvey operation, I thought he had no
kick coming — and let it go at that. And anyway, Mr. Harvey had also died
of his operation.
The complaining doctor was a hustler, socially a good fellow, very much on
the way up in his profession, when a catastrophic repercussion reduced him
to the level of the ice-man. As attending physician, he had brought into the
world an illegitimate child whose birth was a great embarrassment for its
little mother and the maternal grandparents. And on a subsequent call at the
country home he discovered the child was missing. I am not familiar with
the details at this stage of the affair, but rumor had it that the doctor turned
sleuth and dug up the fact that the child was buried in the back yard.
The home folks, older members of the family, contended that it had died of
natural causes—pneumonia, I believe. The doctor was wholly within his
rights when he reported the matter to the authorities—but he did not prove
an apt witness in court. Two older doctors from the north part of the county,
combined and “proved” in effect, on the witness stand that the young doctor
did not know enough about such matters to make a case.
In the ice business in a southern Kansas town the fellow made good. And
though the “injured” doctor had kept on whooping-it-up for a competing
paper until he did, with the help of some disgruntled politicians, put me out
of the newspaper business, I’m glad to say he was not one to carry a grudge
beyond the time of its actual usefulness to him. Just for old friendship’s
sake, he wrote me from the office of his artificial ice plant—owned jointly
with his brother—complimenting me on one of my articles in W. F.
Turrentine’s Spectator. This note on the background of the doctor is given
here for reasons which will appear later.
J. W. Coleman, publisher of the Effingham New Leaf, having conceived the
idea that a string of local papers along the Central Branch, would be the
motive power to land him in a fat political job, came here to negotiate with
me for the Spectator. My paper was not for sale. The doctor and the political
boys combined to persuade Mr. Coleman that a second paper would be
preferable. It would seem the MD and PB’s did not want to crush me on the
spot—or maybe it was their idea of one huge joke to let me die a slower
death. In either event, it was the wedge that pried me loose from The
Spectator. I sold to Coleman. I did not permit this to cause me to break with
the Doctor and my political friends — as there was the outside chance that
they might have been misquoted by the over-anxious purchaser. And then,
too, it was not long before I really liked it. It afforded me time to give my
full attention to other more congenial matters — for getting married, for
instance. The wife said it was a great stroke of good luck for me.
I had weathered one brief, and I may say clean siege of competition, which
had proved that the town was not large enough to support two papers. P. L.
Briney, with his two daughters, Bertha and Olive, wholly on their own—
that is, without MD’s or PB’s moral support—established and published the
Enterprise for about one year. Unable to make a go of it, Mr. Briney sold
the whole outfit—exclusive of the girls, of course—to me for $125, his first
asking price.
Mr. Coleman did not last long enough here to do the political boys any
good. He got off on the wrong foot in an early issue. He attended a recital
given by Edith McConwell’s music pupils—and ridiculed it. Our people did
not like to have their kiddies ridiculed—nor their music teacher either, who
was once a kiddie here herself. However, after a few issues by Coleman, Art
Sells, also of Effingham, took charge, and gave the people—not the
politicians—a very satisfactory paper. Coleman gave up his political
aspirations, sold his two papers, and took the job of City Editor for the
Atchison Daily Globe. However, Coleman’s successor, W. F. Turrentine,
held forth twenty years longer than the fourteen years that I had published
the Spectator before giving up the ghost about five years ago. The idle plant
is still in Wetmore.
To give a clear picture of the grain situation I should explain that Mr. Baker,
of the Greenleaf-Baker grain firm, of Atchison, had asked me why would it
not be a good idea for me to build an elevator here? I told him that I did not
think there would be business enough, from year to year, to justify me in so
doing—which, I might say, was a fact fully demonstrated in later years. I
pointed out that with the large feeding interests here; and in the north
territory, particularly at Granada, where the Achtens sometimes bought as
much as one hundred thousand bushels of corn for feeding cattle and hogs;
that practically all the south territory was in pasture land; and with two
elevators at Goff and- two at Netawaka, we could hardly expect to draw
trade away from them without making costly inducements, as we were now
doing in our track buying.
Mr. Baker said, “Well, then, I’ll build one for you. It will save you paying a
premium to get the corn, and make it more convenient for you to handle it.”
I think the Board members did not know this at the time of organizing. But
the committee, composed of the man who had a canning factory building to
sell, and the doctor who wanted a competing newspaper with political slant,
both uncompromisingly for the Goff man, and two other men who had a
tendency to view things in their proper light, met with a representative of
the Greenleaf-Baker firm in ‘the opera house here. The spokesman for the
committee told Frank Crowell, Mr. Baker’s brother-in-law, and member of
the firm, that they preferred to locate their man Reckeway, because it would
bring another family to town and consequently make a bit more business for
the local merchants. Mr. Crowell told them that we would like to have their
friendship and co-operation—but, regardless of whether or not they located
Mr. Reckeway, that his firm positively would build the elevator as planned.
The two silent members on the committee packed power enough only to
delay action.
As it is now all water over the dam, with not even a trickle of cankerous
aftermath, it is not my purpose to show up the old Board of Trade boys in a
critical light—but it was evident that they were not being guided by the
Golden Rule. They knew the Greenleaf-Baker people were going to build
an elevator, when they located their man. They knew also that in normal
crop years there would hardly be business enough here to sustain one
elevator. As a sort of excuse for them pulling for the Goff man, the
spokesman said to me, “You know, if we don’t get our man located this
year, we may never get an elevator. We have never had a corn crop like this
before, and we may never have another one.” It was not strictly a Christian
act—and I suspect they never had any regrets for having turned the trick. It
was apparently their way of building up the town—and, incidentally,
securing a buyer for an old canning factory building.
The Canning Company, a local organization, having failed to bring in the
expected returns, and having accumulated debts in excess of its ability to
pay, had liquidated, the building going to the highest bidder, one Theodore
Wolfley by name—uncle of Editor Theodore Wolfley. Then, later, it was
planned by the holders of the worthless canning factory stock—and others
—to try to recoup their losses by the establishment of a cheese factory, with
an eye on the old building as a prospective site. It was then that the present
owner hopped out and bought the old canning factory building, hoping to
turn a neat profit. But the cheese factory promotion fell by the wayside. It
was then patent to the purchaser that he had over-played his hand. Knowing
these facts, one can better understand his sudden anxiety for an elevator—
for the good of the town.
Their prospect, W. M. Reckeway, who had been operating the Denton
elevator at Goff, likely misunderstanding the Committee, gave out an
interview in the Goff Advance, saying that they had bargained for the
Worthy dump, and that it was his intention to build a modern up-to-date
elevator in Wetmore, but J. T. Bristow had slipped in and bought it away
from them—the inference being that the good people of Wetmore who had
longed for an elevator for lo these many years, would now have to take
what they could get—something less than would have been the case had
Bristow behaved himself.
Had this been true—the way I look upon such matters — it would have
been both shrewd and legitimate business on my part, though it would have
left an ominous smirch on Mr. Worthy. But it was far from the truth. The
Board Committee had not bargained for the Worthy dump.
As has been pointed out, the Greenleaf-Baker Grain Company had already
planned to build an elevator here for my convenience, as a shipper—but of
course the company was not in the market for the old canning factory
building. My Company, as well as their prospect—not the Committee —
wanted a better location. Mr. Baker instructed me to buy the Worthy dump,
solely for the location.
Knowing the canning factory owner like a book, I did not even suspect that
they would consider the Worthy location. And as a matter of fact, the Board
Committee apparently did not want the Worthy dump—only, at any rate, as
a last resort. When I called on Mr. Worthy, he said, “I’ve given the Board of
Trade fellows an option on it for $200, good until noon today. Come back
here promptly at twelve o’clock. Now don’t wait until after dinner,” he
warned. The Committee went to Mr. Worthy after one o’clock, asking for an
extension of the option. That old canning factory was still in the way. And
the owner did not exactly pat me on the back, but looked as if he wanted to
when he learned that I had bought the Worthy dump. I did not get the
doctor’s reaction to this—but I do know that, though we continued on
friendly terms—we never had any clashes — he continued to “harp” for a
competing paper, with political slant.
Mr. Reckeway, being handy with hammer and saw, converted the old
canning factory building into an elevator in time for the fall business. The
people, including the Board of Trade boys, had an erroneous notion that an
elevator operator could pay more for corn than the track buyer, and while
the reverse is true, they had located their man with this belief. Then that
new man did give me a merry chase—in fact he put me completely out for a
spell. He paid more for corn than I could get for it. How come? Well, the
BT boys gave credit to the old canning factory. They were wrong of course.
It may be a little early to bring this in—but Mr. Reckeway was making
some profit on the sale of a carload of flour he had brought in, but he could
not count on a repeater in this line, for he had already been told by the
canning factory vendor—who sold flour in his general store at substantially
higher prices—to cut it out. It was made plain to the fellow that he had not
been brought here to compete With the home merchants.
I’ll get around to aft explanation of how and why Mr. Heckeway bid up the
price on corn—but this seems the opportune time to slip in a line about the
entry of a business which led all competition. And lo, the man was from
Goff, the town which had furnished me a competitor in the grain business,
and a politically minded doctor who wanted a competing paper—and
ironically enough, the town whose advertising merchants, C. C. Abbott,
John Wendell, and George Bickel, were the thorns that had been pricking
the Board of Trade boys’ sensitive hides.
Mr. C. C. Abbott, the live merchant—the man whose advertisements in my
paper had given so much concern at the Board of Trade’s first meeting, and
was the cause for that elaborate write-up, had moved in on them with a
complete new stock of general merchandise, locating in the old Stowell
brick building, the present Catholic recreation hall.
Now, let ‘em kick!
The energetic efforts of the dominating member of the Board Committee to
close a deal for the sale of that old canning factory building had,
unwittingly of course, also paved the way for the entry of some live
competition for himself.
Mr. Abbott became my best advertiser. Legitimate, too. He paid, in trade,
three to five cents a bushel premium for ear-corn, and turned it to me at the
market price. Also, there was a general come-down of prices in the other
stores. Now was I, or was I not, working for the best interests of the town?
Evidently Mr. Reckeway had a threefold purpose in bidding up the price of
corn. He wanted to build up a reputation, wanted to crush competition, and
at the same time discourage the Greenleaf-Baker people in their plans to
build an elevator here. The word got around that I was going to try to
operate the Worthy dump “as is.” It would have not been fruitful for them to
let Reckeway know the truth at this stage of their dickerings—hence the
circulated report that I had bought the Worthy dump, aiming to operate it
myself.
Nor did Mr. Reckeway know that the order for the lumber in special lengths
had been given to a mill in Arkansas the day after I had bought the Worthy
dump, when he betook himself to Atchison in an effort to dissuade the
Greenleaf-Baker firm from building, pointing out that he had the grain
business corralled here; that I was now a “dead duck,” without standing in
my own community. Mr. Baker was not impressed by Mr. R.’s pleadings.
Mr. Reckeway had been shrewd enough — or lucky enough—to sell, in
early fall, a sizable quantity of December corn at a price above the settled
market. He had been sloughing off his profits to the farmers to create
atmosphere—and to stop me. Many of his old Goff customers were now
bringing their corn to him in Wetmore, a high testimonial of his popularity
—and a welcome morsel for the aggressive half of the BT Committee to
peddle in support of their earlier expressed contention that an elevator man
could actually pay more for corn—even, so to speak, pull rabbits out of a
hat.
Had Mr. Reckeway made it win, it would have been good business. As it
was, I’m not shrewd enough to say whether it was good business or bad
business. The one certainty is that he did not make the goal he was shooting
for.
Owing to delay in getting the lumber, the Baker elevator did not open for
business until January 5. Reckeway had now quit playing for atmosphere.
Then, we both got more corn than we could conveniently handle, as a car
shortage had developed, which slowed down shipments.
We had a little bad luck the very first day the Baker elevator was opened for
business. We were getting corn from three shelters, about 4,000 bushels that
day—and some of the wagons came in after dark. Elmer Brockman, the
builder, was looking after the elevator end of the first day’s run. I weighed a
wagon, told the driver to wait for Elmer to signal him in with his lantern.
Something had gone wrong, and Elmer had taken his lantern and stepped
out of the driveway. Mr. farmer, after pulling up and stopping, decided that
he didn’t need a lantern to guide him—and he drove on in and got one horse
part way in the open dump. The horse lost patches of hair in two or three
places, but was not otherwise injured. The next day the fellow came back
and wanted to sell me the horse for $100. The old plug was worth only
about $40. I didn’t want to buy the horse at any price, and I didn’t want the
man to go away dissatisfied. And I suspicioned—correctly—that some of
my competitor’s supporters might be back of the fellow. I suggested that I
send Milt Cole, the liveryman, out to the farm to examine the horse—and
that I would pay him whatever amount that the two of them might decide
would be just. Mr. Cole said $40 would be a big plenty—and I paid it.
Then, about a week later the farmer, pleased with his high-handed stroke of
luck, had the nerve to tell me that I was an easy mark, that the horse was as
good as ever, and that I had virtually thrown away forty dollars.
Now, this man was on a farm owned by an Illinois man—a Mr. Smith, who
had entrusted me with the rental of the place. The farmer had contracted to
pay cash rent, with a clause in the contract stating that in case of drought, or
for any cause lowering the normal yield, that a substantial reduction would
be allowed. Mr. Smith was a firm believer in the old principle of “live and
let live.” But he soon found out that it wouldn’t work so well here. And
anyway, it was mostly his sister’s idea—she having an interest in the land.
The tenant had asked for a reduction. Well, Mr. Smith came to my printing
office one day, borrowed my shotgun, pulled on new overalls, and went out
to his farm to hunt a bit. He found the tenant at the house, asked for and
received permission to hunt. Mr. Smith said truthfully he had just got in
from Minnesota, and casually asked about crops in general here. The tenant
said they had been good, and he bragged a little about how well he himself
had done that year. Mr. Smith’s sister lived in Minneapolis, and he had gone
around that way to get her to yield a point on that stiff “live and let live”
idea of hers—and to discuss plans for selling the farm. I sold it for them,
later.
Might say here that another tenant the previous year had asked for, and
received a reduction. The man had sold his corn. He patted his pants pocket,
and told me, “I’ve got the money all in here. They’ll have to settle my way,
or not at all.” He was entitled to a reduction and I was sure Mr. Smith
would do the right thing. And he did. I said to the tenant, “If you should
lose that money we would have no chance to collect anything. Put your
money back in the bank where it will be safe. If anything comes up, I’ll
notify you in time for you to get it out before attempting to force a
collection.” He said, “On your word, I’ll do that. Can’t sleep very well with
the money in my britches, anyway.” This man was Albert W. Dixon. Don’t
care to name the other fellow.
This rather unusual incident got “noised” around, and the tenant:—the
farmer with the “crippled” horse—being what he was, thought he might just
as well do a little more gouging. Mr. Smith said to me, “Make that fellow
pay in full—and get rid of him.”
Still Mr. Reckeway was not satisfied. Having failed in his efforts to block
the building of the west elevator, he now began a play to get control of it.
And, finally, he did get it. During a grain dealers meeting at the Byram
hotel in Atchison, Frank Crowell told me that my competitor was still after
my “goat”—that Mr. Reckeway had just renewed his offer to give them all
his shipments, if he could get control of the west elevator.
I said, “For heaven’s sake, let him have it—if it means anything to you?”
Please note that Mr. Crowell and Mr. Baker were my sponsors. They would
not let me down.
Reckeway closed the west elevator.
When the new crop began to come in, I resumed track buying. I could have
forgiven Mr. Reckeway for trying to squeeze me out—but now I would
have to show him how badly he had been misled by his promoters, when he
told the Greenleaf-Baker people that I was a “dead duck.”
We now had a new man in the depot. Agent Larkin was a fine Christian
gentleman, an active church man. Also, he had a wife, and a pretty daughter
who was a popular elocutionist—and a flock of 200 chickens. He did not
impress me as a man who could be influenced or bought for a few kernels
of corn. However, when he asked permission to scrape up the waste around
the car we had just loaded, it gave me an idea. I was not expecting any
favors from this agent — but I wanted to forestall the efforts of my
competitor in demanding a division of cars on a comparable basis of his
grand-elegant physical representation. When the boys would spill too little
corn while loading the cars, I often climbed into the car and kicked out an
extra bushel, sometimes more, before reporting the car ready for sealing—
and of course I wouldn’t object to Agent Larkin gathering up the spilled
corn, for his 200 chickens. I was getting an equal division of cars, and that
was all I could reasonably expect—more, in fact, than seemed equitable to
my competitor, with his investment in an owned elevator and his shrewdly
acquired control of the Greenleaf-Baker elevator.
The idea that an elevator operator could pay more for corn than the track
buyer was all wrong. An elevator is a convenience to the shipper, and
helpful to a community — but don’t forget for one moment that the grain
producer must pay for it all. When track buying, I usually kept two men at
the car, one inside the car and one to help the haulers shovel off their loads.
I paid them 15 cents an hour. Tom and Juber Gibbons were horses to work
then—but don’t look at ‘em now! And in long hauls, I would take the
drivers to dinner at the Wetmore hotel, and feed their teams at Cole’s livery
barn. The haulers, who were the seller’s neighbors, would complain about
having to shovel the corn—but they, in turn, would bring me their corn for
these extra helps, and extra money. One farmer who sold me 3,000 bushels
said, “My neighbors will kick like the devil about having to shovel off their
loads—but I reckon I kicked too when I shoveled off my loads when I was
hauling for them.”
On the basis of those magnificent holdings, Mr. Reckeway took his troubles
to the higher-ups. Agent Larkin called me to the depot. Reckeway was there
with a special representative of the railroad — the “trouble shooter.”
Reckeway told his side of the story—very correctly, I must say. He owned
outright an elevator, and he had control of the Greenleaf-Baker elevator as
well — and that firm was getting all his shipments. And, as a clincher, he
said, “You know the Greenleaf-Baker people are heavy shippers over your
railroad. They have elevators all along the Central Branch.”
The special agent then asked me: “Have you any storage for grain?”
“Yes,” I replied, “a bin with capacity for two car loads of shelled corn.”
His next question: “Did you ever have to pay demurrage for holding a car
over-time while loading?”
Again I replied, “Never.”
The special agent’s final question, the one I was hoping he would ask me:
“Where do you ship your corn?”
I said, “To the Greenleaf-Baker people in Atchison, as always.”
Reckeway’s countenance showed surprise, if not real anger. The agents both
laughed.
Turning to Agent Larkin, the special agent asked: “Has he told the truth in
all three instances?”
“Absolutely,” said my chicken-owner friend.
“Then, give him every other car,” said my newly found friend.
And Mr. Reckeway stalked out mumbling in jumbled English and German,
of which I could catch only, “A man with two elevators—.” My reputation
was now redeemed.
The so-called “Board of Trade” had long since passed out. It was never a
Board of Trade, anyway. Its operations were limited to the sale of one old
canning factory building, and the location of Mr. Reckeway—that is, if we
do not choose to count the location of Mr. Abbott. You know, I was a
member of the Board, with dues and absentee penalties paid in full.
Now, let’s get this straight. I wouldn’t have been so resentful as to induce a
live merchant like Mr. Abbott to move in on the homefolk. I just told him of
the behavior of some of the Board members, and that I might have to deny
him space in my paper. “Oh,” he said, “I don’t believe you will want to do
that to me.” He winked. Well, I didn’t—really.
Mr. Abbott had been thinking things over ever since the time I had asked
him to surrender his space in the interests of that elaborate write-up. Said he
figured it would now be OK for him to bring me copy for a half-page
advertisement announcing his location in Wetmore.
There were, however, many proposals advanced — but always they met
with opposition from some member or members of the Board. In general,
they kicked like the proverbial “bay steer” whenever something was
advanced which might be helpful to one and detrimental to another. I think
Mr. Worthy and I were the only ones who did not protest their proposals—
such as bringing in Mr. Reckeway. And, frankly, until it had come to a
showdown, I was not favored with too much information as to what
Michael had up his sleeve.
I don’t know where they could have found a better man than Mr. Reckeway
for the place—but he was no miracle man. Handicapped as he was, he
found the going rather tough. And having found out also that the Board
Committee’s prophesy was only a myth—that an elevator alone could not
make two bushels grow where only one bushel grew before—after a few
rather lean years, he departed for greener pastures. I believe Mr. Reckeway
made good in the flour milling business at Girard, Kansas.
The Board of Trade sponsored (Reckeway) elevator, after years of idleness,
has been torn down. Goff and Netawaka, like Wetmore, each now have only
one elevator. And still the grain does not roll into Wetmore as was
anticipated by the Board of Trade enthusiasts. Perhaps the old town may
someday be favored with another set of progressives—who do not know
their onions.
I reiterate, there is no lingering malice in this writing. Collectively, year in
and year out, the oldtime Wetmore people, despite all differences, were the
best people I ever knew—and I lived in relative harmony with them for a
long, long time. I’ve lived a lot of living in the old home town.
And, thankfully, I’m still here.

FAMILY AFFAIR
Not Hitherto Published—1947.
By John T. Bristow
In the foregoing article I made reference to Theodore Wolfley’s poor
marksmanship, with a revolver. When possible, I like to back up my
assertions with proof. I now quote from a letter dated at St. Louis, April 5,
1941, written by T. J. Wolfley to his sister May Purcell, commenting on my
writings in The Spectator, in which I likened a Belgrade story to a hot
Wolfley editorial. It was at a time when a Hitler delegation was in Belgrade
endeavoring to put pressure on the Yugoslavs to force them into the war on
the Hitler side. The quote:
“I received the copy of the Wetmore Spectator, which you so kindly sent
me. Thank you for it. I was interested in the story from Yugoslavia; and
flattered to be even remotely connected with the incident by my friend John
Bristow, who professes to think that if I wasn’t in St. Louis, I might be
running a newspaper in Yugoslavia. . . . Just as in the political wars he
mentioned, I was sometimes more friendly with the men I opposed than
with the ones I favored. But the people liked it and it was then the accepted
slogan to give the people the kind of news they wanted. . . . John was a
good newspaper man and a good squirrel hunter, so we thought a little
expert shooting might lend realism to the picture. But I wasn’t a good shot.
I couldn’t even hit the imposing stone when it stood on the side against the
wall. But I remember John could hit a penny when it laid on the floor at the
leg of the imposing stone. So we depended upon John’s ability as a shooter
to keep the enemy away. . . . Show this to John. A good many things
happened in the Spectator office even after I quit, similar to the way they
happen in Yugoslavia. He may remember some more.”
Well, yes—I do remember one more. Always one more. But first I want to
say that Theodore verifies the point I made in the preceding article—that he
could not even hit the leg of the imposing stone, in his gun-practice. To
those who are not familiar with the mechanics of the print-shop, the
imposing stone is a heavy slab of marble mounted on a stand about waist-
high, on which the forms of the newspaper are made up.
When the Spectator was in its first year, I helped Theodore Wolfley carry
out one of his “bright” ideas which gave him some sleepless nights. His
sister Mary, still too young to carry on a flirtation with a grown man, had
embarked on a whirlwind romance with a Central Branch railroad engineer.
The heavy grade at the John Wolfley farmstead five miles west of Wetmore,
made it possible for the engineer and the girl to exchange notes. And when
they might desire a few moments time together, it was said, he would drop
off at the crossing near her home, and then grab onto the caboose—and the
fireman would take the long freight train into Goff.
Theodore told me that, as her older and wiser brother, he intended to break
it up. He said it had got to a point when a talking to would do no good—and
the girl was too big to spank. We printed a ten-line item in the Spectator,
branding Mary’s Romeo as an all round bad character, even had him
arrested and jailed for drunkenness—and credited the item to one of
Atchison’s daily newspapers. After printing one copy for the Wolfley family
perusal, I lifted the spurious item before running the regular edition.
Theodore commuted on horseback between farm and town at that time. He
took the “doctored” paper home with him. He watched Mary read the item.
He said she wrinkled up her nose, shook her head as if she meant to get
even with someone. When he came back to the office the next day, he said,
“I guess that will hold her.” But it didn’t.
On the following day Theodore discovered the item had been cut out of the
Spectator—and he rightly suspicioned it had been turned over to Mr.
Romeo. He came to the office in agitated confusion. He asked me, “What
paper did we credit that darned item to?” He had maligned an Atchison man
and credited the item to one of the three Atchison daily papers—the
Champion, the Patriot, or the Globe—which made him liable to attack from
two angles. But luck was with Wolfley. John Reynolds, the engineer, came
back promptly with his daily exchange saying the item referred to another
John Reynolds living in Atchison—and the romance went merrily on.
Theodore would have felt a lot easier had he known there actually was
another John Reynolds living in Atchison. And though the second Mr.
Reynolds had a shady record, he was never guilty of the things the item
charged the engineer with. I have penned a line on this John N. Reynolds in
another article. John A. Reynolds, the engineer, was really an honorable
man, with high standing in Atchison. I came to know him well in later
years.
I shall carry on from here — after this paragraph — without Mr. Wolfley.
But I’m not forgetting the Romeo engineer. And I should say here that
Mary’s romance terminated without hitting the rocks, and that Theodore
never had any complaints from Atchison. And I might say further, as a last
tribute to my old friend, that Theodore Wolfley went from here to Phoenix,
Arizona, and became editor of the Daily Republican, owned by ex-
Governor Wolfley, of Arizona, (no relation), where he played up Republican
politics to his heart’s content. From there he went to the St. Joseph (Mo.)
Daily Gazette, where I imagine he would have been a loyal Democrat. And
from St. Joe he went to the St. Louis Globe-Democrat as Financial editor.
While in St. Joe Theodore wrote me that he was holding open for me a
place on the Gazette paying four and one-half times the ten dollar weekly
salary I was getting here. That was considered “big money” then. But I had
promised Curt and Polly Shuemaker that I would remain on the job here
when they bought the Spectator from John Stowell. Curt Shuemaker was
blind—lost his eyesight from close bookwork in the Morris store and as the
first cashier of the Wetmore State Bank. I could not quit them cold—but I
was trying to find them a reliable printer when Curt sickened and died
suddenly, leaving The Spectator in need of an editor as well. The quickest
way to help out Polly was for me to buy The Spectator—at my own price.
Not an unfair price, however. When Theodore was back home a short time
before he died, having just read my manuscript of the Green Campbell
story, he proposed that we buy The Spectator from the Turrentines—just to
show the people what we could do. From past experience, I knew he could
have shown them plenty—and I was afraid he might insist on doing it.
Some years after Mary’s romance, I was walking past the depot in Wetmore
with the girl who afterwards became my wife. Her home was on the south
side of the tracks, near the watertank. The noon passenger train was at the
tank. As we came abreast the engine the engineer hopped down from the
cab, pulled off a leather gauntlet glove, and met the girl with a hearty
handshake—and some hurried palaver. She introduced him as Mr.
Reynolds.
But you know, passenger trains must move on time — and when alone with
the girl, I said, “Let me see your hand.” She said, “Oh, you’d never get a
speck of dirt from shaking hands with Johnny Reynolds; he’s really quite
particular about keeping himself clean of engine grime.” I learned later that
she had told the truth in this particular—but how the devil did it come she
knew so much about him? I said, “I think I know something about him that
you do not know.” Then I told her about his exchange of notes with the
Wolfley girl.
She laughed and said, “Were you expecting to see a note in my hand? You
don’t need to be afraid of Johnny Reynolds. He is engaged to a Miss Spelty,
in Atchison.”
“Johnny” Reynolds had roomed at their home in Effingham before the
family came to Wetmore, when Myrtle Mercer was eight years old. Being a
very courteous man, he “made over” all members of the Mercer family
whenever and wherever he might chance to meet them. And he had gotten
lunches from their home in Wetmore.
After her husband’s death in 1888, Myrtle’s mother had rather a hard time
providing for her family of five girls, ranging in age from two to sixteen
years. She was advised to open a boarding house for trainmen — and others
—but it settled down mostly to providing lunches for the two local freight
train crews which passed through here about the noon hour. I think it was
not very helpful. She was an excellent cook, and her twenty-five cent
lunches were too elaborate to make money, even in those days. The
passenger trains had stopped here for dinner before this. The hotel charged
trainmen 25 cents—as was customary at all stops—while passengers paid
35 or 50 cents. Hence a 25 cent precedent for trainmen.
The pinch was lifted, however, some years later, when Mrs. Mercer was
granted a Government pension—for herself and the two younger children—
with several years back pay. Though only 39 years old when he died, John
Mercer was an “honorably” discharged soldier. He had enlisted in 1864,
when only 15 years old. How he managed to get in at that age, is presumed
to be the same as other under-age boys got in.
One time when I was riding the local freight to Atchison, I saw Tom
Haverty, the conductor, an Irish Catholic, open his lunch basket. It
contained a big porterhouse steak cooked just right—it was a steak that
would cost at least $2.50 now, with very few trimmings. I know that steak
was cooked just right, for my wife had learned the art from her mother, and
she had cooked many a one to the same turn for me. Well, Tom Haverty
picked up that steak, held it as though he thought it might bite, walked to
the opposite side of the caboose and chucked it out an open window.
It was Friday.
After selling my newspaper, I found time to “putter about” on my farm one
mile down the creek from town. I actually did a lot of worthwhile work,
cleaning up the bottom land of brush, trimming hedge, and cutting cockle
burrs with a “Nigger” hoe. I usually stuck a sandwich in my pocket for
lunch—but sometimes Myrtle would prepare a real dinner, even steaks like
I’ve been describing, carry it in a basket, sit down on the ground with me in
the shade of hedge or tree, fight flies and gnats while eating, and pretend to
enjoy it.
One morning she said I need not take a lunch—that she was going to cook a
real dinner, bring it down to the farm, and eat it with me. I told her I would
come for dinner, and save her that long walk. She insisted that she “loved
the walk, loved to get out in the open,” and I told her where to meet me.
But she caught a ride most of the way. Green Goodwin, conductor of the
local freight, told her to come aboard the caboose, that he would stop the
train out near the farm and let her off. He had gotten lunches from her
mother’s home. She said, “Mr. Goodwin said my lunch basket smelled good
— like old times. He told a passenger in the caboose that he could always
be sure of getting a good lunch at our home. I sure appreciated the ride, and
I offered to give him my part of the lunch, but he wouldn’t take it. I’ll bet
that traveling man who peeped in the basket wouldn’t have turned it down.
But Mr. Goodwin did eat two of the cream-puffs: he said they were as good
as the ones mamma used to put in his lunches. That leaves four cream-puffs
for you—if I don’t eat any myself.” What manner of man would have eaten
four cream-puffs—just then?
Myrtle felt pretty chesty about getting this ride—to think Green would stop
his train on a steep grade, to save her the walk. Well, it was a pretty steep
grade—and it was kind of Green to give her this lift. It recalled the time
when, on several occasions, freight trains had stopped at that same place to
let me off. And when the train had started to move again I could easily have
beaten the engine to the top of the grade, in a running walk. But that would
not Tiave been what I had been taken on the engine for, in town. I walked,
or trotted slowly, ahead of the train pretty close to the creeping engine,
shooing grasshoppers off the rails. After the 1874 invasion of grasshoppers
freight trains could not make that grade until the rails were cleared of
hoppers—and I had to stay close to the engine so that the hoppers would
not fly around me and settle on the rails again. I was always “Johnny on the
spot” to catch those rides. To ride the engine was a thrilling experience for a
twelve-year-old boy.
While eating our lunch that day, a covey of half-grown quail came out from
between the rows at the end of a cornfield. Myrtle said they were so cute
that it was a shame to kill them. “And if you shoot any more of them,” she
declared, “I will not cook them for you.” I said that I guessed I could cook
them myself—that I had roasted them suspended on a stick over a fire in the
woods.
“Well,” she said, “I’ll cook them, of course—but I promise you that I will
never eat any more of them.” I tried her out on six birds. She cooked them,
of course—and kept her promise. And then, in due time, I also thought they
were too cute to be killed. But I continued carrying feed to the quail, in
snowy times.
While Wolfley said I was a good squirrel hunter, quail was really my game.
I trapped them in my younger days, and shot them when old enough to be
trusted with a gun. I “potted” them. In the old days quail sold for 5-cents
each and no one would think of wasting a charge of ammunition on a single
bird, especially while on the wing; though I did once shoot a lone quail
sitting on top my figure-four cornstalk trap, under which were twenty live
birds. We made our traps then with any old thing we could pick up and bind
together. The twenty trapped quail had followed a tramped out path in deep
snow, baited with a thin scattering of shelled corn, with a more generous
supply of kernels under the trap—thus to engage the lead birds while the
others were coming up, lest an impatient bird might go after the nubbin on
the treadle and spring the trap too soon. I think trapping and “potting” were
legal then. I winged them in later years, same as other sportsmen were wont
to do.
One time while coming home from the farm on a Sunday morning about
eleven o’clock, three teen-age boys caught up with me. They said they were
from Fresno, California. I questioned them a little about Fresno, and
decided they were telling me the truth. Also, I knew they were not
professional tramps—and that they were hungry. I took them to the
Wetmore hotel, and told Bill Cordon to give them their dinners, fill them up
with double orders. One of the boys had about worn out his shoes—the sole
of the left shoe was dragging, making it hard for the boy to keep up with his
pals. While they were waiting in the hotel for the dinner call, I went to my
home and hunted up a pair of shoes—almost new shoes, which pinched my
feet—and took them, with a pair of clean socks, to the little fellow, and
started them on their way back to Fresno, walking of course. On parting, the
boy wearing my shoes, asked me why had I taken so much interest in them?
I told them that I might be tramping myself someday, maybe even get as far
away from home as Fresno, and in that event I hoped to meet them all
again. This is what I told the boys. For the correct answer—it is enough to
know that my people live in Fresno. One of the older boys said, “Never
doubt, we’ll be there—if we ever do get back home.” And though I have
been in Fresno a number of times since, I never had the pleasure of meeting
any of them. I lost their names.
Now—the $64 question!
A real honest-to-goodness professional tramp had hurriedly passed me by
before the boys had caught up with me. I had a couple pork sandwiches in
my pocket. My first thought was to offer them to this fellow—then thought
that maybe he was not a tramp. A tractor had been running on a farm east of
my place, and this fellow was just about smeary enough to have been the
driver. I let him pass—and later saw him go into the depot. The wife and I
were preparing to eat the sandwiches which were on the table still wrapped
in oil paper. Then, this professional tramp showed up at our kitchen door,
asking for a handout. Taking the two wrapped sandwiches off the table, I
said, “Here you are, my man—I’ve been saving them for you.” I told him
that had he not passed me by in such hurry on the railroad tracks, that I
would have offered them to him then. He said he had been sick, and was
hurrying to get in out of the weather. It had been “spitting” snow—which, I
imagine, had caused my dinner guests at the hotel to wonder why did they
leave their homes in sunny California. My home was two blocks away from
the depot—and this was the tramp’s first call. Now—had this fellow “read
my number” in passing on the railroad track? Or, did he read the sign at my
home? It was said in the old days that tramps had a way of marking the
favorable houses. My wife never let an applicant go away without
something, little or much, to allay his hunger.
I shall drop back a few years now and expand a bit on the trials and
tribulations of my wife’s family—before she was my wife, understand.
Married at the age of sixteen, and left a widow at the age of thirty-three,
with little more than the home and a houseful of kids—all girls, at that —
Kate Mercer found herself in a highly discouraging predicament. Deprived
of the bread-winner, the almost new five-room house on an acre of ground
down by the creek, on the “wrong side of the tracks,” could now hardly be
Welcome to Our Bookstore - The Ultimate Destination for Book Lovers
Are you passionate about books and eager to explore new worlds of
knowledge? At our website, we offer a vast collection of books that
cater to every interest and age group. From classic literature to
specialized publications, self-help books, and children’s stories, we
have it all! Each book is a gateway to new adventures, helping you
expand your knowledge and nourish your soul
Experience Convenient and Enjoyable Book Shopping Our website is more
than just an online bookstore—it’s a bridge connecting readers to the
timeless values of culture and wisdom. With a sleek and user-friendly
interface and a smart search system, you can find your favorite books
quickly and easily. Enjoy special promotions, fast home delivery, and
a seamless shopping experience that saves you time and enhances your
love for reading.
Let us accompany you on the journey of exploring knowledge and
personal growth!

ebookgate.com

You might also like