There’s a new planet – planet.php.ie

April 16th, 2008 by kenguest

After a bit of discussion on the php.ie mailing list, Kae Verens and David Coallier set up http://planet.php.ie to bundle together blog postings from people within the Irish PHP community – a big thank you is deserved for them.

If you want your blog added to this ‘planet’ please contact either Kae or myself.

On other news, I’m going to start documenting PEAR_Size real soon.

“unable to find swap space signature”

April 15th, 2008 by kenguest

My darling wife told me when I got home from work today that the laptop, running Ubuntu, was a bit slow.

On a hunch, I ran free -m and saw that the swap file wasn’t being used. I rebooted it, and sure enough saw the phrase “unable to find swap space signature”. This generally means that the swap file needs to be regenerated (this can happen with some laptops if they unexpectedly drop into hibernate mode), so I rebooted into Recovery Mode and:

  • I checked the output of fdisk -l to ascertain which partition the swap space was on (/dev/hda3)
  • Recreated the swap space with ‘mkswap /dev/hda3‘ and activated it with ‘swapon /dev/hda3
  • I then opened the file /etc/fstab and edited the line referring to the swap space so it would be referred by /dev/hda3 rather than the UUID value.
  • rebooted and kept my fingers crossed.

Everything worked just fine.

What I’ve done recently

April 11th, 2008 by kenguest

Travis asked What did you do today? recently – and what he did all sums up to an amazing level of work.

