Blog

Blog posts made in August 2006
31Aug
2006
Jeff Peters On The Directory Watcher Event Gateway

I've written and talked about event gateways for a while, and the very first time we ever mentioned gateways publicly was when I demoed the Directory Watcher gateway at CFUNITED 2005. Jeff Peters saw that demonstration, and noting that its significance failed to resonate with many, has written a column providing a very practical use for this gateway.

Read More ›

30Aug
2006
Microsoft XNA Beta Released

Want to write your own games for Xbox 360? Microsoft has announced the availability of the XNA beta, initially to build games for Windows, but eventually to build games for Xbox, too. More details on the FAQ page. Now you have a really compelling reason to learn C#!

Read More ›

29Aug
2006
Class On Using PDF Files And Forms With ColdFusion

Sterling Ledet is offering a class entitled "Using ColdFusion or Java with PDF files and eForms". If you work with PDF files and forms check this out (select "ColdFusion - Using ColdFusion or Java with PDF files and eForms" from the drop down).

Read More ›

29Aug
2006
Presentation To Thames Valley CFUG

I'll be in the U.K. briefly next month (on my way back from India), and will use the opportunity to present ColdFusion and Flex 2 to the new Thames Valley CFUG. The event is on September 12th and registration is required.

Read More ›

29Aug
2006
Simple ColdFusion Date Difference Calculations

DateDiff() is usually used to perform date difference calculations. But for simple difference calculations you can subtract dates from each other, like this:

view plain print about
1<cfset mydate=CreateDate(2006,8,17)>
2<cfoutput>#Now()-mydate# days since #DateFormat(mydate)#</cfoutput>

The returned number will likely not be an integer, and will contain date fractions too, so you may want to use Int() to round the number to just the integer portion:

view plain print about
1<cfset mydate=CreateDate(2006,8,17)>
2<cfoutput>#Int(Now()-mydate)#</cfoutput>

Read More ›

28Aug
2006
Undocumented Change In <CFFILE> DESTINATION Attribute

I just had to debug some really old code that used to work. I found the issue, and it appears that the code broke in going from CF5 to CFMX (yep, it is code that is not used very often). I was using <cffile action="upload"> to process file uploads, and was using the destination attribute to specify the full path of the file to be saved. As I said, this used to work. But not anymore because destination expects the path to a folder to store the file in, and no longer accepts a path to an actual destination file. The history in LiveDocs says that in CFMX destination was changed so that a trailing slash was no longer needed in paths, but makes no mention of not being able to use actual destination file names anymore. CF5 documentation clearly says that DESTINATION can be a fully qualified file path or directory, so it appears that we broke something in the port from CF5 to CFMX. Bummer.

Read More ›

28Aug
2006
GetScheduledTasks() Function Returns Scheduled Task List

<cfschedule> is used to define and run ColdFusion scheduled tasks. For some reason the tag does not return a list of defined tasks, and a user on cf-talk asked for this functionality recently. So, until we update <cfschedule>, here is a UDF that returns a query containing the details about all scheduled tasks.

The bulk of this code (the regular expressions, funky nested looping, and so on) are the work of Michael Dinowitz (and I have retained his warnings about not doing what he is about to do).

view plain print about
1<!--- Obtain scheduled tasks details --->
2<cffunction name="GetScheduledTasks" returntype="query" output="no">
3
4    <!--- Local vars --->
5    <cfset var tasks="">
6    <cfset var result=QueryNew('path,file,resolveurl,url,publish,password,operation,username,interval,start_date,http_port,task,http_proxy_port,proxy_server,disabled,start_time,request_time_out')>
7    <cfset var OuterStart="">
8    <cfset var InnerStart="">
9    <cfset var qRETest="">
10    <cfset var qRETestinner="">
11    <cfset var ScheduleItem="">
12
13    <!--- This call is undocumented --->
14    <cfsavecontent variable="tasks">
15        <cfschedule action="run" task="__list">
16    </cfsavecontent>
17
18    <!--- The start for each schedule entry --->
19    <cfset OuterStart=1>
20
21    <!--- Be super careful when using an infinite loop in this manner.
22        Actually, never use an infinite loop in this manner. --->

23    <cfloop condition="OuterStart">
24        <!--- Each schedule item is a text string followed by an = followed by a double {.
25            The end of the item also has a double }
26            Getting only the elements in an item removed the need for a negative lookahead later --->

