<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0">
			<channel>
			<title>WebDH blog - ColdFusion</title>
			<link>http://blog.webdh.com/index.cfm</link>
			<description>This is Troy&apos;s blog for WebDH.com LLC.</description>
			<language>en-us</language>
			<pubDate>Wed, 22 May 2013 21:59:02 -0700</pubDate>
			<lastBuildDate>Wed, 18 Jul 2012 20:44:00 -0700</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>webdh.com@gmail.com</managingEditor>
			<webMaster>webdh.com@gmail.com</webMaster>
			
			<item>
				<title>Dynamic RSS Feed from ColdFusion and bad characters like &#xc2;</title>
				<link>http://blog.webdh.com/index.cfm/2012/7/18/Dynamic-RSS-Feed-from-ColdFusion-and-bad-characters-like-</link>
				<description>
				
				Are you creating a dynamic RSS Feed in ColdFusion? Maybe you learned some tips from &lt;a href=&quot;http://www.petefreitag.com/item/465.cfm&quot;&gt;Pete Freitag&apos;s blog article&lt;/a&gt;.  Maybe you have a feed that has worked fine then one day you encounter an issue where bad character(s) are throwing an error in the RSS feed. If you use Internet Explorer, you may see an error like this: An invalid character was found in text content. Line: 71 Character: 271


At the end of this blog I&apos;ll describe a simple fix that helped me and hopefully will help you too. Let&apos;s say you work at a fictious company and are responsible for publishing news content to the website. Today, each news release is saved as a content record in your CMS database; title, publish date, keywords, content. For the content, each news release contains a text file saved to the web server&apos;s file system, and the path to that file is saved in the database. The content file originated in MS Word from your company&apos;s communications department. You create a HTML version of the file, mainly using some simple HTML tags; paragraphs, italics, bold, etc. The website&apos;s news.cfm page queries the CMS database for a list of news titles, showing the most recent at the top. If a user clicks a news title, they visit the page newsdetail.cfm which does a &lt;cfinclude&gt; to display the content file. Maybe this has been working fine for years but now your company wants to offer a RSS Feed of the last 10 news releases. No problem, you read Pete&apos;s blog and whip out the page newsrss.cfm coded like this.

&lt;code&gt;
&lt;cfset currentoffset = getTimeZoneInfo().utcHourOffset&gt;
&lt;cfquery name=&quot;qNews&quot; datasource=&quot;CMS&quot; maxrows=&quot;10&quot;&gt;
  select id,title,pubdate,contentpath
  from news_table
  order by pubdate desc
