Wade Arnold

Fun with Flash, Flex, and AMFPHP

Speaking at ZendCon 2008: Leverage Zend Framework for your next Flex RIA

I am speaking about a project that I have been working on with Adobe and Zend at ZendCon this year. I am supper excited about this advancement as it brings together to languages that I love. Drop a comment if you are thinking about going or want to meet up. Also if there is something specific that you want to see in the presentation let me know! Session information should be released in the enxt couple weeks on the ZendCon website under RIA

1 comment

Embedded/Hardened Flash Media Server 3 on X/Ubuntu Hardy Heron 8.04

A mil spec hardened FMS server and raw video stream publisher were required in order to stream drive camera , ptz and thermal surveillance video over  RTMP streams from a robot back to a Flex user interface. I opted to use a PC-104 stack from to meet the temperature requirements and a mil spec hard drive. I also used a PC-104 4 input frame grabber in order to get all four robot cameras online. The frame grabber showed up as  /dev/video0 with all four channels and we had to write a crop tool that brook the four quadrants of data and placed them onto vloopback V4L2 buffers.  The new Flash Player 10 beta2 player was not able to pick-up vloopback as a valid V4L2 device so I opted for using the FlashCam project to convert my V4L2 device back to V4L. I used an AIR application that picked up the four streams and "published" the video at it's highest quality to a localhost FMS server. Because of this need I had to have an X sessions so I used Xbuntu as the operating system. It is pretty slick install as it gets rid of all the traditional junk the Ubuntu desktop has in order to keep it fast. I assume that I could have cut down RHEL and gone with a supported FMS server but the following information will tell you how to get a dev version of FMS up and running on Xbuntu 8.04.

To install Flash Media Server on the box I had to follow the patch process outlined by Markus Bertheau and the first half of these steps were taken from this aYo Binitie II.

The following process gets Flash Media Server installed properly.

Download Flash Media Server

Install the additional libraries needs to run FMS on Ubuntu

$ sudo apt-get install libnspr4-dev

Unzip the download which for me was on my Desktop

$ unzip Flashmedia3_Int_Strm_ALP.zip
$ cd Flashmedia3_Int_Strm_ALP

$ tar xvzf FlashMediaServer3.tar.gz

Download and install the patch

$ cd FMS_3_0_1_r123/
$ wget http://www.bluetwanger.de/~mbertheau/flash-media-server-3-ubuntu.patch
$ patch -p1 < flash-media-server-3-ubuntu.patch
$ sudo ./installFMS

I ran with the defaults on everything. If you have Group issues then the patch did not work properly!

Installation complete! Double check

$ sudo /etc/init.d/fms restart
$ tail /var/log/messages
Jul 16 08:24:10 wade-laptop Service[21193]: Server stopped .
Jul 16 08:24:10 wade-laptop Service[22858]: Server starting...
Jul 16 08:24:10 wade-laptop Service[22858]: Server started (/opt/adobe/fms/conf/Server.xml).
Jul 16 08:24:10 wade-laptop Adaptor[22878]: Listener started ( _defaultRoot__edge1 ) : localhost:19350/v4
Jul 16 08:24:10 wade-laptop Adaptor[22878]: Listener started ( _defaultRoot__edge1 ) : 1935/v4
Jul 16 08:24:15 wade-laptop Service[23053]: Server starting...
Jul 16 08:24:15 wade-laptop Adaptor[23053]: Listener started ( FCSAdminIpcProtocol ) : localhost:11110/v4
Jul 16 08:24:15 wade-laptop Adaptor[23053]: Listener started ( FCSAdminAdaptor ) : 1111/v4
Jul 16 08:24:15 wade-laptop Service[23053]: Server started (./conf/Server.xml).

$ ps -e | grep fms
22858 pts/1    00:00:00 fmsmaster
22878 pts/1    00:00:00 fmsedge
22881 pts/1    00:00:00 fmscore
23053 pts/1    00:00:00 fmsadmin

Now to add an application and set proper permissions. I had a PTZ applications folder on my desktop with the new FMS app that I wanted installed. The following commands are necessary because you need to first make the applications owned by the user and group fms and then you need to remove the setuid bit that is added.

