Archive for March, 2007

March 29th User Group Presentation

Posted: March 28, 2007 in Apollo, Flash

Hello World,

Technical difficulties (loss of power) caused a rescheduling of this presentation. I apologize to the Nashville User Group member for any inconvenience. We will let you know when this presentation has been rescheduled.

I will be giving a presentation for the Nashville ColdFusion User Group members on Thursday March 29th, 2007. Although I would love to visit Nashville, I will not be presenting in person. I will be connecting with and presenting using Acrobat Connect.

In this meeting I will be presenting a case study of a Flex 2 application I developed for a company in Maryland. I will be talking about the following topics;

  • Lifecycle process of the project
  • Application and Database architecture
  • Select code snippets
  • An Apollo-based application widget

So if you’re in the Nashville area on March 29th stop by the Nashville ColdFusion User Group meeting and catch my presentation. You can get more information about the user group and their meetings by going here: Nashville ColdFusion User Group.

</post>

Advertisements

Hello World,

Apollo Screen

I woke up this morning checking the Adobe Labs as I have been for the past few days. This morning I was presented with a pleasant surprise. The public alpha of Apollo was available. Immediately I dropped everything I was doing and proceeded to download the SDK, runtime, documentation, and the samples. You can also see some great examples of Apollo applications here.

Go get your download and see what everyone is talking about. And don’t forget the download your FREE Apollo Pocket Guide here.

</post>

New Flex 2 Book – A gem of a find!

Posted: March 13, 2007 in Flex

Hello World,

The Essential Guide to Flex 2 with ActionScript 3.0

I go to the bookstore often, always looking for what’s new and what’s up. Barnes and Noble and Borders are my two favorites (after all they are the two largest). As I was browsing the technical bookshelves at Borders I stumbled upon a “gem of a find” … new Flex 2 book! The book read The Essential Guide to Flex 2 with ActionScript 3.0 and like a miner who just found a nugget of gold I immediately grabbed it, looked around to see if anyone was looking, and claimed it as mine. Ok it was a bit extreme but it was the only one on the shelf.

I scanned through the book enough to find that it is geared towards beginner to intermediate Flex 2 developers. As a Flex 2 developer I found it to be below my current skill level. However as a teacher I found that it may be useful as a resource for my upcoming Flex 2 classes. Needless to say, I bought it and it now sits on my desk like a 3-course meal waiting to be devoured.

If you’re interested in finding the book, you can look for it at your local Barnes and Noble or Borders Books. You can also get more information about the book online at the Friends of Ed site. On this site you can view a sample chapter and the book’s contents. The $49 price tag is a little steep but worth it if you, like me, prefer the feel to cold, hard pages. However you may prefer to save a few trees (the snowboarder in me thanks you) and purchase the eBook for $25.

</post>

Hello World,

Last week I was working on a task that required some redirection of the user. I found my solution and was about to blog about it when I started to catch-up on my ColdFusion Weekly podcasts. That’s when I heard that the CF_Quiz for version 2.07 was excatly what my task and blog was about. So I decided, just to be fair, to wait until after the deadline before publishing this article.

Have you ever wanted to know how to redirect an out-of-print web page to another location? You may find that the CFLocation tag does a client-side redirect telling your browser to go to another page. A portion of the HTTP response header would look like this:


HTTP/1.1 302 Moved Temporarily
Content-Type: text/html; charset=UTF-8
location: /anotherPage.cfm
...

However you may quickly find that this is a temporary move. In order to tell the browser that this is a permanent move you need to send a HTTP 301 status code and a location header in the HTTP response of the deprecated web page.

Here is the ColdFusion code that will send the HTTP 301 status code and set the location header:



<cfheader statuscode="301" statustext="Moved Permanently">

<cfheader name="Location" value="https://therush.wordpress.com/2007/03/04/signs-of-apollo/">

<cfabort>

Good Luck

</post>

Hello World,

Could it be just rumor or insider fact? Either way I’m marking March 16th as D-Day (delivery day). Take a look at what PC World has to say:

http://www.pcworld.in/news/index.jsp/artId=5144613

</post>

Hello World,

I’ve built a lot of Flash applications over the past several years of web development. I’ve had my share of including the Flash-based object tag into my ColdFusion templates. Most of the time it was without incident. However, I’m not the greatest typist in the world and copy and paste sometimes has its own issues. So I created a wrapper using ColdFusion Custom Tags and a Javascript library called SWFObject. This wrapper would allow someone who doesn’t know Javascript to add Flash content to any ColdFusion template.

First, a little bit about how SWFObject works. Here’s an excerpt from the blog.deconcept.com/swfobject site:

SWFObject is a small Javascript file used for embedding Adobe Flash content. The script can detect the Flash plug-in in all major web browsers (on Mac and PC) and is designed to make embedding Flash movies as easy as possible. It is also very search engine friendly, degrades gracefully, can be used in valid HTML and XHTML 1.0 documents*, and is forward compatible, so it should work for years to come.

Here’s an example of how you would use SWFObject.


<script type="text/javascript" src="assets/js/swfobject.js"></script>

The code above shows the script block that includes the SWFObject Javascript file. This file contains a library of functions that make all of this work.


<div id="flashcontent1"><strong>You need to upgrade your Flash Player</strong>

    This is replaced by the Flash content.

</div>