&lt;/cfquery&gt;
&lt;cfsavecontent variable=&quot;xmldata&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&lt;rss version=&quot;2.0&quot;&gt;
&lt;channel&gt;
&lt;title&gt;Company ABC News Releases&lt;/title&gt;
&lt;link&gt;http://www.companyabc.com/&lt;/link&gt;
&lt;description&gt;Company ABC is a worldwide leader in making news that people like to read.&lt;/description&gt;
&lt;lastBuildDate&gt;#DateFormat(Now(),&apos;#ddd, d mmm yyyy&apos;)# #TimeFormat(DateAdd(&apos;h&apos;,variables.currentoffset,Now()),&apos;h:mm:ss&apos;)# GMT&lt;/lastBuildDate&gt;
&lt;language&gt;en-us&lt;/language&gt;
&lt;cfloop query=&quot;qNews&quot;&gt;
&lt;item&gt;
&lt;title&gt;#title#&lt;/title&gt;
&lt;link&gt;http://www.companyabc.com/newsdetail.cfm?id=#id#&lt;/link&gt;
&lt;pubDate&gt;#DateFormat(pubdate,&apos;#ddd, d mmm yyyy&apos;)# #TimeFormat(DateAdd(&apos;h&apos;,variables.currentoffset,pubdate),&apos;h:mm:ss&apos;)# GMT&lt;/pubDate&gt;
&lt;content:encoded&gt;&lt;![CDATA[&lt;cfinclude template=&quot;#contentpath#&quot;&gt;]]&gt;&lt;/content:encoded&gt;
&lt;/item&gt;
&lt;/cfloop&gt;
&lt;/channel&gt;
&lt;/rss&gt;
&lt;/cfsavecontent&gt;
&lt;cfcontent type=&quot;text/xml&quot; reset=&quot;yes&quot; /&gt;&lt;cfoutput&gt;#variables.xmldata#&lt;/cfoutput&gt;
&lt;/code&gt;


If your content source is MS Word, it may contain special characters that are not UTF-8 friendly. Examples:

2010?2012  [long/short dash - you are seeing: 2010&#xe2;?&quot;2012]

?110 bn  [Euro - you are seeing: &#xe2;?&#xac;110 bn]

Castaeda  [foreign alpha character - you are seeing: Casta&#xc3;&#xb1;eeda]

value of ?  [greek character - you are seeing: value of &#xce;&#xb8;]

  [angled quotes - you are seeing: &#xe2;??my quote&#xe2;??]

rental.  Minneapolis  [double space - you may see nothing obvious or maybe you are seeing: rental. &#xc2; Minneapolis]


The fix is very simple, just append charset=utf-8 in this line at bottom of page: 

&lt;code&gt;
&lt;cfcontent type=&quot;text/xml; charset=utf-8&quot; reset=&quot;yes&quot; /&gt;
&lt;/code&gt;


For some reason, even though you have &lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; the browser does not always interpret it that way. &lt;a href=&quot;http://www.thickpaddy.com/2009/8/10/coldfusion-is-not-utf-8-encoded&quot;&gt;Read this blog to learn more&lt;/a&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>RSS</category>				
				
				<pubDate>Wed, 18 Jul 2012 20:44:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2012/7/18/Dynamic-RSS-Feed-from-ColdFusion-and-bad-characters-like-</guid>
				
			</item>
			
			<item>
				<title>My page scraper and Twitterfeed</title>
				<link>http://blog.webdh.com/index.cfm/2012/3/10/My-page-scraper-and-Twitterfeed</link>
				<description>
				
				I recently built a small CF app to scrape the Minnesota Twins website. They have a &lt;a href=&quot;http://mlb.com/min/ticketing/sth/gen/sth_of_week.jsp&quot;&gt;page&lt;/a&gt; that is updated once a week (usually Monday) with a new winner of a special prize given to a Season Ticket Holder (STH). I didn&apos;t want to remember to check the page every week, so an automated solution was in order.

I created a page scraping template which makes a cfhttp call to the Twins site and parses the HTML for the winner&apos;s name and prize.  I then check the winner&apos;s name against the previous week&apos;s winner, and if it differs it saves the new data into the database and emails me the new winner and prize. To make it automated, I created a CF scheduled task that runs once a day and calls the scraping template.

To spread the app to other STH peeps, I expanded it further:
1) Email to subscribers each time a new winner is updated
2) Tweet by &lt;a href=&quot;http://twitter.com/faninmn&quot;&gt;@FanInMN&lt;/a&gt; each time a new winner is updated
3) RSS feed of the winners

To achieve 2 and 3, the scraping template also updates a RSS feed. This feed is used by Twitterfeed, which automatically tweets the new winner. Thanks to &lt;a href=&quot;http://blog.joshuaadams.com/index.cfm/2012/2/25/Twitterfeed&quot;&gt;Josh Adam&apos;s blog&lt;/a&gt; for the tip Twitterfeed, it was very easy to setup.

If you are a Twins STH, you can &lt;a href=&quot;http://www.webdh.com/sthprize/subscribe.cfm&quot;&gt;subscribe here&lt;/a&gt;. Go Twins! 
				</description>
				
				<category>Twitter</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Sat, 10 Mar 2012 10:36:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2012/3/10/My-page-scraper-and-Twitterfeed</guid>
				
			</item>
			
			<item>
				<title>Using ColdFusion to Deflate compress a SAML XML authentication message</title>
				<link>http://blog.webdh.com/index.cfm/2010/9/17/Using-ColdFusion-to-Deflate-compress-a-SAML-XML-authentication-message</link>
				<description>
				
				I am working on a ColdFusion project that uses SAML to authenticate users. I won&apos;t get into all the specific application details as they are quite complicated. However, the point of this blog post is to explain the components of the authentication request XML message that gets DEFLATE compressed, Base64 encoded and URL encoded.  I hope some of this can help others dealing with SAML and/or Deflate compression in their projects.

To implement &quot;DEFLATE compressed&quot; I knew Java would come into play and I found this resource which explained the &lt;a href=&quot;http://download.oracle.com/javase/6/docs/api/java/util/zip/Deflater.html&quot;&gt;Java Deflater class&lt;/a&gt;. 

This is the example Java code I needed to represent in ColdFusion.
&lt;code&gt;
/* Encode a String into bytes */
String inputString = &quot;blahblahblah??&quot;;
byte[] input = inputString.getBytes(&quot;UTF-8&quot;);

/* Compress the bytes */
byte[] output = new byte[100];
Deflater compresser = new Deflater();
compresser.setInput(input);
compresser.finish();
int compressedDataLength = compresser.deflate(output);
&lt;/code&gt;

I had a hard time finding any help on how I could create the Java byte array &lt;strong&gt;&quot;output&quot;&lt;/strong&gt; variable in ColdFusion. Luckily, I came across this old 2004 &lt;a href=&quot;http://blogs.adobe.com/cantrell/archives/2004/01/byte_arrays_and_1.html&quot;&gt;blog post from Christian Cantrell&lt;/a&gt;. This find was a life saver, thanks Christian!  Here is Christian&apos;s code:
&lt;code&gt;
&lt;cffunction name=&quot;getByteArray&quot; access=&quot;private&quot; returnType=&quot;binary&quot; output=&quot;no&quot;&gt;
&lt;cfargument name=&quot;size&quot; type=&quot;numeric&quot; required=&quot;true&quot;/&gt;
&lt;cfset var emptyByteArray = createObject(&quot;java&quot;, &quot;java.io.ByteArrayOutputStream&quot;).init().toByteArray()/&gt;
&lt;cfset var byteClass = emptyByteArray.getClass().getComponentType()/&gt;
&lt;cfset var byteArray = createObject(&quot;java&quot;,&quot;java.lang.reflect.Array&quot;).newInstance(byteClass, arguments.size)/&gt;
&lt;cfreturn byteArray/&gt;
&lt;/cffunction&gt;
&lt;/code&gt;

Here is my final ColdFusion code that represents the original Java example above.
&lt;code&gt;
&lt;!--- setup ColdFusion/Java bytearray variable  ---&gt;
&lt;cfset emptyByteArray = createObject(&quot;java&quot;, &quot;java.io.ByteArrayOutputStream&quot;).init().toByteArray()/&gt;
&lt;cfset byteClass = emptyByteArray.getClass().getComponentType()/&gt;
&lt;cfset output = createObject(&quot;java&quot;,&quot;java.lang.reflect.Array&quot;).newInstance(byteClass, 500)/&gt;

&lt;!--- perform Deflate, Base64 encode, and URL encode ---&gt;
&lt;cfscript&gt;
saml_deflate = createObject(&quot;java&quot;, &quot;java.util.zip.Deflater&quot;);
saml_deflate.init(9,true);
saml_deflate.setInput(saml_xml.getBytes(&quot;UTF-8&quot;));
saml_deflate.finish();
compressedDataLength = saml_deflate.deflate(output);
data64 = toBase64(output,&quot;UTF-8&quot;);
data64url = urlencodedformat(data64);
&lt;/cfscript&gt;
&lt;/code&gt;

Before the ColdFusion code above, you start with the SAML XML message like this, which is saved in the CF variable &lt;strong&gt;&quot;saml_xml&quot;&lt;/strong&gt;, and the final result is in the CF variable &lt;strong&gt;&quot;data64url&quot;&lt;/strong&gt;.
&lt;code&gt;
&lt;cfsavecontent variable=&quot;saml_xml&quot;&gt;&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt;
&lt;samlp:AuthnRequest xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;
xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot;
ID=&quot;a966242f393474b7d95f4581ff7db131d&quot; Version=&quot;2.0&quot;
IssueInstant=&quot;2010-05-10T16:24:33.525Z&quot;&gt;
&lt;saml:Issuer&gt;http://theissuer.domain.org/app/&lt;/saml:Issuer&gt;
&lt;/samlp:AuthnRequest&gt;&lt;/cfsavecontent&gt;
&lt;/code&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 17 Sep 2010 11:16:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2010/9/17/Using-ColdFusion-to-Deflate-compress-a-SAML-XML-authentication-message</guid>
				
			</item>
			
			<item>
				<title>Using ColdFusion with a stubborn MS Access Date/Time field</title>
				<link>http://blog.webdh.com/index.cfm/2010/3/20/Using-ColdFusion-with-a-stubborn-MS-Access-DateTime-field</link>
				<description>
				
				I have a small application using a MS Access database. Yes, I know all the reasons why it shouldn&apos;t be used, let&apos;s not go there. Fact is, many developers still use Access for small apps, prototyping, etc, and may come across the same roadblock in which I figured out a solution. For reference, today&apos;s date is &lt;strong&gt;3/19/2010&lt;/strong&gt; which was used in the query examples shown.
&lt;br /&gt;&lt;br /&gt;

&lt;strong&gt;Requirement:&lt;/strong&gt; Query a table of Jobs (JobTitle, Dept, Salary, etc) that contains a Date/Time field named PostingEndDate. This field is configured as Required = No. That means the admin user who populates records in the table will either supply a date, or may leave the date blank.  Think of it as a field that allows NULL in MS SQL. On the end-user side, the query needs to list only current jobs by filtering the records where:&lt;br /&gt;
1) PostingEndDate has not passed today&apos;s date&lt;br /&gt;
OR&lt;br /&gt;
2) PostingEndDate is empty (blank value means the Job can be displayed to the user indefinitely)

Here is a cfdump (jobList_raw) of all records:
&lt;code&gt;
SELECT   JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM     tblJob 
WHERE 	 ActiveJob = 1
ORDER BY JobTitle
&lt;/code&gt;
&lt;img src=&quot;/images/posts/1_rawdata.jpg&quot;&gt;
&lt;br /&gt;&lt;br /&gt;

&lt;strong&gt;Problem:&lt;/strong&gt; no easy way to write the WHERE clause. Here are some attempts:&lt;br /&gt;
1) Len(PostingEndDate) = 0&lt;br /&gt;
No error, but does not pick up those with blank dates:
&lt;code&gt;
SELECT   JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM     tblJob 
WHERE 	 ActiveJob = 1
AND   (Now() &lt;= PostingEndDate OR Len(PostingEndDate) = 0)
ORDER BY JobTitle
&lt;/code&gt;

2) PostingEndDate = &apos;&apos;&lt;br /&gt;
Generates error: [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression. &lt;br /&gt;
We can&apos;t compare the date field to an empty string.
&lt;code&gt;
SELECT   JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM     tblJob 
WHERE 	 ActiveJob = 1
AND   (Now() &lt;= PostingEndDate OR PostingEndDate = &apos;&apos;)
ORDER BY JobTitle
&lt;/code&gt;

3) Cstr(PostingEndDate) = &apos;&apos;&lt;br /&gt;
Generates error: [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Invalid use of Null&lt;br /&gt; 
This was my attempt to Cast the date to a string using an Access function. Guess not.
&lt;code&gt;
SELECT   JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM     tblJob 
WHERE 	 ActiveJob = 1
AND   (Now() &lt;= PostingEndDate OR Cstr(PostingEndDate) = &apos;&apos;)
ORDER BY JobTitle
&lt;/code&gt;
&lt;br /&gt;

&lt;strong&gt;Solution:&lt;/strong&gt; write a ColdFusion Query of Query (QoQ) to UNION the two conditions into one resultset. Here are the steps that lead to the final solution.&lt;br /&gt;
1) I still need a way to get a string representation (varchar) of the date field. So I added another column (PostingEndDate_str) to the Query object.
&lt;code&gt;
&lt;cfset QueryAddColumn(jobList_raw,&quot;PostingEndDate_str&quot;,&quot;varchar&quot;,Arraynew(1))&gt;
&lt;/code&gt;

2) Loop query and populate the new varchar field. This was intended to produce a blank string for what cfdump showed as [empty string]. Then I should be able to use: PostingEndDate = &apos;&apos; 
&lt;code&gt;
&lt;cfloop query=&quot;jobList_raw&quot;&gt;
	&lt;cfset QuerySetCell(jobList_raw, &quot;PostingEndDate_str&quot;, &quot;#PostingEndDate#&quot;,currentrow)&gt;
&lt;/cfloop&gt;
&lt;/code&gt;
NOPE! Still see [empty string] in the new field, THIS BECAME THE HAIR PULLING MOMENT OF THE SOLUTION AT THIS POINT, SO I STARTED GOOGLE SEARCHING.&lt;br /&gt;
&lt;img src=&quot;/images/posts/2_str_empty.jpg&quot;&gt;

I decided to try using &apos;-&apos; before and after the value, a trick I noticed in &lt;a href=&quot;http://www.bennadel.com/blog/379-ColdFusion-Query-of-Queries-Unexpected-Data-Type-Conversion.htm&quot;&gt;Ben Nadel&apos;s blog&lt;/a&gt;:
&lt;code&gt;
&lt;cfloop query=&quot;jobList_raw&quot;&gt;
	&lt;cfset QuerySetCell(jobList_raw, &quot;PostingEndDate_str&quot;, &quot;-#PostingEndDate#-&quot;,currentrow)&gt;
&lt;/cfloop&gt;
&lt;/code&gt;
Now I see &quot;--&quot; for all those [empty string] values, much better. I can work with that in the QoQ.&lt;br /&gt;
&lt;img src=&quot;/images/posts/3_str_dashes.jpg&quot;&gt;

3) Last is the Query of Query UNION.
&lt;code&gt;
SELECT	JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM    jobList_raw 
WHERE   #ParseDateTime(DateFormat(Now(),&apos;mm/dd/yyyy&apos;))# &lt;= PostingEndDate  &lt;!--- Lefthand expression will format Now() as: 2010-03-19 00:00:00.0 ---&gt;
UNION
SELECT	JobID, DeptID, JobTitle, Salary, PostingEndDate
FROM    jobList_raw 
WHERE 	 PostingEndDate_str = &apos;--&apos;  &lt;!--- [empty string] dates will contain this value from the QuerySetCell loop executed above ---&gt;
ORDER BY JobTitle
&lt;/code&gt;

Here is the final recordset. It correctly leaves the Architect job filtered out because its PostingEndDate of Mar 9, 2010 has passed. The Mortgage Processor and Supervisor jobs with blank dates are kept in the results!&lt;br /&gt;
&lt;img src=&quot;/images/posts/4_no_architect.jpg&quot;&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<category>SQL</category>				
				
				<pubDate>Sat, 20 Mar 2010 17:16:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2010/3/20/Using-ColdFusion-with-a-stubborn-MS-Access-DateTime-field</guid>
				
			</item>
			
			<item>
				<title>Excited for special ColdFusion Builder event in St. Paul on March 23</title>
				<link>http://blog.webdh.com/index.cfm/2010/3/17/Excited-for-special-ColdFusion-Builder-event-in-St-Paul-on-March-23</link>
				<description>
				
				Josh Adams, Adobe Senior Solutions Engineer for ColdFusion, will be presenting live as part of a special CFUG tour. Josh will bring us the latest details and demonstration of the new Eclipse based IDE, ColdFusion Builder. We are planning for a fun event hosted at our usual user group location, &lt;a href=&quot;http://www.easeltraining.com/locations.htm&quot;&gt;Easel Solutions&lt;/a&gt;. Adobe is shipping us some special event swag as well, so be there for chance to take home a unique prize. Hope to see a packed house, register now!

&lt;a href=&quot;http://www.colderfusion.com/CFBuilder10.cfm&quot;&gt;www.colderfusion.com/CFBuilder10.cfm&lt;/a&gt;

Date: Tuesday, March 23, 2010

Agenda:&lt;br /&gt;
5:45 Food and Social&lt;br /&gt;
6:30 Presentation begins&lt;br /&gt;
8:15 Q &amp; A - Prizes&lt;br /&gt;
8:30 After party at local bar TBD

Location: Easel Solutions, St. Paul, MN

Updated 3/24/2010&lt;br /&gt;
We had a great event, here are some pics!
&lt;table style=&quot;width:194px;&quot;&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;height:194px;background:url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat left&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/tccfug/ColdFusionBuilderJoshAdamsMarch2010?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh3.ggpht.com/_8EIHSD0NziE/S6oCy9g-XUE/AAAAAAAAAUQ/6yYOWWZdFx8/s160-c/ColdFusionBuilderJoshAdamsMarch2010.jpg&quot; width=&quot;160&quot; height=&quot;160&quot; style=&quot;margin:1px 0 0 4px;&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;text-align:center;font-family:arial,sans-serif;font-size:11px&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/tccfug/ColdFusionBuilderJoshAdamsMarch2010?feat=embedwebsite&quot; style=&quot;color:#4D4D4D;font-weight:bold;text-decoration:none;&quot;&gt;ColdFusion Builder - Josh Adams - March 2010&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Wed, 17 Mar 2010 21:56:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2010/3/17/Excited-for-special-ColdFusion-Builder-event-in-St-Paul-on-March-23</guid>
				
			</item>
			
			<item>
				<title>ColdFusion UG Tour coming to St. Paul June 11</title>
				<link>http://blog.webdh.com/index.cfm/2009/5/31/ColdFusion-UG-Tour-coming-to-St-Paul-June-11</link>
				<description>
				
				I&apos;m thrilled to report that &lt;a href=&quot;http://www.forta.com&quot;&gt;Ben Forta&lt;/a&gt; is visiting the Twin Cities again as part of the Adobe &lt;a href=&quot;http://groups.adobe.com/resources/3cfaadbc5e/summary&quot;&gt;worldwide user group tour&lt;/a&gt; for the upcoming versions of ColdFusion and Flex.  I got the official word a few weeks ago and have been head down in planning mode ever since. Figuring attendance will bust down the doors at Easel Solutions, we needed a bigger venue, so I made a bunch of calls, sent emails, and even visited one potential location. In the end we choose the University of St. Thomas, St. Paul Campus and I think it is going to work out great.

I want to thank the TCCFUG&apos;s co-manager, Ben Ellefson, for major work on the event registration website. It&apos;s now live and I urge you to get this on your calendar and &lt;a href=&quot;http://colderfusion.com/forta09.cfm&quot;&gt;register now&lt;/a&gt;. This is one user group meeting you will not want to miss, plus you&apos;ll be fed and could win an IPod touch to boot.

Hope to see you there!

Updated 6/12/2009&lt;br /&gt;
We had a great event, here are some pics!
&lt;table style=&quot;width:194px;&quot;&gt;&lt;tr&gt;&lt;td align=&quot;center&quot; style=&quot;height:194px;background:url(http://picasaweb.google.com/s/c/transparent_album_background.gif) no-repeat left&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/tccfug/AdobeCF9Flex4UGTourStPaul2009?feat=embedwebsite&quot;&gt;&lt;img src=&quot;http://lh6.ggpht.com/_8EIHSD0NziE/SjEt5--eMqE/AAAAAAAAANw/kUTyq24jp14/s160-c/AdobeCF9Flex4UGTourStPaul2009.jpg&quot; width=&quot;160&quot; height=&quot;160&quot; style=&quot;margin:1px 0 0 4px;&quot;&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;text-align:center;font-family:arial,sans-serif;font-size:11px&quot;&gt;&lt;a href=&quot;http://picasaweb.google.com/tccfug/AdobeCF9Flex4UGTourStPaul2009?feat=embedwebsite&quot; style=&quot;color:#4D4D4D;font-weight:bold;text-decoration:none;&quot;&gt;Adobe CF9/Flex4 UG Tour St. Paul 2009&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt; 
				</description>
				
				<category>Conferences</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Sun, 31 May 2009 23:36:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2009/5/31/ColdFusion-UG-Tour-coming-to-St-Paul-June-11</guid>
				
			</item>
			
			<item>
				<title>Update your Twitter status from ColdFusion using a JSP tag library</title>
				<link>http://blog.webdh.com/index.cfm/2009/2/4/Update-your-Twitter-status-from-ColdFusion-using-a-JSP-tag-library</link>
				<description>
				
				Today I wanted to find an easy way to put a status update into my Twitter account using ColdFusion. I went searching the API docs, and found this page.

&lt;a href=&quot;http://apiwiki.twitter.com/Libraries&quot; target=&quot;_blank&quot;&gt;http://apiwiki.twitter.com/Libraries&lt;/a&gt;

Unfortunately, there are no CF examples listed, boo! However, there are some for Java, so I continued my search in that direction. Eventually I found this JSP taglib, and decided to give it a &quot;Twirl&quot; :)

&lt;a href=&quot;http://www.servletsuite.com/servlets/twittertag.htm&quot; target=&quot;_blank&quot;&gt;http://www.servletsuite.com/servlets/twittertag.htm&lt;/a&gt;

To use any JSP taglib, you simply drop the .jar file into your /webroot/WEB-INF/lib/ directory. I believe it also requires the Enterprise edition of ColdFusion. A &lt;a href=&quot;http://coldfusion.sys-con.com/node/41747&quot; target=&quot;_blank&quot;&gt;good article&lt;/a&gt; that fully explains their usage was done by Charlie Arehart back in May 2002.

After copying the file, you must then restart ColdFusion. This is a must or you will get an error when attempting to import the library. 

That&apos;s it, I was now ready to test a Twitter post. Here is the sample code I used that will put a new status message in my Twitter account. I saved this in a file twitter.cfm, then browsed to the page on my local machine as http://localhost/twitter.cfm 
&lt;code&gt;
&lt;cfimport taglib=&quot;/WEB-INF/lib/twittertag.jar&quot; prefix=&quot;twitter&quot;&gt; 
&lt;twitter:update user=&quot;your_username_here&quot; password=&quot;your_password_here&quot; id=&quot;result&quot;&gt;
My posting to Twitter from CF &lt;cfoutput&gt;#now()#&lt;/cfoutput&gt; 
&lt;/twitter:update&gt; 
&lt;/code&gt;

Upon success, an XML dataset is returned in the &quot;result&quot; variable. If you cfdump it, looks like this.
&lt;code&gt;
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt; &lt;status&gt; &lt;created_at&gt;Wed Feb 04 21:29:26 +0000 2009&lt;/created_at&gt; &lt;id&gt;1177644114&lt;/id&gt; &lt;text&gt;My posting to Twitter from CF {ts &apos;2009-02-04 15:29:28&apos;}&lt;/text&gt; &lt;source&gt;web&lt;/source&gt; &lt;truncated&gt;false&lt;/truncated&gt; &lt;in_reply_to_status_id&gt;&lt;/in_reply_to_status_id&gt; &lt;in_reply_to_user_id&gt;&lt;/in_reply_to_user_id&gt; &lt;favorited&gt;false&lt;/favorited&gt; &lt;in_reply_to_screen_name&gt;&lt;/in_reply_to_screen_name&gt; &lt;user&gt; &lt;id&gt;20062919&lt;/id&gt; &lt;name&gt;Twin Cities CFUG&lt;/name&gt; &lt;screen_name&gt;TCCFUG&lt;/screen_name&gt; &lt;location&gt;St. Paul, MN USA&lt;/location&gt; &lt;description&gt;Adobe ColdFusion User Group -of Minneapolis / St. Paul, Minnesota&lt;/description&gt; &lt;profile_image_url&gt;http://s3.amazonaws.com/twitter_production/profile_images/75391930/colderfusion_twitter_normal.jpg&lt;/profile_image_url&gt; &lt;url&gt;http://groups.adobe.com/groups/bd9082a926/&lt;/url&gt; &lt;protected&gt;false&lt;/protected&gt; &lt;followers_count&gt;0&lt;/followers_count&gt; &lt;/user&gt; &lt;/status&gt;
&lt;/code&gt;

If you fail to restart CF, you will see this TagExtraInfo error message:
&lt;code&gt;
The TagExtraInfo class com.cj.twitter.strVariable for the update tag could not be found.

The CFML compiler was processing:
    * A cfimport tag beginning on line 1, column 2.
&lt;/code&gt;

This is not the best solution if you are in a shared hosting environment, as they may not install the twittertag.jar file for you. I&apos;m curious what other methods developers have found to accomplish status posts to Twitter. 
				</description>
				
				<category>Twitter</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Wed, 04 Feb 2009 15:35:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2009/2/4/Update-your-Twitter-status-from-ColdFusion-using-a-JSP-tag-library</guid>
				
			</item>
			
			<item>
				<title>ColdFusion UDFs long2ip() and ip2long()</title>
				<link>http://blog.webdh.com/index.cfm/2009/1/6/ColdFusion-UDFs-long2ip-and-ip2long</link>
				<description>
				
				Yesterday I was working on porting some PHP code into ColdFusion. The PHP code was using a function called long2ip(), and I researched this &lt;a href=&quot;http://us3.php.net/manual/en/function.long2ip.php&quot;&gt;PHP Manual&lt;/a&gt; website to learn more about it.  I needed this function in CF, but couldn&apos;t find it at cflib or anywhere else doing a few Google searches. The closest I came was this &lt;a href=&quot;http://www.bpurcell.org/blog/index.cfm?mode=entry&amp;entry=1078&quot;&gt;blog post by Brandon Purcell&lt;/a&gt;, which got me started in the right direction. I learned from what Brandon wrote, along with the comments input by Gabriel Malca (if the function doesn&apos;t exist) at the PHP Manual site and came up with the logic for my CF version of the function.  After I had this working, I figured I better implement the opposite conversion function as well, so I also created ip2long(). Again I found a user comment for when the function doesn&apos;t exist to base my function&apos;s logic. I submitted these to &lt;a href=&quot;http://www.cflib.org&quot;&gt;cflib.org&lt;/a&gt; today, so look for them soon.  

Examples:&lt;br&gt;
long2ip(3401190660) = 202.186.13.4&lt;br&gt;
ip2long(202.186.13.4) = 3401190660

Here is the code for UDFs below:
&lt;code&gt;
&lt;cfscript&gt;
/**
 * Generates an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) from the proper address representation. Returns 0 if error occurs.
 * 
 * @param longip Numeric value of the address you want to convert. (Required)
 * @return Returns a String. 
 * @author Troy Pullis (tpullis@yahoo.com) 
 * @version 1, Jan 5, 2009 
 */
function long2ip(longip)
{
	var ip = &quot;&quot;;
	var i = &quot;&quot;;
    if (longip &lt; 0 || longip &gt; 4294967295) 
		return 0;
    for (i=3;i&gt;=0;i--) {
        ip = ip &amp; int(longip / 256^i);
        longip = longip - int(longip / 256^i) * 256^i;
        if (i&gt;0) 
			ip = ip &amp; &quot;.&quot;;
    }
    return ip;
}

/**
 * Converts a string containing an (IPv4) Internet Protocol dotted address (aaa.bbb.ccc.ddd) into a proper address representation.  Returns 0 if error occurs.
 * 
 * @param ip Dotted address value you want to convert. (Required)
 * @return Returns a String. 
 * @author Troy Pullis (tpullis@yahoo.com) 
 * @version 1, Jan 5, 2009 
 */
function ip2long(ip) {
	var iparr = ListToArray(ip,&quot;.&quot;);
	if (ArrayLen(iparr) != 4)
		return 0;
	else 
	 	return iparr[1]*256^3 + iparr[2]*256^2 + iparr[3]*256 + iparr[4];
}
&lt;/cfscript&gt;
&lt;/code&gt; 
				</description>
				
				<category>PHP</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 06 Jan 2009 11:57:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2009/1/6/ColdFusion-UDFs-long2ip-and-ip2long</guid>
				
			</item>
			
			<item>
				<title>CFC for Building a Zip Code Proximity Search with ColdFusion</title>
				<link>http://blog.webdh.com/index.cfm/2008/11/7/CFC-for-Building-a-Zip-Code-Proximity-Search-with-ColdFusion</link>
				<description>
				
				Back in Oct 2005, SysCon &lt;a href=&quot;http://coldfusion.sys-con.com/node/154258&quot; target=&quot;_blank&quot;&gt;published an article&lt;/a&gt; I wrote in CFDJ magazine. Unfortunately, the &lt;a href=&quot;http://www.webmonkey.com/webmonkey/05/32/index4a.html?tw=programming&quot; target=&quot;_blank&quot;&gt;Webmonkey.com&lt;/a&gt; tutorial I originally based my article on has been removed by Wired. I contacted them and hopefully they&apos;ll dig it up and repost it under their new wiki site. In the meantime, here is a link to the CFC file &lt;a href=&quot;http://blog.webdh.com/demos/zipfinder.zip&quot; target=&quot;_blank&quot;&gt;zipfinder.cfc&lt;/a&gt; used in that article. 

One more note... if you make use of my code examples from the CFDJ article, please write your queries using cfqueryparam, which I should have done in the first place. 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 07 Nov 2008 15:46:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/11/7/CFC-for-Building-a-Zip-Code-Proximity-Search-with-ColdFusion</guid>
				
			</item>
			
			<item>
				<title>Twin Cities CFUG November meeting taking shape</title>
				<link>http://blog.webdh.com/index.cfm/2008/10/28/Twin-Cities-CFUG-November-meeting-taking-shape</link>
				<description>
				
				We have a great meeting planned for both intermediate as well as brand new CF developers. This meeting is Wednesday, Nov 5th at Easel Training.

Room 1) Kurt Wiersma - BlazeDS&lt;br&gt;
Have you ever wondered what BlazeDS is and what it can do? If so this session is for you. We will cover how you can install BlazeDS inside of CF and how CF can communicate with BlazeDS to make Flex applications get real time messages from ColdFusion.