$ sudo cp ~wade/Desktop/applications/PTZ /opt/adobe/fms/applications/PTZ
$ ls -la /opt/adobe/fms/applications/ | grep PTZ
drwx--S---  2 root fms 4096 2008-07-16 08:52 PTZ
$ sudo chown -R fms:fms /opt/adobe/fms/applications/PTZ
$ sudo chmod 755 -R /opt/adobe/fms/applications/PTZ
$ ls -la /opt/adobe/fms/applications/ | grep PTZ

drwxr-sr-x  2 fms fms 4096 2008-07-16 08:52 PTZ
$ chmod -s -R /opt/adobe/fms/applications/PTZ
$ ls -la /opt/adobe/fms/applications/ | grep PTZ
drwxr-xr-x  2 fms fms 4096 2008-07-16 08:52 PTZ

Note that the setuid bit has changed from s to x

$ sudo /etc/init.d/fms restart

 

Your good to go now! Start using FMS like the documentation says and everything will work fine.

No comments

Why OOP AMF serialization?

In response to some questions and emails

The specification for AMF serialization define a type market for each data type. There are 13 types in AMF A type marker is one byte in length and describes the type of encoded data that follows. The general data type is very simple to handle but what is more inportant is when a second byte exists called the ecoding type byte. Type markers may be followed by the actual encoded type data, or if the marker
represents a single possible value (such as null) then no further information needs to be encoded.
What data type you need to serialize based on the first byte of data field. Once you get this type you there. This is fine if you have all the time in the world to implement every type in the specification. However most people when they think of array they think of just one type. But there are three types of arrays defined by AMF and if you really want a complete implementation you need to handle all three. Outside of teh speficication people really think of AMF as Life Cycle Data Services. I need AMF in php usually is someone implying that they want all the functionality of LifeCycle DS in PHP. This is really where the OOp functionality comes into play. A fully imlemented AF gateway falls well short of LifeCycle. In the next serialization implementation that I am working on it has to be able to add these additional mapping tools that are more generic than class mapping your custom classes to be a part of the release. A common request is ArrayCollections. Class mapping ArrayCollections is something that you need in almost every Flex project but it really is not part of the AMF specification. In this specific case AMF would treat the incoming Data as an object type which it is. By using a more OOP implementation it is easy to add this as an object type but then also used an optimized ArrayCollection handler that is part of the core library's without having to have everyone role there own.

Headers fall into this too. Most developers like to toss additional session specific or session instantiation specific data into the AMF header. The new aproach allows you to create your own handlers for those headers and of course support the defined amf_server_debug, Credentials, DescribeService.

No comments

New PHP<->AMF serialization done!

I have been working on a new code base for Amf to PHP Serialize'er and it all seems to be working. I am super excited about this! Mostly because I have spent the last 5 weeks working on building the architecture the way that I have always wanted it and it actually worked! It makes it super easy to make new amf/value/newtype.php so that the filter can be applied to the byte type coming in. You can also add amf/header/types.php so that you can easily deal with incoming AMF headers for things such as security. My hope is that this architecture keeps serialization advancements available to other developers so that it is not always on the project leads. So far the tests are really fast even with additional OOP functionality.

This is the last 38 hours of consumption minus starbucks trips and office coffee just so that I could make Mike Potter happy.

Love!

thebull.jpg

5 comments

It’s Here! Essential Guide to Open Source Flash

Just got my author copies of The Essential Guide to Open Source Flash. Obviously I am excited to see my name along with many of my friends and fellow flash zealots on the cover of this book. I have thumbed through the book and I am super excited to take the time to read the other chapters. There is already a lot of stuff that I started looking into to improve what I do. I want to thank Apress for putting up the cash to have those of us in the open source community do a professional job on documenting these great projects. I have found that one of the biggest difference between paid software and open source is documentation. Paid software usually has more documentation than functionality and open source can do everything you ever wanted as long as you watch the mailing list for year! Again thanks Apress, fellow authors, and please run out and buy a copy!
Books Done
If I any idea how to monetize my blog I would have some nuts amazon referral thing but just go get a copy! I need to talk to Aral on that at some point~!

1 comment

