PHP GeekMeet

This Saturday, I will be in Cluj, doing a session at PHP GeekMeet, and later on I will meet the guys from Transylvania Flex Group. If you want to meet and talk about RIA and the Flash Platform, you know where to find me :)

Video tutorial on LiveCycle ES

Duane Nickull posted a video tutorial on LiveCycle ES. You can learn how you can call a function from LiveCycle ES. Watch the video here.

Adobe Developer Day

There is one aspect of my work as a platform evangelist that I really love: being able to help communities to take shape or to grow. I remember the first Camp we did in Bucharest back in 2007. A team from the Adobe’s Bucharest office had an idea to put Bucharest on the map of Flex and AIR events. About 70 people attended the event. Very few knew what Flex is. Two years, later we have user groups in Bucharest, Craiova, Timisoara and Cluj.

And because everything started in Bucharest, we decided to have a mega camp on May 19th. This time we have a great location (Intercontinental Hotel), with three rooms, and we are expecting 400 attendees. We plan to present some mind-blowing sessions, host Boot Camps, and have open doors. But this is only one side of the coin. The other side is the list of speakers and people from Adobe that will attend this event. First of all we have Ben Forta; he will do the keynote and another session, and he will answer your questions. If you haven’t seen Ben live, then you shouldn’t miss this opportunity. Next, we have Digby Horner. He is the man to “blame” for the opening of the Adobe Romanian office. The Romanian AIR team will be there too, and they are pure gold for anyone who wants to know about the internals of Adobe AIR. If you didn’t know, they are the people behind the Update framework, a lot of features for Ajax developers in AIR, debuggers, and BlackBookSafe to name just a few of their contributions. We’ll have also engineers and managers from the Romanian office that will deliver sessions or just answer your questions. And of course, we have the usual suspects Magda, Cornel, Miti and I, the local evangelists.

Here is the schedule:

Main room Speaker
9:30-10:00 Registration
10:00-10:15 Introduction – Agenda Alexandru Costin
10:15-11:15 Adobe and RIA Ben Forta
11:15-11:45 Making of Adobe Romania Digby Horner
11:45-12:00 Coffee break
12:00-13:30 Flex for Enterprise Cornel Creanga
13:30-14:30 Lunch
14:30-15:30 Flex 4 SDK and Flash Catalyst Mihai Pricope
15:30-16:00 Intro to ColdFusion for Enterprise Ben Forta
16:00-16:45 InContextEditing – First Adobe Romania Product Lucian Cozma
16:45-17:30 Mobile Mpackager Mihai Pricope
17:30-18:00 Flash Player 10 – FMS Cornel Creanga
18:00-18:30 Closing session
Bootcamp room Speaker
11:30-12:00 Open Doors Alexandru Costin + Upper Management
12:00-13:30 Pixel Bender Skinning Bootcamp

Dragos Dascalita
14:00-14:30 Open Doors Dragos Georgita+ AIR team
14:30-16:30 BlazeDS + LCDS Bootcamp Advanced Mihai Corlan + Cornel Creanga
16:30-18:30 Introduction to Flex and AIR Bootcamp Mihai Corlan

My advice: make sure you grab a place and you don’t miss it. I can assure you that you’ll not regret it.


How to debug Flex/AIR and PHP applications

LATER UPDATE: I wrote another article that is up to date. You can read here the new one.

Another question I get quite often is “How do I debug my Flex (or AIR) and PHP application?”. Usually I take some time to show a few debug methods when I am presenting Flex/AIR and PHP workflows.

