Book Reviews - jQuery CSS3 and HTML5 for Mobile

Book Reviews - jQuery, CSS3, and HTML5 for Mobile and Desktop Devices
Covers the features of HTML5, CSS3 graphics, jQuery, and jQuery Mobile, and also shows how you can extend the power of CSS3 with SVG. Designed for readers with some knowledge of CSS/HTML/JavaScript, but more advanced users will benefit from numerous graphics techniques that are illustrated in many code samples. DVD with code and graphics included. You’ll see examples that help you learn to: create mobile Web applications using jQuery and jQuery Mobile; render HTML5/CSS3/SVG Web pages in Android and iOS; and create 2D/3D graphics & animation effects with CSS3. A companion DVD with source code and graphics is included.
FEATURES • Learn how to create Web Pages with jQuery and jQuery Mobile • Create mobile apps in Android and iOS with HTML5/CSS3/SVG • Create Web Pages with jQuery with CSS3 • Learn about upcoming CSS3 features such as CSS3 Shaders and Regions • Create 2D/3D graphics and animation effects with CSS3 • Render 2D shapes, charts, and graphs with gradients in HTML5 Canvas • Includes companion DVD with source code and 4-color graphics

Chapter 1   New Features in HTML5
HTML5 and Various Working Groups
HTML5 Specifications: W3C or WHATWG?
What is HTML5?
Browser Support for HTML5
What Technologies are Included in HTML5?
Differences between HTML4 Tags and HTML5 Tags
Useful Online Tools for HTML5 Web Pages
Modernizr
YepNope.js
Caniuse
HTML5 on Mobile
HTML5 BoilerPlate
Designing HTML5 Web Pages
Graceful Degradation
Progressive Enhancement
Responsive Design
A Simple HTML5 Web Page
New HTML5 Elements
Semantic Markup HTML5 Elements
Article Versus Section: How Are They Used?
Why Use Semantic Markup?
A Simple Web Page with Semantic Markup
The HTML5 <hgroup> Element
Custom Attributes in HTML5
The HTML5 <audio> Element
The HTML5 <video> Element
Popcorn.js: HTML5 Media Framework
HTML5 <video> and Web Camera Support
HTML5 Forms
New Input Types
New Attributes
A Simple HTML5 Form Example
The HTML5 FormData Object
Using HTML5 Web Storage
HTML5 Web Storage versus IndexedDB
HTML5 Web Storage versus Cookies
HTML5 Web Storage and Security
An Example of HTML5 localStorage
LocalStorage and iOS 5.1
Storing Images in localStorage
HTML5 Web Databases
Using An HTML5 IndexedDB Database
Storing Twitter Tweets in a Web Database
Web Database and Mobile Devices
Performance, Debugging, and Testing Tools
Blaze
Chrome Speed Tracer
PageSpeed
WEINRE
Firebug for Firefox
jsconsole
Socketbug
Adobe Shadow
Additional Useful Links
Summary
Chapter 2   Introduction to CSS3
CSS3 Support and Browser-Specific Prefixes for CSS3 Properties
A Quick Overview of CSS3 Features
CSS3 Pseudo-Classes, Attribute Selection, and Relational Symbols
CSS3 Pseudo-Classes
CSS3 Attribute Selection
CSS3 Relational Symbols
CSS3 Shadow Effects and Rounded Corners
Specifying Colors with RGB and HSL
CSS3 and Text Shadow Effects
CSS3 and Box Shadow Effects
CSS3 and Rounded Corners
CSS3 Gradients
Linear Gradients
Radial Gradients
Online Tools For Creating CSS3 Gradients
CSS3 2D Transforms
Zoom In/Out Effects with Scale Transforms
Rotate Transforms
Skew Transforms
Translate Transforms
CSS3 Media Queries
Detecting Orientation with CSS3 Media Queries
Detecting Orientation with Simple JavaScript
Working with Web Fonts
Online Resources for Fonts
CSS3 and Presentation Tools
Chapter 3   CSS3 2D/3D Animation and CSS Frameworks
A CSS3-Based Cube
CSS3 Transitions
Simple CSS3 Animation Effects
Animation Effects with CSS3 keyframes
Glowing Effects
Image Fading and Rotating Effects with CSS3
Bouncing Effects
CSS3 Effects for Text
Rendering Multi-Column Text
3D Effects in CSS3
CSS3 3D Animation Effects
CSS3 Animation and CSS Sprites
Sliding Panels with CSS3 Animation
CSS Frameworks
The Compass/Sass Framework
Sass Variables
Sass Mixins
The Blueprint Framework
The LESS Framework
LESS Variables
LESS mixins
Using LESS in Client-Side and Server-Side Code
CSS3 Performance
Useful Link
Chapter 4   CSS3 and SVG
New CSS3 Features
CSS Canvas Backgrounds
CSS Device Adaptation
CSS Exclusions
CSS Filters
CSS Flexbox (Flexible Box)
CSS Grid
CSS Regions
CSS Shaders
Simple Vertex CSS Shaders
Animation Effects with CSS Shaders
CSS Shaders and Detached Tiles
CSS Shaders and Curtain Effects
CSS3 and SVG
CSS3 and SVG Bar Charts
Rendering 3D Surfaces in SVG
Similarities and Differences Between SVG and CSS3
CSS3 Toolkits and IDEs
Sencha Animator
Adobe Edge
AliceJS
Chapter 5   Fundamentals of jQuery
What is jQuery?
Referencing jQuery Files in HTML5 Web Pages
HTML Web Pages without jQuery
Using jQuery to Find Elements in Web Pages
A “Hello World” Web Page with jQuery
jQuery Qualifiers versus jQuery Methods
Using Web Storage with jQuery
Querying and Modifying the DOM with jQuery
Find and Modify Elements With :first and :last Qualifiers
Finding Elements with :even and :odd Qualifiers
Finding Elements with :eq, :lt, and :gt Qualifiers
Finding HTML Elements by class or id
Finding and Setting Element Attributes
Finding Form Elements and Their Attributes
Using nth-child() for Finding Elements
Using jQuery to Remove Elements
Creating DOM Elements
Other jQuery Methods for Inserting DOM Elements
Useful jQuery Code Blocks
jQuery Element Navigation Methods
The next()/prev()/closest()/parent() Methods
Other jQuery Navigational Selection Methods
Caching Results of jQuery Invocations
What About this, $this, and $(this)?
Handling Click Events in jQuery
jQuery APIs for Traversing Elements
Chaining jQuery Functions
HTML5 Geolocation with jQuery
Accelerometer Values with jQuery
Using jQuery Plugins
Chapter 6   Animation Effects with jQuery and CSS3
Working with CSS3 Selectors in jQuery
HTML <div> Elements and the jQuery css() Function
Creating Rounded Corners with jQuery
Gradients and Shadow Effects with jQuery
Basic Animation Effects in jQuery
Using Callback Functions
jQuery Fade and Slide Animation Effects
The fadeIn(), fadeOut(), and fadeToggle() Functions
jQuery Slide-Related Functions
Easing Functions in jQuery
The jQuery .animate() Method
Custom CSS Animation Using the .animate() Function
The jQuery Queue and Animation Effects
Creating a Slideshow with Images
CSS3-Based Animation Effects
Animation Effects with CSS3 Keyframes and 2D Transforms
2D Transforms with CSS3 and jQuery
A Follow the Mouse Example with jQuery
Your First Sketching Program
Other Animation Effects with jQuery
Rendering a Set of Bouncing Balls with jQuery and CSS3
Handling Other Events with jQuery
Handling Mouse Events
Handling Events in jQuery 1.7 and Beyond
Handling Keyboard Events
Summary
Chapter 7   Query UI Controls
Accordion Effects
Buttons
Check Boxes and Radio Buttons
Combo Boxes
Date Pickers
Progress Bars
Scroll Panes with the jQuery jScrollPane Plugin
Sliders
Tabs
Theming jQuery UI
The jQuery UI Effect Function
A Sample Web Page with Various UI Components
Future Versions of jQuery
Useful Links
Chapter 8   Introduction to jQuery Mobile
Overview of jQuery Mobile
Key Features and Components in jQuery Mobile
A Minimal jQuery Mobile Web Page
More Differences between jQuery and jQuery Mobile
jQuery Mobile Page Views
jQuery Mobile Custom Attributes
jQuery Mobile Page Transitions
jQuery Mobile and CSS-Related Page Initialization
The mobileinit Event
jQuery Mobile Options and Customization
Page Navigation and Changing Pages
The jqmData() Custom Selector
Multiple Page Views in One HTML5 Web Page
Positioning the Header and Footer in Page Views
Working with Buttons in jQuery Mobile
Navigation Buttons as Anchor Links
Groups of Buttons and Column Grids
Rendering Buttons with Themes
jQuery Mobile Icons
Forms and Form Elements in jQuery Mobile
List Views in jQuery Mobile
Simple List Views with Buttons
Nested List Views
Navigation Bars
Select Menus in jQuery Mobile
jQuery Mobile and Ajax
jQuery Mobile and Geolocation
Chapter 9   User Gestures and Animation Effects in jQuery Mobile
Handling User Gestures and Events in jQuery Mobile
Two jQuery Plugins for Detecting User Gestures
Scroll Events in jQuery Mobile
Portrait Mode Versus Landscape Mode
Animation Effects Using jQuery Mobile
Fade-Related Methods
Slide-Related jQuery Methods
jQuery Mobile and Transition Effects
jQuery Mobile and Animation Effects with CSS3
jQuery Mobile Virtual Mouse Events
jQuery Mobile and Page-Turning Effects
CSS3 2D/3D Animation Effects with jQuery Mobile
CSS3 3D Animation with Tap Events
jQuery Mobile and Dynamic Animation Effects
jQuery Mobile and 3D Cube Animation Effects
jQuery Mobile Bouncing Balls
Accelerometer Values with jQuery
Chapter 10   Other HTML5 Technologies
The Stages in the W3C Review Process
HTML5 APIs in W3C Recommendation Status (REC)
HTML5 APIs in W3C Candidate Recommendation Status (CR)
Battery API (DAP)
HTML5 Geolocation
Obtain a User’s Position with getCurrentPosition()
Track a User’s Position with watchPosition()
HTML5 WebSockets
A Simple WebSockets Web Page
SPDY and HTML5 WebSockets
Migrating to HTML5 WebSockets
Other Projects with HTML5 WebSockets
Available WebSocket Servers
Vibration API (DAP)
XMLHttpRequest Level 2 (XHR2)
Making Ajax Calls without jQuery
Making Ajax Calls with jQuery
HTML5 Cross-Origin Resource Sharing (CORS)
Ajax Requests Using XMLHttpRequest Level 2 (XHR2)
HTML5 APIs in W3C Last Call Status (LC)
HTML5 Contacts
HTML5 Drag and Drop (DnD)
jQuery and HTML5 Drag and Drop
jQuery and HTML5 localStorage
Libraries for HTML5 localStorage
HTML5 Web Messaging
Using HTML5 Server-Sent Events (SSE)
A Comparison of Ajax and SSE
HTML5 APIs in W3C Working Draft Status (WD)
Audio Processing
jQuery and HTML5 File APIs
HTML5 Web Intents
Using HTML5 Microdata
HTML5 Web Notifications
HTML5 WAI-ARIA
HTML5 Web Workers
HTML5 History APIs
HTML5 Offline Web Applications
Detecting Online and Offline Status
HTML5 APIs in Experimental Status
Other Upcoming HTML5 Features
Chapter 11   Introduction to HTML5 Canvas
What is HTML5 Canvas?
HTML5 Canvas Versus SVG
The HTML5 Canvas Coordinate System
Line Segments, Rectangles, Circles, and Shadow Effects
HTML5 Canvas Linear Gradients
Horizontal, Vertical, and Diagonal Linear Gradients
Radial Color Gradients
Bezier Curves
Bezier Curves with Linear and Radial Gradients
Rendering Images on Canvas with CSS3 Selectors
Repeating an Image on Canvas with Patterns
HTML5 Canvas Transforms and Saving State
jCanvas: A jQuery Plugin for HTML5 Canvas
HTML5 Canvas with CSS3 and jQuery Mobile
Other HTML5 Canvas Topics
Other HTML5 Canvas Toolkits
Chapter 12   Charts and Graphs in HTML5 Canvas
Rendering Gradient Bar Charts
Mouse-Enabled Bar Chart
Rendering 3D Bar Charts
Rendering Multiple Line Graphs
Rendering Area Graphs
Rendering Pie Charts
Rendering Multiple Charts and Graphs
Bar Charts with HTML5 Canvas and jQuery Mobile
Updating HTML5 Canvas Bar Charts with a WebSocket Server
An Integrated Example with HTML5 Canvas, CSS3, and SVG
Third Party Chart Libraries
Chapter 13   HTML5 Mobile Apps on Android, iOS, and Tizen
HTML5/CSS3 and Android Applications
SVG and Android Applications
HTML5 Canvas and Android Applications
Android and HTML5 Canvas Multi-Line Graphs
Android and HTML5 Canvas Animation
Android Applications with jQuery Mobile
What is PhoneGap?
How Does PhoneGap Work?
Other Useful Links
Creating Android Apps with the PhoneGap Plugin
PhoneGap Form Input Example on Android
Working with HTML5, PhoneGap, and iOS
A CSS3 Cube on iOS Using PhoneGap
Tizen
Benefits
Platform Overview
The Application Layer
Tizen API
Tizen Core Service
Application Framework
Base
Connectivity
Graphics and UI
Location
Messaging
Multimedia
PIM (Personal Information Management)
Security
System
Telephony
Web
The Kernel Layer
Development Tools
Sample Web Applications
Native and Hybrid Applications Support
Links to More Information
Android and jQuery Mobile for Robot Control

