Seven Things You’ll Regret Reading – Brett Bieber

January 5th, 2009 by bbieber No comments »

Big thanks to Chuck Burgess for tagging me in the y2k+9 chain letter equivalent Internet meme. At least it’s contained within the PHP community. When someone from my family tags me I’ll know I need to quit participating in these things.

1. I was the senior class president of 235 in my high school, but there’s only one person I keep in touch with and still consider a close friend.
2. My first experience at ‘programming’ was with Logo. My favorite script sliced an image, randomly placed the pieces and played a tune when you re-assembled the puzzle.
3. My first web page was a Windows 95 Tips & Tricks site. It was even featured in the Czech PC World magazine in the mid-to-late nineties. Regrettably, it had ‘Special thanks to Microsoft Corporation’ in the footer, and is forever recorded ~somewhere~ in the waybackmachine.
4. I used America Online (AOL) for many years, and I liked it! I was actually an AOL Ranger and monitored chat rooms for terms of service violations and could kick people off… ohh the power.
5. I like orchids, and have a lot of them (at last count around 70). I don’t like dendrobiums though, but I’ll let them live. :-)
6. In about 2001 or 2002 I started using PHP for my personal site so I could listen to my music remotely. The site allowed authorized users to create playlists, rate songs, and stream the audio from my server. At the same time I was using ASP for work and when I asked if we could use PHP – my boss refused, stating “There’s no support for open source software.”
7. I really want to get a PHP user group started here in Lincoln, NE. When I think back about the PHP conferences it makes me really miss having an in-depth conversation with someone else that understands what I’m talking about. New Year’s resolution, get a Lincoln PHP User Group off the ground.

And one more for good measure:
8. I HATE twitter. Flippin’ useless. Gimme Plurk.

Consider thyself tagged:
Christian Weiske
Helgi Þormar Þorbjörnsson
Amir Mohammad Saied
Greg Beaver
Ken Guest
Arnaud Limbourg
Fake Steve Jobs

Here are the rules for my taggees:
* Link your original tagger(s), and list these rules on your blog.
* Share seven facts about yourself in the post – some random, some weird.
* Tag seven people at the end of your post by leaving their names and the links to their blogs.
* Let them know they’ve been tagged by leaving a comment on their blogs and/or Twitter.

Using SimpleChannelServer to manage a PEAR channel on Google Code

December 8th, 2008 by bbieber 9 comments »

I needed to build a quick pear channel for a library I had built – here’s all it takes:

For this example, we’ll assume your Google project is named: myproject

First, we need to check out the root of your Google Code project, so we can place the channel files here, away from your source code files.

svn checkout https://myproject.googlecode.com/svn/ myproject --username mygoogleusername

Now that we have a checkout, let’s build the channel:

cd myproject

Download the SimpleChannelServer phar file from here:

wget "http://svn.php.net/viewvc/pear2/sandbox/SimpleChannelServer/trunk/pearscs.phar?view=co" -O pearscs.phar

Using a recent version of PHP 5.3, let’s execute the pearscs.phar file, and create the channel for the project:

php pearscs.phar create myproject.googlecode.com/svn myproject

Now commit the files to your repository, and let’s try discovering your pear channel.

pear channel-discover myproject.googlecode.com/svn/

You should see the following message, telling you that the channel was added successfully:

Adding Channel "myproject.googlecode.com/svn" succeeded
Discovery of channel "myproject.googlecode.com/svn/" succeeded

Now let’s create our pear package. PEAR has many tools available to aid in package creation. To get up and running quickly, we’ll start from an example and modify it for our own needs.
Download http://simplecas.googlecode.com/svn/trunk/makepackage.php and save it to your local project as trunk/makepackage.php

Modify this file to use your channel name, package name, release information and maintainer info.
Now let’s create the package:

php makepackage.php
pear package

Now you should have a file myproject-0.1.0.tgz

Let’s release the package to the world, substitute the lead name with your handle:

php pearscs.phar release trunk/myproject-0.1.0.tgz leadhandle

This will add the distribution files to the /get/ directory, and update the channel xml files. There’s a small issue with using Google code to host the xml files, and that’s that the content-type needs to be sent as application/xml or text/xml for the channel files to be read correctly, so set the mime-type property for the xml files.

find . -name '*.xml' | xargs svn propset svn:mime-type application/xml

Now commit these files to your repository, and let’s try installing the package!

pear install myproject/myproject-0.1.0

If everything went correctly, pear should have installed the package. Now when you create a new release, just run the release command, update the mime-type on the xml files and commit your changes.

FYI – the package I needed a channel for is SimpleCAS a PHP5 library for authenticating users against a JA-SIG Central Authentication Service.

Updates

There are a couple gotchas for phar packaging. Here’s some info that might ease some problems with creating or opening phars or PEAR packages:
* Make sure you have zlib! ./configure –with-zlib
* php.ini settings

[phar]
phar.readonly = 0
phar.require_hash = 0

PHP & mcrypt on Mac OS X

November 25th, 2008 by bbieber 5 comments »

What a pain to get mcrypt installed supporting all the architectures Mac OS X needs. I could only compile with one architecture. I kept getting:
gcc-4.0: -E, -S, -save-temps and -M options are not allowed with multiple -arch flags
as well as:
configure: error: Sorry, I was not able to diagnose which libmcrypt version you have installed.

