The amazing adventures of Doug Hughes

Archive for September, 2007

Alagad Unveils Its Plan For World Domination!

Alagad Logo Small VerticalI know that some of the recent growth at Alagad, especially in terms our our team, has turned heads. With a team like ours, all of which are notable and respected people in the industry, many people have been asking me, what is Alagad up to? The answer is quite simple:Alagad is providing world class products, services, and training focused on the Adobe toolset.

It really is that simple.

Our theory is that if you bring the best people in the industry together under one roof you achieve a natural synergy that will bring success, both for our clients and for Alagad.To support this, we have released a new website which focuses on our three core passions: Our products and projects, our consulting and development services, and our training programs.

The website also brings our technical content off to help us better communicate with our customers and the Adobe technical community.This is just the beginning!Trust me, we have a lot more up our collective sleeves. While you wait for us to show the rest of our hand, why dont you browse the new site?

Columbus CFUG Reminder

Juts a reminder that I will be speaking at the Columbus ColdFusion User Group Thursday evening at 6:00 PM.

The presentation will be an introduction to Flex with emphasis on how to use Flex with ColdFusion.

Did You Know ColdFusion 8 Compiles MXML?

I received an extremely interesting tidbit of information from a very authoritative figure at Adobe today. Did you know that ColdFusion 8, when installed with LiveCycle Data Services (which it is, by default) will compile MXML files for you on the fly?

Thats right! You have a complete Flex server included with ColdFusion!

From what I’m told, and I have yet to test this, integration with LCDS “just works” when you use this.

Ultimately, this might hurt performance if you overuse this, so use with caution. That said, from my tests it seems that the resulting SWF is cached and not recompiled on each request.

Ive been asked to give credit for this to Tom Jordal. Thanks!