Book Reviews - Pro jQuery 2.0

Book Reviews - Pro jQuery 2.0
jQuery 2.0 is the latest version of the jQuery framework. Suitable for modern web browsers it provides a robust API for web application development. It is fast becoming the tool of choice for web developers the world over and sets the standard for simplicity,flexibility and extensibility in website design.
In Pro jQuery 2.0 seasoned author, Adam Freeman, demonstrates how to get the most from jQuery 2.0 by focussing on the practical features of the technology and how they can be applied to solving real-world problems. In this comprehensive reference he goes in depth to give you the practical knowledge that you need.
Each topic is covered clearly and concisely, and is packed with the details you'll need to learn to be truly effective. The most important features are given a no-nonsense, in-depth treatment, and chapters contain examples that demonstrate both the power and the subtlety of jQuery.
Chapter 1: Putting jQuery in Context .....................................1
Understanding jQuery UI and jQuery Mobile ............................................1
Understanding jQuery Plug-ins ...........................................1
What Do I Need to Know? ............................................................2
What Is the Structure of This Book? .............................................2
Part 1: Getting Ready .........................................................................2
Part 2: Working with jQuery .......................................................... 2
Part 3: Working with Data and Ajax ............................................... 2
Part 4: Using jQuery UI ...............................................2
Part 5: Using jQuery Mobile ............................................................ 2
Part 6: Advanced Features 

 What’s New in This Edition? ..........................................3