Room 2) Jason Dean - New Developer Breakout Session&lt;br&gt;
This break out session will be an informal meeting for new developers and for developers who are new to CFML. Bring your questions or just learn the basics of ColdFusion.

Both topics will be presented simultaneously in different rooms. Learn more at &lt;a href=&quot;http://colderfusion.com/&quot;&gt;colderfusion.com&lt;/a&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 28 Oct 2008 09:08:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/10/28/Twin-Cities-CFUG-November-meeting-taking-shape</guid>
				
			</item>
			
			<item>
				<title>Whirlwind trip to BFusion/BFlex was a success</title>
				<link>http://blog.webdh.com/index.cfm/2008/9/9/Whirlwind-trip-to-BFusionBFlex-was-a-success</link>
				<description>
				
				Just got back from the &lt;a href=&quot;http://bflex.info/&quot;&gt;BFusion/BFlex&lt;/a&gt; conference and wanted to summarize my weekend. I joined a few local CF developers and we drove 11+ hours to Bloomington, Indiana to attend this FREE 2-day conference put on by some of the Adobe User Groups in conjunction with Indiana University.

Day 1 was ColdFusion focused, and I was in the Intermediate Track. We spent a full day of hands on training learning about the Mach II framework. This was my first formal exposure to a framework and it was great to get a recap of OO principles and see them in action.

