The best books of PIC Microcontrollers Programming in C

The best books of PIC Microcontrollers Programming in C
in usa today



    C Programming for Microcontrollers Featuring 

ATMEL’s AVR Butterfly and the free WinAVR Compile


C Programming for Microcontrollers Featuring ATMEL’s AVR Butterfly and the free WinAVR Compiler

List Price: $49.95
Price: $32.97 & this item ships for FREE with Super Saver Shipping.
You Save: $16.98 (34%)
This a fun book that is great for people that want to get started in embedded programming and design. And at a low introductory affordable price.
This book, and the AVR Butterfly (~$20 at Digikey) are the best bargain you can get for getting started in Embedded programming and development. Together (the book, the AVR Butterfly and miscellaneous parts) form a complete development kit. AVR must be selling the kit for a loss to introduce their products. Buy it before they change their minds.
Although this is not a professional development kit, you will be able to do a lot. This is more like a cookbook to introduce you to the concepts and to enable to easily put a project together.
After reading through this and putting together the projects you will have the basics to understand more advanced books and enable you to design more advanced projects.
The one basic I thought the author left out that was important to include, was the C programming type qualifier “volatile”. Volatile before a variable tells the compiler that a variable can have its value altered by agencies other than the program. For example you would use this when you are reading from a hardware address that is set by an interface. Otherwise the compiler may optimize the variable as a constant and not actually read the value from the hardware address on repeat iterations.
Code example: volatile int temp; Reads an 8 bit temperature code from a hadware address interfaced to a thermocouple.
So now you have it.
I found the book to be very readable, easy to understand and fun to read through.
As prerequisites for this I would recommend:
* Familiarity with the C programming language. For beginners:
I recommend the book “Practical C Programming”. There are
many fine books to choose from.
* Knowledge of very basic circuits, and how to solder
wires.
* A very light knowledge of microprocessors. For
beginners: I recommend the book “Programming Embedded
Systems in C and C++”, by Michael Barr. There are a few
other good beginner books to choose from.
For the beginner, this is a must have that will enable you to quickly get started and build introductory projects. If you are new to embedded programming and design I would highly recommend getting this book and the AVR butterfly.
 Programming 16-Bit PIC Microcontrollers in C, Second Edition: Learning to Fly the PIC 24

Programming 16-Bit PIC Microcontrollers in C, Second Edition: Learning to Fly the PIC 24

List Price: $59.95
Price: $48.03 & this item ships for FREE with Super Saver Shipping.
You Save: $11.92 (20%)
Special Offers Available



I just bought this book and managed to read through it over a few days. I must say that I’m very impressed by it! The book covers programming the PIC24 in C using MPLAB’s C30 C compiler. It covers the PIC24 architecture and peripherals in as much detail as required by a C programmer as well as various non-ANSI C PIC24 specific addons available in the C30 compiler. It also includes a myriad of cool interfacing projects with minimal additional hardware (SPI EEPROM , 3 resistors for the video example flash card, PS2 interfacing e.t.c.) Finally it also introduces all the debugging tools available in MPLAB such as the simulator/logic analyzer and stimulus generator. This book is not for the absolute microcontroller / programming in C beginner however. Its target audience is embedded systems programmers considering to switch to Microchip’s PIC24 family and EE students/hobbyists with some background in embedded systems/ microcontrollers / C programming.

Microcontrollers: From Assembly Language to C Using the PIC24 Family




Microcontrollers: From Assembly Language to C Using the PIC24 Family

List Price: $69.99
Price: $42.34 & this item ships for FREE with Super Saver Shipping.
You Save: $27.65 (40%)
Special Offers Available

As a student of computer and control systems engineering, I am constantly looking for good books based on microcontrollers and electronics. Most of the books that I have seen, up to this point, have neglected to mention several important components regarding either the software or hardware portions of microcontrollers causing me to find another book to supplement the previous book. In all, I wind up having to use 5 or 6 different books to get a full understanding of the microcontroller theory and operation.
However, I recently came across the “Microcontrollers From Assembly to C Using the PIC24 Family” by Professors Robert Reece, J.W. Bruce, and Bryan Jones. This book encompasses all of what 6 books did for me. I certainly wished that I had came across this book first!
The one thing that really struck the home run for me on this book was that it has/uses excellent examples. It details what each instruction does and literally points out what its function is — and it does this in both C and assembly! And if that is not enough, it compares the C code to the assembly instruction. VERY IMPRESSIVE.
The explanations of how microcontrollers work, specifically the PIC24 family, is such that a person with little to no experience can easily grasp the concepts. This book is also a fantastic reference for the more experienced microcontroller users. I personally have worked with the Atmel 8051 and Cypress’ PSoC. I got this book because I wanted to expand my knowledge of embedded systems.
Whether you are a hobbyist, or a student dealing with microcontrollers, or an expert in the field, this book is a great tool to have regarding the understanding of the PIC24 microcontroller. I am very pleased. Thank you professors Reese, Bruce, and Jones for doing such a great job!

 creflo dollar ,auburn university,  auburn, stony brook universityauburn football , the book of eli , pacquiao,father day
