Just got back from our 2nd East Bay CFUG meeting at our new location (New Horizons Computer Learning Center in Pleasanton, CA), and couldn’t be happier with the way the meeting went.
My goal with the group is to break away from what I’ve seen to be the traditional model of people showing up, a speaker speaks for an hour or so (while most people are texting or surfing on their laptops), swag is given out, and everybody goes home.
What I’m shooting for is to engage the audience. To hold interactive, collaborative meetings. Some might be small code challenges where everybody takes a few minutes to solve a particular problem, then shares their solution with the group. Others might be an open discussion on a given topic. Yet others might be hands-on labs to teach a particular technology.
Yesterday I rolled out a new site, http://www.blitztweets.com. I announced it on Twitter, a few folks retweeted (thanks!), and Ray Camden descended upon it like a vulture descends upon a wounded bunny in the high noon desert heat. Ray’s got a knack for finding flaws in CF sites, and I’d be lying if I said I didn’t have him in mind during development.
Overall, I think I did pretty well. He found two issues. First, my contact form could be submitted without the user filling in any fields. That was OK. I don’t particularly mind if somebody really wants to send me an empty contact form. But the second issue… ooh, that was a doozy, and I’m duly embarrassed by it. He linked me to http://www.blitztweets.com/config/ColdSpring.xml, which proceeded to display the entire contents of the file in my browser window (it’s since been fixed). Oops.
Working on a Model-Glue application, I found myself in a situation where a <cfwindow> would come in handy. It’s on a page that displays a list of items that belong to a user. For each item, the user can add a “journal entry”. This is simply a plain text field and a time/date stamp. Each entry displayed on the page has a link for “journal” that pops up a cfwindow that shows all of that item’s journal entries, along with a form (a simple textarea) allowing the user to add a new entry.
Using <cfform> allows the form submission to stay within the <cfwindow>, which worked great. A standard post allowed the page to refresh after the form was submitted (and the record inserted into the database), so it seemed to be a pretty user-friendly way to allow multiple journal entries to be added to an item. When the user was done adding entries, simply close the cfwindow.
Here’s where things got funked up… the first form submission worked great. The form’s action page called an event-handler that did the insert, and added a named result to the event to redirect back to the journal.viewJournal event, which (obviously) displayed the contents of the journal. The event needed the concept of a transactionID, so i used the append attribute of the result tag as follows:
It’s not terribly uncommon to have a page that is expecting a particular variable, but the page may not know if that variable will be in the form scope or URL scope. Case in point might be a resultset that does pagination. On the first submit, the variables would likely be in the form scope. As the user pages through the results, it’s entirely possible that the variables would be in the URL scope.
The most straightforward way to handle this would be:
<cfparam value="myNewVar" default="" />
<cfif structKeyExists(URL, 'myVar')>
<cfset variables.myNewVar = URL.myVar />
<cfif structKeyExists(form, 'myVar')>
<cfset variables.myNewVar = form.myVar />
It checks both scopes for the var, and if it finds the variable in either, it assigns it to a new local variable. It’s straightforward, but not particularly “clean”.
Last night I downloaded and looked at Transfer, a ColdFusion based ORM, for the first time. To be clear, it’s the first time I’ve looked at any ORM. I’m more than a little unhappy. What the hell is wrong with me that I’ve never made an effort to use Transfer before? (that’s a rhetorical question. there’s not enough gigs of storage space on the Internet to answer. k thx).
How did this all finally come about? I’m working on a project that’s my first Model-Glue app that actually makes use of objects. I was told to use Transfer by more than a few people, but I didn’t want to add any more to the learning curve. It seemed to me that learning Model-Glue, ColdSpring, and OO was quite enough for my little brain.
I can’t imagine this isn’t a fairly well known “issue” in the Model-Glue community, but what with being new to Model-Glue, this was a new issue for me. I figure it’s worth mentioning, if only to save somebody else the several billion hours of debugging that i lost this afternoon.
Hey all. I’m back, and I’d like to officially apologize for going all “Bermuda Triangle” on you in the middle of the “Going OO” series. I’d like to take a few minutes and reflect on some of what happened, because some of it is actually relevant.
First… the non-relevant bits. we moved (again). I thought it would be a fairly easy thing to do this time around… because unlike the last 2 times it wasn’t a cross-country move (from AZ to FL, and then from FL to CA). This time it was from CA (southern) to CA (East Bay)… but it still really really sucked. It was just a very draining experience (both physically and mentally) and I never ever want to do it again (but I will).
Factor in starting the new job (which is going great so far, thankyouverymuch) and I just haven’t even had time to keep up with reading blogs, let alone writing an entry.
But things have settled down (somewhat) so I’m going to try and get back into the swing of things.
So the $64,000 question is… where’m I at with all of this OO stuff? Hell of a question. Sorta wish you hadn’t asked. *sigh* but you did, so…