Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Social mediaprogramming part2-java-jax-london


Published on

  • Be the first to comment

  • Be the first to like this

Social mediaprogramming part2-java-jax-london

  1. 1. Social Media Programming Khanderao Kand CTO GloMantra Inc mybantu virtual personalized Assistance @khanderao Nov 2, 2011 at JAX Conference, London
  2. 2. Khanderao KandCTO of Glomantra and myBantu in Silicon Valley, CA, USA AI based Relevance platform / recommendation technology with Social Intelligence Projects on Big Data, Computing, Machine Learning, Text Analytics, SOA, User Interest profiling, Yield OptimizationBIO: 20 years in Industry (currently AI, SOA, Social, Mobile and Cloud Technologies) Lead Oracle’s SOA and BPM Architecture Chief Consulting Architect for SOA and BPM to 50+ architects & hundreds of developers of Oracle’s next Generation Fusion Apps Lead Architect of Peopletools Architect in CRM, Online Dialog Marketing, OLAP Hyperion Participated in Standards of BPEL and SCA at OASIS 9 Patents filled Frequent Speaker in conferences Authored articles in JDJ, WSJ, Cloud Computing
  3. 3. AgendaAPIs, Frameworks and Tools for Social Computing: Key Technologies, APIs Interfacing with Popular Social media Storage Social Media Data Processing
  4. 4. Foundational Protocols andStandards for Social Media
  5. 5. OAuthOAuth is open standard for Authorizing Access (typically data access / actions)Oauth hands over access token and not user credentialsOauth is essential to developing social-ready applicationsOAuth protocol (Dance) involves series of 3 party (consumer browser, Service provider –Social media Site and App).OAuth, including Twitter, Facebook, LinkedIn, TripIt, and Foursquare, as well as the Googleand Yahoo APIs.Different SM supports either Oauth 1.0 and Oauth 2.0Visit : http://oauth.netAPIs: Jersery (JAX-RS), Spring Security API, Googlecode,
  6. 6. Open IDOpen ID is open source standard for multi-site authentication OpenId is for authentication as against OauthNo need of adhoc and site specific authenticationOauth and OpenID can coexistOpen ID providers : think of Google loginProviders pass ID attributes to the relying party (app)However, Oauth is more popular and common in Social MediainterfacesVisit http://www.openid.orgJava API: openid4java, GAE supports,
  7. 7. RESTRepresentational State Transfer (Roy Fielding’s paper forArchitectural Style over HTTP)Basic GET, PUT, POST, DELETE operations on a resourceInternet world REST is currently winningGoogle, Yahoo, Facebook, etc etc.Java: Jersey (JAX-RS), Restlet, RestFul Services, JAX-WS
  8. 8. JSONJavascript Simple Object Notation as lightweight datainterchange formatLighter than XMLCan be manipulated on browsersNo need for parsing into DOMhttp://www.json.orgJava API: GSON, Jackson, JSONLib, FlexJSONXML to/from JSON conversion: JSONLib
  9. 9. RSSReally Simple Syndication (originally RDF Site Summary)Started with news, site, blogs updateSimple and lightweightPopular Readers: Google Reader, Feedly etcJava API: ROME, Simple XML parsing
  10. 10. APIs of Popular Social Media
  11. 11. Facebook Graph APIRepresenting objects and relationships in Facebook’s socialnetworkSimple, consistent and REST style representationObjects: People, events, pages, and photos People: Events: Groups: Pages: Applications: Photo Albums: API:
  12. 12. Facebook Graph API: Access feed: feed (Wall): Tags: Albums: Tags: Uploads:…
  13. 13. Facebook Search using Graph APIAll public objects public posts:,122.427&distance=1000Checkins:
  14. 14. Facebook: Publishing on WallHTTP PostAccess tokencurl -F access_token=...
  15. 15. ExampleString url = ""+facebook ID+"/feed";String data = URLEncoder.encode("access_token", "UTF-8") + "=" + URLEncoder.encode(“ACCESS TOKEN STRING”, "UTF-8");data += "&" + URLEncoder.encode("message", "UTF-8") + "=" + URLEncoder.encode(“wallMessageText”, "UTF-8");data += "&" + URLEncoder.encode("picture", "UTF-8") + "=" + URLEncoder.encode(”IMAGE URL”, "UTF-8");data += "&" + URLEncoder.encode("name", "UTF-8") + "=" + URLEncoder.encode(“POST TITLE STRING”, "UTF-8");data += "&" + URLEncoder.encode("caption", "UTF-8") + "=" + URLEncoder.encode(“CAPTION STRING”, "UTF-8");data += "&" + URLEncoder.encode("description", "UTF-8") + "=" + URLEncoder.encode(“DESCRIPTION”, "UTF-8");data += "&" + URLEncoder.encode("actions", "UTF-8") + "=" + URLEncoder.encode("{"name": ”action_name", "link": ” url1"}", "UTF-8");data += "&" + URLEncoder.encode("link", "UTF-8") + "=" + URLEncoder.encode(“LINK URL”, "UTF-8");// Constructing action linksJSONObject obj = new JSONObject();LinkedHashMap<String, Object> m1 = new LinkedHashMap<String, Object>();m1.put("text“,”LINK1 TEXT”);m1.put("href", “ action url1”);obj.put(”LINK1 LABEL”, m1);
  16. 16. TwitterTwitter is ranked as one of the ten-most-visited websitesworldwide by Alexas web traffic analysis.March 2010 10 billionth tweetTwitter has a user retention rate of forty percent.Value: Conversational 30%, Pointless Babble 30%, Promotion8%, News 8%, news 7-8% and spamGood source: news validation, trend, topic updates
  17. 17. Twitter Usage"Twitter Revolutions" and which include the 2011 Egyptianrevolution, 2010–2011 Tunisian protests, 2009–2010 Iranian electionprotests, and 2009 Moldova civil unrestTwitter is also increasingly used for making TV more interactive andsocialMost of the celebrities are on TwitterPresident Obama and many others effectively used Twitter forcampaigningTwitter has become a great source for latest newsTwitter is an indicator for buzz around latest topics and trendsBrands are using twitters for promotions of products and spreadingdeals
  18. 18. 3rd party Twitter Java APIsTwitter4J : Open Source BSDJava-TwitterJtwitter : Open SourceTwitter Client Streaming API
  19. 19. TwitterTwitter API allows to Tweet Direct message Search Get tweets
  20. 20. Twitter4J API Twitter4J (third party – open source) Access token / consumer key in twitter.propertiesTwitter twitter = new TwitterFactory().getInstance();Query query = new Query(”mybantu");QueryResult result =;// uodate statusStatus status = twitter.updateStatus(latestStatus);
  21. 21. Twitter Fire hoseGNIP 50% at approximately 360K per year For analysis but not for resale or display tweetsSpritzer 2% random for free
  22. 22. Open Social Project"For the question about Google plans to allow developers tocreate Google+ apps deploying the OpenSocial APIs, aspokeswoman of Google said that by means of email nowadaysthe Google+ platform can’t support the OpenSocial APIs.She also added that nevertheless, they are utilizing many of thetechnology which was designed as part of OpenSocial, along withthe gadget application packaging model, and power Google+games and the Portable Contacts JSON schema. Because theydefine the +Platform APIs, they are drawing close attention to thefuture tendency of the OpenSocial APIs, as well as convergingeverything possible."
  23. 23. Developing Social NetworkApache Opensource project in incubation Shindig
  24. 24. Open SocialGreat initiative with huge promise A common “open source” API for social media launched in 2007 Early movers as open social containers: Google Orkut, hi5, LinkedIn, MySpace, Netlog, Ning, orkut, and Yahoo! Opensource OpenSocial Based container : Apache ShindigBummer… Except Facebook Google+ is not yet committed to Open Social
  25. 25. Google Social Graph APIBy supporting open Web standardsfor describing connections betweenpeople, web sites can add to thesocial infrastructure of the webThe API returns web addresses ofpublic pages and publicly declaredconnections between them.Allows developers to create a buttonfor a Web site that would allow aregistered user to easily "addfriends.”index the public Web for Friends of AFriend (FOAF) and Friends Network
  26. 26. Google’s Public Social Graph The Social Graph API looks for two types of publicly declared connections:1. It looks for all public URLs that belong to you and are interconnected. This could be your blog (a1), your LiveJournal page (a2), and your Twitter account (a3).2. It looks for publicly declared connections between people. For example, a1 may link to bs blog while a1 and c link to each other.
  27. 27. Google+ API Public postsGET[yourAPIKey]People SearchGET[yourAPIKey]View People Interacting with PostsGET{activityId}/people/resharers?key=[yourAPIKey] GET{activityId}/people/plusoners?key=[yourAPIKey]
  28. 28. Spring SocialSpring Social provides templates for REST based API handling OAUth and providing operations specific to Social Media TwitterTemplate FacebookTemplate LinkedInTemplate TripItTemplate applications/
  29. 29. Technologies for BuildingApplications on Social Media
  30. 30. Social Media Data Often Needs Different Type of Database Social Media Contains: Huge Data, Often available via JSON, XML , RSSRequires different type of DBs…. Couch DB MongoDB Cassandra Hbase Neo4J Hadoop for Big Data Processing
  31. 31. CouchDB MongoDBData Model Document Oriented Document OrientedData Format JSON BSONInterface REST TCP/IPQuery MapReduce Java Script Jmap Reduce ava Script + QueryFault Tolerance Master Master Master SlaveConcurrency MVCC (Versioning) Updates in placePerformance Comparatively lower Higher
  32. 32. Dealing with Big Data Cassandra HBaseType Column DB Colletcion- column DBType Big Table Big TableProtocol Binary (Thrift) Binary (Thrift) HTTP/RESTMap Reduce Via Hadoop Via Hadoop
  33. 33. Disclaimer and Request1. The presentation though quotes examples of my Company and products, the presentation is based on myknowledge and experience and my company is not liable.2. Attributed to most of the known source, if any attribution is missing, it is not due to intention but might not havegot the information of the original source or might be be negligence in my due diligence. It can be corrected if youcontact3. Feel free to share some / all content however please attribute to Khanderao Kand4. Social Media Networks mentioned in the presentation are more foe example but the approach is applicable to mostof all other social media and there is no intention to promote / discourage any media5. User usage data and financial numbers are dated and would be stale / outdated over a period of time. You mayneed to look for the latest data.6. APIs , tools and libraries are third party and not from me / my company. Though they are listed based on myexperience and knowledge, use them at your risk.7. We have products in Social Commerce, Social CRM, and recommendation. We also take projects around the spaceand can be done outsource / jointly if interested in.Contact : or Twitter @khanderaoFor original Slide deck (ppt) feel free to contact.
  34. 34. Q&A