Month: January 2012

Obtain Facebook likes via PHP SDK

In an update to this post here is another way to obtain the number of likes for a Facebook page.

I’ll assume that you’ve already registered a Facebook application, have downloaded the PHP SDK and have included for use in your code.


Setup an array with your Facebook applications credentials

$facebook = new Facebook(array(
'appId' => '000000000', // Put appID here
'secret' => '0000c000c000c000c', // Put your secret key here

Decide which page you wish to obtain the number of likes for

$getRequest = $facebook->api('/cocacola'); // Lets look at the Facebook page for the popular soft drink
echo $getRequests['likes'];

Obviously you can consume, contrast and display this information in more exciting ways than simply echoing it to the screen. Enjoy.

OSX Lion 10.7.2 Tweetdeck Crashes


Tweetdeck has been crashing on startup recently, – seemingly without any kind of pattern. At first I attributed this to OSX Lion related issues, but sometimes having Firefox or Chrome open seemed to solve the problem.

I have finally tracked down the underlying issue to Adobe Air, the framework powering Tweetdeck and many other applications. In fact it is the switching software for late model Macbook Pros toggling between the discrete and integrated graphics cards. Launching Firefox or Chrome forces the graphics card to switch to discrete mode, solving the autoswitching and crashing on startup error.

You can manually change the setting to solve the problem by navigating to System Preferences -> Energy Saver. Uncheck the Automatic Graphics Switching at the top of the preferences dialog.

A better fix however is to use gfxCardStatus which is a menu bar application for OSX that allows users of dual-GPU 15″ and 17″ MacBook Pros to view which GPU is in use at a glance, and switch between them on-demand.

Update 29/01/2012
I have discovered that VMWareFusion does not play nicely at all with gfxCardStatus. Fusion will work if you disable dynamic switching and force the use of the discrete GPU but if you change between the two, expect major issues. I’m disabling gfxCardStatus before launching Fusion to avoid the problems.