Thursday, August 5, 2010

The XML Schema Complete Reference













Copyright
Preface
The History
The Book
The Web Site
The Value

Acknowledgments
About the Authors
Part I: XML Schema Overview
Chapter 1. Introduction
Section 1.1. Why XML?
Section 1.2. Why XML Schemas?
Section 1.3. The World Wide Web Consortium (W3C) Recommendations
Section 1.4. Object-oriented Concepts
Section 1.5. Unifying Terminology
Section 1.6. Thematic Examples
Section 1.7. Creating an XML Schema Document
Section 1.8. Typesetting Conventions
Section 1.9. Online Resources

Chapter 2. XML Processing
Section 2.1. Basics
Section 2.2. XML Structure Before and After Parsing
Section 2.3. Schema Processing

Chapter 3. XML Namespaces
Section 3.1. Uniform Resource Names and Uniform Resource Locators
Section 3.2. Namespace Components
Section 3.3. Declaring Namespaces
Section 3.4. Qualified Names and QNames
Section 3.5. Namespace Scoping
Section 3.6. XML Schema and Namespaces

Chapter 4. XPath and XPointer
Section 4.1. XPath
Section 4.2. XPointer

Chapter 5. The Structure of Documents and Schemas
Section 5.1. XML Documents
Section 5.2. The XML Information Set
Section 5.3. Introduction to the PSVI
Section 5.4. Introduction to Schemas
Section 5.5. Schema Documents

Part II: Creating XML Schema Documents
Chapter 6. Overview of an XML Schema Document
Section 6.1. The Enclosing schema Element
Section 6.2. Namespaces
Section 6.3. Scope
Section 6.4. Annotating Elements
Section 6.5. Constraining Elements
Section 6.6. Constraining Attributes
Section 6.7. Simple Types
Section 6.8. Complex Types
Section 6.9. Model Groups
Section 6.10. Substitution Groups
Section 6.11. Instantiability
Section 6.12. Identity Constraint Definitions
Section 6.13. Notations
Section 6.14. Impor and Includes
Section 6.15. Locating XML Schemas and XML Schema Components
Section 6.16. Schema Element IDs

Chapter 7. Creating an XML Schema Document
Section 7.1. A Simple XML Schema Document Example
Section 7.2. A schema Element with Every Attribute
Section 7.3. Concepts and Observations
Section 7.4. The schema Element
Section 7.5. The annotation Element
Section 7.6. The appinfo Element
Section 7.7. The documentation Element
Section 7.8. The include Element
Section 7.9. The impor Element
Section 7.10. The notation Element
Section 7.11. The redefine Element

Chapter 8. Element Types
Section 8.1. An Example of a Trivial Element Type
Section 8.2. Concepts and Observations
Section 8.3. The element Element
Section 8.4. The any Element

Chapter 9. Attribute Types
Section 9.1. An Example of an Attribute Type
Section 9.2. An Example of a Named Attribute-use Group
Section 9.3. An Example of anyAttribute
Section 9.4. Concepts and Observations Regarding Attribute Types
Section 9.5. The attribute Element
Section 9.6. The attributeGroup Element
Section 9.7. The anyAttribute Element

Chapter 10. Simple Types
Section 10.1. An Example of a Simple Type Derived from the Built-in token Datatype
Section 10.2. An Example of a Pattern-constrained Simple Type
Section 10.3. An Example of a Simple Type Derived from a User-derived Simple Type
Section 10.4. Concepts and Observations
Section 10.5. The simpleType Element
Section 10.6. The restriction Element
Section 10.7. The list Element
Section 10.8. The union Element

Chapter 11. Complex Types
Section 11.1. An Example of a Complex Type Specifying Empty Content
Section 11.2. An Example of a Complex Type That Adds Attributes to a Simple Type
Section 11.3. An Example of a Complex Type Specifying Nested Element Types
Section 11.4. An Example of a Complex Type Specifying Mixed Content
Section 11.5. Concepts and Observations
Section 11.6. The complexType Element
Section 11.7. The simpleContent Element
Section 11.8. The complexContent Element
Section 11.9. The extension Element
Section 11.10. The restriction Element
Section 11.11. The all Element
Section 11.12. The choice Element
Section 11.13. The sequence Element
Section 11.14. The group Element

Chapter 12. Built-in Datatypes
Section 12.1. Numeric Datatypes
Section 12.2. Date, Time, and Duration Datatypes
Section 12.3. String Datatypes
Section 12.4. Oddball Datatypes