What’s New for Core jQuery? ....................................................... 3
What’s New for jQuery UI? ........................................................ 3
What’s New for jQuery Mobile? ....................................................... 3
What Else Is New? ...................................................................................4
Are There Lots of Examples? 4
Where Can I Get the Example Code? 6
What Software Do I Need for This Book? ......................................................................................6
Getting jQuery 6
Getting an HTML Editor ..........................................................................................................................................7
Getting a Web Browser ..........................................................................................................................................7
Getting a Web Server .............................................................................................................................................7
Getting Node.js......................................................................................................................................................8
Image Attribution ...........................................................................................................................9
Chapter 2: HTML Primer ..................................................................................................11
Introducing a Basic HTML Document ..........................................................................................11
Understanding the Anatomy of an HTML Element .......................................................................13
Understanding Attributes ......................................................................14
The id and class Attributes ............................................................................. 14
Understanding Element Content ..................................................................................................15
Understanding Void Elements .....................................................................................................16
Understanding the Document Structure .................................................16
Understanding the Metadata Elements .......................................................................... 17
Understanding the Content Elements ........................................................................ 19
Understanding the Element Hierarchy .........................................................................................24
Understanding Parent-Child Relationships ........................................................................... 24
Understanding Ancestor-Descendant Relationships ............................................... 25
Understanding Sibling Relationships ............................................................ 25
Understanding the Document Object Model ...........................................25
Using the DOM .................................................................26
Modifying the DOM ....................................................................28
Modifying Styles .....................................................................................29
Handling Events ....................................................................................30
Chapter 3: CSS Primer ........................................................33
Getting Started with CSS ...............................................................33
Setting an Inline Value ..........................................................35
Defining an Embedded Style ....................................................36
Defining an External Style Sheet .................................39
Understanding CSS Selectors .........................40
Selecting by Attribute .....................................................................41
Selecting by Relationship ..................................................................... 42
Selecting Using the Pseudo-element and Pseudo-class Selectors ................................................ 44
Unions and the Negation Selectors .............................................................................. 46
Understanding Style Cascading .......................................................47
Understanding How Styles Cascade ................................................................... 48
Tweaking the Order with Important Styles ................................................................. 49
Tie-Breaking with Specificity and Order Assessments ......................................................... 50
Understanding CSS Units ............................................................................................................52
Working with CSS Colors ...................................................................... 53
Understanding CSS Lengths ................................................................................................ 54
Using Shorthand Properties and Custom Values .........................................................................58
Chapter 4: JavaScript Primer ..........................................................................................61
Getting Ready to Use JavaScript .................................................................................................61
Using Statements ........................................................................................................................62
Defining and Using Functions .....................................................................................................63
Defining Functions with Parameters ................................................................ 64
Defining Functions That Return Results ........................................................... 65
Using Variables and Types ..........................................................................66
Using the Primitive Types ................................................................ 66
Creating Objects .......................................................68
Working with Objects
Using JavaScript Operators ..........................................................75
Using Conditional Statements ................................................................................. 75
The Equality Operator vs. the Identity Operator .................................................................. 76
Explicitly Converting Types ........................................................................ 79
Working with Arrays ....................................................................................................................82
Using an Array Literal ..........................................................................................................................................82
Reading and Modifying the Contents of an Array ................................................................................................ 83
Enumerating the Contents of an Array ................................................................................................................. 84
Using the Built-in Array Methods ......................................................................................................................... 85
Handling Errors ...........................................................................................................................85
Comparing undefined and null Values .........................................................................................87
Checking for null or undefined ............................................................................................................................ 89
Differentiating Between null and undefined ........................................................................................................ 90
Chapter 5: jQuery Basics .................................................................................................93
Setting Up jQuery ........................................................................................................................94
Using Conditional Comments ............................................................................................................................... 96
A First jQuery Script ....................................................................................................................97
Understanding the jQuery $ Function ..........................................................................................99
Waiting for the Document Object Model ...................................................................................101
Using the Alternative Notation ........................................................................................................................... 102
Deferring the ready Event .................................................................................................................................. 103
Selecting Elements ....................................................................................................................104
Narrowing the Selection with a Context ............................................................................................................ 106
Understanding the Selection Result ..........................................................................................107
Determining the Context ....................................................................................................................................108
Dealing with DOM Objects ................................................................................................................................. 109
Modifying Multiple Elements and Chaining Method Calls .........................................................113
Handling Events ........................................................................................................................116
Chapter 7: Manipulating the DOM .................................................................................145
Creating New Elements .............................................................................................................146
Creating Elements Using the $ Function ........................................................................................................... 146
Creating New Elements by Cloning Existing Elements ...................................................................................... 148
Creating Elements Using the DOM API ............................................................................................................... 149
Inserting Child and Descendant Elements ................................................................................150
Prepending Elements .........................................................................................................................................152
Inserting the Same Elements in Different Positions .......................................................................................... 154
Inserting from a jQuery Object ........................................................................................................................... 156
Inserting Elements Using a Function ................................................................................................................. 157
Inserting Parent and Ancestor Elements ...................................................................................159
Wrapping Elements Together in a Single Parent ................................................................................................ 161
Wrapping the Content of Elements .................................................................................................................... 163
Wrapping Elements Using a Function
Inserting Sibling Elements ........................................................................................................166
Inserting Siblings from a jQuery Object ............................................................................................................. 167
Inserting Siblings Using a Function ................................................................................................................... 168
Replacing Elements ...................................................................................................................169
Replacing Elements Using a Function ............................................................................................................... 170
Removing Elements ...................................................................................................................172
Detaching Elements ...........................................................................................................................................173
Empting Elements ..............................................................................................................................................174
Unwrapping Elements .......................................................................................................................................175
Chapter 8: Manipulating Elements ................................................................................177
Working with Attributes and Properties ....................................................................................178
Setting an Attribute Value .................................................................................................................................. 180
Setting Multiple Attributes ................................................................................................................................. 181
Setting Attribute Values Dynamically ................................................................................................................. 183
Removing an Attribute .......................................................................................................................................184
Working with Properties ....................................................................................................................................184
Working with Classes ................................................................................................................185
Adding and Removing Classes Using a Function ............................................................................................... 187
Toggling Classes ................................................................................................................................................189
Toggling Multiple Classes .................................................................................................................................. 192
Toggling All Classes ...........................................................................................................................................193
Toggling Classes in One Direction ..................................................................................................................... 194
Toggling Classes Dynamically ........................................................................................................................... 195
Working with CSS ......................................................................................................................196
Getting and Setting a Single CSS Value ............................................................................................................. 197
Getting Multiple CSS Properties ........................................................................................................................ 198
Setting Multiple CSS Properties ....................................................................................................................... 198
Setting Relative Values ......................................................................................................................................200
Setting Properties Using a Function .................................................................................................................. 200
Using the Property-Specific CSS Convenience Methods ................................................................................... 201
Working with Element Content ..................................................................................................203
Setting Element Content ....................................................................................................................................204
Setting Element Content Using a Function ........................................................................................................ 205
Working with Form Elements ....................................................................................................206
Setting Form Element Values ............................................................................................................................ 207
Setting Form Element Values Using a Function ................................................................................................. 208
Associating Data with Elements ................................................................................................209
Chapter 9: Working with Events ....................................................................................211
Handling Events ........................................................................................................................212
Registering a Function to Handle Multiple Event Types ..................................................................................... 215
Providing Data to the Event Handler Function ................................................................................................... 216
Suppressing the Default Action ......................................................................................................................... 217
Removing Event Handler Functions ................................................................................................................... 218
Executing a Handler Once ................................................................................................................................. 220
Performing Live Event Binding ..................................................................................................221
Limiting DOM Traversal for Live Event Handlers ................................................................................................ 224
Manually Invoking Event Handlers ............................................................................................225
Using an Event Object ........................................................................................................................................227
Using the triggerHandler Method ...................................................................................................................... 228
Using the Event Shorthand Methods .........................................................................................229
Using the Document Event Shorthand Methods ................................................................................................ 231
Using the Browser Event Shorthand Methods ................................................................................................... 231
Using the Mouse Event Shorthand Methods ...................................................................................................... 231
Using the Form Event Shorthand Methods ........................................................................................................ 233
Using the Keyboard Event Shorthand Methods ................................................................................................. 233
Chapter 10: Using jQuery Effects ...................................................................................235
Using the Basic Effects .............................................................................................................236
Toggling Elements .............................................................................................................................................239
Toggling in One Direction ...................................................................................................................................240
Animating the Visibility of Elements .................................................................................................................. 240
Using Effect Callbacks .......................................................................................................................................242
Creating Looping Effects ...................................................................................................................................245
Using the Slide Effects ..............................................................................................................247
Using the Fade Effects ..............................................................................................................248
Fading to a Specific Opacity .............................................................................................................................. 250
Creating Custom Effects ............................................................................................................252
Using Absolute Target Property Values .............................................................................................................. 254
Using Relative Target Property Values ............................................................................................................... 255
Creating and Managing the Effect Queue ..................................................................................256
Displaying the Items in the Effect Queue .......................................................................................................... 257
Stopping Effects and Clearing the Queue .......................................................................................................... 259
Inserting a Delay into the Queue ....................................................................................................................... 262
Inserting Functions into the Queue .................................................................................................................... 263
Enabling and Disabling Effect Animations .................................................................................264
Chapter 11: Refactoring the Example: Part I .................................................................267
Reviewing the Example Document ............................................................................................267
Adding Additional Flower Products ...........................................................................................269
Adding the Carousel Buttons .....................................................................................................271
Dealing with the Submit Button ................................................................................................273
Implementing the Carousel Event Handler Functions ...............................................................275
Totaling the Product Selection ..................................................................................................278
Disabling JavaScript ..................................................................................................................280
Chapter 12: Using Data Templates .................................................................................281
Understanding the Problem That Templates Solve ....................................................................282
Setting Up the Template Library ................................................................................................283
A First Data Templates Example ................................................................................................284
Defining the Data ...............................................................................................................................................286
Defining the Template ........................................................................................................................................286
Applying the Template .......................................................................................................................................287
Using Template Logic ................................................................................................................291
Creating Conditional Content ............................................................................................................................. 291
Enumerating Arrays and Properties ................................................................................................................... 294
Changing the Data Context ................................................................................................................................ 296
Creating Custom Template Helpers ...........................................................................................300
Creating a Conditional Template Helper ............................................................................................................ 301
Returning More Complex Content ...................................................................................................................... 304
Receiving Optional Arguments in the Helper Function ...................................................................................... 305
Providing Custom Template Properties .............................................................................................................. 307
Chapter 13: Working with Forms ...................................................................................309
Preparing the Node.js Server ....................................................................................................310
Recapping the Form-Event Methods .........................................................................................314
Dealing with Form Focus ...................................................................................................................................314
Dealing with Value Changes .............................................................................................................................. 316
Dealing with Form Submission .......................................................................................................................... 317
Validating Form Values ..............................................................................................................319
Using the Validation Checks ............................................................................................................................. 324
Specifying Validation Messages ........................................................................................................................ 334
Creating a Custom Check .................................................................................................................................. 339
Formatting the Validation Error Display ............................................................................................................. 342
Using a Validation Summary .............................................................................................................................. 345
Chapter 14: Using Ajax: Part I .......................................................................................351
Using the Ajax Shorthand Methods ...........................................................................................352
Performing an Ajax GET Request ....................................................................................................................... 352
Performing an Ajax POST Request ..................................................................................................................... 360
Specifying the Expected Data Type .................................................................................................................... 368
Avoiding the Most Common Ajax Pitfall .....................................................................................369
Using the Type-Specific Convenience Methods ........................................................................371
Getting an HTML Fragment ................................................................................................................................ 371
Getting and Executing Scripts ........................................................................................................................... 374
Getting JSON Data .............................................................................................................................................376
Using the Ajax Forms Plug-in ....................................................................................................378
Chapter 15: Using Ajax: Part II ......................................................................................381
Making a Simple Ajax Request with the Low-Level API ............................................................382
Understanding the jqXHR Object ...............................................................................................384
Setting the Request URL ...........................................................................................................385
Making a POST Request ............................................................................................................386
Handling Ajax Callbacks ............................................................................................................387
Dealing with Successful Requests .................................................................................................................... 388
Dealing with Errors ............................................................................................................................................389
Dealing with Completed Requests ..................................................................................................................... 390
Configuring Requests Before They Are Sent ...................................................................................................... 392
Specifying Multiple Event Handler Functions .................................................................................................... 393
Setting the Context for Events ........................................................................................................................... 393
Using the Global Ajax Events .....................................................................................................394
Controlling Global Events ...................................................................................................................................397
Configuring the Basic Settings for an Ajax Request ..................................................................398
Setting Timeouts and Headers ........................................................................................................................... 398
Sending JSON Data to the Server
Using Advanced Configuration Settings ....................................................................................401
Making the Request Synchronously .................................................................................................................. 401
Ignoring Unmodified Data .................................................................................................................................. 402
Dealing with the Response Status Code ............................................................................................................ 403
Cleaning Up the Response Data ........................................................................................................................ 405
Managing Data Conversion ................................................................................................................................ 406
Setting Up and Filtering Ajax Requests .....................................................................................407
Defining Default Settings ...................................................................................................................................407
Filtering Requests ..............................................................................................................................................408
Chapter 16: Refactoring the Example: Part II ................................................................411
Reviewing the Refactored Example ..........................................................................................411
Updating the Node.js Script .......................................................................................................414
Preparing for Ajax ......................................................................................................................416
Sourcing the Product Information .............................................................................................419
Adding Form Validation .............................................................................................................422
Adding Remote Validation .................................................................................................................................. 426
Submitting the Form Data Using Ajax .......................................................................................428
Processing the Server Response ..............................................................................................436
Adding the New Form ........................................................................................................................................442
Completing the Ajax Request ............................................................................................................................. 443
Processing the Data ..........................................................................................................................................445
Chapter 17: Setting Up jQuery UI ...................................................................................449
Obtaining jQuery UI ...................................................................................................................449
Deciding on a Theme .........................................................................................................................................449
Creating the jQuery UI Custom Download .......................................................................................................... 451
Installing jQuery UI for Development .........................................................................................452
Adding jQuery UI to an HTML Document
Installing jQuery UI for Production .............................................................................................454
Using jQuery UI via a Content Distribution Network .......................................................................................... 454
Chapter 18: Using the Button, Progress Bar, and Slider Widgets ..................................457
Using the jQuery UI Button ........................................................................................................458
Configuring the Button ......................................................................................................................................460
Using jQuery UI Icons in Buttons ....................................................................................................................... 462
Using a Custom Image .......................................................................................................................................464
Using the Button Methods ................................................................................................................................. 465
Using the Button Event ......................................................................................................................................468
Creating Different Types of Button ............................................................................................469
Creating a Toggle Button ...................................................................................................................................470
Creating a Button Set ........................................................................................................................................471
Using the jQuery UI Progress Bar ..............................................................................................473
Creating the Progress Bar ................................................................................................................................. 474
Creating an Indeterminate Progress Bar ........................................................................................................... 475
Using the Progress Bar Methods ....................................................................................................................... 476
Using the Progress Bar Events .......................................................................................................................... 478
Using the jQuery UI Slider .........................................................................................................480
Configuring the Slider ........................................................................................................................................481
Using the Slider Methods .................................................................................................................................. 486
Using Slider Events ............................................................................................................................................488
Chapter 19: Using the Autocomplete and Accordion Widgets .......................................491
Using jQuery UI Autocomplete ...................................................................................................492
Creating the Autocomplete Element .................................................................................................................. 492
Configuring Autocomplete ................................................................................................................................. 495
Using the Autocomplete Methods ...................................................................................................................... 503
Using the Autocomplete Events
Using the jQuery UI Accordion ...................................................................................................510
Creating the Accordion ......................................................................................................................................510
Configuring the Accordion ................................................................................................................................ 514
Using the Accordion Methods ............................................................................................................................ 524
Using the Accordion Events ............................................................................................................................... 525
Chapter 20: Using the Tabs Widget ................................................................................527
Creating the Tabs .......................................................................................................................528
Getting Tab Content with Ajax ...................................................................................................531
Configuring the Tabs Widget ......................................................................................................533
Selecting the Active Tab ....................................................................................................................................533
Disabling Individual Tabs ...................................................................................................................................535
Changing the Event Trigger ................................................................................................................................ 537
Using Collapsible Tabs .......................................................................................................................................538
Using the Tabs Methods ............................................................................................................539
Adding and Removing Tabs ............................................................................................................................... 539
Triggering Tab Ajax Requests ............................................................................................................................. 541
Using the Tabs Events ...............................................................................................................542
Intercepting Ajax Requests ................................................................................................................................ 543
Manipulating Remote Tab Data .......................................................................................................................... 544
Using Tabs to Display a Form ............................................................................................................................ 545
Chapter 21: Using the Datepicker Widget ......................................................................555
Creating the Datepicker ............................................................................................................556
Creating an Inline Datepicker ............................................................................................................................ 557
Configuring the Datepicker ......................................................................................................559
Performing Basic Configuration ......................................................................................................................... 559
Managing the Date Selection ............................................................................................................................ 565
Managing the Appearance of the Datepicker
Using the Datepicker Methods ..................................................................................................578
Getting and Setting the Date Programmatically ................................................................................................ 578
Showing and Hiding Pop-up Datepickers Programmatically ............................................................................ 580
Using the Datepicker Events .....................................................................................................581
Responding to a Month or Year Change ............................................................................................................ 582
Responding to the Pop-up Closing .................................................................................................................... 583
Localizing Date Selection ..........................................................................................................584
Chapter 22: Using the Dialog and Spinner Widgets .......................................................587
Using the jQuery UI Dialog Widget .............................................................................................588
Creating the Dialog ............................................................................................................................................588
Configuring the Dialog .......................................................................................................................................590
Using the Dialog Methods .................................................................................................................................. 602
Using the Dialog Events .....................................................................................................................................604
Using the jQuery UI Spinner Widget ..........................................................................................607
Using the Spinner Widget with the HTML5 Input Element Types ....................................................................... 608
Configuring the Spinner Widget ........................................................................................................................ 611
Using the Spinner Methods ............................................................................................................................... 617
Using the Spinner Events ..................................................................................................................................619
Chapter 23: Using the Menu and Tooltip Widgets ..........................................................621
Using the jQuery UI Menu Widget ..............................................................................................622
Creating the Menu ............................................................................................................................................622
Configuring the Menu ........................................................................................................................................625
Using the Menu Methods ...................................................................................................................................631
Using the Menu Events ......................................................................................................................................632
Using the jQuery UI Tooltip Widget ...........................................................................................634
Creating the Tooltip ............................................................................................................................................635
Configuring the Tooltip
Using the Tooltip Methods ................................................................................................................................. 647
Using the Tooltip Events ....................................................................................................................................649
Chapter 24: Using the Drag-and-Drop Interactions .......................................................653
Creating the Draggable Interaction ...........................................................................................654
Configuring the Draggable Interaction ............................................................................................................... 655
Using the Draggable Methods ........................................................................................................................... 661
Using the Draggable Events .............................................................................................................................. 662
Using the Droppable Interaction ................................................................................................663
Highlighting a Drop Target ................................................................................................................................. 665
Dealing with Overlapping Elements ................................................................................................................... 667
Configuring the Droppable Interaction ............................................................................................................... 668
Using the Droppable Methods ........................................................................................................................... 674
Tuning Drag and Drop ................................................................................................................674
Using Element Scope .........................................................................................................................................674
Using a Helper Element .....................................................................................................................................676
Snapping to the Edges of Elements ................................................................................................................... 680
Chapter 25: Using the Other Interactions ......................................................................683
Using the Sortable Interaction ...................................................................................................684
Getting the Sortable Order ................................................................................................................................. 685
Configuring the Sortable Interaction .................................................................................................................. 687
Using the Sortable Methods .............................................................................................................................. 693
Using the Sortable Events ................................................................................................................................. 695
Using the Selectable Interaction ...............................................................................................697
Configuring the Selectable Interaction .............................................................................................................. 699
Using the Selectable Interaction Methods ......................................................................................................... 700
Using the Selectable Interaction Events ............................................................................................................ 701
Using the Resizable Interaction .................................................................................................701
Configuring the Resizable Interaction ................................................................................................................ 703
Chapter 26: Refactoring the Example: Part III ...............................................................709
Reviewing the Refactored Example ..........................................................................................709
Displaying the Products ............................................................................................................711
Adding the Shopping Basket .....................................................................................................713
Wrapping the Accordion ....................................................................................................................................715
Adding the Table ................................................................................................................................................715
Handling Input Value Changes ........................................................................................................................... 716
Applying the Theme Style .........................................................................................................720
Applying the CSS Framework More Widely ....................................................................................................... 721
Applying Rounded Corners to the Table ............................................................................................................. 722
Creating the jQuery UI Button ....................................................................................................725
Adding the Completion Dialog ...................................................................................................728
Handling the Place Order Button Click ......................................................................................731
Completing the Order ................................................................................................................734
Chapter 27: Getting Started with jQuery Mobile ............................................................737
Setting Up jQuery Mobile ..........................................................................................................737
Obtaining jQuery Mobile ....................................................................................................................................738
Installing jQuery Mobile ....................................................................................................................................738
Understanding the jQuery Mobile Approach ..............................................................................739
Understanding Automatic Enhancement ........................................................................................................... 740
Understanding the Viewport ............................................................................................................................. 742
Understanding jQuery Mobile Events ................................................................................................................. 744
Responding to Device Orientation Changes ...................................................................................................... 754
Working with Mobile Devices ....................................................................................................756
Avoiding the Two Cardinal Sins of Mobile Development .................................................................................... 757
Avoiding Bad Assumptions ................................................................................................................................ 757
Avoiding Unrealistic Simulation and Testing ...................................................................................................... 759
Using a Mobile Browser Emulator ..................................................................................................................... 761
Chapter 28: Pages, Themes & Layouts ..........................................................................763
Understanding jQuery Mobile Pages .........................................................................................764
Adding Headers and Footers to a Page ............................................................................................................. 765
Adding Pages to a Document ............................................................................................................................ 766
Linking to External Pages .................................................................................................................................. 771
Using Scripting to Control jQuery Mobile Pages ........................................................................778
Changing the Current Page ................................................................................................................................ 778
Determining the Current Page ........................................................................................................................... 784
Loading Pages in the Background ..................................................................................................................... 786
Using Page Events .....................................................................................................................787
Handling the Page Initialization Event ............................................................................................................... 788
Handling Page Load Events ............................................................................................................................... 788
Responding to Page Transitions ........................................................................................................................ 789
Applying jQuery Mobile Themes ................................................................................................790
Applying Swatches to Individual Elements ........................................................................................................ 793
Creating Grid Layouts ................................................................................................................794
Chapter 29: The Dialog & Popup Widgets ......................................................................797
Using the jQuery Mobile Dialog Widget .....................................................................................798
Creating the Dialog Widget ................................................................................................................................ 798
Configuring the Dialog Widget ........................................................................................................................... 804
Using the Dialog Methods .................................................................................................................................. 808
Using the Dialog Events .....................................................................................................................................809
Using the jQuery Mobile Popup Widget .....................................................................................810
Creating the Popup Widget ................................................................................................................................ 810
Configuring the Popup Widget ........................................................................................................................... 811
Using the Popup Methods .................................................................................................................................. 818
Using the Popup Events .....................................................................................................................................820
Chapter 30: Buttons and Collapsible Blocks .................................................................823
Using jQuery Mobile Buttons .....................................................................................................824
Creating the Button Widget ................................................................................................................................ 824
Configuring jQuery Mobile Buttons .................................................................................................................... 828
Using the Button Methods ................................................................................................................................. 832
Using the Button Events ....................................................................................................................................834
Using jQuery Mobile NavBars ....................................................................................................835
Configuring jQuery Mobile NavBar .................................................................................................................... 837
Using the NavBar Methods & Events ................................................................................................................. 838
Using Collapsible Content Blocks ..............................................................................................838
Creating the Collapsible Block ........................................................................................................................... 838
Configuring jQuery Mobile Collapsible Content Blocks ...................................................................................... 839
Using Collapsible Block Methods ...................................................................................................................... 841
Using Collapsible Block Events .......................................................................................................................... 841
Using jQuery Mobile Collapsible Sets (Accordions) ...................................................................843
Configuring the Collapsible Set ......................................................................................................................... 844
Using the Collapsible Set Methods .................................................................................................................... 845
Using the Collapsible Set Events ....................................................................................................................... 845
Chapter 31: Using jQuery Mobile Forms ........................................................................847
Creating Form Element Widgets ................................................................................................848
Using the Textinput Widget ........................................................................................................851
Configuring the Textinput Widget ....................................................................................................................... 851
Using the Textinput Widget Methods ................................................................................................................. 852
Using the Textinput Widget Events .................................................................................................................... 853
Using the Slider and Range Slider Widgets ...............................................................................853
Configuring the Slider and Range Slider Widgets .............................................................................................. 856
Using the Slider and Range Slider Methods ...................................................................................................... 857
Using the Slider Events ......................................................................................................................................859
Using the Range Slider Events
Using the Selectmenu Widget ...................................................................................................861
Configuring the SelectMenu Widget .................................................................................................................. 862
Using the Selectmenu Methods ......................................................................................................................... 866
Using the Selectmenu Events ............................................................................................................................ 868
Using Flip Switches ...................................................................................................................868
Using the Checkboxradio Widget ...............................................................................................869
Creating Check Boxes ........................................................................................................................................869
Creating and Formatting Radio Buttons ............................................................................................................ 874
Configuring the Checkboxradio Widget ............................................................................................................. 876
Using the Checkboxradio Methods .................................................................................................................... 876
Using the Checkboxradio Events ....................................................................................................................... 877
Chapter 32: Using Lists and Panels ...............................................................................879
Using the ListView Widget .........................................................................................................880
Configuring the Listview Widget ........................................................................................................................ 882
Using the Listview Methods .............................................................................................................................. 894
Using the Listview Events .................................................................................................................................. 894
Using the Panel Widget .............................................................................................................894
Configuring the Panel Widget ............................................................................................................................ 896
Using the Panel Methods ...................................................................................................................................900
Using the Panel Events ......................................................................................................................................901
Chapter 33: Refactoring the Example: Part IV ...............................................................903
Starting with the Basics ............................................................................................................903
Inserting Products Programmatically ........................................................................................905
Reusing Pages ...................................................................................................................................................909
Creating the Shopping Basket ...................................................................................................912
Adding for Quantity Changes ............................................................................................................................. 916
Adding a Button to the Information Page .......................................................................................................... 920
Implementing the Checkout Process
Chapter 34: Using the jQuery Utility Methods ...............................................................929
Queues Revisited: Using General Purpose Queues ....................................................................929
Manually Processing Queue Items .................................................................................................................... 932
Utility Methods for Arrays ..........................................................................................................933
Using the Grep Method ......................................................................................................................................933
Using the inArray Method .................................................................................................................................. 935
Using the Map Method ......................................................................................................................................935
Using the Merge Method ...................................................................................................................................937
Using the Unique Method .................................................................................................................................. 937
Utility Methods for Types ...........................................................................................................938
Using the Type Method ......................................................................................................................................939
Utility Methods for Data .............................................................................................................940
Serializing Form Data ........................................................................................................................................940
Parsing Data ......................................................................................................................................................941
Trimming Strings ...............................................................................................................................................941
Other Utility Methods .................................................................................................................942
Checking Element Containment ........................................................................................................................ 942
Chapter 35: The jQuery UI Effects & CSS Framework ....................................................945
Using the jQuery UI Effects ........................................................................................................945
Animating Colors ............................................................................................................................................... 946
Animating Classes .............................................................................................................................................948
Using the jQuery UI Animations ......................................................................................................................... 951
Using the jQuery UI CSS Framework .........................................................................................953
Using the Widget Container Classes .................................................................................................................. 953
Applying Rounded Corners ................................................................................................................................ 955
Using the Interaction State Classes ................................................................................................................... 957
Using the Cue Classes ...............................................................................................................................
Chapter 36: Using Deferred Objects ..............................................................................963
A First Deferred Objects Example .............................................................................................964
Understanding Why Deferred Objects Are Useful .............................................................................................. 966
Using Other Callbacks ...............................................................................................................973
Rejecting a Deferred Object ............................................................................................................................... 974
Covering Both Outcomes 

 Using Outcome-Indifferent Callbacks 
 Using Multiple Callbacks ....................................................................
