Web 2.0 Fundamentals : with Ajax, Development Tools, and Mobile
Total Page:16
File Type:pdf, Size:1020Kb
WEB 2.0 Fundamentals with Ajax, Development Tools, and Mobile Platfori Oswald Campesato Kevin Nilson JONES AND BARTLETT PUBLISHERS Sudbury, Massachusetts BOSTON TORONTO LONDON SINGAPORE Contents Acknowledgments XXI Biographies of Book Contributors XXV Preface XXXIII Chapter 1 Introduction 1 1.1 Information About This Book 2 1.1.1 Why Should You Buy This Book? 2 1.1.2 Why Are There Two Social Networking Chapters? 2 1.1.3 Why Are There Three Cloud Computing Chapters? 3 1.1.4 Why Does This Book Use the DojoToolkit and jQuery? 1.1.5 Versions of Software and Tools in This Book 4 1.1.6 Appendices with Web 2.0 URLs 4 1.1.7 Web 2.0 Topics That are Omitted from This Book 4 1.1.8 The URLs in This Book 5 1.1.9 Is This Book Only for Developers? 6 1.1.10 Do You Discuss the Best Web 2.0 Tools? 6 1.2 Web 2.0 in Our Lives 7 1.3 What Is Web 2.0? 9 1.3.1 Pioneers in Web 2.0 9 1.3.2 The Shift from Web 1.0 to Web 2.0 10 1.3.3 Is Web 2.0 Overrated? 11 1.3.4 Advantages/Disadvantages ofWeb 2.0 12 1.3.5 Early Enabling Technologies of Web 2.0 12 1.4 Popular Web 2.0 Products andTools 15 1.4.1 Flickr 15 1.4.2 YouTube 16 VIII CONTENTS 1.4.3 Twitter 16 1.4.4 Yelp 18 1.4.5 Del.icio.us 18 1.4.6 SlideShare 18 1.5 The Current Web 2.0 Landscape 19 1.5.1 Ajax (Formerly Called AJAX) 19 1.5.2 Productivity Tools 21 1.5.3 Development Tools and IDEs 22 1.5.4 Social Networks 23 1.5.5 Mash-Ups 26 1.5.6 Cloud Computing 28 1.5.7 Semantic Technology 33 1.5.8 Advanced Project with GWT 35 1.5.9 Comet: "Reverse Ajax" 36 1.5.10 Mobile Applications 36 1.6 What AboutWeb 3.0? 37 1.7 Summary 38 Chapter 2 Landscape of the Web 39 2.1 Coding Guidelines 40 2.2 HTML/JavaScript Examples 41 2.2.1 JavaScript Strings and Arrays 42 2.2.2 Handling Mouse Events 44 2.2.3 Regular Expressions and String Manipulations 2.2.4 HTML Frame Elements 48 2.2.5 HTML IFrame Elements 48 2.2.6 Design Patterns and Best Practices 50 2.3 Cascading Style Sheets (CSS) 50 2.3.1 Basic CSS Examples 51 2.3.2 Object-Oriented CSS (OOCSS) 54 2.4 HTML and Document Object Model (DOM) 55 2.4.1 HTML DOM and JavaScript DOM 56 2.4.2 Managing Nodes and Elements 56 2.4-3 Dojo and jQuery Syntax 60 2.4.4 Distributed DOM 61 2.5 Browser Plug-Ins 61 2.5.1 SVG Plug-In 62 2.5.2 Silverlight Plug-In 65 2.5.3 Adobe Flash 66 2.6 Assorted JavaScript Technologies and Tools 69 2.6.1 Google Caja 69 CONTENTS IX 2.6.2 ECMAScript for XML (E4X) 69 2.6.3 RaphaelJavaScript Library 70 2.7 HTML5: Browser Support and Code Samples 71 2.7.1 The HTML5 Canvas Element 72 2.7.2 Google Chrome 75 2.8 Summary 76 Chapter 3 JSON and XML 79 3.1 Introducing the Concept ofJSONAnd XML 79 3.1.1 XPath, XQuery, XSlt, and XML Documents 83 3.2 Working with JSON 86 3.3 AjaxTool Kits Working with JSON 88 3.3.1 Dojo and JSON 89 3.3.2 jQuery and JSON 90 3.3.3 Working with XML 90 3.3.4 Understanding Simple API for SML (SAX) 102 3.4 Advantages and Disadvantages ofJSON and XML 116 3.4.1 Advantages and Disadvantages of JSON 116 3.4.2 Advantages and Disadvantages of XML 117 3.5 HTML and SGML versus XML 119 3.6 YAML and Comma Separated Values (CSV) as Alternatives to JSON and XML 120 3.6.1 YAML 120 3.6.2 CSV 121 3.7 Advanced Example with Dojo and JSON 121 3.8 Summary 125 Chapter 4 Ajax 127 4.1 Introducing the Concept of Ajax 127 4.2 A Brief History ofAjax 129 4.2.1 IFrames 130 4.3 XMLHttpRequest (XHr) 134 4.4 Ajax via Ajax Libraries 136 4.4.1 Ajax via Dojo 136 4.4.2 Ajax via jQuery 137 4.5 Ajax Working with JSON Using Dojo 138 4.5.1 Ajax Working with JSON in jQuery 139 4.6 Limitations of Ajax 140 4.7 Adoption ofAjax 141 4.7.1 Disadvantages of Ajax 142 4.7.2 Advantages ofAjax 142 4.8 Comparison of Existing Ajax Libraries 143 X CONTENTS 4.8.1 Dojo 143 4.8.2 ExtJS 143 4.8.3 GWT 143 4.8.4 jQuery 143 4.8.5 Prototype Script.aculo.us 144 4.8.6 SmartClient 144 4.8.7 SproutCore 144 • 4.8.8 Tibco GI 144 4.8.9 YUI 144 4.8.10 Understanding the Terms 144 4.9 Comprehensive Ajax Project 144 4.10 Advanced Ajax 157 4.11 Summary 158 Chapter 5 Productivity and Testing Tools 159 5.1 Which Tools Are Best? 160 5.2 Google Wave 162 5.2.1 Google Wave Features 163 5.3 Yahoo Pipes 164 5.3.1 A Simple Yahoo Pipe 165 5.3.2 UsingYQL in Yahoo Pipes 166 5.4 Dapper 168 5.4.1 Creating a Simple Dapp 169 5.5 Assorted Open Source Tools from Google 169 5.5.1 Google Gears 170 5.5.2 Google Native Client 170 5.5.3 Google 03D 172 5.5.4 Google Ajax, Playground, and Sandbox 5.5.5 Google Innovation 173 5.6 Miscellaneous Productivity Tools 174 5.7 Twitter 176 5.7.1 Invoking Twitter APIs 177 5.8 The MIT Simile Project 179 5.9 Web 2.0 Applications and Product Suites 181 5.9.1 Google Apps 182 5.9.2 Zoho 183 5.10 Build Automation and TestingTools 184 5.10.1 Apache Ant 185 5.10.2 A Simple build.xml File 185 5.10.3 Maven 188 5.10.4 Other Build Tools 189 CONTENTS XI 5.10.5 JUnit 190 5.10.6 Other Testing Tools 191 5.11 BenchmarkingTools 191 5.11.1 Faban 192 5.12 Source Code Management Tools 192 5.12.1 How to Use Mercurial 194 5.12.2 Web Containers and Servers 196 5.13 Using DTrace for Web 2.0 Applications 197 5.13.1 DTrace Fundamentals 198 5.14 Industry Perspective and Business Focus 201 5.14.1 HowWillYahoo Pipes Evolve During the Next SeveralYears? 203 5.15 Summary 205 Chapter 6 Debugging Tools 207 6.1 Introducing the Concept of Debugging 207 6.2 Integrated Development Environments (IDES) 208 6.2.1 Eclipse 209 6.2.2 Adobe Flash Builder 4 210 6.2.3 SUNNetBeans 211 6.2.4 Oracle JDeveloper 211 6.2.5 InteUiJIDEA 211 6.2.6 Aptana Studio 212 6.3 Rich Internet Applications (RJA) 212 6.3.1 Adobe AIR 212 6.3.2 SUNJavaFX 212 6.4 Firebug 215 6.4.1 Inspect and Edit HTML and CSS 215 6.4.2 Monitor Network Activity 217 6.4.3 Debug and Profile JavaScript 218 6.4.4 Find Errors 219 6.4.5 Exploring the DOM 220 6.4.6 Execute JavaScript on the Fly 220 6.4.7 Log from JavaScript 221 6.5 Firebug Lite 221 6.6 Venhnan 222 6.7 Firefox Web Developer Add-On 222 6.8 JSLint 225 6.9 JsUnit 225 6.10 Selenium 226 6.11 Wireshark 226 6.12 Google Gadgets 227 XII CONTENTS 6.13 Summary 232 Chapter 7 The Facebook Platform 233 7.1 Social Networking 234 7.2 Facebook 235 7.2.1 Facebook Features and Services 236 7.2.2 Facebook Applications 238 7.2.3 Facebook Core Components 242 7.2.4 Facebook Integration with Other Products 246 7.3 SUNZembly 260 7.3.1 Zembly Features 261 7.3.2 Zembly Applications and Tools 261 7.3.3 ZemblyWeb Gateway API 262 7.4 Bebo 265 7.5 Identity Management for Web 2.0 Applications 266 7.5.1 Key Technologies 266 7.5.2 Conclusions 269 7.6 Summary 269 Chapter 8 The OpenSocial Platform 271 8.1 The OpenSocial Landscape 272 8.2 OpenSocial Markup Language (OSML) 273 8.2.1 OpenSocial Tags 273 8.2.2 OpenSocial Templates 274 8.3 OpenSocial Gadgets 275 8.3.1 Creating and Submitting OpenSocial Gadgets 276 8.3.2 Google Gadgets and Other Tools 277 8.4 The OpenSocial Technology Stack 277 8.5 OpenSocial Applications in Eclipse 278 8.5.1 A Basic OSDE Application 279 8.6 OpenSocial and Major Vendors 279 8.6.1 Yahoo Application Platform (YAP) and OpenSocial 280 8.6.2 Google Orkut 281 8.7 Google Friend Connect (GFC) 281 8.7.1 GFC APIs 282 8.7.2 GFC Gadgets 283 8.8 Apache Shindig 285 8.8.1 Building Apache Shindig 285 8.8.2 OpenSocial Java Client 289 8.8.3 Display Friends in Shindig 289 8.8.4 Compiling the Sample Shindig Code 293 8.9 Integrated OpenSocial Sample Application 294 CONTENTS XIII 8.9.1 Working with OpenSocial: Our Findings 301 8.10 Summary 304 Chapter 9 Mash-Ups and Search Technology 305 9.1 Mash-Ups 306 9.1.1 Consumer and Enterprise Mash-Ups 308 9.1.2 Design Patters and Best Practices 310 9.2 Mash-Up Tools and Products 311 9.2.1 IBM Mash-Up Center 311 9.2.2 WS02 312 9.2.3 Intel Mash Maker 314 9.2.4 Denodo Technologies 315 9.2.5 JackBe 316 9.2.6 Yahoo BOSS Mash-Up Framework 319 9.2.7 Consumer Mash-Ups and Online Tools 320 9.3 Search Technology 323 9.3.1 Google Search Tools 324 9.3.2 Yahoo Search Tools 327 9.3.3 Open Source Search Tools 328 9.4 Search-Related Engines 333 9.4.1 Microsoft Bing 333 9.4.2 Google Caffeine 335 9.4.3 Hakia 336 9.4.4 Kosmix 337 9.4.5 Yebol 337 9.5 Industry Perspective and Business Focus 338 9.5.1 Background 338 9.5.2 Mash-Ups,Web 2.0, and Beyond 339 9.5.3 Products and Resources 341 9.5.4 Implementation 343 9.5.5 Conclusions 344 9.6 Summary 345 Chapter 10 Cloud Computing Part I 347 10.1 What Is Cloud Computing? 348 10.1.1 Public, Private, and Hybrid Clouds 350 10.1.2 Questions to Ask Cloud Computing Vendors 352 10.1.3 The Software Platform Infrastructure (SPI) 353 10.2 Amazon Web Services (AWS) 356 10.2.1 Amazon EC2 357 10.2.2 Amazon S3 358 10.2.3 Amazon SimpleDB 359 XIV CONTENTS 10.2.4 Amazon CloudFront 361 10.2.5 Amazon SQS 362 10.2.6 AlexaWeb Information Service (AWIS) 362 10.2.7 Amazon Elastic Map Reduce 363 10.2.8 Creating Amazon EC2 Applications 364 10.3 IBM Cloud Labs 365 10.3.1 IBM and Amazon Partnership 366 10.4 Google App Engine (GAE) 366 10.4.1 Assessing GAE for Your Company 367 10.4.2 Upcoming GAE Features and Pricing Structure 368 10.4.3 Google Bigtable 368 10.4.4 Installing the GAE SDK for Python 370 10.4.5 A "Hello, World" Example in Python 370 10.4.6 Uploading Applications to GAE 371 10.4.7 "Fusion Tables" Database 371 10.5 Windows Azure 372 10.5.1 Windows Azure Features and .NET Services 373 10.5.2 SQL Azure 374 10.5.3 Windows Azure Development 376 10.6 Yahoo Cloud Computing 377 10.6.1 Yahoo MObStor 377 10.6.2 Yahoo Sherpa 378 10.7 Other Cloud Computing Initiatives 378 10.8 Industry Perspective 379 10.8.1 Economy of the Cloud and How to Get Started 379 10.9 Summary 384 Chapter 11 Cloud Computing Part II 385 11.1 Midsize Cloud Computing Vendors 386 11.1.1 Appistry 386 11.1.2 Engine Yard 387 11.1.3 GoGrid 388 11.1.4