Getting started with Pyrus, the new PEAR compatible package installer
2008-04-30 15:24:34
There are quite a few reasons to start playing with the new PEAR package manager - named Pyrus. The first of which is that it is filled with PHP 5 goodness, utilizing many features of the SPL. And secondly, PEAR2 is just around the corner and these are exciting times for PHP development.
Prerequisites:
- PHP >= 5.2? (I believe you need libxml > 2.6.16, but could use some help verifying this)
- SQLite Extension, should be included by default (sudo apt-get install php5-sqlite)
The first thing we need to do, is create a temporary directory to checkout the PEAR2 files from the repository:
Note: In case you haven't heard, PEAR2 source files are in subversion at http://svn.pear.php.net/PEAR2
mkdir ~/PEAR2_SVN
cd ~/PEAR2_SVN/
svn co http://svn.pear.php.net/PEAR2
Great, now you have a copy of the latest files for Pyrus and PEAR2. (r 314 when this was written).
The following packages are the backbone of the new package manager:
PEAR2_Autoload
PEAR2_Exception
PEAR2_Pyrus
PEAR2_HTTP_Request
PEAR2_Developer (if you'd like to build some PEAR2/Pyrus installable packages)
The PEAR2 channel is not available yet, but we can install the individual packages in Pyrus by using their respective package.xml files within the svn checkout.
Before we install the new packages, let's create a directory to place our Pyrus installation. Previously, users would create a system PEAR install in /usr/share/pear or similar, or a local PEAR install in ~/pear/. And at this point, you would have to make a decision you might have to live with for the rest of the installed packages' lives. But, don't worry! With PEAR2 we can move this Pyrus managed installation later if needed.
mkdir ~/pyrus
cd ~/pyrus/
Note: it is important to change the directory to where you wish to install the packages as the current directory will be used as the default install location for pyrus commands.
Now let's install some packages
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install ~/PEAR2_SVN/PEAR2/Autoload/trunk/package.xml
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install ~/PEAR2_SVN/PEAR2/Exception/trunk/package.xml
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install ~/PEAR2_SVN/PEAR2/HTTP_Request/trunk/package.xml
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install ~/PEAR2_SVN/PEAR2/Pyrus/trunk/package.xml
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install ~/PEAR2_SVN/PEAR2/Pyrus_Developer/package.xml
Now you have Pyrus and all the necessary dependencies installed!
To get started, you can create your PHP files which reference the PEAR2 autoloader by using:
<?php
require 'pyrus/src/PEAR2/Autoload.php';
...
How to create a PEAR2 package
The easiest way to create a Pyrus installable package is to set up a standard filesystem layout, and auto-generate the package.xml manifest for installation.
The source layout is as follows:
PackageName/src/ [role="php"]
PackageName/examples/ [role="doc"]
PackageName/doc/ [role="doc"]
PackageName/data/ [role="data"]
PackageName/tests/ [role="test"]
PackageName/www/ [role="www"]
In the root of your package directory create the following files:
CREDITS (this file contains the project lead info)
example
; maintainers of PackageName
Brett Bieber [saltybeagle] <brett.bieber@gmail.com> (lead)
README (this file contains the summary and description for the package)
example
This package is for use with blah
With this package you can do blah, blah, blah blah. My extended
description goes here.
RELEASE-0.1.0 (This file contains the release notes)
example
This is the first alpha release.
You can create your PEAR2 installable package by using the Pyrus_Developer package and using a file like this:
makepackage.php
<?php
error_reporting(E_ALL);
ini_set('display_errors',true);
require 'pyrus/src/PEAR2/Autoload.php';
$a = new PEAR2_Pyrus_Developer_PackageFile_PEAR2SVN(dirname(__FILE__), 'PEAR2_MyNewPackage');
Then run the file to generate the package.xml and install your package:
php makepackage.php
cd ~/pyrus
php ~/PEAR2_SVN/PEAR2/Pyrus/trunk/pyrus.phar install PackageName/package.xml
Hopefully this gives you all a quick understanding of how to get started, and some idea of where things are headed.
Note: The latest copy of this document is available at
http://docs.google.com/Doc?id=dgtbrg66_50d5c68d
Catalog of Courses/Graduate Bulletin
2008-04-17 19:16:57
Course catalogs are a beast of a publication. The documents are traditionally printed on regular intervals and offer a complete listing of requirements and courses of study for an academic institution. For some students, these books become the bible by which their lives revolve around for 4+ years of professional education. They become a carefully studied map guiding them through the courses required to earn a very expensive piece of paper.
I followed my bulletin closely and kept a copy of it in a secure location. I would refer to it after every semester to make sure I was still on track. Sure there were minute changes, but this was a mammoth printed catalog... and acted as a binding contract between the school and the student.
As the electronic era has progressed, we're offered new opportunities for publishing these large documents, be it PDF, HTML or even print on demand. At some point I'm sure typesetters were working on this document and it was rarely updated. At some point it was transferred to an electronic format, but still printed to paper. But recently I had the opportunity to transfer one of these large publications into an electronic format, that will hopefully become a long lasting appointment.
I'm referring to, an online course catalog or bulletin of courses. In this instance, the University of Nebraska-Lincoln's graduate bulletin. Not to a PDF, but to a solely electronic based medium that will act as the permanent location of the publication.
The old file was a meticulously updated FrameMaker document, which offered some flexibility in output, but nothing to the extent required. The process took probably 3 months to complete, and went online last November to some quiet fanfare. But today, I felt one of the most gratifying moments any web developer could ask for... an end user expressed an unprovoked appreciation and testimonial of the website.
There may never come a day when someone acknowledges the revisioning features, the XCRI XML output format, the simple URL structure or the ease of editing - but after today, it was all worth it.
With that, here's the link - I commend everyone else that has transferred one of these large publications into an online format, it is no easy task.
New PHP User Group - Lincoln, NE
2008-04-07 11:25:07
Greetings fellow PHP developers! I just wanted to invite you to a PHP
User Group meetup here in Lincoln (the first, to my knowledge).
This is something I've been meaning to do for a long time... and I've
finally set a time, a place, and a website. :-)
Thursday, April 10th 2008 7pm-8:30pm CBA 108
Right now the agenda is light, so if you have a topic you'd like to
talk on - by all means let me know and I'll add it to the agenda.
Hopefully we can get some project demos and discussion on what people
are working on currently.
We have room for around 20 people so invite some friends and forward
this on if you know of anyone interested --- especially students you
may have contacts with. I think student participation is key to the
growth and continued life of this user group.
The website is:
http://phpug.unl.edu/
I'll bring some pop & pretzels.... Hope you can attend if you're available!
Stickley #602
2008-03-31 22:04:38
Recently I discovered the online woodworking community... something which I never even thought of looking for online.
Through the searches and feeds I've amassed - I'm finding a lot of inspiration and a ton of projects I'd like to build. The first of which is a reproduction Stickley tabouret.
I'm not finished yet - I just finished staining it tonight and I'll put topcoat on it in the next few days. But, building it was quite a pleasure, as there's a lot of good construction and joinery techniques to practice in it.
It's an excellent little table/stool, with good proportions and a nice size.

