Nov 28 2011

For me it didn’t seem very intuitive to find out what packages were installed when I tried removing the phpUnderControl PEAR channel (I trialled it but preferred Jenkins). This tutorial has nothing personal against phpUnderControl, it just happened to be the package I was removing at the time… All I got was:

$ sudo pear channel-delete phpuc
Channel "pear.phpundercontrol.org" has installed packages, cannot delete
$

Oh ok… maybe I should try:

$ pear list pear.phpundercontrol.org
parsePackageName(): invalid package name "pear.phpundercontrol.org" in "pear.phpundercontrol.org"
$

Hmmf… after a bit of facepalming I finally discovered that `pear help ` existed, and the correct syntax to find installed packages for a channel is:

$ pear list -c phpuc
Installed packages, channel pear.phpundercontrol.org:
=====================================================
Package         Version State
phpUnderControl 1.0.0   stable
$ sudo pear uninstall phpuc/phpUnderControl
uninstall ok: channel://pear.phpundercontrol.org/phpUnderControl-1.0.0
$ sudo pear channel-delete phpuc
Channel "pear.phpundercontrol.org" deleted
$

PEAR 0, James 1.

Nov 22 2011

I recently upgraded to Eclipse PDT Indigo. It was exciting and stuff. The download size has also been completely slashed – from approx 120mb to 89.2mb, so that makes me happy. It was remarkably easy to install and import my existing projects and stuff (I started a new workspace, rather than re-using the existing one). My first problem I ran into was trying to install the Mylyn Context Connector (that gives you task-focused Navigator view etc.), it was moaning about org.eclipse.cvs.feature.group being missing. The solution, although not immediately obvious, is to actually add the Indigo Update site… which is not included in the default PDT install (!). I think this is one of the reasons the PDT Indigo download is much smaller though…

  • Help > Install New Software…
  • Enter “http://download.eclipse.org/releases/indigo” into the “Work with:” box
  • Hit enter… wait while it downloads
  • Once it’s downloaded, go back up to the “Work with:” box and choose “Mylyn for Eclipse 3.5, 3.6 and 3.7 – http://download.eclipse.org/mylyn/releases/latest”
  • Select “Mylyn Context Connector: Eclipse IDE”  from the package list
  • Do a little dance
I really wish Eclipse would make installing packages easier. It’s such hassle having to know the update sites for things left right and centre.

Sep 9 2011

Yep – this morning I took and passed my first Zend Certified Engineer qualification. As with all the candidates, we are bound by a Non Disclosure Agreement, but my tip for anyone wanting to take the exam is to practise and revise more. I found the questions much trickier than I thought they were going to be (based off the PHP5 mock tests I had left), but rightfully so. Good times people!

Oh yes, by the way I know the link doesn’t work yet, but I’m informed it can take 24-48 hours for my Zend Yellow Pages entry to become live… It’s live now :)

Aug 22 2011

Simples:

<?php
// IN THE FORM
$field->addPrefixPath('NS_Validate_', '../library/NS/Validate', 'validate');
$field->setLabel('Enter one')
  ->setRequired(true)
  ->addValidator('ValueEqualsOne');
 
// In library/NS/Validate/ValueEqualsOne.php
class NS_Validate_ValueEqualsOne extends Zend_Validate_Abstract
{
	const DOESEQUALONE = 'doesequalone';
 
	protected $_messageTemplates = array(
		self::DOESEQUALONE => "This value does not equal one",
	);
 
	public function isValid($value)
	{
		$this->_setValue($value);
 
		if($value == 1)
			return true;
 
		$this->_error();
		return false;
	}
}

I’m not sure yet how to get around having to do the addPrefixPath call every time, but I’ll have to do some hacking I guess…

Jul 30 2011

I have a nasty habit of not adding base URLs to my projects because I never think about anyone else who might use it. Anyway, you can get the base URL like this:

In a Controller

$this->getFrontController()->getBaseUrl()

In a View script

$this->baseUrl()

Reminder really, nothing more. It would be nice to know if there was a less long winded way of getting the base URL everywhere though…