SlideShare a Scribd company logo
OPENSOCIAL
     CODELAB

PIETER DE SCHEPPER
Web Developer - Netlog

JOCHEN DELABIE
Web Developer - Netlog


CHEWY TREWHELLA
Developer Advocate - Google
Getting Started



• Text Editor or Google Gadget Editor
• Web Hosting or built-in hosting from Google
  Gadget Editor
• You need a Netlog Account
• You can start developing in the Netlog
  Sandbox
Netlog Sandbox

http://en.netlog.com/go/developer/opensocial/
sandbox
Gadget Basics


Hello World example
<?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?>
<Module>
	 <ModulePrefs title=quot;Hello Worldquot; author=quot;Pieter De
Schepperquot; author_email=quot;pieter@netlog.comquot;>
	 	 <Require feature=quot;opensocial-0.8quot;/>
	 </ModulePrefs>
	 <Content type=quot;htmlquot;>
	 	 <![CDATA[
	 	 	 Hello World!
	 	 ]]>
	 </Content>
</Module>
Gadget Basics

•    <Module>   implies that the XML describes a gadget
•    <ModulePrefs>contains information about the
     gadget, its author and its basic characteristics
•                                   specifies to the
     <Require feature=quot;opensocial-0.8quot;/>

     container to load a certain feature, in this case
     opensocial 0.8
•                       indicates that the gadget’s
     <Content type=quot;htmlquot;>

     content type is html
•                contains all HTML, CSS, JavaScript
     <![CDATA[...]]

     that makes the gadget to what it is
Writing your first Social Gadget



Request Friends of viewer
function loadFriends()
{
	   var req = opensocial.newDataRequest();
	   req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer');
	   	    	   	   	
	   var viewerFriends = opensocial.newIdSpec({ quot;userIdquot; : quot;VIEWERquot;, quot;groupIdquot; : quot;FRIENDSquot; });
	   var opt_params = {};
	   opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100;
	   req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends');
	   	    	   	   	
	   req.send(onLoadFriends);
}

function init()
{
	   loadFriends();
}
	   	    	   	
gadgets.util.registerOnLoadHandler(init);
Writing your first Social Gadget



Handling the data
function onLoadFriends(data)
{
	    var viewer = data.get('viewer').getData();
	    var viewerFriends = data.get('viewerFriends').getData();
	
	    var html = new Array();
	    html.push('Friends of ' + viewer.getDisplayName());
   	 html.push('<ul>');
   	 viewerFriends.each(function(person)
   	 {
   	 	   if (person.getId())
   	 	   {
   	 	   	    html.push('<li>' + person.getDisplayName() + quot;</li>quot;);
  	 	    }
   	 });
   	 html.push('</ul>');
   	 document.getElementById('friends').innerHTML = html.join('');
}
Using App Data



Saving App Data
function saveScore(score)
{
	   var req = opensocial.newDataRequest();
	   req.add(req.newUpdatePersonAppDataRequest(quot;VIEWERquot;, 'score', score));
	   req.send(onSaveScore);
}

function onSaveScore(data)
{
	   if(!data.hadError())
	   {
	   	    alert(quot;Score saved!quot;);
	   }
}
Using App Data



Retrieving App Data
function getScore()
{
	   var req = opensocial.newDataRequest();
	   var viewer = opensocial.newIdSpec({ quot;userIdquot; : quot;VIEWERquot; });
	   req.add(req.newFetchPersonRequest(quot;VIEWERquot;), 'viewer');
	   req.add(req.newFetchPersonAppDataRequest(viewer, 'score'), 'data');
	   req.send(onGetScore);
}

function onGetScore(data)
{
	   var viewer = data.get('viewer').getData();
	   var data = data.get('data').getData();
	   document.getElementById('score').innerHTML = quot;Your current score is quot; +
	   	    data[viewer.getId()]['score'];
}
Creating activity



Creating activity
function createActivity(score)
{
	   var activityParams = {};
	   activityParams[opensocial.Activity.Field.TITLE] = quot;got a new highscore!quot;;
	   activityParams[opensocial.Activity.Field.BODY] = quot;The score was quot; + score;

	   var activity = opensocial.newActivity(activityParams);
	   opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH,
onCreateActivity);
}

