Monthly Archives: November 2010

Eclipse working set

Posted by & filed under Eclipse.

In PHP Explorer, click the inverted triangle and choose Select Working Set. From here you can Add a set so that you can, for example, limit a file search to a particular set.

Editing Joomla Modules

Posted by & filed under Joomla.

It’s useful to know that you can easily hack a Joomla module by opening the relevant module in the /modules directory. Edit the XML file for admin panel entries. Edit the mod_xxx.php file and the helper.php files for the PHP, or edit the file in the tmlp directory for the page HTML. Realy simple!

Manually abort current bash command

Posted by & filed under Linux.

Some things won’t respond to Ctrl+C; in that case, you can also do Ctrl+Z which stops the process and then kill %1 – or even fg to go back to it. Read the section in man bash entitled “JOB CONTROL” for more information. It’s very helpful. (If you’re not familiar with man or the man… Read more »

Finding large files in linux

Posted by & filed under Linux.

Here’s a bash script to do it: #!/bin/bash # if nothing is passed to the script, show usage and exit [[ -n “$1” ]] || { echo “Usage: findlarge [PATHNAME]“; exit 0 ; } # simple using find, $1 is the first variable passed to the script find $1 -type f -size +100000k -exec ls… Read more »

CakePHP ACL with Auth

Posted by & filed under CakePHP.

Auth->allowedActions vs Auth->allow() Use $this->Acl->allow() – documented at http://book.cakephp.org/view/1550/Setting-up-permissions – to set up the ACROs access. You can do this on a controller basis, and also on a controller/action basis. $this->Auth->allowedActions is an array of allowed actions. Auth->allow() alters the $this->Auth->allowedActions array. If you want to be absolutely sure, in any controller, that only certain… Read more »

Moving a Subversion repository

Posted by & filed under Odds.

Host a subversion SNV repository using svnserve server I am detailing here how I moved an svn repos off my Windows development machine onto a Linux based webserver, making it available for checkout from there. Subversion was previously installed on both my windows machine and my linux box. Backup old and create new repos Backup… Read more »

PHP copy and file ownership

Posted by & filed under Linux.

Came across a taxing problem installing Joomla component on an old 1.05 installation. The error was: Warning: copy(/home/example.com/public_html/home/administrator/components/com_rd_rss/rd_rss.xml) [function.copy]: failed to open stream: Permission denied in /home/ucbmedia/public_html/home/administrator/components/com_installer/installer.class.php on line 360 Failed to copy file: /home/example.com/public_html/home/administrator/components/com_installer/component/rd_rss/rd_rss.xml to /home/example.com/public_html/home/administrator/components/com_rd_rss/rd_rss.xml The problem was caused by ownership. PHP was running in fast-CGI mode as user ‘nobody’. But the user… Read more »

Mercury Mail

Posted by & filed under Linux.

I’m using Mercury as a local testing mail server but I need to send mail using a ‘valid’ email address because test@localhost fails validation checks. So I used Configuration -> Aliases to add test@local.dev and map it to test@localhost. But Mercury mail bundled with XAMPP 1.7.3 – was not working. Fix: Configuration -> Protocol modules… Read more »

UTF-8 characters

Posted by & filed under HTML.

If you are getting weird characters when parsing RSS feeds (eg, Twitter) then use: Do not use in conjunction with PHP utf8_decode() – but if you’re not using the above meta then the PHP function might work properly. But using both together you end up with question marks in the text.

CakePHP Pagination

Posted by & filed under CakePHP.

When you add passed parameters for a custom ‘find’ for the pagination routine you need to propagate the params for 2nd and subsequent pages. This is because on 2nd and subsequent pages the action performing the pagination is not receiving the passed params and has ‘lost’ them. You can propagate these params through the Session… Read more »

Date select javascript widget

Posted by & filed under Javascript.

Sorry – this is just a note to self! Have a look at the Event_Ticker in UCB home/files/Event_Ticker – I didn’t use it, but the widget is all working and configured in ticker.php – just uncomment a couple of lines