RSS
 

What, My Flash Gateway is Already AJAX Ready? Sweet.

23 Jul

I’m integrating existing Flex functionality with some new COTS [AJAX RIA] software. Looks like I’m golden on two fronts:

  1. My existing dashboarding app leverages the dynamic module architecture blogged hear in the past. Each module was cleanly encapsulated so it’s about a dozen lines of code to convert each module into a stand-alone app that integrates w/the AJAX page.
  2. My AMFPHP backend is fully reusable!! Using JSON for my AJAX calls, I can simply hit
    path_to_amfphp_install/json.php/class.package.classname.methodname/arg1/arg2/arg3

I really need to take some time and check out Wayne’s ZendAMF to see what he’s cooked up there, I’ve been far too busy as of late.

 
No Comments

Posted in RIA

 

VerifyError: Error #1053: Illegal override of removeChildBridge in mx.managers.SystemManagerProxy

25 Mar

Ran into this error recently when using automation testing (RunTimeLoading.html/swf).

Turned out to be a recently updated SWC (library) that was compiled under a newer SDK than the main app.

With the mixed SDKs main app / SWC(s) RunTimeLoading.swf was unable to load regardless of which SDK version RunTimeLoading was compiled under.

 
 

DBF->MySQL

23 Mar

While working on a staging area for a warehouse, I ran across the need to capture a table schema from a DBF file.

If found this link http://ae.inc.ru/dbf2mysql.php

Problem:
While running the program I received this error

error connecting to database client does not support authentication protocol requested by server; consider upgrading MySQL client

Solution:
You simply need to (in mysql):

SET PASSWORD FOR username@’host’ = OLD_PASSWORD(‘password’);

 

Connecting to 32 bit / 64 bit data sources from Tomcat (Java).

03 Mar

Problem:

When running tomcat your receive the following error when connecting to an ODBC data source
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Solution:

There are *two* ODBC managers in 64 bit windows. 64 bit ODBC data sources are separate from 32 bit data sources.

The ODBC manager accessed from the Control Panel contains the *64 bit* ODBC data sources.

Launch C:\windows\syswow64\odbcad32.exe to configure the 32 bit ODBC data sources.

If your running a 64 bit app, you’ll have access to the 64 bit data sources. Likewise, if your running a 32 bit app you’ll have access to the 32 bit data sources.

For Java apps, you’ll need to invoke the app with the correct JVM (32 bit or 64 bit) to have access to the desired data sources (32 bit or 64 bit).

On Vista, the 32 bit JVM(s) can be found (by default) at C:\Program Files (x86)\Java\jre6\bin. The 64 bit JVM is at C:\Program Files\Java\jre6

Catalina.bat (used to start tomcat) looks to see if JRE_HOME is defined so make sure this is pointing to the correct JRE or update catalina.bat accordingly.

 
4 Comments

Posted in RIA

 

Iterating a Filtered Collection

12 Feb

Okay, nothing profound here but thought I’d post as it’s a common question.

If you have filtered a collection,

ex

var ac:ArrayCollection = new ArrayCollection();
...
...
ac.filterFunction = myFilter
ac.refresh()

but you’d like to iterate over / access the unfiltered collection, simply use the .list property


var items:IList = ac.list

cheers

Josh

 
 

Diving back into the blog

12 Feb

I’ve had a crazy past few months. If I’ve been slow to reply to your comments – sorry !!!

I’ll be posting regularly again now :)

Josh

 
No Comments

Posted in RIA

 

RSL Loading Multiple Dynamic Modules

12 Feb

So I ran into a Flex bug recently documented here .

If your using the framework RSL (Runtime Shared Library) and loading modules, you should read the latter link. I was loading multiple modules and noticed that that they all didn’t necessary load. A little searching and I stumbled upon the open bug in JIRA.

One suggested work around was to load the modules sequentially. This works but doesn’t make for the best user experience. In my case the modules were being loaded dynamically and added to a viewstack. I opted to create a ‘lazy module loader’ component that loads the module on creationComplete().

I filled my viewstack with these components, made sure the viewstacks creation policy was set to ‘auto’ and voila, every things is working great. Of course one could avoid this component and add each module to the viewstack directly – in my use case I don’t want the main app to have to compile in [i.e. bloat] all [any of] the modules when, depending on the users auth they modules may not be used.

 
No Comments

