Sam Farmer head shot

Sam Farmer

Growing up I never imagined I would play bass guitar for the Dave Matthews Band. And indeed it never happened.

But I have become a passionate and pretty good web developer.


bear: ORM text-based diagram

I'm pleased to announce an open-source mini-project that I have been working on to make ORM relationships easier to view. Its called bear.

bear takes metadata from ColdFusion ORM entities and turns it into a readable text-based diagram of the relationships and properties.

Features

  • Works with any entities that a mapping will point to.
  • Option to exclude entities to avoid listing entities that just produce noise (eg, user). Entities are displayed once to prevent circular display problems.
  • Option to show just relationships and ignore properties.
  • A GUI setup process
  • Clicking on a property displays all metadata in a popover

How it works
bear runs as its own application and uses ColdFusion mappings to read entities and their information. Provide all the mappings that your application uses for entities

How to make it work
Download the code somewhere local. Run.

debugClean Version 2

I added a few new features for version 2 of debugClean based on some of the features added to ColdFusion Builder 2.0:

  • Opens in a view.
  • Click on each issue and have the file open up with the line highlighted.
  • The issues are listed in reverse order. This means that when you click on each item and fix it often by removing the line the next issue will be on the correct line.
  • Works on CF and non-CF files.

Check it out and download from RIAForge.

Presentations from RIACon

Here are my two presentations from RIACon:

10 Little Ones: The New Array Features

Adobe ColdFusion 10 brings some improvements to manipulating arrays.

In this example we have two arrays called one and two. A new argument has been added to arrayAppend called arrayConcat that when true will append two arrays together.

one = ["a","c","e"];
two = ["b","d"];

arrayAppend( one, two, true );

writeDump( var=one, label="one after arrayAppend");

one after arrayAppend - array
1 a
2 c
3 e
4 b
5 d

Array one now has all the values. The order seems a little off though. Enter arraySort which as its second argument takes a closure/function where you can write your own sort logic. Basic sorting is straightforward and its nice to have the flexibility to extend it when needed.

arraySort( one, function( a, b ) {
	return ( a > b );
});

writeDump( var=one, label="one after arraySort");

one after arraySort - array
1 a
2 b
3 c
4 d
5 e

In the next example we'll filter the array by writing a closure to return an array with just the letters that are in my name.

filtered = arrayFilter( one, function( val ) {
	if ( reFindNoCase("s|a|m", val ) ) {
		return true;
	} else {
		return false;
	}
});

writeDump( var=filtered, label="filtered");

filtered - array
1 a

Slicing of arrays has also been added with the arraySlice function.

sliced = arraySlice( one, 1, 1 );
writeDump(sliced);

array
1 a

last = arraySlice( one, -1, 1 );
writeDump(last);

array
1 e

Where it makes send these functions also have list and struct equivalents.

10 Little Ones: What are Implicit Accessors?

ColdFusion 10 added implicit accessors and in this post I'll cover how to turn them on and use them.

Turning on implicit accessors is achieved via a straightforward setting in application.cfc:

view plain print about
1component {
2
3this.name = "implicitFun";
4this.invokeImplicitAccessor = true;
5
6}

Once on this means we can now access a getter and setter function of an object/cfc using the same syntax as if it where a struct. Let's look at a simple component called user.cfc:

view plain print about
1component accessors="true" {
2
3property firstname;
4property lastname;
5
6function getFirstname() {
7    return UCase( variables.firstname );
8}
9
10function getName() {
11    return variables.firstname & " " & variables.lastname;
12}
13
14}

Now let's see what happens when we make an object and start interacting with it:

view plain print about
1<cfscript>
2//using the automatic constructor -- there is no init
3
//function in user
4
user = new user( firstname="Homer", lastname="Simpson" );
5
6//calling firstname will run getter function
7
//in CF9 this was user.getFirstname()
8
writeOutput( user.firstname );
9
10/*DISPLAYS:
11HOMER
12*/

13
14//calling name which directly references variables scope does
15
//not call getter function
16
writeOutput( user.name );
17
18/*DISPLAYS:
19Homer Simpson
20*/

21
22//now lets change the name and call it again:
23
user.firstname = "Lisa";
24writeOutput( user.firstname );
25
26/*DISPLAYS:
27LISA
28*/

29
30
31
</cfscript>

As you can see from the code above when you call the implicit accessor on an object it calls the getter or setter function but within a cfc calling the variables scope directly calls the variable and not the getter or setter function.

Speaking at RIACON 2012

I'm delighted to have been asked to speak at this years RIACON — "Back at a better venue". That's my slogan not the official one which doesn't actually exists. RIACON 2012 in its own words:

Where architects and developers of all levels come to gather, share and learn about creating the next generation of web based applications. RIAcon's goal is to help you network with fellow industry professionals and expose you to the best content.

At RIACon attendees can learn the most up to date skills in HTML5, Mobile, Javascript, Flex/AIR, Actionscript, and Server Side Enterprise Architecture.

I'll be speaking on Searching ORM: Why, How and What's New in CF10 and there are many other excellent sessions.

CF Developer Week: 19 Sessions, 5 Days

ColdFusion Developer Week starts Monday June 4th and covers 19 sessions over 5 days. All sessions are presented online using Adobe Connect.

It kicks off with Getting Started with Web Application Development Using ColdFusion presented by Elishia Dvorak and ends with Revamped Scheduled Tasks in ColdFusion 10 presented by Jeff Coughlin.

Along the way there are sessions for beginners and experts covering everything from testing to ORM to PDF's to REST to WebSockets. Check out all the sessions and register.

Searching ORM: First Why, Then How -- Slides from cf.Objective()

Thank you to everyone who came out to my presentation on Searching ORM at cf.Objective().

Here are the slides

ColdFusion 10 is Released!

Its out of beta and up for grabs...ColdFusion 10 has been released! (I make a small appearance in the intro video as well.)

I wrote about ColdFusion 10 back in February read my thoughts.

Crack your laptop open, we'll crack a beer at the Hackathon

My buddy, Adam Tuttle, has organized a Hackathon at cf.Objective() to code for his CFScript Community Components project. The hackathon is taking place at 7pm on Friday. That sounds like a time when its better to have a beer in hand. So, I spoke to some good people at Adobe and they agreed to buy everyone who participates a drink!

So, come along, crack open your laptop and make ColdFusion better and we'll crack open a beer, or drink of preference, for you!

More Entries

BlogCFC was created by Raymond Camden. This blog is running version 5.9.7. Contact Blog Owner