Day 2 was Flex focused and I was in the Beginner Track. We started building a basic photo gallery application following the actual Adobe Flex course materials. I only stayed until noon as we had to get back on the road for the long drive home. Plus, I had a similar training back in April at the local Flex Camp in Minneapolis, so I don&apos;t think I missed too much.

Highlights of the trip:&lt;br /&gt;
- good intro to Mach II, hope to start using it on a small app at work&lt;br /&gt;
- my 2nd exposure to Flex, I really need to put this into a work app soon!&lt;br /&gt;
- met some new CFers and had a good time at The Upland Brewery restaraunt&lt;br /&gt;
- got started on &lt;a href=&quot;http://twitter.com/webdh&quot;&gt;Twitter&lt;/a&gt; and now following over 20 others&lt;br /&gt;
- scored tons of swag for giveaways at CFUG (CF tag posters, Fusion Authority frameworks issue, Flex Authority first issue, etc)&lt;br /&gt;
- won a new book: &lt;a href=&quot;http://www.packtpub.com/coldfusion-8-developer-tutorial/book&quot;&gt;ColdFusion 8 Developer Tutorial&lt;/a&gt;&lt;br /&gt;
- arrived there and back home safely as we covered approx 1400 miles by car 
				</description>
				
				<category>Conferences</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 09 Sep 2008 15:26:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/9/9/Whirlwind-trip-to-BFusionBFlex-was-a-success</guid>
				
			</item>
			
			<item>
				<title>Seal Guard Systems pondering ColdFusion</title>
				<link>http://blog.webdh.com/index.cfm/2008/8/9/Seal-Guard-Systems-pondering-ColdFusion</link>
				<description>
				
				I&apos;ve started working with a new client over the past couple of weeks. Ken Wolfbauer and Kathi Wolfbauer of &lt;a href=&quot;http://www.sealguardsystems.com/&quot;&gt;Seal Guard Systems&lt;/a&gt; who approached me to help with their HTML and SEO. We have been working together in their great showroom in Blaine, MN. I&apos;ve suggested that they move their site under ColdFusion. I&apos;m looking forward to working with Ken and Kathi to promote their products and services on the Internet, including &lt;a href=&quot;http://www.sealguardsystems.com/milgard_fiberglass_windows.htm&quot;&gt;Milgard fiberglass windows&lt;/a&gt; and &lt;a href=&quot;http://www.sealguardsystems.com/MetalRoofing.htm&quot;&gt;Metro steel roofing&lt;/a&gt;. Hopefully I&apos;ll convince Kathi to start using ColdFusion so we can take their website to the next level. 
				</description>
				
				<category>HTML</category>				
				
				<category>ColdFusion</category>				
				
				<pubDate>Sat, 09 Aug 2008 15:37:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/8/9/Seal-Guard-Systems-pondering-ColdFusion</guid>
				
			</item>
			
			<item>
				<title>Useful checks to test for XSS attacks on your ColdFusion site</title>
				<link>http://blog.webdh.com/index.cfm/2008/6/25/Useful-checks-to-test-for-XSS-attacks-on-your-ColdFusion-site</link>
				<description>
				
				If you have a ColdFusion page that contains a form with text inputs or uses URL params, make sure you are not vulnerable to a XSS attack. I&apos;m quite novice at this myself, but learning more about it recently.