There are several methods that you can use to debug Flex/AIR and PHP applications, each with its own advantages and disadvantages:

  1. Use Flex Builder and Zend debuggers.
    1. Pros: it is arguably the most elegant and efficient way; it is not intrusive
    2. Cons: you need to have Flex Builder and Zend Studio installed together; it does not work for AIR applications
  2. Use a server side logging function for PHP, and Flex Builder debugger for Flex
    1. Pros: it works great for both Flex and AIR apps; you need only Flex Builder
    2. Cons: it isn’t so straight-forward; you need to walk through the code and call the logging function until you pin-point the problem. It is very much like doing JavaScript debugging with Alert or PHP debugging with Refresh and die(var_dump($myVar)). It is intrusive because you have to add code to the PHP that is not needed in production.
  3. Use a proxy sniffer, such as Charles
    1. Pros: it understands AMF format; it is not intrusive
    2. Cons: it is shareware, and it can’t be used for AIR apps
  4. FirePHP. This is actually similar to method two above. The only difference is that you need to install a Firefox extension, and then using this extension and some PHP code you can see the output of the FirePHP logging functions directly inside of your Firebug console.
    1. Pros: it is easy to read the four different types of messages (log, info, warn, error) in the console, and it may be familiar for those who already use Firebug (such as AJAX developers)
    2. Cons: it works only in Firefox because of the dependency on Firebug; it doesn’t work for AIR, and it is intrusive (you have to add code for it)

Using Flex Builder and Zend debuggers

This is my favorite, and I believe it is the fastest way to debug your code. Although you can’t use this approach for debugging AIR projects, I think it is worth it to create a twin Flex project just to be able to use this approach.

You can read more about this method here, or you can watch my video tutorial here.

Using a server side logging function

Actually, this was my first approach for debugging AIR and PHP applications back in 2007 when I created my first AIR application. At that time, I was using XML-RPC to communicate between the client and server, and as I started to hit bugs I needed something to debug (at that time the PHP debugger wasn’t so reliable, and it was hard to make it work in the Eclipse IDE).

I still use this approach today, when I want to log some variables on the PHP side. I use this function:

   1: function logMe($var) {
   2:     $filename = dirname(__FILE__) . PATH_SEPARATOR .'__log.txt';
   3:
   4:     if (!$handle = fopen($filename, 'a')) {
   5:         echo "Cannot open file ($filename)";
   6:         return;
   7:     }
   8:
   9:     $toSave = var_export($var, true);
  10:     fwrite($handle, "[" . date("y-m-d H:i:s") . "]");
  11:     fwrite($handle, "\n");
  12:     fwrite($handle, $toSave);
  13:     fwrite($handle, "\n");
  14:     fclose($handle);
  15: }

This function uses a text file (__log.txt) to dump its single argument, together with a time stamp. I can use this function to log primitives as well as complex types. Here is an example of how the file looks after I dump some variables:

   1: [09-03-11 21:56:01]
   2: NULL
   3: [09-03-11 21:56:10]
   4: VOAuthor::__set_state(array(
   5:    'id_aut' => 2,
   6:    'fname_aut' => 'William11',
   7:    'lname_aut' => 'Shakespeare',
   8: ))
   9: [09-03-28 15:18:37]
  10: array (
  11:   0 =>
  12:   VOAuthor::__set_state(array(
  13:      'id_aut' => '1',
  14:      'fname_aut' => 'Dante',
  15:      'lname_aut' => 'Alighierie',
  16:   )),
  17:   1 =>
  18:   VOAuthor::__set_state(array(
  19:      'id_aut' => '4',
  20:      'fname_aut' => 'Niccolo',
  21:      'lname_aut' => 'Machiavelli',
  22:   )),
  23:   2 =>
  24:   VOAuthor::__set_state(array(
  25:      'id_aut' => '3',
  26:      'fname_aut' => 'Umberto',
  27:      'lname_aut' => 'Eco',
  28:   )),
  29:   3 =>
  30:   VOAuthor::__set_state(array(
  31:      'id_aut' => '2',
  32:      'fname_aut' => 'William',
  33:      'lname_aut' => 'Shakespear',
  34:   )),
  35: )

This method is very simple, however it is intrusive since you will have calls to the function in your code, and you don’t want these calls to end up in your production code/server. Second, debugging in this way is not so fast, especially if you don’t have a good idea about where in your code base the problem could be.

Using Charles to debug

You can use Charles (which is a  Proxy Sniffer) to see what messages are exchanged between the Flex client and the server. This method doesn’t work for AIR applications. Charles knows how to decode AMF messages, thus if you are using Remoting, then you can still see the communication.