Illegal Override Error (Error #1053) in FB2 Flex projects w/CF8

I’ve seen some forum messages about this error:

VerifyError: Error #1053: Illegal override of subtopic in mx.messaging.Consumer

This seems to happen to people who’ve installed CF8 and are using FlexBuilder 2 to create Flex projects using Flash Remoting or LCDS (formerly FDS). Why does this happen?

If you look in the properties for a Flex project under FB2 w/a CF8 server, you’ll see that there’s an entry pointing to {cf_install_path}/wwwroot/WEB-INF/flex/libs/fds.swc. This library conflicts with the Flex2 framework SWCs that come with FlexBuilder. The solution?? Pretty easy.

In the project’s Properties panel (right-click the project and hit Properties…) you’ll see a Flex Build Path entry in the list on the left. Click it, then choose the Library Path tab on the right. Now click “Add SWC Folder…” and navigate to your CF server’s {cf_install_path}/wwwroot/WEB-INF/flex/libs folder and click Choose. This will add the {cf_install_path}/wwwroot/WEB-INF/flex/libs folder as a Flex2 library folder to your project. Now remove everything in the Build Path Libraries: window except for:

  • ${FRAMEWORKS}/libs/playerglobal.swc
  • ${FRAMEWORKS}/libs/locale/{locale}
  • /Applications/ColdFusion8/wwwroot/WEB-INF/flex/libs
  • NOTE: Your path to /WEB-INF/flex/libs may be different

Now go back into FlexBuilder 2 and use the Project menu to get to the Clean… menu choice. Choose to clean your Flex project and it should compile, run, debug and in general work just fine with Flash Player 9.0.x.

I was having several issues caused by these mismatched libraries… from the “Illegal override of…” error to being unable to run the project at all, to the project compilling and launching but not running right. It was very frustrating, but once I switched over to the Flex2 libraries that come with CF8 I was up and running just dandy.

Hope this helps!


Hi, I'm Jared

Hi, I’m Jared and I’m a programming addict.

I started my lifelong addiction to programming at the age of 9 when I wrote a sarcastic text-based math game that threatened to call the police on you if thrice you failed to answer correctly. I never did any peeking or poking, but that doesn’t change the fact that I was hooked. I told myself it was OK because I avoided the hardcore stuff, but I was too young to recognize what was really going on. I had a lifetime of coding ahead of me, with no escape.

Later, in my teens I started experimenting with other environments: dBase4 on CPM and then on to the dreaded HyperCard, FoxPro and even FileMaker Pro on MacOS. I was gradually falling deeper and deeper into the dark realm of the Coder, and gradually I was losing more of myself in this world. When FileMaker ceased to be enough of a rush for me, I debased myself and started playing with PowerBuilder and Visual Basic for Applications. I thought it made me cool. I had no idea that my soul was becoming more and more tainted! Eventually even JavaScript wasn’t enough for me and I needed something more. I allowed myself to be given over to this thing called “Internet” and eventually I realized that HTML was just a doorway to something deeper… something far more attractive and interesting.

I found my way to ColdFusion just after it’s 4th revision came out. Apparently version 3 wasn’t doing enough to keep people hooked… though Allaire Corporation seemed to be a benign software dealer, they still kept their products on constant rotation to keep their users from finding other dealers. Once I’d started “playing” with it I was thoroughly hooked. For the next 10 years or so, and even now, I find myself constantly occupied with creating software. I can’t stop myself.

Alagad is a refuge for me. A place where I can succumb to my addiction in a fairly safe environment. They offer exciting programming opportunities and interesting new approaches to what I’ve begun to look at as a lifelong scientific pursuit. Since I’m addicted, I may as well do something productive with it, and Alagad offers me that opportunity. I also have the opportunity to inspire less experienced individuals in the dream that software can make a difference and help guide them to the positive use of their mutation. So I have come to look to my colleagues at Alagad as friends and allies… especially since, in the Tagalog language of the Philippines, “alagad” actually means “ally”.

I look forward to getting more and more involved in the business of Alagad and in the process of improving my skills!

FarCry Training Materials Released

Daemon has released its FarCry 4.0 training course book under Creative Commons for personal use. You can find out more information, and download the PDF here.

In-House Frameworks And The Black Death

Firstly, I will apologize for the delay in my follow on article on Data Warehousing, it is in the works but delayed because I am trying to figure out a ludicrously complex in-house CF coding framework in use by a client I am trying to assist. 

SD Times has been around for a while and I have always found it to be unbiased and objective or at least more so than most.  This article by Andrew Binstock about CF8 was pointed out in an earlier blog post here but I thought it worth expanding on in the light of my years of experience in web application development.

One thing that made me sit up and listen, well read I mean, was the fact that Java Struts or its supposed successor(s) seemed to descend into confusion.  The point that Andrew makes is that many companies out there have web applications that are hard to maintain and/or understand, he puts it this way  – “The cost is significant: Many sites are sitting on reams of legacy code simply because they chose what was once the dominant paradigm.”

In my 8 years with Allaire, Macromedia, Webapper and now Alagad I have literally traveled the world looking at millions of lines of CF Code in no frameworks, home grown frameworks (the worst of all worlds) and recognized-supported frameworks.  After all of this marinating and after listening to developers and end-users I arrived at my own golden-rules for web application development, here they are.

In developing applications we should start at the end and keep focused on the fact that we are delivering a GUI to users to enable them to do something easily and efficiently.  We are not here to experiment with cool new stuff at the expense of users.  Users do not care whether something is “procedural” or “OO”.

We should also assume that the code will need to be maintained and that this will involve troubleshooting.  No matter what the requirements of the application are we should always strive to do this in the simplest most understandable way possible providing that falls in line with acceptable methodologies and frameworks currently used.  Another so often ignored principle; comment code profusely.  As has been stated many times by far greater brains than mine; not only will comments help others they will also help us when we look at what we did 6 months on.

Nothing should ever go into production without Integration Testing (making sure what we just did does not break anything else) and Load Testing (what works really well with one user “us” may fall apart quickly with multiple users – I have seen that many times).

The world of web application development is almost totally disorganized.  For instance we could create a complete application in a single index.cfm in a single directory; there is nothing to stop us doing that.  I have been a firm believer in web application code organization for many years and was firmly behind FuseBox because it made sense to me and has a good user base and had a formal committee which encouraged me to believe it would stay around.  FuseBox in an MVC Design Pattern is still my preferred paradigm.  I absolutely abhor in-house frameworks because they are not necessary and have nothing to do with helping application owners or users of applications.  With FuseBox, Machii and Model-Glue and other items such as Reactor, Transfer, ColdSpring etc there is simply no justification, in my opinion, to create in-house frameworks or methodologies.

From the point of view, for those kind enough to pay me to enjoy myself and create things for them, I genuinely care about what I leave behind, that it delivers what users need/want, that it performs efficiently and above all else is easy to maintain, extend and fix. 

I will finish this post with a repetition of Andrew Binstock’s point – “The cost is significant: Many sites are sitting on reams of legacy code simply because they chose what was once the dominant paradigm.”

I believe It is incumbent on all of us not to let this happen to those kind enough to pay us, even if it means being anarchistic to anyone pushing us to do what we believe to be the wrong thing.  I certainly am and will continue to be so.

Welcome to Alagad, Jared!

As many people may have already noticed, Alagad has hired Jared Rypka-Hauer to join our team. As with the rest of our team, Jared is an exceptional talent and were lucky to have him on board.

For those who don’t already know Jared, he’s the brains and brawn behind the CF.Objective conference and a rabid contributor to the ColdFusion and Adobe Toolset community.

In particular, Jared will help strengthen our (already significant) ability to deliver advanced Flex and Air applications. Jared is also a fantastic resource as far as ColdFusion, frameworks and application architecture are concerned.

As with Alagads other employees, Jared will continue to have a very active role in the ColdFusion community. Expect frequent blogging, talking, training, running of CF.Objective, and more. Before long, I expect Jared to post his first blog entry here as we quickly get him up to speed.

Welcome to the team, Jared!

Doing 'screenshots' in Flex and sending them to ColdFusion

This weekend I was doing some research about capturing ‘screen shots’ of a Flex application, or even specific UI components, and passing the ‘image’ back to the server for processing.

While there are a few ways to do this, I am going to discuss the ‘easiest’. Using the JPGEncoder class packaged as part of the AS3 CoreLib on Google Code. Using this class to encode the data on the client side means that very little needs to be done server side to save the data as an image.

Its fairly easy to use this encoder to create binary data and pass it to CF. I have set up an example here. If you enter some text into the text area inside the panel and click ‘Send Image’, Flex will create a JPG of the panel and send it off to CF.

Here is a look at some of the code, you can also view the source from the Flex application.

First, I import the JPGEncoder class. I store a lot of AS libraries and components in one location and add them to the ‘source path’ of my application.

import com.adobe.images.JPGEncoder;

Next, I create a method that converts a UI component into BitmapData.

function getBitmapData(target: UIComponent): BitmapData {
    var bitmapData: BitmapData = new BitmapData(target.width, target.height);
    var matrix: Matrix = new Matrix();
    bitmapData.draw(target, matrix);
    return bitmapData;

As you can see, this method can take any UI element as an argument. This method returns the bitmap data of the UI element that was passed in.

Next, I create a method that handles calling the above method, and then sends the result to ColdFusion:

function sendImage(target: UIComponent): void {
    var bitmapData: BitmapData = getBitmapData(target);
    var jpgEncoder: JPGEncoder = new JPGEncoder(90);
    var imgData: ByteArray = jpgEncoder.encode(bitmapData);

This method also takes any UI element and uses it when calling getBitmapData(). It also creates an instance of the JPGEncoder class. The ‘90‘ that is passed into the constructor of JPGEncoder is the ‘quality’ of the resulting JPG.

Next we need to create a<mx:remoteObject> to talk to ColdFusion.

<mx:RemoteObject destination="ColdFusion" id="imageService" showBusyCursor="true" source="">
    <mx:method name="saveImage" result="onResult(event)"/>

The CFC itself is very simple, it contains 1 method whose only argument is the binary data that is our image.

<cfcomponent displayname="Image Service" name="Image Service" output="false">
    <cffunction access="remote" name="saveImage" output="false" returntype="any">
        <cfargument name="data" required="true" type="binary"/>
        <cffile action="write" file="c:Tempflex_image.jpg" output=""/>

You will see that inside the method all we do is a <cffile> to write the data to a file.

Lastly, we need some code that will fire off this entire event inside our Flex application.

<mx:Panel height="400" id="panel" layout="absolute" title="My Title" width="400">
    <mx:TextArea bottom="5" left="5" right="5" top="5"/>
<mx:Text text="Enter some text in the text area above and click 'Send Image'"/>
<mx:Button click="sendImage(panel)" label="Send Image"/>

In my online example I have other code that will open a new browser window and show you the image you just captured. You can view the source by right-clicking the application and selecting ‘View Source’.

Using this technique, you can do a screen shot of your entire application, or just individual UI components.

Speaking at Columbus ColdFusion User Group

On September 27th, I will be giving a presentation to the Columbus ColdFusion User Group. The meeting is scheduled for 6:00PM. I am unsure if it will be available via Connect, but will check and post back here.

The presentation will be an introduction to Flex with focus on using Flex with ColdFusion.

On a side note, I will be in the Columbus area from the 27th – 30th for The Gathering of P-51 Mustangs and Legends Air Show. If any CF-ers in the area would like to get together for drinks, dinner or possibly a round of golf (I plan on trying to play on Friday), let me know.

Tag Cloud