ebook img

Assemble the social web with zembly PDF

393 Pages·7.481 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Assemble the social web with zembly

Assemble the Social Web with zembly This page intentionally left blank Assemble the Social Web with zembly GAIL ANDERSON AND PAUL ANDERSON WITH TODD FAST AND CHRIS WEBSTER Upper Saddle River, NJ • Boston • Indianapolis • San Francisco New York • Toronto • Montreal • London • Munich • Paris • Madrid Capetown • Sydney • Tokyo • Singapore • Mexico City Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and the publisher was aware of a trademark claim, the designations have been printed with initial capital letters or in all capitals. Sun Microsystems, Inc. has intellectual property rights relating to implementations of the technology described in this publication. In particular, and without limitation, these intellectual property rights may include one or more U.S. pat- ents, foreign patents, or pending applications. Sun, Sun Microsystems, the Sun logo, J2ME, J2EE, Java Card, and all Sun and Java based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc., in the United States and other countries. UNIX is a registered trademark in the United States and other countries, exclusively licensed through X/Open Company, Ltd. THIS PUBLICATION IS PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. THIS PUBLICATION COULD INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS. CHANGES ARE PERIODICALLY ADDED TO THE INFORMA- TION HEREIN; THESE CHANGES WILL BE INCORPORATED IN NEW EDITIONS OF THE PUBLICATION. SUN MICROSYSTEMS, INC. MAY MAKE IMPROVEMENTS AND/OR CHANGES IN THE PRODUCT(S) AND/OR THE PROGRAM(S) DESCRIBED IN THIS PUBLICATION AT ANY TIME. The authors and publisher have taken care in the preparation of this book, but make no expressed or implied war- ranty of any kind and assume no responsibility for errors or omissions. No liability is assumed for incidental or conse- quential damages in connection with or arising out of the use of the information or programs contained herein. The publisher offers excellent discounts on this book when ordered in quantity for bulk purchases or special sales, which may include electronic versions and/or custom covers and content particular to your business, training goals, marketing focus, and branding interests. For more information, please contact: U.S. Corporate and Government Sales, (800) 382-3419, [email protected]. For sales outside the United States please contact: International Sales, [email protected]. Library of Congress Control Number: 2008941460 Copyright © 2009 Sun Microsystems, Inc. 4150 Network Circle, Santa Clara, California 95054 U.S.A. All rights reserved. Printed in the United States of America. This publication is protected by copyright, and permission must be obtained from the publisher prior to any prohibited reproduction, storage in a retrieval system, or transmission in any form or by any means, electronic, mechanical, photocopying, recording, or likewise. For information regarding permissions, write to: Pearson Education, Inc., Rights and Contracts Department, 501 Boylston Street, Suite 900, Boston, MA 02116, Fax: (617) 671-3447. ISBN-13: 978-0-13-714431-0 ISBN-10: 0-13-714431-8 Text printed in the United States on recycled paper at Courier in Stoughton, Massachusetts. First printing December 2008 Contents Preface xiii Acknowledgments xvii Chapter 1 What Is zembly? 1 1.1 Social Programming 2 1.2 zembly’s Environment 4 1.3 zembly’s Audience 6 1.4 Publishing and Scaling with zembly 7 1.5 Monetizing with zembly 8 1.6 Coming to zembly Soon 8 Meebo 8 OpenSocial 8 Scripting Languages 9 A Final Thought 9 Chapter 2 zembly Basics 11 What You Will Learn 12 Examples in This Chapter 12 2.1 Exploring the Samples 13 Using Clone 15 Widget Actions 16 Tags on zembly 16 AmazonProductSearchWidget—Widget Preview 17 Embedding AmazonProductSearchWidget 18 Sharing Your Widgets with Clearspring 19 v vi Contents 2.2 About You—Your Home Page 20 Your Profile 21 People—Adding Contacts 22 2.3 Your Keychain and Service Providers 24 2.4 Creating Your First Service: LoanPaymentService 25 Specifying Parameters in a Service 27 Error Handling 29 Testing LoanPaymentService 30 Capturing Example Return Data 30 Saving Drafts 31 Using the JavaScript Editor 31 Publishing LoanPaymentService 32 Calling LoanPaymentService 32 2.5 Creating Your First Widget: LoanPaymentWidget 34 Uploading an Image 36 Including Library Prototype JS 37 Building LoanPaymentWidget 38 Using CSS for Styling 38 Calling LoanPaymentService in Your Widget 39 Previewing and Publishing 41 Embedding LoanPaymentWidget 42 2.6 Drafts, Versions, and Timelines 42 Edit History 42 Viewing Versions 44 Online/Offline Status 44 2.7 Putting It All Together—Using the WeatherBug API 45 Using Your Keychain 46 Building WeatherBugService 47 Using E4X and JavaScript 48 Calling WeatherBugService 50 Building WeatherBugWidget 51 Chapter 3 Building Flickr Widgets 55 What You Will Learn 55 Examples in This Chapter 56 Contents vii 3.1 Using Flickr 56 3.2 Building a Slide Show Widget 57 Looking at the Source 59 Using CSS Styles 59 Working with JavaScript 61 Sharing Your Widget 66 Embedding Your Widget in a Web Page 67 3.3 Building a Service for Your Flickr Photos 67 Getting a Flickr Application Key 68 Creating Service FlickrPeopleService 68 Using Find & Use to Add JavaScript 69 Testing and Publishing 71 3.4 Creating a Flickr User Slide Show Widget 71 Specifying Widget Parameters When You Embed 72 Creating Widget MyFlickrRandomSlideshow 73 Reusing JavaScript Code 74 Chapter 4 Building Zillow Widgets 79 What You Will Learn 79 Examples in This Chapter 80 4.1 Using Zillow 80 4.2 Building a Zillow Service 82 Obtaining a Zillow API Key 82 Zillow Property IDs 82 Building a Zillow-based Service with Parameters 83 Using E4X and JavaScript 84 4.3 Building a Zillow Widget 88 Creating RecentSalesWidget 89 Embedding RecentSalesWidget 92 4.4 Building a Google Maps Mashup 92 Exploring Google Maps API 93 Designing Widget RecentSalesMashup 94 Creating Widget RecentSalesMashup 95 viii Contents Chapter 5 Facebook Basics 101 What You Will Learn 101 Examples in This Chapter 102 The New Facebook Design 102 5.1 About Facebook 103 What Is a Facebook Application? 103 Canvas Page 104 The Facebook User 105 Friends 105 Your Profile 105 Applications and Application Settings 106 Profile Boxes 108 Left-Hand Column 109 Application Tabs 110 Application Access 111 Email and Notices 112 Story Types and News Feed Templates 112 Profile Publisher 113 Application Info Sections 114 5.2 Creating a Facebook Application 114 Facebook Application Wizard 115 Core Services and Widgets 120 5.3 Loan Calculator—Your First Facebook Application 121 Deleting Home and Creating a New Widget 121 Editing Widget Home (NewWidget) 122 Uploading Resource Image 123 Including Library Prototype JS 124 Previewing and Publishing Widget Home 124 Configuring Home 124 Running Your Application in Facebook 125 Facebook Application Defaults 126 Enhancing Your Application on Facebook 127 Making Your Application Accessible 129 5.4 zembly and Facebook—A Closer Look 130 Exploring the Facebook APIs 131 Facebook Code Testing Tools 133 Contents ix Application Context and Permissions 134 Controlling the Allow Access Process 136 5.5 BuddyPics—Using FBML and FBJS 137 FBML Overview 138 The BuddyPics Application 139 Adding Content to Your Profile 141 Building the BuddyPics Facebook Application 141 Creating Dynamic Content with FBML 142 BuddyPics Home Widget (FBML) 143 Service GetFriendInfo 153 Testing a Facebook Service 155 Service UpdateProfileBox 157 Summary of Differences with FBML Widgets 158 The HTML Alternative 160 What’s Next 160 Chapter 6 Facebook Integration 161 What You Will Learn 162 Examples in This Chapter 162 6.1 Capital Punishment—A Challenging Facebook Application 162 Cloning the Facebook Application 164 The Capital Punishment Home Widget 164 Service UpdateProfileBox 181 Publishing Feed Stories 182 Sending Challenge Invitations 186 Application FriendChooser 191 6.2 Using the Facebook Data Store and FQL 191 Facebook Data Store Model 192 Data Model for Capital Punishment 193 Facebook Data Store Admin Tool 193 Service CreateDataStore 196 Service SaveScore 198 Using FQL with DataStoreAdmin 199 Services FBMLGetMyScores and FBMLGetFriendScores 201 Service DeleteScore 204 Widget SeeScores 205

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.