Archive for May, 2006

PHP @ FrOSCon call for papers

Wednesday, May 24th, 2006

The PHP Usergroup Dortmund is again organizing a dedicated PHP room at the Free and Open Source Conference 2007. The event will take place on August 25th and 26th in St. Augustin (near Bonn), Germany. For the dedicated PHP talks program, the call for papers is open until June 4th. Talks are accepted in English and German language. For detailed information see http://froscon.phpugdo.de.

Merkwürdiger OSX Absturz [update]

Tuesday, May 23rd, 2006

Ich wollte vorhin eine Web Anwendung einem kleinen Test unterziehen, dabei stürzte OSX komplett ab - mit einer äusserst merkwürdigen Meldung, die ich mit meiner Digi-Cam festgehalten habe. Wie man auf dem Bild erkennt wollte ich lediglich die Web Anwendung mit dem Apache Benchmark Tool (ab) einem kleinen Stresstest unterziehen und hatte dafür aber eigentlich keine wirklich hohen Werte eingestellt.

[update]

Der Fehler lässt sich reproduzieren :-(. Lasse ich den Benchmark dreimal laufen, friert OSX ein. Jetzt muss ich mal herausfinden, woran das liegen könnte. Ich teste gerade diverse locking-mechanismen um eine brauchbare Möglichkeit zu finden ‘race conditions‘ zu vermeiden. In diesem Speziellen Script wollte ich einen Mechanismus testen, der über Semaphoren funktioniert - möglicherweise geht dabei etwas schief.

Share your OPML

Thursday, May 11th, 2006

Über die Webseite http://share.opml.org/ kann man seine OPML Dateien veröffentlichen und damit die abonnierten RSS Feeds anderen Leuten zugänglich machen. Das ist im Prinzip nicht weiter spektakulär. Der nette Aspekt an der Sache ist, dass man sehen kann, welche Leute die gleichen Feeds abonniert haben und ob sich so möglicherweise noch weitere interessante Feeds entdecken lassen.

Wen’s interessiert: hier sind meine abonnierten Feeds.

Interaktive PHP Shell

Thursday, May 11th, 2006

Ich habe mich schon mal letztes Jahr mit der interaktiven Shell von PHP beschäftigt und war damals zu dem Schluss gekommen, dass sie nicht wirklich brauchbar ist, weil sich z.b. keine ‘Fatal Error’ abfangen lassen und so jeder Schreibfehler zum Abbruch der Shell führt.

Jan Kneschke, der Entwickler meines bevorzugten WebServers lighttpd, hat sich nun dieser Problematik angenommen und hat eine PHP Shell entwickelt, die den eingegebenen PHP Code vor dem Ausführen prüft. Dies geschieht über die Tokenizer Erweiterung. So lässt sich vor dem Ausführen beispielsweise überprüfen ob bei einem Funktionsaufruf die jeweilige Funktion überhaupt existiert oder dass keine doppelten Funktionsnamen angelegt werden.

Das Hauptaugenmerkt bei der Entwicklung der PHP-Shell liegt also bei der Vermeidung des ‘Fatal Error’ - welcher sonst zum sofortigen Abbruch des PHP Interpreters führt.

Ich habe bisher nur kurz mit der PHP Shell gespielt, kann aber jetzt schon sagen, dass sie sehr viel brauchbarer ist, als die in PHP eingebaute Shell - eben Dank der Vermeidung des ‘Fatal Error’. Wer mit der Shell experimentieren möchte, kann Sier hier herunterladen:

PHP Shell von Jan Kneschke

Adding Google-like Search Operators to Simple Search Boxes

Tuesday, May 9th, 2006

Give your users instant access to your most important information.

ADOdb Implementation of Active Record: cloning Zend_Db_DataObject

Saturday, May 6th, 2006

The Zend Framework Preview edition is out. I had look this morning at Zend_Db_DataObject, which is an implementation of the Active Record pattern. After reading the tutorial, decided to implement something similar for ADOdb. After a couple of hours coding, I had an implementation that works with both PHP4 and PHP5, and provides a superset of the functionality described in the above link.

The Active Record pattern is becoming extremely popular because it allows you to hide many implementation details for loading, inserting and updating data. For example, the following code reads a record from the Products table, and allows you to update some fields without SQL. Works in both PHP4 and 5!


  // setup
   ADODB_Active_Record::SetDatabaseAdapter($db);
   class Product extends ADODB_Active_Record {};

  // Example1: create new record, then update
   $activeRec = new Product(); // access  Products table
   $activeRec->name = 'New Name';
   $activeRec->price = 43.90;
   $activeRec->save();  // perform insert
   $activeRec->name = 'Renamed';
   $activeRec->save();  // update the same record

 // Example 2: load existing record, then update
   $activeRec2 = new Product();
   $activeRec2->Load('id=4'); // load record using SELECT * FROM Products WHERE id=4
   $activeRec2->price *= 1.1; // change price
   $activeRec2->save();  // perform update

 // return an array of ActiveRecords for processing...
   $activeRecArray = $db->GetActiveRecords($table,"name like 'A%'");
   foreach($activeRecArray as $rec) {
       ...

   }

Highlights:

  • Works with PHP4 and PHP5 and provides equivalent functionality in both versions of PHP. Zend_Db_DataObject only works with PHP5.
  • Function names similar to Zend_Db_DataObject for easy porting, with extensions such as Load() and Replace().
  • ADodb_Active_Record works when you are connected to multiple databases. Zend_Db_DataObject only works when connected to a default database.
  • Support for $ADODB_ASSOC_CASE. The field names are upper-cased, lower-cased or left in natural case depending on this setting.
  • No field name conversion to camel-caps style, unlike Zend’s implementation which will convert field names such as ‘first_name’ to ‘firstName’.
  • New ADOConnection::GetActiveRecords() and ADOConnection::GetActiveRecordsClass() functions in adodb.inc.php.
  • Caching of table metadata so it is only queried once per table, no matter how many Active Records are created.

Try ADOdb’s Active Record Implementation!

Read the tutorial. This implementation has been incorporated in the main ADOdb code branch since 4.80. Download ADOdb.

Enjoy!

PS: I noticed that the Preview release lacks the source code of the Zend_Db_DataObject implementation. I wonder why?

Scale-Up or Scale-Out Your Database

Saturday, May 6th, 2006

Have been reading some product literature on database scaling up and scaling out. Scaleup means scaling by moving to a bigger, more powerful server, while scaleout means scaling by adding more CPU boxes to a cluster of database servers.

SQL Server 2005

These are good introductory articles:

Oracle 10g (RAC)

These are much more sophisticated articles. Also can you spot where Oracle 10g RAC beats SQL Server 2005 in scaleout?

The typical technique used in MySQL for massive parallelism is the Continuous Replication method where a single master db server has read-write access to the database, and the data changes are replicated over to the other database servers, which are read-only. Does anyone know how stable PostgreSQL’s replication projects are and their current status?

phplondon conference 2008

Wednesday, May 3rd, 2006

February 29th (Leap Year Day). phplondon.org announce their third annual community conference to be held at Inmarsat, Old Street, London.This year the conference will run two tracks and include speakers such as Derick Rethans, Wez Furlong, Scott MacVicar and Zoe Slattery.We will also be holding an extended presentation and discussion on frameworks for PHP.Visit our conference site to register. Early bird discount is available until 1st February 2008.

php|tek 2008: Chicago

Tuesday, May 2nd, 2006

php|tek 2008: Chicago The publishers of php|architect Magazine are proud to announce the php|tek 2008 conference in Chicago, Illinois, USA. The PHP Community meets in May for one of North America’s premier PHP conferences of 2008. Join us to hear top speakers such as Derick Rethans (eZ Systems), Lucas Nelan (Facebook), Chris Shiflett (OmniTI), Eli White (Digg) and yes, even Terry Chay (Tagged). For the past two years, php|architect’s spring conference has sold out weeks before the start date, so if you’re interested in attending, don’t delay, and be sure to sign up ASAP!