Friday, February 26, 2010

Self Certificated Sick Leave

Please say briefly why you were incapable of work for the period stated above, words like unwell or illness are insufficient.

I had a fever, slight headache and very sore throat which made it difficult to speak, admittedly not essential to my job but I wouldn't want to pass the illness to my colleagues who need to use the phone without sounding like they'e doing a Barry White impression.

Tuesday, February 23, 2010

Using Outlook Web Access

Since my work seem to be refusing to enable IMAP on their new Exchange server and I refuse to use Outlook, which is just too slow and cumbersome for my simple needs, I've spent the last few days getting to know Outlook Web Access, Microsoft Exchange's webmail offering. Here are some tips:
  1. If you're using Firefox and are miffed to find that you can only use the "light" version of OWA, don't be, I prefer the light version and would recommend it to IE users too. And no, OWA does not work on Firefox if you fake the User Agent.
  2. Don't worry about the missing autocomplete/drop down functionality in the To, CC, etc. fields, type in the names of your recipients separated by semicolons and click Check Names.
  3. If you need to import contacts use the desktop version of Outlook.
  4. There is no Discard button on the Compose form (my one annoyance so far), so go straight to the drafts folder, use the check box and click Delete.
It's not too bad really.

Thursday, February 04, 2010

Facebook Stream_Get, Offline_Access and getFilters Not Working

I am not sure whether I am being stupid, the Facebook API documentation is really bad or the Facebook API just doesn't really work very well, but if you want to display a user's own profile feed on a page (eg, your own feed on your homepage) here are some pointers: (I do not guarantee any of this information is up to date or even correct.)

o) Setup your application on Facebook, it may be easiest to use the sample/example code they give you to start your project. Fill in the Canvas Page URL and point the Canvas Callback URL at your own domain URL. Then visit your Canvas Page URL.

i) To be able to have a page request restricted information from Facebook while the user is not logged in on a particular machine you need to request off line access, you can do this in these two ways, among others:
<fb:prompt-permission perms="read_stream,offline_access">
<script type="text/javascript">
FB.Connect.showPermissionDialog('read_stream,offline_access', ondone);
function ondone(a){ alert(a); }
ii) You then need to grab a persistent session key, in PHP this is available like so:
$key = $facebook->api_client->session_key
$key = $_POST[fb_sig_session_key]
iii) Once you've got this key you (or your script) can "become" the user like so:
$facebook->set_user($user_id, $key, 0)
iv) You can then get an array of streams using stream.get:
$streams = $facebook->api_client->stream_get($user_id, $user_id...)
v) I have not worked out how to "filter" stream_get to return just posts, or links, etc. getFilters will return a list of filters, but I have not had any success in changing the return value of stream_get, at all. There are also apps on the filter that is returned that I am sure I have not installed, Doodle Jump for example, wtf?

The $stream[posts][x][type] value in my streams reflects the following:

11 - create/join? group
46 - post
56 - wall post
80 - link
237 - flickr
none - profile pic, note

Changing the content type of my page rid it of some nasty characters:
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Remember that PHP's htmlentities() can also take a charset.

See the result at

The ridiculous thing is that you can save an awful lot of time and effort by using the Facebook RSS feeds, such as:
To get your key (and userid) go to your notifications page and click on the "Via RSS" link, you can then change "notifications" in the URL to "share_posts", "status", etc.