I felt a need to answer this question myself. This is what I’ve been keeping myself busy with recently:

  • Released version 0.18.0 of Date_Holidays – this includes drivers for Iceland, Romania and the Ukraine along with some bug fixes.
  • Released version 1.0.1 of Validate_IE, focused solely on adding validation for the 089/Tesco mobile phone network.
  • Released version version 0.1.2 of PEAR_Size. This includes integration with the PEAR command.
  • Wrote a review of CodeIgniter for Rapid PHP Application Development.
  • Kick-started a discussion on aggregating blogs of people in the Irish PHP Users Group.
  • I’m trying to decide what to do with the codebase for the website of the Irish Linux Users Group – at the moment it’s all rather cobbled together and isn’t providing as much functionality to the community as it could. I’ll most likely migrate it over to using a more general purpose framework plus ILUG/User Group specific components.
  • Book Review: CodeIgniter for Rapid PHP Application Development

    April 10th, 2008 by kenguest

    A while ago packt sent me another book to review – this time it was “Code Igniter for Rapid PHP Application Development” by David Upton.

    Similar in size to the PEAR Installer Manifesto, this book weighs in at 240 pages, is aimed at developers new to CodeIgniter, and is split into 15 chapters:

    1. Introduction to CodeIgniter
    2. Two Minute’s Work: Setting up a CodeIgniter Site
    3. Navigating your site
    4. Using CI to Simplify Databases
    5. Simplifying HTML Pages and Forms
    6. Simplifying Sessions and Security
    7. CodeIgniter and Objects
    8. Using CI to Test Code
    9. Using CI to Communicate
    10. How CI Helps to Provide Dynamic Information
    11. Using CI to Handle Files and Images
    12. Production Versions, Updates, and Big Decisions
    13. Instant CRUD – or putting it all together
    14. The Verdict On CI
    15. Resources and Extensions

    Chapter one is a bare-bones introduction to what CodeIgniter is and why it was initially developed.
    Chapter two details how to set up an initial site with CodeIgniter.
    Chapter three introduces the reader to the concept of the MVC pattern, what it is about and how CodeIgniter implements it.
    Chapter four details the ActiveRecord class for interacting with databases.
    Chapter five shows the reader how to specify a View, how to nest them for better reuse and demonstrates CodeIgniter’s Validation class.
    Chapter six is about session management and securing applications.
    Chapter seven, if the reader requires a refresher, explains Object Oriented Programming and through some examples shows that CodeIgniter does not take advantage of PHP5′s enhancements in that regard. It also looks at the object model in CodeIgniter.
    Chapter eight details how to perform unit tests, benchmarking, profiling and how to use mock database objects for test purposes.
    Chapter nine is about various machine-to-machine communications: FTP, mail and using xml-rpc for providing webservices.
    Chapter ten focuses on internationalization, caching and string manipulation.
    Chapter eleven is about file uploads, downloads, compression and image manipulation.
    Chapter twelve discusses various topics relevant to migrating your code from your development servers to production.
    Chapter thirteen details CRUD operations in CodeIgniter.
    Chapter fourteen takes an objective look at what the book has covered as regards CodeIgniter’s abilities and what the author chose to not cover – one admitted omission is a lack of focus on AJAX.
    Chapter fifteen, the last one, provides a list of resources and extensions that the dear reader will want to investigate. These include, but are not limited to, graphing and AJAX classes, methods of authentication and CRUD libraries.

    The book is written well and the inevitable – yet thankfully small – number of spelling and grammar mistakes in the books don’t detract from the book as much as in the SOA one. I got the impression while reading chapter eleven that the author is not particularly knowledgeable about file permissions on linux/unix and specifies the most permissive options for those platforms which is a bit worrying.
    I was amused to find the book “PHP Programming with PEAR” gets a mention in the “Resources and Extensions” chapter, more so because CodeIgniter seems to be a framework that has a chronic case of “Not-Invented-Here” syndrome and attacks the PEAR framework on the main page of it’s website and userguide.

    All in all, I found the book to be a straight-forward, educational read and that it works very well alongside the CodeIgniter online documentation.
    Well worth the read if you are new to CodeIgniter.
    Addendum: Kae asked if reading this book might make me inclined to use CodeIgniter; while I found it very interesting I was also shocked that there is no inclination of embracing and utilising PHP5 enhancements and the chronic NIH present in the framework makes me feel very reluctant to use CodeIgniter. There is a spin-off or fork of CodeIgniter called Kohana that takes advantage of PHP5. It may well be worth investigating.

    Today was Document Freedom Day

    March 26th, 2008 by kenguest

    Today was Document Freedom Day.

    Book Review: The PEAR Installer Manifesto

    March 11th, 2008 by kenguest

    Book Review: The PEAR Installer Manifesto by Gregory BeaverPackt Publishing.

    When I was asked by a Packt representative if I would review the book “SOA Approach to Integration” by Poornachandra Sarang, Frank Jennings, Matjaz Juric and Ramesh Loganathan I was told I could pick a book of my choice as a “thank-you” for writing that review.

    I jumped at the chance to obtain a copy of “The PEAR Installer Manifesto” – and have now been asked to write a review of it, so here goes:

    The book is approximately 270 pages long, split into six chapters, and is aimed at PHP developers who “want to understand how the PEAR Installer works and what it can do for them” and also for those “seeking a better way to deploy their applications and manage updates”.

    The six chapters are:

    1. What is it and how do I get it?
    2. Managing PHP Software Management with the PEAR Installer
    3. Leveraging Full Application Support with the PEAR installer
    4. Clever Website Coordination using the pear Installer
    5. Releasing to the world: PEAR Channels
    6. Embedding the PEAR Installer: Designing a Custom Plugin System

    Chapter one explains what PEAR is, how to install the PEAR installer and how to deploy PEAR packages remotely onto a server over FTP – proving that no matter what way you access your production servers you can, and should, be using the PEAR installer.

    Chapter two covers versioning, package.xml and roles; teaching how to turn software written in PHP into discrete distributable packages.

    Chapter three focuses more on version two of package.xml (chapter two briefly covered both versions 1 and 2 of the package definition file) and explains how to bundle a package with its dependancies.

    Chapter four is about source code control and performing roll-backs on pear packages – essential tasks when it comes to managing a complex website.

    Chapter five details how to set up a channel server, outlines various ways to distribute packages and applications using channel servers and discusses related security issues.

    Chapter six closes the book with an explanation of why you might want to embed the PEAR installed, a discussion of several methods of handling plug-in systems and designing a custom PEAR channel-based plugin system.

    As a PEAR developer who’s going through the process of getting a new package proposed and accepted I found the discussion of package.xml enlightening – much more so than the current online documentation.

    As a developer who has occasionally needed to rollback changes pushed to a production server… well, if chapters two and three weren’t eye-opening enough; chapter four definitely was as it details how to employ the PEAR installer to update and rollback live code so you can quickly revert back to a known working version of the site.

    Though they are relatively few the book is not without its flaws: there is a small number of spelling mistakes present and considering the book was published in 2006 I don’t think it unrealistic to expect these to be corrected in an on-line errata. Other than that I found “The PEAR Installer Manifesto” to be a nicely focused, well written book grounded with good case studies and real world examples.

    Authored by the authority on the PEAR installer the book couldn’t get much better. Highly recommended.

    Our php.ie stand at the Irish Web Technologies Conference 2008

    February 29th, 2008 by kenguest

    I noticed just now that Kae blogged about our participation at the Irish Web Technologies Conference.

    As Kae mentioned, this was the first time that we represented the Irish PHP Users Group at any such conference and we learnt a lot – from the mundane to the slightly more insightful.

    • Bring at least two [long] extension leads along rather than assume there will be power sockets nearby!
    • Have Group business cards to give out – a few times we had to resort to writing the website address and contact/mailing list details of the Group onto scraps of paper; obviously not the best impression to give.
    • Building on this, it wouldn’t be a bad idea to prepare some form of flyer that could be used to raise awareness of what the Group, and PHP in general, is about – a more substantial take away reminder as it were.
    • And on top of this we need to raise awareness of the Group: I got speaking with David Ennis from TechWest in Galway and discovered that until today he had no idea that there was a national users group for php developers. We need to work on making ourselves known. David had some good ideas about this including having regional talks every 3 months or so. We reminded each other that the PHPLondon Conference was on today and for us to hold something similar there’s a lot of baby steps that we’d need to do before we can consider holding something similar.

    It was a good day and I’m sure the next time we participate in a conference we’ll come better prepared.

    Book Review: SOA Approach to Integration

    February 6th, 2008 by kenguest

    Book Review: SOA Approach to Integration by Poornachandra Sarang, Frank Jennings, Matjaz Juric, Ramesh Loganathan – (Packt Publishing)

    I was recently asked by a representative of Packt Publishing to review this book on Service Oriented Architecture and I looked forward to reading the review copy they sent me.

    While I waited for the book to arrive I searched the packt website for the errata for it – and found none. I thought “Either the book is perfect or they haven’t gotten around to publishing a list of corrections yet”. Quite an omen.

    The blurb on the back of the book says that it is intended for “architects and senior developers who are responsible for setting up SOA for integration for applications within the enterprise and applications across the enterprise”.

    The 360 or so pages are split into six chapters:

    1. Integration Architecture, Principles and Patterns
    2. Service- and Process-Oriented Architectures for Integration
    3. Best Practices for Using XML for Integration
    4. SOA and Web Services Approach for Integration
    5. BPEL and the Process-Oriented Approach to Integration
    6. Service- and Process-Oriented Approach to Integration Using Web Services

    Chapter one focuses on integration technologies, approaches and patterns – pretty much laying the groundwork as you would expect an introductory chapter to do.
    The second chapter attempts to drill down deep into what SOA is about.
    Chapter three details the Best Practices that should be followed when using XML for Integration and seems completely out of place considering the intended audience that this book is written for – it is far to low-level for a book aimed at software architects.
    Chapter four focuses on web services and does a very good job of it, advising for example to stick with approved Standards rather than using proprietary extensions of say SOAP and WSDL. Amusingly though, while advising that web services should remain independent of programming languages and application platforms the book soley gives examples in Java and .net.
    Chapter five details BPEL (Business Process Execution Language) and the Process-Oriented Approach to Integration in a rather comprehensive manner.
    Chapter six, discusses the Enterprise Service Bus (ESB) in depth. Just as with chapter 4 I was amused with this one. There is a subsection to it about how ESB helps avoid vendor lock-ins yet there is no discussion of open source offerings that are available for EBS, BPEL etc etc.

    “SOA Approach to Integration” focuses in detail on the WS-* standards and references SOAP very often. There is an anomaly in that there is no mention of REST and while the authors, with their collective experience in Java and .NET, focus on detailing use and interoperability between those platforms I would have expected at least some Open Source technologies and programming languages to be referred to – the ESBs Apache Service Mix, Mule for example; along with perl, PHP and python as some of the programming languages that can be used.
    If PHP was to be mentioned I would expect the “WSO2 Web Services Framework for PHP” to be listed as well as, perhaps, the SOAP and UDDI packages from PEAR.

    I found myself reading some sections of the book repeatedly – not because the technical content was too complex to understand; but due to it being too verbose, due to bad grammar, spelling mistakes and poor punctuation. I also felt that the diagrams and figures in the book should have been identified better, both in the text and individually. A glossary and a more complete index would have been nice too.

    On the whole, although I did enjoy reading portions of the book, it seems to be a lacklustre introduction for software architects and senior developers that are new to Service Oriented Architecture but that’s pretty much all that it is.

    Irish PHP Users Group Meetings tomorrow [on Wednesday 30 Jan]

    January 29th, 2008 by kenguest

    The monthly Irish PHP Users Group meetings are on tomorrow, Wednesday, night at 8 o’clock at the following venues:

    1. Dublin: upstairs in the Longstone pub on Townsend Street
    2. Cork: Metropole Hotel on MacCurtain Street
    3. Monaghan: Contact Kae Verens for details.

    Pádraic Brady, of Patterns for PHP et al, will be making his debut appearance at the Dublin venue.

    More for Date_Holidays

    January 22nd, 2008 by kenguest

    It seems that my recent post about Date_Holidays has evolved into a request-fest for Drivers and Filters to calculate when the national and public holidays for various countries.

    On the list to be developed so far are:
    * Iceland
    * Romania
    * The Ukraine

    Email me or leave a comment below if you are interested in this ;-)

    New release of Date_Holidays PEAR package.

    January 5th, 2008 by kenguest

    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

    January 3rd, 2008 by kenguest

    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.

    Reviving my Kodak Z710 digital camera

    December 30th, 2007 by kenguest

    My digital camera, a Kodak Z710, stopped working under ubuntu a while back; the error message “Could not claim the USB device” was cited.

    A quick google brought up the solution, on Ubuntu Forums – apparently the line relating to the camera was no longer present in /etc/udev/rules.d/45-libgphoto2.rules.
    I inserted the relevant line,
    SYSFS{idVendor}=="040a", SYSFS{idProduct}=="05b3", MODE="0660", GROUP="plugdev",
    at the bottom of that file and, after reloading those rules with /etc/init.d/udev restart. This final step is important – otherwise you’ll have to restart your PC ;-)

    I got the idVendor and idProduct values from the output of lsusb. They were also present in the post to Ubuntu Forums.

    Sad state…

    December 19th, 2007 by kenguest

    As Chuck Burgess says, “The sad state of U.S. Homeland Security…”

    The Linux Counter Project

    December 14th, 2007 by kenguest

    The Linux Counter project has been going for some time now and is an attempt to determine how many people are using Linux worldwide.

    It is also used to estimate how many machines Linux is installed on.

    I received an email this morning asking me to update my details, this is not uncommon as I had not logged in for quite some time, and felt compelled to blog about it to remind others who might want to ‘stand up and be counted’.

    The Irish Linux Counter Homepage details how best to register yourself if you are based in Ireland.

    So go on, what are you waiting for?

    PHP Users Group Meeting[s]

    November 27th, 2007 by admin

    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.

    There’s some mapping ahead

    November 18th, 2007 by admin

    Inside the next seven days two things that I am very excited about* are going to happen:

    • On Thursday (22nd November), Steve Coast from the Open Street Map project will be giving a talk at the HEAnet offices in the IFSC, Dublin.
    • There will be a “Mapping Party” in Dublin on Saturday and Sunday.

    *Never said it wouldn’t be something geeky ;-)

    Selectively mounting systems with sshfs

    November 14th, 2007 by admin

    I recently discovered sshfs; which is a useful way to mount remote systems via ssh.

    I wanted to have some systems mounted automatically on my laptop whenever I am online but not have any timeouts or attempts to connect when I am not. This ruled out simply adding a line or two to my .bashrc file or the /etc/fstab file.

    The solution?
    I already use the whereami package to selectively mount nfs shares and do other things depending on my location so it was just a matter of editing the /etc/whereami/whereami.conf file to include the following:

    #mount /media/server1
    =home sudo -u kguest sshfs server1.example.com: /media/server1 -o workaround=rename
    #mount /media/server2
    =home sudo -u kguest sshfs server2: /media/server2 -o workaround=rename
    

    The ‘home’ location is defined in my /etc/whereami/detect.conf file if the access point at home is detected:

    if wlan
      testap example-ap-name  home,wdhcp
      notat  wlan,wdhcp
    fi

    Combined, these mean that if the whereami script detects an access point named example-ap-name (original isn’t it?) then those remote systems are mounted into the /media/server1 and /media/server2 directories.

    Determining specific install of PEAR packages.

    October 15th, 2007 by admin

    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…

    August 20th, 2007 by admin

    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.