Filter Directory Contents By Multiple File Extensions

Query of Queries really helped me out this morning. The Model-Glue team is working on a ColdFusion Builder extension and we need to get a list of files to inspect. There could be many types of files in a project that aren't relevant to our purposes and I wanted to filter only the ones I need.

My Directory query contained lots of SVN specific files, which make for a good example of what we want to filter, before doing our inspection work.

Original Directory Query

What we need in this case is to filter anything that isn't a CFM, CFC or XML file. The CFDirectory tag will allow only a single filter, so what do we do?

In ColdFusion, I would use listlast( filename, ".") to look at the file extension but that would mean I'd have to unpack the query and either make a new one, or pack it in another datastructure. Waste of code, I tell ya. I ended up using Query of Queries and a LIKE statement to filter.

New Directory Query

The Code I Used for the Query of Queries

view plain print about
1<cfquery name="CleanedDirectoryQuery" dbtype="query">
2    SELECT *
3    FROM arguments.sourceDirectoryQuery
4    WHERE lower(NAME) LIKE '%.cfm'
5        OR lower(NAME) LIKE '%.cfc'
6        OR lower(NAME) LIKE '%.xml'

The secret sauce is the lower() function on NAME, and the LIKE conditional with a wildcard % operator. I found this through the Query of Queries documentation and I also learned about a few other wildcard operators as well.

List of Wildcard Operators Supported In Query of Query LIKE conditional

  • The underscore (_) represents any single character.
  • The percent sign (%) represents zero or more characters.
  • Square brackets ([ ]) represents any character in the range.
  • Square brackets with a caret [^] represent any character not in the range.
  • All other characters represent themselves.

Simple and maintainable. Just how I like it. Thanks #ColdFusion!

A Side Effect of ySlow and Firebug

A Side Effect of ySlow and Firebug

I spent a number of hours researching a bug in a Model-Glue application. Each time a form was submitted successfully, a duplicate record showed up in the database. This application uses a number of frameworks and it wasn't very clear which layer was causing the problem.

I started to dig into the issue, looking for any rhyme or reason and pinged my good buddy Ezra Parker for some sanity checks. After some intense debugging, we found out that the second record in the database showed up after the ColdFusion request ended. I tried all sorts of programmer sorcery to find out why this second request happened and did not get much useful information. This duplicate request problem defied all logic!

Through the course of working through the information and issues, we explored many potential causes and questions like:

  • Was Model-Glue possibly adding a second redirect somewhere?
  • Was there a CFThread buried in Model-Glue, ColdSpring, Transfer or CFUniform that caused this?
  • Was there some javascript call being fired off, and replicating the request?
  • Were space hackers infiltrating my computer?
  • Am I on Candid Camera?
  • Should I just quit programming and open a Bakery?


So you wanna convert Open Office Documents to Wiki format?

While working on some Model-Glue documentation we needed to convert an open office document to TracWiki format. I'm not fluent in TracWiki and I certainly didn't want to manually format 30-40 pages. Thankfully, there is an Open Office --> TracWiki conversion macro that will automate pretty much all of it. It helps if you used the Styles features of Open Office because the TracWiki will be cleaner, but no worries, it'll convert it anyways if you didn't. Here is how it works.

  1. Open the Open Office document you want to copy text from. We'll call it the Source document.
  2. Set the macro permissions to Medium or Low by going to the menu -> Tools -> Options -> Open -> Security -> Macro Security
  3. Download and open the Open Office Template Macro (ODT file)
  4. Remove all text in the newly opened ODT file.
  5. Highlight the text in your Source document, copy it, then paste it into the ODT file.
  6. Press the button with the correct format, the text will be converted to the correct wiki format and copied to the clipboard. (English is on page 2)
  7. Paste the text from the clipboard into the edit box in your wiki.

You now have converted Open Office document text to wiki format.

The conversion picked nearly everything. I manually cleaned up white space issues and also added in code blocks around all the source code sections, but I was very pleased with the amount of work handled by the OpenOfficeToTracWikiScript.

Get Free Model-Glue training this weekend!

As you've probably seen, I'm giving Free Model Glue training this weekend at BFusion/BFlex in Bloomington, Indiana. This will be the last Free Model-Glue training before we start the MG Training Roadshow, which won't be free. (Unless I win the lottery, which could happen).

