• Search:



Planet eZ publish




ez publish community gateway

› eZ Publish Community Project 2014.03 freshly built

Dear all, we are delighted to bring you the latest, the most beautiful, the most solid, the shiniest build of eZ Publish Community Project: 2014.03! Read on for more details.

 
18/04/2014 4:50 pm (UTC)   http://share.ez.no   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans

› Walking the London LOOP - part 7 and 8

Walking the London LOOP - part 7 and 8

Section 8

After lunch we came through Bourne Hall Park where section 7 ends and section 8 starts. With 7 being so short, there was plenty of time to also finish section 8.

loop8-d36_5140.jpg

The start of section 8 is also the source of the Hogsmill river. And the whole route of section 8 tries to follow the river as closely as possible. In some places that was not really possible so we had some diversions through residential areas, and slightly smellier, through the Hogsmill Valley Sewage Treatment Works. But most of it, was pleasent walking past the river.

loop8-d36_5151.jpg

Near the end we came to Kingston-Upon-Thames were it was again a bit trickier to follow the river.

loop8-d36_5157.jpg

With the weather being so nice, we had to stop for a few pints at the end of the walk, at two of Kingston's river side pubs, the Bishop and the Gazebo next door!

The weather was again very good, with 16-18°C and no clouds to be seen. We took just over four hours for the two sections that together were 20.3km long.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

