Facebook loading multiple picture url for custom friend selector - facebook

I'm building a custom friend selector on mobile (Air, starling). I use the graph api to request invitable_friends which returns me everything i need.
My concern is about loading all these images. The basic strategy would be to loop over all the output and load all image separately.
First, i'm afraid that will be very slow and heavy for the user,
Second, i'm afraid facebook will blacklist the incoming connection if it gets too many calls.
So my question is, is there any specific strategy, as caching the images on the mobile harddrive to load them only once (and refresh once in a while)
Or does facebook another way to access all those data in a single request ?
Thanks

Related

Is there an alternative to avatars.io?

As http://avatars.io seems to return 404 instead of already uploaded photos, and does not allow to upload new photos, I found myself in an inconvenient situation, where I have to move to a different service provider or implement my own avatars solution.
The latter (based on my experience from nk.pl) seems to be quite time consuming, and I do not want users of my website to wait for this basic functionality, so I'd really love to hear that there is some drop-in replacement for avatars.io.
I need a service which :
allows a user to upload a photo to the cloud (preferably directly from their browser using a js library)
stores the photo, resizes it, crops it to a square shape
after the upload returns a url which can be stored in the database and subsequently used to retrieve the avatar

Updating Page Content Without Refreshing Page

I want to update recent notifications on the user's dashboard without refreshing it whenever there is a change in database notification table...as in Facebook where posts and comments are updated in real time...doesn't require page refresh. How can I do it. Any idea?
Thanks in advance.
I work for a company called Realtime (http://www.realtime.co) and we developed a very cool framework to work with real-time data.
It works on the cloud, we offer a lot of different APIs, you don't need to install anything and you can get a free account (with 1.000.000 free messages and 30.000 users per month). It allows you to push data to browsers, meaning you won't be hammering your server with AJAX requests.
On browsers, it uses websockets, if available. For older, non-websocket browsers, we will transparently fallback to whatever is that your browser can use.
Check out http://www.realtime.co and http://www.xrtml.org for downloads and documentation. Please let me know if you need any help as I am the Developer Evangelist for Realtime :)
It is something called asynchronous. Which you refresh the contents of a webpage or a DIV or anything else without reloading the page.
Actually you should use AJAX to load another page into a already present DIV in your page so it will be refreshed on a time basis.
AJAX
The documentation is really simple on w3 schools you can see there.
But the thing is you should use another page called a Handler or something to load and process the contents and then make them ready to be presented in your page and so you can load it time by time using javascript timers or etc.

Caching Feeds from Facebook, Twitter & Instagram

I'm building a site for a non-profit festival where we'd like to have a 'media' page which brings in photos from instagram (hashtag search), updates and photos from Facebook (via festival's albums) twitter posts (by user and hashtag).
I've tried the JS widgets for Facebook and Twitter but wondered about using PHP/Codeigniter to pull the feeds and caching them somehow for better performance and more control over the look.
Would it be best to then store the feed data in a json file on the server or in a MySQL record?
I'm leaning toward a table with a record for each feed that would basically just store the feed URL, JSON, last updated time and an identifier of some sort.
Then I could write a class with the following type of methods:
get_feed($id='facebook_updates', $expiry_time=3600);
Does this seem like a reasonable way to go? or is there a better solution already existing?
I'm not quite sure how I'd work that in with the feeds that need Auth (twitter & Instagram)
bro!
First, it does seem a reasonable way to do it and I don't know any better.
But, if I had to accomplish that, I would break my problem in two:
A server side code to grab the info from the services (that I would
probably store as json so that I could use the info returned
directly) running with cronjobs from time to time.
A client side (server would work too) one to show that info with
customized style.
To work with the feeds that need auth, you'll have to create an app in each of them, authorize it to access your personal account and use it in the code. Never worked with Instagram but the others have good documentation on how to do that.
Finally, with some modification, you may be able to use this wonderful too to help you accomplish your task: http://plugins.in1.com/socialist

How can I create two different isntance of connection to Facebook?

I need to have two different Facebook connection on the same website! So, they points to two different Application Keys.
How can I manage this?
This isn't something Facebook JavaScript SDK supports and this can't be simply achieved by storing FB object in other variable before adding another instance of SDK.
In the code of SDK FB is used directly pretty everywhere, and the response from API will use it too.
BTW, Even if it was possible your users would be needed to Authorize two applications if you want to access their data (transfer of data from one application to another violate platform policies).
As #JuicyScripter wrote, the js sdk itself can not be shared among different apps in the same document, and that's exactly what you can try to play with.
How about adding an iframe per fb app?
You have the main page (the +1) which acts as usual, then you load an iframe inside of it and in it you can load another fb sdk for a different application.
Depending on what exactly you plan on doing, you might need to communicate between iframes, which will only work if they share the same domain.
Another approach is to make all api requests from the server side, but you'll have to have an access token for the user per app.

Hosting password protected videos for my iphone app

I am building a paid iphone application which
- shows some premium content videos to the user.
- app loads a page from my webserver in UIWebView
- but the videos are hosted at some other video hosting site.
I realize that, in order for me to be keep this app paid, I need to keep the video links protected/secure (else if the urls are leaked, no one is going to want to pay for it).
I can easily password protect the webpage (pointing to the actual video) and make the user name and password available to the iphone app to access this webpage. But when the user selects the video link, the app will load that url. If user sniffed the packets on the iphone at this time, they could get access to the url and just run it from there directly.
I dont believe mod_sec_download or mod_xsendfile can work in this scenario because the video link is external. Right?
Is Amazon S3 a possible solution?
Would appreciate any insight/solution.
Thanks!
Don't point directly to a video file. That'll make it trivial to steal. instead, point at a proxy script that can check the source of the request and verify that it's coming from a registered purchaser.
With appropriate one-time tokens, tracking of usage, etc... you can keep most people from sucking your site dry. And of course, the best practice is to embed a watermark into the video as it plays, so that even if it gets stolen, you can track it back to the first person to release it.
You might want to take a look at the OWASP Top 10 and in particular, number 8 about failure to restrict URL access. This is effectively your scenario: you have resources which need to be secured at the server level. You can't just do this from the device end, the location of resources requested by the device is easily discoverable.
So it comes down to access controls on the resources, in this case, your videos. How you do this will depend in part on your server stack. For example, IIS7 has an integrated pipeline which can apply access controls to resources of any type such as PDFs, images and videos (more on this in OWASP Top 10 for .NET developers part 8: Failure to Restrict URL Access). Alternatively, you'll need some form of application proxy which can take responsibility for the authentication then delivery of the video content.
This is really more of a webserver issue than an iPhone issue. Focus on getting the access controls right on the server then the iPhone end will be a much more straight forward process.