Posted in RIA

 

South Bend Flex User Group: RIA @ the Bend

29 Dec

If your close to the South Bend, IN area, I’ll be heading up a new Adobe Flex User Group (http://groups.adobe.com/groups/3595576894/summary). Tim Eash, another local Flex developer will also help head up the group. We’ll be updating the group site over the next few weeks.

We’ll be meeting monthly at I.U.S.B. starting in January. Many thanks to Dr. Hakimzadeh, director of Informatics at I.U.S.B. for setting up the facilities.

The groups focus is Flex, Air, ActionScript, and Catalyst development. If you have any topics you’d like to discuss just let me know.

 
2 Comments

Posted in RIA

 

Flex 4 Gumbo Compiler Benchmark

21 Nov

‘Benchmark’ is being used pretty loosely here. I just got back from MAX and thought I’d check out the new compiler performance.

In addition to the exciting new display logic separation (Spark Framework), the SDK team has worked on speeding up compilation.

I compiled (incremental build) a project containing 57K lines of code (34K AS3, 23K MXML) under the 3.1 SDK via FlexBuilder. The compile took 40 seconds.

I then pointed FlexBuilder to the Flex 4.0.0 SDK. Make sure you update the ‘Require Flash Player Version’ on the Flex Compiler settings page to 10.0.0. If not you will receive errors including

1046 type was not found or was not a compile-time constant Matrix3D

After building the project I then preformed the same incremental build under 4.0.0 (Gumbo). The compile took 25 seconds.

Results:

SDK 3.1: 40 seconds
SDK 4.0.0 (Gumbo): 25 seconds

That’s not too bad, only ~62% of my original compile time.

 
 

MAX 2008 Pre-Event Summary

16 Nov

Okay, the first day of Adobe MAX 2008 is winding down. MAX is being held in San Francisco this year.

Today included registration and full day labs.

Badges

The badges got a technology upgrade this year, no bar codes this year, rather an RFID name badge. The local electronic stores are closed for the night – if I can find some time, it might be a fun project to grab an RFID reader and write up a quick AIR app (this *is* an Adobe conference after all :) to look at the data on the card. The information kiosks include RFID reader/writers that you use to ‘update’ your badge as you change / update your session schedule.

Tidbits

A few of the new features of the next FlexBuilder and AIR Runtime did slip out today. It’s not my place to ‘scoop’ that info – so I’ll wait to post until the general / official announcements are made in the next few days :)

Looks like Max 2009 will be on the West Coast again, this time in Los Angeles (Oct 4-7).

For those PureMVC developers out there, Cliff Hall will be broadcasting on Tuesday afternoon from the Marriott.

If your attending Max this year, feel free to drop me a line.

 
No Comments

Posted in MAX

 

Refactoring, Error #1065

23 Oct

I received the following runtime error in a flex project recently:

Error #1065 Variable package::Component_inlineComponent1 is not defined.

I was refactoring away from some static MXML to a dynamically loaded module. I had commented out the static MXML to test the dynamic module. Everything worked great. When I un-commented the previously working static module the #1065 error was thrown.

Problem:
[Cache causing] Error #1065 Variable is not defined error.

Solution:
Project -> Clean
:)

 
1 Comment

Posted in RIA

 

Revisiting one of my first RIAs

17 Oct

I spent some time updating on of my *first* RIAs today.

IEP RIA

The application allows special needs teachers to create IEPs (Individual Education Plans) for students. The teachers fill out various (20+) forms that compose the students’ IEPs.

During the initial interviews, it was identified that the forms would be revised annually and new forms would be added. Dynamically generated forms were *beyond* the project’s scope, so some easy-to-update forms were needed.

So back today, it’s always fun going back to revisit old code. I got a kick out of looking back at the approach taken on the RIA, hence this post. I wouldn’t necessarily recommend this “architecture” but it did make my job today extremely easy/fast to add some new forms & update some existing forms.

