116536 items (844 unread) in 26 feeds
CNN
(30 unread)
MSNBC
(26 unread)
PHP
(82 unread)
Deals
(668 unread)
Tech
(16 unread)
Web Development
(5 unread)
CNN Money
(12 unread)
Savers Sites
(5 unread)
sudo zf create project-provider csv importSpecials,importSummersaleAfter running the command the project's profile .zfproject.xml has been modified and a new providers directory exists in the project root directory containing the scaffolded Csv provider. The next code snippet shows the initial Csv provider class skeleton and its two empty action methods named importSpecials and importSummersale. At the point of this writing, using the Zend Framework 1.8.4 and PHP 5.2.10 on a Mac OS X system the generated Csv provider code or the mapping in the .zfproject.xml is incorrect, but can be fixed by renaming the class from CsvProvider to Csv.
<?phpImplementing the action logicHaving the project provider class skeleton ready to get going, it's time to enliven the actions with their intended features by using either other components of the Zend Framework, any suitable third party library or plain-vanilla PHP. For the sake of brevity I decided to implement only the importSpecials action which transforms the data of a known CSV file structure into a relevant database table. The CSV parsing steps shown next might not be that sophisticated, as their sole purpose is to illustrate an exemplary implementation of a project specific provider action.
require_once 'Zend/Tool/Project/Provider/Abstract.php';
require_once 'Zend/Tool/Project/Provider/Exception.php';
class CsvProvider extends Zend_Tool_Project_Provider_Abstract
{
public function importSpecials()
{
/** @todo Implementation */
}
public function importSummersale()
{
/** @todo Implementation */
}
}
<?php
require_once 'Zend/Tool/Project/Provider/Abstract.php';
require_once 'Zend/Tool/Project/Provider/Exception.php';
class Csv extends Zend_Tool_Project_Provider_Abstract
{
private function _isProjectProviderSupportedInProject(Zend_Tool_Project_Profile $profile,
$projectProviderName)
{
$projectProviderResource = $this->_getProjectProfileResource($profile,
$projectProviderName);
return $projectProviderResource instanceof Zend_Tool_Project_Profile_Resource;
}
private function _isActionSupportedByProjectProvider(Zend_Tool_Project_Profile $profile,
$projectProviderName, $actionName)
{
$projectProviderResource = $this->_getProjectProfileResource($profile,
$projectProviderName);
$projectProviderAttributes = $projectProviderResource->getContext()
->getPersistentAttributes();
return in_array($actionName, explode(',', $projectProviderAttributes['actionNames']));
}
private function _getProjectProfileResource(Zend_Tool_Project_Profile $profile,
$projectProviderName)
{
$profileSearchParams[] = 'ProjectProvidersDirectory';
$profileSearchParams['ProjectProviderFile'] =
array('projectProviderName' => strtolower($projectProviderName));
return $profile->search($profileSearchParams);
}
public function importSpecials($csvFile, $env = 'development')
{
$relatedTablename = 'specials';
if
Truncated by Planet PHP, read more at the original (another 6273 bytes)
As a follow-up to my recent post on Dependency Injection containers and Zend_Application I was eager to find out if its possible to integrate the new Symfony Dependency Injection Container into the Zend Framework. To my suprise its possible without having to make any changes to one of the two components. An example use-case would look like:
$container = new sfServiceContainerBuilder();
$loader = new sfServiceContainerLoaderFileXml($container);
$loader->load(APPLICATION_PATH.'/config/objects.xml');
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/config/application.xml'
);
$application->getBootstrap()->setContainer($container);
$application->bootstrap()
->run();
Resources instantiated by Zend_Application are then injected into the container by the name of the resource and are given the resource instance. Any object from the Symfony container can then use these dependencies in their object setup. The only drawback of the integration is the fact that the Symfony Container is case-sensitive in regards to the service names but Zend_Application lower-cases all service before injecting them into the container. The following code is a restatement of my previous example of a MyModel class which requires a Zend_Db and Zend_Cache constructor argument.
$container->register('myModel', 'MyModel')
->addArgument(new sfServiceReference('db'))
->addArgument(new sfServiceReference('cache'));
Access to a MyModel instance with its dependencies is then granted through the call $container->myModel throughout the application. Make sure to call this after running Zend_Application::bootstrap, so that the Resource dependencies are injected first.
With the announcement of the speakers for this year’s Zend/PHP Conference it seems I’ll be giving three talks this fall (in the span of two months):
First at CodeWorks 2009 (Dallas) I’ll be giving a talk on best practices, standards and tools to help with both in your PHP development:
The other two will be at ZendCon (in San Jose). They’re on two different topics:
Hope to see you all there! Here’s more info on the two conferences: CodeWorks (Sept. 26th-27th in Dallas) and ZendCon (Oct. 19th-22nd in San Jose)
My article on High Performance and Availability with Oracle RAC and PHP is out on the Oracle web site. Enjoy.
CREATE TABLE _TREE_ (our key components are
id int(11) NOT NULL auto_increment,
parent_id int(11) NOT NULL DEFAULT 0,
seqid int(11) NOT NULL DEFAULT 0,
depth int(11) NOT NULL DEFAULT 0,
leaf int(1) NOT NULL DEFAULT 0,
name varchar(128) default '',
fullpath TEXT default '',
PRIMARY KEY (`id`),
INDEX qlookup( parent_id , seqid , depth)
);
This does the hard work of iterating through the tree, and updating the sequence number, depth, leaf field and filling in the fullpath field
DROP PROCEDURE IF EXISTS _TREE__resequence;
DELIMITER $$
CREATE PROCEDURE _TREE__resequence(i_sep VARCHAR(4)) DETERMINISTIC
BEGIN
DECLARE v_p, v_d, v_s INT(11);
DECLARE v_fp TEXT;
SET v_fp = '';
SET v_p =0;
SET v_d =0;
SET v_s =0;
SET max_sp_recursion_depth=255;
CALL _TREE__resequence_sub(v_p, v_d, v_fp, i_sep, v_s);
END $$
DELIMITER ;
DROP PROCEDURE IF EXISTS _TREE__resequence_sub;
DELIMITER $$
CREATE PROCEDURE _TREE__resequence_sub(
i_parent INT(11),
i_depth INT(11),
i_fullpath TEXT,
i_sep VARCHAR(4),
INOUT i_seqid INT(11)
) DETERMINISTIC
BEGIN
DECLARE v_nid, v_ex_seqid INT(11);
DECLARE v_name VARCHAR(128);
DECLARE v_leaf INT(1);
DECLARE v_fullpath TEXT;
DECLARE done INT DEFAULT 0;
DECLARE qry CURSOR FOR SELECT id, seqid, name FROM _TREE_
WHERE parent_id = i_parent ORDER BY seqid;
DECLARE CONTINUE HANDLER FOR NOT FOUND SET done = 1;
OPEN qry;
REPEAT
FETCH qry INTO v_nid, v_ex_seqid, v_name;
IF NOT done THEN
IF v_ex_seqid != i_seqid THEN
UPDATE _TREE_ SET seqid = i_seqid, depth=i_depth WHERE id=v_nid;
END IF;
IF i_depth > 0 THEN
SET v_fullpath = CONCAT(i_fullpath, i_sep, v_name);
ELSE
SET v_fullpath = v_name;
END IF;
SET v_leaf =0;
SELECT COUNT(id) INTO v_leaf FROM _TREE_ where parent_id = v_nid;
UPDATE _TREE_ SET
fullpath = v_fullpath,
leaf = IF (v_leaf > 0, 0 , 1)
WHERE id=v_nid;
SET i_seqid = i_seqid +1;
#// do the children..
CALL _TREE__resequence_sub(v_nid, i_depth+1, v_fullpath, i_sep, i_seqid);
END IF;
UNTIL done END REPEAT;
CLOSE qry;
END $$
DELIMITER ;
DROP FUNCTION IF EXISTS _TREE__add_node;
DELIMITER $$
CREATE FUNCTION _TREE__add_node(
i_parent INT(11),
i_after INT(11),
i_name VARCHAR(128)
) RETURNS INT(11) DETERMINISTIC
BEGIN
DECLARE v_depth INT(11);
DECLARE v_seqid INT(11);
DECLARE v_ret INT(11);
DECLARE v_tmp INT(11);
SET v_depth = 0;
SET v_seqid = 0;
SET
Truncated by Planet PHP, read more at the original (another 3410 bytes)
To celebrate the release of the new edition of well-loved SitePoint book Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition — by Kevin Yank, we’re publishing a chapter a day next week, beginning Tuesday the 7th of July.
Today, we’ve published the beginning of the series: the Introduction and directly from the book, Chapter 1: Installation. Over the weekend you can read chapter 1 and make sure your newly installed software is working properly, in readiness for next week’s chapters. At the end of the week you’ll have 4 complete chapters from the book and one bonus article, comprising another book excerpt.
Here’s what you’ll be receiving:
Chapter 2: Introducing MySQL
An introduction to databases in general, and the MySQL relational database management system in particular. If you’ve never worked with a relational database before, you’ll find this enlightening, whetting your appetite for what’s to come! In the process, you’ll build up a simple database to be used in later chapters.
Chapter 3: Introducing PHP
Here’s where the fun really starts. In this chapter, Kevin will introduce you to the PHP scripting language, which you can use to build dynamic web pages that present up-to-the-moment information to your visitors.
Chapter 4: Publishing MySQL Data on the Web
In this chapter you’ll bring together PHP and MySQL to create some of your first database driven web pages. You’ll explore the basic techniques of using PHP to retrieve information from a database and display it on the Web in real time. Kevin will also show you how to use PHP to create web-based forms for adding new entries to, and modifying existing information in, a MySQL database on the fly.
Bonus: How to Handle File Uploads with PHP
In this bonus excerpt from Chapter 12, you’ll learn how to accept file uploads from your web site visitors securely and store them.
Build Your Own Database Driven Web Site Using PHP & MySQL, 4th Edition is one of the most popular PHP books for beginners, and SitePoint’s first ever book. This shiny new 4th edition has been completely updated using only best-practice PHP. It’s essential reading for all budding PHP & MySQL developers. For more information, see the book page.
If you prefer to read the Adobe Acrobat PDF version of these first four chapters, you can download the first four chapters FREE.
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&did=adz&adtype=vertical" type="text/javascript">
Found and reported a couple of PHP 5.3 bugs yesterday. That isn’t such a surprise; it’s a new release, after all, and we’re currently in the midst of developing code for the first time against 5.3 here at work. One of them is a crasher, but an obscure one reliant on the new-in-5.3 INI_SCANNER_RAW mode in parse_ini_file and a rather odd configuration file, so as these things go, it’s pretty minor, and scottmac has jumped on it very promptly indeed (thanks!). The response from Jani was interesting, though:
Thanks for not reporting this before release..
Now, Jani does a tremendous amount of work triaging PHP bugs and I — and every other PHP developer (particularly those of us who does this for a living) — owe him a huge debt for that. But frankly, I resent the implication that I’ve somehow sat on a crasher since before 5.3.0 was released and only submitted it now as some sort of weird vendetta against the PHP internals team. Funnily enough, I only found it while I was reducing the other, more trivial bug down to a minimal test case.
I get far worse things implied in my direction when I’m out on a Saturday night in Northbridge, so really, I’m not that fussed. (I’m obviously a bit fussed, though, since I’m writing this.) I do wonder how somebody new to the PHP community would feel, though — my guess is that you could forget about future bug reports in some cases, and that just isn’t a win for anyone.
Yesterday we had an entire day at Liip dedicated to various talks, workshops and hanging out together. It really reminded me again what an amazing company Liip is. Its really what I wished m company back in Berlin should have been. Fun, smart, successful, productive, agile, good. At any rate I wanted to mention the stuff we are working on in terms of OSS. Obviously Chregu and myself are active on PHP. Jordi is also an active member of the PHP.net community. But we have other less known stuff that should also get noted, like Jackalope, Mahara, Picok, GottaGo and Okapi.
Jackalope is an implementation of the client side JCR standard for PHP. This will enable us making happy agile frontends that are managed with all the various Enterprise features like versioning, ACL's etc. Liip created this project but is looking for others to join. We are already sharing the interfaces with the typo3 guys.
Mahara is a social networking platform that has spawned out of the Moodle e-learning community. Penny recently joined Liip and she was actually one of the original founders of the project.
Picok is a one of my babies. Its sort of an OSS iGoogle. So it allows you to easily create new so called portlets, that can aggregate content from various internal and external data sources and present them in a user customizable interface. Originally created for one of our clients the Raiffeisen Bank here in Switzerland. They were kind enough to let us open source the code. In return we won them a couple prizes at the Swiss Web Awards :)
GottaGo actually took the Swiss Web Awards by storm. It won the grand prize along with a few other category prizes. Its an iPhone app that basically finds the fasted route via public transportation from point A to B here in Switzerland. Oh and I should stop referring to it as GottaGo, since its now called "Transport".
Okapi is our super lightweight framework. Recently Chregu and I have started working on version 2. Basically we took various Symfony2 components and integrated them into our code. Currently its still in proof of concept stage, but it looks quite promising. I am really seeing a lot of potential in the service container and event dispatcher. I also think it could become a very useful addition to the Symfony eco-system as it seems quite feasible to migrate from Okapi2 to Symfony2 or vice versa. Meaning it will be able to choose if you want something simple and lean or you need something full features, without having to need to learn two totally different frameworks. Chregu has ported liip.to to this proof of concept, so check it out!
Yesterday we had an entire day at Liip dedicated to various talks, workshops and hanging out together. It really reminded me again what an amazing company Liip is. Its really what I wished m company back in Berlin should have been. Fun, smart, successful, productive, agile, good. At any rate I wanted to mention the stuff we are working on in terms of OSS. Obviously Chregu and myself are active on PHP. Jordi is also an active member of the PHP.net community. But we have other less known stuff that should also get noted, like Jackalope, Mahara, Picok, GottaGo and Okapi.
Jackalope is an implementation of the client side JCR standard for PHP. This will enable us making happy agile frontends that are managed with all the various Enterprise features like versioning, ACL's etc. Liip created this project but is looking for others to join. We are already sharing the interfaces with the typo3 guys.
Mahara is a social networking platform that has spawned out of the Moodle e-learning community. Penny recently joined Liip and she was actually one of the original founders of the project.
Picok is a one of my babies. Its sort of an OSS iGoogle. So it allows you to easily create new so called portlets, that can aggregate content from various internal and external data sources and present them in a user customizable interface. Originally created for one of our clients the Raiffeisen Bank here in Switzerland. They were kind enough to let us open source the code. In return we won them a couple prizes at the Swiss Web Awards :)
GottaGo actually took the Swiss Web Awards by storm. It won the grand prize along with a few other category prizes. Its an iPhone app that basically finds the fasted route via public transportation from point A to B here in Switzerland. Oh and I should stop referring to it as GottaGo, since its now called "Transport".
Okapi is our super lightweight framework. Recently Chregu and I have started working on version 2. Basically we took various Symfony2 components and integrated them into our code. Currently its still in proof of concept stage, but it looks quite promising. I am really seeing a lot of potential in the service container and event dispatcher. I also think it could become a very useful addition to the Symfony eco-system as it seems quite feasible to migrate from Okapi2 to Symfony2 or vice versa. Meaning it will be able to choose if you want something simple and lean or you need something full features, without having to need to learn two totally different frameworks. Chregu has ported liip.to to this proof of concept, so check it out!

With over 40,000 copies sold of the three previous editions, I’m very pleased to announce the latest title hot off the SitePoint production line:
Build Your Own Database Driven Web Site Using PHP & MySQL (4th Edition) — by Kevin Yank
One of the most popular PHP books for beginners, this shiny new 4th edition has been completely updated using only best-practice PHP.
In this book you’ll learn how to:
And a whole lot more …
At around 480 pages, this book is an easy read. As you move through the book you’ll quickly notice that it’s written in a clear tutorial format that’s easy to understand, and illustrated with plenty of screenshots and diagrams, providing quick visual cues. If you hate wading through dry, academic-style “how to” texts, this book will be a breath of fresh air to you.
If you’ve never built a database driven web site and you’re looking to go beyond the limitations of a static site, this book will start you off in no time.
And if you have built database driven web sites before, the extensive PHP/MySQL reference guides included will ensure this book remains an extremely handy desk reference.
Check out the free sample chapters or order a copy today.
<script src="http://ads.aws.sitepoint.com/adjs.php?region=136&did=adz&adtype=vertical" type="text/javascript">
Dave Neary summed this up well:
...I fundamentally disagree with discouraging someone from pursuing a technology choice because of the threat of patents. In this particular case, the law is an ass. The patent system in the United States is out of control and dysfunctional, and it is bringing the rest of the world down with it. The time has come to take a stand and say “We don’t care about patents. We’re just not going to think about them. Sue us if you want.”
With Midgard we have prior art on some software patents. Software patents only promote big multinational monopolies, and therefore are against the interests of both Europe and the Free Software movement. They're silly, don't apply here, and therefore the only rational response is to ignore them.
Technorati Tags: softwarepatents
There has been some discussion in recent days regarding Object-Relational Mappers (ORMs), Drupal, and why the latter doesn't use the former. There are, actually, many reasons for that, and for why Drupal doesn't do more with the Active Record pattern.
Rather than tuck such discussion away in an issue queue, I figured it better to document a bit more widely.