Using the Outcomes of Multiple Deferred Objects ....................................................................983
Providing Progress Information .................................................................................................984
Getting Information about a Deferred Object ............................................................................988
Using Ajax Deferred Objects

Book Reviews - Fraud Analytics Using Descriptive Predictive and Social Network Techniques

Book Reviews - Fraud Analytics Using Descriptive, Predictive, and Social Network Techniques
Detect fraud earlier to mitigate loss and prevent cascading damageFraud Analytics Using Descriptive, Predictive, and Social Network Techniques is an authoritative guidebook for setting up a comprehensive fraud detection analytics solution. Early detection is a key factor in mitigating fraud damage, but it involves more specialized techniques than detecting fraud at the more advanced stages. This invaluable guide details both the theory and technical aspects of these techniques, and provides expert insight into streamlining implementation. Coverage includes data gathering, preprocessing, model building, and post-implementation, with comprehensive guidance on various learning techniques and the data types utilized by each. These techniques are effective for fraud detection across industry boundaries, including applications in insurance fraud, credit card fraud, anti-money laundering, healthcare fraud, telecommunications fraud, click fraud, tax evasion, and more, giving you a highly practical framework for fraud prevention.
It is estimated that a typical organization loses about 5% of its revenue to fraud every year. More effective fraud detection is possible, and this book describes the various analytical techniques your organization must implement to put a stop to the revenue leak.
  • Examine fraud patterns in historical data
  • Utilize labeled, unlabeled, and networked data
  • Detect fraud before the damage cascades
  • Reduce losses, increase recovery, and tighten security
