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

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

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

Change the SSH login message

To change the message displayed before login, edit /etc/ssh/sshd_config : $ sudo vi /etc/ssh/sshd_config and add (or uncomment) the line Banner /etc/banner ...

March 27, 2007 · 1 min · Dave Perrett

Stop cron emails

Dreamhost sends you an email by default every time you run a cron job. To turn this off, run $ crontab -e and add this line to the top of your cron file: MAILTO=""

March 22, 2007 · 1 min · Dave Perrett

Vi as default crontab editor

Dreamhost sets your default editor to pico. To change it to Vi, add the following line to the .bashrc file in your home directory : export VISUAL="vi"

March 22, 2007 · 1 min · Dave Perrett

Configure Ubuntu w/ Static IP

Ubuntu Enterprise 6 seems to install as DHCP out-of-the-box. To change to a static ip, open the file /etc/network/interfaces. It should contain some lines like : auto eth0 iface eth0 inet dhcp Change this to something like : ...

March 8, 2007 · 1 min · Dave Perrett

Install Ubuntu SSH server

Ubuntu Enterprise 6 doesn’t seem to install sshd out-of-the-box. To install : $ sudo apt-get install openssh-server

March 8, 2007 · 1 min · Dave Perrett

Cake actions from the terminal

Edit app/webroot/index.php and change the lines that read like : if (isset($_GET['url']) && $_GET['url'] === 'favicon.ico') { } else { $Dispatcher=new Dispatcher(); $Dispatcher->dispatch($url); } to something like : ...

February 7, 2007 · 1 min · Dave Perrett