Chapter 13. Identity Constraints
Section 13.1. Identity Constraint Example
Section 13.2. Concepts and Observations
Section 13.3. The unique Element
Section 13.4. The key Element
Section 13.5. The keyref Element
Section 13.6. The selector Element
Section 13.7. The field Element

Chapter 14. Regular Expressions
Section 14.1. Concepts and Observations
Section 14.2. Regular Expression Syntax
Section 14.3. Constraining Simple Content


Part III: Validation
Chapter 15. XML Schema Component Detail
Section 15.1. Schemas: The Basic Idea
Section 15.2. Schema (Schema Schema Component)
Section 15.3. Attribute Types
Section 15.4. Element Types
Section 15.5. Annotation (Annotation Schema Component)
Section 15.6. Notation (Notation Declaration Schema Component)

Chapter 16. PSVI Detail
Section 16.1. Schema Validation and Schema Processing
Section 16.2. The PSVI

Chapter 17. Java and the Apache XML Project
Section 17.1. Apache Background
Section 17.2. Java Xerces on Your Computer
Section 17.3. "Hello Apache"
Section 17.4. Critical Xerces Packages
Section 17.5. Xerces Java DOM In-depth
Section 17.6. Java Xerces SAX In-depth

Chapter 18. MSXML and the Schema Object Model (SOM)
Section 18.1. Introducing MSXML
Section 18.2. Concepts and Observations
Section 18.3. XML Schema Examples
Section 18.4. MSXML Fundamentals
Section 18.5. Schema Object Model (SOM)
Section 18.6. Validation
Section 18.7. Example: XML Schema Tree


Part IV: Result-oriented Schemas
Chapter 19. Object-oriented Schemas
Section 19.1. Concepts and Observations
Section 19.2. Object-oriented Concepts
Section 19.3. XML Schemas and Objects
Section 19.4. Mapping XML Schemas to Object-oriented Languages
Section 19.5. Sample Schema: party.xsd
Section 19.6. Design Patterns
Section 19.7. Language Examples

Chapter 20. Document-oriented Schemas
Section 20.1. Why Use XML for Documents?
Section 20.2. Creating a Schema for a Set of Documents: Document Analysis
Section 20.3. Implementing Document Processing

Chapter 21. Application-oriented Schemas
Section 21.1. XML Applications
Section 21.2. Role of XML Schemas
Section 21.3. Describing Applications
Section 21.4. Application Structure
Section 21.5. Transporting XML
Section 21.6. Describing Applications
Section 21.7. Example Application


Part V: Data-oriented Schemas
Chapter 22. Data-oriented Schemas: Datatypes
Section 22.1. XML Schema Design Considerations
Section 22.2. General Discussion of Facet Restrictions
Section 22.3. Check Constraints versus Triggers
Section 22.4. Datatypes

Chapter 23. Data-oriented Schemas: Simple Types
Section 23.1. XML Schema Design Considerations
Section 23.2. An Example of a Simple Type Mapping to a Database Schema
Section 23.3. Concepts and Observations
Section 23.4. The list Element
Section 23.5. The union Element

Chapter 24. Data-oriented Schemas: Complex Types
Section 24.1. XML Schema Design Considerations
Section 24.2. An Example of a Complex Type Mapping to a Database Schema
Section 24.3. An Example of a Complex Type Mapping Supporting Mixed Content to a Database Schema
Section 24.4. Concepts and Observations
Section 24.5. complexType Element
Section 24.6. all Element
Section 24.7. annotation Element
Section 24.8. any Element
Section 24.9. anyAttribute Element
Section 24.10. attributeGroup Element
Section 24.11. choice Element
Section 24.12. complexContent Element
Section 24.13. group Element
Section 24.14. sequence Element
Section 24.15. simpleContent Element
Section 24.16. restriction Element
Section 24.17. extension Element


Part VI: A Case Study: The Campus Resource and Scheduling System (CRSS)
Chapter 25. The Business Case
Section 25.1. Basic CRSS Flow
Section 25.2. CRSS Requirements
Section 25.3. System Users
Section 25.4. Extensible Style Language Transform (XSLT)
Section 25.5. SQL 2000 XML Capabilities
Section 25.6. CRSS Technical Architecture
Section 25.7. Summary

Chapter 26. The Architecture
Section 26.1. System Architecture
Section 26.2. Creating HTML Pages by Using XSLT
Section 26.3. Sending Form Data
Section 26.4. Summary

Chapter 27. The Server Tier
Section 27.1. Database Design with XML Schemas
Section 27.2. SQL IIS Configuration
Section 27.3. CRSS Application Requirements
Section 27.4. Updategrams
Section 27.5. Summary