function onCreateActivity(data)
{
	   if(!data.hadError())
	   {
	   	    alert(quot;Activity created!quot;);
	   }
}
Sending notifications



Sending notifications
function sendNotification(toUserID, fromName)
{
	   var recipients = [toUserID];
	   var msg = fromName + quot; has challenged you to a game of pokerquot;;
	   var params = {};
	   params[opensocial.Message.Field.TYPE] = opensocial.Message.Type.NOTIFICATION;
	   var message = opensocial.newMessage(msg, params);
	   opensocial.requestSendMessage(recipients, message);
}
Making use of views


<?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?>
<Module>
	   <ModulePrefs title=quot;Viewsquot; author=quot;Pieter De Schepperquot; author_email=quot;pieter@netlog.comquot;>
	   	    <Require feature=quot;opensocial-0.8quot;/>
	   	    <Require feature=quot;viewsquot;/>
	   </ModulePrefs>
	   <Content type=quot;htmlquot; view=quot;canvasquot;>
	   	    <![CDATA[
	   	    Hello Canvas!<br/>
	   	    <a href=quot;#quot; onclick=quot;gadgets.views.requestNavigateTo('profile')quot;>To profile view</a>
	   	    ]]>
	   </Content>
	   <Content type=quot;htmlquot; view=quot;profilequot;>
	   	    <![CDATA[
	   	    Hello Profile!<br/>
	   	    <a href=quot;#quot; onclick=quot;gadgets.views.requestNavigateTo('canvas')quot;>To canvas view</a>
	   	    ]]>
	   </Content>
</Module>
Other features



• Content requests
• requestShareApp
• Dynamic height
• Netlog extensions
Usefull links


•   Netlog OpenSocial
    http://en.netlog.com/go/developer/opensocial

•   Netlog Sandbox
    http://en.netlog.com/go/developer/opensocial/sandbox

•   OpenSocial reference
    http://code.google.com/apis/opensocial/docs/index.html

•   Gadget reference
    http://code.google.com/apis/gadgets/devguide_landing.html

•   OpenSocial Tutorial
    http://wiki.opensocial.org/index.php?title=OpenSocial_Tutorial

More Related Content

What's hot

OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
Pamela Fox
 
jQuery Presentation to Rails Developers
jQuery Presentation to Rails DevelopersjQuery Presentation to Rails Developers
jQuery Presentation to Rails Developers
Yehuda Katz
 
22 j query1
22 j query122 j query1
22 j query1
Fajar Baskoro
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
Pedro Morais
 
Java script programs
Java script programsJava script programs
Java script programs
ITz_1
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
Morteza Zohoori Shoar
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
fishwarter
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
Stijn Van Minnebruggen
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
nicdev
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
Brajesh Yadav
 
Soa lab 3
Soa lab 3Soa lab 3
Soa lab 3
goldenrajan
 
JavaScript Training
JavaScript TrainingJavaScript Training
JavaScript Training
Ramindu Deshapriya
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To Practice
Sergey Bolshchikov
 
Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on RailsBoston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
John Brunswick
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
Martin Rehfeld
 
Web Automation Testing Using Selenium
Web Automation Testing Using SeleniumWeb Automation Testing Using Selenium
Web Automation Testing Using Selenium
Pete Chen
 
Jaoo - Open Social A Standard For The Social Web
Jaoo - Open Social A Standard For The Social WebJaoo - Open Social A Standard For The Social Web
Jaoo - Open Social A Standard For The Social Web
Patrick Chanezon
 
Local SQLite Database with Node for beginners
Local SQLite Database with Node for beginnersLocal SQLite Database with Node for beginners
Local SQLite Database with Node for beginners
Laurence Svekis ✔
 
Speed is a feature PyConAr 2014
Speed is a feature PyConAr 2014Speed is a feature PyConAr 2014
Speed is a feature PyConAr 2014
Pablo Mouzo
 
Shaping up with angular JS
Shaping up with angular JSShaping up with angular JS
Shaping up with angular JS
Brajesh Yadav
 

What's hot (20)

OpenSocial Intro
OpenSocial IntroOpenSocial Intro
OpenSocial Intro
 
