Friday, March 30, 2012

Crazy bus driver between Thekkady and Alappuzha



Looks like this is becoming a popular video on YouTube, it's starting to get over 200 views a day now.  At present, it has nearly 5000 views.  :)  I just wish I could have got the camera going earlier, as he was really getting a lot of body roll, unsafely leaning the bus into the oncoming lanes of traffic.

Tuesday, March 27, 2012

Facebook access tokens and offline access deprecation

Uh oh, Facebook's changing things again...

Recently Facebook announced deprecation of offline_access permissions. So the question that is most frequently asked is "How do I get a token I can use when the user is not logged in?"

So, please add this to your FAQ.

How do I get a token for offline access?

Fairly simple. When the user is logged into your app, take their current access token (usually this one expires in an hour or so) and pass it as a query string parameter to a specific URL.

That url is:

https://graph.facebook.com/oauth/access_token?             
    client_id=[APP_ID]&
    client_secret=[APP_SECRET]&
    grant_type=fb_exchange_token&
    fb_exchange_token=[EXISTING_ACCESS_TOKEN]


Replace [APP_ID], [APP_SECRET] and [EXISTING_ACCESS_TOKEN] with your application values and the current access token, and in the response from Facebook, you will get a 60 day access token.

Why is Facebook making it hard?

In my opinion, I believe it is to reduce the number of spammy apps. Facebook says it's to drive more traffic to your app and also to ensure that your app is relevant and important to the user. I've heard of Facebook also wanting to ensure that the apps become less independent and more dependent on user interaction. Most developers do hope that their app is relevant and useful to the user. And most developers are not trying to spam. However, because of the naughty ones, the rest of us have to suffer who want to do something like making it easier for marketers to schedule posts in advance.

Can I exchange my 60 day access token for a new 60 day access token?

No, sorry you cannot. You can only exchange a valid (meaning current) user access token for an extended one. You cannot extend an already extended access token.

Final thoughts

So with this knowledge, we need to make our apps more engaging and let the user know they will need to visit fairly often. For those apps that do automated work with no user interaction, this means someone will have to manually get a 60 day token (I prefer to use the Facebook Graph API Explorer Tool) and plug it into their application via refreshable settings, as opposed to hard-coded in compiled apps.

Wednesday, March 21, 2012

Tuesday, March 20, 2012

How to use the Graph API to search for places

Facebook has recently updated their documentation on their search* feature. This is exciting news! In this blog I want to show you how simple it is to search for places or locations in a geographical area. All you need to know is the center coordinates of the location to be searched.

* note: Facebook's made it hard to directly link to the information as they have no anchor tag in the long page. Scroll down to the "Search" heading.

To search for places near a geographical location


https://graph.facebook.com/search?q=coffee&type=place&center=37.76,-122.427&distance=1000&access_token=VALID_ACCESS_TOKEN

I believe the distance parameter is in meters, but it is hard to tell because they've left that part undocumented.

To search for objects near a geographical location


https://graph.facebook.com/search?type=location&center=37.76,-122.427&distance=1000&access_token=VALID_ACCESS_TOKEN

What's interesting is you will get check-ins from friends if you're using a user access token for this query. Here's what Facebook says:

In addition, the returned objects will be those in which you or your friend have been tagged, or those objects that were created by you or your friends. There are important behavioral differences in the results depending on the permissions your app has acquired. Please see the documentation for the location_post FQL table for more information.

Happy coding! And as always be nice to your API.


Facebook Graph API undocumented (or poorly documented) properties and connections.

I'm writing this post to shed some light on poorly documented Graph API properties and connections. All comments are welcome and I'll try to update this blog entry with the latest and greatest.


photo.backdated_time

Some information about backdated_time can be found in this stackoverflow question.


user.installed

Appears to be letting us know if the user has installed the current application. You can see this field added by specifically declaring on the Graph API call of `me/friends?fields=installed`. Yet another stackoverflow question led me to this information.


user.email

Can't seem to get the email on the user object? Well, just add `?fields=email` to your Graph API query and you now will get that information.

Thursday, March 15, 2012

AMVIV I, a history

Well, using the power of archive.org's wayback machine, I've pulled the content from an old website no longer under my control. This is content I wrote in 2004 and published on http://www.aminivacationinvegas.com. You will note that the site is not current and it appears that the real place for all things AMVIV is http://www.amviv.com.

Here's the link to my content: http://dominicminicoopers.com/amviv/default.aspx Enjoy the throwback in history!

Localizing the Google +1 button plugin code

Localizing the Google +1 button plugin code was kinda a mystery. The documentation for it was difficult for me to find. So i've written this quick how to localize the Google +1 button plugin code.



The trick to it is to use a little documented window.___gcfg object, setting the 'lang' property to the language of your choice. Please note, you will need to do this prior to the loading of the plusone.js code. If you do it afterwards, then the language you specified will be ignored!!

Here's the list of available languages.

I hope this helps you along your way to making the best possible user experience on your website.
Happy coding!!

Assigning URL for Facebook Comments plugin via JavaScript

How to assign a URL for the Facebook comments plugin dynamically at run-time on the client side using some simple JavaScript.

To set your href parameter for the Facebook Comments plugin, simply add the following code.


* Thanks for the tip on how to use gist from github!

In the above code, please note that I'm using the window.fbAsyncInit. When the Facebook JavaScript SDK is loaded dynamically, Facebook will call this function once the SDK is ready to go.

Also note the use of FB.XFBML.parse(); function. This will tell the SDK to reparse the DOM for any Facebook plugin code. It doesn't matter if the code is HTML5 or XFBML, either way, the Facebook JavaScript SDK is smart enough to find either type and will insert their iframed content.

I hope this helps you along your way to making the best possible user experience on your website.
Happy coding!!

Wednesday, March 14, 2012

Tips and Tricks coming soon for Facebook and Google+ integration

Just an announcement that soon I will be writing blogs on how to integrate website with Google+ as well as Facebook like and comments.