Chapter 28. The Integrated Solution
Section 28.1. CRSS Design Review
Section 28.2. Web Tier Construction
Section 28.3. UI Broker Component Construction
Section 28.4. Security Broker Component Construction
Section 28.5. CRSS Broker Component Construction
Section 28.6. Template Query
Section 28.7. CRSS Review


Part VII: Appendixes
Appendix A. XML Schema Quick Reference
Appendix B. XML Schema RegularExpression Grammar
Appendix C. The Thematic Catalog XML Schema
Appendix D. Data-oriented Schemas: Oracle8i Datatypes
Section D.1. General Overview
Section D.2. Discussion of the Consequences

Appendix E. Glossary
Section E.1. Objects, Classes, and Instances
Section E.2. Markup
Section E.3. XML Documents
Section E.4. XML DTDs and Schemas
Section E.5. Selected Datatypes Used in Schema Documents
Section E.6. Miscellaneous


Download
Another XML books
Continue Reading ...

The TINI™ Specification and Developer’s Guide















Contents
Foreword xi
Preface xiii
CHAPTER 1 The TINI Platform. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Applications. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 TINI Hardware . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.3.1 The Memory Map . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
1.3.2 Integrated I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
1.3.3 A Hardware Reference Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
1.4 TINI Runtime Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.1 API Overview. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
1.4.2 The Java Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
1.4.3 Native Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
1.4.4 TINI OS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1.4.5 Bootstrapping the System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
1.4.6 Step 1: Execute the Bootstrap Loader . . . . . . . . . . . . . . . . . . . . . . 19
1.4.7 Step 2: Initialize the Runtime Environment. . . . . . . . . . . . . . . . . . 20
1.4.8 Step 3: Start the Primary Java Application . . . . . . . . . . . . . . . . . . 21
1.5 The Future . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
CHAPTER 2 Getting Started . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1 Hardware Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
2.1.1 The TINI Board Model 390 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
2.1.2 The E10 Socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
2.2 Development Platform Requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
2.2.1 A Java Development Environment. . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2.2 The Java Communications API . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.2.3 The TINI SDK . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
2.3 Loading the TINI Runtime Environment . . . . . . . . . . . . . . . . . . . . . . . . 29
2.4 Slush: A Quick Primer. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.4.1 Slush Defined. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
2.4.2 Starting a New Session . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
2.4.3 Exploring the File System . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
2.4.4 Getting Help. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35
2.5 Configuring the Network. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
2.6 Some Simple Examples. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.6.1 HelloWorld. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
2.6.2 Blinky, Your First TINI I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
2.6.3 HelloWeb, a Trivial Web Server . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2.7 Debugging Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
CHAPTER 3 Serial Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.1 Introduction and Terminology. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
3.2 The Java Communications API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
3.2.1 Acquiring and Configuring Serial Ports. . . . . . . . . . . . . . . . . . . . . 56
3.2.2 Flow Control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
3.2.3 Sending and Receiving Serial Data . . . . . . . . . . . . . . . . . . . . . . . . 61
3.2.4 Serial Port Events. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
3.3 TINI’s Serial Ports. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
3.4 A Small Terminal Example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.5 A Serial ⇔ Ethernet Converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
CHAPTER 4 The 1-Wire Net . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
4.1 1-Wire Networking Fundamentals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.1.1 1-Wire Signalling. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
4.1.2 1-Wire Transactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 84
4.1.3 Addressing 1-Wire Chips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
4.1.4 1-Wire Chips and iButtons. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.2 Adapters. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
4.2.1 Finding and Creating Adapters . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4.2.2 The Internal Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.2.3 The External Adapter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.2.4 Determining an Adapter’s Capabilities . . . . . . . . . . . . . . . . . . . . . 91
4.2.5 Searching for 1-Wire Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92
4.2.6 Adapter Ownership . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.3 Direct 1-Wire Communication . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.4 Containers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.4.1 The Class OneWireContainer . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.4.2 Creating Container Instances . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.4.3 Example: 1-Wire Humidity Sensor. . . . . . . . . . . . . . . . . . . . . . . 104
4.5 Ensuring Data Integrity Using CRCs . . . . . . . . . . . . . . . . . . . . . . . . . . 108
CHAPTER 5 TCP/IP Networking. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
5.1 TINI Networking Environment and API Overview. . . . . . . . . . . . . . . . 112
5.1.1 The Network Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113
5.1.2 Ethernet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
5.1.3 PPP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115
5.1.4 Loopback . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116
5.2 Setting Network Parameters . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117
5.2.1 Committing Static Network Parameters . . . . . . . . . . . . . . . . . . . 119
5.2.2 Dynamic IP Configuration Using DHCP. . . . . . . . . . . . . . . . . . . 121
5.3 DNS. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124
5.4 HTTP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 127
5.5 ICMP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
CHAPTER 6 Dial-Up Networking Using PPP . . . . . . . . . . . . . . . . . . . . . 139
6.1 The PPP API Classes. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
6.2 PPP Events . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 142
6.2.1 STARTING Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
6.2.2 AUTHENTICATION_REQUESTED Event . . . . . . . . . . . . . . . . 143
6.2.3 UP Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.2.4 STOPPED Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
6.2.5 CLOSED Event . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
CHAPTER 7 Building a Remote Data Logger . . . . . . . . . . . . . . . . . . . . 147
7.1 Description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147
7.2 The DataLogger Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149
7.3 Collecting the Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 152
7.4 A Sample Client . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
7.5 Implementing the PPP Daemon . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160
7.6 Managing the PPP Data Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
7.6.1 The Serial Link . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 167
7.6.2 Controlling the Modem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169
7.7 Adding the PPP Daemon to DataLogger. . . . . . . . . . . . . . . . . . . . . . . . 175
7.8 Testing the Entire Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176
CHAPTER 8 Parallel I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181
8.1 TINI’s Parallel Bus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
8.2 The DataPort Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185
8.2.1 Data Transfer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186
8.2.2 Memory Access Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187
8.2.3 Controlling Bus Timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 188
8.3 Parallel I/O Examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
8.3.1 Additional TTL I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
8.3.2 Reading and Writing External Memory. . . . . . . . . . . . . . . . . . . . 196
CHAPTER 9 Just the Bits. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
9.1 TINI’s Ports and Port Pins. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
9.2 The BitPort Class. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 201
9.3 Synthetic Port Pins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 202
9.3.1 Example: Creating Additional Outputs . . . . . . . . . . . . . . . . . . . . 204
9.4 The BytePort Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 206
9.5 Performance of BitPort and BytePort . . . . . . . . . . . . . . . . . . . . . . . . . . 207
CHAPTER 10 Accessing System Resources . . . . . . . . . . . . . . . . . . . . . . 209
10.1 The Real-Time Clock . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 209
10.1.1 Setting the Current Date and Time . . . . . . . . . . . . . . . . . . . . . . 212
10.1.2 Using a Network Time Server . . . . . . . . . . . . . . . . . . . . . . . . . . 212
10.2 The Watchdog . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
10.2.1 Motivation for Using the Watchdog. . . . . . . . . . . . . . . . . . . . . . 215
10.2.2 A Tail of Two Dogs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
10.2.3 Using the Watchdog Timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
10.2.4 Example Use of the Watchdog Timer . . . . . . . . . . . . . . . . . . . . 217
10.2.5 Beware of Dog! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
10.3 The External Interrupt . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
10.3.1 Polling versus Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
10.3.2 Properties of the External Interrupt . . . . . . . . . . . . . . . . . . . . . . 220
10.3.3 Triggering the External Interrupt . . . . . . . . . . . . . . . . . . . . . . . . 220
10.3.4 Receiving Notification of Interrupts . . . . . . . . . . . . . . . . . . . . . 221
10.3.5 Sharing a Common Interrupt Source . . . . . . . . . . . . . . . . . . . . . 224
CHAPTER 11 Application Programming Tips . . . . . . . . . . . . . . . . . . . . 225
11.1 Performance Profiling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225
11.2 Efficient I/O . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227
11.2.1 Block Data Transfer versus Byte-Banging . . . . . . . . . . . . . . . . 227
11.2.2 Buffered Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232
11.3 Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11.3.1 Object Creation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11.3.2 Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233
11.3.3 Profiling Memory Usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234
11.3.4 Garbage Collection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
11.4 Other Optimization Tips . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
11.4.1 Relative Cost of Common Operations . . . . . . . . . . . . . . . . . . . . 238
11.4.2 Loop Optimizations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
11.4.3 Arithmetic Operations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244
11.4.4 The ArrayUtils Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246
11.5 An Optimization Strategy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
11.6 Application Hardening . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
11.6.1 TINI’s Memory Technology and Data Persistence . . . . . . . . . . 249
11.6.2 Application Startup . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251
11.6.3 Hardening Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253
APPENDIX Almanac . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255
Index. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 341

Download
Another Software Engineering books
Continue Reading ...

Related Posts with Thumbnails

Put Your Ads Here!

Recent Posts