Archive for the ‘php’ Category

New release of Date_Holidays PEAR package.

Saturday, January 5th, 2008

Date_Holidays 0.17.2 was released today; with two new drivers and some bug fixes!

Date_Holidays is a PEAR package for PHP that is used for determining whether a specific date is a [public] holiday in some specified country, listing all such holidays and for these reasons is a useful component for scheduling applications.

This is driver based, one per country.
Currently there are drivers for: Austria, Denmark, England & Wales, Germany, Ireland, The Netherlands (new) , Norway (new), Slovenia, Sweden and the USA.

There are also drivers for Christian and Jewish holidays along with special ‘UN’ celebrated days such as “World Health Day”.

It’s very easy to write new drivers for Date_Holidays, heck I wrote the Ireland driver ;-) So if you’ve noticed there is no driver for where you are I’d recommend that you do so.

Manual install of ezPublish; part one

Thursday, January 3rd, 2008

For the last few weeks I’ve been meaning to install ezPublish, a PHP based Content Management System from the guys working for eZ in Norway.

Well, because I have a number of different systems already running on my laptop I didn’t want to run the plain wizard/installer – just in case something got overwritten that I obviously should have made a backup of, I found the Manual “installation on a Linux/UNIX based system” documentation elsewhere on their site.
Thought I’d share the link as it may come in useful for someone else.

PHP Users Group Meeting[s]

Tuesday, November 27th, 2007

Tomorrow is the last Wednesday of the month – the day the three PHP Users Group meetings are held:

  • Dublin: At the Metropole Pub on Townsend Street [upstairs]
  • Cork: Metropole Hotel on MacCurtain Street
  • Monaghan: Contact Kae Verens for details.

Other details are available on the Irish PHP Users’ Group website.

Determining specific install of PEAR packages.

Monday, October 15th, 2007

