<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>.larre &#187; programming</title> <atom:link href="http://www.larre.com/category/programming/feed/" rel="self" type="application/rss+xml" /><link>http://www.larre.com</link> <description>technology, innovation and media</description> <lastBuildDate>Fri, 29 Jan 2010 21:26:46 +0000</lastBuildDate> <generator>http://wordpress.org/?v=2.8.6</generator> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <item><title>Reflections after having implemented Facebook Connect and Google Friend Connect on my blog</title><link>http://www.larre.com/2008/12/18/reflections-after-having-implemented-facebook-connect-and-google-friend-connect-on-my-blog/</link> <comments>http://www.larre.com/2008/12/18/reflections-after-having-implemented-facebook-connect-and-google-friend-connect-on-my-blog/#comments</comments> <pubDate>Thu, 18 Dec 2008 21:25:54 +0000</pubDate> <dc:creator>larre</dc:creator> <category><![CDATA[programming]]></category> <category><![CDATA[web2.0]]></category> <category><![CDATA[facebook]]></category> <category><![CDATA[facebook api]]></category> <category><![CDATA[facebook connect]]></category> <category><![CDATA[google]]></category> <category><![CDATA[google friend connect]]></category> <category><![CDATA[opensocial]]></category> <category><![CDATA[portability]]></category> <category><![CDATA[social]]></category><guid
isPermaLink="false">http://www.larre.com/?p=136</guid> <description><![CDATA[This year there have been some developments related to the challenges we have with many different and closed social networks.  Facebook, MySpace,  Reunion, LinkedIn, Xing and many many more gives me a headache. There are several problems and challenges related to your identity online and technologies that make up the &#8216;Open Stack&#8217; like [...]]]></description> <content:encoded><![CDATA[<p><img
hspace="10" align="left" class="size-full wp-image-141" title="lastvisitors" src="http://static.larre.com/blog/wp-content/uploads/2008/12/lastvisitors.jpg" alt="Facebook Connect" width="191" height="149" />This year there have been some developments related to the challenges we have with many different and closed social networks.  Facebook, MySpace,  Reunion, LinkedIn, Xing and many many more gives me a headache. There are several problems and challenges related to your identity online and technologies that make up the &#8216;Open Stack&#8217; like OpenSocial, PortableContacts, OAuth, XRDS-Simple and OpenID is designed to resolve this. I think that &#8216;Open&#8217; has had quit a lot of attention this year.</p><p><strong>Log in with your preferred identity on the web</strong><br
/> If you are active and comment much on articles, blogs etc, the problem is to appear with one single identity. Lately both Facebook and Google has launched technologies (among others like MySpace)  that enables us to take our identity with us around the web for all sites implementing this functionality. This is a great step forward for social data portability.  My blog now supports both Facebook Connect and Google Friend Connect. What does this mean? First of all this means that you have the ability to log in to my site with your preferred identity. This could be Facebook account, Google account, OpenID account, Yahoo account, or AIM account. If you leave a comment on one of my post you will be identified with this account.  <a
href="http://mashable.com/2008/12/11/facebook-connect-blog/">Her is a great video</a> from the guys at Facebook showing how to implement Facebook Connect on your blog or site.</p><p><strong>Critical mass</strong><br
/> For me as a user it is great to be able to hook my identity (for example my OpenID account) on to websites where I leave a comment.  The ability to log in to a new site or register as a new user and only use a button like Facebook Connect is fantastic. It is easy, convenient and lays the foundation for new social services. <a
href="http://www.triptelevision.com/clip.php?id=265">TripAdvisor did not manage to success</a> with their restaurant reviews until they hooked up with Facebook. The problem for them relates to critical mass.  They created a Facebook Application (LocalPick) and experienced a tremendous success</p><p><strong>What is the long term implications?</strong><br
/> If we look beyond blogs all sites that utilizes user generated content like reviews, ratings and so forth should be able to make use of the ongoing social data portability trend. In fact this trend should be perfect in the critical mass perspective. When I look at TripAdvisor today, they have not yet implemented the ability for users to log in with their preferred identity and use that ID to interact with the site.</p><p>For the companies that wins the battle over your identity this should give enormous opportunities. Who will win this race? Facebook, Google, MySpace? I don&#8217;t know. Imagine that on 90% of all sites (blogs, magazines, news, classifieds&#8230;) all the user generated content, like reviews, ratings, comments or listings comes through Facebook or Googles identity. This should give them a possibility to among other things further develop their ad-systems. They may utilize all the information and statistics that the users give them through their use of the web! <a
href="http://www.techcrunch.com/2008/12/16/soon-all-your-blog-comments-will-belong-to-facebook-or-google/">Here is a great article at TechCrunch</a> that reflects some of this thoughts.</p><p><strong>Remark about Google Friend Connect</strong><br
/> At the end; Just one reflection about the Google Friend Connect. If you are logged in to your Google account and try the friend connect on a site, you will not be given the possibility to choose other accounts. Log out of your Google account first and try the join button and see the difference.</p> ]]></content:encoded> <wfw:commentRss>http://www.larre.com/2008/12/18/reflections-after-having-implemented-facebook-connect-and-google-friend-connect-on-my-blog/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Building a Facebook Application in 15 minutes</title><link>http://www.larre.com/2007/10/10/building-a-facebook-application-in-15-minutes/</link> <comments>http://www.larre.com/2007/10/10/building-a-facebook-application-in-15-minutes/#comments</comments> <pubDate>Wed, 10 Oct 2007 09:29:07 +0000</pubDate> <dc:creator>larre</dc:creator> <category><![CDATA[howto]]></category> <category><![CDATA[programming]]></category> <category><![CDATA[app]]></category> <category><![CDATA[application]]></category> <category><![CDATA[code]]></category> <category><![CDATA[development]]></category> <category><![CDATA[facebook]]></category> <category><![CDATA[integration]]></category> <category><![CDATA[java]]></category> <category><![CDATA[jsp]]></category> <category><![CDATA[platform]]></category><guid
isPermaLink="false">http://larre.wordpress.com/2007/10/10/building-a-facebook-application-in-15-minutes/</guid> <description><![CDATA[So, after fowa and 90k+ developers in mind, I just had to go ahead and implement a Facebook application. Here is the code and how I implemented it.
See also: Reflections after having implemented Facebook Connect and Google Friend Connect on my blog
First of all my goal was to use an existing web application, write a [...]]]></description> <content:encoded><![CDATA[<p>So, after <a
href="http://www.larre.com/2007/10/09/future-of-web-apps/">fowa</a> and 90k+ developers in mind, I just had to go ahead and implement a Facebook application. Here is the code and how I implemented it.</p><p><strong>See also: <a
href="http://www.larre.com/2008/12/18/reflections-after-having-implemented-facebook-connect-and-google-friend-connect-on-my-blog/">Reflections after having implemented Facebook Connect and Google Friend Connect on my blog</a></strong></p><p>First of all my goal was to use an existing web application, write a facebook integration module that communicates with the Facebook APIs, extracting some information/data and presenting them inside the existing web application. The web application I used is based on a j2ee framework (jsp, java). The architecture is much like <a
href="http://struts.apache.org">Struts</a> The first thing to do was to <a
href="http://developers.facebook.com/get_started.php">get the Developer Application</a> to my existing Facebook account. Then I had to download the <a
href="http://developers.facebook.com/resources.php">Client Library</a>. I choosed the Java Library since my development environment was Java. When I extracted the Client Library, only the source files where included. So what I had to do first (besides looking into the source code), was to compile the java-files. I actually wrote an ant-task for this purpose, but a more easier way is just to use javac without using ant-framework. The next step was to take the output from the compile process and put it into an archived file (.jar). This is not necessary but I like to do it this way and the facebook.jar file I now had is easily dropped into my existing web application library. In my Facebook profile I had to create (set up) a new application. This is done by clicking the developer application that was installed earlier. Its some steps including getting a key (API key and secret key) that I used in my java-code but this process is straight forward.</p><p
align="left">Ok, now lets start the coding process. Here is the java code controlling the session and authentication:</p><p
align="left"><em>String apiKey = &#8220;something&#8221;;<br
/> String secretKey = &#8220;something&#8221;; </em></p><p
align="left"><em>FacebookRestClient frc = null;<br
/> HttpSession session = request.getSession();<br
/> String sessionKey = (String) session.getAttribute(&#8221;facebookSession&#8221;);<br
/> String token = request.getParameter(&#8221;auth_token&#8221;);</em></p><p
align="left"><em>try {</em></p><p
align="left"><em>if (sessionKey != null &amp;&amp; sessionKey.length() &gt; 0) {</em></p><p
align="left"><em>frc = new FacebookRestClient(apiKey, secretKey, sessionKey);<br
/> this.doTheThing(request, response, frc);<br
/> } else if (token != null) {<br
/> frc = new FacebookRestClient(apiKey, secretKey);<br
/> session.setAttribute(&#8221;facebookSession&#8221;, sessionKey);<br
/> sessionKey = frc.auth_getSession(token);<br
/> session.setAttribute(&#8221;facebookSession&#8221;, sessionKey);<br
/> this.doTheThing(request, response, frc);<br
/> </em></p><p
align="left"><em>} else {<br
/> response.sendRedirect(&#8221;http://www.facebook.com/login.php?api_key=&#8221; + apiKey + &#8220;&amp;v=1.0&#8243;);<br
/> }<br
/> } catch (FacebookException fe) {<br
/> } catch (IOException ioe) {<br
/> &#8230;</em></p><p
align="left">The <em>doTheThing</em> method is extracting the information and looks like this:</p><p
align="left"><em>int myid = frc.users_getLoggedInUser();<br
/> EnumSet&lt;ProfileField&gt; fields = EnumSet.of(com.facebook.api.ProfileField.NAME, com.facebook.api.ProfileField.PIC, com.facebook.api.ProfileField.PIC_BIG, com.facebook.api.ProfileField.PIC_SMALL);<br
/> Collection&lt;Integer&gt; users = new ArrayList();<br
/> users.add(myid);</em></p><p><em>// Get my information<br
/> Document d = frc.users_getInfo(users, fields);<br
/> String myname = d.getElementsByTagName(&#8221;name&#8221;).item(0).getTextContent();<br
/> String mypicture = d.getElementsByTagName(&#8221;pic&#8221;).item(0).getTextContent();</em></p><p><em>// Get my friends id<br
/> Document d2 = frc.friends_get();<br
/> String s = d2.toString();<br
/> NodeList userIDNodes = d2.getElementsByTagName(&#8221;uid&#8221;);<br
/> int fcount = userIDNodes.getLength();</em></p><p><em>Collection&lt;Integer&gt; friends = new ArrayList&lt;Integer&gt;();<br
/> for (int i = 0; i &lt; fcount; i++) {<br
/> Node node = userIDNodes.item(i);<br
/> String idText = node.getTextContent();<br
/> Integer id = Integer.valueOf(idText);<br
/> friends.add(id);<br
/> }</em></p><p><em>List l = new ArrayList();<br
/> Map m = new HashMap();<br
/> Document d3 = frc.users_getInfo(friends, fields);</em></p><p>// Get my friends information<br
/> for (int j = 0; j &lt; fcount; j++) {<br
/> String name2 = d3.getElementsByTagName(&#8221;name&#8221;).item(j).getTextContent();<br
/> String picture2 = d3.getElementsByTagName(&#8221;pic&#8221;).item(j).getTextContent();<br
/> String picture3 = d3.getElementsByTagName(&#8221;pic_small&#8221;).item(j).getTextContent();<br
/> String picture4 = d3.getElementsByTagName(&#8221;pic_big&#8221;).item(j).getTextContent();</p><p><em>m.put(&#8221;name&#8221;, name2);<br
/> m.put(&#8221;picture&#8221;, picture2);<br
/> m.put(&#8221;picture_small&#8221;, picture3);<br
/> m.put(&#8221;picture_big&#8221;, picture4);</em></p><p><em>l .add(m);<br
/> m = new HashMap();</em></p><p><em>}<br
/> request.setAttribute(&#8221;friends&#8221;, l);<br
/> request.setAttribute(&#8221;myname&#8221;, myname);<br
/> request.setAttribute(&#8221;mypicture&#8221;, mypicture);<br
/> request.setAttribute(&#8221;numFriends&#8221;, new Integer(fcount));</em></p><p
align="left"><p
align="left">So all the information from Facebook is now added to the request and can be displayed in a JSP. The code above is not very elegant and is not optimized(!). Its just a pice of code done after half an hour of work and my goal was to implement an integration module for testing purpose.</p><p>Hope this blog post can help others looking for hints when getting started with Facebook application development/integration.</p> ]]></content:encoded> <wfw:commentRss>http://www.larre.com/2007/10/10/building-a-facebook-application-in-15-minutes/feed/</wfw:commentRss> <slash:comments>33</slash:comments> </item> </channel> </rss>

<!-- W3 Total Cache: Minify debug info:
Engine:             disk
Group:              category
-->

<!-- W3 Total Cache: CDN debug info:
Engine:             cf
Replaced URLs:
http://www.larre.com/blog/wp-content/uploads/2008/12/lastvisitors.jpg
-->

<!-- W3 Total Cache: Db cache debug info:
Engine:             disk
Total queries:      14
Cached queries:     0
Total query time:   0.029
SQL info:
    # | Time (s) |    Caching (Reject reason)     |   Status   | Query
    1 |    0.014 |            enabled             | Not cached | SELECT option_name, option_value FROM wp_nj5ugn_options WHERE autoload = 'yes'
    2 |    0.001 |            enabled             | Not cached | SELECT option_value FROM wp_nj5ugn_options WHERE option_name = 'aiosp_post_title_format' LIMIT 1
    3 |    0.001 |            enabled             | Not cached | SELECT option_value FROM wp_nj5ugn_options WHERE option_name = 'openid_associations' LIMIT 1
    4 |    0.001 |            enabled             | Not cached | SELECT option_value FROM wp_nj5ugn_options WHERE option_name = 'openid_nonces' LIMIT 1
    5 |    0.001 |            enabled             | Not cached | SELECT post_modified_gmt FROM wp_nj5ugn_posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_modified_gmt DESC LIMIT 1
    6 |    0.001 |            enabled             | Not cached | SELECT post_date_gmt FROM wp_nj5ugn_posts WHERE post_status = 'publish' AND post_type = 'post' ORDER BY post_date_gmt DESC LIMIT 1
    7 |    0.001 |            enabled             | Not cached | SELECT t.*, tt.* FROM wp_nj5ugn_terms AS t INNER JOIN wp_nj5ugn_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category')  AND t.slug = 'programming' ORDER BY t.name ASC
    8 |    0.003 |  disabled (query is rejected)  | Not cached | SELECT SQL_CALC_FOUND_ROWS  wp_nj5ugn_posts.* FROM wp_nj5ugn_posts  INNER JOIN wp_nj5ugn_term_relationships ON (wp_nj5ugn_posts.ID = wp_nj5ugn_term_relationships.object_id) INNER JOIN wp_nj5ugn_term_taxonomy ON (wp_nj5ugn_term_relationships.term_taxonomy_id = wp_nj5ugn_term_taxonomy.term_taxonomy_id)  WHERE 1=1  AND wp_nj5ugn_term_taxonomy.taxonomy = 'category' AND wp_nj5ugn_term_taxonomy.term_id IN ('16') AND wp_nj5ugn_posts.post_type = 'post' AND (wp_nj5ugn_posts.post_status = 'publish') GROUP BY wp_nj5ugn_posts.ID ORDER BY wp_nj5ugn_posts.post_date DESC LIMIT 0, 10
    9 |    0.001 |  disabled (query is rejected)  | Not cached | SELECT FOUND_ROWS()
   10 |    0.002 |            enabled             | Not cached | SELECT t.*, tt.*, tr.object_id FROM wp_nj5ugn_terms AS t INNER JOIN wp_nj5ugn_term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN wp_nj5ugn_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('category', 'post_tag') AND tr.object_id IN (136, 15) ORDER BY t.name ASC
   11 |    0.001 |            enabled             | Not cached | SELECT post_id, meta_key, meta_value FROM wp_nj5ugn_postmeta WHERE post_id IN (136,15)
   12 |    0.001 |            enabled             | Not cached | SELECT * FROM wp_nj5ugn_users WHERE ID = 2 LIMIT 1
   13 |    0.001 |            enabled             | Not cached | SELECT meta_key, meta_value FROM wp_nj5ugn_usermeta WHERE user_id = 2
   14 |    0.001 |            enabled             | Not cached | SELECT remote_path FROM wp_nj5ugn_w3tc_cdn_queue
-->

<!-- W3 Total Cache: Page cache debug info:
Engine:             disk
Key:                w3tc_99f03baef0ec9a5cf935256f33dc9796_page_736a203b341f9ab9d67aeb419996abff
Caching:            disabled
Reject reason:      user agent is rejected
Status:             not cached
Creation Time:      0.353s
Header info:
X-Powered-By:       W3 Total Cache/0.8.5.1
Expires:            Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control:      no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma:             no-cache
X-Pingback:         http://www.larre.com/blog/xmlrpc.php
Last-Modified:      Fri, 29 Jan 2010 21:26:46 GMT
ETag:               "794e7f11c619555748c1fbcd485532dd"
Content-Type:       text/xml; charset=UTF-8
-->