Wednesday, July 16, 2008

ABC of Facebook Application

Facebook offers a great platform and userbase for developing your cool app, but on the other hand their documentation is useless specially in Java side. I can' find words how badly it is written !*&@*&#*#.
When I development of my first Facebook app, I struggled a lot. I could find much more information in people's blog rather than on Facebook website.

I'll cover few of topic which will app development little simpler.

Facebook Session Demystified
Once user click on your application canvas link Facebook call your callback URL and pass this response to user browser. In this call authentication token is NOT added in the request your server receives. If you need authentication token you need to forward request to following URL


http://www.facebook.com/login.php?api_key=YOUR_API_KEY&v=1.0

Don't worry users will not be asked to login again. Facebook will create an authentication token, append it in your callback URL and send request to this URL.

Now you have authentication token. Store it in HttpSession; your will need it soon...
I a second we would try to fetch user friends list using FacebookRestClient class. I am using Facebook java apis hosted at http://code.google.com/p/facebook-java-api/
Use the stored authentication token to create instance of FacebookRestClient as

FacebookRestClient fClient = new FacebookRestClient(YOUR_API_KEY,YOUR_SECRET_KEY);
String fbSession = fClient._getSessionKey();
long fbUserId = fClient.auth_getUserId(token);

After this step most of the things are simple. Use various methods of FacebookRestClient to perform various actions e.g. getting User friend list.

List fList = fClient.friends_getAsList();

Store fbSession in HttpSession and use it in following request to get handle of FacebookRestClient in following way


FacebookRestClient fClient = new FacebookRestClient(YOUR_API_KEY,YOUR_SECRET_KEY,fbSession);


In next few post I'll try to cover more topics about Facebook Api including Feeds, notifications and more.

Wednesday, June 18, 2008

Lipstick Economy

National Public Radio is reporting when US economy is moving towards recession, lipsticks sales are off the chart. Why?? Because when people are not doing very good they need a little boost and since they can't go for $100.00 perfume they go for next best thing a $20.00 Lipstick.

Thursday, March 13, 2008

Playing avi files from PS3 Hard Drive

I was trying to do it since long time.
I was able to stream avi to PS3 using Nero Media Server, but some time it use to give me troubles like skipping frames and jamming for some time.

Yesterday I tried to copy avi file to PS3(You have to copy it by using nero media server) and then play it from HD and surprisingly it worked. Actually PS3 dose support avi playback from hard drive but surprisingly Sony never revealed this feature.

I think you need to enable Divx playback in PS3 setting since it uses Divx codec to play avi. Also it will show avi clip as Divx under Video.

I would try to add video later today.