Adam Harvey posted about listing which PEAR packages are installed. This inspired me to spend a few minutes coding a solution to check for a specific installed version of a package.
This is useful for where you provide a system that uses certain packages and you decide to not bundle those packages with the system you developed [so you don't have to manually apply upgrades for security fixes etc] and rely on PEAR itself to install and upgrade those packages as need be.

Cool things about PHP…

Monday, August 20th, 2007

Peter Goodman has written a quick blog entry on “15 Cool Things About PHP That Most People Overlook” at http://ioreader.com/2007/08/17/11-cool-things-about-php-that-most-people-overlook/.
It’s an interesting read.

Sixth Meeting in Dublin of the Irish PHP Users Group

Thursday, July 26th, 2007

There were five attendants at this Wednesday’s meeting:

  1. Fergal Byrne <editor@adnet.ie>
  2. Justin Kelly <jk@tedcreativegroup.com>
  3. Ken Guest <kguest@php.net>
  4. Michael Słaby <michal.slaby@epsi.pl>
  5. Stephen Curran <stephen.curran@gmail.com>

Symeon Charalabides sent his apologies, as did Barry O’Donovan – both unable to
attend.

We had a very interesting discussion about the different forms of testing:
Test Driven Development, phpunit, simpletest and the management/recording of
manual testing. CruiseControl and xinc were mentioned in passing.

This segued into chatting about maintaining existing code; the use of
php_beautifier and vim’s indent function for making code more readable and
phpdoc for generating documentation.
PHPCS was also mentioned and how it can be hooked into CVS or Subversion to
ensure only code adhering to the coding standards can be committed – much the
same as Fergal’s suggestion of hooking phpunit up so only fully tested code
can get into the repositary.

All in all it was a successful meeting; we even came away with a nice quote
from Justin: “Perl is nice if you want to be Harry Potter” (!)

links:

  1. xinc – http://sourceforge.net/projects/xinc
  2. cruisecontrol – http://cruisecontrol.sourceforge.net/
  3. phpunit – http://phpunit.de
  4. simpletest – http://www.lastcraft.com/simple_test.php
  5. phpcs – http://pear.php.net/package/PHP_CodeSniffer
  6. php_beautifier – http://pear.php.net/package/PHP_Beautifier

Irish PHP Users Group Website

Thursday, July 12th, 2007

This week a number of us have been discussing the need for a website the Irish PHP Users Group aka PHP Users Group Ireland on http://www.php.ie and what should be on it.

If you are a PHP Developer in Ireland we’d appreciate your input – please do so either on the mailing list (you’ll need to be subscribed to email it) or on the #phpug IRC channel at irc.php.ie ( or irc.linux.ie) .

Thanks

Fifth meeting of Irish PHP Users Group

Friday, June 29th, 2007

The fifth meeting of the Irish PHP Users Group on Wednesday was a quite one with 5 people
present:
* Ken Guest
* Sarah Gleeson
* Eoin McLoughlin
* Glenn Strong
* Tim Gilmartin

Discussed that some other groups have talks and then retire to the pub – would there be a better turn out if we were to give talks on PHP [and related] topics, and where would these be held.

Mentioned the plush PHP Elephant [http://www.nexen.net/elephpant.php] – might be handy to have a few so we can be spotted more easily when having our meetings ;-)

Also discussed output buffering [ http://ie2.php.net/manual/en/ref.outcontrol.php ] and some uses of it; xdebug [ http://www.xdebug.org/ ] and it’s integration with vim and Eclipse.

It was mentioned that I don’t remind/announce these regular meetings soon enough – I’ll endeavour to remind people seven days before hand, rather than one or two.

Irish PHP Users Group; second meeting

Thursday, March 1st, 2007

The second meeting of the Irish PHP Users Group came and went last night – there wasn’t all that many of us there at all (a sum total of two!) . This has triggered a healthy discussion on the mailing list of what we could to do raise the awareness of the Users Group and what it should be about.

Join in on the discussion here.

ViM for PHP Programmers

Monday, February 19th, 2007

I got to read the presentation notes that Andrei Zmievski from Yahoo put on the web after giving his talk on ViM for PHP Programmers at the PHP Vancouver Conference.

I’ve been using vim for ages (at least since ’99 when I wrote Intro to vim for the Irish Linux Users’ Group linux.ie website) and I have to say Andrei pointed out functions that I wasn’t aware of.

It’s also nice to see that Tobias Schlitt’s “phpDocumentor for Vim” plugin got a mention in Andrei’s notes as it is extremely useful for generating phpdoc comments in vim.

Great stuff!

Irish PHP Users Group; the first meeting.

Friday, January 26th, 2007

On Wednesday I had the pleasure of attending the first meeting of IEPHPUG – the Irish PHP Users Group; with thanks to AJ McKee for organising it and our new friends in Zend for providing the drink :-)

It was an interesting chat and quite a bit was discussed: Zend Certification, which frameworks are being used, various CMSs and forking [of Mambo/Joomla and OSCommerce/ZenCart] were all touched on. It was also very interesting to hear of the different solutions deployed that were implemented in PHP.

This will hopefully be the first meeting of many.

Irish PHP Users’ Group

Wednesday, May 3rd, 2006

AJ McKee has kickstarted an Irish PHP Users’ Group mailing list. Not a bad idea at all – there’s already a frappr/Google map for members.

Feed Validator

Monday, April 24th, 2006

If you use PHP (or any other language) to develop Atom or RSS feeds, you really should use feedvalidator.org periodically to ensure no problems pop up.

Fun with parsing retrieved XML.

Tuesday, April 4th, 2006

The search engine for the website that I administer and develop is provided by a third party: query is made against their cluster, XML formatted data comes back, is parsed and displayed.

It stopped working this morning.

I traced the problem down to a PHP Sablotron/XML parsing error (“xml declaration not at start of external entity”). Seems the server that’s connected to now sends response headers back to the client and these headers were getting in the way of Sablotron doing it’s job.

A simple one-liner fix got things working again, as shown in the middle of this sample code:


$fp = fsockopen($queryhost, 80);
if(
$fp) {
    
fputs($fp, $header);
    while(!
feof($fp)) {
        
$xml .= fgets($fp, 128);
    }
}
fclose($fp);

//ensure string starts with the XML declaration.
$xml = substr($xml, strpos($xml, "<?xml") );

$xsltproc = xslt_create();
$result = xslt_process($xsltproc,'arg:/_xml',$xsltfile,NULL,array('/_xml' => $xml));

php session weirdness

Friday, October 21st, 2005

I discovered yesterday that the www.linux.ie website wasn’t allowing logins for Niall Walsh to add a news item to the system. After some investigation I found that the values set in the $_SESSION array weren’t sticking – through some update the session.save_path in the php.ini was left pointing at /var/lib/php4 while that directory was replaced with /var/lib/php5!
It seems not only does php not fall back to using /tmp if the directory specified in session.save_path doesn’t exist, it doesn’t raise an error regarding the problem.

Suffice to say a quick reset has resolved the problem – logins on www.linux.ie are back to normal.

phpDocumentor for Vim

Thursday, October 13th, 2005

Tobias Schlitt wrote an excellent “phpDocumentor for Vim” plugin that I’ve started using in work. It works very well at generating phpDocumentor tags with intelligent defaults, some based on the code in your vim window.

(php) Links of the day

Monday, October 3rd, 2005

While looking around for information on PHP workflow engines I found an absolute goldmine on all things PHP at Tony Marston’s website.

[other] Workflow engine specific information is at:

  1. openflow.it (OpenFlow-OpenSource Workflow Management System)
  2. Galaxia
  3. workflowpatterns.com

Though I’m sure there’s much more out there.

quicker way to code in vim

Monday, August 15th, 2005

I’ve been experimenting with Thomas Link’s excellent tSkeleton plugin for the vim editor recently.

tSkeleton provides file templates and code skeletons which are parsed and expanded when you edit your code. It currently comes with templates for PHP, Ruby, vim scripting and many other languages too.

There are some parts of tSkeleton which will only work when using the gtk-gui version of vim (or the Windows version); the popup menus for example but I’m not going to let that stop me.

This is a brief outline of how I got it working after a few false starts:

  1. Download the multvals and genutils scripts that tSkeleton requires from vim.org and uncompress them until some useful directory. I put them into my /home/kguest/config/vim/scripts/ directory.
  2. Add entries to your ~/.vimrc to source these files:
    source /home/kguest/config/vim/scripts/multvals.vim
    source /home/kguest/config/vim/scripts/genutils.vim
  3. Download the tSkeleton.zip file and uncompress it’s contents into your ~/.vim directory.
  4. Add lines similar to these into your ~/.vimrc
    autocmd BufNewFile ~/.vim/skeletons/*.suffix TSkeletonSetup othertemplate.suffix
    autocmd BufNewFile *.suffix TSkeletonSetup template.suffix
  5. Next you’ll need to copy a directory or two from ~/.vim/skeletons/bits.samples/ to ~/.vim/skeletons/bits/ - I only copied the php directory over.
  6. Finally you may want to set some some details in your .vimrc so tSkeleton can expand the templates with slightly more meaningful information. I added these lines:
    let tskelUserName='Ken Guest'
    let tskelUserEmail='ken@guest.cx'

Some PHP and webdevelopment goodies.

Saturday, August 13th, 2005

Writing more efficient PHP
I found the IBM tutorial on writing more efficient PHP today. Most of it is very obvious stuff [cache values, understand the lower-level workings of the programming language in question so you can take advantage of it's design, etc, etc], says a guy with ten years experience of developing software with a variety of programming languages. But some is more cunning than obvious glaring-you-in-the-face-with-a-cheeky-smile stuff.
For example if too many GET requests are made then the web-application will seem to be much slower. So when generating PDFs, it’s good to issue both the Content-Type and the Content-Disposition headers to minimise the number of requests that the browser may make.
If you aren’t sure what’s going on in a scenario such as this and you use FireFox then you could always install the LiveHeaders plugin to have a detailed look what information and requests are traversing the connection between browser and server.

memcached
I recently discovered the memcached project as well. memcached is a distributed memory caching system like a huge big hash table shared between any mumber of servers intended for use in speeding up dynamic web applications by alleviating database load though it can be used for more generic purposes as well. I haven’t used it yet, but wish I had. It is used by Slashdot, WikiPedia and SourceForge amongst others.

Quick Reference Cards

Friday, January 16th, 2004

Found this handy collection of Quick Reference Cards through google (what else?). I already have the ViM quick reference card printed and adorning my cubicle in work. There are some very nice goodies here :)