Here are some inputs to try in your forms or URL param values, if they echo the value back to the user after the page submits/reloads. This is often done on forms with server side validation when 1 or more errors are found, you preserve the fields already typed by the user and give them an error message to try again.

&lt;code&gt;
FORM INPUTS
&quot;&gt;&lt;blink&gt;XSS&lt;/blink&gt;
&quot;&gt;&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;&lt;

FORM TEXTAREA
&lt;/textarea&gt;&lt;script&gt;alert(&quot;XSS vulnerability&quot;)&lt;/script&gt;&lt;textarea

URL PARAM VALUES
&quot;&gt;&lt;script&gt;alert(&quot;XSS&quot;)&lt;%2Fscript&gt;&lt;
&quot;&gt;&lt;img+src%3Dhttp%3A%2F%2Fintercodes.files.wordpress.com%2F2007%2F10%2Fhacked.jpg&gt;&lt;&quot;
&quot;+onmouseover=alert(&quot;XSS&quot;)+
click%20here%22%20onmouseover=%22javasript:alert(%27XSS%27)%22
&lt;/code&gt;

The solution is to wrap any value that echos back on the page in HtmlEditFormat(). For example:

&lt;code&gt;
#HtmlEditFormat(URL.firstname)#
or
#HtmlEditFormat(Form.company)#
&lt;/code&gt;

