Showing posts with label Facebook. Show all posts
Showing posts with label Facebook. Show all posts

"Catch Who Didn't Match You..." - Facebook unfriend finder on WSO2 StratosLive...!!!

The word "unfriend" was named as the word of year 2009 by the Oxford Dictionary.
unfriend – verb – To remove someone as a ‘friend’ on a social networking site such as Facebook.
The Facebook, the most popular social networking site, doesn't offer a straight forward way to figure out who removed you there.

The "Catch Who Didn't Match You" application caters exactly that. Currently it's running on WSO2 StrtosLive PAAS and backed by a highly scalable cassandra NoSQL data store - available via http://tinyurl.com/stratos-unfriend.




Enabling secured browsing with Facebook

Did you know there is an option in Facebook to enable secured browsing..?

Go to Account --> Account Settings --> Account Security and enable HTTPS browsing for your account as shown below.



I am bit surprised though why this isn't enabled by default.

There were many incidents reported where the Facebook sessions were hijacked - using Firesheep - a Firefox add-on.

Catch who removed you from Facebook...!

Facebook doesn't send notifications upon unfriending.. although it does when somebody added you.

This blog post explains how to catch people who remove you from Facebook friend list.

Before running the following java program, you need to do the following steps..

0. Go to http://www.facebook.com/#!/pages/Facebook-Developer/7213347185 and LIKE that page.

1. Go to http://www.facebook.com/developers and click on "Set Up New App"

2. Once done with [1] - go to the link http://developers.facebook.com/docs/reference/rest/auth.createtoken and select your application from the "Test Console" and click on the link which looks like https://api.facebook.com/method/auth.createToken?
access_token=...

3. Now a new browser window will be opened up and from the Url - copy the access_token - which is in the query string. Make sure you properly copy the access_token value only - don't mess up with the other query string parameters present in the same Url.

4. Replace the value of the constant ACCESS_TOKEN in code below with the one you got from [3].

5. Download the RestFB jar from here and add it to the classpath of the java program.

6. That's it and whenever you run the following program you will see the friends you made and lost from your previous run.
package samples.fb.app;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;

import com.restfb.Connection;
import com.restfb.DefaultFacebookClient;
import com.restfb.FacebookClient;
import com.restfb.types.User;

public class FacebookTestClient {

 private final static String ACCESS_TOKEN = "126895777dsd7843z4erer7C2.WfdfgQmjj376b_gfdfdf__.3600.1295557200-787236966%7CQ0166mXlhvmBoCXohUDVpfWrYAg";

 public static void main(String[] args) {

  FacebookClient facebookClient = new DefaultFacebookClient(ACCESS_TOKEN);
  Connection<User> myFriends = facebookClient.fetchConnection("me/friends", User.class);

  List<User> list = myFriends.getData();
  Hashtable<String, String> newFriends = new Hashtable>String, String>();
  Hashtable<String, String> oldFriends = loadOldFriends();

  for (Iterator<User> iterator = list.iterator(); iterator.hasNext();) {
   User friend = iterator.next();
   newFriends.put(friend.getId(), friend.getName());

   if (oldFriends != null) {
    if (!oldFriends.containsKey(friend.getId())) {
     System.out.println("You have a new friend today, " + friend.getName());
    }
   }
  }

  if (oldFriends != null) {
   for (Iterator<Entry<String, String>> iterator = oldFriends.entrySet().iterator(); iterator
     .hasNext();) {
    Entry<String, String> friendEntry = iterator.next();
    if (!newFriends.containsKey(friendEntry.getKey())) {
     System.out.println("You lost a friend today, " + friendEntry.getValue());
    }

   }
  }

  saveFriends(newFriends);

 }

 private static void saveFriends(Hashtable<String, String> friends) {

  try {
   FileOutputStream fileOut = new FileOutputStream("friendlist.ser");
   ObjectOutputStream out = new ObjectOutputStream(fileOut);
   out.writeObject(friends);
   out.close();
   fileOut.close();
  } catch (Exception e) {
   e.printStackTrace();
  }
 }

 private static Hashtable<String, String> loadOldFriends() {

  Hashtable<String, String> friends = null;

  try {
   if (new File("friendlist.ser").exists()) {
    FileInputStream fileIn = new FileInputStream("friendlist.ser");
    ObjectInputStream in = new ObjectInputStream(fileIn);
    friends = (Hashtable<String, String>) in.readObject();
    in.close();
    fileIn.close();
   }
  } catch (Exception e) {
   e.printStackTrace();
  }
  return friends;
 }
}

Passport vs OpenID vs Facebook Connect

A nice post by Dick Hardt, read it here...

Facebook redesigned..!

Facebook with it's new design went live yesterday.

This is a much cleaner better UI than the predecessor.

Further details available here.