David Harris's Technology Blog

ColdFusion, Flex, and other stuff...   (and 323,446 hours, 25 mins in to my plan for global domination)

Search:

Calendar:

Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    

Subscribe:

Enter your email address to subscribe to this blog.

Archives By Subject:

Tags:

adobe air ajax cfug coldfusion flash flex frameworks free software fxug general jpgmetadatareader mac off topic opensource papervision spry

Recent Entries:

Top Posts:

Recent Comments:

Top Commenters:

My Links:

RSS:


Adventures in jQuery

The last week or so I've had the pleasure of working deeply with jQuery.

And I mean that, it's been a pleasure.

Once you get used to the 'style' of how it works, it makes sense and has a consistent coding experience.

I've worked mainly with the core and the ui.jquery libraries, with fileupload thrown in. In the mix is also , and they have all played together nicely (so far!)

I've got jQuery adding and removing custom DOM elements on the fly, while updating information on the server, uploading and deleting images and also maintaining the structure of the form so that when it is submitted in the usual "post" manner, the server knows what to do with the data it receives.

So all in all I've had a good experience with it.

Things it has helped me understand is the use of "anonymous Functions" (I think that is what they are called)

EG:

$("#myelement").hide();
will hide the element with the id of "myelement"

now the "hide" method will accept an argument of a function that it will call when it has completed. Commonly called a "callback", so i we had a function like this:

function alertme(){ alert('me'); }
you could call that function when hide was complete like this:
$("#myelement").hide( alertme );
so the function has the name "alertme", so is not anonymous.

To use an anonymous function to do the same thing, this is what you would do:

$("#myelement").hide( function(){ alert('me'); } );

You can also do this in Flex.

eg:

rather than:

addEventListener( "SomeEvent" , someFunction );
You can go:
addEventListener( "someEvent" , function( event: Event): void { [do stuff here] } );
While you can put as much in you function as you like, I did find it makes code a bit hard to read.

One thing that works, but somehow feels wrong, is that the anonymous functions have direct access to the variables declared in the calling function.

eg:

function myFunction()
{

   var someString = "bob";
   $("#myelement").hide( function(){ alert( someString ); } );

}
This seems to be true of both JS and AS. I guess this is because the function itself belongs to the function it is being called in, so has access to the variables called in there...

So all in all I've enjoyed getting to know jQuery, and suspect it's the beginning of a beautiful friendship!

...but, I still prefer Flex!

CF8 Ajax Goodness - Ray Camdens Recording

Tonight we had the honor of Ray Camden staying up till 1am his time to present to us @ 6pm NZ time.

The meeting was the NZ ColdFusion UG June meeting, and the topic was CF8 Ajax Goodness

After a couple of technical issues (involving screen issues and incorrect Connect meeting rooms on my part...*cough*) we got the meeting under way.

Ray, as always, gave a great presentation which promoted good discussion in the group afterwards.

So a big thanks to Ray for his continued giving of time and energy to the community!

The recording URL is https://admin.adobe.acrobat.com/_a200985228/p21985414/ and I have also added it to UGTV

Enjoy!

ColdFusion 8.0.1 fixed my bug!

I while ago I logged a bug for the first time with in ColdFusion 8.

Here is the entry about it.

While looking over the 8.0.1 release notes I decide to check...

and yes, at the top of page 15, bug number 70594 has been addressed! Thank you!

Transfer 1.0 ORM is released!

Just noticed this on a mailing list:

Transfer 1.0 Release Candidate - Out Now!

Well done Mark!

Mark presented to the NZCFUG last year on TransferORM.

I'll be downloading Transfer 1.0 soon to have take it for a spin!

ColdFusion Error: can't load a null

I was working with a CFC today and ColdFusion threw this error at me:

can't load a null

There was no more information than that...

I'm not sure why is this error happens, but I did work what is causing it...

If you define a function that has an argument that has a default that is a variable or function with the same name as any of the arguments, this error is thrown.

You don't even need to call the function, you just need to define it.

Create a .cfm or .cfc and put this function in it:

<cffunction name="someFunction">

   <cfargument name="myValue" default="#myValue#">

   <cfreturn false>

</cffunction>

The error is occurring when ColdFusion is parsing the code, and not running it.

Weird eh?

