<?xml version="1.0" encoding="UTF-8"?>
<posts type="array">
  <post>
    <author>Simon Schoeters</author>
    <content>&lt;p&gt;As I had some troubles finding out how to show some of my own Flickr photos on this site using the Flickr API and Ruby on Rails I thought it would be useful to write it down in a small tutorial.&lt;/p&gt;
	
&lt;h3&gt;STEP 1: Finding a library: rFlickr&lt;/h3&gt;

&lt;p&gt;Flickr lists 3 possible Ruby frameworks for their API. After trying &lt;a href="http://redgreenblu.com/flickr/" title="My first shot at a Flickr API kit" class="ext"&gt;flickr.rb&lt;/a&gt; and not being able to login I decided to switch to &lt;a href="http://rubyforge.org/projects/rflickr/" title="The Flickr API kit I choose" class="ext"&gt;rFlickr&lt;/a&gt; as it seems the most popular one. I didn't look at the last one: &lt;a href="http://premshree.seacrow.com/code/ruby/flickr-ruby" title="Another Flickr API kit for Ruby" class="ext"&gt;flickr-ruby&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Start with installing the rFlickr library. You may need to uninstall a previous library if you installed another one earlier.&lt;/p&gt;

&lt;samp&gt;# gem install rflickr&lt;/samp&gt;

&lt;h3&gt;STEP 2: Get a Flickr API key&lt;/h3&gt;

&lt;p&gt;Flickr doesn't use the username/password combination as most other API's do. An application can ask for permissions which the user has to grant. A token is returned when this is done allowing the application to connect the next time so we'll only have to do this once. &lt;a href="http://flickr.com/services/api/keys/apply/" title="Request an API key" class="ext"&gt;Apply for a key&lt;/a&gt; at the Flickr website and remember the key and the shared secret. I use a &amp;ldquo;Web Application&amp;rdquo; key as I want to use it for my blog.&lt;/p&gt;

&lt;h3&gt;STEP 3: Get a Flickr token&lt;/h3&gt;

&lt;p&gt;Start your development environment:&lt;/p&gt;

&lt;samp&gt;# ./script/console&lt;/samp&gt;

&lt;p&gt;Next load the newly installed rFlickr module and ask for a Flickr frob using the API key and shared secret you got earlier.&lt;/p&gt;

&lt;samp&gt;&amp;gt;&amp;gt; require 'flickr'&lt;br /&gt;
=&amp;gt; []&lt;br /&gt;
&amp;gt;&amp;gt; flickr = Flickr.new(&amp;apos;/tmp/flickr.cache&amp;apos;, YOUR_KEY, YOUR_SECRET)&lt;br /&gt;
=&amp;gt; #&amp;lt;Flickr:0x...&lt;br /&gt;
&amp;gt;&amp;gt; flickr.auth.login_link&lt;br /&gt;
=&amp;gt; &amp;quot;http://flickr.com/services/auth/?api_sig=a07a7...&lt;/samp&gt;

&lt;p&gt;This will return a URL you need to copy &amp;amp; paste in your browser to allow the application to read, write and delete your photos. If you don't need all this permissions your can add the &amp;lsquo;perms&amp;rsquo; parameter for a less greedy permissions. Use the following if you only need read access to the photos:&lt;/p&gt;

&lt;samp&gt;&amp;gt;&amp;gt; flickr.auth.login_link(perms=&amp;apos;read&amp;apos;)&lt;/samp&gt;

&lt;p&gt;Allow the application to access your photos when you open the URL. You can request the forb we need and make sure to to keep it for now.&lt;/p&gt;

&lt;samp&gt;&amp;gt;&amp;gt; flickr.auth.getFrob
=&amp;gt; &amp;quot;7215760...&lt;/samp&gt;

&lt;p&gt;Now we&amp;apos;ll need a token. The token is more permanent as the frob but we need the forb to get one. Finally cache the token:&lt;/p&gt;

