Archive for December, 2007

App one of fiftytwo posted

Posted: December 31, 2007 in AIR, Flash, Flex

Hello World,

I posted on my site (FiftyTwo Apps) some of the preliminary information for the first of what will be many smal apps. I call it the FlexTimer.



FiftyTwo Apps is a Go!

Posted: December 30, 2007 in Adobe, AIR, ColdFusion, Flash, Flex, SQL

Hello World,

Ever year so many people make New Year’s resolutions. Well I am no exception. This year I have dedicated myself to create fifty two apps. And thus was born the FiftyTwoApps web site.

For the next fifty two weeks I will create fifty two apps – from conception to completion, from design to delivery. You will be able to follow my progress as I design, develop, document, test, and deliver each app to … well, all of you. I will make available the full source of each app, a summary of each of the development tasks, time spent on each task, resources used, and lessons learned. Every Monday I will begin work on a new app and one week later, by Sunday at midnight, I will upload the completed app onto the FiftyTwoApps web site. During the week I will publish my progress on the site so you can see where I am in the process.

So visit the site often – if you wish. Starting Monday December 31st I will begin the first of the fifty two apps,
the FlexTimer. I hope to see you there. The next fifty two weeks will be a wild ride.


Hello World,

I read a very interesting post today from Rich Tretola on his Everything Flex blog about creating an AIR AlertWindow Component (Toast Style). Go on over to his blog and take a look. It has some very useful material. I decided I would learn from his example and attempt to incorporate what he’s done into something I was doing. I ran into a few obstacles but a few posts later I came up with another version of the AS class he created. I give my thanks to him and Josh (another developer who commented on Rich’s blog) for helping me with what I am presenting below:

Here is the modified class:

    import flash.utils.Timer;

    import mx.containers.Canvas;
    import mx.controls.Button;
    import mx.controls.TextArea;
    import mx.core.Window;

    public class AlertWin extends Window
        private var _showTimer:Timer;
        private var _delayTimer:Timer;
        private var _hideTimer:Timer;

        private var _delayTime:int;
        private var _message:String;
        private var _width:int;
        private var _height:int;

        public function AlertWin() {
            this.maximizable = false;
            this.resizable = false;
            this.minimizable = false;

            // alternate, none, standard, utility
            this.systemChrome = "none";

            // lightweight, normal, utility
            this.type = "lightweight"

            this.addEventListener(FlexEvent.CREATION_COMPLETE, completeHandler);

        public function completeHandler(event:FlexEvent):void {
            this.nativeWindow.x = flash.display.Screen.mainScreen.bounds.width - (this.width + 20);
            this.nativeWindow.y = flash.display.Screen.mainScreen.bounds.height - 20;

            this.horizontalScrollPolicy = "off";
            this.verticalScrollPolicy = "off";

            _showTimer = new Timer(10,0);
            _showTimer.addEventListener("timer", showTimerHandler);

        public function show(message:String, title:String = "", delayTime:int=2, width:int=200, height:int=150): void {
            _delayTime = delayTime;

              this.width = width;
               this.height = height;

            var cnv:Canvas = new Canvas();
            cnv.width = width;
            cnv.height = height;
            cnv.horizontalScrollPolicy = "off";
            cnv.verticalScrollPolicy = "off";

            var ta:TextArea = new TextArea();
            ta.text = message;
            ta.width = width;
            ta.height = height;

            var btn:Button = new Button();
            btn.label = "My Message";
            btn.setStyle("right", "5");
            btn.setStyle("bottom", "45");




        private function showTimerHandler(event:TimerEvent):void {
            this.nativeWindow.y -= 10;

            if(this.nativeWindow.y <= (flash.display.Screen.mainScreen.bounds.height - (this.nativeWindow.height + 10))){

                _delayTimer = new Timer(1000,_delayTime);
                _delayTimer.addEventListener("timer", delayTimerHandler);

        private function delayTimerHandler(event:TimerEvent):void {
            var t:Timer = Timer(;

            if(t.currentCount == _delayTimer.repeatCount){
                _hideTimer = new Timer(20,999);
                _hideTimer.addEventListener("timer", hideTimerHandler);

        private function hideTimerHandler(event:TimerEvent):void {
            if(!this.nativeWindow.closed) {
                this.nativeWindow.y += 10;

                if(this.nativeWindow.y >= (flash.display.Screen.mainScreen.bounds.height-20)){
            } else {

And here is my implementation;

<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="" layout="absolute" creationComplete="init()">

            import AlertWin;

            private var myAlertWin:AlertWin = new AlertWin();

            private function init():void {
      "My Alert Message\nLine 2");

Thanks Guys!Ciao

Resetting your CF Admin password

Posted: December 13, 2007 in ColdFusion

Hello World,

If you are anything like me you can’t wait until passwords are replaced with biometric authentication.

Geek Phrase of the Day:

Biometric authentication is the verification of a user’s identity by means of a physical trait or behavioral characteristic that can’t easily be changed.

However until that day we need to rely on our own “grey matter” to remember the dozens of username/password combinations. Thus the reason for this little tip.

You can reset your ColdFusion Administrator password by following these easy steps (works for ColdFusion 6 MX, ColdFusion 7 MX, and ColdFusion 8):

  • Stop the “ColdFusion MX Application Server” Service.
  • Open the “neo-security.xml” file contained in [your cf install root]\lib.
  • Find the line: “<var name=’’><boolean value=’true’/></var>”, change the true to false, and then save the file.
  • Restart the “ColdFusion MX Application Server” Service.
  • Go into the ColdFusion Administrator again and set a new password.

Remembering Passwords Rule Number 5: If it takes you longer than 60 seconds to think of a password you probably won’t remember it.

Remembering Passwords Rule Number6: Don’t. Get RoboForm. It remembers the passwords for you and you can place it on a USB drive to carry it with you – no matter where you go.

now what’s that Italian word for see ya … 🙂

Hear Ye! Hear Ye! The Beta 3s Are Here!

Posted: December 13, 2007 in Adobe, AIR, Flex

Hello World,

Adobe comes through once again!

Adobe has just released updates for two of my favorite development technologies, Adobe Flex Builder 3 and Adobe AIR.

Adobe has released Beta 3 (M4) of Flex Builder 3, their final public prerelease version. A Beta 3 version of the Flex Builder 3 Eclipse plug-in was also released. Although you can have both Flex Builder 2 and 3 on your system, it is (highly) suggested that you do not install Flex Builder Beta 2 on top of Flex Builder 2. You should also remove any previous version of Flex Builder 3 before installing this new version.

Adobe has also released Beta 3 of the Adobe AIR SDK and Runtime but beware, your existing AIR applications may not run properly when using the new beta. They also released updated documentation for Flex, Flash, and HTML developers.

Another item of note is the release of BlazeDS Beta 1. Previously available as part of Adobe LiveCycle Data Services, the technologies that made up BlazeDS and the Action Message Format (AMF) protocol specification as now available on Adobe Labs.

So go to Adobe Labs ad get your “update fix” and enjoy the Holidays!


Hello World,

I must give props to Jeff Price for suggesting a way to improve the code I published in my previous post. Here is the improved function:

<cffunction name="arrayValsToBitFlags" access="private" output="false" returntype="numeric">
	<cfargument name="myArray" type="array" required="yes"> 

	<cfset total = 0>

	<!--- loop over array --->
	<cfloop from="1" to="#ArrayLen(myArray)#" index="myIndex">

		<!--- if the the array item has a length or use your own criteria --->
		<cfif Len(myArray&#91;myIndex&#93;)>

			<!--- use powers of two to set the appropriate bit and add to the rest. Remember CF arrays start at 1 so subtract that! --->
			<cfset total += 2^(myIndex-1)>

	<cfreturn total>

And here is an example how you would use it:

<cfset myArgs = &#91;"1","","Hello","World",""&#93;>
<cfset total = arrayValsToBitFlags(myArgs)>

As you can see his version is much improved as it doesn’t require you to pass into the function a number value. Also, passing in an array makes the function call shorter and easier to read. Thanks Jeff!Ciao

Hello World,

Here’s an alternative to those complex CFif/CFelseif statements in your ColdFusion code.


Today I was working on a portion of a web site that required the system to perform certain functions based on the existence or non-existence of data in four different variables. Since there are four variables involved in this equation that means that there are 16 different combinations (check my math, please). I think you can imagine the nightmarish nested CFif/CFelseif monster statement that can be constructed from such possibilities.


My first step was to map out all of the possible combinations by creating what I call a logic matrix. I was simply a worksheet with each of the four variables listed across the top. Down the rows I shaded the cells that would contain a value in each of the combinations.

I then gave each column a number; 1, 2, 4, 8. i wanted to follow binary numbering to insure that the sum of each row is unique.

I then analyzed each row and determined what process would occur for each combination. Take a look at my screenshot to get an idea of what I mean.

my logic matrix

At this point I am ready to implement my code!

First, I created a CFC function that takes a string variable and it numeric value. The function evaluates the string value to determine if it’s empty or not. Should the string variable be empty a zero value it returned. However should the string variable be non-blank the passed-in numeric value is returned. Take a look at the code shown below:

<cffunction name="evalStringToNumber" access="private" output="false" returntype="numeric">
	<cfargument name="myStrVal" type="string" required="yes">
	<cfargument name="myResVal" type="numeric" required="yes">

	<cfset result = 0>

		if(Len(Trim(Arguments.myStrVal)) GT 0) {
			result = Arguments.myResVal;

	<cfreturn result>

Now on to the calling function!This is the main function that takes the four variables and will return a string indicating the process to run. First take a look at the code below:

<cffunction name="doSomething" access="public" output="false" returntype="string">
    <cfargument name="valOne" type="string" required="yes">
    <cfargument name="valTwo" type="string" required="yes">
    <cfargument name="valThree" type="string" required="yes">
    <cfargument name="valFour" type="string" required="yes">

    <cfset processToComplete = "">

    <cfset total =    evalStringToNumber(Arguments.valOne, 1) +
                    evalStringToNumber(Arguments.valTwo, 2) +
                    evalStringToNumber(Arguments.valThree, 4) +
                    evalStringToNumber(Arguments.valFour, 8)>

    <cfswitch expression="#total#">
        <cfcase value="15,14,12" delimiters=",">
            <cfset processToComple = "Process 1">
        <cfcase value="11,9" delimiters=",">
            <cfset processToComple = "Process 2">
        <cfcase value="4,13,5" delimiters=",">
            <cfset processToComple = "Process 3">
        <cfcase value="7" delimiters=",">
            <cfset processToComple = "Process 4">
        <cfcase value="6" delimiters=",">
            <cfset processToComple = "Process 5">
        <cfcase value="3,1" delimiters=",">
            <cfset processToComple = "Process 6">
        <cfcase value="0" delimiters=",">
            <cfset processToComple = "Do Nothing">

    <cfreturn processToComplete>

This function can work any way you want but the two most important aspects of this function are;Calling the evalStringToNumber function, passing it the variable, and its numerical value. Remember that logic matrix? Look across (or imagine) the top row containing your variable names and use the numbers you wrote for each of them. The CFSET variable assignment will sum the value of each of the evalStringToNumber function calls.Now construct your CFSWITCH/CFCASE statement to contain all the different processes that will be called based on the value of total. Each combination on the worksheet should correspond to a CFCASE statement.An that’s it!As you can see the code here is so much easier to read than the alternative. With proper documentation (in the CFC and hard copy) one can easily make modifications to the existing code.Future:

I can imagine many improvements to the code shown above (and I’m sure you can too). For example, one can create a function that evaluates the string variable based on a specific passed-in value – not just blank/non-blank.

If you have any suggestions or comments feel free to contact me – We all benefit from the wisdom of many.