Xalan 2.7.0 – Namespace error

I got the following exception while generating a WSDL:

NAMESPACE_ERR: An attempt is made to create or change an object in a way which is incorrect with regard to namespaces.

Solution is to add the following properties to your VM Arguments:

Calling Google Analytics Realtime API from PHP

This article describes how to call the Google Analytics API via PHP.

1. Create a new project in the Google Developers Console (https://console.developers.google.com) and make sure the (realtime) analytics API is turned on. At the credentials page, create a new Client ID. This will generate a Client ID, Email address and a public key fingerprints. Afterwards generate a P12 key. This will also download the key file. I stored in the root of my Laravel project. Continue reading Calling Google Analytics Realtime API from PHP

Responsive Facebook comments

Currently I am using the Joomla Facebook comments plugin from internetpartner.info Works perfect but the only problem was it wasn’t responsive. To fix this add the following code to your css and in the plugin settings change ‘data-width’ to 100%:

.fb_iframe_widget, .fb_iframe_widget iframe[style], 
.fb_iframe_widget > span[style] {
  width: 100% !important;

Plugin settings

DOMDocument not found

I installed the YooTheme master template (yoo-master2) and activated it directly. The only thing I got was a blank page. I had to remove the template folder to get the default template back again and started debugging.

The following error was thrown:

PHP Fatal error:  Class 'DOMDocument' not found in /var/www/mysite/current/public/wp-content/themes/mytheme/warp/src/Warp/Dom/Document.php on line 15, referer: http://www.mysite.nl/wp-admin/update.php?action=upload-theme

The problem was that PHP’s xml library was not installed on my VPS. To install it I had to run:

yum install php54w-xml 

Laravel 4 and environment detection

Lately I was struggling with the environment detection in Laravel 4.1. I am using one VPS for my staging and production environment. So environment detection based on the hostname won’t work for my situation because they are the same. URL detection has been removed in 4.1 due to security issues.

I found a blog post which almost suits my needs. The problem with this approach was that every time I do a deployment (via Rocketeer) I had to create a new environment.php to specify which environment it should use.

Rocketeer pulls a Github repository into a releases folders and creates a symlink from the ‘current’ directory to the right release. Rocketeer has also a ‘shared’ section which will remain (logs / sessions / settings (PhilF)) on deployment. So that would be a nice location for the environment.php


return 'staging'; //or 'production'

So what you should do is to change the detectEnvironment (bootstrap/start.php) file like this:

$app->bindInstallPaths(require __DIR__.'/paths.php');

$env = $app->detectEnvironment(function () use ($app) {

    $environment = include $app['path.base'].'/app/storage/settings/environment.php';
    return $environment ? $environment : 'local';


Note 1: Make sure bindInstallPaths is called before detectEnvironment.

Note 2: I am using ‘include’ instead of ‘required’, because the environment.php is optional. Required will stop the application. When the file is not found it will default to the ‘local’ configuration (for development).

Additional info:
The app/storage/settings directory is a symlink to /var/www/mysite/staging/shared/app/storage/settings

Directory structure:
/var/www/mysite/staging/current –> symlink to a release
/var/www/mysite/staging/releases/201401172200/app/storage/settings –> symlink to staging/shared/settings

See also https://gist.github.com/stefandroog/8489315

Laravel 4 and NodeJs/Redis pub/sub realtime notifications

Currently I am building an application where we can fill in live scores and I needed something to update all my visitors whenever a score has been updated by one of the admins.

Whenever an admin updates the score via the Laravel 4 backend I fire an event and publish it to Redis. I’ve setup a simple NodeJS server which listens to Redis for incoming changes. NodeJS will redirect the message to all Socket.IO clients.

Continue reading Laravel 4 and NodeJs/Redis pub/sub realtime notifications

VSFTPD for CentOS 6.4 (Selinux)

A couple of days ago I was setting up VSFTP on my CentOS 6.4 installation. I followed a tutorial and was able to connect to my server via FTP but however I did not see any contents. No error, nothing. My FTP users are bound to their home dir.

Did some searching on the internet and a lot of people turned off Selinux which causes the issue! Not a ‘real’ solution IMHO. To fix this first run the following command:

getsebool -a|grep ftp

Now check the values: ‘ftp_home_dir’ and ‘allow_ftpd_full_access’. Those should be set to ‘on’.

setsebool -P ftp_home_dir ON
setsebool -P allow_ftpd_full_access ON

Laravel and HTML 5 datetime component

I want to store all dates in UTC format into the database. To use HTML5 datetime-local element you have to do some conversion of datetimes. The HTML5 element expects a format of ‘2013-08-14T18:55’ (Y-m-d*H:i). In this post I’ll show you how I solved this.

Continue reading Laravel and HTML 5 datetime component

Laravel 4: Redirect to the intended url after login

The best way to redirect a user who is not logged in is to use the ‘Redirect::guest(..)’ method. This method will store the intended url in the session of the user. After logging in he can be be redirected back to the intended url via ‘Redirect:intended(..)’.

See example below.
Continue reading Laravel 4: Redirect to the intended url after login

Yii hide buttons of a CButtonColumn / TbButtonColumn

When you are using the CButtonColumn or TbButtonColumn and you want to hide a particular link you have to set the template attribute. You can also use this approach to change the order of the icons. See example below:

Continue reading Yii hide buttons of a CButtonColumn / TbButtonColumn