jQuery Presentation to Rails Developers
jQuery Presentation to Rails DevelopersjQuery Presentation to Rails Developers
jQuery Presentation to Rails Developers
 
22 j query1
22 j query122 j query1
22 j query1
 
Taking Web Apps Offline
Taking Web Apps OfflineTaking Web Apps Offline
Taking Web Apps Offline
 
Java script programs
Java script programsJava script programs
Java script programs
 
Why Django for Web Development
Why Django for Web DevelopmentWhy Django for Web Development
Why Django for Web Development
 
The Django Web Application Framework 2
The Django Web Application Framework 2The Django Web Application Framework 2
The Django Web Application Framework 2
 
jQuery basics
jQuery basicsjQuery basics
jQuery basics
 
5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter5 Reasons To Love CodeIgniter
5 Reasons To Love CodeIgniter
 
AngularJS Introduction
AngularJS IntroductionAngularJS Introduction
AngularJS Introduction
 
Soa lab 3
Soa lab 3Soa lab 3
Soa lab 3
 
JavaScript Training
JavaScript TrainingJavaScript Training
JavaScript Training
 
Web Projects: From Theory To Practice
Web Projects: From Theory To PracticeWeb Projects: From Theory To Practice
Web Projects: From Theory To Practice
 
Boston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on RailsBoston Computing Review - Ruby on Rails
Boston Computing Review - Ruby on Rails
 
Rails GUI Development with Ext JS
Rails GUI Development with Ext JSRails GUI Development with Ext JS
Rails GUI Development with Ext JS
 
Web Automation Testing Using Selenium
Web Automation Testing Using SeleniumWeb Automation Testing Using Selenium
Web Automation Testing Using Selenium
 
Jaoo - Open Social A Standard For The Social Web
Jaoo - Open Social A Standard For The Social WebJaoo - Open Social A Standard For The Social Web
Jaoo - Open Social A Standard For The Social Web
 
Local SQLite Database with Node for beginners
Local SQLite Database with Node for beginnersLocal SQLite Database with Node for beginners
Local SQLite Database with Node for beginners
 
Speed is a feature PyConAr 2014
Speed is a feature PyConAr 2014Speed is a feature PyConAr 2014
Speed is a feature PyConAr 2014
 
Shaping up with angular JS
Shaping up with angular JSShaping up with angular JS
Shaping up with angular JS
 

Similar to Opensocial Codelab

Open Selector
Open SelectorOpen Selector
Open Selector
jjdelc
 
Google Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocialGoogle Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocial
Patrick Chanezon
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
Ignacio Coloma
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
borkweb
 
Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and Dashboards
Atlassian
 
OpenSocial - GTUG Stockholm Meeting Oct 1 2009
OpenSocial - GTUG Stockholm Meeting Oct 1 2009OpenSocial - GTUG Stockholm Meeting Oct 1 2009
OpenSocial - GTUG Stockholm Meeting Oct 1 2009
Jacob Gyllenstierna
 
Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008
Rob
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
Wen-Tien Chang
 
Django - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazosDjango - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazos
Igor Sobreira
 
Hi5 Opensocial Code Lab Presentation
Hi5 Opensocial Code Lab PresentationHi5 Opensocial Code Lab Presentation
Hi5 Opensocial Code Lab Presentation
plindner
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
IndicThreads
 
Ajax ons2
Ajax ons2Ajax ons2
Ajax ons2
Chad Davis
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
Carles Farré
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
ipolevoy
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
Sven Haiges
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
Eric Steele
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)
Pamela Fox
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
Matthew Turland
 
IBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileIBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for Mobile
Chris Toohey
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
Ory Segal
 

Similar to Opensocial Codelab (20)

Open Selector
Open SelectorOpen Selector
Open Selector
 
Google Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocialGoogle Devfest Singapore - OpenSocial
Google Devfest Singapore - OpenSocial
 
Developing and testing ajax components
Developing and testing ajax componentsDeveloping and testing ajax components
Developing and testing ajax components
 
Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2Javascript: Ajax & DOM Manipulation v1.2
Javascript: Ajax & DOM Manipulation v1.2
 
Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and Dashboards
 