&lt;samp&gt;&amp;gt;&amp;gt; flickr.auth.getToken(&amp;apos;YOUR_FROB&amp;apos;)&lt;br /&gt;
=&amp;gt; #&amp;lt;Flickr::Token:0x...&lt;br /&gt;
&amp;gt;&amp;gt; flickr.auth.cache_token&lt;br /&gt;
=&amp;gt; 154&lt;/samp&gt;

&lt;h3&gt;STEP 4: Give me my photos!&lt;/h3&gt;

&lt;p&gt;Now it's time to do something more useful with the token. What about showing the thumbnails of the 6 last added photos? We'll need your NSID which is the strange number in your Flickr URL that looks like 26227936@N00.&lt;/p&gt;


&lt;samp&gt;def flickr
	require &amp;apos;flickr&amp;apos;&lt;br /&gt;
	photos = Array.new&lt;br /&gt;
	flickr = Flickr.new(&amp;apos;/tmp/flickr.cache&amp;apos;, &amp;apos;YOUR_KEY&amp;apos;, &amp;apos;YOUR_SECRET&amp;apos;)&lt;br /&gt;
	photo_list = flickr.people.getPublicPhotos(&amp;apos;YOUR_NSID&amp;apos;,&amp;apos;&amp;apos;,6)&lt;br /&gt;
	photo_list.each do |photo|&lt;br /&gt;
		photos.push( {&amp;apos;id&amp;apos; =&amp;gt; photo.id, &amp;apos;source&amp;apos; =&amp;gt; photo.sizes[:Square].source} )&lt;br /&gt;
	end&lt;br /&gt;
	return photos&lt;br /&gt;
end&lt;/samp&gt;

&lt;p&gt;Look, you now have an array with the last 6 posted public photos and their ID. Good luck!&lt;/p&gt;

&lt;h3&gt;Resources&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.gemjack.com/gems/rflickr-2006.02.01/index.html" title="RDoc for the rFlickr library" class="ext"&gt;RDoc for the rFlickr library&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content>
    <created-at type="datetime">2007-10-05T00:42:51+02:00</created-at>
    <id type="integer">7</id>
    <location-id type="integer">1</location-id>
    <permalink>rflickr</permalink>
    <title>My Flickr photos with RoR</title>
    <updated-at type="datetime">2008-05-20T12:05:59+02:00</updated-at>
  </post>
  <post>
    <author>Simon Schoeters</author>
    <content>&lt;p&gt;A few days ago we played with the &lt;a href="http://doyoupoken.com/" title="Poken's website" class="ext"&gt;Poken&lt;/a&gt; I got from &lt;span class="vcard"&gt;&lt;a class="url fn n ext" href="http://www.fousa.be" title="Fousa's blog"&gt;&lt;span class="given-name"&gt;Jelle&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;. It's still in beta so I thought it would be good to write a short review as feedback. Please note: they are still improving the website so my review today may be old news tomorrow.&lt;/p&gt;

&lt;h3&gt;The hardware&lt;/h3&gt;

&lt;a href="http://flickr.com/photos/schoeters/3211066910/" title="Larger version available on Flickr"&gt;&lt;img src="http://farm4.static.flickr.com/3506/3211066910_b49b68073d_m.jpg" alt="Two Pokens" style="float: left; border: 1px solid #dfdfdf; padding: 5px; margin-right: .5em" /&gt;&lt;/a&gt;

&lt;p&gt;A token is a small &lt;abbr title="Radio-frequency identification"&gt;RFID&lt;/abbr&gt; tag and reader with an &lt;abbr title="Universal Serial Bus"&gt;USB&lt;/abbr&gt; plug designed as small creatures with a big hand (see photo). All the electronic stuff is in the big white hand. The creature itself is just some decoration that protects the plug.&lt;/p&gt;

&lt;p&gt;The Pokens are small and look silly, which is perfect for their target audience in my opinion. The playful character of the Pokens may make it more appealing for girls as well which may be a good idea for something geeky as an &amp;lsquo;RFID tag&amp;rsquo;.&lt;/p&gt;

&lt;p&gt;The &lt;abbr title="Light-emitting diode"&gt;LED&lt;/abbr&gt; in the hand turns green when the Pokens exchange information. If you press the button in the hand twice a small red LED will blink showing that &amp;lsquo;ghost&amp;rsquo; mode is enabled. This means the Poken will act like normally but it will not share your details (but you will get theirs).&lt;/p&gt;

