<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>arcster.com Blog &#187; ColdFusion</title>
	<atom:link href="http://blog.arcster.com/blog/index.php/category/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.arcster.com</link>
	<description>These fragments I have shored against my ruins</description>
	<lastBuildDate>Sun, 11 Sep 2011 00:05:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Problem with ColdFusion ListQualify function?</title>
		<link>http://blog.arcster.com/2010/03/problem-with-coldfusion-listqualify-function/</link>
		<comments>http://blog.arcster.com/2010/03/problem-with-coldfusion-listqualify-function/#comments</comments>
		<pubDate>Mon, 15 Mar 2010 17:48:27 +0000</pubDate>
		<dc:creator>arcster</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Oracle]]></category>
		<category><![CDATA[Is It My Code Or Is It A Bug]]></category>
		<category><![CDATA[ListQualify]]></category>

		<guid isPermaLink="false">http://arcster.com/blog/?p=163</guid>
		<description><![CDATA[Update 9/24/10: Solution to this problem found! Here&#8217;s a ColdFusion/Oracle problem that took way longer than I thought it would. I wanted to exclude a couple names from a result set an pass the names in a single-quote, comma-delimited list: &#8230; <a href="http://blog.arcster.com/2010/03/problem-with-coldfusion-listqualify-function/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Update 9/24/10: Solution to this problem <a href="http://blog.kukiel.net/2010/08/coldfusion-lists-sql-in-and.html" target="_blank">found</a>!</p>
<p>Here&#8217;s a ColdFusion/Oracle problem that took way longer than I thought it would.</p>
<p>I wanted to exclude a couple names from a result set an pass the names in a single-quote, comma-delimited list:</p>
<p><code>&lt;cfset tempexcludelist ="PHIL,DON"&gt;<br />
&lt;cfset VARIABLES.excludelist = "("&amp;ListQualify(tempexcludelist,"'")&amp;")"&gt;<br />
</code><br />
My Oracle query looked like this:</p>
<pre>&lt;cfquery name="who" datasource="#APPLICATION.ds#"&gt;
select
FULL_NAME,
initcap(TITLE) as TITLE,
BUILDING,
ROOM,
PHONE_NUMBER,
PRIMARYEMAIL
from
people
where
userid NOT IN #VARIABLES.excludelist#
&lt;/cfquery&gt;</pre>
<p>My expectation was for the final line to be output like so:</p>
<pre>userid NOT IN ('PHIL','DON')</pre>
<p>But it didn&#8217;t turn out that way. Instead I got</p>
<pre>[Macromedia][Oracle JDBC Driver][Oracle]ORA-00907:
missing right parenthesis</pre>
<p>and my debug output showed Oracle was processing the following<br />
<code>select  FULL_NAME, initcap(TITLE) as TITLE, BUILDING,<br />
ROOM, PHONE_NUMBER, PRIMARYEMAIL from people where userid NOT IN (''PHIL'',''DON'')</code></p>
<p>Wha? Where did the extra single quotes come from?</p>
<p>I tried various alternatives for my listqualify qualifier, including</p>
<p><code>&lt;cfset VARIABLES.excludelist = "("&amp;ListQualify(tempexcludelist,"")&amp;")"&gt;<br />
</code><br />
<code>&lt;cfset VARIABLES.excludelist = "("&amp;ListQualify(tempexcludelist,"''")&amp;")"&gt;<br />
</code><br />
<code>&lt;cfset VARIABLES.excludelist = "("&amp;ListQualify(tempexcludelist,"#Chr(34)#")&amp;")"&gt;</code></p>
<p>but nothing worked.</p>
<p>I finally resolved the problem by using a unique employee number so that I didn&#8217;t have to worry about quote marks, but next time I may not be so lucky. So where is the problem? ColdFusion? Oracle? Me?</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.arcster.com/2010/03/problem-with-coldfusion-listqualify-function/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cool Find and Replace using regexp</title>
		<link>http://blog.arcster.com/2009/06/cool-find-and-replace-using-regexp/</link>
		<comments>http://blog.arcster.com/2009/06/cool-find-and-replace-using-regexp/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 15:21:37 +0000</pubDate>
		<dc:creator>arcster</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Regular Expressions]]></category>

		<guid isPermaLink="false">http://arcster.com/blog/?p=116</guid>
		<description><![CDATA[So I saved an Excel file as a tab-separated text file. Then I wanted to add some html. The first column was all numbers followed by a tab and the second column. I opened the text file in Dreamweaver and &#8230; <a href="http://blog.arcster.com/2009/06/cool-find-and-replace-using-regexp/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>So I saved an Excel file as a tab-separated text file. Then I wanted to add some html. The first column was all numbers followed by a tab and the second column.</p>
<p>I opened the text file in Dreamweaver and put the following in the &#8220;Find&#8221; box: \n([0-9]+)\t</p>
<p>That says &#8220;Look for a line break followed by a subexpression containing at least one numeric character followed by a tab&#8221;</p>
<p>I put the following in the Replace box: \n&lt;div class=&#8221;col1&#8243;&gt;$1&lt;/div&gt;&lt;div class=&#8221;col2&#8243;&gt;\t</p>
<p>That says &#8220;Replace it with a line break followed by a div tag followed by the subexpression (i.e, the number) followed by a closing div followed by an opening div for col2 followed by a tab&#8221;</p>
<p>Then the check the &#8220;Use regular expression&#8221; checkbox and hit &#8220;Replace All&#8221;</p>
<p>Quirky behavior noted: I couldn&#8217;t do one-at-a-time replacements. It only worked when I did Replace All. So make sure you have a back up handy.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.arcster.com/2009/06/cool-find-and-replace-using-regexp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Shun the Coldfusion Developer&#8217;s Journal</title>
		<link>http://blog.arcster.com/2008/07/i_hate_cdj/</link>
		<comments>http://blog.arcster.com/2008/07/i_hate_cdj/#comments</comments>
		<pubDate>Fri, 11 Jul 2008 14:24:13 +0000</pubDate>
		<dc:creator>arcster</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://arcster.com/blog/2008/07/11/i_hate_cdj/</guid>
		<description><![CDATA[Every fricking time I go to the Coldfusion Developer&#8217;s Journal (coldfusion.sys-con.com), Firefox crashes. I hate that.]]></description>
			<content:encoded><![CDATA[<p>Every fricking time I go to the Coldfusion Developer&#8217;s Journal (coldfusion.sys-con.com), Firefox crashes.</p>
<p>I hate that.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.arcster.com/2008/07/i_hate_cdj/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ColdFusion/Outlook email discovery</title>
		<link>http://blog.arcster.com/2008/03/a-beautiful-discovery/</link>
		<comments>http://blog.arcster.com/2008/03/a-beautiful-discovery/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 17:06:02 +0000</pubDate>
		<dc:creator>arcster</dc:creator>
				<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://arcster.com/blog/2008/03/14/a-beautiful-discovery/</guid>
		<description><![CDATA[Generating an Outlook meeting invitation from ColdFusion is a challenge. There are snippets of code here and there, but I finally got a working solution. &#60;cfmail to=&#8221;someone@someplace.com (Name here)&#8221; from=&#8221;someoneelse@someplace.com (Name)&#8221; subject=&#8221;Test appointment from ColdFusion&#8221; type=&#8221;multipart&#8221;&#62; &#60;cfmailparam name=&#8221;content-class&#8221; value=&#8221;urn:content-classes:calendarmessage&#8221;&#62; &#60;cfmailparam &#8230; <a href="http://blog.arcster.com/2008/03/a-beautiful-discovery/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Generating an Outlook meeting invitation from ColdFusion is a challenge. There are snippets of code here and there, but I finally got a working solution.</p>
<p>&lt;cfmail to=&#8221;someone@someplace.com (Name here)&#8221; from=&#8221;someoneelse@someplace.com (Name)&#8221; subject=&#8221;Test appointment from ColdFusion&#8221; type=&#8221;multipart&#8221;&gt;<br />
&lt;cfmailparam name=&#8221;content-class&#8221; value=&#8221;urn:content-classes:calendarmessage&#8221;&gt;<br />
&lt;cfmailparam name=&#8221;Content-Type&#8221; value=&#8221;text&#8221;&gt;<br />
&lt;cfmailparam name=&#8221;method&#8221; value=&#8221;REQUEST&#8221;&gt;<br />
&lt;cfmailparam name=&#8221;charset&#8221; value=&#8221;utf-8&#8243;&gt;<br />
&lt;cfmailparam name=&#8221;Content-Transfer-Encoding&#8221; value=&#8221;7bit&#8221;&gt;<br />
&lt;cfmailpart type=&#8221;text&#8221;&gt;<br />
[Introductory blurb here]<br />
&lt;/cfmailpart&gt;<br />
&lt;cfmailpart type=&#8221;text/calendar&#8221;&gt;<br />
BEGIN:VCALENDAR<br />
PRODID:-//Microsoft Corporation//Outlook 11.0 MIMEDIR//EN<br />
VERSION:2.0<br />
METHOD:PUBLISH<br />
BEGIN:VEVENT<br />
DTSTART:20080317T123000Z<br />
DTEND:20080317T133000Z<br />
LOCATION:Your location<br />
TRANSP:OPAQUE<br />
SEQUENCE:0<br />
UID:0<br />
DTSTAMP:20080303T140000Z<br />
DESCRIPTION:Descriptive text here.\n<br />
SUMMARY:Short summary here<br />
PRIORITY:5<br />
X-MICROSOFT-CDO-IMPORTANCE:1<br />
CLASS:PUBLIC<br />
END:VEVENT<br />
END:VCALENDAR<br />
&lt;/cfmailpart&gt;<br />
&lt;/cfmail&gt;</p>
<p>Note: If you don&#8217;t include the cfmailparts, and try to send the whole thing with content-type = text/calendar, you (well at least I did) will get the following error:  IOException while sending message; nested exception is: javax.activation.UnsupportedDataTypeException: no object DCH for MIME type text/calendar; method=REQUEST</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.arcster.com/2008/03/a-beautiful-discovery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Another day in the life of a ColdFusion drone</title>
		<link>http://blog.arcster.com/2008/02/another-day-in-the-life-of-a-coldfusion-drone/</link>
		<comments>http://blog.arcster.com/2008/02/another-day-in-the-life-of-a-coldfusion-drone/#comments</comments>
		<pubDate>Thu, 14 Feb 2008 14:55:18 +0000</pubDate>
		<dc:creator>arcster</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[COM]]></category>

		<guid isPermaLink="false">http://arcster.com/blog/2008/02/14/another-day-in-the-life-of-a-coldfusion-drone/</guid>
		<description><![CDATA[This may be of use to the handful of people in the universe who: 1. use ColdFusion; 2. have no direct access to their Coldfusion server; 3. need to manipulate PowerPoint on the server; and 4. aren&#8217;t using .NET OK, &#8230; <a href="http://blog.arcster.com/2008/02/another-day-in-the-life-of-a-coldfusion-drone/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This may be of use to the handful of people in the universe who: 1. use ColdFusion; 2. have no direct access to their Coldfusion server; 3. need to manipulate PowerPoint on the server; and 4. aren&#8217;t using .NET</p>
<p>OK, the three of you who are still reading may continue.</p>
<p>So I&#8217;m trying to do this via COM and ColdFusion&#8217;s cfobject tag.</p>
<p>First, I waited a couple months for the people who run the server to get PowerPoint installed on the server. Then I dusted off some old code from <a title="CF Comet" href="http://www.cfregex.com/cfcomet/forum/ViewThread.cfm?ThreadID=F09104FE-1802-684D-687BF5A8897E7E1F">CF Comet</a>.</p>
<p>My code looked like this:</p>
<pre>&lt;cfobject TYPE="com" NAME="objPPT" CLASS="PowerPoint.Application" ACTION="connect"&gt;
&lt;cfobject TYPE="com" NAME="objPPT" CLASS="PowerPoint.Application" ACTION="create"&gt;

presentationsCollection = objPPT.Presentations;

myPresentation = presentationsCollection.Open("D:xxxmaingetppt.ppt", False, False, False);

newpresentation = objPresentation.SaveAS("D:xxxmainnew.ppt",11, True);
// Close a presentation

objPresentation.Close();

// Quit PowerPoint

objPPT.Quit();</pre>
<p>Here was my error the first time I ran the script. (Note: path and file names have been altered)<br />
<code>An exception occurred when executing a Com method.<br />
The cause of this exception was that: AutomationException: 0x80004005 -<br />
PowerPoint could not open the file. in 'Microsoft Office PowerPoint 2003'.</code><br />
Updated April 2009</p>
<p>Thank you Todd for noticing that somehow my posting got completely botched in the copy and paste process. Here is a working example of a ColdFusion file that uses COM to open a powerpoint pre-loaded onto the server, add data, and then save the new file into a location on the server where the user can download it</p>
<p>Also available as a <a href="http://arcster.com/blog/wp-content/uploads/2009/04/coldfusioncom.txt">text file</a></p>
<p>&lt;cfset VARIABLES.localpath = &#8220;D:\rootfolder\subfolder\&#8221;&gt;</p>
<p>&lt;cfset VARIABLES.remotepath = &#8220;http://someurl/&#8221;&gt;</p>
<p>&lt;cfset VARIABLES.pptext = &#8220;.ppt&#8221;&gt;</p>
<p>&lt;cfset VARIABLES.sourcefile = &#8220;testppt&#8221;&gt;</p>
<p>&lt;cfset VARIABLES.nowdate = tostring(DateFormat(Now(),&#8217;yyyymmdd&#8217;))&gt;</p>
<p>&lt;cfset VARIABLES.nowtime = tostring(TimeFormat(Now(),&#8217;hhmmss&#8217;))&gt;</p>
<p>&lt;cfset VARIABLES.newfile = trim(VARIABLES.nowdate) &amp; trim(VARIABLES.nowtime)&gt;</p>
<p>&lt;cfset VARIABLES.basefilepath = VARIABLES.localpath &amp; VARIABLES.sourcefile &amp; VARIABLES.pptext&gt;</p>
<p>&lt;cfset VARIABLES.newfilepath = VARIABLES.localpath &amp; VARIABLES.newfile &amp; VARIABLES.pptext&gt;</p>
<p>&lt;cfset VARIABLES.newurl = VARIABLES.remotepath &amp; VARIABLES.newfile &amp; VARIABLES.pptext&gt;</p>
<p>&lt;cfquery name=&#8221;Query&#8221; datasource=&#8221;datasource&#8221;&gt;</p>
<p>some query to populate chart</p>
<p>&lt;/cfquery&gt;</p>
<p>&lt;!DOCTYPE html PUBLIC &#8220;-//W3C//DTD XHTML 1.0 Transitional//EN&#8221; &#8220;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&#8221;&gt;</p>
<p>&lt;html xmlns=&#8221;http://www.w3.org/1999/xhtml&#8221;&gt;</p>
<p>&lt;head&gt;</p>
<p>&lt;meta http-equiv=&#8221;Content-Type&#8221; content=&#8221;text/html; charset=iso-8859-1&#8243; /&gt;</p>
<p>&lt;title&gt;PowerPoint Creator&lt;/title&gt;</p>
<p>&lt;/head&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;cftry&gt;</p>
<p>&lt;CFOBJECT</p>
<p>TYPE=&#8221;com&#8221;</p>
<p>NAME=&#8221;objPPT&#8221;</p>
<p>CLASS=&#8221;PowerPoint.Application&#8221;</p>
<p>ACTION=&#8221;connect&#8221;&gt;</p>
<p>&lt;cfcatch&gt;</p>
<p>&lt;CFOBJECT</p>
<p>TYPE=&#8221;com&#8221;</p>
<p>NAME=&#8221;objPPT&#8221;</p>
<p>CLASS=&#8221;PowerPoint.Application&#8221;</p>
<p>ACTION=&#8221;create&#8221;&gt;</p>
<p>&lt;/cfcatch&gt;</p>
<p>&lt;/cftry&gt;</p>
<p>&lt;!&#8212;</p>
<p>kudos to</p>
<p>http://www.cfregex.com/cfcomet/forum/ViewThread.cfm?ThreadID=F09104FE-1802-684D-687BF5A8897E7E1F</p>
<p>&#8212;&gt;</p>
<p>&lt;cfset presentationsCollection = objPPT.Presentations&gt;</p>
<p>&lt;cfscript&gt;</p>
<p>//open as readonly</p>
<p>myPresentation = presentationsCollection.Open(VARIABLES.basefilepath, True, False, False);</p>
<p>//The presentation object has a slides collection</p>
<p>if (isDebugMode()) writeOutput(&#8220;Creating collection&#8221;);</p>
<p>CollSlides = myPresentation.Slides;</p>
<p>//The first param defines the number of slides.</p>
<p>//The second parameter defines the slide layout</p>
<p>//Figured out blank by trial and error</p>
<p>//blank = 12</p>
<p>//blank with title = 11</p>
<p>ObjSlide = CollSlides.Add(1, 11);</p>
<p>// This chunk of code creates a title. I know it&#8217;s a lot just to create a title, but Powerpoint has a lot of classes.</p>
<p>slideShape = ObjSlide.Shapes;</p>
<p>newShape = slideShape.Title;</p>
<p>myTextFrame = newShape.TextFrame;</p>
<p>myTextRange = myTextFrame.TextRange;</p>
<p>myTextRange.Text = &#8220;This is the Title&#8221;;</p>
<p>// This is how to add more text to the slide.</p>
<p>bodyShape = SlideShape.AddTextBox(1, 200, 300, 700, 100);</p>
<p>bodyShapeTextFrame = bodyShape.TextFrame;</p>
<p>bodyShapeTextRange = bodyShapeTextFrame.TextRange;</p>
<p>bodyShapeTextRange.Text = &#8220;This is some additional text&#8221;;</p>
<p>//add table</p>
<p>//http://skp.mvps.org/ppttable.htm</p>
<p>//AddTable(NumRows, NumColumns, Left, Top, Width, Height)</p>
<p>//</p>
<p>//Somewhere I read you couldn&#8217;t stack your arguments (this.that.theother) more than two deep</p>
<p>//This doesn&#8217;t seem to be true.</p>
<p>//</p>
<p>//Define the most rows that can display on a page</p>
<p>imaxrows = 10;</p>
<p>//How many rows returned by query?</p>
<p>irowct = Query.RecordCount;</p>
<p>//have to account for record count of 0, or we&#8217;ll have issues</p>
<p>//note the nify use of integer division and mod</p>
<p>if (irowct GT imaxrows)</p>
<p>inumslides = funcnumslides(irowct, imaxrows);</p>
<p>function funcnumslides(i1, i2){</p>
<p>inumint =  i1 \ i2;</p>
<p>inummod = i1 mod i2;</p>
<p>if (inummod GT 0)</p>
<p>return inumint + 1;</p>
<p>else</p>
<p>return inumint;</p>
<p>}</p>
<p>ObjSlide = CollSlides.Add(inumslides, 11);</p>
<p>bodyShape = SlideShape.AddTable(imaxrows,1,30,110,660,320);</p>
<p>oTable = bodyShape.Table;</p>
<p>oCell = oTable.Cell(1,1);</p>
<p>try {</p>
<p>otext = oCell.Shape.TextFrame.TextRange;</p>
<p>rsltText = Query.RecordCount;</p>
<p>otext.Text = rsltText;</p>
<p>}</p>
<p>catch(Any excpt)</p>
<p>{</p>
<p>WriteOutput(&#8220;#excpt.Message#&#8221;);</p>
<p>}</p>
<p>newpresentation = myPresentation.SaveAS(VARIABLES.newfilepath, 11, True);</p>
<p>// Close a presentation</p>
<p>myPresentation.Close();</p>
<p>//Quit PowerPoint</p>
<p>objPPT.Quit();</p>
<p>&lt;/cfscript&gt;</p>
<p>&lt;p&gt;Your file is ready for &lt;a href = &#8220;&lt;cfoutput&gt;#VARIABLES.newurl#&lt;/cfoutput&gt;&#8221;&gt;download&lt;/a&gt;.<br />
On opening you will be asked to allow macros. Click OK.&lt;/p&gt;</p>
<p>&lt;/body&gt;</p>
<p>&lt;/html&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.arcster.com/2008/02/another-day-in-the-life-of-a-coldfusion-drone/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

