Posted on Leave a comment

Unofficial Metacritic API released as a package

For everyone googling for what happened to the Metacritic API that was published on it was taken down by Mashape because they received a complaint from CBS Interactive, which owns Scraping web pages (even though my API is not an automated crawler) is a legally grey area and any centralization is a weakness – it’s pretty easy to either block or attack the origin with legal threats.

Therefore I released the API script as a distributable package that you can host on your server and it’s up to you to get the authorization from them that it’s OK to do whatever you are doing.

Click here if you are interested in buying it. Please note, this is a package for developers. This means it should prevent you from having to implement and maintain it yourself. As such, it also means you can use it in as many of your own projects as you like.


Why did I not release the source as free? I want to offer it as a product with support, and not as an soon-to-be abandoned github project. Also, I have a business and lots of bills to pay.

Why PHP 5.5.9 as a requirement? The script was not meant for distribution and I like Lumen now 🙂 But it’s not out of the question that I will make a back-port. Please let me know if there’s any interest for a PHP 5.3 compatible package. However, as a developer I am sure you have a web server for development purposes. After all, you can get one for as low as 5 EUR / month. I have one at and I am happy with it.

What does it mean “support and upgrades”? It means I will fix any bugs, add new functions and regularly release new versions. After your purchase, you will be able to download the newest version of the script from this website.

Posted on 8 Comments

CKEditor save button callback

I am sharing this since it was impossible to find with Google.

Before CKEditor 4.2 if you wanted to handle the save event with a custom function, you had to write your own plugin.

Now all you need to do is to specify the callback upon initialization:

CKEDITOR.replace('ckeditor', {
	on: {
		save: function(evt)
			// Do something here, for example:

			// If you want to prevent the form submit (if your editor is in a <form> element), return false here
			return false;
Posted on Leave a comment

Set up the mssql extension on LAMP

Do you need to connect to a MSSQL database from a Linux, Apache, PHP enviroment? Are you tired of going through endless documentation? Could the production of goat cheese be more profitable than being a freelance web developer?

While I still have no idea about the third, there’s an easy solution for the first two problems!

Before you continue, please be warned I am sharing because it worked for me and I think it’s useful, not because I know everything about it. This article is an expansion to Daniel Lang’s PHP 5.3.6 + MSSQL + FreeTDS article.

Basically, all you need to do is to compile FreeTDS and the MSSQL PHP extension. On a debian-flavoured system (Linux Mint 13 here), this is how you do it.

Fetch the FreeTDS package and compile the library.

sudo su
cd ~
mkdir sources
tar -x freetds-stable.tgz
cd freetds-0.91
./configure --enable-msdblib --prefix=/usr/local/freetds
make && make install
cp include/tds.h /usr/local/freetds/include
cp src/tds/.libs/libtds.a /usr/local/freetds/lib

Now we need to compile the MSSQL PHP extension. For that you need to fetch the source of your PHP version. You can get it with:

php -v

My version is 5.3.10 so let’s use that for the example.

cd .. # go back to "sources"
wget # note the version
cd php-src-php-5.3.10/ext/mssql
./configure -–with-mssql=/usr/local/freetds

Let’s copy the extension to the PHP extensions dir. To check where on your system that is:

php -i | grep extension_dir

Mine is at /usr/lib/php5/20090626/, so…

cp modules/ /usr/lib/php5/20090626/

Proceed to edit your php.ini file (mine is at /etc/php5/apache/php.ini) and add this directive

Please note that if you are running your PHP scripts (with MSSQL code) through the CLI (like usually with cron jobs), you will also need to edit /etc/php5/cli/php.ini in the same fashion.

Now, for each server you need access to, you will need to add a corresponding entry into the freetds.conf config file. This is located in /usr/local/freetds/. Refer to this FreeTDS page for all available options.
Considering this, I added the following:

        host =
        port = 1433
        tds version = 7.0
        instance = Instance_name

You can check if you configured your server correctly with the troubleshooting/query tool that comes with FreeTDS:

ln /usr/local/freetds/bin/tsql /usr/bin # make the tsql tool available anywhere
tsql -S testserver -U some_user

If all is well, the server will ask you for your password. You can then type any query and try it out. Note that the query is executed by the word GO (must be in it’s own line).

2> GO

At this point there’s nothing more than to restart your apache server (service apache2 restart) and you are good to go!

mssql_connect('testserver', 'some_user', 'some_pass');

Refer to the PHP manual on MSSQL and the FreeTDS User Guide if you are having trouble configuring/accessing your server.

If you have a better solution please let me know.

Posted on 6 Comments

jQuery YoxView “Error loading language file”

A quick note for all googlers: If you happen to stumble upon this error when using the great YoxView plugin for jQuery, make sure you don’t put the script in a folder that has “jquery.yoxview” in it’s name. There’s a bug in the script which uses a loose regular expression, which, when provided the following URL
will return
and thus will try to request the language files from e.g.

I have the habit of unzipping the archive and using a full script name + version for the folder name, which has the benefit, that when you change the script version, all your returning visitors will definitely get the latest script since the cache for it will not exist.