OpenSocial - GTUG Stockholm Meeting Oct 1 2009
OpenSocial - GTUG Stockholm Meeting Oct 1 2009OpenSocial - GTUG Stockholm Meeting Oct 1 2009
OpenSocial - GTUG Stockholm Meeting Oct 1 2009
 
Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008Rugalytics | Ruby Manor Nov 2008
Rugalytics | Ruby Manor Nov 2008
 
Building Web Interface On Rails
Building Web Interface On RailsBuilding Web Interface On Rails
Building Web Interface On Rails
 
Django - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazosDjango - Framework web para perfeccionistas com prazos
Django - Framework web para perfeccionistas com prazos
 
Hi5 Opensocial Code Lab Presentation
Hi5 Opensocial Code Lab PresentationHi5 Opensocial Code Lab Presentation
Hi5 Opensocial Code Lab Presentation
 
Migration testing framework
Migration testing frameworkMigration testing framework
Migration testing framework
 
Ajax ons2
Ajax ons2Ajax ons2
Ajax ons2
 
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
[DSBW Spring 2009] Unit 07: WebApp Design Patterns & Frameworks (3/3)
 
ActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group PresentationActiveWeb: Chicago Java User Group Presentation
ActiveWeb: Chicago Java User Group Presentation
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Plone Interactivity
Plone InteractivityPlone Interactivity
Plone Interactivity
 
Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)Gadgets Intro (Plus Mapplets)
Gadgets Intro (Plus Mapplets)
 
Web Scraping with PHP
Web Scraping with PHPWeb Scraping with PHP
Web Scraping with PHP
 
IBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for MobileIBM Lotus Notes Domino XPages and XPages for Mobile
IBM Lotus Notes Domino XPages and XPages for Mobile
 
Client-side JavaScript Vulnerabilities
Client-side JavaScript VulnerabilitiesClient-side JavaScript Vulnerabilities
Client-side JavaScript Vulnerabilities
 

Recently uploaded

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
Matthew Sinclair
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
Octavian Nadolu
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Albert Hoitingh
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
sonjaschweigert1
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 

Recently uploaded (20)

Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
20240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 202420240607 QFM018 Elixir Reading List May 2024
20240607 QFM018 Elixir Reading List May 2024
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Artificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopmentArtificial Intelligence for XMLDevelopment
Artificial Intelligence for XMLDevelopment
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024
 
A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...A tale of scale & speed: How the US Navy is enabling software delivery from l...
A tale of scale & speed: How the US Navy is enabling software delivery from l...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 

