Archive

Archive for the ‘Zend_Amf’ Category

10X Zend Amf Performance enhancements — please test!

January 18th, 2010

Mark Reidenbach from everytruckjob.com has submitted a awesome patch for Zend Amf that creates a huge performance increase. Thanks so much Mark! I have also added a reference check optimization that uses SPL_object_hash to quickly see if an object has been seen before or not. Overall you should see a big performance increase. The test case I used was the James Ward’s census data from my ZendCon talk which consists of random people objects ranging from 1 – 100 duplicates totaling 5k total rows.  Xdebug profiling analyzed by  KCacheGrind showed roughly a 10X increase in performance!

The question is did all of these changes introduce any bugs? I have not been able to find anything and all of the tests pass. However with such a major change I would really appreciate you downloading the attached file and overwriting Zend/Amf/* with it’s contents. Please report any issues in the comments here or better yet on the actual bug ZF-7493 If all goes well we will try and get this into the 1.10 release.

Amf_performace.zip

Flash Platform, Zend_Amf

Zend Con 2009 session files

October 21st, 2009

Zend Con ‘09 has already been a great event. If your not here you need to come in 2010! Attached are the files for my Zend Amf talk on Advanced Data Communication with the Flash Platform

Session Files

Here are all the resources too!

Zend AMF Downloads
http://framework.zend.com/download/amf

Adobe Flash Builder 4 beta 2
http://labs.adobe.com/technologies/flashbuilder4/

New PHP Features in Flash Builder 4 – Part 1: Data-Centric Feature Overview
http://ria.dzone.com/articles/new-php-features-flash-builder

New PHP Features in Flash Builder 4 – Part 2: Using Zend AMF and Flash Remoting
http://ria.dzone.com/articles/new-php-features-flash-builder-2

James Ward Census
http://www.jamesward.com/blog/2007/04/30/ajax-and-flex-data-loading-benchmarks/

ActionScript 3, Flash Platform, Speaking, Zend_Amf

ZF 1.8.4 breaks addDirectory()

June 27th, 2009

Looks like a bug was introduced in 1.8.4 that breaks class loading from the addDiretory() method. If  you use require_once with setClass or just use the 1.8.3 Zend_Amf_Server class file it will work. Unfortunitly I didn’t write the affected change but hope to have

=== Update July 1st 2009 ===

For some reason in 1.8.4 package there’s an old version of Zend/Loader/PluginLoader.php.

Take the new one here:

http://framework.zend.com/svn/framework/standard/branches/release-1.8/library/Zend/Loader/PluginLoader.php

It should work with it and the Zend Framework team is going to patch the 1.8.4 release on June 2nd to resolve this release issue.

== Update July 7th 2009 ==

http://devzone.zend.com/article/4808-Zend-Framework-1.8.4pl1-Now-Available

This patch-level version corrects a missing patch for Zend_Loader_PluginLoader that provided some critical functionality for Zend_Amf users. If you utilize that component, you are encouraged to upgrade immediately; for all other uses, the release tarball remains the same as the 1.8.4 version, and upgrading is left to your discretion.

Flash Platform, Zend_Amf

Major Zend Amf updates for 1.8.4 release

June 23rd, 2009

Lots of changes made to Zend Amf made there way into Zend Frameworks next mini release for 1.8.4. I thought that I would run through the major changes. Special thanks to Stefan Klug for all of the patches that he produced! Absolutely grateful sir! This is probably the biggest update to the system since the first release. Please make sure that you test 1.8.4 before you push it into your production environment. Why? Well if your like me you probably built a couple work arounds for some of these bugs. Those work arounds may no longer work once the bug is fixed!

Major Changes

ZF-6641 Shared references are duplicated
ZF-6205 Serializer does not support cyclic references
ZF-6393 Wrong Amf0_Amf3 reference counting
ZF-5382 Multiple calls seems to break the deserializer.
ZF-6625 Zend Amf can load any instantiated PHP class. Security

Minor but significant changes

ZF-6975
Adobe Flash Builder 4 wizard now supports data types for introspection.
ZF-6992 Negative integers on 64 bit system is resolved.
ZF-6775 Unable to send Array’s from Blaze DS.

The 1.8.4 release has already been tagged and should come out sometime today 6/23/2009

AMFPHP, Flash Platform, Zend_Amf

ArrayCollection beta update in Zend Amf: thoughts?

June 15th, 2009

I started working on a project this week that extensively uses ArrayCollection’s and I found that ZendAmf could use a couple additions in order to have some utilities for working with ArrayCollections in PHP. The new feature relies heavily on PHP’s SPL and specifically Countable, ArrayAccess, and IteratorAggregate all of which require PHP 5.2.3 or greater.

The following file can be added to your Zend Amf project to play with some of these features. Please let me know if there is anything else that I should add before it is added in the next release. Please post feedback to the blog or directly to the Zend Framework feature request.

Alpha Zend_Amf_Value_Messaging_ArrayCollection

To create an ArrayCollection

$this->_data[] = array('foo' => 'foo1', 'bar' => 'bar1');
$this->_data[] = array('foo' => 'foo2', 'bar' => 'bar2');
$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollectionTwo($this->_data);

To Create an ArrayCollection from a Zend_Db_Table_row

$table = new Bugs();

$select = $table->select();
$select->where('bug_status = ?', 'NEW');

$rows = $table->fetchAll($select);
$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollectionTwo($rows);

To alter an element of an ArrayCollection

$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollection($this->_data);
$total = count($this->_arrayCollection);
echo($total); // outputs 2

To get the size of the array collection


to iterate through the ArrayCollection

$count = 0;
foreach($this->_arrayCollection as $row) {
    $count++;
}
$this->assertEquals(2, $count);

To manipulate an ArrayCollection based on keys.

$this->_arrayCollection = new Zend_Amf_Value_Messaging_ArrayCollection($this->_data);

// See if the offset key exists
$boolean = $this->_arrayCollection->offsetExists(1);

// Alter or add the row at they key offset of 1
$data = array('fooSet' => 'fooSet2', 'barSet' => 'barSet2');
$this->_arrayCollection->offsetSet(1,$data);

// Remove the row at the offset key of 3
$this->_arrayCollection->offsetUnset(3);

// Get the row at the offset 6
$row = $this->_arrayCollection->offsetGet(6);

To change an ArrayCollection to an Array

$standardArray = iterator_to_array($this->_arrayCollection);

To append another row to an ArrayCollection

$this->_arrayCollection->append(array('kung' => 'foo', 'Bruce' => 'Lee'));

– Update –
From a PHP developers perspective this makes little since. I am asking that you comment why you like the new ArrayCollection. I am creating something that can already be done with an array in PHP and then just wrap it into a stub ArrayCollection class. The two things that action script does not do with an array is:

it can not handle sparse array’s. {1=> one, 2=>two, 4=>four} this is a sparse array and Action Script will try and pad the array or just make it an object.

Actionscript can not use strings as the key in the array so it just uses an object. If you want a numerically keyed array of objects they call it an ArrayCollection.

Both of these concepts are handled in PHP as just an Array. So there is no reason that you could not use the Array and then pass the array into a simple ArrayCollection class for it to be parsed back to flex. So when you see the new ArrayCollection class what are the use cases that you feel you would use the class for? Is it just a convenience tool or does it add complexity that does not need to exists?

ActionScript 3, Flash Platform, Zend_Amf

Adobe Flash Builder 4 Beta for PHP developers

June 9th, 2009

I am giving a couple e-seminars about some of the new  features exposed in Flash Builder 4. The examples are all going to be PHP but it the majority of the talk is on tooling. Come check it out and ask questions. It’s still beta so if you want something changed now is the time to ask!

Adobe® Flash Builder 4 Beta (formerly Flex Builder) for PHP developers
Tuesday, June 9, 2009 12:00 PM PT
Thursday, July 16, 2009 11:00 AM PT

Learn about the new improvements with Adobe Flex 4 Beta and how developers working with Flex and PHP are boosting their productivity by combining it use with Zend. This demonstration will show you how you can create a combined project with Flex components and PHP natures and reap the benefit of coding in both languages.

Flash Platform, Zend_Amf

Speaking at PHP | tek Chicago

May 5th, 2009

I am giving a presentation with Lee Brimelow about using Flex and PHP. Looks like it is going to be a great presentation. ;-)

php|tek 2009 PHP Conference - Chicago, May 19-22, 2009

I submitted an unconfrence hands on session. This requires a vote so GO VOTE if you find it interesting. If you want me to address anything in either talk just let me know.

Flex + AMF+ PHP = Data Visualization
http://joind.in/event/view/41

Looking to build your first Flex application or are just curios about it’s complexity? Most people are attracted to Flex in order visualize complex data. Learn the technical details for setting up your first visualization application with charting, maps, and lazy loaded data sets. For even more fun we will use some real time data from #tek09 with the help from Zend Framework.

Flash Platform, Speaking, Zend_Amf

Adobe looking for developers to join early access program for Flex Builder

April 3rd, 2009

From Andi Gutmans

Adobe is currently building the next generation of Flex Builder, the Eclipse based IDE for creating cross-platform rich Internet applications.  In this upcoming version, a significant new set of features are being introduced to accelerate creation of data-centric applications with PHP on the server-side leveraging Zend Framework and Zend AMF.  Prior to the public Beta later in the year, Adobe would like to invite a select group of PHP developers into a private pre-release program for Flex Builder. You’ll get to work with the new data-centric development features, interact with members of the product team, provide feedback, and generally help shape the future of the product.  No prior experience with Flex is necessary; in fact feedback from new users would be particularly helpful.  There is a brief survey here - please complete it and Adobe will send an invitation to you shortly.

Flash Platform, Zend_Amf

GZip compression is not part of AMF!

April 3rd, 2009

I have read a couple ranting emails, tweets, and blog posts about why Zend Amf does not have gzip compression; “Wade what a waste!” is my favorite one. The reality is that the AMF protocol does not have gzip compression, there is no DEFLATE call, and if you read the protocol you can find no mention of such a thing. When AMFPHP added AMF3 support it also added a php based gzip support in the same release. Hence AMFPHP now with AMF3 and Gzip compression; mutually exclusive rumor started. The compression of HTTP which is the envelop that that AMF data is transported through does not mean that AMF is compressed. This is no different than the plethora of other http service end points such as Soap, JSON, REST, XMLRPC, etc which all benefit from a properly configured web server. 

If you run apache check out mod_deflate.  With this approach, you tell the server what content types should be compressed, and the server does it transparently to your application. Apache is a heck of a lot faster at doing the compression than adding PHP code that uses gzcompress.

Hope this helps… and please no dirty names for someone that’s just trying to give you some free code. Go get Live Cycle DS dude!

Flash Platform, Zend_Amf

Don’t miss part 2 of our free webinar on Flex & PHP

April 3rd, 2009

Friday, April 3, 2009 1:00 PM – 2:00 PM EDT

Signup!
A three part series on how PHP developers can develop applications with the Adobe Flash Platform.  Lee Brimelow, a technical evangelist for Adobe, will go over the pieces of the Flash Platform and how PHP developers can use technologies like Adobe Flex and Adobe AIR in combination with PHP to build rich applications that work consistently across browsers in Flash Player and on the desktop using Adobe AIR.

Flash Platform, Zend_Amf