&lt;p&gt;When you connect the Poken to your computer you still need to open it and click the website link to upload the data (on a Mac that is). There is an autorun.inf file on the drive so I suppose it does this automatically on Windows, why not on Mac?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Update:&lt;/strong&gt; we created &lt;a href="http://www.milkcarton.be/apps/lazypoken" title="LazyPoken autostarts your Poken" class="ext"&gt;LazyPoken&lt;/a&gt;, a small application for Mac OS X that does exactly that. It starts your Poken when you connect it with you Mac.&lt;/p&gt;

&lt;h3&gt;The software&lt;/h3&gt;

&lt;p&gt;The hardware is probably the most visible part but there seems to be more work on the software part. The Poken system is a social community site: you add &amp;lsquo;friends&amp;rsquo; and share profiles. Poken tries to be that little extra by adding your friends to other services as well (Twitter and Facebook to name two). They seem to add new services quickly when their Pokens get some buzz in a certain region.&lt;/p&gt;

&lt;p&gt;Each Poken has a unique number. When you hold your Poken to another one the numbers are exchanged. Once home you connect your Poken to your computer and accept or deny the collected profiles. From that point on it's nothing more than a social network site. You'll see the new information when someone updates his information without having to poke him again (pun intended).&lt;/p&gt;

&lt;p&gt;On the website you can add a bunch of services. Poken needs to know your accounts on these services to be able to add your Poken friends to these networks. It asks your account and password information for each of these services which feels &lt;a href="http://adactio.com/journal/1357/" title="The password anti-pattern" class="ext"&gt;very, very wrong&lt;/a&gt;. Dear Poken, there are other ways of doing this (have a look at &lt;a href="http://oauth.net/" title="An open protocol to allow secure API authorization" class="ext"&gt;OAuth&lt;/a&gt;)! &lt;strong&gt;I do not trust you with all my passwords.&lt;/strong&gt; I don't mind how secure your servers may be, it's just wrong. This alone makes Poken a no go for me.&lt;/p&gt;

&lt;p&gt;I binded my Twitter account to my Poken profile (yes, I gave you my password, shiver) and tried to add a friend. This friend was not added to my Twitter followers list. Does this run in the background and was I too fast or are there still some implementation  problems?&lt;/p&gt;

&lt;p&gt;Then there are some minor annoyances I expect will be solved when they get out of beta:&lt;p&gt;

&lt;ul&gt;
&lt;li&gt;The website design needs some work: it's not easy to navigate.&lt;/li&gt;
&lt;li&gt;The difference between the big and small cards is not clear. Is the big one your complete profile and the other the discreet one?&lt;/li&gt;
&lt;li&gt;I couldn't find the difference between the &amp;lsquo;discreet&amp;rsquo; and &amp;lsquo;ghost&amp;rsquo; modes.&lt;/li&gt;
&lt;li&gt;Even though my friend filled in his website URL in his profile it does not show up in my list.&lt;/li&gt;
&lt;li&gt;The Flickr logo is missing from the profile cards.&lt;/li&gt;
&lt;li&gt;Apparently the battery only lasts 6 months, come on, really? Why not charge it via USB?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Can I add a feature request as well? As Chantal already proposed on your &lt;a href="http://getsatisfaction.com/poken/topics/export_friends_to_vcard" title="Export friends to vCard @ Get Statisfaction" class="ext"&gt;support channel&lt;/a&gt; it would be nice to have an &amp;lsquo;export to vCard&amp;rsquo; function. This would make it easy to import my friends in Address Book, which is where I want my contacts in the end.&lt;/p&gt;</content>
    <created-at type="datetime">2009-01-23T00:00:56+01:00</created-at>
    <id type="integer">48</id>
    <location-id type="integer">8</location-id>
    <permalink>do-you-poken</permalink>
    <title>Do you Poken?</title>
    <updated-at type="datetime">2009-02-02T15:13:58+01:00</updated-at>
  </post>
</posts>
