|
Norwegian speaking ColdFusion Develpment Role! |
The other day this role came up:
http://www.cwjobs.co.uk/JobSearch/JobDetails.aspx?NoExpire=1&JobId=42975395
2Salary: Market Rate
3Company: Xchanging Resourcing Services
4Job type: Contract
5Date posted: 27/01/2009 17:28:45
6
7ColdFusion Developer sought for client in Oslo/ Norway. The project will mainly involve development of existing DropBox solution with add-on functionalities specific for the client. The product needs further development in order for it to receive electronic invoices which will be controlled and sent on to different recipients which require different file formats. Ideal candidates for this role should have 3-6 years experience in ColdFusion as well as good knowledge of electronic development of sales documents. Candidates applying must be eligible to work in Norway and speak/ write fluent Norwegian.
8
9Contact: Erika Bernstedt
Having spent my teen years in Normay, this is pretty much the ideal ColdFusion development job for me! Its a shame its contract though.
|
Returning useful error messages from CFC's in Flex |
One thing I've learnt from my flex to CFC tomfoolery is that sometimes flex doesn't diplay very good error messages from CFC's. This is no fault of flex, but more usually a problem with the interface between it, and CF, as most of the unfriendly error messages you get are http error strings, which usually get truncated as they are raw code, so you don't get to see the problem then either.
So you need more elegant error handling in your CFC's. (or whatever back end your using)
Here is a complete script as an example, we will go through it line by line:
2
3
4 <cffunction name="selectRecords" hint="Returns a query object based on an id" access="public" output="false" returntype="Any">
5 <cfargument name="id" required="true" type="String" hint="An id to use in the query below">
6
7 <cfset var message = "">
8
9 <!--- TRY the transaction below, throw a catch message --->
10 <cftry>
11
12 <cfif NOT isNumeric(arguments.id)>
13 <cfset message = "Id was not a number">
14 </cfif>
15
16 <cfquery datasource="#application.dsn#" name="qGetRecordById">
17 SELECT id, name, age, sex, telephone, mobile, address, postcode, county, country
18 FROM memberTable
19 Where id = #arguments.id#
20 </cfquery>
21
22 <cfcatch>
23 <cfthrow message="cfcatch.message">
24
25 <cfreturn message>
26 </cfcatch>
27
28 </cftry>
29
30 <cfreturn qGetRecordById />
31 </cffunction>
32</cfcomponent>
So its a normal component, with one function, it accepts an 'ID' and performs a query, and returns it.
I am setting a local variable at the top, 'message' that will only be created and used inside the scope of the CFC. Then we will 'TRY' and do our transaction. At this point I'm wrapping everything in the cftry tag so as to encapsulate any possible code errors or logic faults.
Any logic I have here will replace the value of 'message' if proven to be false, and return that message rather than the query object I was expecting.
But you'll notice the lines:
2 <cfthrow message="cfcatch.message">
3
4 <cfreturn message>
5 </cfcatch>
This will catch any errors from the try block, and throw them to flex. In this way flex receives the message in the throw command, not a http response message when the CFC breaks.
This is obviously a Coldfusion - CFC specific example, but I've seen very similar error trapping in php, working in exactly the same way, so it really doesn't matter what back end your using with flex.
|
ActiveCrossSelect custom tag |
In several previous projects I've had cause to be moving data from one list to another. Rather than creating a form, with a list, I'd wanted a more elegant solution, so I 'found' a really handy custom tag that doesn't seem to have had much press.
Its fairly old, but does a great job of creating two text areas, and allowing a user to move data between them.
ActiveCrossSelect is the custom tag. I like it, you will to :-).
I didn't write it, it was written by 'Vitaliy Shevchuk', so all credit there.
View a test script here.
Download the Rar archived version here.
2 left_name = "left_C1"
3 right_name = "Right_C1"
4 valuesleft = ""
5 valuesright = "1,2,3,4,5,6,7,8,9,0"
6 textleft = ""
7 textright = "11,22,33,44,55,66,77,88,99,00"
8 formname="form1"
9 width="250"
10 sizeleft = "7"
11 sizeright = "7"
12 headleft="Left Text 1 "
13 headright="Right Text 1"
14 onChange="alert(oh);"
15 quotedlist = "No"
16 JS = "ActiveCrossSelect.js"
17 >
|
Calling Component methods in one function call |
Sometimes I want to return a data object from a specific method within a cfc, but in one hit. Why code an object creator, then a call to a method in that object, when you can do it in one go.
In the code above I am creating a variable "variables.myFuseBox". This becomes the return data from the object "myFuseBox" which is invoked with the createObject command. I am then passing the ".init" command to reference the "init" method in the CFC.
Lastly I'm passing in a list of arguments to the init method in the standard way.