08 March 2007

Flash wmode / Firefox: key.isDown() always returns false

If you set wmode when you embed your Flash movie, key presses will not work in Firefox. This is because, in Firefox, Key.isDown() always returns false.

If using wmode, use Key.getCode() instead of Key.isDown()

This post helped me solve the problem:
http://www.johanvanmol.org/content/view/47/41/

13 February 2007

Dreamweaver 8 / IE 7 FTP bug

My computer at work melted recently (literally) and after IT rebuilt it I found all my FTP details for sites in Dreamweaver 8 would go missing every time I reopened it.

This is a bug with the IE 7 "release candidate", which does weird things to registry entries. Here's the Adobe technote:

http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=3491671c

14 July 2006

CFC's - not all that object oriented

I had this cracking idea to store repopulate data in CF flash forms using a cfc and storing it in the session scope, then using a remoting function to broadcast this data so the form fields could data bind to remote service. Didn't quite work.

My cfc basically looked like this:

<cfcomponent>

<cfset this.formData = StructNew() />

<cffunction name="getValues" returntype="remote">
<cfreturn this.formData />
</cffunction>

</cfcomponent>

I instantiated the above cfc in the onSessionStart function:

Session.objFormData = CreateObject("component","formData")

I then used the onRequestStart function to populate the Session based object (as per the previous post):

<cfloop list="#form.fieldnames#" index="item">
<cfset Session.objFormData.formData[item] = Evaluate(item) />
</cfloop>

This works fine and removes the need for an "action" page - just simply copy the form into the session until you need it (a bit wasteful, yes, but really quick code if you're in a hurry!)

You'd think the value returned by "this.formData" would be the data stored in the session instance. Not so... all that was returned was an empty structure! This was essentially the uninstantiated cfc with no data. Doing a cfdump of the session showed that the object and data were still in the session scope, but "this" did not return the values of the object in the session.

Copying form scope into session scope CFMX 7

I've just noticed a weird behaviour with the form scope in CFMX 7. I was trying to copy all the data in the form to a session variable e.g.

Session.formData = StructNew()
Session.formData = form

Do a <cfdump var="#session#"> immediately after that line and you see the form structure inside the session structure. However, I noticed that when I redirect onto another page without form scope, the Session.formData structure was empty - it didn't persist, even though it was copied to the Session scope!?

What must be happening is that a reference to the form scope is copied into the Session NOT the form data. When you move to another page where the form scope does not exist, then the data is not in the Session.

You must loop though form.fieldnames and set the data explicitly, like so:
<cfloop list="#form.fieldnames#" index="item">
<cfset Session.formData[item] = Evaluate(item) />
</cfloop>


I should try and remember to start posting more!

05 April 2006

Should I buy a Mac or PC?

I thought long and hard about this and it really didn't come down to a hardware decision at all. I'd buy a computer that ran on hamsters in wheels if it was easy to use and had all the capabilities I need.

The specs for the latest Toshiba Qosmio dual core machines are very simliar to the MacBook Pro: same CPU, same graphics cards etc., yet they're a few hundred quid cheaper. But with Macs, you get what you pay for: design, simplictiy and well intergrated components. However, I personally think the MacBook Pro is over priced, I don't really like the look of it and the keyboard is too small. It could have been made much bigger if they'd repositioned the speakers and reduced the size of the touch pad.

I've upgraded from a 2.33GHz P4 Sony Vaio notebook (which I'll still use) to the 17" iMac 1.8GHz Core Duo. The iMac is truly great. I don't think any PC would have given me the same feeling of money well spent. I'm converted. Not specifically to Macs, but OS X.

I can get all the apps I need on OS X, plus loads of free downloadable stuff - just like you can on Windows XP (although sometimes the open source stuff is hard to install).

You never know Microsoft could surprise us all in January with Windows Vista - a stable well designed Operating System... but i doubt it. If Steve Jobs had any sense he'd make next version of OS X run on PC's and release it in October 2006.

However, the thing that makes Windows so unreliable is the vast amount of hardware it has to support. OS X is designed for Macs with specific components, but under the cover Macs are looking more and more like PC's.

Still, I reckon the iMac is probably the best computer for its price at the moment.