SitePoint is looking for two experienced PHP developers (one with a sysadmin twist) to join the team here at SitePoint HQ in Melbourne, Australia. Help us find the right person for either of these positions, and we’ll buy you a shiny, new iPhone 3GS!
Know someone with “mad PHP skillz” who either lives in Melbourne or would move here for the opportunity to work on one of the Web’s major destination sites for web developers and designers? Drop me an email with the details at kevin(at)sitepoint.com.
Of course, if you would just like to apply for the position yourself, the complete position descriptions are in our jobs section.
Internationalizing the a website, you run into a problem where you don’t know what strings you’ve parsed out for localization or not.
For these tasks, my favorite language is “zxx.” I use that code to replace all strings with some XX’s. Now any strings (or images) I missed are immediately evident.
Keeping the zxx localization file up to date is easy to update…
// {{{ l10n_upgrader($pofile,$callback)
/**
* Allows you to upgrade a PO file automatically.
*
* Search for all "" (two double quotes) and translate these.
*
* @param string $pofile the messages.po file to upgrade
* @param string $callback the callback function that does the string lookup
* @return array
*/
function l10n_upgrader($pofile,$callback='')
{
if ($callback) {
$data = file_get_contents($pofile);
$matches = array();
$data = preg_replace_callback("!^msgid \"(.+?)\"\nmsgstr \"\"!m", $callback, $data); // if I add s it matches too aggressively
//unlink($pofile);
file_put_contents($pofile,$data);
}
// generate output
//msgfmt message.po
$exec = sprintf(
'cd %s;msgfmt %s',
escapeshellarg(dirname($pofile)),
escapeshellarg('messages.po')
);
pass($exec); //erroring out this is an exec function
}
// }}}
// {{{ l10n_ZXXer($matches)
/**
* Add a bunch of XXXX's to a string
*
* @param array $matches
* @return string
*/
function l10n_ZXXer($matches)
{
return sprintf(
"msgid \"%s\"\nmsgstr \"%s\"",
$matches[1],
str_pad('',strlen($matches[1]),'XXXX ')
);
}
// }}}
l10n_upgrader($gt_dird.'zxx_XX/LC_MESSAGES/messages.po', 'l10n_ZXXer');
You may have some trouble getting things working, so remember that gettext uses your system to set the language. If your system doesn’t have zxx installed, you can’t just flip your locale over and expect it to work. As a quick hack for develement, just symlink the directory in your dev machine over to a language you aren’t using. I’m currently using “zu_ZA” which will be okay until Tagged localizes for Zulu.
Also remember that your web server caches gettext strings, so be sure to shut down the webserver to free the file lock before updating your .pot file.
Improving your linguisticnessl10n_ZXXer() above is not that clever. It won’t handle the cases where you have nested sprintf() substitutions. But you can imagine improving it. Here are some ideas of different fake languages:
strlen() computation by 1.2 in order to handle spacing issues for localizing to German.
Truncated by Planet PHP, read more at the original (another 1347 bytes)
Some users reported that the windows builds of PHP 5.3 are not able to open the shipped go-pear.phar file. As a workaround, use the official pear.php.net/go-pear non-pharred version.
Some users have reported that the windows builds of PHP 5.3 are not able to open the shipped go-pear.phar file.
As a workaround, users can run the distributed phar with php -d phar.require_hash=0 go-pear.phar or download and use the [pear.php.net] non-pharred version.
PHP 5.3 is released and after the release stress is over my mind is open for new ideas. While relaxing yesterday I thought about many things, among them was the Resultset iterator I recently discussed.
Now I wondered where to go next with this and had the idea that an individual Resultset is a child of the whole result and this might be wrapped in an Recursive Iterator. For doing so we don't implement the Iterator interface but RecursiveIterator. RecursiveIterator extends a typical Iterator with two methods: hasChildren() and getChildren(). But now we have a problem: The Iterator returned by getChildren() has to be a RecursiveIterator, too, which makes sense, in general. But I want to return a MySQLi Resultset which isn't recursive - so making this a RecursiveIterator is wrong. My solution now is to introduce yet another Iterator which goes by the name of MySQLi_PseudoRecursiveResultIterator and is implemented by extending IteratorIterator which will wrap the MySQLi_Result and implements RecursiveIterator telling the caller that there are no children.
As a sidenote: In our experimental tree Andrey made MySQLi_Result an iterator but that's not yet in php.net's CVS (might need some more testing, and probably we might change the design there...) so I'm emulating this with MySQLi_Result::fetch_all() combined with an ArrayIterator, using the experimental code the constructor can be dropped.
So let's finally look at the code of these two classes:
<?php
class MySQLi_ResultsetIterator implements RecursiveIterator
{
private $mysqli;
private $counter = 0;
private $current = null;
private $rewinded = false;
public function __construct(mysqli $mysqli) {
$this->mysqli = $mysqli;
}
private function freeCurrent() {
if ($this->current) {
$this->current->free();
$this->current = null;
}
}
public function rewind() {
if ($this->rewinded) {
throw new Exception("Already rewinded");
}
$this->freeCurrent();
$this->counter = 0;
$this->rewinded = true;
}
public function valid() {
$this->current = $this->mysqli->store_result();
return (bool)$this->current;
}
public function next() {
$this->freeCurrent();
$this->counter++;
$this->mysqli->next_result();
}
public function key() {
return $this->counter;
}
public function current() {
if (!$this->current) {
throw new Exception("valid() not called");
}
return $this->current;
}
public function hasChildren() {
return true;
}
public function getChildren() {
return new MySQLi_PseudoRecursiveResultIterator($this->current);
}
}
class MySQLi_PseudoRecursiveResultIterator
extends IteratorIterator
implements RecursiveIterator
{
public function __construct(MySQLi_Result $result) {
// This ctor can be dropped with the experimental bzr sources
// as IteratorIterator::__construct() directly works with
// MySQLi_Result
parent::__construct(new ArrayIterator($result->fetch_all()));
}
public function hasChildren() {
return false;
}
public function getChildren() {
throw new Exception("This should never be called");
}
}
?>
Now we can use this code. For properly using a RecursiveIterator one should use a RecursiveIteratorIterator (RII). To get some nice labels I'm extending the RII and then have a single foreach:
<?php
class MyRecursive_IteratorIterator
extends RecursiveIteratorIterator
{
public function __construct(MySQLi $mysqli, $flags = 0) {
parent::__construct(
new Mysqli_ResultSetIterator($mysqli),
$flags | RecursiveIteratorIterator::LEAVES_ONLY);
}
public function beginChildren() {
echo "Next ResultSet:\n";
}
}
$mysqli = new MySQLi("localhost", "root", "", "test");
$query = "SELECT 1,2 UNION SELECT 3, 4;".
"SELECT 'hi world' UNION SELECT 'foobar'";
if ($mysqli->multi_query($query)) {
foreach (new MyRecursive_IteratorIterator($mysqli) as $key => $row) {
printf(" %s\n", $row[0]);
}
}
?>
Now calling this code gives us a result similar to the following:
Next ResultSet:
1
3
Next ResultSet:
hi world
foobar
Isn't that nice? - I think that's a cool API! What do you think? Do you have use cases for such an API? Should we implement this in C and bundle it with PHP? Any feedback welcome!
Over the last couple months I had a chance to help create a great new product for Stumbleupon. Su.pr lets create short urls, publish directly to Facebook and Twitter and gives you great tracking and statistics around them. Su.pr also helps you get more traffic by making it easy to get your content in front of the Stumbleupon community.
Last week we launched our API which lets you integrate shorten and post functionality into any site or application. Today we are adding the ability to use your own domain for shortening. This lets you have urls like [joshuaeichorn.com] so your readers can know what domain they are going too before they click on the link.
Now down to the fun part installation.
Step 1, Sign up for Su.prJust go to the su.pr homepage and sign up using suprjosh for the invite code (The code is good for 500 sign ups).
I’m not going go over this in detail since instructions are already available from su.pr.
Note: when installing the rewrite rule you’ll want to make sure its not catching any of your other pages, I put mine after all my custom rules and added a condition to check the given url wasn’t the name of a file or directory.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^[a-zA-Z0-9]{4}$ supr.php?supr=$0
RewriteRule ^supr_settings.json$ supr.php?check_install=$0
If your doing your URL rewriting in PHP you might want to handle the link detection there instead, but 4 character words with no extension aren’t too common.
Step 3, Test is outNow that you are up and running any short url created on Su.pr for your domain will be use your domain instead of su.pr for the shortening. If you ran into any problems let me know, I will see what I can do to help.
Details on how things workThe double redirection at the end lets us collect stats and do the required setup for showing the Javascript version of the Stumbleupon toolbar.
While the manual for Zend_Session does discuss unit testing and the read-only exception, it has no mention of an exception I encountered recently while unit testing. I admit that the reason I encountered the exception is most likely because I'm Doing It Wrong. However, given reality, I did not have time to properly make the class, or at least do it better. I received the following exception:
exception 'Zend_Session_Exception' with message 'Session must be started before any output has been sent to the browser; output started...'
The problem was, of course, that the feedback from previous tests was already outputted to the screen. I could've solved this by playing with my test suite and just starting sessions at that level but that wouldn't have been the best solution. In fact, I'd qualify that solution under bandaids (solutions that mask a problem instead of fixing them). If you can't see why it is a bandaid, I'm happy to discuss it but for once, I"m going to try to stay on topic and not digress any further than I have.
So, here's the scenario:
The solution? A little 'undocumented' static variable:
Zend_Session::$_unitTestEnabled = true;
Ok, undocumented is a bit misleading. You won't find out about it by looking at the Manual but will find it when you're digging through the API. So it is documented, just not well. I'm guessing because it is rare to encounter the exception. I'm not surprised that I encountered it since my projects always seem to have some degree of weirdness, which makes for an interesting learning curve thats compounded with Zend's curve.
W00t! 5.3.0 stable is out. Never expected it to take this long, but its a lesson to keep faithful to the "release early, release often mantra" in the future. At some point a branch can just get too big, that it becomes close to impossible to release it. While I do appreciate the various thank you (or in the case of backslash haters "drop dead") emails, I want to highlight that all I really did is take over the tasks that require at most a bit of patience and certainly no technical skill (well I did have to update a few websites, but even there I needed Hannes to fix all my typos).
So Johannes was the one who was especially in the last few weeks laboring over tons of patches and bug reports and sleeping less and less as we got closer to the actual release date. Pierre was of course also a huge help in this process .. and of course the countless developers that worked on the actual code that you all can now download and play with.
Now I am not saying that 5.3.0 hasn't eaten up my share of time. I am very thankful to my employer Liip that let me spend time on all of this. A bit of free time also went into 5.3.0, which I hope to now direct towards my music career a bit more :)
It was a long run and I'm sure it felt like an eternity for many - for me it certainly did. PHP 5.3 was branched of over two years ago and finally is ready to be called 5.3.0.
The php.net website and many other blogs discuss the features - from often loved closures, to well discussed namespaces to the sometimes hated goto - so I think I don't have to this here but instead can focus on that what really matters:
So with that: In case you didn't do already: Browse over to php.net and grab your copy, it's for free!
If you want to celebrate the release and are close to Munich: We're planing a PHP Release Party on July 17th, details on that will follow.
Stefan Esser's Bytekit is an extension to the PHP interpreter that provides a userspace representation of the bytecode that is generated during the PHP interpreter's compilation phase. The extension not only exports the raw bytecode data but also provides control flow information in the form of code flow graphs and basic blocks. Among other things, Bytekit is developed with the goal of providing a foundation to develop all kinds of static and dynamic code analysis tools.
bytekit-cli is such an analysis tool that I started to develop immediately after Stefan released Bytekit 0.1.0 at the International PHP Conference - Spring Edition in Berlin earlier this year. This posting provides an overview of the functionality implemented so far.
Some days ago I released a little bugfix release of the PHP extension uploadprogress. It fixes one nasty bug with cleaning filenames with preceding whitespace, so an upgrade is highly recommended. It furthermore improves tmp-directory detection, but can only do this during compile time.
Last but not least, the example was improved. It checks for more possible wrong settings (like if the tmp-directory is there and writeable) and gives more feedback. Due to the nature of how this extension works, it may be a little bit tricky to get it working, but the example should help. See also the "Common issues and some answers" post for some hints.
According to Drupal.org, it has now been four years and five days since I first joined the Drupal community. My how time flies, and how much has changed since then.
Lately, there have been many well-intentioned but I would contend misguided ideas proposed to handle noise on public programmer mailing lists. The premise is that in fact there are very important messages being drowned out in a chorus of irrelevant messages from ill-informed developers. Warnings of inefficiencies have been tossed about quite a bit as the curse of "bike shedding."
To understand what they mean by "bike shedding," one must know the bike shed parable. Once upon a time, a group of people got together to build a nuclear reactor to power the city. Everyone in the town said "great, we need more power," and so they got to work designing the plant. Everything was going great, the design of the reactor sailed by until one day, one of the citizens said "hey, let's build a bike shed for the workers so they don't have to come to work in cars and can get exercise." Everyone agreed until an argument broke out over whether to paint the shed blue or red. Eventually, the whole process broke down, and the plant was never built because they couldn't choose a color to paint the bike shed. The moral of the story: everyone agrees on the complex important things, but the process breaks down over arguments about irrelevant details.
I think we can all agree that this is a tragic parable, illustrating what happens when the process for decision-making breaks down.
When there is a problem of signal-to-noise ratio on a mailing list, the problem has to do with the process for accepting public input, I completely agree with this. However, I am troubled by the implication that having unmoderated mailing lists is the intrinsic problem with open source that must be solved. There is a crucial balance between rewarding quality and being open to the outsider that is the life blood of open source. You could even think of it as the "affirmative action" of the programming world: we recognize that amateur programmers who do not come from the establishment of the temples of programming in academic computer science departments or even computing careers, may have ideas that are better than the most learned highest karma achiever.
For my musician reader: Open source thrives on meritocracy: the idea that those who can do junk have more influence than those who can't do as much junk. Karma is the thing with which these individuals are rewarded. Only those with karma are able to actually make changes to the source code. It doesn't matter who you are, or what your background is, if you demonstrate good coding and community, you get karma.
String quartet rehearsal is similar, the best ideas get more weight regardless of whether the person who has them is playing the melody.
Why am I talking about string quartet rehearsal in a post about moderated programmer mailing lists? I come from a profession (professional chamber music) where "karma" is a fluid object, and unlike the programming world tends to break down when we attempt to nail it down. My string quartet has found that rather than try to decide who will be "the decider" for tough decisions, it's not just friendlier, but is also far more efficient to devote our individual energies to two essential things:
Sometimes they are crackpot, but most of the time, the reason they just seemed crackpot because they were outside the boundaries of our collective imaginations.
An example: in our first years together, we occasionally would get into endless arguments in my quartet about whether to play a particular musical section faster or slower (PHP developers: think endless namespace separator arguments). After a long time of arguing about this, it usually turned out that we were asking the wrong question, until one day we would find the right question, which was something like "how long are the phrases?" (PHP developers: the right question turned out to be "how do we solve the ambiguity between static methods and namespaced functions?"). After finding the right question, we stopped arguing nearly as much, and the music sounded much better after we all re-adjusted our thinking.
This illustrates an important distinction: the question of how fast to play was not an irrelevant "bike shedding" detail, it was a crucial part of the solution. We still had to choose a speed to play, just as the nuclear power plant people still would need a place to put their bikes. By changing the question from "How fast?" to "How long is the phrase?" we were actually solving the question of what color to paint the bike shed at the same time we solved the question of how to design access to the nuclear reactor, not ignoring it.
The best solution is for t
Truncated by Planet PHP, read more at the original (another 846 bytes)
Lately, there have been many well-intentioned but I would contend misguided ideas proposed to handle noise on public programmer mailing lists. The premise is that in fact there are very important messages being drowned out in a chorus of irrelevant messages from ill-informed developers. Warnings of inefficiencies have been tossed about quite a bit as the curse of "bike shedding."
To understand what they mean by "bike shedding," one must know the bike shed parable. Once upon a time, a group of people got together to build a nuclear reactor to power the city. Everyone in the town said "great, we need more power," and so they got to work designing the plant. Everything was going great, the design of the reactor sailed by until one day, one of the citizens said "hey, let's build a bike shed for the workers so they don't have to come to work in cars and can get exercise." Everyone agreed until an argument broke out over whether to paint the shed blue or red. Eventually, the whole process broke down, and the plant was never built because they couldn't choose a color to paint the bike shed. The moral of the story: everyone agrees on the complex important things, but the process breaks down over arguments about irrelevant details.
I think we can all agree that this is a tragic parable, illustrating what happens when the process for decision-making breaks down.
When there is a problem of signal-to-noise ratio on a mailing list, the problem has to do with the process for accepting public input, I completely agree with this. However, I am troubled by the implication that having unmoderated mailing lists is the intrinsic problem with open source that must be solved. There is a crucial balance between rewarding quality and being open to the outsider that is the life blood of open source. You could even think of it as the "affirmative action" of the programming world: we recognize that amateur programmers who do not come from the establishment of the temples of programming in academic computer science departments or even computing careers, may have ideas that are better than the most learned highest karma achiever.
For my musician reader: Open source thrives on meritocracy: the idea that those who can do junk have more influence than those who can't do as much junk. Karma is the thing with which these individuals are rewarded. Only those with karma are able to actually make changes to the source code. It doesn't matter who you are, or what your background is, if you demonstrate good coding and community, you get karma.
String quartet rehearsal is similar, the best ideas get more weight regardless of whether the person who has them is playing the melody.
Why am I talking about string quartet rehearsal in a post about moderated programmer mailing lists? I come from a profession (professional chamber music) where "karma" is a fluid object, and unlike the programming world tends to break down when we attempt to nail it down. My string quartet has found that rather than try to decide who will be "the decider" for tough decisions, it's not just friendlier, but is also far more efficient to devote our individual energies to two essential things:
Sometimes they are crackpot, but most of the time, the reason they just seemed crackpot because they were outside the boundaries of our collective imaginations.
An example: in our first years together, we occasionally would get into endless arguments in my quartet about whether to play a particular musical section faster or slower (PHP developers: think endless namespace separator arguments). After a long time of arguing about this, it usually turned out that we were asking the wrong question, until one day we would find the right question, which was something like "how long are the phrases?" (PHP developers: the right question turned out to be "how do we solve the ambiguity between static methods and namespaced functions?"). After finding the right question, we stopped arguing nearly as much, and the music sounded much better after we all re-adjusted our thinking.
This illustrates an important distinction: the question of how fast to play was not an irrelevant "bike shedding" detail, it was a crucial part of the solution. We still had to choose a speed to play, just as the nuclear power plant people still would need a place to put their bikes. By changing the question from "How fast?" to "How long is the phrase?" we were actually solving the question of what color to paint the bike shed at the same time we solved the question of how to design access to the nuclear reactor, not ignoring it.
The best solution is for t
Truncated by Planet PHP, read more at the original (another 846 bytes)
The problem with mailing lists is that they are a free for all, it doesn’t matter who posts, everybody at every level gets to see the post.
In the real world, communications pass through a hierarchy of people, escalating as necessary, passing from person to person up the chain.
This means that, given enough time, any mailing list starts to have a large noise:signal ratio, at least for any given person’s take on the list;
they want to read what they want to read, and don’t need to be distracted ignoring the stuff they don’t want to read.
There is an unspoken — some what hap-hazard — hierarchy among the community, which with some thought, I believe, could be defined, refined
and utilized to our advantage. As an example:
- Active internals contributors with access to internals CVS (contributions of code and useful discussions)
\
- Active internals contributors without access to internals CVS (patch submitters, useful discussions)
- Inactive internals contributors with access to internals CVS (previous contributions of code and useful discussions)
\
- Active non-internals, PHP contributions (docs, phpweb, PEAR)
- Active community leaders
- Active project leaders
- Active linux distro maintainers
\
- General Users with a high understanding
\
- Genernal users with little understanding (newbies)
If we take each of these, and assign them a number:
L1 - Active internals contributors with access to internals CVS (contributions of code and useful discussions)
\
L2 - Active internals contributiors without access to internals CVS (patch submitters, useful discussions)
L2 - Inactive internals contributors with access to internals CVS (previous contributions of code and useful discussions)
\
L3 - Active non-internals, PHP contributions (docs, phpweb, PEAR)
L3 - Active community leaders
L3 - Active project leaders
L3 - Active linux distro maintainers
\
L4 - General Users with a high understand
\
L5 - Genernal users with little understanding (newbies)
Now, what if, at any level, you could only see (by default) 1 level below you (and all levels above you). For example: L1 can see L2, L2 can see L3 etc.
This immediately means that you only see stuff that might be relevant to you; however, as a community, we then lose the ability for newcomers to contribute good ideas; because they would start out with zero karma. To help solve this issue, we adjust karma based on responses:
ScenarioIn this case, only the thread in question is bumped up, however given enough L2/L1 (weighted) direct responses over different threads, a L3 user can gain karma and eventually become a L2 user (and obviously this applies to anyone moving up the chain)
In this way, threads (and by this mechanism, users also) can organically make their way up the tree as they gain traction, are discussed at each level and moved up.
I believe it would be possible to have a ”’single”’ mailing list that could span everything from internals right down to php-general, but this is probably not desired! It would however allow the users of any list to, regardless of their experience in the tree, contribute without weighing down the list.
FeaturesIn this way, we can, in some ways, automate the karma, and in someways advance it through o
Truncated by Planet PHP, read more at the original (another 795 bytes)
9 months after the 1.2 release, I just published a long overdue release of the SabreAMF library.
The package mainly contains bugfixes. Upgrading is highly recommended.
Special thanks to Ionut Stoica for creating a Drupal Module, and Asbjørn Sloth Tønnesen for the bugfixes and patches. Enjoy!
Earlier this week, Google launched a campaign to make the web faster. It appears to be a call for improving the quality of web sites in general, but with a focus on performance.
The project includes an article on “PHP performance tips”, which is bordering on being ridiculous. There are of course lots of blog posts with similar non-sense around the web, but since this is being endorsed by Google, it’s fair to assume that people might take it at face value. That’s unfortunate, as almost none of it is true. The PHP Team responded back with this message, wherein they refute the ungrounded non-sense.
What’s more troubling however, is the whole approach to performance optimisation as a matter of “knowing the secret handshake”. Optimisation is far more complex than that, and spending time on these “optimisation tricks” are rarely worthwhile and might often lead to unmaintainable code, if applied too early. It’s a fine line, because there are of course certain things that you shouldn’t do (Such as hit the database within a tight loop, if you can send one query instead), but there are likewise lots of things that are a complete and utter waste of every body’s time. It’s a pity that this article failed to keep those two separated.
Performance optimisation is not magic. The real way to deal with it, is to measure and analyse. It is almost impossible - even for a highly skilled programmer - to anticipate exactly where there might be bottle necks in a program. Using a profiler, gives you real numbers to relate to, rather than wild guesses and superstition.
For PHP scripts, there is the freely available Xdebug extension, which provides detailed information on both memory usage and execution time on a per-function basis. It’s easy to install and with the simple WebGrind as a frontend, you’re up and running in no time.
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&did=adz&adtype=horizontal" type="text/javascript">
Earlier this week, Google launched a campaign to make the web faster. It appears to be a call for improving the quality of web sites in general, but with a focus on performance.
The project includes an article on “PHP performance tips”, which is bordering on being ridiculous. There are of course lots of blog posts with similar nonsense around the web, but since this is being endorsed by Google, it’s fair to assume that people might take it at face value. That’s unfortunate, as almost none of it is true. The PHP Team responded back with this message, wherein they refute the unfounded nonsense.
What’s more troubling however, is the whole approach to performance optimisation as a matter of “knowing the secret handshake”. Optimisation is far more complex than that, and spending time on these “optimisation tricks” are rarely worthwhile and might often lead to unmaintainable code, if applied too early. It’s a fine line, because there are of course certain things that you shouldn’t do (such as hit the database within a tight loop, if you can send one query instead), but there are likewise lots of things that are a complete and utter waste of every body’s time. It’s a pity that this article failed to keep those two issues separate.
Performance optimisation is not magic. The real way to deal with it, is to measure and analyse. It is almost impossible — even for a highly skilled programmer — to anticipate exactly where there might be bottlenecks in a program. Using a profiler gives you real numbers to relate to, rather than wild guesses and superstition.
For PHP scripts, there is the freely available Xdebug extension, which provides detailed information on both memory usage and execution time on a per-function basis. It’s easy to install and with the simple WebGrind as a front-end, you’ll be up and running in no time.
<script src="http://ads.aws.sitepoint.com/adjs.php?region=137&did=adz&adtype=horizontal" type="text/javascript">
Pádraic:
Thanks for taking the time to discuss this with me on Twitter last night. I’m the Associate Publisher for Wrox, I’m the person usually behind @wrox on twitter.
After meeting with the editor who ran the PHP list for us, you’re right. The titles of these PHP6 books, some of the references to PHP6 in the books, what isn’t covered in the books, all prove we made a mistake, something went wrong. But how, why?
Elizabeth (and thanks for her measured response) is correct in part of her assessment that books take a long time to write and publish. I’m sure that when the editor and authors started these books in Spring 2008, they’re thinking was that 6.0 would indeed be a stable release by early 2009 (if not sooner) and they were aiming for that. But clearly along the way we dropped the ball on checking references to things like the non-existent “6.0.0 stable.”
In the Beginning PHP6, MySQL, Apache book, I can actually understand the rationale not to cover Unicode there. Given that Unicode is primarily valuable to someone internationalizing a site or localizing it for multiple languages – topics that I wouldn’t consider “Beginning” level – I can see why it wasn’t covered. (Before becoming associate publisher, I was actually our ASP.NET editor for most of the last 5 years and we don’t for example cover internationalization/localization in our Beginning ASP.NET 3.5.) So we want to have a book that Beginning level customers understand will work with PHP6 if that’s the version they’re using, but we didn’t communicate right what that meant in this context where there weren’t major new v6 features at the level we thought a beginner would need.
The professional book stumps me more. It’s hard for me to understand how that book doesn’t have a chapter on Unicode. It looks like an oversight by everyone involved in the book.
So where do we go from here and get better than this to eventually prove we’re worthy of better than when @bicatu says “That reminds me why I've never bought a Wrox book?”
First, I’ve asked the team involved with Beginning PHP6 scheduled to ship to the printer this week to pull that book back, to read your post and the subsequent twitter discussion and to make sure we aren’t making the same mistake a third time. I want the author and editors to provide a level of confidence that the PHP6 features that should be covered are, that the discussion of the current state of PHP6 is accurate, and the that the title, subtitle, and marketing copy on the book and online accurately reflects what is and isn’t covered.
Second, publishing the ri
Truncated by Planet PHP, read more at the original (another 1839 bytes)
Notepad with GtkSourceview is a program developed in Php-Gtk using Glade.
To use you must have installed on your pc Php-Gtk, just do a search on the internet so you can discover.
is a modified version of notepad made from kksou But with gtksourceview and use its property for the editing of code in this case was set php.
It almost happened, but it didn't for now. Originally we planned to release today. But again a few issues came up, even with Johannes deciding that sleep is for the weak, it just seemed unwise to announce the release today. So we pushed things back a few days, so the new date is June 30th (meaning it will be a Tuesday release). This also gives the documentation team, who have been expanding the 5.3 docs like crazy, a few more days to beef things up even more. Now is really high time to ensure that you have a PHP 5.3 compatible release of your software ..
6. Extract the tarball, and change to the directory it creates:
tar -vxzf php-6.0.0.tar.gz
cd php-6.0.0
3. Scroll down to the Complete Source Code section, and click on the appropriate link to download
the latest tar.gz package.
The most recent stable versions that were in effect at the time of this book's writing were:
PHP: Version 6.0.0
Apache: Version 2.2.9
MySQL: Version 5.0.67
Future editions of this book will address changes and improvements in these programs as they become
available.
Truncated by Planet PHP, read more at the original (another 1324 bytes)
Gestern war ich zu Gast bei der DOAG Regionalgruppe Rhein-Main, um etwas über "PHP5 und Oracle" zu erzählen. Der Vortrag richtete sich an DBAs, für die die Webwelt eine recht neue Welt ist und zeigt auf, warum gerade PHP eine passende Sprache für (businesskritische) Webanwendungen ist und weshalb PHP5 (seit einigen Jahren) auch sehr gut mit Oracle zusammenarbeitet. Den Vortrag werde ich im September noch mal bei der DOAG Regionalgruppe in Hamburg halten.
PHP5 und OracleView more PDF documents from mayflowergmbh.
Question from one of the PHP-GTK members:
"I looked at your submission for RocketDMS on php-gtk.eu, and from the screenshots on your site, the app does not look like php-gtk at all. Is it
really done in PHP-GTK ?"
Reply:
Absolutely 100%! It uses gtk 2.0 (2.10) and uses libwimp giving it a native windows look
and feel. The screenshots are from Windows XP.
Mike
Via reddit: The goto documentation got an xkcd overhaul. :)
I was emailed this a short while ago - thought it worth sharing
<quote>
Five years ago, Packt published its first book, ‘Mastering phpMyAdmin for Effective MySQL Management’. In the years that followed, Packt has published over 200 books on many different subjects and technologies.
We think it’s important to take the time to celebrate and thank the people who have made this possible. Therefore as our way of saying thank you for your support over the last five years, we have decided that over the next few weeks, Packt will be offering new and existing customers’ five exclusive offers.
The PEAR Installer Manifesto is one of the eBooks that we are offering to our readers. This book shows users the power of this code management and deployment system to revolutionize their PHP application development.
To download a free PDF copy of this book, simply visit [www.packtpub.com] and login to your account, or create one if you don’t already have one, and scroll down to your download area. Here you will see a link to the eBook, which you can download as many times as you like. In addition to this book, you can also download other eBooks on various technologies for free.
You can find more information on this offer by visiting [www.packtpub.com]
</quote>
RocketDMS is a multi-user document management system. This is a native windows application that provides easy storage, tracking, search and retrieval of electronic, scanned and physical documents. Built in scanning and full text searching. RocketDMS can be used as a GUI for Subversion and can be used with existing subversion repositories (>=1.6).
Thanks its dedicated community, symfony has been chosen as a finalist for the 2009 Sourceforge Community Choice Awards in no less than three categories!
Best Project
Best Tool or Utility for Developers
Best Project for the Enterprise
Some other PHP projets are also finalists: phpMyAdmin, FLOW3, Joomla, TYPO3, and vtiger CRM.
If you like symfony, or if you just like PHP, or if you just want to be kind with us, please, consider voting for symfony: [sourceforge.net]
At the Barcamp 2009 Alex, Michele, Michel, Markus, Sven and I continued a project that had already begun at the Barcamp 2008 - Creating an LDAP structure for internal Mayflower use and implementing a basic tool set for the administration.
A new LDAP scheme was created, a maintenance tool based on Zend Framework and Dojo was created and the tool was embedded as addon in the current PHProjekt 5
I'm changing jobs! Well, at the very least I'm leaving Filemobile.
It was for this job I moved from Hilversum, the Netherlands to Toronto, Canada. A very scary move for me at the time, but it turned out to be one of the best experiences of my life. I've ramped up my English, and went through the entire process of working out an idea to a successful company. As an owner I'll definitely still stay involved though, just no longer full-time.
Although moving to a new country can be intense, it would have been a lot more difficult if it wasn't for my co-workers, who've acted as both my friends and family. I doubt I'll find a work environment as fun as Filemobile. (If you live around toronto, they are looking for smart people!).
But after 3 years, it's time for something new. I'm excited to move somewhere else again, but haven't yet figured out the next step in my career path. If you have any advice or looking for someone with web development skills, definitely let me know! (resume). I'll be available for contract work, and I'll relocate wherever you are, if needed :).
Today, at the longest day of the year at the summer solstice, I am making a bit change to my life. If you're following me on twitter you probably already know what I'm up to. For everybody else, I am going to say good bye to Skien in Norway, and move to London (the one in England, and not the one in Ontario). Norway has been my home for the past five years, and I've had a great time exploring the nature as well as working at our office in Skien. Skien is a nice place, but ... not the most interesting of cities in the world. From today I will be living in London to see what life will bring me there. I am both sad to leave Norway, but I am also excited to live in a cool new place like London. I'll have awesome house mates (Hi, Mr. Þorbjörnsson, Ms. Cherry and Mr. Ray!!), and something new to put my energy in. I will continue to work as project leader for eZ Components for eZ Systems and continue to make great software with Alexandru, Tobias, Kore and Sebastian. If you are about in London, let me know! We could go for a pint or something. See you there!
Over at phpdeveloper.org I was pointed to a blog post talking about MySQLi and stored procedures. That reminded me about a small thing I recently did: When using MySQLi's multi_query to send queries which return multiple result sets you have to use a rather unintuitive API which can certainly be improved.
Recently I sat down and cooked up a small improvement for that, being an iterator fan I, of course, had to use an iterator for that and implemented the following class:
<?php
class MySQLi_ResultsetIterator implements Iterator {
private $mysqli;
private $counter = 0;
private $current = null;
private $rewinded = false;
public function __construct(mysqli $mysqli) {
$this->mysqli = $mysqli;
}
private function freeCurrent() {
if ($this->current) {
$this->current->free();
$this->current = null;
}
}
public function rewind() {
if ($this->rewinded) {
throw new Exception("Already rewinded, rewinding multiple times is not allowed!");
}
$this->freeCurrent();
$this->counter = 0;
$this->rewinded = true;
}
public function valid() {
$this->current = $this->mysqli->store_result();
return (bool)$this->current;
}
public function next() {
$this->freeCurrent();
$this->counter++;
$this->mysqli->next_result();
}
public function key() {
return $this->counter;
}
public function current() {
if (!$this->current) {
throw new Exception("valid() not called");
}
?>
This iterator is wrapping all that's needed an then can be used like that:
<php
$mysqli = new MySQLi("localhost", "root", "", "test");
$query = "SELECT 1,2 UNION SELECT 3, 4;".
"SELECT 'hi world' UNION SELECT 'foobar'";
if ($mysqli->multi_query($query)) {
foreach (new MySQLi_ResultsetIterator($mysqli) as $key => $result) {
echo 'MySQL Resultset #'.(1+$key).":\n";
while ($row = $result->fetch_row()) {
printf(" %s\n", $row[0]);
}
}
}
?>
The output will be something like
MySQL Resultset #1:
1
3
MySQL Resultset #2:
hi world
foobar
And is, in my opinion, way nicer than the classical way, which you can see on the multi_query docs page.
That code is the first revision of that idea, I'll try to improve it and port it over to C so that some future version of PHP will include it. As a disclaimer: If you plan on using this class be aware that a future PHP might bundle a class having that exact name so use your own name
Feedback welcome.
Some seriously good news here. It took several years of waiting, but, it finally happened. PHP-FPM project is officially BSD-licensed now, which means, that it has good chances to become a part of official PHP distribution.
PHP-FPM is “deciphered” as “PHP FastCGI Process Manager” and is a patch for php to greatly improve FastCGI SAPI usage in production. It adds a bunch of additional features to php’s fastcgi such as: easy php-process daemonization (with ability to specify uid/gid/chroot/log-file), safe php-processes restart (without losing requests), custom error-handling and accelerated file-upload support (requires additional support from web-server).
There’s not much documentation in english, currently, but, again, there is a good chance that it will be added really soon.
Four thousand words that distill what you really need to understand to build scalable multiuser servers: Server Design by Jeff Darcy.
I would love to have a 'Throwable' inteface in PHP, so I opened my very first feature request.
I realize this is mostly an OOP purist request, as it won't provide any real functionality.
If you agree, vote!
I had to relaunch a web site using Serendipity with a new Drupal installation. The old site had about 100 blog posts and lots of comments we did not want to loose. After some googling, i found this excellent blog post on creating drupal nodes programmatically and this useful resource on drupal node fields. i knocked up the following script that does the job. Just copy this to s9y-import.php and place it in your web root and call it in your web browser. Please back up your database in case something goes wrong (believe me, if you have no backup, it will go wrong!). You might want to read the code comments to know about the current limitations.
Read the full post to see the source code.
Memcached::OPT_COMPRESSION - -1001
Memcached::OPT_SERIALIZER - -1003
Memcached::SERIALIZER_PHP - 1
Memcached::SERIALIZER_IGBINARY - 2
Memcached::SERIALIZER_JSON - 3
Memcached::OPT_PREFIX_KEY - -1002
Memcached::OPT_HASH - 2
Memcached::HASH_DEFAULT - 0
Memcached::HASH_MD5 - 1
Memcached::HASH_CRC - 2
Memcached::HASH_FNV1_64 - 3
Memcached::HASH_FNV1A_64 - 4
Memcached::HASH_FNV1_32 - 5
Memcached::HASH_FNV1A_32 - 6
Memcached::HASH_HSIEH - 7
Memcached::HASH_MURMUR - 8
Memcached::OPT_DISTRIBUTION - 9
Memcached::DISTRIBUTION_MODULA - 0
Memcached::DISTRIBUTION_CONSISTENT - 1
Memcached::OPT_LIBKETAMA_COMPATIBLE - 16
Memcached::OPT_BUFFER_WRITES - 10
Memcached::OPT_BINARY_PROTOCOL - 18
Memcached::OPT_NO_BLOCK - 0
Memcached::OPT_TCP_NODELAY - 1
Memcached::OPT_SOCKET_SEND_SIZE - 4
Memcached::OPT_SOCKET_RECV_SIZE - 5
Memcached::OPT_CONNECT_TIMEOUT - 14
Memcached::OPT_RETRY_TIMEOUT - 15
Memcached::OPT_SEND_TIMEOUT - 19
Memcached::OPT_RECV_TIMEOUT - 15
Memcached::OPT_POLL_TIMEOUT - 8
Memcached::OPT_CACHE_LOOKUPS - 6
Memcached::OPT_SERVER_FAILURE_LIMIT - 21
Memcached::HAVE_IGBINARY - #&UNDEFINED;#
Memcached::HAVE_JSON - #&UNDEFINED;#
Memcached::GET_PRESERVE_ORDER - 1
Memcached::RES_SUCCESS - 0
Memcached::RES_FAILURE - 1
Memcached::RES_HOST_LOOKUP_FAILURE - 2
Memcached::RES_UNKNOWN_READ_FAILURE - 7
Memcached::RES_PROTOCOL_ERROR - 8
Memcached::RES_CLIENT_ERROR - 9
Memcached::RES_SERVER_ERROR - 10
Memcached::RES_WRITE_FAILURE - 5
Memcached::RES_DATA_EXISTS - 12
Memcached::RES_NOTSTORED - 14
Memcached::RES_NOTFOUND - 16
Memcached::RES_PARTIAL_READ - 18
Memcached::RES_SOME_ERRORS - 19
Memcached::RES_NO_SERVERS - 20
Memcached::RES_END - 21
Memcached::RES_ERRNO - 26
Memcached::RES_BUFFERED - 32
Memcached::RES_TIMEOUT - 31
Memcached::RES_BAD_KEY_PROVIDED - 33
Memcached::RES_CONNECTION_SOCKET_CREATE_FAILURE - 11
Memcached::RES_PAYLOAD_FAILURE - -1001
Just a little teaser before we all head out to countryside for the midsummer weekend:
Yes, you're seeing the software versions right. The screenshot is from the "About Midgard" screen of Ragnaland, a hybrid setup of Midgard's MidCOM MVC framework from Midgard1 (MidCOM 8.09) and Midgard2 running in an App Builder instance (Midgard 9.09).
Still requires some tweaking and bug fixes, but consider the possibilities:
I’ve seen a lot of methods used to take a website temporarily off-line for maintenance. Most involve a using PHP to disable the site or renaming the index file. There is however a far better method of doing this, by placing the following in the vhost file or in an .htaccess file in the document root:
Redirect 503 /
This way you are sure no part of the site is used. Also by returning a 503 http response, search-engine crawlers will not reindex your site right at the moment it is down. You can use ‘ErrorDocument’ to place a different text than the apache default.
A couple of days ago I came home from one of the best PHP conferences in the world, Dutch PHP Conference 2009 with again a very elite list of speakers.
Thursday, June 11 was tutorial day. A whole day dedicated at learning new things by the greatest PHP minds in the world.
I attended the "Zend Framework Workshop" by Matthew Weier O' Phinney, Chief Architect at Zend Framework.
I went to see this tutorial session to see all the goodies that are put in Zend Framework 1.8 and to learn how to do stuff better. Great stuff like Zend_Tool, Zend_Application and other Zend Framework components are worth checking out.
As it appears, I have to look into the Zend_Acl adapter using a configuration file or an external source and contribute my solutions to the Zend Framework wiki.
Afterwards a Belgian delegation went down-town Amsterdam to have dinner at an Italian place and a drink afterwards at "Leidse Plein".
Day one was a very hectic day for me since I was scheduled to speak at 10:30am. But we'll get there in a minute.
Before the opening keynote of Cal Evans, Director of PCE at Ibuildings, an awesome animated movie was shown to the public.
Cal Evans talked about what everyone could expect at the conference, what the rules of engagement were and what tags to use during the conference (a very important note).
Andrei Zmievski opened the conference officially talking about "PHP: people, code and ideas". Too bad I had to flee the scene half way the presentation to set up my gear for my own talk about SPL.
I hosted a talk called "SPL, not a bridge too far" where I discussed on a low level (according to some, a bit too low) the funky features SPL brings to the table. And looking at the comments left on joind.in I actually got people interested in using SPL in their future development projects.
Too bad I cut it short, like most people mentioned, because there's a whole lot to tell about SPL. Thanks everyone for you feedback, I will definitely keep it mind to make my presentation better.
Ben Ramsey showed us that "Grokking the REST architectural style" is worth thinking about when dealing with REST web services. He also talked about ATOM as a protocol, and he really got me interested in it to find out more. Thanks Ben, it was awesome.
Matthew Weier O' Phinney impressed us all again with another talk about "Contribute" and what we developers could do to make a difference.
For everyone involved in open-source projects, a must see presentation and again lots of kudos to Matthew for bringing this point to the attention of the masses.
Unfortunately I missed Stefan Esser's talk about "Secure Programming with the Zen
Truncated by Planet PHP, read more at the original (another 7573 bytes)
We just released FluentDOM 1.0. The package contains the two classes (FluentDOM and FluentDOMStyle) and a lot of examples.
FluentDOM is a test driven project. The tests are included in the package of course.
We decided to use The MIT License for the project. Test it, use it und please give us some feedback.
So yesterday I had a quick interview with a journalist from the Nenagh Guardian - my local paper - about this OpenStreetMap (OSM) mapping malarky.
As most of you will probably know OSM is to printed atlases from AA, Ordnance Survery etc, as wikipedia is to encyclopedias. People can contribute data to the project through a variety of activities: going out and actually mapping an area with a sat nav or gps unit [even a mobile phone with GPS in it such as an iphone, nokia n95 or whatever], tracing data off Yahoo [and other] aerial imagery, filing bugs on the openstreetbugs website or literally drawing in information via the walking papers map making website. And better again, this is about providing free geographic data such as street maps to anyone who wants them.
Anyway…I mentioned how the OpenStreetMap map of Nenagh is more complete than even the latest commercially available maps for Garmin and Google Maps and listed off a few ways how OSM could be used commercially: by real estate agents, courier companies, how being able to pin-point where all the amenities are would be useful for tourists, and so on.
Compare the Open Street Map of Nenagh with the Google Map of the area - as you can see, there’s still quite a bit of work to be done - Millers Brook needs to be marked as such along with the various groves, avenues etc that comprise that estate. Plus all the amenities, shops [perhaps even their opening hours] and the Shannon Development Industrial Centre still need to be added - as I’m sure are some other small portions of the town that I’ve unknowingly neglected.
It’s fair to say that this will never be finished - existing housing estates will be extended, there will always be urban development plans that when implemented would also need to be included on the map.
It would also be cool to have the new “Nenagh Cycling Hub” rendered on the opencyclemap.org website.
I discovered the OpenStreetBrowser site to be a great test of the data that myself and others have entered - it’s also a great way of demonstrating just what can be done with OSM data.
If you happen to spot something that I’ve missed please either drop me a comment or use the openstreetbugs website.
On a related note: it would be good to see a PEAR/PHP based client/component for interfacing with the OpenStreetMap server so that interesting apps utilising that data could be implemented on the LAMP stack - something to go alongside the Services_GeoNames package from pear

At this years Dutch PHP Conference I presented a PHP Security Crash Course for beginners and a session about secure programming with the Zend Framework. You can download all the slides from here.
PHP Security Crash Course for beginners
Secure Programming with the Zend Framework
Enjoy the slides and shoot any questions or improvement ideas my way…
Much has been written on Dependency Injection lately, mostly by Padraic Brady (1, 2) and Fabien Potencier (1, 2, 3, 4, 5). My subjective feeling tells me there are now more PHP DI containers out there than CMS or ORMs implemented in PHP, including two written by myself (an overengineered and a useful one). Its an awesome pattern if used on a larger scale and can (re-) wire a complex business application according to a clients needs without having to change much of the domain code. It aims at a complete seperation of object instantiation and dependency tracking from the business logic.
Beginning with version 1.8 Zend Framework is able to integrate any of these DI containers into its Zend_Application component easily. The Application component intializes a set of common resources and pushes them into the MVC stack as additional Front Controller parameters. Technically a Zend_Registry instance holds all these resources with their respective resource names as keys. The resources are accessible inside the Front Controller and the Action Controller classes. Assume the resource 'Db' is initialized in your application, you can access it with:
$front = Zend_Controller_Front::getInstance();
$container = $front->getParam('bootstrap')->getContainer();
$db = $container->db;
// or:
class FooController extends Zend_Controller_Action {
public function barAction()
{
$container = $this->getInvokeArg('bootstrap')->getContainer();
$db = $container->db;
}
}
This is pretty much dependency injection already, but the default registry approach suffers from two serious problem: New instances can only be added to the Container by implementing new Zend_Application resources and these instances cannot be lazy loaded. All resources used by Zend_Application are always loaded on every request. But the application container implementation was developed with Dependency Injection in mind and is not tied to the use of Zend_Registry. Only three magic methods are required by any container that wants to be Zend_Application compliant: __get(), __set() and __isset(). Each instantiated resource is pushed via __set() into the container. If required by another resource, __isset() is used to check wheater a resource with the given name exists inside the container and __get() is used to retrieve the instances from the container.
Some month ago I extended Yadif, a lightweight PicoContainer-like DI container for PHP written by Thomas McKelvey, with several features that make it a very powerful DI container in my opinion. It has a detailed documentation and examples on the GitHub Page if you want to check it out. I extended Yadif to be Zend_Application compliant in a way that the application-wide Zend_Application resources can be used as dependencies for objects that are lazy-loaded from the container. Skipping the tech-talk, here is an example. First we have to replace the default Container with Yadif:
$objects = new Zend_Config_Xml(APPLICATION_PATH."/config/objects.xml");
$container = new Yadif_Container($objects);
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/config/application.xml'
);
// Set Yadif as Container
$application->getBootstrap()->setContainer($container);
$application->bootstrap()
->run();
Assume you run Zend_Application with a "Db" and a "Cache" resource. These resources are loaded on every request. The objects configured in Yadif however are not instantiated until they are requested for the first time from the container. We can merge these two worlds and make use of the Application resources inside the Yadif Configuration "objects.xml", which looks like:
<?xml version="1.0" ?>
<objects>
<myModel>
<class>MyModel</class>
<arguments arg1="db" arg2="cache" />
</myModel>
</objects>
Instantiating a myModel
Truncated by Planet PHP, read more at the original (another 691 bytes)
Bugzilla isn't really the best place for contributing and discussing new ideas for a software project. Like Ubuntu and openSUSE before us, the Maemo community now also has a better tool for this: Maemo Brainstorm.
Maemo Brainstorm, developed as part of our efforts to the April 09 Sprint is a new web service that follows the model of Drupal's IdeaTorrent, but with a particular Maemo flavor.
Users can propose new ideas:
Users can also comment and propose solutions for ideas:
The ideas then enter "Sandbox", from where moderators can put them through the Brainstorm workflow:
After voting, popular ideas may then be chosen to be implemented by a team of moderators.
In addition to normal IdeaTorrent-like functionality as described in the Task page on Maemo Wiki, there are some adaptations for the maemo.org environment, including:
Some work is still being done on Brainstorm, including a dedicated search for this area of the site. In the meanwhile, please go and submit your favorite ideas, and vote for the ideas others have submitted. You can also follow the categories you're interested in via their RSS feeds, or the progress of your own ideas via the Dashboard.
And be sure to report any issues or ideas you have about Brainstorm itself!
Technorati Tags: brainstorm, maemo, midgard, moderation, ideatorrent
A while ago I was sent a review copy of “Learning JQuery 1.3” by Jonathan Chaffer and Karl Swedberg, as published by Packt. I’ve now had a chance to read it objectively and compare it against the original “Learning JQuery” which Packt also sent me to review about a year ago. That earlier edition covered a much less mature version (version 1.1.3.1 to be precise) of this popular Javascript framework.
Aimed at web developers and designers with a basic understanding of html and CSS (and some level of comfort with Javascript), the later book is thicker than the original - it weights in at some 440 pages compared to the 360 pages that were required for the first. A new chapter, “Developing Plugins” covers how to write plugins for the framework and how to “share it with the world” - naming conventions, documentation style and other advice are included. There is also a new “Quick Reference” appendix which just begs to be reproduced in “Cheat-sheet” format for pinning up on your wall. Chapters already present in the earlier book are more detailed and read better.
The subject matter is expertly covered and unless you were aware of the changes in jQuery 1.3, compared to the older version that the original was focused it would be difficult to tell which portions of the book are new - the revision and updates to the original are seamless.
Quite rightly, Swedberg and Chaffer do not explain all differences between jQuery 1.3 and its predecessors - they rightly assume that if you’re reading “Learning JQuery 1.3″ then you don’t need to be informed of exactly how jQuery 1.3 differs from the version they previous covered. The book flows better because of this and remains very easy to understand because of this approach.
There is no hint of the selector engine in 1.3 being any different than what was already covered. The language used for explaining the different concepts to the reader is more precise, especially so in the Events chapter and this makes understanding the concepts being covered much more easy - for this reason alone buying the revised edition is well worth the money.
The book doesn’t focus on new additions that were freshly added to jQuery 1.3 but also ones that had been added to jQuery since the first edition was published; JSONP, which was introduced in jQuery 1.2 is covered in the chapter on AJAX, as is the more low-level $.ajax() method; it also mentions which features have been removed from jQuery since the first edition was published - XPath being one such example. The listing of development tools has also been reworked, as has the Online Resources section. These listings mention resources that are current and up-to-date.
I remember mentioning in my review of the first book (trying hard not to use the word ‘original’ again!) that until a later edition of it was released that you wouldn’t be able to find a better book on the subject. I stand by that assertion - the only book that covers jQuery better than the first edition of “Learning jQuery” is the second edition of the same.
Yesterday we held our PHP BBQ event at Munich, well it was no BBQ as the weather forecasts predicted rain,which came in the evening, but a nice evening in a beer garden.
We had more than 30 people there, some leaving early, sme arriving late, covering quite different kinds of participants: PHP core developers, professional PHP users, people doing PHP stuff as hobby, friends and PHP community veterans like Till Gerken. Many people didn't know each other or didn't see each other or some time so we had lot's of discussions, and most of them even weren't about PHP and even many non-IT things were covered, which I find always great. If you want an impression check Ulf's photos. I really hope this makes a good foundation for more regular PHP meetups.
There will be a few more events of this kind this week in Germany, so go there if you can, don't be shy and have fun.
PHP BBQ dates:
Untitled from Paul Reinheimer on Vimeo.
Thanks to the efforts of Daniel O’Connor, the PEAR website is getting nicer and better. Bug RSS feeds support Baetle now, the PEAR proposal system - PEPr - works again and many small improvements and fixes found their way on the site.
Some people emailed me about a blog post I wrote some time ago about a dependency injection container done in PHP 5.3. I have published on Github the small version of it (Twittee), but not the "working" version.
Today, I took the time to publish it on Github. Pimple is a small dependency injection container, with all the features you need for a usage in real projects.
Feel free to use it, fork it, and enhance it for your next PHP 5.3 project.
And don't forget to give PHP 5.3 a try as the PHP core team has just published the third release candidate, and they hope to release the final version by the end of June.
Frequently, you do client work and if you are fortunate enough, you can setup a development environment on your own server or your laptop (or whatever), tinker with the files, and templates, and so on — until it's all done.
And whenever you are done, it's time to move files.
Sounds easy? It sort of is!
ChecklistHere's a small check list of things to keep in mind when you move an installation.
You may need to fix up the configuration file in order to adjust all database related settings. It's located in app/etc/local.xml.
Certain directories will need to be made writable. Writable in this case means that the webserver has to be able to write into it. Since most of the standard PHP setups are with mod_php, this will be the user www, apache or www-run (in most cases). If you (or your provider) runs php-cgi, chances are that this is not necessary.
You may have to ask an administrator to set this up. If the administrator is not available, you can always chmod 777 these, but for obvious reasons this may be risky in a shared environment.
The following is a list of directories (and contents) which need to be made writable:
app/etc/var/media/And in case you want to use MagentoConnect, there are additional directories to make writable. Please see this blog post for more info.
URLs, URLs, URLs. You were working on localhost all this time and now you think you can move it over just like that? Wrong!!! ;-) But all you need to do is edit the following keys in the core_config_data table:
web/unsecure/base_urlweb/secure/base_urlIf you have any additions, please leave a comment!