Advertisements
بواسطة djamel نشرت في Book

Computer Graphics, C Version (2nd Edition)

Computer Graphics, C Version (2nd Edition)

Description

For junior- to graduate-level courses in computer graphics. Also, widely used for professional self-study. Reflecting the rapid expansion of the use of computer graphics and of C as a programming language of choice for implementation, this new version of the best-selling Hearn and Baker text converts all programming code into the C language. Assuming the reader has no prior familiarity with computer graphics, the authors present basic principles for design, use, and understanding of computer graphics systems. The authors are widely considered authorities in computer graphics, and are known for their accessible writing style. A free Open GL supplement is available via the texts Prentice Hall Catalog page.

Details

  • Hardcover: 652 pages
  • Publisher: Prentice Hall; 2 Sub edition (May 24, 1996)
  • Language: English
  • ISBN-10: 0135309247
  • ISBN-13: 978-0135309247
  • Product Dimensions: 10.1 x 8.1 x 0.8 inches
  • Shipping Weight: 3.2 pounds

See More About: Computer Graphics, C Version (2nd Edition)


Contents:
PREFACE xvii
1 A Survey of Computer 2-2
Graphics 2
Computer-Aided Design 2-3
Presentation Graphics ‘I 2-4
Computer Art l 3 2-5
Entertainment 18
Education and Training 2 1
Visualization 25
Image Processing 3 2
Graphical User Interfaces 3 4
Overview of Graphics 2 systems 35 2-6
2-1 VideoDisplayDevices 36 2-7
Refresh Cathode-Ray Tubes 37
Raster-Scan Displays 40
Random-Scan Displays 41
Color CRT Monitors 42
Direct-View Storage Tubes 4.5
Flat-Panel Displays 45
Three-Dimensional Viewing Devices 49
Stereoscopic and Virtual-Reality
Systems
Raster-Scan System!;
Video Controller
Raster-Scan Display Processor
Random-Scan Systems
Graphics Monitors and Workstations
Input Devices
Keyboards
Mouse
Trackball and Spaceball
Joysticks
Data Glove
Digitizers
Image Scanners
Touch Panels
Light Pens
Voice Systems
Hard-Copy Devices
Graphics Software
Coordinate Representations
Graphics Functions
Software Standards
PHIGS Workstations
Summary
References
Exercises
3 Outout Primitives 83
Points and Lines
Line-Drawing Algorithms
DDA Algorithm
Bresenham’s Line Algorithm
Parallel Line Algorithms
Loading the Frame Buffer
Line Function
Circle-Generating Algorithms
Properties of Circles
Midpoint Circle Algorithm
Ellipse-Generating Algorithms
Properties of Ellipses
Midpoint Ellipse Algorithm
Other Curves
Conic Sections
Polynomials and Spline Curves
Parallel Curve Algorithms
Curve Functions
Pixel Addressing
and Object Geometry
Screen Grid Coordinates
Maintaining Geometric Properties
of Displayed Objects
Filled-Area Primitives
Scan-Line Polygon Fill Algorithm
Inside-Outside Tests
Scan-Line Fill of Curved Boundary
Areas
Boundary-Fill Algorithm
Flood-Fill Algorithm
Fill-Area Functions
Cell Array
Character Generation
Summary
Applications
References
Exercises
Attributes of Output
Primitives 143
Line Attributes
Line Type
Line Width
Pen and Brush Options
Line Color
Curve Attributes
Color and Grayscale Levels
Color Tables
Grayscale
Area-Fill Attributes
Fill Styles
Pattern Fill
Soft Fill
Character Attributes
Text Attributes
Marker Attributes
Bundled Attributes
Bundled Line Attributes
Bundled Area-Fi Attributes
Bundled Text Attributes
Bundled Marker Attributes
Inquiry Functions
Antialiasing
Supersampling Straight Line
Segments
Pixel-Weighting Masks
Area Sampling Straight Line 5-6 Aff ine Transformations 208
Segments 174 5-7 Transformation Functions 208
Filtering Techniques 174 5-8 Raster Methods for Transformations 210
Pixel Phasing 1 75 Summary 212
Compensating for Line lntensity
Differences 1 75 References 21 3
Antialiasing Area Boundaries 1 76 Exercises 213
Summary
References
Exercises
Two-Dimensional
180 6 Viewing 21 6
6-1 The Viewing Pipeline
5 Two-Dimensional Geometric 6-2 Viewing Coordinate Reference Frame
183 6-3 Window-teviewport Coordinate Transformations Transformation
5-1 Basic Transformations
Translation
Rotation
Scaling
5-2 Matrix Representations
and Homogeneous Coordinates
5-3 Composite Transformations
Translations
Rotations
Scalings
General Pivot-Point Rotation
General Fixed-Point Scaling
General Scaling Directions
Concatenation Properties
General Composite Transformations
and Computational Efficiency
5-4 Other Transformations
Reflection
Shear
Two-Dimensional Wewing Functions
Clipping Operations
Point Clipping
Line Clipping
Cohen-Sutherland Line Clipping
Liang-Barsky Line Clipping
Nicholl-Lee-Nicholl Line Clipping
Line Clipping Using Nonrectangular
Clip Windows
Splitting Concave Polygons
Polygon Clipping
Sutherland-Hodgernan Polygon
Clipping
Weiler-Atherton Polygon Clipping
Other Polygon-Clipping Algorithms
Curve Clipping
Text Clipping
Exterior Clipping
Summary
5-5 Transformations Between Coordinate References
Systems 205 Exercises
7 Structures and Hierarchical
Modeling 250
7-1 Structure Concepts 250
Basic Structure Functions 250
Setting Structure Attributes 253
7-2 Editing Structures 254
Structure Lists and the Element
Pointer 255
Setting the Edit Mode 250
Inserting Structure Elements 256
Replacing Structure Elements 257
Deleting Structure Elements 257
Labeling Structure Elements 258
Copying Elements from One Structure
to Another 260
7-3 Basic Modeling Concepts 2 60
Mode1 Representations 261
Symbol Hierarchies 262
Modeling Packages. 263
7-4 Hierarchical Modeling
with Structures 265
Local Coordinates and Modeling
Transformations 265
Modeling Transformations 266
Structure Hierarchies 266
Summary 268
References 269
Exercises 2 69
Graphical User Interfaces
8 and Interactive lnput
Methods 271
8-1 The User Dialogue
Windows and Icons
Accommodating Multiple
Skill Levels
Consistency
Minimizing Memorization
Backup and Error Handling
Feed back
8-2 lnput of Graphical Data
Logical Classification of Input
Devices
Locator Devices
Stroke Devices
String Devices
Valuator Devices
Choice Devices
Pick Devices
8-3 lnput Functions
Input Modes
Request Mode
Locator and Stroke Input
in Request Mode
String Input in Request Mode
Valuator Input in Request Mode
Choice lnput in Request Mode
Pick Input in Request Mode
Sample Mode
Event Mode
Concurrent Use of Input Modes
8-4 Initial Values for Input-Device
Parameters
8-5 lnteractive Picture-Construction
Techniques
Basic Positioning Methods
Constraints
Grids
Gravity Field
Rubber-Band Methods
Dragging
Painting and Drawing
Virtual-Reality Environments 292 10-4
Summary 233
References 294
Exercises 294 10-5
10-6
9 Three-Dimensional
Concepts 296
9-1 Three-Dimensional Display Methods
Parallel Projection
Perspective Projection
Depth Cueing
Visible Line and Surface
Identification
Surface Rendering
Exploded and Cutaway Views
Three-Dimensional and Stereoscopic
Views
9-2 Three-Dimensional Graphics
Packages 302
Three-Dimensional
10-1 Polygon Surfaces
Polygon Tables
Plane Equations
Polygon Meshes
10-2 Curved Lines and Surfaces
10-3 Quadric Sutiaces
Sphere
Ellipsoid
Torus
Superquadrics
Superellipse
Superellipsoid
Blobby Objects
Spline Representations
Interpolation and Approximation
Splines
Parametric Continuity
Conditions
Geometric Continuity
Conditions
Spline Specifications
Cubic Spline Interpolation
Methods
Natural Cubic Splines
Hermite Interpolation
Cardinal Splines
Kochanek-Bartels Splines
Bezier Curves and Surfaces
Bezier Curves
Properties of Bezier Curves
Design Techniques Using Bezier
Curves
Cubic Ezier Curves
Bezier Surfaces
B-Spline Curves and Surfaces
B-Spline Curves
Uniform, Periodic B-Splines
Cubic, Periodic €3-Splines
Open, Uniform B-Splines
Nonuniform 13-Splines
B-Spline Surfaces
Beta-Splines
Beta-Spline Continuity
Conditions
Cubic, Periodic Beta-Spline
Matrix Representation
Rational Splines
Conversion Between Spline
Representations
Displaying Spline Curves
and Surfaces
Homer’s Rule
Forward-Difference Calculations
Subdivision Methods
Sweep Representations
Constructive Solid-Geometry
Methods
Octrees
BSP Trees
Fractal-Geometry Methods
Fractal-Generation Procedures
Classification of Fractals
Fractal Dimension
Geometric Construction
of Deterministic Self-Similar
Fractals
Geometric Construction
of Statistically Self-Similar
Fractals
Affine Fractal-Construction
Methods
Random Midpoint-Displacement
Methods
Controlling Terrain Topography
Self-squaring Fractals
Self-inverse Fractals
Shape Grammars and Other
Procedural Methods
Particle Systems
Physically Based Modeling
Visualization of Data Sets
Visual Representations
for Scalar Fields
VisuaI Representations
for Vector Fields
Visual Representations
for Tensor Field
Visual Representations
for Multivariate Data Fields 402
Summary 404
References 404
Exercises 404
Three-Dimensional
11 Geometric and Modeling
Transformations 407
Translation 408
Rotation 409
Coordinate-Axes Rotations 409
General Three-Dimensional
Rotations 41 3
Rotations with Quaternions 419
Scaling 420
Other Transformat~ons 422
Reflections 422
Shears 423
Conlposite Transformations 423
Three-Dimens~onal Transformation
Functions 425
Modeling and Coordinate
Transformations 426
Summary 429
References 429
Exercises 430
Three-Dimensional 12 Viewing 43 1
12-1 Viewing Pipeline 432
12-2 Viewing Coordinates 433
Specifying the Virbw Plane 433
Transformation from World
– 40 1 to Viewing Coordinates
Projections
Parallel Projections
Perspective IJrojections
View Volumes and General
Projection Transformations
General Parallel-Projection
Transformations
General Perspective-Projection
Transformations
Clipping
Normalized View Volumes
Viewport Clipping
Clipping in Homogeneous
Coordinates
Hardware Implementations
Three-Dimensional Viewing
Functions
Summary
References
Exercises
1 3-1 2 Wireframe Methods 490
13-1 3 Visibility-Detection Functions 490
Summary 49 1
Keferences 492
Exercises 49 2
lllumination Models
14 and Surface-Rendering
Methods 494
Visi ble-Su dace Detection
Met hods 469
Classification of Visible-Surface
D~tectionA lgorithms
Back-Face Detection
Depth-Buffer Method
A-Buffer Method
Scan-Line Method
Depth-Sorting Method
BSP-Tree Method
Area-Subdivision Method
Octree Methods
Ray-Casting Met hod
Curved Surfaces
Curved-Surface Representations
Surface Contour Plots
Light Sources
Basic lllumination Models
Ambient Light
Diffuse Reflection
Specular Reflection
and the Phong Model
Combined Diffuse and Specular
Reflections with Multiple Light
Sources
Warn Model
Intensity Attenuation
Color Considerations
Transparency
Shadows
Displaying Light Intensities
Assigning Intensity Levels
Gamma Correction and Video
Lookup Tables
Displaying Continuous-Tone
Images
Halftone Patterns and Dithering
Techniques
Halftone Approximations
Dithering Techniques
Polygon-Rendering Methods
Constant-Intensity Shading
Gouraud Shading
Phong Shading
Fast Phong Shading
Ray-Tracing Methods
Basic Ray-Tracing Algorithm
Ray-Surface Intersection
CaIculations
Reducing Object-Intersection
Calculations
Space-Subdivision Methods
AntiaIiased Ray Tracing
Distributed Ray Tracing
Radiosity Lighting Model
Basic Radiosity Model
Progressive Refinement
Radiosity Method
Environment Mapping
Adding Surface Detail
Modeling Surface Detail
with Polygons
Texture Mapping
Procedural Texturing
Methods
Bump Mapping
Frame Mapping
Summary
References
Exercises
15-6 CMY Color Model
15-7 HSV Color Model
15-8 Conversion Between HSV
and RGB Models
15-9 HLS Color Model
1 5-1 0 Color Selection
and Applications
Summary
Reierences
Exercises
16 Computer
Animation 583
14-1 Design of Animation Sequences
16-2 General Computer-Animation
Functions
16-3 Raster Animations
16-4 Computer-Animation Languages
16-5 Key-Frame Systems
Morphing
Simulating Accelerations
16-6 Motion Specifications
Direct Motion Specification
Goal-Directed Systems
Kinematics and Dynamics
Color Models and Color Summary
A.p ,d i cations 564 References Exercises 597
15-1 Properties of Light 565
15-2 Standard Primaries and the
Chromaticity Diagram 568 A Mathematics for Computer
XYZ Color Model 569 Graphics 599
CIE Chromaticity Diagram
569 A-1 Coordinate-Reference Frames 600
1 5-3 Intuitive Color Concepts 571 Two-Dimensional Cartesian
15-4 RGB Color Model
15-5 YIQ Color Model
572 Reference Frames 600
5 74 Polar Coordinates in the xy Plane
Three-Dimensional Cartesian
Reference Frames
Three-Dimensional Curvilinear
Coordinate Systems
Solid Angle
A-2 Points and Vectors
Vector Addition and Scalar
Multiplication
Scalar Product of Two Vectors
Vector Product of Two Vectors
A-3 Basis Vectors and the Metric Tensor
Orthonormal Basis
Metric Tensor
A-4 Matrices
Matrix Transpose
Determinant of a Matrix
Matrix Inverse
Complex Numbers
Quaternions
Nonparametric Representations
Parametric Representations
Numerical Methods
Solving Sets of Linear Equations
Finding Roots of Nonlinear
Equations
Evaluating Integrals
Fitting CUN~Sto Data Sets
Scalar Multiplication and Matrix
BIBLIOGRAPHY
Addition 612
Matrix Multiplication 612
INDEX

