Aug 22

Sexy Ubuntu

I’ve finally reskinned Ubuntu using a GTK theme from Ubuntu-Art.org. The skin is called Shiki-Colors and it’s a mix of the dark and light themes. I’ve also installed the Gnome-Colors Icons to spice up the look. Installing the theme was pretty easy, but it wasn’t without problems. After applying the new theme, I noticed borders on every division within a window, but after apply the following comment, the theme is working correctly.

This is not a theme problem, it’s a user/root permissions problem. It will happen to any theme/icons you download from the internet and install through the appearance preferences.

To fix this, there are two solutions:
-When installing a theme/icon set, install to usr/share/themes or usr/share/icons as root user, respectively.

- Or for an easier solution, run the following commands in a terminal:
sudo ln -s ~/.icons /root
sudo ln -s ~/.themes /root

And now for some screenshots of this sexy theme.

Jun 29

CakePHP 1.2 RC2 is available!

The cake team is working rather quickly. They have released Cake 1.2 release candidate 2 on June 27th. Time to upgrade once again! The goodness just keeps coming.

Jun 16

Playing with Cake RC1

CakePHP RC1 was released on June 4th. At the moment I haven’t had much time to play with it as I wrap up a few projects using 1.2 beta. One thing I did notice was their inclusion of the Containable Behaviour. This is a powerful behaviour that helps in limiting the data you want to grab from your models. I’ve used both Mariano’s and Felix’s behaviours and I’m glad those forces were combined to produce this, and then some.

This weekend I’ll be upgrading my client sites to RC1 and hopefully all will go well. For information on what’s new in RC1, visit the bakery

Feb 28

CakePHP ACL Behavior modified

I’ve posted this up at the bakery, but articles seem to take awhile to get published. It could also be that they’re working on a new ACL Behavior, one can hope. For the time being, I’ve fixed up the core behavior and added a few features as well. I’ll just replicate here what I wrote at the bakery.

This Acl behavior makes a number of improvements from the built-in one. It allows you to have a model act as both an “Aro” and “Aco”. It creates an alias in this format “Model.id”. If parent node is not provided, it’ll create one based on root object. For example, if you create Post.1 as an ACO and you set parentNode to null, it’ll set the parent_id to the root “Post” Aco if it exists. So your tree would look like the following:

Acos
----------
Post
|-Post.1
|-Post.2
|-Post.3

Usage Instructions

Follow the following steps to use the Acl behavior.

Step 1

Copy the behavior class into a file named “acl.php” in your /app/models/behaviors folder.

Step 2

Load the behavior in the model you want to use it in.

Examples:

Ex 1: Act as Aco

var $actsAs = array('Acl' => array('Aco'));

Ex 2: Act as Aco

var $actsAs = array('Acl' => 'Aco');

Ex 3: Act as Aro

var $actsAs = array('Acl' => array('Aro'));

Ex 4: Act as Aro and Aco

var $actsAs = array('Acl' => array('Aro', 'Aco'));

Step 3

Create the method parentNode($type) in your model. This will return the parent_id to a method in the Acl behavior.

Here’s an example of a User model passing a group id as it’s parent id only for the ARO:

function parentNode($type)
{
if ($type == 'Aro') {
if (!$this->id) {
return null;
}
 
$data = $this->read();
 
if (!$data['User']['group_id']){
return null;
} else {
return array('model' => 'Group', 'foreign_key' => $data['User']['group_id']);
}
} else {
return false;
}
}

That’s it!
Download the behavior class here

Mar 21

Cheat sheets

Sometimes it’s hard to remember certain things about technologies you use when developing a web application. I must admit that I frequent php.net occasionally to remind myself what parameters a function takes. With frameworks, extra php libraries, javascript libraries, and css it becomes increasingly more difficult to remember how to use all of these technologies. In comes the cheat sheet. Cheat sheets are great as a quick reference on how to use common features with a particular technology.

Here is a short list of useful cheat sheets:

Cakephp Cheat Sheet Cake PHP - by Gwoo

Prototype Cheat Sheet Prototype 1.5 - by Jonathan Snook

Moo Tools cheat sheet Mootools r.83 - by Jonathan Snook

Scriptaculous Cheet Sheet Scriptaculous - by Ryan Carter

CSS cheat sheet CSS by Dave Child

You can find more of cheat sheets (PHP, mySQL, Javascript, etc) over at Dave Childs cheat sheet section

Next Page ยป