Tag Archives: Facebook

After Life

I don’t believe in after life, I think human body is a biological machine which stops functioning after death , that’s it.

But there are lives around us who continue.  One of my colleague shared a blog on a real experience how disastrous can life be after an unexpected death of a family member. The author mentions few lessons she learned after loosing her husband and all information with him.

My friend  shared the following an article about claiming money stuck at various investments.

On a lighter note of you are worried about your Facebook status after death, there is an article for you :)

Syncronize your web accounts with IFTTT

I just came across this wonderful service provided by the website http://ifttt.com . I always wanted to synchronize photos , links posted in various web accounts I have automatically. This website called “If This Then That” works pretty much like a cron job you define in Linux machines.

For example I share interesting links in Facebook and Twitter but forget to bookmark them for my future reference. Later I struggle a lot to dig down the link in my Facebook/Twitter steam history. I wish I would have bookmarked those links in my Diigo account.   Using this portal I can create a task which will be triggered whenever I post a link in Twitter or Facebook it gets saved in the social bookmarking site Diigo with appropriate tag , so that it can be searched easily later on.

Another example is that whenever I post photos in Facebook I wanted them to get backed up in my Dropbox account also this again helps retrieving Facebook photos for  printing later. Usually the best photos of mine goes to Facebook even if I forget to upload them in Picasa, so they are worth saving :)

Similarly this portal supports 36 different web accounts (they call them channels) and any of them can be used as the triggering event and acting event.

The above rules are called recipes and you can brows through many recipe ideas from the other users. I have share a rule in which Facebook photos gets uploaded in one of my Dropbox folder.

This is a very interesting service as it runs automatically in every 15 minutes and you can manually force it to run the rules whenever you want. Most of the tasks I have created till now has worked without any issues till now.

Another good news about this portal is that it uses OAuth for most of the user account credentials so that you don’t have to share your password with IFTTT for giving limited access.

Visit IF THIS THEN THAT and play around tasks now !

Facebook API from Java code

I just got started with Facebook (graph)  API and fetch data from native Java programs for my project requirements .First of all I created an sample app at http://developers.facebook.com/ and got the necessary details about the app at the summery.

Once I registered the app it was time to give permission from my user account to the app so that it can access ( so the API ) data from my account.


MY_URL was any random url as the landing page after I log in was immaterial in this case as I was going to use the APIs from the java code.


I addded offline_access so that it does not time out , I can use the access token generated forever.
Now after I allowed access it landed on a page similar to the following


To get the access_token I invoked following


once the access token appeared in the response I invoked various graph APIs to test if data is coming in JSON format


gives me all my wall posts


gives me all the comments for a given post id of mine

I also used json-simple to parse and decode the JSON returned by the above Facebook APIs.


import java.io.BufferedReader;

import java.io.IOException;

import java.io.InputStreamReader;

import java.net.MalformedURLException;

import java.net.URL;

import java.net.URLConnection;

import org.json.simple.JSONArray;

import org.json.simple.JSONObject;

import org.json.simple.JSONValue;

public class FindComments {

* @param args

* @throws IOException


public static void main(String[] args) throws IOException {
String commentID = "<COMMEN_ID>";

String accessToken = "<ACCESS_TOKEN>";
// TODO Auto-generated method stub

URL yahoo = new URL(


URLConnection yc = yahoo.openConnection();

BufferedReader in = new BufferedReader(new InputStreamReader(yc


String inputLine;

String s = "";

while ((inputLine = in.readLine()) != null)

// System.out.println(inputLine);

s = s + inputLine + "n";

// System.out.println(s);
Object obj = JSONValue.parse(s);

// JSONArray array=(JSONArray)obj;

// System.out.println(obj);

// System.out.println(array.get(1));

JSONObject obj2 = (JSONObject) obj;
JSONObject comments = (JSONObject) obj2.get("comments");

JSONArray commentsArray = (JSONArray) comments.get("data");

// System.out.println(commentsArray.size());

// System.out.println(obj2.get("comments"));

for (int i = 0; i &lt; commentsArray.size(); i++) {

JSONObject commentobj = (JSONObject) commentsArray.get(i);

// System.out.println(commentobj);

String commentText = (String) commentobj.get("message");




The above code prints the comments given on the Hard coded post ID