Well, the secret is –disable-dependency-tracking (more info here).

To build libmcrypt-
libmcrypt-2.5.8:

MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
LDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
./configure --disable-dependency-tracking
make -j6
sudo make install

To build the mcrypt extension -
php-5.2.6/ext/mcrypt:

/usr/local/php5/bin/phpize
MACOSX_DEPLOYMENT_TARGET=10.5 \
CFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
LDFLAGS='-O3 -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
CXXFLAGS='-O3 -fno-common -arch i386 -arch x86_64 -arch ppc7400 -arch ppc64' \
./configure --with-php-config=/usr/local/php5/bin/php-config
make -j6
sudo make install

mcrypt.so (162Kb MD5: 6801f7ea818954405028eeb68d59a5f6)

Here’s the address to download the extension http://saltybeagle.com/downloads/mcrypt.so

PDO and MySQL on Mac OS X

October 20th, 2008 by bbieber No comments »

I have to do this so often I decided to just put it on my site.

Apple didn’t include MySQL support for PDO within Mac OS X 10.5 (Leopard), much to the frustration of many PHP + Mac devs.

I’ve built pdo_mysql.so for Mac OS X using the 5.2.6 source and latest mysql source.

pdo_mysql.so (133kb MD5: 9f2d8b843a2031907a994ec62e7d2c45)

This works on my xserve, and desktop mac machines running 10.5.5 with the stock PHP 5.2.6 and MySQL 5.0.67 (i686) and 5.0.45 (powerpc).

Just place the file in /usr/lib/php/extensions/no-debug-non-zts-20060613/pdo_mysql.so and add extension=pdo_mysql.so to your /etc/php.ini file.

This should work on all the following architectures:

ucommbieber:no-debug-non-zts-20060613 bbieber$ file pdo_mysql.so
pdo_mysql.so: Mach-O universal binary with 4 architectures
pdo_mysql.so (for architecture i386):	Mach-O bundle i386
pdo_mysql.so (for architecture x86_64):	Mach-O 64-bit bundle x86_64
pdo_mysql.so (for architecture ppc7400):	Mach-O bundle ppc
pdo_mysql.so (for architecture ppc64):	Mach-O 64-bit bundle ppc64

Here’s the address to download the extension http://saltybeagle.com/downloads/pdo_mysql.so

If you’d like the full details to build the extension yourself – see Tom Gidden’s post with all the info.

HighEdWeb 2008 Follow Up

October 10th, 2008 by bbieber No comments »

I was very impressed with the conference this year. Lots of great sessions and good information for us higher ed web folks.

My presentation on Test Driven Development for Web Applications is below. I believe they recorded the audio, but it hasn’t been posted yet.

http://docs.google.com/Presentation?id=dgtbrg66_175gngd8gz5

During the sessions, many of us plurked the details. My colleague Seth Meranda has a post which links to all the sessions with corresponding plurks.

Two days of rest, then I take a plane to Tennessee for PHP Appalachia.

PHP Savant Has A New Home

August 20th, 2008 by bbieber No comments »

As Paul already announced on his blog, I am taking over the Savant project for him, and I will act as the steward for the project into the future.

Savant 3 logo

I’m very familiar with Savant, and use it in all my projects – so when Paul asked if anyone was interested, I volunteered for two reasons – firstly, I’m familiar with the project and knew I wanted to take part, and secondly, many of my projects are dependent on Savant and I would be in for a world of hurt if it went away!

So Paul and I have had quite a few email exchanges over the past couple of weeks, through DNS transfers, file exchanges, database dumps etc. And as of now I’m hosting the PHPSavant.com site, and hopefully will continue the project’s important position and beacon as ‘The Simple, Elegant Template System for PHP.’

Many thanks to Paul for his help over the past few weeks – and to those interested in helping out, feel free to get in contact with me. I’d be happy to let others participate in the project.

Oh, and I hope you like the new design for the homepage. I’ll be working on the site over the next few weeks, so things may be out of place at times, but I’ll do my best to make it easy to find the information developers need.

http://phpsavant.com/

Here’s to Savant!

Lost Stickley Side Table

August 10th, 2008 by bbieber No comments »

The rumor is that this was a prototype Stickley table, never put in to production. It has 14 mortise & tenon joints, and the legs angle slightly outward – which makes it a more complex project to build. This was also the first project in which I used hand-cut dovetails. After some reflection, I think this project required every tool in my little workshop to build. From mortising & tenoning jigs, hand saw & chisel for the dovetails, table saw & dado blades, jig saw for rough-cuts, band saw for the smooth curves, thickness planer, biscuit joiner, sanders, drills and screwdrivers – just about everything was used to some degree.

It has taken me quite a few weekends to build, but now that it’s complete I think it will make a nice piece of furniture for our house.
Done finishing!
Lost Stickley Side Table
half blind dovetails on the drawer front

The only question is – what do I build next?

Getting started with Pyrus, the new PEAR compatible package installer

April 30th, 2008 by bbieber No comments »

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.3 (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

April 17th, 2008 by bbieber No comments »

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.

The University of Nebraska-Lincoln 2007-2008 Graduate Studies Bulletin

New PHP User Group – Lincoln, NE

April 7th, 2008 by bbieber No comments »

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!