Archive

Archive for the ‘Technical’ Category

Facebook Cookie Bug? REST API data_getCookies()

July 22nd, 2010

I have noticed some of the metrics on my Facebook app going missing. In particular, the tracking of the user installation. This relies on Facebook’s cookies which are being set on the post-authorization page and then re-read on the main page of the site in order to record that the user installed the app. The reason why you must use the Facebook cookies and not your own is that it is Facebook hitting your server on the post-authorize and not the user themselves.

The calls I am using to record and retrieve these cookies are based on the old REST API:
$facebook->api_client->data_setCookie(user_id, cookie_name, value, expiry_time)
$facebook->api_client->data_getCookies(user_id, cookie_name)

The proper data format that Facebook is supposed to return looks like this:

[
{
"uid": "542432762",
"name": "test",
"value": null,
"expires": null,
"path": null
}
]

However, for the last few days, Facebook seems to be returning the data as a numerically-indexed array and not a array of hashes as above:

[99990041857023, "cookie_name", "value", "expiry", "path"]

You can temporarily fix your app by translating this array into the equivalent hash, like this PHP snippet does:


if( !isset($c['name']) )
{
$c = array(
'uid' => $c[0],
'name' => $c[1],
'value' => $c[2],
'expires' => $c[3],
'path' => $c[4]
);
}

Technical, php

Generate your own Wordpress Permalink without GUIDs from database

March 1st, 2010

If you are generating links to your blog articles via some other mechanism than Wordpress itself you usually have to use the guid database field. This is the unique global indentifier of the post. In reality it is not globally unique but only unique to your blog. Read more…

Databases, MySQL, Technical, apache, wordpress , , ,

[haXe] Failed to load library : std.ndll

February 18th, 2010

If, like me, you just started playing around with haXe and you might get the following error when including an external Flash resource:

Uncaught exception – load.c(232) : Failed to load library : std.ndll (std.ndll: cannot open shared object file: No such file or directory)

The solution is simple, you just need to install neko and neko-dev:

sudo apt-get install neko neko-dev

Now simply run the setup:

sudo haxelib setup

Happy haXe-ing!

Linux, Technical, haXe , ,

Scary Privacy Quotes

February 10th, 2010

“If you have something that you don’t want anyone to know, maybe you shouldn’t be doing it in the first place.”

- Google CEO Eric Schmidt

“…doing a privacy change for 350 million users is not the kind of thing that a lot of companies would do. But we viewed that as a really important thing, to always keep a beginner’s mind and what would we do if we were starting the company now and we decided that these would be the social norms now and we just went for it.

- Facebook CEO Mark Zuckerberg

“There was of course no way of knowing whether you were being watched at any given moment… It was even conceivable that they watched everybody all the time.

But at any rate they could plug into your wire whenever they wanted to. You had to live – did live, from habit that became instinct – in the assumption that every sound you made was overheard, and except in darkness, every movement scrutinized.”

- George Orwell, 1984

Rants, Technical, The Future, privacy , , , , ,

Google Buzz: A Privacy Disaster

February 10th, 2010

As someone who is no friend to Facebook, I was quite interested to hear that Google will be stepping into the social networking world with their newest product: Google Buzz. The introductory video looked good enough showing a slick, simple interface, easy message, photo and video posting and an good time to be had by all. Perhaps, I thought, this means Facebook’s hegemony over the social networking sphere was coming to a close. Anything is better than Facebook’s blatant disregard for privacy right? Wrong. Read more…

Google, Rants, Technical, The Future, privacy , , , , ,

Lower-case all URLs with Apache mod_rewrite

February 5th, 2010

Search engines, like Google, will index URLs on your site in a case-sensitive fashion, so www.yoursite.com/iamtest shows up as a different page than www.yoursite.com/iAmTest. This has negative consequences for your search rankings as these different URLs will be interpreted as duplicate content. Read more…

Linux, Technical, apache, server, web , , , , ,

How to install PHP 5.2 on CentOS 5

October 22nd, 2009

I recently needed to install PHP 5.2 on CentOS 5.3. This version of CentOS comes with PHP 5.1 but, in order to run phpMyAdmin, I needed 5.2. The CentOS software repositories are, unfortunately, still stuck with 5.1 and the only way to get a newer version of PHP installed via the package manager (yum) is to add another repository that has a newer version. Read more…

Linux, Technical , , , , , , , ,

MySQL Replication – Silent Timeout Failure

July 19th, 2009

I have been encountering a strange error that causes MySQL replication to stop working without any errors reported via SHOW SLAVE STATUS. The command reports everything running ok and that the slave is caught up with the master (seconds behind master=0).

However, looking into the running processes via SHOW FULL PROCESSLIST I noticed that the thread reading the binary log data from the master has disappeared mysteriously.
Read more…

Databases, MySQL, Technical , ,

WordPress spam killing script

January 30th, 2009

Blog comment spam is an unfortunate reality of having a blog. See the chart to get a sense of how much spam comes in on a daily basis to one of my blogs that receives a moderate amount of traffic. The red line shows the 30-day moving average for the number of spam comments daily.

Number of daily spam comments on the typical blog

Read more…

Linux, Technical , , ,

How green is your code?

January 20th, 2009

Is your code fast and efficient? Is your nasty for-loop killing penguins somewhere and You don’t even know about it? We all hacked and brute-forced through a problem at one time or another – it is inevitable. How much CO2 will your hack release into the atmosphere? Writing power-inefficient code is like driving a fuel-inefficient car – we’ve all done it but it’s just not cool anymore. With green finally becoming the buzz-word everywhere, it is time to take a look at a few numbers surrounding the environmental cost of bad code.

Read more…

Technical, The Future ,