January, 2010


23
Jan 10

Breaking News – I’m an IE user once more

It’s been a while since I last used IE. As a front-end guy I use IE Tester, a simple app that has multiple versions of IE bundled together. So if you need IE 6 you add a new tab with IE 6 running in it. Awesome!

So the last time I really used IE was the last time I reinstalled Windows and needed to download Firefox. But as Firefox 3.6 came out yesterday (2 days ago really, I upgraded yesterday) the only game I play stopped working.

The reason why I started running IE again is that Battlefield Heroes is not compatible with Firefox 3.6 (yet).

The Battlefield Heroes developers already confirmed the bug and said a fix is on the way. Unfortunately, nobody seems to understand why they didn’t test the game when FF 3.6 was in beta (there were more then one beta versions).

In case you’re wondering, Battlefield Heroes is a free online shooter game. You install on your computer but in order to run it you need to go to the official website, log in and the game launches via a browser addon. At the moment only Firefox and Internet Explorer are supported, and as FF doesn’t work, I went back to using IE to start the game.

Now the fine print: I still use FF for all my day-to-day activities. I use IE only to run the game.


12
Jan 10

Institut za povijest umjetnosti

Institut za povijest umjetnosti is the official website of Croatian Art history Institute.

The website is built with CakePHP and jQuery.


12
Jan 10

Eventio

Eventio.co.uk is a business and networking oriented events posting site. Build with CakePHP, with some Geo coding running in the background.


12
Jan 10

Capital Business Research

Capital business research carries out quantitative and quantative online research surveys amongst thousands of businesses based across all sectors in both the small and the SME Market.

The site is build on a PHP / MySQL with a CMS for building surveys, exporting results and managing users.


9
Jan 10

A week in prototyping

I’ve spent the past week building a prototype of an application I plan to launch later this year. It’s your usual Twitter-style networking app with a twist, but I’ll hold off from sharing much details for now. Once the domain name clears, I’ll send out the demo to a couple of seed fonds in hope of raising some capital and bringing this idea to life ASAP.

Lithium framework hit version 0.4 – I feel ashamed I still haven’t put it to good use.

There was an annual TweetUp on Friday 8. Met a lot of new friendly people there.

Aside from that I finished a little VB.net app I was postponing for over two months now. It took a few hours, but it was worth it.

Next week will be mostly about bringing the prototype to a stable version with all the functions planned. I figure 5 days should be enough to do just that.


3
Jan 10

The missing gems of Django in CakePHP

Django is a really powerful web framework and I really miss some of it’s gems back in CakePHP. The thing I really miss is get_object_or_404 which is a shortcut for looking up database results and raising a 404 if none are found. When working with Cake most people typically do the following:

function view($id=null) {
	if (!$id) {
		$this->Session->setFlash(__('Invalid Category.', true));
		$this->redirect(array('action'=>'index'));
	}
	$this->set('category', $this->Category->read(null, $id));
}

So basically, if the read method doesn’t return anything, you get a blank page. Of course, you can check if something was returned or not. But it’s just extra work (and the console should do it for you if you ask me..). So why not make our own get_object_or_404 method?

The easiest way to do this is to create our own method in the AppModel class. Open up app_model.php in your project/app root (or create one if you don’t have it).

<?php
class AppModel extends Model {

    function getDataOr404($id = null) {
        if(!$id) {
            // return a 404 if the ID wasn't supplied
            $this->cakeError('error404');
        }

        $data = $this->read(null, $id);

        if($data) {
           return $data;
        } else {
            // $this->read returns FALSE if no data is found
            $this->cakeError('error404');
        }
    }

}
?>

So how do you use this? Open up one of your controllers and do the following:

function view($id=null) {
     $this->set('category', $this->Category->getDataOr404($id));
}