After you start Charles, be sure you configure your browser to use Charles as a proxy:

firefox_config

Next, start your Flex application and make a call to the server. In Charles, you can see the request, what method was called from Flex, and the response sent back by the server. In the screen capture below, you can see the information for a remote call on a PHP class using Zend AMF.

charles

This method is great for quickly pin-pointing what Flex sends to a PHP script. If your problem is not solved here, then you have to switch back to method 1 or 2. Or you can alter your code to output the variables from your script, and in Charles you can see the dump (for the example below I just added to my script something like die(var_dump($result));:

charles2

Using FirePHP to debug

You can find information about how to use FirePHP here and here.

firePHP

If you are using Zend Framework, then it is even easier beacause you don’t have to download and install the FirePHPCore library. You need only Firefox, Firebug, and FirePHP extensions installed. Again, you cannot use this with AIR projects. Zend Framework lets you enable and disable the logging very easily:

   1: $writer->setEnabled(false);
   2: $profiler->setEnabled(false);

This means that you don’t have to remove the debug calls when you go to production.

Conclusion

There are many ways to debug Flex/AIR and PHP applications. Depending on the nature of your project, and the nature of your problem, you can use more than one. I hope this post will help you, especially when you take the first steps in Flex and remoting.

New version of TweetDeck is out

My favorite Tweet client, TweetDeck, has a new version. This new version brings Facebook integration, and, more importantly, fixes a memory leak issue that forced users to restart the application from time to time.

You can read more here. Happy tweeting from TweetDeck!

Drink with Platform Evangelists

drink-wing-04-aa-05

Spring has come! Finally we have nice weather in Bucharest (my town). We’ve decided to start a series of after-hours meetings, in a nice pub in Bucharest, to talk about RIA, web technologies, trends, and more. With platform evangelists (Miti, Cornel, engineers from AIR team, and me), and you! This is really not an excuse to get rid of our ladies, and drink beer. No! It’s all about technology and people!

The first meeting is tomorrow, April 9th, starting with 20:00, Motoare pub!

We are really curious to see how many people will show up, and what topics people want to discuss! (You can find more by watching the movie; it is in Romanian as we don’t expect to have people who don’t speak Romanian).


Drink with Platform Evangelists in Romania from Mihai Corlan on Vimeo.

Make money with the Adobe Affiliate Program

You can earn up to 8% commision out on the Adobe products you recommend to others! Thus if you have a website or a blog, maybe it is a good idea to have a look here.

Adobe® Flex™ Builder 3 Professional for unemployed developers

It is no secret that these times are not the best we’ve had in the past 9 years, and that some of us have lost jobs. Thus, we (Adobe Evangelists) thought the least we could do is to lend a hand and help people in this situation to learn Flex. This way they can improve their chances of finding a job, and, who knows, maybe find a better paying one.

As a result we put together this site: https://freeriatools.adobe.com/learnflex/, where you can get Flex Builder 3 Professional (if you are unemployed and you will not use the product for commercial purposes).

All the best!

June Adobe User Groups Tour

If you are part of an Adobe User Group and you want Adobe Evangelists to present at one of your group’s events in June, then it is time to ask your Adobe User Group Manager to register your group.

It seems that the Americans are ahead of us, the Europeans. Come on, let’s try harder and show them that we do know how to put on a show!

Sideline, an AIR application with YUI created by Yahoo!

You can read here an interesting article about the making of the Slideline AIR application by a team of front-end engineers from Yahoo! Here is a quote from the article about the goals of the project:

* Create a desktop application that allows for the creation, grouping, and auto-execution of advanced search queries against Twitter
* Leverage existing skill-sets and tools
* Target the Windows, Mac OS X, and Linux operating systems and minimize the amount of platform specific code that must be written
* Open source the code so that others can learn from, contribute to, and/or extend the product as they see fit

sideline

If you take the time to read the article, you will find some advice about how to approach an AIR project/application. The application is created using HTML/JS/CSS and YUI.

← Previous PageNext Page →

Switch to our mobile site