Add Dreamweaver Extensions

To colour-code a new extension ( .ctp CakePHP templates for example ), edit the file C:\Program Files\Adobe\Adobe Dreamweaver CS3\configuration\Extensions.txt and add the .ctp extension to the first line ( All Documents ) and the PHP Files section : ...

June 4, 2007 · 1 min · Dave Perrett

External Sessions in CakePHP

If you are using CakePHP in conjunction with an existing PHP application, chances are you need to import the normal application’s session into cake. Create a file called session_import.php or something similar in your cake app/config directory with the following contents : ...

June 4, 2007 · 2 min · Dave Perrett

Multiple DBs in CakePHP

Edit : To avoid confusion, cake has quite a nice mechanism for defining multiple DBs already (the database.php file), and if you only want to define a finite set of DBs, this is not the way to do it. This method is only useful if you want to have multiple DBs with the same structure (a database for each customer, for example). ...

June 4, 2007 · 7 min · Dave Perrett

Replacing text with sed

To replace all occurences of string1 in a file with string2 : $ sed -ri "s|string1|string2|" some_file.txt

May 16, 2007 · 1 min · Dave Perrett

Cocoa drag to dock to open

Go to Project->Edit Active Target->Properties (Tab) and enter the filetypes that you want your dock icon to respond to : ...

April 13, 2007 · 1 min · Dave Perrett

Quit cocoa app on window close

Add this method to your NSWindowController : -(BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)theApplication { return YES; }

April 13, 2007 · 1 min · Dave Perrett

Cocoa NSTextView setHidden

If you’re trying to hide an NSTextView without success, be aware that setHidden only hides the NSTextView itself - it doesn’t hide the enclosing NSScrollView. Instead of doing this : [myTextView setHidden:YES]; you need to do : [[myTextView enclosingScrollView] setHidden:YES];

April 5, 2007 · 1 min · Dave Perrett

Format XML with PHP

Courtesy of TJ at devnet ...

April 5, 2007 · 1 min · Dave Perrett

Compile LibTorrent on OSX

Before you do anything, install darwinports , and then use it to install boost : ...

April 2, 2007 · 1 min · Dave Perrett

Installing MySql/PDO for PHP

I was getting something like this trying to run an application built on the Zend Framework : ...

April 2, 2007 · 1 min · Dave Perrett