The Architecture

  • The teachers fill out their forms in a MDI Flex interface.
  • Form data is persisted for subsequent use.
  • All forms where mapped to Flex Accordion controls for a consistent user experience.
  • PDFs forms are utilized for printing.
  • I created a Flex component based on MX:Accordian. This component exposes a function ‘getData’ that when called recursively extracts data the user had entered in the form. This includes any data entered in datagrids, combo boxes, etc. The data is returned as a loosely typed ActionScript object.

    The object graph is sent to PHP via AMFPHP and persisted in MySQL via a PHP “ORM” class that can persist (& reconstruct) any PHP object graph. The object graph is not serialized rather, a modified preorder tree traversal algorithm is used. This provides for simple SQL queries, when / if needed.

    On the PDF form the form field is simply set to the desired attribute name of the object graph.

    So today, to add any form fields, I simply drop on an input (textbox for example), give that input an id and set the text property using databinding. (eg. id=”iep_firstName” text=”{dp.iep_firstName}”).

    That’s it.

    The new field will be persisted with no other work required :) The field can be added to the PDF should the field need to be printed.

    We have 8 Million+ records to date, and things seem to be scaling well.

     
    No Comments

    Posted in RIA

     

    Open Source ESBs… it’s here !!

    17 Oct

    I was excited to find an unexpected package on my doorstep last weekend. I had enrolled in Manning’s early access to Open Source ESBs quite a while ago (last year???). Well the books in print and I’ve got my copy in hand.

    I’m currently reading this book right now and loving it!!. I’ll make sure I update this post once I’ve finished the book.

    For those not familiar with ESBs (Enterprise Service Bus), suffice it to say the Enterprise Integration field is one of the most rewarding areas to be in software right now, IMHO.

    EI is full of architecture (which I love) so it’s a blast working in this field. Add data warehousing some RIA and you’ve got a snapshot of my past three months :)

     
    No Comments

    Posted in books

     

    The Data Warehouse Toolkit

    17 Oct

    I’ve read some really great books the past few months and thought I’d post a review.

    I’d highly recommend Ralph Kimball’s The Data Warehouse Toolkit.

    I’d normally opt for an architecture book over a [dry] database book without a second thought. Well I was pleasantly surprised to find this great resource.

    Kimball gives the reader a GREAT introduction to dimensional data modeling. For those ‘big picture’ developers out there, you owe to yourself to take a look at this work.

    I’ll leave the lengthy reviews to those more eloquent writes out there :)

    Two thumbs up.

     
    No Comments

    Posted in RIA

     

    Pipes Source Code

    17 Oct

    I’ve been heads down in development the past few months. During that time I’ve had numerous requests for the full source on the dynamically loaded modules ‘Pipes’ demo,MortgageApp.

    I *finally* had time to upload that source, simply use the ‘View Source’ on the demo to view the source.

    I’ve implemented a few enterprise RIAs using PureMVC pipes now. They work great, but I’m working on engineering (architecting) a new approach that I’ll post on the blog when it’s ready :)

     
    No Comments

    Posted in Pipes

     

    AdvancedDataGrid: Adventures in binding

    18 Sep

    Quick post on AdvancedDataGrid dataProviders.

    If your using a HierarchicalData provider for you AdvancedDataGrid (Flex) binding changes may (will) not be picked up by the AdvancedDataGrid.

    For example


    <mx:AdvancedDataGrid id="grid" bottom="10" top="40" left="10"
    designViewDataType="tree" width="379">
    <mx:dataProvider>
    <mx:HierarchicalData source="{grades}"
    childrenField="assignments"/>
    </mx:dataProvider>
    <mx:columns>
    <mx:AdvancedDataGridColumn headerText="Course" dataField="title"/>
    <mx:AdvancedDataGridColumn headerText="Score" dataField="scoreString" width="80"/>
    </mx:columns>
    </mx:AdvancedDataGrid>

    Won’t pickup the update to ‘grades’. Instead you’ll need to update the dataProvider itself…


    var hd:HierarchicalData = new HierarchicalData();
    hd.childrenField = "assignments";
    hd.source = grades;
    grid.dataProvider = hd;

     
    4 Comments

    Posted in Flex

     

    Bindable Read Only Getters

    08 Sep

    I had the opportunity to clear up some confusion on ‘bindable’ read-only ‘getters’ so I thought I’d post.

    If you mark your ActionScript class [Bindable], the compiler will generate propertyChange events for the class’s public variables and properties exposed through getters and setters.

    When a property exposed through a get / set pair is modified, a propertyChange event will be dispatched (from the setter). Use the comiplers -keep flag to inspect this for yourself.

    If you have a property exposed through a getter but no matching setter, data binding will not detect changes to the ‘get’ value.

    For example, you might have a getter value that is calculated from two other fields. To enable data binding on the ‘getter’ value, simply dispatch an event whenever the fields in the calculation are updated. You can then mark the getter function Bindable on those event names.

    Here’s a working example


    package
    {
    import flash.events.Event;

    [Bindable]
    public class BindingDemo
    {
    private var _numerator:Number = 0;
    private var _denominator:Number = 1;

    public function get numerator():Number
    {
    return _numerator;
    }

    public function set numerator(value:Number):void
    {
    if(value != _numerator)
    {
    _numerator = value;
    this.dispatchEvent(new Event('numeratorChanged'));
    }
    }

    public function get denominator():Number
    {
    return _denominator;
    }

    public function set denominator(value:Number):void
    {
    if(value != denominator)
    {
    _denominator = value;
    this.dispatchEvent(new Event('denominatorChanged'));
    }
    }

    [Bindable(event='numeratorChanged')]
    [Bindable(event='denominatorChanged')]

    public function get ratio():Number
    {
    if(_denominator == 0)
    return 0;
    return _numerator / _denominator;
    }
    }
    }

    And some MXML to try it out


    <?xml version="1.0" encoding="utf-8"?>
    <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
    <mx:Script>
    <![CDATA[

    [Bindable] public var bdemo:BindingDemo = new BindingDemo();

    ]]>
    </mx:Script>
    <mx:Button x="193" y="23" label="Update" click="bdemo.numerator=Number(nvalue.text)"/>
    <mx:Label x="20" y="25" text="Numerator"/>
    <mx:Label x="20" y="51" text="Denominator"/>
    <mx:Label x="30" y="90" text="Numerator" fontWeight="bold"/>
    <mx:Label x="17" y="116" text="Denominator" fontWeight="bold"/>
    <mx:Label x="62" y="142" text="Ratio" fontWeight="bold"/>
    <mx:Label x="105" y="90" text="{bdemo.numerator}" id="num"/>
    <mx:Label x="105" y="116" text="{bdemo.denominator}" id="den"/>
    <mx:Label x="105" y="142" text="{bdemo.ratio}" id="ratio"/>
    <mx:TextInput x="105" y="23" width="80" id="nvalue"/>
    <mx:TextInput x="105" y="49" width="80" id="dvalue"/>
    <mx:Button x="193" y="49" label="Update" click="bdemo.denominator=Number(dvalue.text)"/>

    </mx:Application>

    Try it out below.

     
    No Comments

    Posted in binding

     

    PHP ODBC Across Networked Drives

    20 Aug

    While integrating some backend services needed by our RIA I ran across a small hiccup that was easily fixed but I thought I’d post in case someone else get’s stumped by this (apparently some already have ).

    Problem:

    PHP needed access to and ODBC connection that pointed to a dBase III database on a remote server. While local applications could use this ODBC connection flawlessly, connection via PHP failed.

    Symptons:

    Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC dBase Driver] ‘(unknown)’ is not a valid path.

    Solution:

    You need to enable rights for the Apache Service to have access to the remote directory.

    For my particluar situation the server running apache and php was not part of the domain, so I simply right clicked on the apache service, navigated to the Log On tab and selected “This Account” (and filled in the administrator credentials) as opposed to the default “Local System Account.”

     
    1 Comment

    Posted in PHP

     

    Flex Modules Watch Your Scope

    14 Aug

    Here’s another help hint for those working with Modules in Flex: Watch your variable scope!!

    When loading modules, you have a number of options for loading the SWF including the ModuleLoader and ModuleManager. If neither of those fit your needs you always have access to Flash’s Loader class. ModuleManger can be used for fine grained control of the loading process. Either way, variable scope plays a crucial roll in the loading process.

    Here’s an example using ModuleLoader…

    public function loadSWFModule(swfURL:String):void
    {
    var moduleLoader:ModuleLoader = new ModuleLoader();
    moduleLoader.url = swfURL;

    moduleLoader.addEventListener(ModuleEvent.READY,onModuleLoaded);
    moduleLoader.addEventListener(ModuleEvent.ERROR,onModuleError);
    moduleLoader.addEventListener(ModuleEvent.PROGRESS,onProgress);
    moduleLoader.loadModule();
    }

    The moduleLoader is declared as a local variable. As it turns out this will cause problems, even with the ‘strong’ event listeners. For those not wanting to read the technical details to follow, simply use avoid using a locally scoped variable.

    The following are some of the symptoms you may run into using the latter locally scoped variable:

    To help those searching the net, I’ll be a bit redundant in the ‘symptom’ descriptions so hopefully you’ll find this post if you’ve stumbled upon this problem

    Symptons

  • The module fails to load the first time, but loads successfully the second time.
  • The ModuleEvent.READY is never dispatched
  • The ModuleInfoProxy never picks up the ModuleEvent.READY dispatched by ModuleInfo
  • ModuleInfo.clearLoader() throws an error (which is quietly caught), Error #2029: This URLStream object does not have a stream opened when calling loader.close()
  • The problem comes in when the Loader finishes loading the SWF. ModuleInfo’s internal listener list (listeners attached during ModuleInfoProxy’s constructor) are lost (i.e. null) when ModuleInfo finally reaches it’s readyHandler( ) method. At the end of the readyHandler( ), a ModuleEvent.READY event is dispatched.

    dispatchEvent(new ModuleEvent(ModuleEvent.READY));

    With the listener list being null, the event is never picked up by the ModuleInfoProxy and the initial load fails.

    On subsequent loads (i.e. the second time) ModuleInfoProxy’s load( ) method checks to see if the info has already been loaded and dispatches the ModuleEvent.READY event directly.

    else if (info.loaded)
    {
    //trace("Module[", url, "] load is already loaded");
    if (info.setup)
    {
    ...
    if (info.ready)
    {
    ...
    dispatchEvent(new ModuleEvent(ModuleEvent.READY));
    }
    }
    }

    Causing the load to ‘work’ the second time.

    My understanding is that Garbage Collection is often invoked when a module is loaded. It looks like it’s the cause of this behavior (the listeners being lost). I assumed that the ‘strong’ listeners would be enough to keep the GC away, oh well.

    Again the solution is simple, make sure your not using a locally scoped variable when loading modules.

     
    13 Comments

    Posted in Flex, Modules

     

    Flex, Java Remoting, and JMS [null message body]

    07 Aug

    So I was pounding out some code this afternoon, ran into a small snag and thought I’d post. Neuro-physiologists tell us that we better remember what we write down so here goes.

    Similar to my post a few months ago, I made a simple omission in my coding flurry.

    I was working with a backend Java class that published messages to [ActiveMQ] JMS. I wrote up a simple VO class to publish via JMS.


    package com.dl.sifagents.vo;

    import java.io.Serializable;

    public class ZISEventVO implements Serializable
    {
    public String eventType = "";
    public String payloadPackage = "";
    public String payloadElement = "";
    public String xml = "";
    }

    On the Flex side, I wrote up an AS3 implementation


    package com.dl.sifagents.vo
    {
    [RemoteClass(alias="com.dl.sifagents.vo.ZISEventVO")]
    [Bindable]
    public class ZISEventVO
    {
    public var eventType:String;
    public var payloadPackage:String;
    public var payloadElement:String;
    public var xml:String;
    }
    }

    I published the VO to JMS…


    public void publishObjectToJMS(Serializable o)
    {
    try {
    ObjectMessage message = _pubSession.createObjectMessage();
    message.setObject(o);
    _publisher.publish(message, Message.DEFAULT_DELIVERY_MODE, Message.DEFAULT_PRIORITY, 5 * 60 * 1000);
    } catch (JMSException e1) {
    e1.printStackTrace();
    }
    }

    I received the JMS message in Flex (via BlazeDS) but the message body was null. I checked and doubled checked my Java VO implementation vs AS3 VO implementation and couldn’t find any naming conflicts or errors.

    Then it hit me, in my haste I’d forgotten to upload the Java VO class to BlazeDS (i.e. to the WEB-INF/classes folder)!

    That’s my piece of humble pie for the week :) Back to work.

     
    3 Comments

    Posted in BlazeDS, JMS, Java