Even Ray Camden&apos;s blog.cfc is vulnerable. To see what I mean, follow these steps:

1) &lt;a href=&quot;http://blog.webdh.com/contact.cfm&quot; target=&quot;_blank&quot;&gt;Click here to the contact page&lt;/a&gt;

2) Enter the following in the Name field:
&lt;code&gt;
&quot;&gt;&lt;script&gt;alert(&quot;XSS&quot;)&lt;/script&gt;&lt;
&lt;/code&gt;

3) Click the &lt;em&gt;Send Your Comments&lt;/em&gt; button 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Wed, 25 Jun 2008 14:51:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/6/25/Useful-checks-to-test-for-XSS-attacks-on-your-ColdFusion-site</guid>
				
			</item>
			
			<item>
				<title>ColdFusion infinite loop causes Java heap space error</title>
				<link>http://blog.webdh.com/index.cfm/2008/6/20/ColdFusion-infinite-loop-causes-Java-heap-space-error</link>
				<description>
				
				If you get an error page like this, and are scratching your head as to why, it&apos;s probably an infinite loop in your CFML code. The error I had was this, and sure enough, I had an out of control loop.

&lt;code&gt;
500 

ROOT CAUSE: 
java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2882)
        at java.io.CharArrayWriter.write(CharArrayWriter.java:105)
        at coldfusion.runtime.CharBuffer.replace(CharBuffer.java:37)
        at coldfusion.runtime.CharBuffer.replace(CharBuffer.java:50)
        at
