MongoDB for Developers

I finished the “M101P: MongoDB for Developers” course from MongoDB University with a 100% score.

Aside | Posted on by | Leave a comment

L’Hymne à l’amour

Video | Posted on by | Tagged | Leave a comment

What A Wonderful World – Trombone Arrangement

Video | Posted on by | Tagged | Leave a comment

Bootstrap themed forms with Silex – UPDATE

In a side-project using Silex I wanted to have forms being styled with Bootstrap. I did not want to write the theming code myself. Since I couldn’t find a solution for Silex itself I thought about re-using a Symfony solution.

Here is what I am using now:

First I added the Braincrafted/BootstrapBundle to the composer.json:

"braincrafted/bootstrap-bundle": "2.0.0"

In my apps bootstrap.php I added a path to the Twig configuration and registered a Twig extension:

$app->register(new Silex\Provider\TwigServiceProvider(), array(
    'twig.path' => array(
        __DIR__.'/views',
        __DIR__.'/../vendor/braincrafted/bootstrap-bundle/Braincrafted/Bundle/BootstrapBundle/Resources/views/Form'
    )    
));
...
$app['twig'] = $app->share($app->extend('twig', function($twig) {
    $twig->addExtension(new \Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapIconExtension);
    $twig->addExtension(new \Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapLabelExtension);
    $twig->addExtension(new \Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapBadgeExtension);
    $twig->addExtension(new \Braincrafted\Bundle\BootstrapBundle\Twig\BootstrapFormExtension);
    return $twig;
}));

In the forms template the theme is registered:

{% form_theme form 'bootstrap.html.twig' %}

From now on the form on the page is rendered nicely in Bootstrap-style.

UPDATE (24.4.2014): As mentioned in the comments – with the latest updates – now some more extensions are needed. The code example has been updated (hat tip gcrico).

Posted in PHP | Tagged , , | 2 Comments

Twitter Bootstrap – no more excuses

Twitter Bootstrap is a very well structured set of CSS classes paired with some JavaScript components which makes it easy to create good looking websites. By default it has a Twitteresque look but it can be customized very extensively.

Besides all that, it is very well documented and brings instant results. I just reworked a small internal web project which was put together with some years ago with totally no UI love and therefore had only minimal CSS applied to it. To be honest – not something to be proud of looking at it from a design perspective.

After an evening of removing the old CSS and bringing in Twitter Bootstrap the application is not to be recognized. It looks like a modern web application even with some responsive design elements which makes it good looking and – even better – usable on mobile devices.

So far I am really exited about the results and plan to use it in more projects. With Twitter Bootstrap even engineers have no excuse why a web application should not have at least a minimum of visual appeal.

Posted in Misc | Tagged , , | Leave a comment

phing: Publish PEAR package to channel

Publishing a PEAR package via a PEAR channel is normally done by uploading the package in the channels admin interface.
While not a being very complicated task it asks for automation when releasing regularly.

So I created a small phing task which uploads a package to a channel server:

   <target name="deploy" description="Upload package to channel server">
    <input propertyname="version" defaultValue="" promptChar="?">Version</input>
    <input propertyname="username" defaultValue="" promptChar="?">Channel-Benutzer</input>
    <input propertyname="password" defaultValue="" promptChar="?">Channel-Passwort</input>
    <property name="channel">http://my-channel-server.com/pearfrontend.php</property>
    <property name="uploadFile">_build/PACKAGENAME-${version}.tgz</property>
    <exec command="curl -d "login=Submit&password=${password}&user=${username}" --cookie-jar /tmp/deployCookie -s ${channel} > /dev/null"></exec>
    <exec command="curl -F release=@${uploadFile} -F submitted=1 -F f=0 -F filename=${uploadFile} --cookie /tmp/deployCookie ${channel} > /tmp/deployCheck"></exec>  
  </target>

I realize that this task lacks any error handling, so you might want to check your channel server afterwards. However so far this worked very well for me.

Pro tip: This is especially nice at the end of a Jenkins Build Pipeline.

Posted in PHP | Tagged , | Leave a comment

XDebug with Zend Server CE on MacOS X Snow Leopard

After (finally) upgrading my Mac to Snow Leopard (a little late – I know) the xdebug module stopped working.
I got “Failed loading /usr/local/zend/lib/php_extensions/xdebug.so: (null)” when launching php in Terminal (e.g. with running phpunit).

Reinstalling xdebug did not help and I eventually found the solution in the Zend forums.

Here are the steps I used to get the current xDebug version (2.1.1) installed:

sudo -s 
ftp http://pecl.php.net/get/xdebug-2.1.1.tgz
tar zxvf xdebug-2.1.1.tgz
cd xdebug-2.1.1
export CFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp" 
export CCFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" 
export CXXFLAGS="-arch i386 -arch x86_64 -g -Os -pipe" 
export LDFLAGS="-arch i386 -arch x86_64 -bind_at_load"
/usr/local/zend/bin/phpize
./configure --with-php-config=/usr/local/zend/bin/php-config
make
cp modules/xdebug.so /usr/local/zend/lib/php_extensions/xdebug.so
Posted in PHP | Tagged , , , | Leave a comment