<?xml version="1.0" ?>
<?xml-stylesheet type="text/css" href="http://www.petefreitag.com/rss/simple_style.css" ?>
<rss version="2.0">
<channel>
<title>Pete Freitag's Homepage</title>
<link>http://www.petefreitag.com/</link>
<description>Covering ColdFusion, Java, Web Development, and other topics</description>
<language>en-us</language>
<docs>This file is an RSS 2.0 file, please see: http://blogs.law.harvard.edu/tech/rss for more info.</docs>
<lastBuildDate>Thu, 31 Jul 2008 19:25:00 GMT</lastBuildDate>
<ttl>45</ttl>
<item>
<title>Dear SQL Server Enterprise Manager Developer</title>
<link>http://www.petefreitag.com/item/679.cfm</link>
<guid>http://www.petefreitag.com/item/679.cfm</guid>
<description><![CDATA[ <p>Please add a button to make a column an identity.</p><p>You have a button to set as primary key, why do we have to scroll down through 3/4 of the properties, click the plus under "Identity", and then choose "Yes" for such a common operation?</p>
<p>Thank You</p> ]]></description>
<pubDate>Thu, 31 Jul 2008 19:25:00 GMT</pubDate>
<category>Databases</category>
<category>sql</category>
<category>sql server</category>
<category>microsoft</category>
</item>
<item>
<title>PostalMethods - Web Service for Snail Mail</title>
<link>http://www.petefreitag.com/item/678.cfm</link>
<guid>http://www.petefreitag.com/item/678.cfm</guid>
<description><![CDATA[ <p><img src="http://www.petefreitag.com/images/blog/postalmethods.png" align="left" alt="PostalMethods Logo" style="padding:6px;" />I just noticed <a href="http://www.postalmethods.com/">PostalMethods</a> a new SOAP web service / API for sending snail mail via the US Postal Service. This service is from the folks at <a href="http://www.interfax.net/">InterFax</a> who have a nice web service for sending Faxes as well.</p>
<p>It was nice to see that they have code samples for <a href="http://www.postalmethods.com/resources/samples/coldfusion">ColdFusion</a>!</p>
<p>Some potential uses for this new service:</p>
<ul>
<li><strong>Mailing Address Verification</strong> - you can send an automated letter with a personalized code, and have them enter in the code to your web site.</li>
<li><strong>Security Nofications</strong> - You can send a letter to a users mailing address, when the account email or password is changed for verification purposes.</li>
<li><strong>Promotional Codes</strong> - Setup a scheduled task that runs through your customers and sends out a certain amount of coupons each month.</li>
<li><strong>Lots More</strong> - What would you use it for?</li>
</ul> ]]></description>
<pubDate>Sun, 27 Jul 2008 23:03:00 GMT</pubDate>
<category>ColdFusion</category>
<category>mail</category>
<category>web services</category>
<category>api</category>
<category>soap</category>
</item>
<item>
<title>Mastering CFQUERYPARAM</title>
<link>http://www.petefreitag.com/item/677.cfm</link>
<guid>http://www.petefreitag.com/item/677.cfm</guid>
<description><![CDATA[ <p>If you haven't been using the <code><a href="http://cfdocs.org/cfqueryparam">cfqueryparam</a></code> tag, chances are you had a baptism by fire this week. As you may have heard, lots of ColdFusion powered sites were targeted by hackers using SQL Injection this week.</p>
<p>Fortunately SQL Injection is very easy to prevent in CFML using the <code>cfqueryparam</code> tag, and many people have pointed out some of the simple use cases for the tag. But there are a few cases where you can't use the <code>cfqueryparam</code> tag. In those cases, ColdFusion might throw an exception that looks like this:</p>
<pre>
[Macromedia][SQLServer JDBC Driver][SQLServer]Incorrect syntax near '@P1'.
[Macromedia][SQLServer JDBC Driver][SQLServer]Statement(s) could not be prepared.
</pre>
<p>Let's take a look at some of these special cases, and how to get around them:</p>
<p><strong>SELECT TOP</strong></p>
<p>If you are passing a variable into a <code>SELECT TOP</code> statement, you can't use <code>cfqueryparam</code>, instead consider using the <code>Val</code> function. This is a really handy function that will return <code>0</code> whenever it gets a non-numeric value, and will convert decimal values into integers.</p>
<pre>
SELECT TOP #Val(url.max_rows)# first_name FROM people
</pre>
<p><strong>ORDER BY</strong></p>
<p>When attempting to use a <code>cfqueryparam</code> tag in the <code>ORDER BY</code> statement you might receive an error such as:</p>
<pre>
[Macromedia][SQLServer JDBC Driver][SQLServer]The SELECT item identified
by the ORDER BY number 1 contains a variable as part of the expression
identifying a column position. Variables are only allowed when ordering
by an expression referencing a column name.
</pre>
<p>A good way to get around this limitation is to use the <code>ListFindNoCase</code> function, to limit the sortable column names, for example:</p>
<pre>
&lt;cfset sortable_column_list = "age,height,weight,first_name"&gt;
&lt;cfquery ...&gt;
&nbsp; SELECT first_name, age, height, weight
&nbsp; FROM people
&nbsp; ORDER BY &lt;cfif ListFindNoCase(sortable_column_list, url.sort_column)&gt;#url.sort_column#&lt;cfelse&gt;first_name&lt;/cfif&gt;
&lt;/cfquery&gt;
</pre>
<p><strong>Passing Value Lists using IN</strong></p>
<p>What to do when your variable contains a list of values to be used with a SQL <code>IN</code> expression? The <code>cfqueryparam</code> actually makes it very easy to pass a list, you don't even need to put single quotes around each element if for text lists, it takes care of that for you. To use <code>cfqueryparam</code> with an <code>IN</code> simply add <code>list="true"</code> to your <code>cfqueryparam</code> tag.</p>
<pre>
&lt;cfset name_list = "Bob,Fred,Pete"&gt;
&lt;cfquery ...&gt;
&nbsp; SELECT first_name, age, height, weight
&nbsp; FROM people
&nbsp; WHERE first_name IN (&lt;cfqueryparam value="#name_list#" list="true" cfsqltype="cf_sql_varchar"&gt;)
&lt;/cfquery&gt;
</pre>
<p><strong>Cached Queries</strong></p>
<p>ColdFusion 8 now allows <code>cfqueryparam</code> in cached queries, but if you are running earlier versions, you won't be able to use it with cached queries.</p>
<p>If the variables passed into the query are integer only, then you can use the <code>Val</code> function to protect against SQL Injection. Or if the possible string values are limited you can use the <code>ListFindNoCase</code> function as shown above.</p>
<p>The best workaround is to remove the caching, upgrade to CF8, or cache them in the application scope, as follows:</p>
<pre>
&lt;cfif NOT IsDefined("application.my_cached_query")&gt;
&nbsp; &lt;cfquery name="application.my_cached_query"&gt;
&nbsp;&nbsp;&nbsp; ...
&nbsp; &lt;/cfquery&gt;
&lt;/cfif&gt;
</pre>
<p>This will keep the query cached until the application is reinitialized, or the variable is overwritten.</p>
<p><strong>Passing NULL's</strong></p>
<p>The <code>cfqueryparam</code> lets you pass <code>null</code> values into your database using the <code>null="true"</code> attribute. For example:</p>
<pre>
UPDATE people
SET age = &lt;cfif IsValid("integer", form.age) AND form.age NEQ 0&gt;
&nbsp; &lt;cfqueryparam value="#form.age#" cfsqltype="cf_sql_integer"&gt;
&lt;cfelse&gt;
&nbsp; &lt;cfqueryparam null="true" cfsqltype="cf_sql_integer"&gt;
&lt;/cfif&gt;
</pre>
<br />
<p>Those are some of the more common gotcha's that you will run into with <code>cfqueryparam</code>. Please post a comment with any other <code>cfqueryparam</code> tricks, or special cases.</p> ]]></description>
<pubDate>Thu, 24 Jul 2008 21:05:00 GMT</pubDate>
<category>ColdFusion</category>
<category>cfqueryparam</category>
<category>cfml</category>
<category>security</category>
<category>sql injection</category>
<category>sql</category>
<category>cfquery</category>
</item>
<item>
<title>Google Code Search for ColdFusion</title>
<link>http://www.petefreitag.com/item/676.cfm</link>
<guid>http://www.petefreitag.com/item/676.cfm</guid>
<description><![CDATA[ <p>Google's code search engine has been <a href="http://google-code-updates.blogspot.com/2008/07/code-search-improved-browsing-and-new.html">updated </a> with an outline view that shows hierarchy of Java, C, C++, C#, Python, JavaScript and Pascal source files.</p>
<p>You can also filter searches by language, for example if you just wanted to search for ColdFusion code you can add: <a href="http://gooogle.com/codesearch?q=lang%3Acoldfusion">lang:coldfusion</a> to your query.</p> ]]></description>
<pubDate>Mon, 14 Jul 2008 12:13:00 GMT</pubDate>
<category>ColdFusion</category>
<category>google</category>
<category>search</category>
<category>code</category>
</item>
<item>
<title>Speaking at CFUNITED 2008</title>
<link>http://www.petefreitag.com/item/675.cfm</link>
<guid>http://www.petefreitag.com/item/675.cfm</guid>
<description><![CDATA[ <p><img src="http://www.petefreitag.com/images/blog/125x125_cfunited08_speaker.jpg" alt="Speaking at CFUNITED 2008" border="0" align="left" style="margin-right:15px;margin-bottom:4px;" /> I can't believe it's already time for CFUNITED again! I will be speaking twice again this year:</p>
<ul>
<li>Thursday @ 2:45p - Writing Secure CFML</li>
<li>Friday @ 8:30a - Image Manipulation with ColdFusion 8</li>
</ul>
<p>See you there!</p>
]]></description>
<pubDate>Mon, 16 Jun 2008 13:23:00 GMT</pubDate>
<category>ColdFusion</category>
<category>cfunited</category>
<category>presentations</category>
<category>speaking</category>
</item>
<item>
<title>Getting ColdFusion SQL Statements from SQL Server Trace</title>
<link>http://www.petefreitag.com/item/674.cfm</link>
<guid>http://www.petefreitag.com/item/674.cfm</guid>
<description><![CDATA[ <p>Running a SQL Trace in the SQL Server Profiler can be a great way to track down performance problems in your ColdFusion application. However if you have tried to run one, you probably didn't see the actualy SQL queries your ColdFusion application was sending, only things like this:</p>
<pre>
RPC:Completed exec sp_execute 1,2,4
</pre>
<p>The reason for this is that ColdFusion's JDBC Driver for SQL Server passes SQL statements through the <code>sp_execute</code> stored procedure, so you are only seeing the stored procedure call. You need to enable an event that is not enabled by default, the <code>SP:StmtCompleted</code> event.</p>
<div align="center">
<img src="http://www.petefreitag.com/images/blog/coldfusion-sqlserver-trace.png" alt="SQL Server ColdFusion Trace Setup" border="0" />
</div>
<p>When you start your trace click on the <code>Event Selection</code> tab, and then check <code>Show all events</code> then find <code>SP:StmtCompleted</code> under the <code>Stored Procedures</code> node.</p>
<p>The above was tested on SQL Server 2005, you may have a different UI on previous versions.</p>
<p>Now when you run your trace you should see your SQL Statements in the <code>TextData</code> column where <code>EventClass</code> is <code>SP:StmpCompleted</code></p> ]]></description>
<pubDate>Mon, 16 Jun 2008 12:48:00 GMT</pubDate>
<category>ColdFusion</category>
<category>Databases</category>
<category>sql</category>
<category>sqlserver</category>
<category>profiler</category>
<category>trace</category>
<category>cf</category>
<category>cfml</category>
</item>
<item>
<title>CFSCRIPT Cheatsheet</title>
<link>http://www.petefreitag.com/item/673.cfm</link>
<guid>http://www.petefreitag.com/item/673.cfm</guid>
<description><![CDATA[ <p>Last year I put together a <a href="http://www.petefreitag.com/cheatsheets/coldfusion/cfscript/" title="Cheat Sheet for CFSCRIPT Syntax">CFSCRIPT cheatsheet</a> for my <a href="http://www.petefreitag.com/cheatsheets/">cheatsheet collection</a>. I just realized today, I don't think I ever blogged about it. Let me know if you find it useful or if I am missing anything.</p> ]]></description>
<pubDate>Mon, 05 May 2008 12:38:00 GMT</pubDate>
<category>ColdFusion</category>
<category>cfscript</category>
<category>cfml</category>
<category>cheatsheets</category>
<category>cheat</category>
<category>sheet</category>
</item>
<item>
<title>3 New Image Effects for ColdFusion 8</title>
<link>http://www.petefreitag.com/item/672.cfm</link>
<guid>http://www.petefreitag.com/item/672.cfm</guid>
<description><![CDATA[ <p><img src="http://www.petefreitag.com/images/blog/board-med-sepia.png" align="left" title="Sepia Tone Lovin" border="0" style="margin-right:8px;margin-bottom:8px;" /> Foundeo has released <a href="http://foundeo.com/image-effects/">3 new Image Effects for ColdFusion 8!</a></p>
<p>The first is <strong>sepia tone</strong>, you can see an example image to the left. Sepia tone was popular in the 1800's (used to give black and white photos a bit of color), but thanks to modern photoediting technology is making a comeback. The idea for this effect came from a customer suggestion.</p>
<p>I also added two other effects to the component which can lighten or darken an image or photo.</p>
<p>You can score all 8 of the effects (rounded corners, gradients, reflections, drop shadows, etc) for $39.99 until Thursday May 1st, when the price increases to $49.99</p>
<p>Existing customers get a free upgrade, so just login to your account, and download the latest code.</p>
<p>Visit <a href="http://foundeo.com/image-effects/">foundeo.com</a> to order.</p> ]]></description>
<pubDate>Mon, 28 Apr 2008 12:49:00 GMT</pubDate>
<category>ColdFusion</category>
<category>foundeo</category>
<category>image effects</category>
<category>cfimage</category>
<category>coldfusion 8</category>
<category>sepia</category>
<category>darken</category>
<category>lighten</category>
</item>
<item>
<title>Googlebot to Submit Web Forms</title>
<link>http://www.petefreitag.com/item/671.cfm</link>
<guid>http://www.petefreitag.com/item/671.cfm</guid>
<description><![CDATA[ <p>I saw recently on the <a href="http://googlewebmastercentral.blogspot.com/2008/04/crawling-through-html-forms.html">Google blog</a> that the <em>Googlebot</em> will start submitting web forms.</p>
<blockquote>
Specifically, when we encounter a <code>&lt;FORM&gt;</code> element on a high-quality site, we might choose to do a small number of queries using the form. For text boxes, our computers automatically choose words from the site that has the form; for select menus, check boxes, and radio buttons on the form, we choose from among the values of the HTML.
</blockquote>
<p>They also listed some important limitations, which makes this seam much less extreme as it did when I first read about it.</p>
<p>The Googlebot will NOT submit forms that:</p>
<ul>
<li>Use <code>method="post"</code></li>
<li>Have <code>password</code> fields</li>
<li>"Use terms commonly associated with personal information such as logins, userids, contacts, etc"</li>
<li>Have a form action that is forbidden in <code>robots.txt</code>
</ul> ]]></description>
<pubDate>Wed, 23 Apr 2008 12:26:00 GMT</pubDate>
<category>Web</category>
<category>google</category>
<category>googlebot</category>
<category>seo</category>
<category>forms</category>
</item>
<item>
<title>ColdFusion 8 Update 1 Fixes some Image Processing Quirks</title>
<link>http://www.petefreitag.com/item/670.cfm</link>
<guid>http://www.petefreitag.com/item/670.cfm</guid>
<description><![CDATA[ <p>It was nice to see that two of the quirks that I talk about in my <em>Image Processing in ColdFusion 8</em> presentation were fixed in ColdFusion 8, Update 1 - they are:</p>
<ul>
<li>The cfimage tag and image functions now retain EXIF data after operating on an image. </li>
<li>The height and width attributes are now optional for cfimage action=captcha. If you omit these
options ColdFusion sizes the Captcha image to fit the generated text. <em>This is nice because if you specified a height or width that was too small it would throw an exception!</em></li>
</ul>
<p>They also added two other enhancements / fixes in this update:</p>
<ul>
<li>The cfimage tag now supports alt, style, and other standard HTML image attributes. </li>
<li>If you specify an image that uses the CMYK color space for the image border, ColdFusion
converts it to the RGB color space. The source image is not changed. </li>
</ul> ]]></description>
<pubDate>Sat, 05 Apr 2008 13:20:00 GMT</pubDate>
<category>ColdFusion</category>
<category>cfimage</category>
<category>exif</category>
<category>captcha</category>
<category>image processing</category>
<category>cfml</category>
</item>
</channel>
</rss>
