Posts filed under ‘Uncategorized’
How not to display fault exception messages
With the imminent release of the iPhone 4 in Australia, I received an email from Optus to pre-register for the lineup outside the Optus stores.
Unfortunately, when I visit the link: Optus pre-registration I get the following error message:
Hypersite with URL 'https://optusiphone4.com/content/launch?elq=97148e61ae704842868620d3dcf34102' could not be found (Fault Type: System.ServiceModel.FaultException) - (Fault Code: System.ServiceModel.FaultCode)
This is a SOAP exception error and indicates this site uses M$ ASP.NET.I am dumbfounded that this error message is not more properly handled (as indicated by MSDN FaultException better fault handling should occur via using a FaultContractAttribute) and a more intuitive web page is provided e.g. a web page with “Thankyou for your interest but currently we are overloaded. Please try again later” or even cooler a Twitter version of a Fail Whale will suffice , though I suspect they did not expect this level of interest for the release of the iPhone 4 in Australia.
Quirks of PHPUnit & Xdebug setup in Ubuntu 9.10 (Karmic Koala)
PHPUnit is a good Unit Testing framework for PHP and works well with the Zend framework.
Setup Quirks for PHPUnit & Xdebug
It is especially easy (installing & configuring via PEAR – PHP equivalent of CPAN for Perl) [thank you Sebastian for the update]:
>sudo apt-get install php-pear
>sudo pear upgrade-all PEAR
>sudo pear channel-update PEAR
>sudo pear channel-discover pear.phpunit.de
>sudo pear install pear.phpunit.de/phpunit
Install the xdebug libraries as well:
>sudo apt-get install php5-dev
>sudo pecl install xdebug
Edit the file /etc/php5/apache2/php.ini and add the following two lines to the bottom of the file:
[xdebug]
zend_extension="/usr/lib/php5/20060613+lfs/xdebug.so"
(Note that the xdebug.so file might be located in a different directory. Please double check this).
PHPUnit Code Coverage Memory Quirk
Another quirk is a memory hog issue that exists with the code coverage reporting done by PHPUnit.
As PHPUnit is run from the command line, you will need to modify the ‘cli’ version of the php.ini file than rather apache2 directory version.
> vim /etc/php5/cli/php.ini
And look for the memory_limit variable and set it to 512 Mb (Yes, it does take a lot memory!!).
>memory_limit = 512 M
This is recommended by Jeffrey Sambells
PHPUnit erroneous package Quirk
It appears that PHPUnit uses YUI for the javascript even though t is disabled in /usr/share/PHPUnit/TextUI/TestRunner.php ($arguments['reportYUI'] = FALSE;)
The error message being reported is the same as reported on Ubuntu launchpad:
# phpunit --coverage-html coverage-html application PHPUnit 3.3.16 by Sebastian Bergmann.
Time: 0 seconds
OK (0 tests, 0 assertions)
Generating code coverage report, this may take a moment. Warning: copy(/usr/share/php/PHPUnit/Util/Report/Template/container-min.js): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Util/Report.php on line 242
Call Stack:
0.0008 95544 1. {main}() /usr/bin/phpunit:0
0.4147 6243128 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
5.0970 6249232 3. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:128
5.0979 6263480 4. PHPUnit_Util_Report::render() /usr/share/php/PHPUnit/TextUI/TestRunner.php:424
5.0989 6268848 5. PHPUnit_Util_Report::copyFiles() /usr/share/php/PHPUnit/Util/Report.php:115
5.1511 6272616 6. copy() /usr/share/php/PHPUnit/Util/Report.php:242
Warning: copy(/usr/share/php/PHPUnit/Util/Report/Template/yahoo-dom-event.js): failed to open stream: No such file or directory in /usr/share/php/PHPUnit/Util/Report.php on line 242
Call Stack:
0.0008 95544 1. {main}() /usr/bin/phpunit:0
0.4147 6243128 2. PHPUnit_TextUI_Command::main() /usr/bin/phpunit:52
5.0970 6249232 3. PHPUnit_TextUI_TestRunner->doRun() /usr/share/php/PHPUnit/TextUI/Command.php:128
5.0979 6263480 4. PHPUnit_Util_Report::render() /usr/share/php/PHPUnit/TextUI/TestRunner.php:424
5.0989 6268848 5. PHPUnit_Util_Report::copyFiles() /usr/share/php/PHPUnit/Util/Report.php:115
5.1743 6272616 6. copy() /usr/share/php/PHPUnit/Util/Report.php:242"
The fix for this is relatively straightforward, though having an updated package should alleviate this. Doing a bit of googling showed there is a patch. Looking at the patch it was a simple case of editing /usr/share/php/PHPUnit/Util/Report.php and removing the offending javascript lines from the php script:
-- /usr/share/php/PHPUnit/PHPUnit/Util/Report.php +++ /usr/share/php/PHPUnit/PHPUnit/Util/Report.php @@ -230,12 +230,10 @@ 'chameleon.png', 'close12_1.gif', 'container.css', - 'container-min.js', 'glass.png', 'scarlet_red.png', 'snow.png', 'style.css', - 'yahoo-dom-event.js' );
Hope this helps whoever comes across the same quirks when setting up PHPUnit.
Website Name Change
Finally, I have had time & success in changing the domain name to debounce.org
Didn’t take much work. All it really required was buying 10 credits ($10USD) and changing the domain nameservers via my domain host provider. Sweet!
I will be conducting some restructuring of the site to ‘synergise’ my social networks so that it can be accessed from the one location.
There will be a section on photography, with my first DSLR (Canon 1000D) takin centre stage, with the help of flickr, and the forays of a geek trying to get better at taking shots.
A section will be dedicated to iPhone dev and the angst and pros of developing on the platform (esp. with the upcoming iPhone 3.0)
Also, this site will try to be the one-stop shop for tech events or trends happening in Sydney (and possibly around the world!)
Hello world from the iphone
Trying out wordpress iPhone app.
It seems to be quite intuitive thought it lacks certain features.