The PHP BBQ Tour organized by Ulf Wendel and various PHP Usergroups in Germany will stop in Karlsruhe. For those of you living near Karlsruhe, it’s definatly worth to join us. There will be food, drinks and I’m sure it’ll be a great evening. Information can be found here

Liip is happy to announce that we are now the official Swiss Mahara Partner! Mahara is an Open Source
ePortfolio system.
In many respects Mahara is a "sister" application to Moodle, providing students with a learning environment that they themselves own, giving them them the ability to showcase their work and collaborate with their peers. However, Mahara is also well suited as a social networking system, running out of the box without Moodle.
Mahara was originally funded by the New Zealand government's Tertiary Education Commission, and has grown into a thriving open source product that is increasingly being adopted worldwide. It makes a lot of sense for Liip to be a partner, both because we're already the official Moodle partner in Switzerland, and Mahara fits very well into our existing list of projects we work with, and because Penny Leach, one of the original core developers, is now working at Liip.
We are very much looking forward to providing services around Mahara!
Shortly after my lunch I saw the following tweet from David Pogue, technology columnist for the The New York Times.

Given Pogue’s large following, I was disappointed by the advice he gave.
A secure password on a laptop isn’t to keep semi-trusted people off of it. It’s to keep it protected in the event that the hard drive is lost. Arguably, the drive could be removed and read without booting it, removing all password protection, but a good password combined with disk encryption can help protect data from theft.
Pogue argues that he doesn’t need a password for security, but any information that is stored on file servers or worse, in his keychain, is accessible with that simple password he is using. Failing to have a secure password not only places his data at risk, but the data of those he might know or work with.
Even if gaining physical access (e.g. finding the computer or stealing it) would grant a person a huge advantage, this is not an excuse to make the password so incredibly simple. And for one of the most well-known technology columnists to suggest otherwise to his 444,666 followers is negligent, bordering on criminal.
Twitter is everywhere nowadays. Odds are eventually you will want to tweet
from PHP. No need to use one of the numerous PHP Twitter libraries, as
tweeting is as simple as using the PHP built-in file_get_contents()
function:
function tweet($message, $username, $password)
{
$context = stream_context_create(array(
'http' => array(
'method' => 'POST',
'header' => sprintf("Authorization: Basic %s\r\n", base64_encode($username.':'.$password)).
"Content-type: application/x-www-form-urlencoded\r\n",
'content' => [http_build_query(] array('status' => $message)),
'timeout' => 5,
),
));
$ret = file_get_contents('http://twitter.com/statuses/update.xml', false, $context);
return false !== $ret;
}
Pretty easy, no? Using the tweet() function is of course a piece of cake:
tweet('From PHP, yeah...', 'fabpot', 'Pa$$');
As an added bonus, the function returns true if everything went fine, or
false otherwise.
As we talk about Twitter, you can follow me.
FluentDOM got an own webpage at [fluentdom.org] .
You can now find nightly builds at [nightly.fluentdom.org] . A PHPUnit log file and the code coverage report for the latest nightly build is provided, too.
Status UpdateWe added a FluentDOMStyle class. This class extends FluentDOM and adds support for manipulation of the style attributes.
$items = FluentDOMStyle($xhtml)->find('//div');
$items->css(
array(
'text-align' => 'center',
'color' => 'black'
)
);
This one reminds me on my past - after seeing it, I feel very happy that I do not do any contracting work any more. I still don’t know if I should laugh or cry. It might be old - but nevertheless worth to watch it.
(English - with German subtitles)
via Guido Muehlwitz
I thought the topic of offensive presentations at professional tech conferences was beat to death before, but apparently there are still some out there who don't get it. Recently, the GoGaRuCo incident stirred up controversy, and now this monstrosity has occurred.
In a nutshell, the keynote speaker at Flashbelt, Hoss Gifford, gave a presentation that included actions and images that would make even Howard Stern do a double-take. The highlights of the talk, according to Courtney Remes, as recounted here, are:
Yeah, seriously. WTF, indeed.
- He opens his keynote with one of those "Ignite"-esque presentations — where you have 5-minutes and 20 slides to tell a story — and the first and last are a close-up of a woman's lower half, her legs spread (wearing stilettos, of course) and her shaved vagina visible through some see-thru panties that say "drink me," with Hoss's Photoshopped, upward-looking face placed below it.
- He later demos a drawing tool he has created (admittedly with someone else's code) and invites a woman to come up to try it. After she sits back down, he points out that in her doodles she's drawn a "cock."
- Then he decides he wants to give a try at using the tool to draw a "cock" (he loves this word) — and draws a face, then a giant dick (he redraws it three times) that ultimately cums all over the face.
- A multitude of references to penises and lots of swearing — and also "If you are easily offended, fuck you!"
- And then, to top it off, a self-made flash movie of an animated woman's face, positioned as if she's having sex with you, who gradually orgasms based on the speed of your mouse movement on the page.
Hoss exploits this shared narrative in his work to great effect, and will use his inaugural Flashbelt presentation to analyze a series of projects that build on each other's successes and failures to deliver increasingly rich experiences. And he'll say ` F**k ' a lot.
His idea of "increasingly rich experiences" differs from mine, apparently.
Interestingly enough, it was his response and the response of his supporters that reveals the deeper issues. There are still so many out there who think that they are entitled to act like douchebags because they *can,* and that everybody else should let it go. Get over yourselves, I say. You're nowhere near as cool as you'd like to think you are. And you shrugging it off and alienating a good portion of your audience (men and women alike) is like me building a website that requires IE8 only.
I applaud the collaborative efforts and professionalism of the well thought out response by the conference organizers and the geek girls -- they are truly making progress, I think. In a way, though, it really saddens me. It saddens me that this conversation and effort even has to take place.
I think that idiots like Mr. Gifford do not represent a good portion of male techies in the world, and certainly he represents none of the men I know in the PHP world. So basically, I know I'm preaching to the choir on this one, but for those gentlemen out there that don't get it, IT'S REALLY NOT THAT DIFFICULT.
In case you're not sure where the "appropriate" line for your professional presentation is, here are a few pointers to help you decide.
1- Witty, pertinent content: GOOD. Pictures of naked women, or really anything sexually charged: BAD.
2- If you would feel uncomfortable giving the presentation to your little sister or Aunt Linda, CHANGE IT.
3- The audience and the conference organizers are your CLIENTS. They're paying you good money to educate and share your knowledge. Offending and embarrassing them and yourself is a BAD IDEA.
4- EDGY does not mean PORN.
5- You obviously have intelligence and something interesting to say. DON'T HIDE BEHIND BULLSHIT.
6- It's called EMPATHY. LOOK IT UP.
If you *still* don't get it, and you're not sure if your presentation is questionable, approach some women in tech with your presentation and get their opinion. We are out there, trust me. No, we won't chastise you for being ignorant. We will appreciate the fact that you cared enough to ask.
Today is my last day at The Bivings Group. Yesterday was my last effective day; as I write this, I’m flying over West Virginia on my way to a friend’s wedding in California.
Starting June 22nd, I’ll be working for Applied Security. I’ve learned a lot at The Bivings Group, and worked on a lot of great projects, including The Pickens Plan. I’ll miss the friends I made, but I’m glad that I’ll be able to see them again at the developer’s group meetings and conferences.
Good luck to the folks at The Bivings Group. See you soon.
I think this is different from the last one, since this one has three openings, instead of a single senior one.
Contact information:
Carl Kenny, Yoh IT
408.654.9192 Extn:25
carl.kenny [at] yoh [dot] com
A small, but promising company in Sunnyvale is seeking a Sr. Software Engineer with the following skills:
Projects that the candidate will be working on depending on their mix of skills are:
Contact Urmila Bhide, Talent Space, Inc., 408-330-1905
Today I like to present a new projekt: FluentDOM
It provides an easy to use, jQuery like, fluent interface for DOMDocument.
The idea was born in a workshop of Tobias Schlitt about the PHP XML extensions at the IPC Spring in Berlin.
The last few days Bastian Feder and I implemented it. That's how it looks in action:
require_once('../FluentDOM.php');
echo FluentDOM($xml)
->node(
FluentDOM($samples)
->find('//b[@id = "first"]')
->removeAttr('id')
->addClass('imported')
)
->replaceAll('//p');
We are aware that here are some other projects with similiar concepts. But none of them matched our requirements (XML targeted, XPath selectors, namespace support, ...).
You can take a look at the current version in Bastian's public SVN.
svn://fluentdom.org/trunk/FluentDOM
DPC - 0 Interview with Christian Wenz from Paul Reinheimer on Vimeo.
DPC Day 0 - Rob from Paul Reinheimer on Vimeo.
As author of Xdebug, people ask me often the question how to handle the case in teams when there is one development server and multiple developers working on the same project on that server. Xdebug only allows you to specify one IP address to connect to (through xdebug.remote_host) while doing remote debugging. It does not automatically connect back to the IP address that runs the browser the request the PHP scripts because of security reasons. You don't want everybody on the Internet to be able to run a debugging session against your code for example. There is no problem if all developers are working on a different project, because the xdebug.remote_host setting can be made for each directory (through Apache's .htaccess functionality). However, for the case where multiple developers work on the same code, the .htaccess trick won't work as the directory in which the code lives is the same.
Now,
in order to solve the above mentioned issue, you will need to run a DBGp
proxy. DBGp is the protocol, designed by ActiveState and myself to facilitate
communication between an IDE (such as Komodo, or any of the other
listed clients)
and PHP+Xdebug. A DBGp proxy is a bit of software that acts as a
redirector for DBGp streams. In order to make things work for multiple
developers and one source base, you set Xdebug's xdebug.remote_host
setting to the machine on which the DBGp proxy runs. This is most likely
going to be on the same machine that acts as development server, so that
the xdebug.remote_host setting should be set to "127.0.0.1"
(i.e. localhost). The proxy server the listens for IDE connections. An
IDE needs to register itself with the DBGp proxy by using the proxyinit
command. This command requires an "idekey" that is a
unique identifier for each client (IDE). Every developer should have its
own unique idekey (I usually just pick my name), and this idekey should
be configurable in the IDE. For Komodo, it's at
Edit->Preferences->Debugger->Connection->"I am running
a debugger proxy and Komodo should use it"->"Proxy
Key". In Komodo you also need to select "a system-provided
free port" in the same configuration panel. When initiating the
debugging session from the browser with either
XDEBUG_SESSION_START=session_name as GET/POST/COOKIE parameter, or
export XDEBUG_CONFIG="idekey=session_name" from the comment
line, make sure to change "session_name" to the idekey as
configured in your IDE. (See the documentation on
how to set this up). The Xdebug Firefox
extension also has a setting for this. You have to configure
Xdebug's xdebug.remote_host
setting to the IP address of the machine that the proxy runs at. Xdebug
itself does not see a difference between either the proxy and a normal
IDE. But the proxy itself now knows because of the configured idekey on
how to forward the requests and responses to the correct client.
You can find the DBGp proxy code as part of the python remote debugging package that ActiveState provides. By default it listens for IDE registrations at port 9001, and for Xdebug connections at port 9000. To run the proxy, do:
tar -xvzf Komodo-PythonRemoteDebugging-5.1.3-28369-linux-x86_64.tar.gz cd Komodo-PythonRemoteDebugging-5.1.3-28369-linux-x86_64 cd bin ./pydbgpproxy
This outputs:
INFO: dbgp.proxy: starting proxy listeners. appid: 30430 INFO: dbgp.proxy: dbgp listener on 127.0.0.1:9000 INFO: dbgp.proxy: IDE listener on 127.0.0.1:9001
Running a DBGp proxy also allows you to avoid NAT issues where (as seen from PHP+Xdebug on the server) all connections seem to come from the same IP (because your internal network is NATted). In this case, you can simple run the dbgp proxy on your NAT machine, configure xdebug.remote_host setting to the IP address of your NAT machine, and configure the IDEs to connect to the proxy running at :9001.
As a last note; there is a patch to allow the connect-back-to-requesting-IP-address functionality that is not available directly in Xdebug. This patch, written by Brian Shire and Lucas Nealan of Facebook made its way into Xdebug 2.1. However, great care should be taken by using this functionality. It does not make the NAT situation as outlined above work however.
Oof!
I like giving presentations. I really do. But this has been quite a conference season this year; certainly my busiest ever. Four conferences in four different states, and nine presentations. And the year isn't even half over yet...
Here's what I've been up to:
DPC -1 from Paul Reinheimer on Vimeo.
DPC -1 from Paul Reinheimer on Vimeo.
DPC -1 from Paul Reinheimer on Vimeo.
The German Oracle User Association (DOAG e.V.) has published a statement (in German) about the acquisition of Sun/MySQL by Oracle and its impact for Oracle users. You can find the statement here.
Oh and btw, I'll give a session about "PHP5 & Oracle" at the local Oracle usergroups in Frankfurt on June, 23rd and Hamburg on Sep 14th. The main goal is to promote the usage of PHP5 in Oracle environments (and how you can leverage PHP's potential in Enterprise environments) as there are good Oracle database connectors for PHP5 available. See you there!
Hello!
i am Mte90 and i have actually 18 years. I'm a web programmer principally but when i have decide to abandon Windows on my notebook i have opted for Sidux (debian sid). But in windows i was a vb.net programmer and the .net framework it isn't for linux. I have decided to develop in this good language!
I begin the italian translator of this site for the italian!
I develop for the cms that i use in the php language. The name is New-Cms and is a flat cms.
I like jquery and retain that this iste is a good point to learn this language!
Hello everybody!!!
Today I was writing some Selenium unit tests for our PHPUnit test suite and needed to check if a certain navigational tab was active. Situation in html:
I needed to check if Button 1 was active. The problem was that with simple xpath constructs like //span[@class='active']/input do not work since the class may have multiple values.
The rescue was the contains function: //span[contains(@class, 'active')]/input[@id='someId'] as parameter to assertElementPresent().
Update 2009-06-09Jakob Westhoff has a better solution to this problem.
If you need to regularly connect to a lot of different servers like I do, you probably use SSH to connect to them, and you also probably use your personal SSH identity file to ease the connection.
Some time ago, I re-discover a neat trick to simplify the connection by using
the .ssh/config file. I don't know why I forgot about it, but as it seems
that a lot of people around me do not know about this file either, here is a
small post on how it can be used to your advantage.
Let's say you have a host at 1.2.3.4 you need to connect to and the username
you need to use is fabien. Each time you want to connect to it, you need to
type something like the following:
$ ssh fabien@1.2.3.4
Simple enough, even if you need to remember the remote user you need to use for each server. However, if you need to specify a specific key, it becomes more verbose:
$ ssh -i /Users/fabien/keys/myserver.key fabien@1.2.3.4
That's difficult to remember, quite tedious to write and error prone. Instead, I want to be able to just type:
$ ssh myserver
It's quite easy. Create a .ssh/config file under your home directory and put
something like this inside:
Host myserver HostName 1.2.3.4 User root IdentityFile /Users/fabien/keys/myserver.key
That's all there is to it. Now, connecting to the server is as easy as typing:
$ ssh myserver
And it works everywhere SSH is involved. For instance, when you use scp to
copy a file:
$ scp localfile.txt myserver:/tmp/
It is also a great way to not give sensitive information in configuration
files. For instance, in a symfony project, the properties.ini file can
contain the information to connect to the production servers used for
deployment. Instead of having to hardcode the real host name, the login and
the password like this:
[production] host=www.myserver.com port=22 user=someusername pass=somepassword dir=/var/www/mysite/
You can simply reference the name you gave in the config file and keep the
details secret on your local machine:
[production] host=myserver port=22 dir=/var/www/mysite/
Unix is really powerful thanks to little things like this one. By the way, if you want to know more about the Unix history, you can read the really interesting "Unix turns 40: The past, present and future of a revolutionary OS" article published on ComputerWorld.com earlier this month.
Why spend valuable time coding everything by hand? Using a framework is a great way to save time and effort on your next project—you’ll have a firm foundation to build upon, there will be pre-built modules to perform tedious coding tasks, and if you’re a learner, it’s a great way to learn about good coding practice. PHP’s massive popularity means that developers have a wide variety of frameworks to choose from. We’re sure you can find one amongst these 16 to meet your needs.
Agavi: This PHP 5-based framework started off as a fork of the popular Mojavi project. While it can be used as a web site construction kit, its primary focus is on building fully-fledged applications.
Akelos: Akelos is a PHP port of a Ruby on Rails framework for building web applications. It avoids complex configurations, making it ideal for use on simpler web servers. There’s a healthy community around this one!
CakePHP: The very well-known CakePHP is easy for coders of all skill levels to use. It’s based on the same principles that guide Ruby on Rails, and its heavy focus on rapid deployment methods make it a great choice for developers who are squeezed for time (see SitePoint’s beginner’s CakePHP tutorial to get started).
CodeIgniter: EllisLab’s CodeIgniter has won wide praise for its small footprint and speed, and has become a favorite amongst many developers. There’s extensive documentation and a large community of users to help you out.
eZ Components: OK, so we’re stretching the definition of framework here. eZ Components, as the name suggests, is a library of individual components for common tasks. If you’re familiar with the ezPublish CMS, you might have seen some of these components before!
Fuse: Fuse is based on Ruby on Rails and CakePHP, but has had many features added by the development team to make the most stable platform they could. There are frequent updates—development on version 2.0 is underway!
Horde: This mainstay of the PHP framework world grew from the Horde webmail and groupware suite. If you’re a developer who speaks a language other than English, you may be interested in the fact that the framework is designed specifically to be localization-friendly.
Kohana: Kohana, originally based on CodeIgniter, puts its focus on being small, fast, and secure.
Truncated by Planet PHP, read more at the original (another 5323 bytes)
The LCD screen from my macbook broke a while back, much to my regret Apple's warranty didn't cover it at the time and was going to charge $900 for it.
I was pretty set on making it useful again, so a few days ago I ordered a new LCD screen myself. It was quite an undertaking to replace it, because it was needed to take the entire thing apart, top to bottom.
It took me 4 hours, and 12 minutes including dinner and going to the neighbours to replace a screwdriver. Here's a 12 second version of it:
Sorry, your browser does not yet support the html <video> Try it with the latest (beta) version Firefox, Opera or Safari.
If you plan to try this yourself, know what you're getting into.. Make sure you have a steady hand and it helps if there's someone around to hold stuff together. Make sure you get good screwdrivers and be very careful with the cabling. I also found it handy to use tweezers.
I got the instructions from IFixit, which has some great guides.
After all that, I ended up with 1 screw I was unable to fit back in, a few damaged wifi antenna cables (still worked!) and I discovered a few places of broken plastic, which were likely from the first time it got damaged.
A few weeks ago, Helgi and I attended PHP|Tek 2009 in Chicago, as both representatives of echolibre and The PEAR Group.
This post will briefly discuss the formation of a Recommended PHP Standards Group, as put forward by a meeting of PHP developers at the conference. As would be expected, a bit of controversy surrounds this proposal, but my hope would be that it would be accepted and grow within the global PHP community in the coming years.
As posted by Travis Swicegood, a group of community project representatives came together to discuss naming standards for PHP 5.3 and above. (I would like to take the opportunity to publicly thank the staff of the PHP|Tek conference for providing us with a large meeting room with little more than 2 hours notice).
So, what’s this all about?With PHP 5.3 being closer to a stable release, the inclusion of namespaces and packaging within projects will take on a whole new meaning for large projects. People representing The PEAR Group (PEAR2), The Zend Framework, Cake PHP, Solar PHP, Agavi and unofficial representatives of Symfony and Phing met together and we discussed standards that could benefit each of the projects and the community in general.
Attending wereBeing a PEAR representative with Travis, Helgi and Brett we brought to the table the feedback and problems that we have been facing over the past year and a half with namespacing standards discussions, Matthew Weier O’Phinney from the Zend Framework brought their issues, same for Agavi, Solar, Cake and Symfony (Stefan is an unofficial representative). We brewed and stormed our issues, brought solutions and came up with a standard for namespacing and package structure.
Sneak PreviewHere are a few hints about the standards (outlined on this page) which cover things like namespace packaging structure, exceptions, abstract class naming, interface naming, and concrete class naming.
NamespacesAll packages should be named:
<vendor>\<package_or_component>\<ClassName>
Example:
1 2 3 4 5 | <?php
namespace pear2\text_diff\Diff;
namespace zend\controller\FrontController;
namespace cake\models\DatabaseModel;
?> |
All of the above mentioned projects consented to this standard as of PHP 5.3. What this means to users and developers is that the barrier for entry from one framework to another becomes greatly reduced and the interoperability of packages between projects is tremendously improved.
A few of my friends and associates may have heard me talk about the media server I've been running in my basement; I used to automatically transfer content from my tivo to a hard-disk in my basement so that I had more space for recordings on the tivo. Since most of the recordings that I want to keep are now available via Hulu, I haven't had much call to use it in the last 6 months.
So, what is CouchShare? It's a UPnP server that can share content from folder to an XBox 360 on your network.
It's written in PHP (and requires a tiny PHP extension to enable multicast support) and is written using the eventing framework that is part of the Alexandria codebase.
I wrote the code back in 2007 and it has served me well for a couple of years; it felt like it was about time I got off my backside and shared it with the world.
It is by no-means a polished bit of code; I think it's probably the sloppiest code I've written in quite some time, and it may well need a couple of tweaks to make an easier application out of it.
DPC Day -4.5 from Paul Reinheimer on Vimeo.
PHP 5.3 is just around the corner with a lot of great new features. However, even if I'm really excited about this new release, I won't make yet another PHP 5.3 feature list; I will rather look at the future of PHP. PHP core developers met at php|tek and discussed the future of PHP. And it is really great to see that they plan lots of wonderful features; let's set aside the Unicode stuff.
They published some notes from the meeting, and here is my personal list for things I find really interesting:
Add __cast() magic method that will be called for all casts. If the
__toString() method is there it will get used for string types first.
Consider making a "callable" type.
Make ArrayObject and ArrayAccess accepted everywhere regular arrays
are.
Add traits support.
Add type hinted return values, scalar type hints.
Make function call chaining possible (f()() if f() returns a function),
and array dereferencing (f()[0]).
C#-style properties with getters/setters:
class Foo
{
public $bar
getter { return $this->bar; }
setter { $this->bar = strtolower($value); }
;
}
Three weeks after I present my research about advanced post exploitation in hardened PHP environments at SyScan in Singapore and Taipei, I will present a similar session at this year’s Blackhat Briefings 2009 in Las Vegas. The session will be a little bit different from the one at SyScan because I will have a few more minutes to present. If you want to see some PHP memory corruption voodoo in action and cannot attent SyScan you should come to Las Vegas.
Session: State of the Art Post Exploitation in Hardened PHP Environments
When an attacker manages to execute arbitrary PHP code in a web application he nowadays often ends up in hardened PHP environments that not only make use of PHP’s internal protections like safemode, openbasedir or disable_functions but also make use of Suhosin and operating system, filesystem or libc level security mechanisms like ASLR, NX, hardened memory managers or unix file permissions.In such a situation taking over the server becomes a challenge and requires PHP shellcode that is able to use local PHP exploits to get around these protections. This talk will show the problems arising from the different protection mechanisms for PHP shellcode, will give an insight into the internal memory structures of PHP that are required to write stable local exploits and will demonstrate how a special class of vulnerabilities in PHP that also exists in standard functions enables PHP shellcode to get around most of these protections.
See you in Las Vegas between 29rd and 30rd.
One of the biggest decisions you can make for any project is the environment it which the project will be written.
Most developers mistake the word environment for the word “technology” or “software”. For example, you develop in a “JSP environment”, or a “LAMP environment”. This is a crucial mistake that is made time and time again, and unfortunately, it hurts companies because the decision makers either make the same mistake, or they listen to those making the mistake.
I’ve said numerous times, that you can use any language to do anything. Yes, there are practical limits, using C to write a dynamic website isn’t a great idea, nor is using PHP for password cracking. Each language has it’s own strengths and weaknesses; good developers however, know what these are and work with their strengths and work around their weaknesses. This post isn’t going to focus much on languages; I figure everybody reading has already chosen PHP and knows why.
What I will say is this: Ruby, Python, PHP, Perl, Java and .NET all bring the same capabilities to the table (some things are easier in some, and some more difficult in others). You can create any solution you want in each of these languages, in an efficient, well thought out, well developed way. Yahoo! could be written in Python. How do we know this? because Google uses it. Microsoft uses .NET for it’s web presence, and while you might not like to use it, it still stands up to more stress than most of the websites on the internet.
With this in mind, I then would say that the language capabilities themselves, are the least important factor in choosing your environment.
This then brings me neatly to what else that environment encompasses. These, to me, fall into three categories. People, knowledge and penetration.
Access to PeopleTo put it bluntly, if you can’t find the people to write your code, you’re screwed. While you may know what you’re doing, and you have enough people now: your team will need to grow. If you can’t find people around you to hire, then what?
There are estimates that for every 100 PHP developers, there are 42 Perl developers, there are 12 Python developers and 4 Ruby developers. (see: here)
Some will say that this is because there is a lot of bad PHP developers. I will agree to a point, but that point is that there are just so damn many, that there are still more great developers to pick from than with other languages.
Access to KnowledgeWhile this one is more subjective, I believe that the sheer number of PHP developers generate far more useful knowledge from which to learn, cherry pick ideas and utilize them. Add to that the extensive number of books, and our excellent php|architect magazine; as well as the training and teachings provided by MTA, Zend and ibuildings, we have more going for us than most every other language with, I think, the exception of Java in terms of professionally backed learning.
Market PenetrationSimply put, the availability of PHP as a platform is there from the cheapest virtualhost, to the most expensive dedicated systems. It has gained wide acceptance from smaller companies, because it is cheap and reliable, and from enterprise companies such as IBM, Oracle and even Microsoft because they see that the ability is there for PHP to operate in that space and a huge number of developers willing to make that happen.
ConclusionNo other language can claim this trifecta, sure, there are a lot of .NET and Java developers, but a lot that goes on happens behind closed doors in big enterprises, and the knowledge is not shared. And while this isn’t true of Python, or Ruby, they lack in numbers and knowledge comparatively. This is why I choose PHP.
- Davey
Dutch PHP Conference Day -6, part 1/? from Paul Reinheimer on Vimeo.
This is an abstract for a chapter from a book on Quality Assurance in PHP Projects.
Although Unit Testing is a recommended practice for any software project, care has to be exercised such that testing yields the desired benefits. Bad programming practices in both test code and production code can make Unit Testing a nightmare. Maintenance of an overly complex test suite can easily become a burden to the project team.
Situations of hard to maintain test code can have extremely negative outcomes for project quality. Programmers start to ignore tests, because of their inconclusive description of what is going wrong. New features might not be tested at all, because writing tests for the current architecture considerably extends development time. In the end the project manager might decide to stop Unit Testing alltogether, because the costs outweight the benefits.
Bad practices of Unit Testing manifest in so called "Test Smells". These are an early indicator of problems for long-run maintainability and utility of a project test suite. To constantly derive a benefit from Unit Tests, a commitment for high quality tests has to be made.
This case study will discuss Unit Testing bad practices and well as Test Smells and gives hints on how to avoid them. For each test smell, examples are shown from well-known PHP Open Source projects. As a result, the reader should be aware of the possible pitfalls of Unit Testing and that any test code requires the same care that is put into production code.
Benjamin Eberlei is a Project Lead with direkt effekt GmbH and contributes to the Zend Framework and other Open Source projects.
Swati Iyer from Packt Publishing offered me a free copy of Mastering phpMyAdmin 3.1 in exchange for a review on my blog. I got the book, I read it, and here is the review.
"Mastering phpMyAdmin 3.1 for Effective MySQL Management" is a book about - phpMyAdmin. phpMyAdmin is a tool that most web developers use on a daily basis and know in and out. The existing knowledge about PMA is the hurdle that will make most devs refrain from buying the book; 75% of the information presented in the book was already in my head, having used PMA for over half a dozen years now.
Interestingly, the book still contained things that I didn't know and that are noteworthy. For example, I never heard about the multi-table query generator. Other aspects I didn't know about or only sketchily:
The last thing that really excited me was the foreign key dropdowns when using the pma-based linked table infrastructure. Surely I had already seen the dropdowns, played around with and used them, but I never knew that one could customize the format. And, what's way cooler, is that - if there are too much items for the dropdown (number configurable) - you'll get a "browsable foreign-table window" popup! Really nifty.
So I learned something new about phpMyAdmin while reading the book. It's a book for lazy train rides when you don't like to switch on your laptop. The book is 35 US$, so with the low Dollar today, it's a cheap buy for Europeans (and probably becoming cheaper over the next months). If you need it, and if you didn't get enough tips by reading this article.
Swati Iyer from Packt Publishing offered me a free copy of "Mastering phpMyAdmin 3.1" in exchange for a review on my blog. I got the book, I read it, and here is the review.
"Mastering phpMyAdmin 3.1 for Effective MySQL Management" is a book about - phpMyAdmin. phpMyAdmin is a tool that most web developers use on a daily basis and know in and out. The existing knowledge about PMA is the hurdle that will make most devs refrain from buying the book; 75% of the information presented in the book was already in my head, having used PMA for over half a dozen years now.
Interestingly, the book still contained things that I didn't know and that are noteworthy. For example, I never heard about the multi-table query generator. Other aspects I didn't know about or only sketchily:
The last thing that really excited me was the foreign key dropdowns when using the pma-based linked table infrastructure. Surely I had already seen the dropdowns, played around with and used them, but I never knew that one could customize the format. And, what's way cooler, is that - if there are too much items for the dropdown (number configurable) - you'll get a "browsable foreign-table window" popup! Really nifty.
So I learned something new about phpMyAdmin while reading the book. It's a book for lazy train rides when you don't like to switch on your laptop. The book is 35 US$, so with the low Dollar today, it's a cheap buy for Europeans (and probably becoming cheaper over the next months). If you need it, and if you didn't get enough tips by reading this article.
As announced previously by Sebastian, the crew of MAYFLOWER spent 5 days in St. Leonhard, South Tyrol (Italy), for this year's Barcamp. In the next couple of days the teams will present their projects ranging from LDAP to modules for PHProjekt 6 or phpmybirthday. Starting today with a ContactImporter.
Almost every internet user knows the problem: You manage your contacts at different services like social networks, webmail clients and so on. With an increasing number this can become quite confusing, and you never know where a specific contact is saved. Sometimes you wish you have a possibility to merge all those contacts at one central point.
The PHP Community is a fairly large, rules-free community of people who share a common interest in programming. Many of us hang out on Twitter, our own blogs, or on IRC (usually on Freenode #phpc). So some events of the day certainly caught me by surprise.
This afternoon, while hanging out in a lesser known channel, I was kicked out for no reason besides the whim of the operator, Derick Rethans. No warning, no rude comment on my part, just a joke followed by a kick. Alison Lunde was also kicked for a seemingly bogus reason. Another person was banned.
How could this be, two weeks after the “community conference,” which Derick himself attended?
I was furious. I felt betrayed, violated, attacked personally for something that shouldn’t have happened. I hadn’t been kicked out of an IRC channel since before I was a teenager; this was a personal insult and by God, I was ready to fight. I talked to a number of my friends in the PHP community and told them that this slight was beyond insulting; I was going to tear Derick a new one on my blog and wash my hands of the community forever. After all, everyone in the channel seemed to support this decision, right? They were all still there, hanging out, perhaps hoping they wouldn’t be next.
But a few hours went by, and a few things started to happen. First, a number of people in the community told me that leaving the community would hurt the community overall. Others told me they were beside themselves at Derick’s action, and wouldn’t be participating in any “elite” channels. I got a number of supportive emails. A number of people said “well if we can’t be a part of that channel, we’ll start our own” and did just that. Not to be exclusive - just to reduce the noise level.
As time went on I realized that the community really is larger than any one person. Even when one person does something inconsiderate or rude, that doesn’t and shouldn’t define the community. I was really ready to let Derick have it, to walk away, and to never be a part of the community ever again. But no one person defines the community, and no one person can shape it, no matter who they are. That’s the point of the PHP community.
Instead I’ll practice some forgiveness. Derick, you’re welcome in any channel I’m in, any time. Xdebug is fantastic and your book on dates and times is perhaps the preeminent work on the topic. Your contributions to the core of PHP and its documentation are unmatched by anyone, and with 130 presentations to your name, you certainly are accomplished. You’re a part of the community, and I welcome you.
For those wondering how to join the community, it’s easy. Show up in IRC, or come to a conference. Find your users group in your area, or join one of PHP’s many project mailing lists. If you need direction, Elizabeth Smith (@auroraeosrose) always has direction on work that needs to be done in the community. Dive in, get involved, don’t be a jerk and meet people. Put on a thick skin, watch out for toes, put on your work clothes and get involved.
Tell them I sent you.
Taking advantage of php|tek bringing a lot of people together, we had a PHP developers meeting over 2 days before the conference. Day 1 was dedicated to technical issues in PHP 5 and 6, and day 2 was spent discussing potential features, migration issues, current roadblocks, etc.
The notes from the meeting are available on the wiki. These notes are not necessarily “decisions”, but they do reflect the consensus of the group that was at the meeting and hopefully present a more structured and outlined list of things that we can follow for PHP 5.4/6.
In the past year I've
been working on a book, describing PHP's Date and Time functionality in
great detail. It's now finally out under the name "php|architect's Guide to Date and Time
Programming". Look at the pretty cover! It's actually a
picture I took some months ago from the church in Skien, where I am
still living (more about that in a later post).
The book is devoted on helping you understanding dates and times, as well as how PHP deals with it. It explains how PHP parsers and reads dates and times in strings including possible pitfalls; timezones, their history, the annoyances and how to deal with them properly; formatting and displaying dates and times; and last but not least, how to handle intervals and iterating over time. There is more information on the website where you can also buy this awesome book. And in case you're wondering "what? dates and times are really simple!", then this book is definitely for you.
Rumour is that all attendees of the Dutch PHP Conference will receive a copy with their tickets, if you're asking nicely I might even sign your copy! I'll be there to give a talk on "PHP on the D-BUS" and will show you how to talk to skype, GSM chips and other desktoppy things!
Using different editors during development is not easy. Try to remember the "delete the current line" shortcut:
Notepad++Ctrl+L NetBeansCtrl+E EclipseCtrl+D vimEsc,d,d joeCtrl+Y
By a show of hands, how many people here ever heard of SPL? How many already used it? Chances are most of you didn’t raise your hands, and some might even have a confused look on their faces. Indeed that is the sad reality when it comes to SPL, but What is SPL?
SPL, or Standard PHP Library, is a set of classes and interfaces built in to PHP since version 5.0, and as of PHP 5.3 it cannot even be disabled, so its here and for good. Its actually hard to disable it when compiling, so 9.9 out of 10 changes that you have it. But why have you not used it? The answer begins at “poor documentation” and ends in “didn’t even know it existed”, SPL has not had the “bling” about that it deserves, but this is where this article comes in, time to turn this around. So what is in SPL?
SPL makes available a few hooks for overloading the PHP Engine, such as ArrayAccess, Countable and SeekableIterator interfaces, to make your objects work like arrays. You can also manipulate other stuuf using RecursiveIterator, ArrayObejcts and various other iterators. It even has classes for specific points such as Exceptions, SplObserver, Spltorage and helper functions to overload other aspects, like spl_autoload_register, spl_classes and iterator_apply. Overall its a swiss army knife of code that can be implemented in PHP but that because of its hooks will probably perform much faster in SPL. So, what can i actually do with it then?
Overloading autoloader
You are a by the book programmer, and after __autoload came around you rewrote all your sites and remove the endless stream os includes and requires in your code to make way for lazy loading, right? So once in a while you found yourself in a jam, you product’s classes use a specific naming/directory structure and the Zend Framework classes you use have a “_” to path approach, how do you solve this? Giant __autoload that includes all logic, trial and error style? Alter you directory structure to Zend’s? No! Overload it!
The process is simple, just create your own autoload function and overload it, that way the autoload procedure will run the class through Zend’s loader, if it does not find a class, it will then run yours, and keep on going down the line until one of them finds it.
1 <?php
2
3 class MyLoader{
4 public static function doAutoload($class){
5 //autoload process
6 //use file_exists please
7 }
8 }
9
10 spl_autoload_register( "/>Truncated by Planet PHP, read more at the original (another 19995 bytes)
There is currently a heated debate spawned with the creation and subsequent announcement of a more or less final decision made by a select group of people at php|tek. Now I am a friend of openness, but I have a hard time remembering any significant existing project within the PHP community that actually changed its coding guidelines. For all I know the main CS in the PHP world originated in the Horde project, but adopted and expanded by PEAR, got adopted and expanded by Zend Framework. See the pattern?
Now PEAR is actually trying to do what hasn't been done before, change the CS in an existing community. From being heavily involved in PEAR years ago, I can tell you that all CS discussions on the mailinglist where useless. Of course there are bad CS and there are very good CS decisions. I personally have a few things to say here. But for the most part its about defining a standard and sticking to it. So handing over the bulk of the deciding to the PEAR group (not to be confused with the PHP group that has no real active responsibilities beyond being the copyright holders) was the only sane thing to do. Now they took things one step further and got a bunch more frameworks together. Awesome.
The mistake they made was to publish their findings on a mailinglist on php.net called php standards. It should have been published on the PEAR developer list. Or maybe some new mailinglist, just not one that makes it sound like anything more than a standard to be adopted by the named list of frameworks. Of course they should promote the standard, adjust the standard if needed, but keeping the actual deciding in a small circle again is the only sane approach for this. But making it sound bigger than it actually is, is not the way to go. Let it grow naturally and all will be good.
May has come and gone and for me almost half of it was spent on the road. SFO-DEN-BNA, BNA-ORD, ORD-ZRH-TXL-ZRH-ORD, ORD-SFO. To decipher that for you, I first went to Nashville to visit my friend Raquel and see the land of the honky tonks. I was surprised to find an almost full-sized replica of Parthenon there, as well as a really great ƒood/drink scene. Some highlights include Prince’s Hot Chicken Shack (I dare you to order something more than medium hotness), a great beer place called The Flying Saucer (150+ beers on the menu), and especially The Patterson House (recommended by the awesome Steph Dub), where we spent a few hours snacking on tasty bits from the menu and drinking the awesome cocktails that the bartender mixologists prepared in front of us.
Then it was off to Chicago for php|tek 2009 conference. The first two days were dedicated to the first real PHP developers meet-up since November 2005. On Monday we discussed technical issues with regard to PHP 5.3 and 6, and on Tuesday the topic shifted more towards potential features aside from Unicode to entice people to move to 6 and how to ease this migration. Overall it was a productive meeting and the notes should be posted soon. The next day I gave the opening keynote on the present and future of PHP. I managed to throw in a few inside jokes and funny photos in there to lighten up the morning mood. The rest of the conference was productive as well—there were great talks on everything from utilizing HTTP status codes to multi-level caching to a talk that Cal gave on telecommuting. After the conference hours we stopped by the Map Room a couple times for some excellent beer flights (La Folie on tap, OMG).

@tychay is not happy
After Chicago, I flew to Berlin for the International PHP Conference Spring Edition 2009. This year they accepted all 3 of my proposals, so I had my work cut out for me. Miraculously, I managed to make the German audience smile and even laugh a couple of times during my keynote. Success! The other two talks intl me this, intl me that on localizing and translating your pages, and All the Little Pieces on using PHP with memcached, mogilefs, and Gearman went well too. Funny enough, the RailsWay conference was going on at the same place—didn’t they know that Terry Chay is coming to town?! This was my first visit to Berlin, so Terry and I played tourists for a bit and went to see Checkpoint Charlie, the remaining pieces of the Berlin Wall, Brandenburg Gate, and Reichstag. It is really amazing to consider that the Berlin Wall used to be 150 km long and embedded a piece of Western Germany in the middle of Eastern one.
Finally, I had a long series of flights home, and despite a mishap at the immigration in Chicago, arrived to my apartment safely and almost on time. It was great to see old friends and new faces and to talk to the best development community out there.
For those of you who wondered where to get the I Unicode t-shirt that I wore during my keynote, I put the design up on Zazzle, so you can get your own for the next gathering of the Unicode-minded folks.
A few weeks ago at php|tek, I corralled developers from all of the major PHP frameworks into one of the conferences rooms. The idea was simple: in the PEAR Group we've been discussing our new PEAR2 Coding Standard and have come to some conclusions on how PHP 5.3 code should be handled moving forward. A standard is only a standard if people use it, though, and PEAR is not entirely representative of the community at large.
That's where this group comes in. By having official representatives from PEAR, Agavi, Cake, Solar, and Zend Framework and unofficial representation from Phing and Symfony, we had a good cross section. I went into the meeting with 3 items I wanted to pick off, which were, in order:
I had hoped that we'd make it through the first one, but fully anticipated it taking longer. About 20 minutes into the meeting, we were already moving on to the second item! We flew through the list and were all extremely energized by our productivity. We decided to form an official group of our projects to oversee the creation of this standard and work toward better, more widely adopted standards across our projects.
We also decided to setup a mailing list. Given all of our experience with the proletariat, we decided to make the list moderated. This has proven to be the biggest flash-point so far, drawing criticism from the creator of PHP, himself.
For better, or worst, I stand by my decision to vote for a moderated list. Below is what my vision is. It's my vision and mine alone, but this is where I'm coming from. I posted it earlier this morning to the internal list that we've started to discuss moving these standards forward.
I'd love to see an officially sanctioned standard come out of our work. All of us are too busy, both with real jobs and our various projects, to fight the battles that come of trying to make this a completely open process where anyone with an email address can contribute. Sad as it may be, pear-dev has demonstrated that coding standards *must* go the way of sausages and laws lest they devolve into a constant "but I think <insert favorite coding standard pet peeve> is better, and this is why..." followed by pages of well meaning, but generally irrelevant content.
My reason for wanting a standard is simple, I move among other coding communities in addition to PHP and I am constantly put in a position that I must defend PHP against criticisms that it is unmaintainable, barely useable, and only useful if the least common denominator is your sole concern. Needless to say, I think those are opinions are misguided at best, and patently wrong at worst; but then someone looks at WordPress or phpBB or <insert favorite "I'm amazed it actually runs" project written in PHP> source code and has all their criticisms validated.
As a community, we need to be able to come together and agree on a coding standard. When code is published for public consumption in a year, I would love it if the first comment on blog posts or mailing list messages announcing the new code is "wow, that's great, but you should run it through phpcs." In Python it's not uncommon for pastebin'd code or newly published code to have a response "read pep 8." They aren't trying to be mean or petty, they're just trying to guide someone down the path to good citizenship in the Python community.
Given it's frigid—even hostile in some cases—reception, it does look like having an official coding standard for frameworks and libraries is our best outcome. Hopefully, with the projects in the community we have behind this we'll be able to build up a consensus and prove our decisions the correct ones. If not, then at least we've expanded the number of projects we can easy move between out from our small enclaves to a wider swath of the PHP landscape.
Original post blogged on b2evolution.
Recently I read in AnandTech a good article on Solid State Devices (SSD). It certainly blew away many misconceptions I had about SSD.
From a professional point of view, my main interest would be how databases are affected by the following characteristics of SSD:
From this summary, it appears that the SSD is ideal for relatively static data, and we can selectively put certain parts of the database on SSD. Examples include:
For transaction processing systems it depends on the usage. Assuming the blocks in a table are updated 10,000 times a day, the data distribution of updates is even across all records, and the table fits into 100 512K blocks, then the lifetime of the SSD for those blocks would be 100 days (this might be acceptable if SSD was sufficiently cheap). And even for data warehouse applications with relatively static data, B-tree index rebalancings will cause the frequent rewrites of indexes.
It also appears that operations characterized by sequential writes such as transaction logging should continue to be placed on hard disks.
For some information on potential database performance, see these articles testing SSD with mysql, DB2 and PostgreSQL. Also see Windows 7 Support and Q&A for Solid-State Drives.
Tim O'Reilly talks about how Google bets big on html5. Sadly, without Internet Explorer support, a lot of this talk is moot to me. Not to say that I wouldn't salivate over using the new html5 canvas element. We draw a lot of flow charts graphics and it needs to run on as many browsers as possible. We don't use flash, we use Walter Zorn's excellent jsgraphics library. It's not very fast, but hey, that's why we have multi-gigahertz PCs on our desktops and on our laps.
Recently I read in AnandTech a good article on Solid State Devices (SSD). It certainly blew away many misconceptions I had about SSD.
From a professional point of view, my main interest would be how databases are affected by the following characteristics of SSD:
From this summary, it appears that the SSD is ideal for relatively static data, and we can selectively put certain parts of the database on SSD. Examples include:
For transaction processing systems it depends on the usage. Assuming the blocks in a table are updated 10,000 times a day, the data distribution of updates is even across all records, and the table fits into 100 512K blocks, then the lifetime of the SSD for those blocks would be 100 days (this might be acceptable if SSD was sufficiently cheap). And even for data warehouse applications with relatively static data, B-tree index rebalancings will cause the frequent rewrites of indexes.
It also appears that operations characterized by sequential writes such as transaction logging should continue to be placed on hard disks.
For some information on potential database performance, see these articles testing SSD with mysql, DB2 and PostgreSQL. Also see Windows 7 Support and Q&A for Solid-State Drives.
Here are the slides and sources from my session at the IPC 09 Spring in Berlin.
Recently I read in AnandTech a good article on Solid State Devices (SSD). It certainly blew away many misconceptions I had about SSD.
From a professional point of view, my main interest would be how databases are affected by the following characteristics of SSD:
From this summary, it appears that the SSD is ideal for relatively static data, and we can selectively put certain parts of the database on SSD. Examples include:
For transaction processing systems it depends on the usage. Assuming the blocks in a table are updated 10,000 times a day, the data distribution of updates is even across all records, and the table fits into 100 512K blocks, then the lifetime of the SSD for those blocks would be 100 days (this might be acceptable if SSD was sufficiently cheap). And even for data warehouse applications with relatively static data, B-tree index rebalancings will cause the frequent rewrites of indexes.
It also appears that operations characterized by sequential writes such as transaction logging should continue to be placed on hard disks.
For some information on potential database performance, see these articles testing SSD with mysql, DB2 and PostgreSQL. Also see Windows 7 Support and Q&A for Solid-State Drives.
This year I was abel to attended the 2009 php|tek conference in Chicago. This conference is hosted by MTACon, the company behind php|architect magazine, one of the most influent PHP publications in the world. php|tek is a unique event in its overall “feel” and purpose - for those that read my post on ZendCon’08 you may be able to pickup this difference yourselves. Tek is a community oriented event, as opposed to ZendCon which is much more aimed at companies. Is this good you ask? Yes, its perfect, it in no way falls short of the content in ZendCon, but on the plus side it gives one many more opportunities to mingle and meet the central PHP Core Developer Team, and most importantly, it inspires attendees to work with and give back to PHP.
Same as last year, the conference was held in Chicago, IL in the Unites States at the Sheraton Hotel, a wonderful venue that helps keep everyone close by during the conference and during “off-time”. The conference ran for three days plus a tutorial day - from May 19th to May 22nd. The day before the start one could already see many of the most well known PHP developers arriving - it appeared that the Core team was arriving early to host a PHP Dev meeting held at Microsoft. And the topic of the conference .. ? PHP 5.3.
The sessions were great, and tutorials day featured particularly interesting sessions, of which I attended a security talk to complement my PHP Security skills,as well as a Code Review Session. This session, held by Sebastian Bergamann, Stefan Priebsch and Arne Blankerts was extremely interesting, we dove deep into the code of some major frameworks and apps, like Magento, Wordpress, Habari and found some incredible (not in a good sense) pieces of code. This talk showed me a different side of things especially for certain areas of coding where I can certainly do better. It also gave me a new perspective on code reviews, which have today a much bigger importance then before.
The rest of the sessions during the event were really good, some were inspiring (Security Centered Design), some made you wish PHP 5.3 was out (PHP 5.3 - Hot or not?), some made incredible associations to drive home the importance of a good development environment (The Knight Rider Methodology to Software Development), some showcased the more obscure but very useful parts of PHP (SPL to the Rescue), some even tried to point you in a good direction (Untestable Code). There really were sessions for every kind of developer, from the “regular joe” to the php expert - at times I wished I had the method __clone implemented on myself, so I could get to all sessions. Also, alongside the event we had great UnCon Sessions and an Hackathon organized and led on by the community, with some simple but great sessions.
This leads me to the biggest feature of php|tek, and one most commonly overlooked by developers and managers alike, namely the community. This was by far the biggest difference from ZendCon, a total focus on the community and hence, a focus on geting everyone active. The PHP comunity has been in focus during the last few months. Since the news of PHP 5.3 was released we have seen an increase in activity inside the PHP community: BugHuntDays, TestFest09, documentation, patches, you name it the community has done it this year. User Groups keep growing and popping up everywhere. Just in Brazil we have had at least 5 groups started since last year. The conference fosters the
The recipe for success in this sense is not clear, was it the community oriented sessions (A guide to using and understanding the community, User Group Meetup)? The after-hour programming (PechaKucha night, Retro Gaming Night, Hackathon)? Maybe it was the breakfasts and lunches where you shared tables with all the active members of the community? The discussions around a cup of wine? I’m guessing it was a combination of all this, the sheer exposion to all this is enough to get you into the “giving back” mood. The ingredients are pretty simple, knowing where you can help, who to ask, where to read about it and a touch of “karma”. Many moments at tek were based on this, the interaction with great names of the community and a clear picture of what PHP needs. The whole experience shows you clearly that not Zend, ibuildings, IBM or Microsoft are in t
Truncated by Planet PHP, read more at the original (another 5056 bytes)
Recently I read in AnandTech a good article on Solid State Devices (SSD). It certainly blew away many misconceptions I had about SSD.
From a profession point of view, my main interest would be how databases are affected by the following characteristics of SSD:
From this summary, it appears that the SSD is ideal for relatively static data, and we can selectively put certain parts of the database on SSD. Examples include:
For transaction processing systems it depends on the usage. Assuming the blocks in a table are updated 10,000 times a day, the data distribution of updates is even across all records, and the table fits into 100 512K blocks, then the lifetime of the SSD for those blocks would be 100 days (this might be acceptable if SSD was sufficiently cheap). And even for data warehouse applications with relatively static data, B-tree index rebalancings will cause the frequent rewrites of indexes.
It also appears that operations characterized by sequential writes such as transaction logging should continue to be placed on hard disks.
For some information on potential database performance, see these articles testing SSD with mysql, DB2 and PostgreSQL. Also see Windows 7 Support and Q&A for Solid-State Drives.
Recently I read in AnandTech a good article on Solid State Devices (SSD). It certainly blew away many misconceptions I had about SSD.
From a profession point of view, my main interest would be how databases are affected by the following characteristics of SSD:
From this summary, it appears that the SSD is ideal for relatively static data, and we can selectively put certain parts of the database on SSD. Examples include:
For transaction processing systems it depends on the usage. Assuming the blocks in a table are updated 10,000 times a day, the data distribution of updates is even across all records, and the table fits into 100 512K blocks, then the lifetime of the SSD for those blocks would be 100 days (this might be acceptable if SSD was sufficiently cheap). And even for data warehouse applications with relatively static data, B-tree index rebalancings will cause the frequent rewrites of indexes.
It also appears that operations characterized by sequential writes such as transaction logging should continue to be placed on hard disks.
For some information on potential database performance, see these articles testing SSD with mysql, hDB2 and PostgreSQL. Also see Windows 7 Support and Q&A for Solid-State Drives.
Some very interesting developments in desktop wiki land: Tomboy, the popular note-taking application for GNOME and OS X now supports web synchronization.
The developers of Tomboy have launched Snowy, a web service that allows you to synchronize and access your notes online. As the API is documented, I decided to add support for it in Midgard too. This way the Tomboy notes will become regular objects in the content repository.
At the moment there is only the sync service, provided as a component for the MidCOM3 MVC framework. However, a web user interface will also be coming soon. Here's how synchronization with Midgard looks like:
In addition to Tomboy, the Mozilla/Maemo Danish Weekend also showed new advances in mobile Midgard2 land: We launched a Midgardized version of Conboy, the maemo port of Tomboy. Both Midgard2 and Conboy were also built for Fremantle and tested on a developer preview machine. Very promising!
With the Midgard storage back-end Conboy will gain all the regular benefits of using a content repository:
While there are plans to add web synchronization to next release of Conboy, the Midgard version will also be able to synchronize via XMPP in true peer-to-peer fashion.
Technorati Tags: midgard
I have been working on some really fun PHP projects with some really cool people the last six months. This has kept me busy both day and night so, naturally, blogging have not been a major priority. After creating a new Spanish photo sharing site fotos.es which took a few months we started on a Swedish project. And now, we are finally launching the best Swedish weather site, klart.se. As weather is what Swedish people talk about whenever they meet, a quality Swedish weather site is needed
Even though all the project members are located in many different locations in both Sweden and Spain most things have gone really well.
After having been in Spain for the last six months it looks like it’s time to move on. In a few weeks we’re probably moving to Kalmar, Sweden. We haven’t lived in those parts since we moved to Dublin in 2000 and even though I really enjoyed my time here in Spain I am a looking forward to moving back home.
I just released v0.8 of the SabreDAV library. This is mostly a bugfix release, and fixes some compatibility problems with both Windows Vista and adds support for Netdrive.
Netdrive is free for home-use and is an alternative for the built-in clients from Windows XP or Vista. Do not use it if it's more than 1 person accessing data from a webdav share, I can not stress this enough.. If it's just you, you'll find it works much smoother than the built-in client.
Compatibility breakAll exception classnames are renamed. They follow Sabre_DAV_Exception_FileNotFound, instead of the Sabre_DAV_FileNotFoundException convention. This change was made for consistency reasons. If you implemented anything custom, you will probably run into this while upgrading.
Download and the full changeLog.
FutureIt's pretty close to being feature-complete, so unless I really missed something or more bugs will be found this will probably move quickly towards 1.0. Thanks for the support and using it!
Since part one and two were uber-successful, here's an update on my Zend Framework PHP performance situation. I've also had this post sitting around since beginning of May and I figured if I don't post it now, I never will.
Disclaimer: All numbers (aka pseudo benchmarks) were not taken on a full moon and are (of course) very relative to our server hardware (e.g. DELL 1950, 8 GB RAM) and environment. The application we run is Zend Framework-based and currently handles between 150,000 and 200,000 visitors per day.
Why switch at all?In January of this year (2009), we started investigating the 2.2 branch of the Apache webserver. Because we used Apache 1.3 for forever, we never had the need to upgrade to Apache 2.0, or 2.2. After all, you're probably familiar with the don't fix it, if it's not broken-approach.
Late last year we ran into a couple (maybe) rather FreeBSD-specific issues with PHP and its opcode cache APC. I am by no means an expert on the entire situation, but from reading mailing lists and investigating on the server, this seemed to be expected behavior — in a nutshell: Apache 1.3 and a large opcode cache on a newer versions of FreeBSD (7) were bound to fail with larger amounts of traffic.
We tried bumping up a few settings (pv entries), but we just ran into the same issue again and again.
Because the architecture of Apache 2.2 and 1.3 is so different from one another (and upgrading to 2.2 was the proposed solution), I went on to explore this upgrade to Apache 2.2. And once I completed the switch to Apache 2.2, my issues went away.
So far, so good!
Performance?On the performance side we experienced rather mediocre results.
While we benched that a static file could be read at around 300 requests per second (that is a pretty standard Apache 2.2 install, sans a couple unnecessary modules), PHP (mod_php) performed at a fraction of that, averaging between 20 and 23 requests per second.
Before some people yell at me for trying to optimize my web server, one needs to take the costs of scaling (to a 100 requests per seconds) into account.
One of those servers currently runs at 2,600.00 USD. The price tag adds up to an additional 10,400.00 USD in order to scale to a 100 (lousy) requests per seconds. Chances are of course, that the hardware is slightly less expensive since DELL gives great rebates — but the 8 GB of (server) RAM and the SAS disks by themselves are melting budgets away.
And on top of all hardware costs, you need add setup, maintenance and running costs (rack space, electricity) for an additional four servers — suddenly, developer time is cheap. ;-)
So what do we do? Nginx to the rescue?!
Publishing and Sharing Content
The user has the right to publicize or not to publicize their own contents. By publicizing the Contents, the user acknowledges and agrees that anyone using this Web site can and may use the Contents without restrictions.
From time to time, publicized Contents can be used by ThinkFree at its own discretion.
In addition, the user can allow a specified user to access and collaborate on user-created Contents. ThinkFree is not responsible for any problems arising from users sharing or publishing Contents.
We've just successfully wrapped up another edition of php|tek. Yet again, I was reminded of the significance of bringing together PHP developers, core dev members, and those in industry and related technologies. Our conferences are always a lot of fun-- we work hard and play hard, and we hope everyone comes away with something besides a postcard that says "wish you were here!" or a t-shirt from Shoeless Joe's.
I won't bore you with the tales of "Geeks Gone Wild" or recap the speakers' presentations; for all that, you can check out the 800+ pics on Flickr and the slides on Slideshare. You can also read other people's wrap-ups if you're really interested.
For those who weren't there (or those who were, but missed out), we at MTA made a few surprise announcements:
I also wanted to mention some of the things that happened in the "Hallway Track" as we call it; that time between times when cool things arise out of nowhere: unplanned, unscheduled, and off-the-cuff.
The second conference day started with a meeting with quite a few people from the PHP frameworks world, on introducing certain advised standards for PHP libraries and frameworks. These standards should make it easier for people to include and use libraries. We had a great 2-hour discussion on namespaces and naming, exception naming and handling, and some slightly related off-topic discussions. All in all, a great meeting, which resulted in the start of a new PHP mailinglist.I'm very interested to see what comes of this, and I think it's great they got the ball rolling!
Other interesting things that were going on during the conference:
Truncated by Planet PHP, read more at the original (another 1358 bytes)
Zend Framework poster - DIN A0. A must have for developers.
Mayflower loves Zend Framework. If we have the choice, we choose the Zend Framework (otherwise, we choose the framework the customer uses). For this reason, we compiled a big poster giving an overview about the most common used components of Zend Framework and distributed it via International PHP Conference and soon PHP Magazin. Currently, the poster is in German. We're working on an English translation which should be available soon in the next days. If you'd like to have one, just drop me an e-mail - we'll send you one. Oh, we're just working on having the poster at one of the online shops so that everyone can get his own Zend Framework poster!
Zend Framework has, like other frameworks, its advantages and disadvantages. However we think that it will be one of the upcoming industry standards that leverage speed and easyness in PHP development. For years, Mayflower has been a big fan of Zend Framework, working with it since V0.9 in its early days. As always, we're customer minded, that means if a customer prefers other frameworks like Symfony, PEAR, eZ components and the like, we're happy to go with. But we just believe that Zend Framework will be spearheading the OpenSource PHP framework world.
Picture at [www.flickr.com] - argentinian asado. We love this country!
When it's summer, it's likely that you go out with friends having a barbecue or drinking some cocktails while having fun meeting those people you're mostly communicating with virtually. A good friend of Mayflower, Ulf Wendel, came up with the idea of a PHP BBQ tour - getting in touch with various PHP Usergroups in Germany. For all those people who like meat and gathering with the local PHP crowd, we can really recommend the PHP BBQ tour. At the wiki page on forge.mysql.com you can see the tour dates.
Of course, some of the Mayflower crowd will join in. Johann-Peter Hartmann is the local contact for the PHP BBQ tour on June, 15th at Munich (scheduled location Hirschgarten). Björn Schotte will join the tour and attend the PHP BBQ tour at Berlin on invitation of the local user group. We expect having a lot of fun and would be happy if you would join the tour, too.
Pierre Fauconnier has set up a new distribution of PHP-GTK 2 for Windows, and a site to match on SourceForge, under the moniker PiGii
You can find this distro at http://pigii.sourceforge.net/
#define MYSQLND_INC_GLOBAL_STATISTIC(statistic) \
{ \
if (MYSQLND_G(collect_statistics) && statistic != STAT_LAST) { \
mysqlnd_global_stats->values[statistic]++; \
} \
}
I usually don't make this mistake, but in this particular case I did. Can you spot it?
This week is the Interactive Knowledge project general assembly and requirements gathering workshop in Salzburg, Austria.
My notes from the meeting days can be found on Qaiku:
As things are happening, it is also possible to follow progress on the #iks-project Qaiku channel or the #iks-project Twitter hashtag.
Technorati Tags: iks-project, semanticweb
Truncated by Planet PHP, read more at the original (another 2435 bytes)
Recently I’ve been focusing on MySQL replication for a project at work. On this particular project, I’m acting in a Solutions Architect role and have been since about September of 2008.
Because of my background in systems administration, I tend to get myself into situations where I become the Schematic-side sys admin on projects. This involves things like deployment processes, getting development, staging, and production environments setup, and now, setting up MySQL replication. This is probably because a) I’m probably bad at delegating these things to others, b) I’m kinda’ good at it, and c) let’s be honest, I’m a control freak, so I like knowing the servers hosting my apps are setup in a meticulous manner.
In short, we’re running MySQL 5.0.45 on RedHat Enterprise Linux 5 (I know, I know…RedHat and MySQL 5.0…boo…but it’s okay). We’re required to replicate our production database to a secondary machine for backup purposes. This way, if our production server dies, we can manually failover to the slave (once we enable writes to it, of course), then swap the two back once the production server is back up.
All in all, this site is rather low-traffic at around 20,000 dynamic page views per day. Factoring in US-based users in an 11 hour time period, that’s about 1,800 request per hour, or right around 0.5 page views per second. We’ve got a single server in production that’s acting as our webserver and database server; it’s got a RAID array in it that was all setup by the group hosting the application (so I don’t know tons about it, but it’s new, quality hardware).
I’m using my master database for reads and writes in Production. Again, the slave is really only required for live backup-type purposes.
Now, I’m no expert on MySQL replication, but I’ve learned a lot these past few weeks. So I’m going to share one big caveat here. Please correct me as you see fit!
MySQL’s got a sync_binlog configuration option. You typically set it in my.cnf, and its value is an integer from 0-n. This value determines how many binary log writes need to occur before its contents are flushed out of the buffer and onto disk. With it set to zero, your operating system just determines when the buffer is flushed to disk.
I have a database migration process that copies table structures and their data from PostgreSQL into MySQL, then basically migrates that data into the appropriate tables in the new MySQL instance. It involves the transformation of a lot of data. It’s a sizable, complete data set for 8+ year old system that’s not the prettiest, best normalized data model in the world.
Per recommendations in High Performance MySQL, I had my sync_binlog value set to 1 in Production.
When I was performing a test migration to Production recently, the process took about 3 hours. Wow. Thanks, MySQL! It normally takes about 90 minutes in Staging, if that.
In digging around Google and MySQL.com, I found that a non-zero value for sync_binlog causes more disk seeks to flush the binary log to disk. The benefit of having it set to 1 is so that every transaction can be written to the binary log, which is then flushed to disk upon commit. Then, if your server happens to die, the last completed transaction will always be present in the binary log on disk, so you never have to worry about, say, missing a transaction replay on your slaves. However, this results in a lot more disk activity on your master.
I set sync_binlog to 0 and re-ran my migration. It ran in 90 minutes — that’s a 50% performance gain! Now, if you do the math, this makes sense. It’s one less disk seek and write per-transaction, so this result totally makes sense. Hooray for numbers, right?
I’m willing to gamble the integrity of data on my slave for the 50% performance increase. (remind me of this post in 6 months when I’m kicking myself over this for some reason, okay?)
With no binary logging enabled (i.e. in our dev environment), this process takes about 20 minutes. This makes sense — far less disk writes during the process.
Another way to workaround this
Truncated by Planet PHP, read more at the original (another 1796 bytes)
IPC in Berlin is still in progress and I feel a bit wasted after too much alcohol during the last two days. I think I need a holiday to recover.
For the ones interested - yesterday I had my talk about Architecture in Web Development - and here are the slides. Seems like slideshare ruined the layout when converting - sorry - you have to live with that. The slides probably won’t be of much help if you did not attend the talk. Anyway - here we go:
Why Architecture in Web Development matters View more PDF documents from dodgeris.


I just realized I've been blogging for 3 years now, so it's time for my annual meta-blogging post :).
I've managed to come up with 50 mildly interesting topics since the 2 year mark, so that's pretty close to a 1 post per week average. Not bad, but a drop of 4 posts since the last.
Thanks very much for reading, I'm always really happy to see people linking or dropping comments, if there's any improvements I can make in my writing definitely let me know.
Since the Sun acquisition was announced I continue to get questions on how it will impact MySQL. This seems to be mainly as a result of the close affinity between PHP and MySQL. I must admit that while I had a lot of immediate thoughts when the IBM/Sun rumor was floating around, I have had a bit of a harder time figuring out what the Oracle/Sun acquisition means for the various pieces of Sun's business including MySQL.
Like many I believe that Oracle would not want to kill MySQL and that steering it more towards the SQL Server market as opposed to Oracle DB could make a lot of sense for Oracle. After all, MySQL definitely competes with SQL Server on ease-of-use and some of the mainstream relational DB features, while for the very high-end features, Oracle is still way ahead (Real Application Clusters, Database Resident Connection Pooling, Backup & Recovery, Data Mining, OLAP). But what will it take to steer MySQL towards SQL Server? Invest in better Windows packaging? Improve performance on Windows? Invest in native management UIs? Build a strong Visual Studio plug-in for MySQL? Make .NET-based applications like Dotnetnuke work better with MySQL? I think it means all of the above and probably some additions I didn’t think of. All that said, I have now changed my mind and believe this is not where the big opportunity lies for Oracle although I see it as a strong secondary strategy and believe Oracle is likely to benefit from executing in this direction regardless.
The other assumption I heard from many was that MySQL would be the entry version for Oracle into accounts. But how would that work in real life? Would they over time build Oracle API (OCI) compatibility into MySQL and hope that at some point people will install Oracle, migrate their data from MySQL to Oracle, and rewrite their applications to access Oracle instead of MySQL? This does make some good sense for Oracle especially as it’d give them a chance to build mindshare and awareness among developers for the their brand. However, brand awareness and account foot print is not enough and I believe this simplistic view does not take into account the user experience. For the user there would be too many challenges in having to swap out the database with a new one, do the data migration and port the application from MySQL to Oracle APIs. In fact, it could be such a pain that users would likely prefer to invest time in working around the MySQL limitations at the application layer instead of doing a migration especially if they are in a time sensitive situation (which MySQL users have been doing successfully for years).
A few days ago I finally figured out what I would do if I were Oracle. I would go out and build an Oracle storage engine for MySQL similar to the DB2 for i storage engine MySQL developed with IBM.(http://solutions.mysql.com/engines/ibm_db2_storage_engine.html) Just think of it as using MySQL as a front-end to Oracle and immediately leveraging the eco-system of developers, applications and tools that support MySQL (see Diagram 1 below). I would then continue to push MySQL’s adoption as much as possible and build out the features that will continue to drive broad adoption.
At this point MySQL would tie directly into Oracle and immediately when a customer needs an Enterprise-grade features like clustering, hot-backup, BI, etc. they could just sell their “Oracle DB Infrastructure” which would support MySQL via the Oracle storage engine. The result would be that without changing any application code you would immediately tie into Oracle and then start leveraging some of Oracle’s unique capabilities.
Of course once that happens, Oracle sells another Oracle license, the data sits in Oracle (typically that means it never migrates anywhere else) and over time other applications will likely leverage this data either via the MySQL interface or directly via OCI (Oracle Client Interface).
What is there left to do for Oracle? No need to focus on investing in Enterprise-grade features for MySQL. They just need to make sure that there’s