I'm off to http://www.adobe.com/go/wish now to log a bug (all-be-it an obscure odd one...)

I know what DSL is now, thanks to Peter Bell!

Last Thursday at the NZ CFUG group we tried something new.

For the first time we watched a recording of a Connect meeting and had discussion about it once it finished.

After voting by the CFUG members for the topic, "Practical Code Generation" by Peter Bell was chosen.

About this Presentation (taken from UGTV):

A 20-30 minute preview session of my full session where we'd learn how to generate your applications in a fraction of the time by using the latest techniques proven to reduce application development times - from Software Product Lines to Domain Specific Languages.

The meeting was given to the "Online ColdFusion User Group" a couple of months back.

I've heard the phrase "Domain Specific Languages" (DSL) thrown round a bit and generally I nodded my head hoping the person using it wouldn't ask me about it, as I didn't really know what it meant...

In the presentation Peter took some pains to explain what a DSL is and how they can be used in code generation.

I found it to be a highly information presentation, so kudos to Peter Bell for this and also Charlie Arehart for running (and recording) the meeting

The link to the recording is here: https://admin.acrobat.com/_a204547676/p26665304/, so have a look when you get a chance!

PS: there can *never* be enough TLA's in the world! *NEVER*!

What do *you* want in ColdFusion9?

Rupesh Kumar (a member of the ColdFusion engineering team) has just blogged about surveys for input on the next version of ColdFusion!

Go here - http://coldfused.blogspot.com/2008/01/adobe-coldfusion-survey.html to find the surveys and give the CF team some good ideas on the next version of CF!

www.coldfusioncommunity.org - 'ave a look

Props to Nick Tong for setting up http://www.coldfusioncommunity.org/

If you think of yourself as a CFer, sign up! My profile is here

It'll be interesting to see how this developes in the days ahead...

Need a throw-away random String? Don't use createUUID()!

In the past when I need a random string for something, I have used the createUUID() function and modified it as required.

This is slow.

I think the reason this is slow is because it's not a "random" string, but a "unique" string.

From the Docs:

Creates a Universally Unique Identifier (UUID).

I ran this code:

<cfloop from = "1" to="5" index="iCount">
   <cfoutput>#createUUID()#</cfoutput><br />
</cfloop>

and got:

1330544F-C09F-F023-3B5732BB3AB1E6FC
1330546E-C09F-F023-3B427B03747AD651
1330547E-C09F-F023-3B32F655A3898333
1330548D-C09F-F023-3B272F4E96E41BED
1330549D-C09F-F023-3B342477C11A9E36

From this it is obvious that while each of those strings are Unique, they are not random. So I am guessing that the algorithm used is based on the time of the server and some randomness.

It was taking about 1.5 - 2 seconds to run this code:

<cfloop from = "1" to="100" index="iCount">
   <cfset createUUID()>
</cfloop>

As all I needed was a random string that I was not planning to use again, I came up with this:

#hash( rand() )#
that was a lot quicker. Creating 100 of those took 15ms or less.

I ran the code below(which took about 3secs), and got NO duplicates, so it's random enough for me!

<cfset stData = structNew()>
<cfloop from = "1" to="100000" index="iCount">
   <cfset randValue = "_#hash( rand() )#">
   <cfif structKeyExists( stData , randValue )>
      <p>Found it! <cfoutput>#randValue#</cfoutput></p>
   </cfif>
   <cfset stData[ randValue ] = "">
</cfloop>

I wouldn't recommend using this as a prim key in a DB table, but it does what I need if for!

CFCamp - Australia sign up

Following up from my previous post about CFCamp, the sign up for the event has baan posted.

Go to http://cfcamp.eventbrite.com/ to sign up!

PS: Still working on the New Zealand Connection!

What version of Flash player does cfpresentation require?

This is a question I had, so, doing what all good developers do, I looked in the documentation.

Didn't find it there.

The next step a good developer does is ask the holder of knowledge, Mr Google. He didn't know either...

Third step, inspect the generated code...

The generated code uses a .JS file called "loadflash.js", which has the code snippet:

object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,65,0" width="'+w+'" height="'+h+'" id="SlideContent" align="" VIEWASTEXT>

note the: "version=6,0,65,0"

so the answer to the question: What version of Flash player does cfpresentation require?

would be: 6+ :-)

More Entries