Thanks to TreeFrogFurniture for the inspiration.
Plurk'in Away
2008-03-12 10:49:55
A good friend of mine (and a fantastic UI designer) ran away to seek fortune and fame with a vc firm in Canada. After I started pouting, he sent me an invite to their latest creation, and I've been using it for the last month or so.
It's called Plurk.com
Screenshot for proof:

The site is pretty nifty... and, as they say, targeted towards HSTG (high-school teenage girls)... but it has some interesting social networking aspects to it.
I would classify it as IM on steroids, or Twitter with threaded responses.. and I can see this being a new gossip channel for those that do that sort of thing. :-)
New features are rolling out quickly, but it really is a nifty little talk channel - and with integration with a Jabber client you can easily keep in touch with what your friends are doing.
I've posted my invite link in case anyone wants to try it out... if anything it could be useful to get an idea of what young kids are doing.
http://plurk.com/redeemByURL?from_uid=229&check=-2142784318
And finally, way to go Alvin! The site looks really fantastic and we miss you.
iPhone/iPod Touch WebClip Icons
2008-01-16 13:28:25
The new webclips allow users to add 'one-click' access to web based applications on their iPhone and iPod Touch.
Web developers can provide an icon specifically for the main screen of the iphone, by adding a file to their server or a link within the head of their document.
The icon sizing is a little tricky to get the hang of. While the Apple website recommends 57x57 for an icon size, I've found that a larger image will create a sharper icon.
There is also areas of the image which will get trimmed to make the webclip icon, so add some padding.