27        <cfset qRETest=REFind('\w+={{(.+?})}}', tasks, OuterStart, 1)>
28        <!--- If there is a result, use it.
29            Otherwise break out of the loop. VERY IMPORTANT!!! --->

30        <cfif qRETest.Pos[1]>
31            <!--- This is the string containing all of the
32                elements in a schedule item --->

33            <cfset ScheduleItem=Mid(tasks, qRETest.Pos[2], qRETest.len[2])>
34            <!--- Set the start past the schedule item found --->
35            <cfset OuterStart=qRETest.Pos[2]+qRETest.len[2]>
36
37            <!--- The start for each element of a schedule item --->
38            <cfset InnerStart=1>
39            <!--- Add a row. We don't have so specify as we'll be
40                adding 1 per schedule item --->

41            <cfset QueryAddRow(result)>
42        
43            <!--- Be super careful when using an infinite loop in this manner.
44                Actually, never use an infinite loop in this manner. --->

45            <cfloop condition="InnerStart">
46                <!--- A schedule element is text followed by an = followed by
47                    a value inside of {}. Even though the schedule item string
48                    can be seen as a list, we don't know if there will be a
49                    comma inside one of the elements so we're doing it the
50                    hard but safe way. --->

51                <cfset qRETestinner=REFind('(\w+)={([^}]*)}', ScheduleItem, InnerStart, 1)>
52    
53                <!--- If there is a result, use it.
54                    Otherwise break out of the loop. VERY IMPORTANT!!! --->

55                <cfif qRETestinner.Pos[1]>
56                    <!--- The QuerySetCell will automatically assign the value to the last row added so no need to specify row. The second element of the RegEx return is the column name and the third is the value--->
57                    <cfset QuerySetCell(result,
58                                        Mid(ScheduleItem, qRETestinner.Pos[2], qRETestinner.len[2]),
59                                        Mid(ScheduleItem, qRETestinner.Pos[3], qRETestinner.len[3]))
>

60                    <!--- Set the start past the schedule element found --->
61                    <cfset InnerStart=qRETestinner.Pos[1]+qRETestinner.len[1]>
62                <cfelse>
63                    <!--- Break out of our inner infinite loop --->
64                    <cfbreak>
65                </cfif>
66            </cfloop>
67        <cfelse>
68            <!--- Break out of our inner infinite loop --->
69            <cfbreak>
70        </cfif>
71    </cfloop>
72
73    <cfreturn result>
74
75</cffunction>

Read More ›

28Aug
2006
Mike Nimer's Flex Debug Component

I was working on a Flex component to display ColdFusion debug data in a usable format, but then learned that Mike Nimer had beaten me to it (and created something far more elaborate than I was planning). So, if you are looking for something akin to <cfdump> in Flex (usable with any AS3 objects, including debug information returned from ColdFusion via a <mx:RemoteObject> call), grab a copy of Mike's Flex 2 Debug component.

Read More ›

27Aug
2006
Oliver Merk Explains The ColdFusion Flex Relationship

If you want to learn about the basics of ColdFusion Flex integration, and the relationship between the two, check out Oliver Merk's new CFDJ article entitled An Introduction To Flex 2 For ColdFusion Developers.

Read More ›

25Aug
2006
ColdFusion Positions In MI, KS, MN

It's Friday again, so time for some more ColdFusion employment opportunities:

  • Cleantech Capital Group (Brighton, MI) is looking for an experienced ColdFusion Developer. Requirements include good knowledge of ColdFusion MX 7, HTML, JavaScript, and Dreamweaver This is a full-time onsite position. Contact resume@cleantech.com.
  • City of Overland Park (Overland Park, KS) is looking for a developer to work on existing systems and to develop new applications. Requirements include a Bachelors Degree in Computer Science or a related field, 3+ years of programming experience, and experience with ColdFusion and Oracle. Details (including salary range) are posted online.
  • signsearch (Burnsville, MN) is looking for a junior ColdFusion developer to work on new database and Web application development and the support of existing applications, some support work may be required as well. Requirements include 2+ years working with core technologies HTML, ColdFusion, JavaScript, VBA, and SQL. Details (including salary range) are posted online.

Read More ›