بواسطة djamel نشرت في Book

J2ME: The Complete Reference

J2ME: The Complete Reference

Description

J2ME allows developers to use Java and the J2ME wireless toolkit to create applications and programs for wireless and mobile devices. This is the most comprehensive resource for Java developers seeking to understand and utilise J2ME when building mobile applications and services. – Understand the core fundamentals of J2ME – Discover what makes J2ME unique with coverage on advanced topics like Mobile Information Device Profile (MIDP) and Connected Limited Device Configuration (CLDC) – Comprehend how to build robust mobile applications with examples on J2ME supported software development kits, databases, web services, and more – Learn from other people’s mistakes with coverage on J2ME Best Practices and security

About the Author

James Keogh (New York, NY) is a faculty member of Columbia University where teaches a breadth of computer science courses in their CTA program. Keogh developed the Electronic Commerce track for Columbia University and was the first person to chair the track.


Product Details

  • James Keogh (New York, NY)
  • Paperback: 768 pages
  • Publisher: McGraw-Hill (February 27, 2003)
  • Language: English
  • ISBN-10: 0072227109
  • ISBN-13: 978-0072227109
  • Product Dimensions: 9.3 x 7.4 x 1.8 inches



Contents
Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xv
Part I
J2ME Basics
1 J2ME Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
Java 2 Micro Edition and the World of Java . . . . . . . . . . . . . . . . . . . . 4
Enter Java . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Java Virtual Machine . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
J2EE and J2SE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
The Birth of J2EE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Back to the Future: J2ME . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
Inside J2ME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
How J2ME Is Organized . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
J2ME and Wireless Devices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
What J2ME Isn’t . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Other Java Platforms for Small Computing Devices . . . . . . . . . . . . 16
2 Small Computing Technology . . . . . . . . . . . . . . . . . . . . . 17
Wireless Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
Radio Transmission . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
Limitations of Radio Transmissions . . . . . . . . . . . . . . . . . . . 20
Radio Data Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
Data Packets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
Microwave Technology . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Satellite Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
Mobile Radio Networks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
Cellular Telephone Networks . . . . . . . . . . . . . . . . . . . . . . . . 26
Digital Wireless Transmissions . . . . . . . . . . . . . . . . . . . . . . . 28
Cell Phones and Text Input . . . . . . . . . . . . . . . . . . . . . . . . . . 28
Messaging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
Personal Digital Assistants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
Mobile Power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
Set-Top Boxes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
Inside Look at a Set-Top Box . . . . . . . . . . . . . . . . . . . . . . . . . 33
Smart Cards . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
3 J2ME Architecture and Development Environment . . . 35
J2ME Architecture . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
Small Computing Device Requirements . . . . . . . . . . . . . . . . . . . . . . 37
Run-Time Environment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
Inside the Java Archive File . . . . . . . . . . . . . . . . . . . . . . . . . . 38
Inside the Java Application Descriptor File . . . . . . . . . . . . . 40
MIDlet Programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
Event Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43
User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Device Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
Java Language for J2ME . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
J2ME Software Development Kits . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
Hello World J2ME Style . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
Compiling Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
Running Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
Deploying Hello World . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 54
What to Do When Your MIDlet Doesn’t
Work Properly . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
Multiple MIDlets in a MIDlet Suite . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
J2ME Wireless Toolkit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
Building and Running a Project . . . . . . . . . . . . . . . . . . . . . . 61
Hello World Project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64
MIDlets on the Internet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
J2ME Best Practices and Patterns . . . . . . . . . . . . . . . . . . . 71
The Reality of Working in a J2ME World . . . . . . . . . . . . . . . . . . . . . . 72
Best Practices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Keep Applications Simple . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
Keep Applications Small . . . . . . . . . . . . . . . . . . . . . . . . . . . . 74
Limit the Use of Memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75
Off-Load Computations to the Server . . . . . . . . . . . . . . . . . 76
Manage Your Application’s Use of a
Network Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Simplify the User Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
Use Local Variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Don’t Concatenate Strings . . . . . . . . . . . . . . . . . . . . . . . . . . . 81
Avoid Synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
Thread Group Class Workaround . . . . . . . . . . . . . . . . . . . . . 83
Upload Code from the Web Server . . . . . . . . . . . . . . . . . . . . 83
Reading Settings from JAD Files . . . . . . . . . . . . . . . . . . . . . . 84
Populating Drop-down Boxes . . . . . . . . . . . . . . . . . . . . . . . . 85
Minimize Network Traffic . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Dealing with Time . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
Automatic Data Synchronization . . . . . . . . . . . . . . . . . . . . . 88
Updating Data that Has Changed . . . . . . . . . . . . . . . . . . . . . 89
Be Careful of the Content of the startApp() Method . . . . . 90
Part II
J2ME User Interface
5 Commands, Items, and Event Processing . . . . . . . . . . . . 95
J2ME User Interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
Display Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
The Palm OS Emulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
Command Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
CommandListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 105
Item Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111
Item Listener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114
Exception Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
Throwing a MIDletStateChangeException . . . . . . . . . . . . . 120
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125
6 High-Level Display: Screens . . . . . . . . . . . . . . . . . . . . . . . 129
Screen Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130
Alert Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Alert Sound . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 138
Form Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
Item Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143
ChoiceGroup Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144
DateField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154
Gauge Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 158
StringItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166
TextField Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 170
ImageItem Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178
List Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182
Creating an Instance of a List Class . . . . . . . . . . . . . . . . . . . 184
TextBox Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Creating an Instance of a TextBox Class . . . . . . . . . . . . . . . . 195
Ticker Class . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 203
7 Low-Level Display: Canvas . . . . . . . . . . . . . . . . . . . . . . . 213
The Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 214
The Layout of a Canvas . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Proportional Coordinates . . . . . . . . . . . . . . . . . . . . . . . . . . . . 216
The Pen . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
Painting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217
showNotify() and hideNotify() . . . . . . . . . . . . . . . . . . . . . . . 219
User Interactions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219
Working with Key Codes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Working with Game Actions . . . . . . . . . . . . . . . . . . . . . . . . . 227
Working with Pointer Devices . . . . . . . . . . . . . . . . . . . . . . . . 233
Graphics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239
Stroke Style and Color . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240
Lines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Rectangles . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243
Arcs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250
Text . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257
Images . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266
Repositioning Text and Images . . . . . . . . . . . . . . . . . . . . . . . 274
Clipping Regions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 279
Creating a Clipping Region . . . . . . . . . . . . . . . . . . . . . . . . . . 280
Animation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 284
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 286
Part III
J2ME Data Management
8 Record Management System . . . . . . . . . . . . . . . . . . . . . . 295
Record Storage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
The Record Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 296
Record Store Scope . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 297
Setting Up a Record Store . . . . . . . . . . . . . . . . . . . . . . . . . . . . 298
Writing and Reading Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 302
Creating a New Record and Reading an
Existing Record . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 303
Writing and Reading Mixed Data Types . . . . . . . . . . . . . . . 309
Record Enumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 316
Reading a Record of a Simple Data Type
into a RecordEnumeration . . . . . . . . . . . . . . . . . . . . . . . . . 319
Reading a Mixed Data Type Record into a
RecordEnumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 324
Sorting Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 330
Sorting Single Data Type Records in a
RecordEnumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 332
Sorting Mixed Data Type Records in a
RecordEnumeration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 337
Searching Records . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 345
Searching Single Data Type Records . . . . . . . . . . . . . . . . . . 345
Searching Mixed Data Type Records . . . . . . . . . . . . . . . . . . 352
RecordListener . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 360
9 J2ME Database Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . 365
Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 366
Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 367
Database Schema . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 368
Identifying Information . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 369
Decomposing Attributes to Data . . . . . . . . . . . . . . . . . . . . . . 372
Defining Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 375
Normalizing Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 377
Grouping Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 378
Creating Primary Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 380
Functional Dependency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Transitive Dependencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . 382
Foreign Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383
Referential Integrity . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 384
The Art of Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 385
An Index in Motion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 386
Drawbacks of Using an Index . . . . . . . . . . . . . . . . . . . . . . . . 386
Clustered Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 387
Derived Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Selective Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 388
Exact Matches and Partial Matches . . . . . . . . . . . . . . . . . . . . 389
Searching for Phonetic Matches . . . . . . . . . . . . . . . . . . . . . . 389
10 JDBC Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391
The Concept of JDBC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 392
JDBC Driver Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 393
Type 1 JDBC to ODBC Driver . . . . . . . . . . . . . . . . . . . . . . . . 393
Type 2 Java/Native Code Driver . . . . . . . . . . . . . . . . . . . . . 394
Type 3 JDBC Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Type 4 JDBC Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
JDBC Packages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Overview of the JDBC Process . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 394
Load the JDBC Driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Connect to the DBMS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 395
Create and Execute an SQL Statement . . . . . . . . . . . . . . . . . 395
Process Data Returned by the DBMS . . . . . . . . . . . . . . . . . . 396
Terminate the Connection to the DBMS . . . . . . . . . . . . . . . . 397
Database Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
The Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 398
Timeout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 401
Connection Pool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 402
Statement Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
The Statement Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 403
PreparedStatement Object . . . . . . . . . . . . . . . . . . . . . . . . . . . 406
CallableStatement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407
ResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 409
Reading the ResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 410
Scrollable ResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 411
Specify Number of Rows to Return . . . . . . . . . . . . . . . . . . . 414
Updatable ResultSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 415
Transaction Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 419
Savepoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 421
Batch Statements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 422
Keeping ResultSet Objects Open . . . . . . . . . . . . . . . . . . . . . . 424
RowSet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 424
Autogenerated Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
ResultSet Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 426
Data Types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 427
Exceptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 428
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 429
11 JDBC and Embedded SQL . . . . . . . . . . . . . . . . . . . . . . . . 453
Model Programs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 454
Model A Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455
Model B Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 457
Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Create a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 460
Drop a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 462
Indexing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Create an Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 463
Drop an Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Inserting Data into Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 465
Insert a Row . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 466
Insert the System Date into a Column . . . . . . . . . . . . . . . . . 466
Insert the System Time into a Column . . . . . . . . . . . . . . . . . 467
Insert a Timestamp into a Column . . . . . . . . . . . . . . . . . . . . 467
Selecting Data from a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 468
Select All Data from a Table . . . . . . . . . . . . . . . . . . . . . . . . . . 469
Request One Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 470
Request Multiple Columns . . . . . . . . . . . . . . . . . . . . . . . . . . 471
Request Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 472
Request Rows and Columns . . . . . . . . . . . . . . . . . . . . . . . . . 472
AND, OR, and NOT Clauses . . . . . . . . . . . . . . . . . . . . . . . . . 473
Join Multiple Compound Expressions . . . . . . . . . . . . . . . . . 474
Equal and Not Equal Operators . . . . . . . . . . . . . . . . . . . . . . 475
Less Than and Greater Than Operators . . . . . . . . . . . . . . . . 477
Less Than or Equal to and Greater Than or Equal To . . . . 478
Between Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 479
LIKE Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
IS NULL Operator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 480
DISTINCT Modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 481
IN Modifier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 482
Metadata . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 483
Number of Columns in ResultSet . . . . . . . . . . . . . . . . . . . . . 483
Data Type of Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Name of Column . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Column Size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 484
Updating Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Update Row and Column . . . . . . . . . . . . . . . . . . . . . . . . . . . 485
Update Multiple Rows . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 486
Deleting Data from a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
Delete a Row from a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . 490
Joining Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 491
Join Two Tables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 494
Parent-Child Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 495
Multiple Comparison Join . . . . . . . . . . . . . . . . . . . . . . . . . . . 496
Multitable Join . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 497
Create a Column Name Qualifier . . . . . . . . . . . . . . . . . . . . . 498
Create a Table Alias . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 499
Inner and Outer Joins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 500
Calculating Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 504
SUM() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 506
AVG() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
MIN() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 507
MAX() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
COUNT() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 508
Count All Rows in a Table . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Retrieve Multiple Counts . . . . . . . . . . . . . . . . . . . . . . . . . . . . 509
Calculate a Subset of Rows . . . . . . . . . . . . . . . . . . . . . . . . . . 510
NULLs and Duplicates . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 511
Calculate Without Using Built-in Functions . . . . . . . . . . . . 511
Grouping and Ordering Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 512
GROUP BY . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 513
Group Multiple Columns . . . . . . . . . . . . . . . . . . . . . . . . . . . . 514
Conditional Grouping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 515
Working with NULL Columns . . . . . . . . . . . . . . . . . . . . . . . 516
Sorting Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 516
Sorting on Derived Data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 518
Subqueries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 519
Create a Subquery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 520
Conditional Testing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 521
VIEWs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Rules for Using VIEWs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 525
Create a VIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 527
Select Columns to Appear in the VIEW . . . . . . . . . . . . . . . . 528
Create a Horizontal VIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . 528
Create a Multitable VIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Group and Sort VIEWs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 529
Modify a VIEW . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 530
Part IV
J2ME Personal Information Manager Profile
12 Personal Information Manager . . . . . . . . . . . . . . . . . . . . 535
PIM Databases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 536
The Contact Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 538
The Event Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 539
The To Do Database . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 540
Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
A Model PIM Application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 541
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 557
Part V
J2ME Networking and Web Services
13 Generic Connection Framework . . . . . . . . . . . . . . . . . . . 575
The Connection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 576
Connection and Streams . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 577
Hypertext Transfer Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 580
Creating an HTTP Connection . . . . . . . . . . . . . . . . . . . . . . . . 580
Reading Data from an HTTP Connection . . . . . . . . . . . . . . 582
The File Protocol . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 589
Socket . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 592
Communication Management Using HTTP Commands . . . . . . . . . 597
HttpConnection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 598
Session Management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 608
Cookies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Transmit as a Background Process . . . . . . . . . . . . . . . . . . . . . . . . . . . 610
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 614
14 Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 617
Web Services Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
The Tier . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 618
Clients, Resources, and Components . . . . . . . . . . . . . . . . . . 620
Accessing Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 621
J2EE Multi-Tier Web Services Architecture . . . . . . . . . . . . . . . . . . . . 621
Client Tier Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Classification of Clients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 624
Web Tier Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 625
Enterprise JavaBeans Tier Implementation . . . . . . . . . . . . . . . . . . . . 626
Enterprise Information Systems Tier Implementation . . . . . . . . . . . 627
Inside WSDL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
The WSDL Document . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 629
Types Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
Message Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 632
portType Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 633
Binding Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 634
Port Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
Service Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 635
J2ME MIDlets and Web Services . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 636
JAX-RPC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Holder Classes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 637
Remote Method Invocation Concept . . . . . . . . . . . . . . . . . . . . . . . . . 639
Remote Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
SOAP Basics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 639
SOAP Functionality . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 640
The SOAP Message and Delivery Structure . . . . . . . . . . . . 640
WSDL and SOAP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 641
SOAP One-Way Transmission Primitive . . . . . . . . . . . . . . . 642
SOAP Request-Response Transmission Primitive . . . . . . . 643
SOAP Binding Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
SOAP Operation Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . 645
SOAP Body Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
SOAP Fault Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
SOAP Header Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 646
SOAP Address Element . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
WSDL and HTTP Binding . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 647
Quick Reference Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 649
Appendix: Quick Reference Guide . . . . . . . . . . . . . . . . . 653
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 721

بواسطة djamel نشرت في Book