EzDevInfo.com

facebook interview questions

Top facebook frequently asked interview questions

What APIs in Android is Facebook using to create Chat Heads?

How does Facebook create the Chat Heads on Android? What is the API to create the floating views on top of all other views?


Source: (StackOverflow)

Facebook database design?

I have always wondered how Facebook designed the friend <-> user relation.

I figure the user table is something like this:

user_email PK
user_id PK
password 

I figure the table with user's data (sex, age etc connected via user email I would assume).

How does it connect all the friends to this user?

Something like this?

user_id
friend_id_1
friend_id_2
friend_id_3
friend_id_N 

Probably not. Because the number of users is unknown and will expand.


Source: (StackOverflow)

Advertisements

How to get share counts using graph API

I can get the share count of an URL using PHP SDK and using the deprecated rest API, but didn't find a way to get the share counts of an URL using graph API.

Is there any way to find out?


Source: (StackOverflow)

Facebook development in localhost

Just wanted to know if there is any way I could develop Facebook applications in localhost.


Source: (StackOverflow)

Facebook Like Button - how to disable Comment pop up?

I'd like to disable the Comment box that pops up when a user clicks the Facebook (fbml) Like button I've placed on my site. Is this possible to do? I can't find any details in the documentation.


Source: (StackOverflow)

Open Facebook page from Android app?

from my Android app, I would like to open a link to a Facebook profile in the official Facebook app (if the app is installed, of course). For iPhone, there exists the fb:// URL scheme, but trying the same thing on my Android device throws an ActivityNotFoundException.

Is there a chance to open a Facebook profile in the official Facebook app from code?


Source: (StackOverflow)

Facebook Architecture [closed]

I have been scrounging for articles/info about the architecture at Facebook, the challenges & ways they tackle them. What they use & why they use. How do they scale & what are the design decisions for what they do etc. Main underpinning being to learn. Knowing about sites which handles such massive traffic gives lots of pointers for architects etc. to keep in mind certain stuff while designing new sites. I am sharing what I found.

  1. Facebook Science & Social Graph (Video)
  2. Scale at Facebook
  3. Facebook Chat Architecture
  4. Facebook Blog
  5. Facebook Cassandra Architecture and Design
  6. Facebook Engineering Notes
  7. Quora - Facebook Architecture
  8. Facebook for 600M users
  9. Facebook Chat Architecture
  10. Hadoop & its usage at Facebook
  11. Erlang at Facebook: Chat Architecture
  12. Facebook Performance Caching
  13. Facebook Connect Architecture

I have 2 more links but unable to post due to restrictions at this site. Also, please share if anyone has anything better (need not be related to Facebook only).

P.S. - I wasn't able to find good places to share this research, hence this initiative. Hope this helps someone.


Source: (StackOverflow)

Safari 3rd party cookie iframe trick no longer working?

So this is the umteenth revenge of the "how do I get 3rd party cookies to work in Safari" question but I'm asking again because I think the playing field has changed, perhaps after February 2012. One of the standard tricks to get 3rd party cookies in Safari was as follows: use some javascript to POST to a hidden iframe. It (used to) trick Safari into thinking that the user had interacted with the 3rd party content and so then allow cookies to be set.

I think this loophole has been closed in the wake of the mild scandal where it was revealed that Google was using that trick with its ads. At the very least, while using this trick I have been completely unable to set cookies in Safari. I unearthed some random internet postings that claimed that Apple was working on closing the loophole but I haven't found any official word.

As a fallback I even tried redesigning the main third party frame so that you had to click on a button before the content would load but even that level of direct interaction was not enough to melt Safari's cold cold heart.

So does anyone know for certain if Safari has indeed closed this loophole? If so, are there other workarounds (other than manually including a session ID in every request)?


Source: (StackOverflow)

What does a Ajax call response like 'for (;;); { json data }' mean? [duplicate]

Possible Duplicate:
Why do people put code like “throw 1; <dont be evil>” and “for(;;);” in front of json responses?