Opensocial Codelab

  • 1. OPENSOCIAL CODELAB PIETER DE SCHEPPER Web Developer - Netlog JOCHEN DELABIE Web Developer - Netlog CHEWY TREWHELLA Developer Advocate - Google
  • 2. Getting Started • Text Editor or Google Gadget Editor • Web Hosting or built-in hosting from Google Gadget Editor • You need a Netlog Account • You can start developing in the Netlog Sandbox
  • 4. Gadget Basics Hello World example <?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?> <Module> <ModulePrefs title=quot;Hello Worldquot; author=quot;Pieter De Schepperquot; author_email=quot;pieter@netlog.comquot;> <Require feature=quot;opensocial-0.8quot;/> </ModulePrefs> <Content type=quot;htmlquot;> <![CDATA[ Hello World! ]]> </Content> </Module>
  • 5. Gadget Basics • <Module> implies that the XML describes a gadget • <ModulePrefs>contains information about the gadget, its author and its basic characteristics • specifies to the <Require feature=quot;opensocial-0.8quot;/> container to load a certain feature, in this case opensocial 0.8 • indicates that the gadget’s <Content type=quot;htmlquot;> content type is html • contains all HTML, CSS, JavaScript <![CDATA[...]] that makes the gadget to what it is
  • 6. Writing your first Social Gadget Request Friends of viewer function loadFriends() { var req = opensocial.newDataRequest(); req.add(req.newFetchPersonRequest(opensocial.IdSpec.PersonId.VIEWER), 'viewer'); var viewerFriends = opensocial.newIdSpec({ quot;userIdquot; : quot;VIEWERquot;, quot;groupIdquot; : quot;FRIENDSquot; }); var opt_params = {}; opt_params[opensocial.DataRequest.PeopleRequestFields.MAX] = 100; req.add(req.newFetchPeopleRequest(viewerFriends, opt_params), 'viewerFriends'); req.send(onLoadFriends); } function init() { loadFriends(); } gadgets.util.registerOnLoadHandler(init);
  • 7. Writing your first Social Gadget Handling the data function onLoadFriends(data) { var viewer = data.get('viewer').getData(); var viewerFriends = data.get('viewerFriends').getData(); var html = new Array(); html.push('Friends of ' + viewer.getDisplayName()); html.push('<ul>'); viewerFriends.each(function(person) { if (person.getId()) { html.push('<li>' + person.getDisplayName() + quot;</li>quot;); } }); html.push('</ul>'); document.getElementById('friends').innerHTML = html.join(''); }
  • 8. Using App Data Saving App Data function saveScore(score) { var req = opensocial.newDataRequest(); req.add(req.newUpdatePersonAppDataRequest(quot;VIEWERquot;, 'score', score)); req.send(onSaveScore); } function onSaveScore(data) { if(!data.hadError()) { alert(quot;Score saved!quot;); } }
  • 9. Using App Data Retrieving App Data function getScore() { var req = opensocial.newDataRequest(); var viewer = opensocial.newIdSpec({ quot;userIdquot; : quot;VIEWERquot; }); req.add(req.newFetchPersonRequest(quot;VIEWERquot;), 'viewer'); req.add(req.newFetchPersonAppDataRequest(viewer, 'score'), 'data'); req.send(onGetScore); } function onGetScore(data) { var viewer = data.get('viewer').getData(); var data = data.get('data').getData(); document.getElementById('score').innerHTML = quot;Your current score is quot; + data[viewer.getId()]['score']; }
  • 10. Creating activity Creating activity function createActivity(score) { var activityParams = {}; activityParams[opensocial.Activity.Field.TITLE] = quot;got a new highscore!quot;; activityParams[opensocial.Activity.Field.BODY] = quot;The score was quot; + score; var activity = opensocial.newActivity(activityParams); opensocial.requestCreateActivity(activity, opensocial.CreateActivityPriority.HIGH, onCreateActivity); } function onCreateActivity(data) { if(!data.hadError()) { alert(quot;Activity created!quot;); } }
  • 11. Sending notifications Sending notifications function sendNotification(toUserID, fromName) { var recipients = [toUserID]; var msg = fromName + quot; has challenged you to a game of pokerquot;; var params = {}; params[opensocial.Message.Field.TYPE] = opensocial.Message.Type.NOTIFICATION; var message = opensocial.newMessage(msg, params); opensocial.requestSendMessage(recipients, message); }
  • 12. Making use of views <?xml version=quot;1.0quot; encoding=quot;UTF-8quot; ?> <Module> <ModulePrefs title=quot;Viewsquot; author=quot;Pieter De Schepperquot; author_email=quot;pieter@netlog.comquot;> <Require feature=quot;opensocial-0.8quot;/> <Require feature=quot;viewsquot;/> </ModulePrefs> <Content type=quot;htmlquot; view=quot;canvasquot;> <![CDATA[ Hello Canvas!<br/> <a href=quot;#quot; onclick=quot;gadgets.views.requestNavigateTo('profile')quot;>To profile view</a> ]]> </Content> <Content type=quot;htmlquot; view=quot;profilequot;> <![CDATA[ Hello Profile!<br/> <a href=quot;#quot; onclick=quot;gadgets.views.requestNavigateTo('canvas')quot;>To canvas view</a> ]]> </Content> </Module>
  • 13. Other features • Content requests • requestShareApp • Dynamic height • Netlog extensions
  • 14. Usefull links • Netlog OpenSocial http://en.netlog.com/go/developer/opensocial • Netlog Sandbox http://en.netlog.com/go/developer/opensocial/sandbox • OpenSocial reference http://code.google.com/apis/opensocial/docs/index.html • Gadget reference http://code.google.com/apis/gadgets/devguide_landing.html • OpenSocial Tutorial http://wiki.opensocial.org/index.php?title=OpenSocial_Tutorial

Editor's Notes