The longer fraud is allowed to go on, the more harm it causes. It expands exponentially, sending ripples of damage throughout the organization, and becomes more and more complex to track, stop, and reverse. Fraud prevention relies on early and effective fraud detection, enabled by the techniques discussed here. Fraud Analytics Using Descriptive, Predictive, and Social Network Techniques helps you stop fraud in its tracks, and eliminate the opportunities for future occurrence.
Chapter 1: Fraud: Detection, Prevention, and Analytics!
Introduction
Fraud!
Fraud Detection and Prevention
Big Data for Fraud Detection
Data-Driven Fraud Detection
Fraud-Detection Techniques
Fraud Cycle
The Fraud Analytics Process Model
Fraud Data Scientists
A Scientific Perspective on Fraud
References
Chapter 2: Data Collection, Sampling, and Preprocessing
Introduction
Types of Data Sources
Merging Data Sources
Sampling
Types of Data Elements
Visual Data Exploration and Exploratory Statistical Analysis
Benford's Law
Descriptive Statistics
Missing Values
Outlier Detection and Treatment
Red Flags
Standardizing Data
Categorization
Weights of Evidence Coding
Variable Selection
Principal Components Analysis
RIDITs
PRIDIT Analysis
Segmentation
References
Chapter 3: Descriptive Analytics for Fraud Detection
Introduction
Graphical Outlier Detection Procedures
Statistical Outlier Detection Procedures
Clustering
One-Class SVMs
References
Chapter 4: Predictive Analytics for Fraud Detection
Introduction
Target Definition
Linear Regression
Logistic Regression
Variable Selection for Linear and Logistic Regression
Decision Trees
Neural Networks
Support Vector Machines
Ensemble Methods
Multiclass Classification Techniques
Evaluating Predictive Models
Other Performance Measures for Predictive Analytical Models
Developing Predictive Models for Skewed Data Sets
Fraud Performance Benchmarks
References
Chapter 5: Social Network Analysis for Fraud Detection
Networks: Form, Components, Characteristics, and Their Applications
Is Fraud a Social Phenomenon? An Introduction to Homophily
Impact of the Neighborhood: Metrics
Community Mining: Finding Groups of Fraudsters
Extending the Graph: Toward a Bipartite Representation
References
Chapter 6: Fraud Analytics: Post-Processing
Introduction
The Analytical Fraud Model Life Cycle
Model Representation
Selecting the Sample to Investigate
Fraud Alert and Case Management
Visual Analytics
Backtesting Analytical Fraud Models
Model Design and Documentation
References
Chapter 7: Fraud Analytics: A Broader Perspective
Introduction
Data Quality
Privacy
Capital Calculation for Fraud Loss
An Economic Perspective on Fraud Analytics
In Versus Outsourcing
Modeling Extensions
The Internet of Things
Corporate Fraud Governance
References
About the Authors
Index
End User License Agreement