multi-byte manipulation in php: ord, iconv, mbstring

Working on optimizations for AMF serialization and I want to finalize on just using the default ord function or actually using one of the fancier libraries such as mbstring or iconv. However I am not able to find very much information on what is the preferred library to code against. Surfing google shows that "everyone" likes iconv as it is almost always there on linux but suggest that mbstring is more portable? However there does not seem to be any suggestion as to what new developers should code against. I really like the additional methods that iconv and mbstring provide and both suggest optimizations although I would have to write my own tests to prove any optimizations. Can anyone lead me to some more detailed information on what the community wants to adopt?

-- Update: ICONV it is! --

"mbstring offers better support and more options. However, it's not enabled in vanilla PHP installs -- whereas iconv _is_. So, for that reason, we typically recommend utilizing iconv. (I actually switched from using mbstring to iconv in Zend_XmlRpc for this reason.)"

Matthew Weier O'Phinney
Software Architect
Zend Framework      

No comments

Basics to securing AMFPHP

There are a lot of comments about how to secure amfphp. If you can do one thing and one thing only do the following.

1.) PLEASE remove the amfphp/browser/ folder from your project. This was designed as a debugging tool and has no access controls. Never place the browser on a production server.

2.) The more important file to remove rather than the browser directory is "f8v4/services/amfphp/services/amfphp/DiscoveryService.php" you can point any browser at a different gateway.php and it'll bring up those services if the DiscoveryService.php is still there.  Its this file/service that tells the browser was services are available for calling.  For a complete kill of the browser you need to remove.

"f8v4/services/amfphp/services/amfphp/"  <-- DiscoveryService.php in here.
"f8v4/services/amfphp/browser/"

3.) Change "public_html/f8v4/services/amfphp/gateway.php"
define("PRODUCTION_SERVER", false);
to
define("PRODUCTION_SERVER", true);

4.) You really need to run the application over SSL if you can. It really helps keep people from being able to see all the plain text data that you are sending to and from the server.

5.) Implement before filter and I will blog on this real soon.

This will at least make it so that you can not remotly inspect all fo the services that are avaialable. I will release an

7 comments

AMF<->PHP and whats new?

I have been working with a couple well know technology companies on an open source project to bring two languages I love closer together. It will be very cool  ;-) Flex3 and PHP will soon be better friends than ever!

With that said; Yes I am busy! For now that is really all I can say about what I am doing. This post is to let everyone know that the AMFPHP project is alive and well!

Also we finally have a cover to the Essential Guide to Open Source Flash which features and artical on AMFPHP. Very cool!

Can anyone figure out why sourceforge hates the username wadearnold? Let me back in!  I can't answer questions without access.

3 comments

SourceForge help me w/ AMFPHP

So my sourceforge account ha been blocked for about a month now. For some reason I get all my email add the account that I signed up with but my password no longer works and password recovery does not recognize my email address. How can I be getting email when they don't know my password? ODD! I have opened several tickets but nobody seems to be able to do anything other than close my ticket. This seems to be a major issue because as a project lead I can't just sign up a new account and then give myself rights to myself? FUN. Help if you can!

my sourceforge username is: wadearnold

No comments

Switched to Ubuntu and all is well

Update: After three days of using the Flex Builder plugin i just relized that it does not support design view yet! Well that would be nice!

Running Ubuntu as my primary OS and AIR, Flex Builder Plugin, PDT, Charles, Vmware Workstation FileZilla, all work great. It took me longer to backup everything from my Vista install than it did to get everything back up and going. Vista was my first Windows OS since Windows ME when I switched to Linux. Post college (aka cash) I became a mac guy but purchased a Dell M90 about a year or more ago when the whole switching to the intel architecture thing was going on. I had two power macs in a row that the monitor stoped working and out of frustration moved to what seemed like a super powerful laptop. Although I liked OSX 10.0 - 10.3 the powerpc hardware left me with a lot to be desired and I still hope that other hardware vendors can someday install OSX. I decided this weekend that there was no way I was getting a new mac any time soon and with the change to Linux I may never go back. Unfortunately I still need Flash CS3 which requires windows so VMware it is until Flash looks a lot more like eclipse.

5 comments

Next Page »