The code above defines the section of the page that will contain the Flash content. I can also be used to display information to users that do not have the Flash player installed. So far, so good.


<script type="text/javascript">// <![CDATA[

    var so = new SWFObject("antique-analog-clock.swf", "swfid", "206", "246", "8", "ffffff");

    so.addVariable("myName", "Theo Rushin");

    so.write("flashcontent1");

// ]]>

</script>

The code above contains another block of Javascript code. The first line creates a new instance variable of a SWFObject. I pass several parameters to the method such as; the swf name, an object id, width, height, Flash version, and background color. You can get full details about the method and its parameters by visiting this site – http://blog.deconcept.com/swfobject/.

The next line calls a method of the SWFObject instance variable called addVariable. This method allows me to pass a variable name and value into the Flash movie. Normally this is done using FlashVars.

The last line calls the write method of the instance variable to write the completed Object/Embed tag into the div tag shown in the second code block.


<cfimport prefix="socf" taglib="/cfswfobject/com">

Use CFImport to access the custom tags in the cfswfobject folder.


<socf:swfobjectinit />

Call the swfobjectinit custom tag to initialize the SWFObject functionality.


<cfif thisTag.ExecutionMode EQ 'start'>

    <script type="text/javascript" src="assets/js/swfobject.js"></script>

</cfif>

This is the code from with in the swfobjectinit.cfm file. As you can tell, when the Execution mode for this custom tag is ‘start’ we simply include the swfobject Javascript file. In case you are wondering, “what is this Execution mode?” Take a look at the Adobe LiveDocs to get a full explanation about Creating and calling custom tags.

So how do I call the custom tags to include my Flash movie?


<socf:cfswfobject name="antique-analog-clock.swf" width="206" height="246" version="8" bgcolor="ffffff">
    <socf:sovar varname="myName" value="David Bailey" />
</socf:cfswfobject>

Use the cfswfobject and sovar custom tags to include the Flash movie in the template. As you can see I use the prefix specified in the cfimport tag to refer to the cfswfobject custom tag. I use several user defined attributes to pass values inside the custom tag. I then have a child custom tag that allow me to set a variable name/value that will be passed into the Flash movie.

So what does the cfswfobject custom tag look like?


<cfif isDefined('ThisTag.ExecutionMode')>

    <cfif ThisTag.ExecutionMode IS 'Start'>
    <cfelseif ThisTag.ExecutionMode IS 'End'>

        <div id="flashcontent">

            <strong>You need to upgrade your Flash Player</strong>

            This is replaced by the Flash content.

        </div>

        <cfoutput>

        <script type="text/javascript">

            // <![CDATA[

            var so = new SWFObject("#Attributes.name#", "swfid", "#Attributes.width#", "#Attributes.height#", "#Attributes.version#", "#Attributes.bgcolor#");

            <cfset len = ArrayLen(ThisTag.assocAttribs)>

            <cfif StructKeyExists(ThisTag, 'assocAttribs')>

                <cfloop index="ndx" from="1" to="1">

                    so.addVariable("#ThisTag.assocAttribs[ndx].varname#", "#ThisTag.assocAttribs[ndx].value#");

                </cfloop>

            </cfif>

            so.write("flashcontent");

        // ]]>

        </script>

        </cfoutput>

    </cfif>

</cfif>

I start off my checking the Execution mode for the custom tag. I have an empty cfif block reserved for any functionality I may need later. The real functionality is contained with the cfelseif code block. I output the div block that serves as a holding place for the Flash movie. I then begin a block of Javascript code that does several things.

First I create a variable instance of the SWFObject, passing into its method the values I passed into the custom tag.

Second I get the number of associated attributes I may have for this custom tag. This code along with the code in the child custom tag, sovar.cfm, allow the parent custom tag (this one) access any attributes passed into the child custom tag. The child custom tag receives a varname and value. Those two values are made accessible due to the code in child custom tag.

As I continue through the loop I call the addVariable method of the swfObject instance in order to pass values into the Flash movie.

So what do this sovar.cfm custom tag do?


<cfif ThisTag.ExecutionMode IS 'Start'>

    <!--- Associate local attributes to <cf_cfswfobject> --->

    <cfassociate basetag="cf_cfswfobject">

</cfif>

The most important thing it does is to define a relationship between the child custom tag (this one) and its parent (cfswlonject.cfm). It does this by using the cfassociate tag. We identify the parent tag by specifying it name (using the prefix of cf_) in the basetag attribute.

And that’s it. Now you can simply include those few lines of CF code to safely include your Flash movie.

View a demo of this sample page here.

Download full code here.

Download version 1.4 of the SWFObject Javascript library here or from their site here.

</post>

Hello World,

Mark Piller just posted a facinating blog about the performance and speed differences between using Webservices, HTTPServices, and RemoteObjects in Flex. It should be no suprise that RemoteObjects are faster than the other two. But it was suprising to me just how fast.

Take a look at his blog and sample Flex application that allow you to clock just how various types of RemoteObject calls stack up against WebService andHTTPService calls. Am I saying that we should dump all of our WebService SOAP or HTTPService REST calls? No. Each type of invocation has it’s place. It really depends on the type and scope of the application. In addidtion, it depends on what kind and how much control you may (or may not) have on the remote object.

“A carpenter has many tools in his toolbelt. Each one serves a different purpose in the context of its application” Choose the right tools to get the job done(period)

</post>