Watch Ben Forta speak about ColdFusion Builder at CFUG-NL

25 03 2010

Thanks to Kjeld Kahn you can now watch Ben Forta’s presentation about ColdFusion Builder, at the Ducth ColdFusion User Group on March 10, 2010 in Amsterdam. Enjoy!





Video of my Ant presentation at CFUGNL

12 03 2010

Thanks to Kjeld Kahn you can now watch a video of my entire Ant presentation at the Dutch ColdFusion User Group on March 10, 2010. You can find the video here.





My Ant presentation for the Dutch ColdFusion User Group

11 03 2010

Yesterday I did a presentation about build automation with Ant, for the Dutch ColdFusion User Group. The presentation included two live demos. I am glad to say everything worked as expected during my talk. I hope to have conveyed the message that ColdFusion developers can indeed benefit from build automation, by increasing efficiency during development, reducing deployment stress and improving software quality.

If you missed the presentation, or want to take another look, you can download my slides here. If you want to try out Ant and/or CruiseControl, I have made the demo-app from my presentation available for download. Also I have made available an Amazon EC2 AMI, with a CruiseControl server plus the demo-app installed, for you to play around with. For details on how to obtain the demo-app + AMI, and instructions on how to get started, you can go to the project’s Wiki page.  Enjoy! And please let me know what you think!





Any questions about ColdFusion and/or statistics?

2 04 2009

If you have any questions about ColdFusion and/or statistics, please feel invited to ask me on martijnvanderwoud   @   gmail.com. I will provide clear and helpful answers where I can on this weblog. And where my expertise is insufficient I can probably help you find someone who knows!

I think this can be a fun way of ‘forcing’ myself to blog more often. :) Fire away!





A new job!

3 03 2009

Just a quick post to let everybody know that I have a new job. Starting April 1st, I will be working as senior web developer at Kapaza! Kapaza! is the leading classifieds site in Belgium. With over 200.000 unique visitors each day, the scale of this site is definitely going to offer new challenges. I am thrilled to join a highly technical work environment where I can be a hardcore software developer. I cannot wait to dive in!

Of course I am also leaving a wonderful employer. Being a member of the R&D team of Orga-Toolkit was my first bonafide job. I witnessed the company grow from two (my boss and me) to currently thirteen workers. In many aspects, the past four and a half years have been a rollercoaster. I feel incredibly lucky to have had so much opportunity for experimentation, for the chance to learn so many new things, and – most importantly – for the privilige to work with one of the most enthousiastic, talented and wonderfully joyful set of people I’ve ever come across. You will not be forgotten!





A UDF for sorting arrays of beans (instantiated CFC’s), or arrays of structures

27 09 2008

A while a ago, I posted a discussion about different ways to represent complex data, and a UDF to sort arrays of structures on multiple keys. After reading this post, Brian Fitzgerald asked me if I knew of any UDF that could provide the same kind of functionality for an array of beans (instantiated CFC’s). This made me realize that my blog post had omitted perhaps the most useful way of representing complex data in ColdFusion (version 6 and up): ColdFusion Components!

This is not the place for an in-depth discussion of CFC’s, but if you are interested I can recommend this introduction by Hal Helms. For me, the essential advantage of CFC’s is, that they provide the possibility to encapsulate both data and functionality inside one object(variable). This makes it possible for CFC’s to represent real-life objects more naturally than any other CF datatype. CFC’s also provide great possibilities for writing re-usable and portable code, because they can contain the logic that is necessary to handle the specific data they are holding.

As for Brian’s question, it inspired me to improve my sorting UDF, so that now it is able to sort arrays of objects, the object being either instantiated CFC’s (beans), or structures. The UDF, together with two usage examples, can be downloaded here. The code of the examples is shown below .