I found this kind of syntax being used on Facebook for Ajax calls. I'm confused on the for (;;); part in the beginning of response. What is it used for?

This is the call and response:

GET http://0.131.channel.facebook.com/x/1476579705/51033089/false/p_1524926084=0

Response:

for (;;);{"t":"continue"}

Source: (StackOverflow)

Facebook Graph Api v2.0+ - /me/friends returns empty, or only friends who also use my app

I am trying to get my friend name and ids with graph api v2.0, but data returns empty:

{
  "data": [
  ]
}

when I was using v1.0, everything was ok with following request:

FBRequest* friendsRequest = [FBRequest requestForMyFriends];
  [friendsRequest startWithCompletionHandler: ^(FBRequestConnection *connection,
                                                NSDictionary* result,
                                                NSError *error) {
      NSArray* friends = [result objectForKey:@"data"];
      NSLog(@"Found: %i friends", friends.count);
      for (NSDictionary<FBGraphUser>* friend in friends) {
          NSLog(@"I have a friend named %@ with id %@", friend.name, friend.id);
      }
  }];

but now I cannot get friends!


Source: (StackOverflow)

Design for Facebook authentication in an iOS app that also accesses a secured web service

Goal: Allow a user to authentication with Facebook into an iOS application which requires access to a protected web service that I'm running.

Assumptions: There is a native authentication (and registration) system in place for those users that opt not to use Facebook for sign in.

Details:

  • Assume we want to offer the option for a user to sign in with Facebook without creating a separate account/credential for our system.
  • Because we support our own native auth mechanism (username and password) we have our own user IDs and issue an authentication token that is used for subsequent interactions after the initial credential validation.

I'm surprised that Facebook doesn't have best practices for this in their developer documentation. All the existing documentation is either assuming you are building FB auth into a website, or a standalone mobile app with no service that requires authentication.

Here's my initial thoughts on how this would be designed but want validation on whether it's correct.

  1. Client pops the Facebook iOS Login
  2. UI User signs in with Facebook credentials and gets access token
  3. iOS App passes access token to our server
  4. Our server talks to FB graph API using access token to (a) validate the token and (b) get the FB user ID for that access token.

    e.g. Our server would call https://graph.facebook.com/me/?access_token=XYZ which would return profile info in a JSON object

  5. Assuming it's valid, our server extracts the User ID from the JSON object and checks whether the user already has an account. If so, we issue our own auth ticket to client to use for that session. If user doesn't have an account, we create a new one with the Facebook User ID, assign our own unique UserID and issue our auth ticket.

  6. Client then passes auth ticket back on subsequent interactions that need authentication.

This seems like the right approach to me but not sure if I'm missing something insanely basic and going down the wrong (complicated) path.


Source: (StackOverflow)

Facebook API - How do I get a Facebook user's profile image through the Facebook API (without requiring the user to "Allow" the application)

I'm working on a CMS that fetches a user's profile image from their Facebook URL (that is, http://facebook.com/users_unique_url). How can I accomplish this? Is there a Faceboook API call that fetches a user's profile image URL without the user needing to Allow the application?


Source: (StackOverflow)

Android Facebook style slide

The new Facebook application and its navigation is so cool. I was just trying to see how it can be emulated in my application.

Anyone has a clue how it can be achieved?

enter image description here

On clicking the the top left button the page slide and the following screen is shown:

enter image description here

YouTube Video


Source: (StackOverflow)

How to identify if a webpage is being loaded inside an iframe or directly into the browser window?

I am writing an iframe based facebook app. Now I want to use the same html page to render the normal website as well as the canvas page within facebook. I want to know if I can determine whether the page has been loaded inside the iframe or directly in the browser?


Source: (StackOverflow)

Facebook Callback appends '#_=_' to Return URL

Facebook callback has started appending #_=_ hash underscore to the Return URL

Does anyone know why? What is the solution?


Source: (StackOverflow)