17/04/2014 10:29 am (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

ez publish community gateway

› Community Project Board meeting minutes - April 14

Here are the minutes of the 46 Community Project Board meeting. Our previous minutes can be found here. Minutes for meeting 44 and 45 included.

16/04/2014 8:52 am (UTC)   http://share.ez.no   View entry   Digg!  digg it!   del.icio.us  del.icio.us

ez publish community gateway

› PHP and eZ Publish Summer Camp: Call for workshops and sponsors

One month ago we announced a double event: the 3rd eZ Publish Summer Camp and the 1st PHP Summer Camp. Today we released some more information on each web site and are calling PHP, Symfony and eZ Publish gurus to send us proposals for workshops. There is anopportunity for interested companies and organisations to sponsor the events as well.

15/04/2014 1:57 pm (UTC)   http://share.ez.no   View entry   Digg!  digg it!   del.icio.us  del.icio.us

netgen

› Going mainstream with PHP and eZ Publish Summer Camp: Call for workshops and sponsors

One month ago we announced a double event: the 3rd eZ Publish Summer Camp and the 1st PHP Summer Camp. Today we released some more information on each web site and are calling PHP, Symfony and eZ Publish gurus to send us proposals for workshops. There is an opportunity for interested companies and organisations to sponsor the events as well.

15/04/2014 1:25 pm (UTC)   http://www.netgenlabs.com/Blog   View entry   Digg!  digg it!   del.icio.us  del.icio.us

netgen

› Symfony2 MVC - part 2: Controller

In our first blog post in the Symfony2 MVC series we covered the concept of the Model part in Symfony2 MVC, using a simple example of a model implemented with Doctrine ORM. In this blog post, we will focus on the Controller part, where we will create a simple controller class implementing the basic create/update/delete operations on the model from the previous blog post. We will also cover the basics of mapping a specific controller action to a URL path using the Symfony2 routing mechanism.

10/04/2014 2:20 pm (UTC)   http://www.netgenlabs.com/Blog   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans

› Cursors and the Aggregation Framework

Cursors and the Aggregation Framework

With MongoDB 2.6 about to be released, the PHP driver for MongoDB has also seen many updates to support the features in the new MongoDB release. In this series of articles, I will illustrate some of those.

In this article, I will introduce command cursors and demonstrate how they can be applied to aggregations. I previously wrote about the Aggregation Framework last year, but since then it has received a lot of updates and improvements. One of those improvements relates to how the Aggregation Framework (A/F) returns results. Before MongoDB 2.6, the A/F could only return one document, with all the results stored under the results key:

demo->cities;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $c->aggregate( $pipeline );
var_dump( $r['result'] );
?>

This code would output something like:

array(242) {
  [0] =>
  array(2) {
     '_id' => string(2) "AD"
     'timezones' => array(1) { [0] => string(14) "Europe/Andorra" }
  }
  [1] =>
  array(2) {
     '_id' => string(2) "AE"
     'timezones' => array(1) { [0] => string(10) "Asia/Dubai" }
  }
  [2] =>
  array(2) {
     '_id' => string(2) "AF"
     'timezones' => array(1) { [0] => string(10) "Asia/Kabul" }
  }
  …

MongoCollection::aggregate() is implemented under the hood as a database command. The method in the PHP driver merely wraps this, but you can also call A/F through the MongoDB::command() method:

demo;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $d->command( [
     'aggregate' => 'cities',
     'pipeline' => $pipeline,
] );
var_dump( $r['result'] );
?>

Because a database command only returns one document, the result is limited to a maximum of 16MB. This is not a problem for my example, but it can can certainly be a limiting factor for other A/F queries.

MongoDB 2.6 adds support for returning a cursor for an aggregation command. With the raw command interface, you simply add the extra cursor element:

$r = $d->command( [
     'aggregate' => 'cities',
     'pipeline' => $pipeline,
     'cursor' => [ 'batchSize' => 1 ],
] );
var_dump( $r );

Instead of a document with all results inline, you get a cursor definition back:

array(2) {
  'cursor' =>
  array(3) {
     'id' => class MongoInt64#5 (1) {
          public $value => string(12) "392201189815"
     }
     'ns' => string(11) "demo.cities"
     'firstBatch' => array(1) {
       [0] =>
       array(2) {
          '_id' => string(2) "AD"
          'timezones' => array(1) { [0] => string(14) "Europe/Andorra" }
       }
     }
  }
  'ok' => double(1)
}

The cursor definition contains the cursor ID (in id), the namespace (ns), and whether the command succeeded (in ok). The definition also a portion of the results. The number of items in firstBatch is configured by the value given to batchSize in the command.

To create a cursor that you can iterate over in PHP, you need to convert this cursor definition to a MongoCommandCursor object. You can do that with the MongoCommandCursor::createFromDocument() factory method. This factory method takes three arguments: the MongoClient object ($m in my example), the connection hash, and the cursor definition that was returned. The hash is required so that we can fetch new results from the same connection that executed the original command.

To obtain the connection hash, we need to include a by-ref variable as the third argument to MongoCollection::command():

demo;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $d->command(
     [
          'aggregate' => 'cities',
          'pipeline' => $pipeline,
          'cursor' => [ 'batchSize' => 1 ],
     ],
     null,
     $hash
);
var_dump( $hash );

The hash looks like localhost:27017;-;.;26415. Together with the result, you can now construct a MongoCommandCursor:

$cursor = MongoCommandCursor::createFromDocument( $m, $hash, $r );

And iterate over it:

foreach ( $cursor as $result )
{
     echo $result['_id'], ': ', join( ', ', $result['timezones'] ), "\n";
}
?>

As this is all a bit cumbersome, we have also added a helper method for this: MongoCollection::aggregateCursor. This internally does the whole MongoCommandCursor creation dance, and simplifies the previous example to:

demo->cities;

$pipeline = [
     [ '$group' => [
          '_id' => '$country_code',
          'timezones' => [ '$addToSet' => '$timezone' ]
     ] ],
     [ '$sort' => [ '_id' => 1 ] ],
];

$r = $c->aggregateCursor( $pipeline );

foreach ( $r as $result )
{
     echo $result['_id'], ': ', join( ', ', $result['timezones'] ), "\n";
}
?>

This helper also automatically sets the initial batch size to 101. You can change the batchSize for subsequent batches by using the MongoCommandCursor::batchSize() method, and for the initial batch by specifying an option to MongoCollection::aggregateCursor:

$options = [ 'cursor' => [ 'batchSize' => 5 ] ];

$r = $d->cities->aggregateCursor( $pipeline, $options );
$r->batchSize( 25 );

In general, you probably should not change the default batch sizes.

The Aggregation Framework has some other new features in MongoDB 2.6 as well. Please refer to the release notes for more information. I might write another post on some of those features later, too.

09/04/2014 10:29 am (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

ez projects

› Netgen Class List Datatype released

First version of Netgen Class List Datatype is released.

This datatype allows you to maintain a selection of content classes in your content object to be used in your code.

The extension is published under GNU GPLv2 license and the source code is available on GitHub.

07/04/2014 9:59 am (UTC)   eZ Projects   View entry   Digg!  digg it!   del.icio.us  del.icio.us

derick rethans

› Walking the London LOOP - part 5 and 6

Walking the London LOOP - part 5 and 6

Section 5

While waking up we already knew this would be a glorious day. Blue skies with no clouds in sight. The moment I got out of the house I knew I was not going to need my coat either. Getting to Hamsey Green, the start of section 5 was a bit more of a chore than normally. It involved two tube trains to Victoria, a train to West Croydon and then another bus ride down the road to Ken's Auto at Hamsey Green.

loop5-d36_4980.jpg

After a short section next to a road, we entered Riddlesdown. With mostly open fields and a bit of woodland we made it down into the next valley, coming past a disused quarry. We only really noticed the quarry once we made it over a bridge across some railroad tracks and up a fairly steep path up the hill on the other side of the valley.

loop5-d36_4992.jpg

After some steps, and some more steep uphill part we came to Kenley Common, a now open space that used to be farmland, as a swap for the Kenley Aerodrome that the RAF seconded during the second World War. We made a few wrong turns on Kenley Common and there were a few slightly useless fences. Passing through some woods and a field with gliders overhead, we "suddenly" found ourselves at the Wattenden Arms, a pub displaying much WWII memorabilia from the Kenley Aerodrome. The friendly staff served a decent pint, and after refreshing ourselves we continued the walk.

After climbing our first style we were overtaken by another LOOP walker as we passed by the Kenley Observatory and a friendly horse. For a bit we had to walk past a road without footpath or pavement.

loop5-d36_5007.jpg

After that we passed by a field with a sole postbox and then made our way to Happy Valley. With the Sun blazing and everything looking greener that it probably was we descended into the valley and back out on the other end. The signing of the LOOP was a bit confusing so I don't think we followed the route correctly, but we picked up the walk again just shy of the next common, Farthing Downs.

This part of the walk was over a hill crest with the skyline of London in the far background. The section ended with a slight downhill into Coulsdon were we stopped for some refreshments—most importantly cake—at the Poppy Cafe. Because the weather was so nice, we decided to continue with the following section as well, section 6.

Section 6

loop6-d36_5021.jpg

Passing through South Coulsdon station we had a long climb up a residential road before we continued on a bridleway. With a long section through some woods and farmland around, a slight detour around a road without pavement, we came upon the Mayfield Lavender Fields. Sadly, we were too early to see it all in bloom, but there was most definitely already a hint of purple to be seen.

loop6-d36_5052.jpg

We then walked through Oak's Park, after which there was another long straight section on the edge of Surrey that took us past HMP Highdown. Luckily most of it was hidden by hedges and trees. The last part of this much shorter section took us to the Banstead Downs and over the Banstead Downs Golf Club to the end of the walk. From there it was a short link to Banstead, where we luckily only had to wait 20 minutes for the train—there is only a service every hour.

Where section 5 was mostly known for its up and downs, section 6 was the "horse" section. Lots of bridleways and horses around.

The weather was very good, with 16-18°C and no clouds to be seen. We took nearly four and a half hours for the two sections that together were 19.4km long.

The photos that I took on this section, as well as the photos of the other sections of the LOOP, are available as a Flickr set.

01/04/2014 10:11 am (UTC)   Derick Rethans   View entry   Digg!  digg it!   del.icio.us  del.icio.us

netgen

› A few Smashing days in Oxford

Ever since Vitaly Friedman (@smashingmag) announced that last years’ Frieburg event is to be reenacted, and the speakers lineup started to form, it was clear the event would be, pun intended, smashing. The lovely city of Oxford was chosen for the venue so it was even harder to say no to such a chance to learn and meet.

31/03/2014 6:29 pm (UTC)   http://www.netgenlabs.com/Blog   View entry   Digg!  digg it!   del.icio.us  del.icio.us