<!--- Example: sorting an array of instantiated CFCs --->
<!--- Note: this templates depends on person.cfc being in the same folder --->
<!--- Include UDF template --->
<cfinclude template="sortArrayOfObjects.cfm">
<cfscript>
//EXAMPLE USAGE:
//an array of 4 persons, with three properties...
variables.persons = arrayNew(1);
variables.person = createObject('component','person');
variables.person.setName('Martijn');
variables.person.setAge(29);
variables.person.setWeight(78);
arrayAppend(variables.persons, variables.person);
variables.person = createObject('component','person');
variables.person.setName('Jelle');
variables.person.setAge(29);
variables.person.setWeight(85);
arrayAppend(variables.persons, variables.person);
variables.person = createObject('component','person');
variables.person.setName('Lammert');
variables.person.setAge(51);
variables.person.setWeight(78);
arrayAppend(variables.persons, variables.person);
variables.person = createObject('component','person');
variables.person.setName('Bas');
variables.person.setAge(51);
variables.person.setWeight(78);
arrayAppend(variables.persons, variables.person);
// specify how to sort:
// first on age - descending
// second on weight - ascending
// third on name - ascending
variables.sortkeys = arrayNew(1);
variables.sortKey = structNew();
variables.sortKey.keyName = "age";
variables.sortKey.sortOrder = "descending";
arrayAppend(variables.sortKeys, variables.sortKey);
variables.sortKey = structNew();
variables.sortKey.keyName = "weight";
variables.sortKey.sortOrder = "ascending";
arrayAppend(variables.sortKeys, variables.sortKey);
variables.sortKey = structNew();
variables.sortKey.keyName = "name";
variables.sortKey.sortOrder = "ascending";
arrayAppend(variables.sortKeys, variables.sortKey);
// do the sorting
variables.persons_sorted = sortArrayOfObjects(
arrayToSort = variables.persons,
sortKeys = variables.sortKeys,
doDuplicate = false,
useGetterMethods = true);
</cfscript>
<h3>Unsorted:</h3>
<cfloop from="1" to="#arrayLen(variables.persons)#" index="variables.i">
<cfset variables.person = persons[variables.i]>
<cfoutput>
<p>
Position: #variables.i# <br />
Age: #variables.person.getAge()# <br />
Weight: #variables.person.getWeight()# <br />
Name: #variables.person.getName()# </br>
</p>
</cfoutput>
</cfloop>
<h3>Sorted:</h3>
<cfloop from="1" to="#arrayLen(variables.persons_sorted)#" index="variables.i">
<cfset variables.person = persons_sorted[variables.i]>
<cfoutput>
<p>
Position: #variables.i# <br />
Age: #variables.person.getAge()# <br />
Weight: #variables.person.getWeight()# <br />
Name: #variables.person.getName()# </br>
</p>
</cfoutput>
</cfloop>

<!--- Example: sorting an array of structures --->
<!--- Include UDF template --->
<cfinclude template="sortArrayOfObjects.cfm">
<cfscript>
//     EXAMPLE USAGE:
//an array of 4 persons, with three properties...
variables.persons = arrayNew(1);
variables.person = structNew();
variables.person.name = 'Martijn';
variables.person.age = 29;
variables.person.weight = 78;
arrayAppend(variables.persons, variables.person);
variables.person = structNew();
variables.person.name = 'Jelle';
variables.person.age = 29;
variables.person.weight = 85;
arrayAppend(variables.persons, variables.person);
variables.person = structNew();
variables.person.name = 'Lammert';
variables.person.age = 51;
variables.person.weight = 78;
arrayAppend(variables.persons, variables.person);
variables.person = structNew();
variables.person.name = 'Bas';
variables.person.age = 51;
variables.person.weight = 78;
arrayAppend(variables.persons, variables.person);
// specify how to sort:
// first on age - descending
// second on weight - ascending
// third on name - ascending
variables.sortkeys = arrayNew(1);
variables.sortKey = structNew();
variables.sortKey.keyName = "age";
variables.sortKey.sortOrder = "descending";
arrayAppend(variables.sortKeys, variables.sortKey);
variables.sortKey = structNew();
variables.sortKey.keyName = "weight";
variables.sortKey.sortOrder = "ascending";
arrayAppend(variables.sortKeys, variables.sortKey);
variables.sortKey = structNew();
variables.sortKey.keyName = "name";
variables.sortKey.sortOrder = "ascending";
arrayAppend(variables.sortKeys, variables.sortKey);
// do the sorting
variables.persons_sorted = sortArrayOfObjects(
arrayToSort = variables.persons,
sortKeys = variables.sortKeys,
doDuplicate = false,
useGetterMethods = false);
</cfscript>
<h3>Unsorted:</h3>
<cfdump var="#variables.persons#">
<h3>Sorted:</h3>
<cfdump var="#variables.persons_sorted#">





It looks like a minus but it is not: \u2013

24 09 2008

Today a colleague came to me with a rather curious error. He had made a UDF, containing the following line of code:
ZS = (arguments.rawScore – arguments.mean) / arguments.SD;
All referenced arguments existed (we checked that multiple times :) ) and – as you may see, the expression structure seems to be valid (the UDF was written in cfscript).

Still, calling the UDF consistently resulted in the following error:

Invalid CFML construct found on line XX at column XX.

ColdFusion was looking at the following text:

\u2013

After a few minutes of astonishment another colleague suggested to take a good look at the character at the position reported in the error message. This turned out to be the  – in the above line. Nothing seemed wrong with it, but replacing it with a – turned out to fix the problem.

Huh? I could not see the difference either, but the original – had been copied and pasted from a MS Word document, and in fact was not a minus but a unicode ‘EN DASH’ (U+2013). This character is not a minus so ColdFusion was correct in reporting the error. Apparently MS Word had figured out that my colleague actually meant to write an ‘EN DASH’ when he pressed the minus key on his keyboard. Just another reason not to use MS Word to wite down code. Not even short snippets of code, as part of taking notes in a discussion!








Follow

Get every new post delivered to your Inbox.