BFusion is a super-mega-low cost event ($10) that has excellent content by excellent speakers. Held on the campus of Indiana University, the vibe at the conference is very open and inviting. If you come, you can get lots of hands on training in ColdFusion and Flex basically for free.

Did you know, BFusion was the inspiration for the CFinNC event this past weekend? Yep, good things happen at BFusion/BFlex. Folks get inspired, improve their skills and careers, and forge lasting friendships with really great people.

So cancel your weekend plans, get in the car, bus, plane, or train and head down. If you aren't totally impressed with BFusion/BFlex, I'll personally refund your $10.

Register for BFusion/BFlex Today!


Model Glue:Gesture - Version 3.1 Presentation at CF.Objective(ANZ)

I'll be presenting on Model-Glue 3, code named Gesture, at the CF.Objective(ANZ) conference, taking place in Melbourne, Australia on November 12th and 13th.

I'm glad I'm able to go to this conference because the schedule is packed with quality material by highly decorated speakers. Having interacted with a number of Australian developers through mailing lists and chat, I'm very pleased to meet some of the legends in person and to meet the very vibrant, entertaining ColdFusion community from Australia, New Zealand and Asia.

Seats are limited and there are less than 4 weeks until the conference. Register today! I hope to see you there!

How to resolve svn: Error setting property 'log':

I was trying to check in some changes on the Model-Glue framework and kept getting this error:

view plain print about
1update D:/webroot/ModelGlueTrunk/ModelGlue/gesture -r HEAD --force
2 At revision 184.
3commit -m "Removed potential recursion in this functionality..." D:/webroot/ModelGlueTrunk/ModelGlue/gesture/helper/HelperInjector.cfc D:/webroot/ModelGlueTrunk/ModelGlue/gesture/helper/IncludeHelperShell.cfc
4 Failed to execute WebDAV PROPPATCH
5svn: Commit failed (details follow):
6svn: At least one property change failed; repository is unchanged
7RA layer request failed
8svn: Error setting property 'log':
9Could not execute PROPPATCH.

I updated from SVN, thinking it to be a synchronization error, but I still got the same error.

I used the 'cleanup' or SVN:clean functionality to maybe get the .svn files and such back in to the right condition, but that didn't help either.

The original SVN Comment I used was:

view plain print about
1Removed potential recursion in this functionality
2Also removed useless cfdump when a helper is attempted to be included but doesn't have a cfc or cfm extension

Can you spot the issue? I can't either. What fixed the error:

view plain print about
1Failed to execute WebDAV PROPPATCH
2svn: Commit failed (details follow):
3svn: At least one property change failed; repository is unchanged
4RA layer request failed
5svn: Error setting property 'log':
6Could not execute PROPPATCH.

Was changing the multi-line comment to a single line comment. Once the comment was a single line, there was no issue checking it in. I'm not sure what I learned here, but I hope SVN doesn't REALLY have a problem with multi-line comments, after all, we need those to keep details on what changed!

On Managing IT Professionals

Bucky Schwarz, TACFUG Member, CFinNC Conference planner, Model-Glue contributor, posted a link on twitter today called The Unspoken Truth To Managing Geeks. I read this with my morning coffee and felt compelled to share it with the rest of you, since the article was so well done and happened to hit many fastening devices on their apexes. (Bonus points if you can translate that sentence).

Go read the article for yourself, I'm not going to delve into any insightful commentary, heck, it is 8:00 in the morning! I will, however, share two of the passages that prompted me to put this post in tubes for you all to enjoy.

...IT pros are sensitive to logic -- that's what you pay them for. When things don't add up, they are prone to express their opinions on the matter, and the level of response will be proportional to the absurdity of the event. The more things that occur that make no sense, the more cynical IT pros will become. Standard organizational politics often run afoul of this, so IT pros can come to be seen as whiny or as having a victim mentality. Presuming this is a trait that must be disciplined out of them is a huge management mistake. IT pros complain primarily about logic, and primarily to people they respect. If you are dismissive of complaints, fail to recognize an illogical event or behave in deceptive ways, IT pros will likely stop complaining to you. You might mistake this as a behavioral improvement, when it's actually a show of disrespect. It means you are no longer worth talking to, which leads to insubordination.

...later on in the article...

Most IT pros support an organization that is not involved with IT. The primary task of any IT group is to teach people how to work. That's may sound authoritarian, but it's not. IT's job at the most fundamental level is to build, maintain and improve frameworks within which to accomplish tasks. You may not view a Web server as a framework to accomplish tasks, but it does automate the processes of advertising, sales, informing and entertaining, all of which would otherwise be done in other ways. IT groups literally teach and reteach the world how to work. That's the job.