Place apple-touch-icon.png in the root of your web server, or add <link rel="apple-touch-icon" href="/path/to/myicon.jpg" /> to the head of your document.
Now when users add a webclip for http://www.unl.edu/ they'll see the new icon.

Upgrading Ancient PEAR Versions
2008-01-11 10:46:31
If your PEAR installer is acting funky, returning 404's, remote packages not found etc you may have an ancient version in need of upgrading. As announced almost a year ago, XML RPC would be disabled on Jan 1st, 2008.
Here's a typical error:
# pear list-upgrades
HTTP error, got response: HTTP/1.1 404 Not Found
Didn't receive 200 OK from remote server. (HTTP/1.1 404 Not Found)
Read this message on the PEAR website for how to fix it.
Test Driven Development
2007-11-16 13:17:48
Yesterday I gave a presentation to a group of campus web developers on Test Driven Development, and how it relates to web applications.
The topics I covered included:
* Test Driven Development
* Unit Testing
* Selenium & integration with unit testing frameworks
* Continuous Integration & Cruise Control
Overall I think everyone was able to grasp all the topics covered, and leave with a basic understanding of TDD philosophy, the benefits of it, and how to get started.
Slides available online at http://docs.google.com/Doc?id=dgtbrg66_52fjqngh
Facebook Mobile Edition Validation
2007-11-09 09:55:33
When you proudly proclaim that your application works in mobile browsers, and you've dedicated resources to creating a mobile edition of your web application - you might want to make sure it actually works.

This page contains the following errors:
error on line 2 at column 848: EntityRef: expecting ';'
Below is a rendering of the page up to the first error.
Now that you can easily integrate HTML validation into your PHP Unit test suite, are there any other excuses? Come on guys, entity references?!?
"it's like I'm playing with my brother's kids or somethin'" - Billy Bob in Tombstone :-)
Electric Bill
2007-11-06 20:38:03
As my wife can attest to, when I opened our electric bill this month it was as if I had won the lottery.
$50.13
Now that might not seem like a big deal to some, but, considering that we have no natural gas bill - I think that's quite a number.
I've already blogged about our Energy Star home, heat pump and electric water heater, and my use of compact florescent light bulbs - but I've also tracked our electric bill since we moved in.
We're now over 1 year in the house, and to celebrate, I've published our electric bill as a Google document.
An interesting tidbit of information is the fluctuation of the price per kilowatt hour. In the winter months, the price drops quite a bit as electricity becomes more abundant due to the majority of homes using natural gas for heat. By looking at the numbers you can see that our usage goes up quite a bit in the winter, but the cost stays relatively low.
Our house is probably an average sized starter home, 1246 sq feet with a 560 sq ft basement... so about 1800 altogether and while pretty efficient - I'm sure there is room for improvement. A step would be enabling the power saving features on my computers, which I've refrained from doing. :-| Next to that, tweaking our thermostat settings may allow me to kill-a-watt. (wishlist item)
I'll continue to track this and see comparably how we're doing over the next year - with the goal of reducing the average kw/h usage. Overall it's an exciting time to be excited about energy efficiency and conservation.
http://spreadsheets.google.com/pub?key=pub1-LI1gApqqofh2WT5EQQ