coldfusion.runtime.NeoBodyContent.write(NeoBodyContent.java:254)
        at.........
&lt;/code&gt; 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Fri, 20 Jun 2008 10:18:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/6/20/ColdFusion-infinite-loop-causes-Java-heap-space-error</guid>
				
			</item>
			
			<item>
				<title>Putting ColdFusion to sleep</title>
				<link>http://blog.webdh.com/index.cfm/2008/4/8/ColdFusion-MX-sleep</link>
				<description>
				
				Here is a code snippet that makes the ColdFusion processing &quot;sleep&quot; for the specified number of milliseconds.  This works on ColdFusion MX 6 and above, which can expose the Java language from within CFML.

&lt;code&gt;
&lt;cfset thread = CreateObject(&quot;java&quot;, &quot;java.lang.Thread&quot;)&gt;
&lt;cfset thread.sleep(3000)&gt;  &lt;!--- About to sleep for 3 seconds... ---&gt;
&lt;/code&gt;

ColdFusion 8 introduced a new sleep() function. The above code and the new function are explained in more detail in this &lt;a href=&quot;http://coldfusioncookbook.com/entry/61/How-do-I-make-a-template-pause(sleep)?&quot;&gt;ColdFusion Cookbook article&lt;/a&gt;. 
				</description>
				
				<category>ColdFusion</category>				
				
				<pubDate>Tue, 08 Apr 2008 18:25:00 -0700</pubDate>
				<guid>http://blog.webdh.com/index.cfm/2008/4/8/ColdFusion-MX-sleep</guid>
				
			</item>
			</channel></rss>