So if you haven't yet read the article, The Unspoken Truth To Managing Geeks yet, go for it. It is illuminating and will help us all to be personally productive as well as more useful to those we impact and manage.

Come watch Model-Glue 3 on the CFMeetup today at Noon

I'm presenting on Model-Glue 3 today on the CFMeetup at noon (EST).

We'll look at some of the powerful features of the recently released Model-Glue 3 and use the framework to build out an application while you watch.

This presentation will give you an understanding of how Model-Glue 3 helps you build feature-rich applications faster and more consistently.

More information here: You can join the meeting here:

Thanks to the consistency awesome Charlie Arehart, the recording of Model-Glue:Gesture for Fun and Profit can now be viewed.

My CFUnited Presentation Schedule

I'm honored to give 4 different presentations at CFUnited. I'm especially excited to give "Model-Glue:Gesture for Fun and Profit" as it shows some really bada$$ features of the just released (today) Model-Glue 3 so try to make a special effort to come to that one, if you can. No powerpoint, just code!

I'll list the presentation schedule and hope to see you there!

Date/Time Presentation Room
Wednesday 8/12/2009 11:00 AM-12:00 PM Practical Refactoring: Making Bad Code Good Galactica
Wednesday 8/12/2009 8:30 PM-9:30 PM Model-Glue:Gesture release BOF Matrix
Thursday 8/13/2009 8:30 AM-9:30 AM Model-Glue:Gesture for Fun and Profit Sandtrap
Thursday 8/13/2009 2:00 PM-3:00 PM Building Your First AIR/CF Application Amphitheater
Friday 8/14/2009 4:15 PM-5:15 PM Taming CFCs with ColdSpring Valhalla
Saturday 8/15/2009 4:15 PM-5:15 PM Building Your First AIR/CF Application Valhalla

Hello, Me again. - A Mid-Year Letter from Dan Wilson

CFUnited is right around the corner. I can close my eyes and clearly remember last year's CFUnited like it was a month ago. "Where does the time go?", they say?

I remember in High School watching the second hand slow dance across the dial. Each minute broken up into 60 equally agonizing seconds each in turn taking it's own eternity.

One way I mark time is by looking at my blogging habits. My blogging habits have been abysmal. I partially blame twitter, the ultra-time-suck-in-140-characters or less, since twitter serves as an outlet to the world for me. I also blame Facebook to a lesser degree, though I've long since removed any vestige of twitter or facebook from my work computers in an attempt to control my distractions.

I can also say that Model-Glue has taken it's share of time as well. Thankfully there is a large community of active contributors willing to put in time to keep the framework moving so it is certainly a manageable workload. ( though depending on who you ask, manageable might be debatable). Shepherding Model-Glue to the final 3.0 release is one of my recent professional accomplishments I'm most proud of.

I've also recently gotten married. June 6th to be exact. As proof, I stuck a picture in this post. Don't worry, I won't bore you with more.

We've also combined houses, and bought a new house, and are in the process of closing on the new house and selling the old house. This is a tremendous amount of work and I never thought I'd ever spend 14 hours spreading mulch, but I can chalk it off to one of my professional accomplishments I'd like not to repeat too often :).

I'm also involved, along with most members of the best CFUG on the face of the planet in planning the CF in NC conference. If you are new to this idea, we are holding a really great Adobe Platform in the Research Triangle Area of North Carolina. Thanks to the dedication and cleverness of the members of the planning committee, and the generosity of our sponsors, we've managed to remove the cost of the registration fee. Our unofficial slogan is "The Economy Sucks, We Don't. Come to CFinNC!"

I've missed a few things along the way. I missed the chance to really get down and dirty with CF9 once it hit public beta. I missed the rescheduling of Flex 4 for 2010. Heck, I even missed the chance to spew my own brand of bullpoop in the last Great OO Is Dead blog war.

I think things will settle down a little after CFUnited. I'll be able to really get into CF9 and learn how to make the best use of the newest, hottest features. I'll have time to work on my SuperSecretAIRApplication. I'll even have time to blog more, which I dearly miss.

If you've stuck around this long, thanks. Sometimes we all need to reflect a little and remember where we've come from, so we know where we're headed. Best wishes to you in the last half of 2009.