Archive for June, 2008|Monthly archive page
Received My New ColdFusion Book!
I Just received my new book, “ColdFusion – Lists, Arrays and Structures” by Jeff Peters.
I had the pleasure of meeting Jeff at CFUNITED a few years back, while attending a Hal Helms presentation on the subject. This is probably the book I would most recommend to new CF programmers. I can’t emphasize how important the tools in this book are!
I bought this one because it’s the second edition, with new, updated content on ColdFusion 8.
Go get it. I promise it’ll be the best $20 you ever spent!
Multi-Dimensional Arrays
I’m working on a new database-driven code review tool for myself. I’m planning on using it to learn more about regular expressions – the most powerful force in the universe!
Anyway, I didn’t have much of a problem creating an array with 6 dimensions, but outputting the values from it was another story.
The code that generates it resides in a query loop, so it needs to be dynamic:
<cfset lineNum = lineNum + 1>
<cfset errorArray[lineNum] = arrayNew(1)>
<cfset errorArray[lineNum][1] = arrayNew(1)>
<cfset errorArray[lineNum][1][1] = arrayNew(1)>
<cfset errorArray[lineNum][1][1][1] = arrayNew(1)>
<cfset errorArray[lineNum][1][1][1][1] = arrayNew(1)>
<cfset errorArray[lineNum][1][1][1][1][1] = arrayNew(1)>
<cfset errorArray[lineNum][1][1][1][1][1] = “Problem: ” & getchecks.cr_errortitle>
<cfset errorArray[lineNum][1][1][1][1][2] = sourceLineNum>
<cfset errorArray[lineNum][1][1][1][1][3] = “Source: ” & thisLine>
<cfset errorArray[lineNum][1][1][1][1][4] = “Dir\File: “ & mySite.directory & “\” & mySite.name >
<cfset errorArray[lineNum][1][1][1][1][5] = “Suggestion:” & getchecks.cr_suggestion >
And here’s how I log it to the db (I still need to add more error checking. This is just a prototype).
<cfloop from=’1′ to=’#lineNum#’ index=’i'>
<cfquery datasource=”#dsn#”>
insert into tbllog (log_name, log_time, log_problem, log_linenum, log_sourcetext, log_directoryfile, log_suggestion)
values(
‘#form.scanname#’
,
<cfqueryparam cfsqltype=”cf_sql_timestamp” value=”#createODBCDateTime(now())#”>
,
<cfloop from=’1′ to=’#arrayLen(errorArray[i])#’ index=’j'>
<cfloop from=’1′ to=’#arrayLen(errorArray[i][j])#’ index=’k'>
<cfloop from=’1′ to=’#arrayLen(errorArray[i][j][k])#’ index=’l'>
<cfloop from=’1′ to=’#arrayLen(errorArray[i][j][k][l])#’ index=’m'>
<cfloop from=’1′ to=’#arrayLen(errorArray[i][j][k][l][m])#’ index=’n'>
<cfif len(errorArray[i][j][k][l][m][n])>
<cfif n eq 2>
<cfqueryparam cfsqltype=”cf_sql_integer” value=”#errorArray[i][j][k][l][m][n]#”>
<cfelse>
<cfqueryparam cfsqltype=”cf_sql_varchar” value=”#errorArray[i][j][k][l][m][n]#”>
</cfif>
<cfelse>
NULL
</cfif>
<cfif n neq arrayLen(errorArray[i][j][k][l][m])>
,
</cfif>
</cfloop>
</cfloop>
</cfloop>
</cfloop>
</cfloop>
)
</cfquery>
</cfloop>
Works like a champ! Thanks to Barney B. of CF-Talk for helping me out!
A Newcomer’s Comparison – Model Glue and Coldbox – Part 1
I’ve decided to post some thoughts on my first adventure into two popular frameworks – Model Glue 2 and Coldbox. Both frameworks use an MVC architectural patern.
Remember, my comments are only my opinion. I am definitely not a frameworks expert, nor am i an OO expert. But I think it’s interesting to see what a nOOb thinks about these two fine frameworks at first glance. What goes through a complete newcomer’s mind as he pours over the information and files accompanying the applications.
Let’s find out…
New Tutorial Website – Built With ColdBox AND Model Glue
I’ve never really used frameworks when building applications. It just seemed… well… like a waste of time?
When I started fooling around with a framework, I’d go through the quickstart tutorials, and by the time I got to step 20 to simply output a query on the screen, I said screw this! I could’ve been done an hour ago!
I just started a new position at a large company here in Greensboro which uses a framework, so I figured heck, I might as well dive into again.
With all that said, I’d like to present a tutorial site I built using Model Glue and Coldbox. www.cfcomplexdata.com
The site focuses on a subject that isn’t well-documented … Complex data types. I’ll add more to the content as I go along, but I believe it’s a good start. I think I should add a bit more about how to loop over those complex data types when you actually need to USE them.
You’ll see a few bits of code examples on the site, but I plan to blog about my experience with both frameworks, and which one seems to fit me best.
Another ColdFusion Blog About to Be Unleashed …
I’m planning on blogging my experiences with Model Glue and Coldbox. You’ll see code and ramblings about code.
<cffunction name="init" access="public" returntype="calendarDAO" output="false" hint="Returns an instance of the CFC initialized with the correct settings."> <cfargument name="dsn"> <cfset variables.dsn = arguments.dsn> <cfreturn this> </cffunction>
Hope you enjoy suffering along with me on this journey.
Will
Leave a Comment
Leave a Comment
Comments (4)