<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8688578682638853763</id><updated>2012-01-28T11:33:15.552-05:00</updated><category term='future'/><category term='debug'/><category term='figleaf'/><category term='ToFile.cfm'/><category term='techniques'/><category term='FCK Rich Text'/><category term='coldfusion'/><category term='debug handler'/><category term='iPod'/><category term='java cast'/><category term='MP3'/><category term='wireless carrier'/><category term='cfform'/><category term='conference'/><category term='Apple'/><category term='washington'/><category term='2008'/><category term='flex'/><title type='text'>BonCode</title><subtitle type='html'>Bilal's view on code (Flex, Java, C#, vb, ColdFusion, JavaScript, etc, etc.) and some random other musings.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>62</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7582361770951593162</id><published>2012-01-13T15:14:00.001-05:00</published><updated>2012-01-13T15:14:04.257-05:00</updated><title type='text'>CF: When does OnRequestEnd get executed</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;This is one is from my main man Kip (@kipthegreat) he ran through this exercise using Adoce CF 9.&lt;br /&gt;Might be helpful for others to know.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-bottom: medium none; border-collapse: collapse; border-left: medium none; border-right: medium none; border-top: medium none;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;Situation&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;Does OnRequestEnd() get executed?&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;Page calls &lt;cfabort&gt; tag&lt;o:p&gt;&lt;/o:p&gt;&lt;/cfabort&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: #00b050;"&gt;Yes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;Page calls &lt;cflocation&gt; to redirect user&lt;o:p&gt;&lt;/o:p&gt;&lt;/cflocation&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: #00b050;"&gt;Yes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;Page calls &lt;cfdump&gt; with abort="true"&lt;o:p&gt;&lt;/o:p&gt;&lt;/cfdump&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: #00b050;"&gt;Yes&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;Request exceeds timeout&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: red;"&gt;NO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;Uncaught exception&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;/td&gt;&lt;td style="border-bottom: windowtext 1pt solid; border-left: medium none; border-right: windowtext 1pt solid; border-top: medium none; padding-bottom: 0in; padding-left: 5.4pt; padding-right: 5.4pt; padding-top: 0in; width: 239.4pt;" valign="top" width="319"&gt;&lt;div class="MsoNormal"&gt;&lt;b&gt;&lt;span style="color: red;"&gt;NO&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;div class="MsoNormal"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;o:p&gt;The lesson to pay attention to is to catch and handle your exceptions ;o)&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;o:p&gt;&lt;br /&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;o:p&gt;&amp;nbsp;Cheers,&lt;/o:p&gt;&lt;/div&gt;&lt;div class="MsoNormal"&gt;&lt;o:p&gt;-B&lt;/o:p&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7582361770951593162?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7582361770951593162/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7582361770951593162' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7582361770951593162'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7582361770951593162'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2012/01/cf-when-does-onrequestend-get-executed.html' title='CF: When does OnRequestEnd get executed'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3160764804657663603</id><published>2012-01-08T14:02:00.000-05:00</published><updated>2012-01-08T14:02:00.457-05:00</updated><title type='text'>JavaScript: Check whether a sub object is defined in a multi-object chain</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;When you are in JavaScript mode it is common for you to use&lt;br /&gt;typeof operator to see whether a given variable, object, function etc. is known to JavaScript.&lt;br /&gt;&lt;br /&gt;However, many times I find myself writing more complex code because it is a child of a child object that I need to check for a value. This makes for ugly code.&lt;br /&gt;Being rather simple minded I chose to Google for an obvious solution.&amp;nbsp;Unfortunately, nothing was&amp;nbsp;immediately&amp;nbsp;available (or I might be simple missing it). Most people seem to only need to be dealing with the top level object&amp;nbsp;deceleration&amp;nbsp;and, thus, no need for anything else.&lt;br /&gt;&lt;br /&gt;So, to make a long story short, I created a simple helper function that does most of the work for me and cleans up the repetitive code. Feel free to use it at your leisure:&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;pre&gt;&lt;span style="color: green;"&gt;&lt;i&gt;/**&lt;br /&gt;&lt;br /&gt; * Take string input in varName and determine whether it is defined object in Javascript&lt;br /&gt;&lt;br /&gt; * @param {String} varName&lt;br /&gt;&lt;br /&gt; * @return {boolean}&lt;br /&gt;&lt;br /&gt; * @author Bilal Soylu&lt;br /&gt;&lt;br /&gt; */&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: red;"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt; isDefined&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;varName&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; retStatus &lt;span style="color: blue;"&gt;=&lt;/span&gt; false&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;typeof&lt;/span&gt; varName &lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;"string"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  try &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; arrCheck &lt;span style="color: blue;"&gt;=&lt;/span&gt; varName&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;split&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"."&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; strCheckName &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;""&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; i&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: brown;"&gt;0&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt; arrCheck&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;length&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;+&lt;/span&gt;&lt;span style="color: blue;"&gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    strCheckName &lt;span style="color: blue;"&gt;=&lt;/span&gt; strCheckName &lt;span style="color: blue;"&gt;+&lt;/span&gt; arrCheck&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;i&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: green;"&gt;&lt;i&gt;//check wether this exist&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;    &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;typeof&lt;/span&gt; eval&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;strCheckName&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: purple;"&gt;"undefined"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: green;"&gt;&lt;i&gt;//stop processing&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;     retStatus &lt;span style="color: blue;"&gt;=&lt;/span&gt; false&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: red;"&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;     &lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;else&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: green;"&gt;&lt;i&gt;//continue checking next node&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;     retStatus &lt;span style="color: blue;"&gt;=&lt;/span&gt; true&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     strCheckName &lt;span style="color: blue;"&gt;=&lt;/span&gt; strCheckName &lt;span style="color: blue;"&gt;+&lt;/span&gt; &lt;span style="color: purple;"&gt;"."&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; catch &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;e&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: green;"&gt;&lt;i&gt;//any error means this var is not defined&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;   retStatus &lt;span style="color: blue;"&gt;=&lt;/span&gt; false&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;else&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;   &lt;br /&gt;&lt;br /&gt;  throw &lt;span style="color: purple;"&gt;"the varName input must be a string like myVar.someNode.anotherNode[]"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt; retStatus&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; &lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3160764804657663603?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3160764804657663603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3160764804657663603' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3160764804657663603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3160764804657663603'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2012/01/javascript-check-whether-sub-object-is.html' title='JavaScript: Check whether a sub object is defined in a multi-object chain'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6340995759591756973</id><published>2012-01-02T07:30:00.000-05:00</published><updated>2012-01-05T14:02:39.405-05:00</updated><title type='text'>Java: Implementing PGP Single Pass Sign and Encrypt using League of Bouncy Castle library</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;The League of Bouncy&amp;nbsp;Castle&amp;nbsp;Cryptography library is&amp;nbsp;chock-full of goodies but it is hard to convert what is in there to more practical examples.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;The example files are a solid basis but I seam to need to fiddle quite a bit until it something is usable for me. The PGP Single Pass Sign and Encrypt process is one of these things that took me for a long time to figure out. I owe much of the actual solution impementation to John Opincar who solved this puzzle for C#.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;Here is my implementation for Java:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: -webkit-auto;"&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;pre&gt; &lt;span style="color: green;"&gt;&lt;i&gt;/**&lt;br /&gt;&lt;br /&gt;  * This is the primary function that will create encrypt a file and sign it&lt;br /&gt;&lt;br /&gt;  * with a one pass signature. This leans on an C# example by John Opincar&lt;br /&gt;&lt;br /&gt;  * @author Bilal Soylu&lt;br /&gt;&lt;br /&gt;  * @param targetFileName&lt;br /&gt;&lt;br /&gt;  *            -- file name on drive systems that will contain encrypted content&lt;br /&gt;&lt;br /&gt;  * @param embeddedFileName&lt;br /&gt;&lt;br /&gt;  *            -- the original file name before encryption&lt;br /&gt;&lt;br /&gt;  * @param secretKeyRingInputStream&lt;br /&gt;&lt;br /&gt;  *            -- Private Key Ring File&lt;br /&gt;&lt;br /&gt;  * @param targetFileStream&lt;br /&gt;&lt;br /&gt;  *            -- The stream for the encrypted target file&lt;br /&gt;&lt;br /&gt;  * @param secretKeyPassphrase&lt;br /&gt;&lt;br /&gt;  *            -- The private key password for the key retrieved from&lt;br /&gt;&lt;br /&gt;  *            collection used for signing&lt;br /&gt;&lt;br /&gt;  * @param signPublicKeyInputStream&lt;br /&gt;&lt;br /&gt;  *            -- the public key of the target recipient to be used to&lt;br /&gt;&lt;br /&gt;  *            encrypt the file&lt;br /&gt;&lt;br /&gt;  * @throws Exception&lt;br /&gt;&lt;br /&gt;  */&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;public&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;void&lt;/b&gt;&lt;/span&gt; fEncryptOnePassSignatureLocal&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;String targetFileName&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   String embeddedFileName&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; InputStream secretKeyRingInputStream&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    OutputStream targetFileStream&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; String secretKeyPassphrase&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;   &lt;br /&gt;&lt;br /&gt;   InputStream signPublicKeyInputStream&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; InputStream contentStream&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; Exception &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// ** INIT&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// read public Key from stream (file, if keyring we use the first working key)&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  PGPPublicKey encKey &lt;span style="color: blue;"&gt;=&lt;/span&gt; readPublicKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;signPublicKeyInputStream&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// need to convert the password to a character array&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;char&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt; password &lt;span style="color: blue;"&gt;=&lt;/span&gt; secretKeyPassphrase&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;toCharArray&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; BUFFER_SIZE &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: brown;"&gt;1&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt; &lt;span style="color: brown;"&gt;16&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; &lt;span style="color: green;"&gt;&lt;i&gt;// should always be power of 2(one shifted bitwise 16 places)&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//for now we will always do integrity checks and armor file&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;boolean&lt;/b&gt;&lt;/span&gt; armor &lt;span style="color: blue;"&gt;=&lt;/span&gt; true&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;boolean&lt;/b&gt;&lt;/span&gt; withIntegretyCheck &lt;span style="color: blue;"&gt;=&lt;/span&gt; true&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//set default provider, we will pass this along&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  BouncyCastleProvider bcProvider &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; BouncyCastleProvider&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// armor stream if set&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;armor&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   targetFileStream &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; ArmoredOutputStream&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;targetFileStream&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// Init encrypted data generator&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  PGPEncryptedDataGenerator encryptedDataGenerator &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPEncryptedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    SymmetricKeyAlgorithmTags&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;CAST5&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; withIntegretyCheck&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; SecureRandom&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; bcProvider&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  encryptedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;addMethod&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;encKey&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  OutputStream encryptedOut &lt;span style="color: blue;"&gt;=&lt;/span&gt; encryptedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;open&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;targetFileStream&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;BUFFER_SIZE&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// start compression&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  PGPCompressedDataGenerator compressedDataGenerator &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPCompressedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    CompressionAlgorithmTags&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ZIP&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  OutputStream compressedOut &lt;span style="color: blue;"&gt;=&lt;/span&gt; compressedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;open&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;encryptedOut&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//start signature&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//PGPSecretKeyRingCollection pgpSecBundle = new PGPSecretKeyRingCollection(PGPUtil.getDecoderStream(secretKeyRingInputStream));&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//PGPSecretKey pgpSecKey = pgpSecBundle.getSecretKey(keyId);&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  PGPSecretKey pgpSecKey &lt;span style="color: blue;"&gt;=&lt;/span&gt; readSecretKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;secretKeyRingInputStream&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;pgpSecKey &lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;throw&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; Exception&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"No secret key could be found in specified key ring collection."&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  PGPPrivateKey pgpPrivKey &lt;span style="color: blue;"&gt;=&lt;/span&gt; pgpSecKey&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;extractPrivateKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;password&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;bcProvider&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  PGPSignatureGenerator signatureGenerator &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPSignatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    pgpSecKey&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getPublicKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getAlgorithm&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    HashAlgorithmTags&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;SHA1&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; bcProvider&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  signatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;initSign&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;PGPSignature&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;BINARY_DOCUMENT&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; pgpPrivKey&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// iterate to find first signature to use&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;@SuppressWarnings&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"rawtypes"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  Iterator i &lt;span style="color: blue;"&gt;=&lt;/span&gt; pgpSecKey&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getPublicKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getUserIDs&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;hasNext&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   String userId &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;String&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; i&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   PGPSignatureSubpacketGenerator spGen &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPSignatureSubpacketGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   spGen&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setSignerUserID&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;false&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; userId&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   signatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;setHashedSubpackets&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;spGen&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;generate&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: green;"&gt;&lt;i&gt;// Just the first one!&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;break&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  signatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;generateOnePassVersion&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;false&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;encode&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;compressedOut&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// Create the Literal Data generator output stream&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  PGPLiteralDataGenerator literalDataGenerator &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPLiteralDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// get file handle&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  File actualFile &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; File&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;targetFileName&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// create output stream&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  OutputStream literalOut &lt;span style="color: blue;"&gt;=&lt;/span&gt; literalDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;open&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;compressedOut&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    PGPLiteralData&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;BINARY&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; embeddedFileName&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; Date&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;actualFile&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;lastModified&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;BUFFER_SIZE&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// read input file and write to target file using a buffer&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt; buf &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;byte&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;BUFFER_SIZE&lt;span style="color: blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;int&lt;/b&gt;&lt;/span&gt; len&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;len &lt;span style="color: blue;"&gt;=&lt;/span&gt; contentStream&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;read&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;buf&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color: brown;"&gt;0&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; buf&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;length&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt; &lt;span style="color: brown;"&gt;0&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   literalOut&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;write&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;buf&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color: brown;"&gt;0&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; len&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   signatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;update&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;buf&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color: brown;"&gt;0&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; len&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// close everything down we are done&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  literalOut&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  literalDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  signatureGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;generate&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;encode&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;compressedOut&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  compressedOut&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  compressedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  encryptedOut&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  encryptedDataGenerator&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;armor&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; targetFileStream&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;close&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: green;"&gt;&lt;i&gt;/**&lt;br /&gt;&lt;br /&gt;  * Try to find a public key in the Key File or Key Ring File&lt;br /&gt;&lt;br /&gt;  * We will use the first one for now.&lt;br /&gt;&lt;br /&gt;  * @author Bilal Soylu&lt;br /&gt;&lt;br /&gt;  * @param in -- File Stream to KeyRing or Key&lt;br /&gt;&lt;br /&gt;  * @return first public key&lt;br /&gt;&lt;br /&gt;  * @throws IOException&lt;br /&gt;&lt;br /&gt;  * @throws PGPException&lt;br /&gt;&lt;br /&gt;  */&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; PGPPublicKey readPublicKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;InputStream in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; IOException&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; PGPException &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  in &lt;span style="color: blue;"&gt;=&lt;/span&gt; PGPUtil&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getDecoderStream&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  PGPPublicKeyRingCollection pgpPub &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPPublicKeyRingCollection&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// we are only looking for the first key that matches&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;// iterate through the key rings.&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color: green;"&gt;&lt;i&gt;//&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  Iterator rIt &lt;span style="color: blue;"&gt;=&lt;/span&gt; pgpPub&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getKeyRings&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;rIt&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;hasNext&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   PGPPublicKeyRing kRing &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;PGPPublicKeyRing&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; rIt&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   Iterator kIt &lt;span style="color: blue;"&gt;=&lt;/span&gt; kRing&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getPublicKeys&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;kIt&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;hasNext&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    PGPPublicKey k &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;PGPPublicKey&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; kIt&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;k&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;isEncryptionKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     &lt;span style="color: red;"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt; k&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;throw&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; IllegalArgumentException&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span style="color: purple;"&gt;"Can't find encryption key in key ring."&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt; &lt;span style="color: green;"&gt;&lt;i&gt;/**&lt;br /&gt;&lt;br /&gt;  * Find first secret key in key ring or key file. &lt;br /&gt;&lt;br /&gt;  * A secret key contains a private key that can be accessed with a password.&lt;br /&gt;&lt;br /&gt;  * @author Bilal Soylu&lt;br /&gt;&lt;br /&gt;  * @param in -- input Key file or key ring file&lt;br /&gt;&lt;br /&gt;  * @param passwd -- password for key&lt;br /&gt;&lt;br /&gt;  * @return matching private key&lt;br /&gt;&lt;br /&gt;  * @throws IOException&lt;br /&gt;&lt;br /&gt;  * @throws PGPException&lt;br /&gt;&lt;br /&gt;  * @throws NoSuchProviderException&lt;br /&gt;&lt;br /&gt;  */&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: red;"&gt;&lt;b&gt;private&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;static&lt;/b&gt;&lt;/span&gt; PGPSecretKey readSecretKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;InputStream in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   &lt;span style="color: red;"&gt;&lt;b&gt;throws&lt;/b&gt;&lt;/span&gt; IOException&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; PGPException&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; NoSuchProviderException &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;  PGPSecretKey               sKey &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: red;"&gt;&lt;b&gt;try&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   in &lt;span style="color: blue;"&gt;=&lt;/span&gt; PGPUtil&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getDecoderStream&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   PGPSecretKeyRingCollection pgpPriv &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; PGPSecretKeyRingCollection&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;in&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;   &lt;span style="color: green;"&gt;&lt;i&gt;// we just loop through the collection till we find a key suitable for&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;   &lt;span style="color: green;"&gt;&lt;i&gt;// decrypt&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;   Iterator  it &lt;span style="color: blue;"&gt;=&lt;/span&gt; pgpPriv&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getKeyRings&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;       &lt;br /&gt;&lt;br /&gt;   PGPSecretKeyRing   pbr &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;         &lt;span style="color: red;"&gt;&lt;b&gt;while&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;sKey &lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&amp;amp;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;amp;&lt;/span&gt;&lt;/span&gt; it&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;hasNext&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;          Object readData &lt;span style="color: blue;"&gt;=&lt;/span&gt; it&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;next&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;          &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;readData &lt;span style="color: red;"&gt;&lt;b&gt;instanceof&lt;/b&gt;&lt;/span&gt; PGPSecretKeyRing&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;           &lt;br /&gt;&lt;br /&gt;           pbr &lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;PGPSecretKeyRing&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;readData&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;             &lt;br /&gt;&lt;br /&gt;              sKey &lt;span style="color: blue;"&gt;=&lt;/span&gt;  pbr&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getSecretKey&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;             &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;br /&gt;&lt;br /&gt;         &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;sKey &lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;             &lt;span style="color: red;"&gt;&lt;b&gt;throw&lt;/b&gt;&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;new&lt;/b&gt;&lt;/span&gt; IllegalArgumentException&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"secret key for message not found."&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: red;"&gt;&lt;b&gt;catch&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;PGPException e&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            System&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;err&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;println&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;e&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: red;"&gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;e&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getUnderlyingException&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="color: blue;"&gt;!&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt; &lt;span style="color: red;"&gt;&lt;b&gt;null&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;                e&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getUnderlyingException&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;printStackTrace&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;            &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span style="color: red;"&gt;&lt;b&gt;return&lt;/b&gt;&lt;/span&gt; sKey&lt;span style="color: blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;Cheers,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: #494949; font-family: Verdana, Arial, Helvetica, sans-serif;"&gt;&lt;span style="font-size: 12px; line-height: 20px;"&gt;B.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6340995759591756973?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6340995759591756973/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6340995759591756973' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6340995759591756973'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6340995759591756973'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2012/01/java-implementing-pgp-single-pass-sign.html' title='Java: Implementing PGP Single Pass Sign and Encrypt using League of Bouncy Castle library'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7384802465915987748</id><published>2011-12-26T17:08:00.000-05:00</published><updated>2011-12-26T17:08:14.543-05:00</updated><title type='text'>CF: New version of BonCode PGP library released</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I had a few request to look into the PGP library I released for ColdFusion and Railo last year. It took me a while to understand my own code, then, a while longer to implement the features that I wanted to add ;o)&lt;br /&gt;&lt;br /&gt;The main add on this time is the ability to create single pass signed files. This allows you to create a file where you are assured that only the authorized receiver can read them, while the receiver is assured that the sender is authentic as well. &amp;nbsp;Yep, I know sound like cold-war stuff, but it is quite common scenario in financial exchanges to assure both sides that everything is the way it should be.&lt;br /&gt;&lt;br /&gt;To a lesser level some other&amp;nbsp;additions&amp;nbsp;and bug fixes were completed as well.&lt;br /&gt;All this, as usual is open source.&lt;br /&gt;&lt;br /&gt;You can download code, examples, and implementation from here:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://pgp.riaforge.org/" target="_blank"&gt;http://pgp.riaforge.org&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7384802465915987748?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7384802465915987748/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7384802465915987748' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7384802465915987748'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7384802465915987748'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/12/cf-new-version-of-boncode-pgp-library.html' title='CF: New version of BonCode PGP library released'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2738722157608714514</id><published>2011-12-20T13:10:00.000-05:00</published><updated>2011-12-21T08:02:41.421-05:00</updated><title type='text'>CF: Setting up the OWASP ESAPI Library for use with ColdFusion and Railo</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;If you are taking application security seriously or have been curious about it you know by now that the native tools built into ColdFusion and Railo are not sufficient to hinder the serious hacker from making headway.&lt;br /&gt;&lt;br /&gt;To truly use best practices you can do a lot of code development, or, fall back to a project that has already proven its merit through many years of practical use.&lt;br /&gt;&lt;br /&gt;I am&amp;nbsp;referring&amp;nbsp;to the OWASP&lt;a href="https://www.owasp.org/index.php/Category:OWASP_Enterprise_Security_API" target="_blank"&gt; Enterprise Security API&lt;/a&gt; (ESAPI).&amp;nbsp;Unfortunately, getting this puppy running in any shape requires some reading muscle and some luck and some powers of deduction.&lt;br /&gt;&lt;br /&gt;I am summarizing here the findings, so you don't have to run through the maze of options and boiling it down to something simple.&lt;br /&gt;&lt;br /&gt;First, you will have to &lt;a href="http://code.google.com/p/owasp-esapi-java/downloads/list" target="_blank"&gt;download&lt;/a&gt; the jar file (as of this writing it would be&amp;nbsp;esapi-2.0.1). The download is around 14MB but you only need the&amp;nbsp;esapi-2.0.1.jar file. Copy the jar file to&amp;nbsp;(backup any esapi file that already exists in there first):&lt;br /&gt;[cfroot]/wwwroot/WEB-INF/lib in Adobe Coldfusion.&lt;br /&gt;WEB-INF/lib in Railo&lt;br /&gt;&lt;br /&gt;Then, download a good &lt;a href="http://owasp-esapi-java.googlecode.com/svn/trunk/configuration/esapi/ESAPI.properties" target="_blank"&gt;ESAPI.properties&lt;/a&gt; file. Most of my head banging and hair ripping surrounds finding the property&amp;nbsp;definitions. Can't stress this enough. Start with the one from source code it has good comments. Go through this file carefully and make needed changes. Make sure all directories referenced in the properties file actually exist on your drive system and also change default Encryptor.MasterKey and Encryptor.MasterSalt to something you are comfortable with, e.g. do not use something like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Encryptor.MasterKey=changeme&lt;br /&gt;Encryptor.MasterSalt=blah&lt;br /&gt;&lt;br /&gt;After you made changes save it (e.g. c:\esapi\files).&lt;br /&gt;&lt;br /&gt;Thirdly, make environment&amp;nbsp;start up&amp;nbsp;changes.&lt;br /&gt;If you are using Adobe Coldfusion you will need to change the JVM startup properties in CF Administrator to add a property and point to place where you placed ESAPI.properties file. E.g.:&lt;br /&gt;-D org.owasp.esapi.resources=c:\esapi\files&lt;br /&gt;&lt;br /&gt;For Railo, the above is done in Tomcat/Jetty startup parameters.&lt;br /&gt;&lt;br /&gt;Fourthly, change classpath (Yep, you heard right change JAVA classpath): Add the directory you placed the properties file in to Java classpath. This is something that had me stumped as well.&lt;br /&gt;&lt;br /&gt;After all of the above, give your server a good schake (restart), and then test whether all works.&lt;br /&gt;Simple code snippet:&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;cfset esapi &lt;span style="color: blue;"&gt;=&lt;/span&gt; CreateObject&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"java"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"org.owasp.esapi.ESAPI"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;cfset encoder &lt;span style="color: blue;"&gt;=&lt;/span&gt; esapi&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;encoder&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;cfset myInput&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: purple;"&gt;"&amp;lt;script&amp;gt;some input for html context; &lt;br /&gt;&lt;br /&gt;  alert('doing something you don't want');&amp;lt;/script&amp;gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  #now&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;# &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;br&lt;span style="color: blue;"&gt;/&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  #encoder&lt;span style="color: blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;encodeForHTML&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;JavaCast&lt;span style="color: blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color: purple;"&gt;"string"&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; myInput&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;#&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue;"&gt;/&lt;/span&gt;cfoutput&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;The good news is that Adobe is looking into bundling this in the future so you don't have to. However, in the meantime this is good practice ;o)&lt;br /&gt;&lt;br /&gt;Best,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2738722157608714514?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2738722157608714514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2738722157608714514' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2738722157608714514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2738722157608714514'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/12/cf-setting-up-owasp-esapi-library-for.html' title='CF: Setting up the OWASP ESAPI Library for use with ColdFusion and Railo'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-9029176718444284426</id><published>2011-12-08T10:47:00.001-05:00</published><updated>2011-12-08T11:09:42.099-05:00</updated><title type='text'>Internet Explorer and the case of the vanishing Forms</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;So we ran into the problem of a customer's users' not being able to use our application. The users happen to use Internet Explorer and IIS (Internet Information Server)&amp;nbsp;and the behavior was intermittend.&lt;br /&gt;We thought, this is a&amp;nbsp;network issues for sure; so we&amp;nbsp;put sniffers on client and servers sides and observed that nothing was conclusive. &lt;br /&gt;Another thing that threw us was that using an alternate browser such as Chrome everything seemed to be working.&lt;br /&gt;When things did not work, however,&amp;nbsp;we saw that IE (version 6 through 9) would not send any HTTP form information along. So even with simple HTML page that had two form fields "FirstName" and "LastName", we would see through the protocol capture that IE started an HTTP post, but no form fields and values. They had vanished. Poof !&lt;br /&gt;Our further suspicion of maybe a plugin, proxy or firewall stripping this data out was also eliminated and we started staring at each like we are all going crazy. And, of course, we googled. Nothing there either. (Google, oh Google, why did you fail us!)...&lt;br /&gt;Then, a little break, we discovered, that everytime things stopped working and Forms started vanishing, the user had just entered a secured area of the site and returned to an unsecured area. The security access&amp;nbsp;was transparent as IIS was setup to use "Windows Authentication" similar to "Integrated Authentication"; thus, IE was doing this in the background. Thereafter, even if the user returned to the non-secure areas of the site, IE would refuse to send Form data. After more digging we found that this seems to be intentional; we even found an old web-page that descibed this as good feature for IE6. The behavior is this: after, IE authenticates to a site via NTML / Kerberos (i.e. some integrated way), all traffic to that site has to be secured and as part of the security mechanism no plain text form submission is allowed. Great !&lt;br /&gt;The solution to this was to move the secure portions to a seperate site on IIS and thus everything started working as it should. IE was happy, customer was happy, and we could go to sleep.&lt;br /&gt;&lt;br /&gt;Hope you don't have to spent as much time on troubleshooting knowing this.&lt;br /&gt;&lt;br /&gt;B.&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-9029176718444284426?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/9029176718444284426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=9029176718444284426' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9029176718444284426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9029176718444284426'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/12/internet-explorer-and-case-of-vanishing.html' title='Internet Explorer and the case of the vanishing Forms'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-8440333350891939985</id><published>2011-11-23T12:49:00.001-05:00</published><updated>2011-11-23T13:20:35.038-05:00</updated><title type='text'>CF: Tracing AMF (Action Message Format) packages for Flex/BlazeDS in Coldfusion</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;I know I had seen this and done this before but for some reason I could not find it. I am looking at a Flex based component that makes remote calls to ColdFusion (Flash Remoting), then, renders some of the data. Now I wanted to find out what is happening and more specifically what data is being exchanged between Flex and ColdFusion.&lt;br /&gt;As you might know, the exchange between CF and Flex is in &lt;a href="http://en.wikipedia.org/wiki/Action_Message_Format" target="_blank"&gt;AMF &lt;/a&gt;format, which is a binary format and thus not easily readable over protocol sniffer.&lt;br /&gt;I know, I know, I can get many tools, and &lt;a href="http://www.kevinlangdon.com/serviceCapture/" target="_blank"&gt;ServiceCapture&lt;/a&gt; is mentioned many times; but I wanted to do this simpler.&lt;br /&gt;What I done in the past is used the command window to get this, but with many things, you forget, or just get older ;o)&lt;br /&gt;So you can start ColdFusion in a Command / Terminal window, by going to the installation folder and finding the right startup script.&lt;br /&gt;For windows:&lt;br /&gt;[cfroot]\bin\cfstart.bat&lt;br /&gt;&lt;br /&gt;This will start the ColdFusion server in command window:&lt;br /&gt;&lt;table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style="text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GVOJkliqAi4/Ts00iu5VxsI/AAAAAAAAAD0/M7X-XSgRu9o/s1600/BlazeDebug.gif" imageanchor="1" style="margin-left: auto; margin-right: auto;"&gt;&lt;img border="0" height="198" src="http://3.bp.blogspot.com/-GVOJkliqAi4/Ts00iu5VxsI/AAAAAAAAAD0/M7X-XSgRu9o/s400/BlazeDebug.gif" width="400" /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td class="tr-caption" style="text-align: center;"&gt;Command Window running ColdFusion&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;However, this did not automatically decode the AMF messages or gave me insight into flash remoting. In order to that I had to find the flex services-config file. On stand-alone server install on Windows this would be located here:&lt;br /&gt;[cfroot]\wwwroot\WEB-INF\flex\services-config.xml&lt;br /&gt;&lt;br /&gt;find the logging&amp;nbsp;&lt;logging&gt;section and change logging level to "Debug" like so:&lt;/logging&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="mycode"&gt;&lt;pre&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;logging&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;target class&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: purple;"&gt;"flex.messaging.log.ConsoleTarget"&lt;/span&gt; level&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: purple;"&gt;"&lt;b&gt;Debug&lt;/b&gt;"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;        ...&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue;"&gt;/&lt;/span&gt;logging&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can even change the prefix of the messages, e.g. to Flex like so:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;logging&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;target class&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: purple;"&gt;"flex.messaging.log.ConsoleTarget"&lt;/span&gt; level&lt;span style="color: blue;"&gt;=&lt;/span&gt;&lt;span style="color: purple;"&gt;"Debug"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;properties&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;br /&gt;&lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;prefix&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color: grey;"&gt;&lt;b&gt;[Flex]&lt;/b&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue;"&gt;/&lt;/span&gt;prefix&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;This is the cheap way of getting debugging going on the protocol and see what is being exchanged.&lt;br /&gt;Hope this helps,&lt;br /&gt;&lt;br /&gt;-B&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-8440333350891939985?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/8440333350891939985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=8440333350891939985' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8440333350891939985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8440333350891939985'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/11/cf-tracing-amf-action-message-format.html' title='CF: Tracing AMF (Action Message Format) packages for Flex/BlazeDS in Coldfusion'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-GVOJkliqAi4/Ts00iu5VxsI/AAAAAAAAAD0/M7X-XSgRu9o/s72-c/BlazeDebug.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-4938224828683509613</id><published>2011-10-29T16:19:00.000-04:00</published><updated>2011-10-29T16:19:14.953-04:00</updated><title type='text'>CF: CFCamp 2011 presentation and sample code</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;A long day at CFCamp came to a social conclusion at the Marriott-bar. This again confirms the impression that the ColdFusion community is approachable by old and new hands alike.&lt;br /&gt;&lt;br /&gt;Another interesting fact about the CF community emerged. According to the custodial support staff, the CFCamp attendees consumed three times as much coffee as crowds of a similar size.&amp;nbsp;Definitively&amp;nbsp;a mark of distinction.&lt;br /&gt;&lt;br /&gt;Thanks to the organizers, presenters, and attendees for making this a solid CF event.&lt;br /&gt;Overall, learned new things from all and had a&amp;nbsp;Pretzel&amp;nbsp;to boot.&lt;br /&gt;As discussed, I posted the the &lt;a href="http://boncode.net/downloads/PracticalApplicationSecurity.pdf"&gt;presentation slides&lt;/a&gt; and &lt;a href="http://boncode.net/downloads/sec.zip"&gt;sample code&lt;/a&gt; for download.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-4938224828683509613?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/4938224828683509613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=4938224828683509613' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4938224828683509613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4938224828683509613'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/10/cf-cfcamp-2011-presentation-and-sample.html' title='CF: CFCamp 2011 presentation and sample code'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6320866654926344077</id><published>2011-10-14T13:24:00.000-04:00</published><updated>2011-10-14T13:24:15.542-04:00</updated><title type='text'>CF: Munich in the Fall, CFCamp 2011</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;So, you just missed Oktoberfest and were wondering what else there is to do in Munich in the Fall. Well, you happen to be in luck, especially if you are a ColdFusion enthusiast.&lt;br /&gt;It so happens that this year a few fellow believers in the art of the Pretzel and motivated ColdFusion learners are assembling on October 28th for &lt;a href="http://www.cfcamp.org/home.cfm"&gt;CFCamp 2011&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;Even yours truly will make the&amp;nbsp;trek&amp;nbsp;down &amp;nbsp;to Bavaria's Capital to chat and learn from others. Will also do a talk on application security, sharing some nuggets of the school of hard knocks etc.&lt;br /&gt;&lt;br /&gt;As far as I understand it, it is not too late to signup and the Beer and&amp;nbsp;Pretzels&amp;nbsp;are beckoning....&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6320866654926344077?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6320866654926344077/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6320866654926344077' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6320866654926344077'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6320866654926344077'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/10/cf-munich-in-fall-cfcamp-2011.html' title='CF: Munich in the Fall, CFCamp 2011'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1075378936874470316</id><published>2011-10-09T13:12:00.001-04:00</published><updated>2011-10-09T13:12:23.272-04:00</updated><title type='text'>.NET: wddx.net library revision</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;Before web services, before JSON, before many other things or people ever thought about it, &amp;nbsp;there was this other way to exchange data across platforms via the Internet using XML. It was called WDDX (Web Distributed Data Exchange).&lt;br /&gt;&lt;br /&gt;According to &lt;a href="http://en.wikipedia.org/wiki/Wddx" target="_blank"&gt;Wikipedia&lt;/a&gt; this its definition:&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WDDX &lt;/b&gt;(Web Distributed Data eXchange) is a programming-language-, platform- and transport-neutral data interchange mechanism to pass data between different environments and different computers. It supports simple data types such as number, string, boolean, etc., and complex aggregates of these in forms such as structures, arrays and recordsets (row/column data, typically coming from database queries).&lt;br /&gt;&lt;br /&gt;Support for WDDX is available natively in several languages including ColdFusion, PHP, Ruby, and Python. Other languages implement this through add ons. .NET belongs to the later category, thus needs a library to process WDDX.&amp;nbsp;Unfortunately, this library has not seen updates in a long while. It is open source and was created by Joel Mueller early in the 2000s and not much happened since then.&lt;br /&gt;&lt;br /&gt;First, Kudos for Joel taking on this project and making it available. It is well documented and executed;&amp;nbsp;unfortunately,&amp;nbsp;as with any software, there were some issues. Having discovered these and "fixed" them, the question of getting the fixes back into distribution came up. After several attempts to contact the current maintainer of this project and several months of wait time I got very frustrated and decided to take over some of this.&lt;br /&gt;&lt;br /&gt;Rather than branching this on Microsoft Codeplex site (this is Microsoft's site for&amp;nbsp;maintaining&amp;nbsp;open source projects) I used Git Hub. The main reason for me to use another site for maintenance was that Codeplex seem to not get any attention from Microsoft. Bug messages were being ignored,&amp;nbsp;documentation&amp;nbsp;did not match to what the site did or operated.&lt;br /&gt;&lt;br /&gt;&lt;a href="https://github.com/Bilal-S/WDDX.net"&gt;Download WDDX.NET library&lt;/a&gt;:&amp;nbsp;&lt;a href="https://github.com/Bilal-S/WDDX.net"&gt;https://github.com/Bilal-S/WDDX.net&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;So I hope that if you need WDDX support in .NET you will check out this project.&lt;br /&gt;As usual please let me know if you find any issues.&lt;br /&gt;&lt;br /&gt;Best,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1075378936874470316?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1075378936874470316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1075378936874470316' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1075378936874470316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1075378936874470316'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/10/net-wddxnet-library-revision.html' title='.NET: wddx.net library revision'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-8026058805513122480</id><published>2011-09-18T14:26:00.000-04:00</published><updated>2011-09-20T09:10:08.339-04:00</updated><title type='text'>NCDevCon: Presentation Slides and Code</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;The NCDevCon 2011 conference is on its way to be concluded. Many interesting and well rounded presentations. Meeting friends from all over again and chatting about the best and worst way of doing things.&lt;br /&gt;I am continuing to be impressed what the team (Dan Wilson, Jim Priest, Shawn Dunning) is able to do with so little resources. Way to go team.&lt;br /&gt;&lt;br /&gt;As promised I am posting the links to the slides to my presentations:&lt;br /&gt;&lt;b&gt;Practical Application Security:&lt;/b&gt;&lt;br /&gt;&lt;a href="http://slidesix.com/view/Practical-Application-Security-for-ColdFusion"&gt;Practical Application Security Slides&lt;/a&gt;&lt;br /&gt;I posted the code for &lt;a href="http://urlencoder.riaforge.org/"&gt;URLEncoder &lt;/a&gt;on RIAforge as open source project.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Client Side MVC with Sencha Touch:&lt;/b&gt;&lt;br /&gt;&lt;a href="http://slidesix.com/view/Client-side-MVC-using-Sencha-Touch-and-ColdFusion"&gt;Client Side MVC with Sencha Touch Slides&lt;/a&gt;&lt;br /&gt;Download&lt;a href="http://boncode.net/downloads/SenchaTouchMVC.zip"&gt; Sencha MVC code&lt;/a&gt;. Please review the Readme_first.txt file on how to get this going.&lt;br /&gt;&lt;br /&gt;Please feel free to explore code and slides.&lt;br /&gt;The conference also posts &lt;a href="http://go.ncsu.edu/ncdevcon2011"&gt;the video&lt;/a&gt; of the presentations.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;&amp;nbsp;-B.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-8026058805513122480?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/8026058805513122480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=8026058805513122480' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8026058805513122480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8026058805513122480'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/09/ncdevcon-presentation-slides-and-code.html' title='NCDevCon: Presentation Slides and Code'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-9139619037641633629</id><published>2011-09-18T14:19:00.001-04:00</published><updated>2011-09-18T14:19:18.304-04:00</updated><title type='text'>CF: Using URLEncoder to secure URL Parameter against CSRF and XSS</title><content type='html'>&lt;div dir="ltr" style="text-align: left;" trbidi="on"&gt;In my presentation about ColdFusion Application Security I also showed a reference implementation of an URLEncoder that can assist with three scenarios:&lt;br /&gt;&lt;br /&gt;Cross Site Scripting: If scripts are injected through URL parameters, this encoder will ensure that no user inputs besides the one set by CF are accepted.&lt;br /&gt;&lt;br /&gt;Insecure Direct Object Reference: By encrypting the object references in passed URL the object reference are no longer exposed to users and cannot be changed by users.&lt;br /&gt;&lt;br /&gt;Cross Site Request Forgery: By adding&amp;nbsp;additional&amp;nbsp;reference in the encrypted packages the URLEncoder will assist with Cross Site Request forgery attempts.&lt;br /&gt;&lt;br /&gt;The URLEncoder allows a very&amp;nbsp;flexible&amp;nbsp;way of transporting data via URL parameters in a secure fashion. It is not restricted to primitive/simple data types. Complex data such as arrays and structures can easily passed &amp;nbsp;via the URL using this component as well.&lt;br /&gt;&lt;br /&gt;Moreover, additional security option are available. During encoding, you can specify whether the generated URL has an expiration and or can only be used from the originating URL.&lt;br /&gt;&lt;br /&gt;During the decoding phase the URLEncoder you can specify which scope the transported data from the URL parameters will be placed in. By default this will be placed into Request.URL, however, you can change this to be placed into the regular URL scope so that legacy application will only need minimal change to add this layer of security.&lt;br /&gt;&lt;br /&gt;Here is the &lt;a href="http://urlencoder.riaforge.org/"&gt;link to the&amp;nbsp;download&lt;/a&gt;&amp;nbsp;to the project from RIA Forge.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-9139619037641633629?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/9139619037641633629/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=9139619037641633629' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9139619037641633629'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9139619037641633629'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/09/cf-using-urlencoder-to-secure-url.html' title='CF: Using URLEncoder to secure URL Parameter against CSRF and XSS'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6926368874590928562</id><published>2011-08-31T16:18:00.002-04:00</published><updated>2011-08-31T16:40:05.151-04:00</updated><title type='text'>NCDevCon 2011: Developer Conference coming up Setp 17-18, Raleigh, NC</title><content type='html'>For the last three years an amazing thing has happened. The Triangle Area ColdFusion User's Group (TACFUG), has put a lot of blood, sweat and tears into organizing a conference, &lt;a href="http://www.ncdevcon.com"&gt;NCDevCon&lt;/a&gt;, that has ColdFusion at its center. &lt;br /&gt;This by itself is an amazing feat; especially given that the large ColdFusion specific conferences are faltering and Adobe, the main source of CF, does not have an independent gathering focused on this topic.&lt;br /&gt;On top of this, the conference manages to have broad coverage of many relevant areas of Colfusion and Web development while also giving beginners options for hands on sessions.&lt;br /&gt;This is a major, major (yes two majors!) achievement. So definetly cudos to the organizers.&lt;br /&gt;All this is available for a very small fee ($60) compared to the several hundreds of dollards we commonly pay. So definetly a deal in light of the knowledge that is being shared. &lt;br /&gt; &lt;br /&gt;I have been selected to do &lt;a href="http://ncdevcon.com/post.cfm/ncdevcon-speaker-spotlight-bilal-soylu"&gt;two presentations&lt;/a&gt; this year on very different topics. The first one on Application Security, I can see eyes already glazing over, nope we'll provide some practical code here as well.&lt;br /&gt;The other one is on mobile application developement with Sencha Touch and ColdFusion. This one is harder to organize as I have lots of material I am trying to decide what to cut out at the moment.&lt;br /&gt;&lt;br /&gt;Hope to see you there.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6926368874590928562?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6926368874590928562/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6926368874590928562' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6926368874590928562'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6926368874590928562'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/08/ncdevcon-2011-developer-conference.html' title='NCDevCon 2011: Developer Conference coming up Setp 17-18, Raleigh, NC'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-5596852874498639142</id><published>2011-08-24T12:16:00.005-04:00</published><updated>2011-08-25T14:40:42.189-04:00</updated><title type='text'>CF: Decide if we got enough memory to succeed</title><content type='html'>Since the beginning of computing there has been the struggle between available resources and the number of computing tasks to run on them. When we had 16KB of RAM our code looked very compact and we were critical of any extra bytes that we stored or computing cycles we ran.&lt;br /&gt;When, today, we easily reach 16GB of RAM the level of individual byte analysis does not quite happen. More likely than not, we tend to worry less about do we have enough memory to run this operation and assume (to our chagrin) that things will work themselves out,... right until they don't.&lt;br /&gt;&lt;br /&gt;Which brings me to the problem at hand. Rather than running a process, thread, task and hoping things work, can we predictably make that decision instead?&lt;br /&gt;&lt;br /&gt;In my case, this being ColdFusion I needed to find out whether I had a snowballs change in the Hot-Place to open an Excel file. Remember that ColdFusion uses the Apache POI library to read Microsoft Office documents. Works normally fairly transparently but the downfall here (it is documented as well, see POI docs) is that POI will grab big chunks of memory for processing any access to, say, a spreadsheet.&lt;br /&gt;&lt;br /&gt;This, if not managed, gets us into an unconfortable situation of crashing the server with OutOfMemroy exceptions. Yep, not good.&lt;br /&gt;&lt;br /&gt;So our solution was first determine a common estimation factor (spreadsheet size to JVM memory size), then use it to see whether we would have a chance of opening / loading this spreadsheet at all given the current memory envelope on the server.&lt;br /&gt;Nice message to user if we had no chance, go ahead and process otherwise.&lt;br /&gt;This eliminates unneccesary server crashes. Which is, indeed, a very good thing.&lt;br /&gt;&lt;br /&gt;Here is the code  snippet we used to determine available CF server memory:&lt;br /&gt;&lt;div class="mycode"&gt;&lt;br /&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"getMemory"&lt;/span&gt; returntype&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"numeric"&lt;/span&gt;&lt;br /&gt;    access&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"private"&lt;/span&gt; hint&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"return server unused available memory"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;	&lt;br /&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfscript&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;			&lt;br /&gt;	var intMB = 1024 * 1024;&lt;br /&gt;	var objRuntime = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java.lang.Runtime"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).getRuntime();&lt;br /&gt;	var intUsedMem = objRuntime.totalMemory() - objRuntime.freeMemory();&lt;br /&gt;	var intAvailableMem = objRuntime.maxMemory() - intUsedMem;&lt;br /&gt;	return (intAvailableMem/intMB);&lt;br /&gt;	&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cfscript&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;		&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;	&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;The value here will have to be compared against the expected value of memory use for your operation. For example, if you expect your spreadsheet to occupy 100MB memory while loaded into JVM and want to have a margin on 50MB, you can only proceed with the operation if the return of the above function is a value of 150 or greater.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-5596852874498639142?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/5596852874498639142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=5596852874498639142' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5596852874498639142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5596852874498639142'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/08/cf-decide-if-we-got-enough-memory-to.html' title='CF: Decide if we got enough memory to succeed'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6774030809987707681</id><published>2011-08-19T04:39:00.005-04:00</published><updated>2011-08-19T04:53:33.291-04:00</updated><title type='text'>Facebook and Automatic Granting of Permissions to Applications via Mobile Devices</title><content type='html'>I make it a policy of conduct not to install any Facebook application or grant any Facebook apps rights to my Facebook account. Call me paranoid (many have).&lt;br /&gt;So, needless to say, I was surprised when I was looking at my settings page under application how many applications I seem to have granted access. &lt;br /&gt;There they were, a little more than half a dozen apps that seem to have access to my information and friends, not remembering, having granted any of them the right to do so.&lt;br /&gt;This baffled me to no end. How did this happen?&lt;br /&gt;&lt;br /&gt;Well, the only thing that seemed to be a common pattern for these apps is that I had loaded similarly named application on my iPhone from the Appstore. Ahh, yes, here is where the plot thickens. Thus the best I can explain this is that the terms of acceptance of these apps includes that they can access my Facebook profile. Thus, if they detect the Facebook app loaded on your device they establish connection and register themselves as authorized apps with Facebook.&lt;br /&gt;&lt;br /&gt;I might get this all completely wrong, but this is the only explanation I can come up with, since I got this policy of no apps etc.&lt;br /&gt;&lt;br /&gt;Yes, some of you may now say that I was too trusting a soul, and this, too, might be true, so I am now checking more regularly to see whether I am being hoodwinked into approving this type of behavior.&lt;br /&gt;&lt;br /&gt;I am now checking regularly what the Facebook app settings page looks like (see below) and killing the permissions. I truly wish that FB had explicit lock on this type of stuff as this is very sneaky behavior in my opinion.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/-nzEfGwp-xPs/Tk4jQokK5LI/AAAAAAAAADw/MrzkBkX6FI8/s1600/FaceBookApps.png"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 83px;" src="http://1.bp.blogspot.com/-nzEfGwp-xPs/Tk4jQokK5LI/AAAAAAAAADw/MrzkBkX6FI8/s400/FaceBookApps.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5642486151815816370" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;As usual would appreciate some feedback.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6774030809987707681?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6774030809987707681/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6774030809987707681' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6774030809987707681'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6774030809987707681'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/08/facebook-and-automatic-applications.html' title='Facebook and Automatic Granting of Permissions to Applications via Mobile Devices'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/-nzEfGwp-xPs/Tk4jQokK5LI/AAAAAAAAADw/MrzkBkX6FI8/s72-c/FaceBookApps.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3111753469601801384</id><published>2011-07-28T17:40:00.003-04:00</published><updated>2011-07-28T18:11:07.387-04:00</updated><title type='text'>CF: ColdFusion Debug trace for remoting (Flex, SOAP, anything else)</title><content type='html'>One of the things I have always liked with working in ColdFusion is the ability to derive detailed debugging information. You get a good idea of what is going behind the covers and do have a good basis to hunt down bugs.&lt;br /&gt;Unfortunatly, this all breaks down when you start to do any kind of remoting (invoking CFCs from another technology). Currently, this is for Flex and SOAP (Webservices) type calls. If anything goes haywire, or the calls themselves are complex, e.g. call on many other components and tags you fly in the dark more often then not.&lt;br /&gt;The common response to this kind of issue from peers is to use the line debugger, set breakpoints etc. and this does work to a certain degree.&lt;br /&gt;However, where I get a little agitated is that most of the time when problems occur you are nowhere near a line-debugger or IDE to capture the processing.&lt;br /&gt;For standard .cfm pages I can use the &lt;a href="http://boncode.blogspot.com/2008/09/cf-silent-server-side-debugging.html"&gt;Silent Debugger &lt;/a&gt;option.&lt;br /&gt;So I was wondering if I could build something similar that worked with CFCs and remoting. I would add this to the Application.cfc and, bingo, I could capture the debugging output to file. Alas, many hours later I had nothing workable. To make a long story short it does not look like there is a way to capture cfc debug output, because no debugging session is seems running.&lt;br /&gt;&lt;br /&gt;Unfortunatly, it looks like the auto-wiring that ColdFusion performs makes the decision not to initialize / start a degugging session in the ServiceFactory (coldfusion.server.ServiceFactory).&lt;br /&gt;Thus the call for factory.getDebuggingService() will fail and my attempts to manualy start the debugging service failed for lack of insight into how CF actually does this (what classes and method in what order).&lt;br /&gt;So I was back to square one.&lt;br /&gt;After a little more thinking and tinkering I decided to go for the workaround solution. This happens to be practical enough for me as my remoted cfcs are only stubs, so not much functionality is implemented there.&lt;br /&gt;I have several stub types and, thus, decided to rewrite the call from SOAP / FLEX remoted calls to HTTP Post (REST) calls.&lt;br /&gt;&lt;br /&gt;So in the remoted call I would just turnaround and call the REST gateway if I detected that we were trying to debug stuff using the IsDebugMode() function.&lt;br /&gt;&lt;br /&gt;This would allow me to use the Silent Debugging option and capture the debug output to file even for calls coming from SOAP and FLEX remoting. I would also need to translate the reponse back correctly for FLEX and SOAP clients to consume.&lt;br /&gt;&lt;br /&gt;All this is more overhead but not drastically so, while allowing me to trace errors while they occur even for remoted CFCs. I can access this information afterwards for analysis.&lt;br /&gt;&lt;br /&gt;Overall, I am disapointed that I was not able to hook into native CF processes to expose debugging results. Maybe in future iterations this will be possible. However, being able to get this insight is invaluable to me.&lt;br /&gt;&lt;br /&gt;Feel free to experiment.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3111753469601801384?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3111753469601801384/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3111753469601801384' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3111753469601801384'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3111753469601801384'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/07/cf-coldfusion-debug-trace-for-remoting.html' title='CF: ColdFusion Debug trace for remoting (Flex, SOAP, anything else)'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7479234757019769440</id><published>2011-07-21T17:09:00.002-04:00</published><updated>2011-07-21T17:19:19.913-04:00</updated><title type='text'>CF: cfObjective 2011</title><content type='html'>Meant to provide feedback on the cfObjective conference in Mineapolis, MN.&lt;br /&gt;The conference goes by the tagline of&lt;br /&gt;"The Only Enterprise ColdFusion Conference". Unfortunatly, this may be very true.&lt;br /&gt;Anyways, here is the skinny as I see it (fully my opinion):&lt;br /&gt;&lt;br /&gt;Even though this is the biggest CF conference that still is around, I was still disappointed by how small the crowd was. No knock on this conference as it comparitively has grown from last year, but with the demise of cfUnited, I was expecting a larger crowd to carry over to this one.&lt;br /&gt;&lt;br /&gt;Conversations with fellow conference attendees lead to the insight that instead of one big conference there are many smaller regional ones that focus on this topic.&lt;br /&gt;If this is the trend, the obvious question would be how CF is CF going to survive? Will many small conferences attract developers by the truck load or will they stay away? Adobe did not sponsor, I hear lots of politics involved. Not a good image if you are trying to convince new people to pick up CF and grow the community.&lt;br /&gt;&lt;br /&gt;The location was OK. Downtown Minneapolis is not hot but you can make it work. Weather was a bummer (pretty nippy). The food was good, lunch was better than breakfast.&lt;br /&gt;&lt;br /&gt;The presentations followed a similar pattern to cfUnited, the same people are doing the presenting. The quality was just a notch above what was available at cfUnited. I am personally getting a little tired of the same presenters, I think the community needs some fresh blood. Only so many times I can hear an extreme opinion presented as fact ;o)&lt;br /&gt;Overall, still something I will attend, but maybe shorten the time for next year. Do only two days rather than three. The last day was just a rush to get out.&lt;br /&gt;&lt;br /&gt;There you have it. Catching up on writing.&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7479234757019769440?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7479234757019769440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7479234757019769440' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7479234757019769440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7479234757019769440'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/07/cf-cfobjective-2011.html' title='CF: cfObjective 2011'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-4568439243841231361</id><published>2011-04-21T12:38:00.003-04:00</published><updated>2011-04-21T12:52:21.647-04:00</updated><title type='text'>CF: Coldfusion java.lang.StackOverflowError</title><content type='html'>If you run into this with ColdFusion, it probably will appear to come out of  no-where.&lt;br /&gt;One day everything will work fine and, the next, without any change you can think of, you see your site stop to respond.&lt;br /&gt;Upon digging into the exception.log file you see something like this:&lt;br /&gt;&lt;br /&gt;"Error","jrpp-0","04/20/10","17:33:53",,"'' The specific sequence of files included or processed is: C:\Webroot\Test4\TestFile.cfm'' "&lt;br /&gt;java.lang.StackOverflowError&lt;br /&gt; at java.io.ObjectInputStream$PeekInputStream.read(ObjectInputStream.java:2263)&lt;br /&gt;&lt;br /&gt;This for me occurred when serializing/de-serializing data. But anytime you run into this you have to ask yourself one primary question.&lt;br /&gt;Did this happen because of my logic? If yes, go revise your logic first.&lt;br /&gt;If you are certain your stuff is solid, you need to increase the Stack Size by providing the -Xss directive to the jvm upon ColdFusion startup.&lt;br /&gt;&lt;br /&gt;I would bump it four fold; while the default seems to be slightly different based on OS, it is normally in the 300-400kb range.&lt;br /&gt;&lt;br /&gt;I bumped mine up first to 10MB, then, reduced it to find out exactly what was workable.&lt;br /&gt;&lt;br /&gt;The -Xss argument can be specified in kb e.g. -Xss512k or in mb, e.g. -Xss1m.&lt;br /&gt;&lt;br /&gt;here is an image with configured jvm:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/-3h8ZOrFT3G4/TbBgDOPNzvI/AAAAAAAAADk/_irrelMAPkw/s1600/CF9JVM.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 93px;" src="http://4.bp.blogspot.com/-3h8ZOrFT3G4/TbBgDOPNzvI/AAAAAAAAADk/_irrelMAPkw/s400/CF9JVM.gif" alt="" id="BLOGGER_PHOTO_ID_5598079945299316466" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-4568439243841231361?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/4568439243841231361/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=4568439243841231361' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4568439243841231361'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4568439243841231361'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/04/cf-coldfusion-javalangstackoverflowerro.html' title='CF: Coldfusion java.lang.StackOverflowError'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-3h8ZOrFT3G4/TbBgDOPNzvI/AAAAAAAAADk/_irrelMAPkw/s72-c/CF9JVM.gif' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-4454115170260047479</id><published>2011-04-01T11:28:00.002-04:00</published><updated>2011-04-01T11:40:21.344-04:00</updated><title type='text'>inno: converting Ansi string to string</title><content type='html'>When you work in Unicode Inno Setup the data typing of strings for functions seems to always get you one way or the other.&lt;br /&gt;There are no easy build in conversions either.&lt;br /&gt;After running into this repeatdly I build a helper function that simply converts the Ansi string to regulare string.&lt;br /&gt;&lt;br /&gt;May come in handy for others:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;//convert Ansi String to String&lt;br /&gt;function ConvertToString(AString:AnsiString):String;&lt;br /&gt;var&lt;br /&gt; i : Integer;&lt;br /&gt; iChar : Integer;&lt;br /&gt; outString : String;&lt;br /&gt;begin&lt;br /&gt; outString :='';&lt;br /&gt; for i := 1 to Length(AString) do&lt;br /&gt; begin&lt;br /&gt;  iChar := Ord(AString[i]); //get int value&lt;br /&gt;  outString := outString + Chr(iChar);&lt;br /&gt; end;&lt;br /&gt;&lt;br /&gt; Result := outString;&lt;br /&gt;end;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-4454115170260047479?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/4454115170260047479/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=4454115170260047479' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4454115170260047479'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4454115170260047479'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/04/inno-converting-ansi-string-to-string.html' title='inno: converting Ansi string to string'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1194281144053377514</id><published>2011-03-23T09:08:00.002-04:00</published><updated>2011-03-23T09:24:19.648-04:00</updated><title type='text'>tomcat: Another way to connect IIS and Tomcat</title><content type='html'>If you were working with tomcat and IIS for a while you know things are getting a little long in the tooth. The last principle update to how IIS and Tomcat interact was made in early 2000. In the meantime many changes have occured to IIS and Tomcat with more capabilities added.&lt;br /&gt;So, I thought it would be time to also update the way IIS and Tomcat connect.&lt;br /&gt;I just published a project on RIAForge whose goal is to modernize this part:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://tomcatiis.riaforge.org/"&gt;http://tomcatiis.riaforge.org/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Here are some reasons to consider a new connector:&lt;br /&gt;• no ISAPI code&lt;br /&gt;• no IIS6 vestiges or backward compatibility elements needed on IIS7&lt;br /&gt;• all managed code using the modern extensibility framework&lt;br /&gt;• works on IIS6 and IIS7&lt;br /&gt;• speed improvements &lt;br /&gt;• easier control by file type on IIS side&lt;br /&gt;• no virtual directories and virtual mapping needed&lt;br /&gt;• configuration can be inherited to sub-sites and virtual sites&lt;br /&gt;• easy install/uninstall&lt;br /&gt;• support partial stream sending to browser (automatic flushing) with faster response to client&lt;br /&gt;• support both 32/64 bit of Windows with same process and files&lt;br /&gt;• transfer of all request headers to servlet container&lt;br /&gt;• build in simple-security for web-administration pages&lt;br /&gt;&lt;br /&gt;Happy experimenting,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1194281144053377514?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1194281144053377514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1194281144053377514' title='43 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1194281144053377514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1194281144053377514'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/03/tomcat-another-way-to-connect-iis-and.html' title='tomcat: Another way to connect IIS and Tomcat'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>43</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-5324478107641148212</id><published>2011-02-24T12:41:00.003-05:00</published><updated>2011-03-14T10:38:02.338-04:00</updated><title type='text'>.NET: C# find pattern in byte array</title><content type='html'>Byte Arrays are not as easily handled as strings when it comes to finding what they contain, especially if we are searching for a pattern of matching bytes.&lt;br /&gt;It seems like everyone is rolling their own on this one. Most examples I have seen look at converting bytes to strings and then using IndexOf operators.&lt;br /&gt;However, if you use bytes that cannot be converted to a string easily or do not want to use string comparison here is my version of a working function that does the trick.&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;FONT COLOR=RED&gt;&lt;B&gt;private&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=RED&gt;&lt;B&gt;static&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=RED&gt;&lt;B&gt;int&lt;/B&gt;&lt;/FONT&gt; ByteSearch&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=RED&gt;&lt;B&gt;byte&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt; searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;,&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=RED&gt;&lt;B&gt;byte&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;,&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=RED&gt;&lt;B&gt;int&lt;/B&gt;&lt;/FONT&gt; start &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;0&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;    &lt;FONT COLOR=RED&gt;&lt;B&gt;int&lt;/B&gt;&lt;/FONT&gt; found &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;-&lt;/FONT&gt;&lt;FONT COLOR=BROWN&gt;1&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;    bool matched &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; false&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;    &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//only look at this if we have a populated search array and search bytes with a sensible start&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;    &lt;FONT COLOR=RED&gt;&lt;B&gt;if&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;0&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;0&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt; start &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;-&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt; searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;        &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//iterate through the array to be searched&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;        &lt;FONT COLOR=RED&gt;&lt;B&gt;for&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=RED&gt;&lt;B&gt;int&lt;/B&gt;&lt;/FONT&gt; i &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; start&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt; i &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;-&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt; i&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;+&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;        &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;            &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//if the start bytes match we will start comparing all other bytes&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;            &lt;FONT COLOR=RED&gt;&lt;B&gt;if&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;i&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BROWN&gt;0&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;            &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                &lt;FONT COLOR=RED&gt;&lt;B&gt;if&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;1&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//multiple bytes to be searched we have to compare byte by byte&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;                    matched &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; true&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=RED&gt;&lt;B&gt;for&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=RED&gt;&lt;B&gt;int&lt;/B&gt;&lt;/FONT&gt; y &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;1&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt; y &lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;=&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;.&lt;/B&gt;&lt;/FONT&gt;Length &lt;FONT COLOR=BLUE SIZE=+1&gt;-&lt;/FONT&gt; &lt;FONT COLOR=BROWN&gt;1&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt; y&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;+&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;+&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                        &lt;FONT COLOR=RED&gt;&lt;B&gt;if&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;searchIn&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;i &lt;FONT COLOR=BLUE SIZE=+1&gt;+&lt;/FONT&gt; y&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;!&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; searchBytes&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;[&lt;/B&gt;&lt;/FONT&gt;y&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;]&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                        &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                            matched &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; false&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                            &lt;FONT COLOR=RED&gt;&lt;B&gt;break&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                        &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//everything matched up&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;                    &lt;FONT COLOR=RED&gt;&lt;B&gt;if&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;(&lt;/B&gt;&lt;/FONT&gt;matched&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;)&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                        found &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; i&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                        &lt;FONT COLOR=RED&gt;&lt;B&gt;break&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt; &lt;br /&gt;                &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                &lt;FONT COLOR=RED&gt;&lt;B&gt;else&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;{&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//search byte is only one bit nothing else to do&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;                    found &lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt; i&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;                    &lt;FONT COLOR=RED&gt;&lt;B&gt;break&lt;/B&gt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt; &lt;FONT COLOR=GREEN&gt;&lt;I&gt;//stop the loop&lt;br /&gt;&lt;/I&gt;&lt;/FONT&gt;                &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt; &lt;br /&gt;            &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;        &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt; &lt;br /&gt;    &lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;    &lt;FONT COLOR=RED&gt;&lt;B&gt;return&lt;/B&gt;&lt;/FONT&gt; found&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;;&lt;/B&gt;&lt;/FONT&gt;&lt;br /&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&lt;B&gt;}&lt;/B&gt;&lt;/FONT&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-5324478107641148212?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/5324478107641148212/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=5324478107641148212' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5324478107641148212'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5324478107641148212'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/02/net-c-find-pattern-in-byte-array.html' title='.NET: C# find pattern in byte array'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-8459028059349518888</id><published>2011-02-08T17:09:00.002-05:00</published><updated>2011-02-08T17:22:42.067-05:00</updated><title type='text'>CF: ColdFusion Report Builder migration errors with Invalid construct.A script statement must end with ";"</title><content type='html'>You may had the opportunity to work with ColdFusion Report Builder in the past. It was a cool little tool that we used with ColdFusion 7 when you could not afford anything else to write reports with.&lt;br /&gt;In its first iteration it was pretty buggy; today, it still is around but I see fewer people using or mentioning it. It barely gets any play at the user conferences and is treated more like a red-headed step child (I have nothing against red headed people of any kind ;o).&lt;br /&gt;In my opinion it is still a useful tool that does not get its share of attention. However, when you migrate from older versions of reports that you have written with, say, ColdFusion Report Builder (CFRB) 7, to ColdFusion Report Builder 8 or 9 you may get some fairly unexpected errors.&lt;br /&gt;Such as this:&lt;br /&gt;&lt;br /&gt;Invalid construct.A script statement must end with ";"&lt;br /&gt;&lt;br /&gt;The only thing you did it just open and save the report. No changes were actually made. All of a sudden, errors jump up from seemingly nowhere. Well, for me, that resulted in many hours of ghost hunting (since I cannot see what's in the cfr files) until I finally got the bright idea to dig up an old copy of Report Writer 7 for those reports.&lt;br /&gt;&lt;br /&gt;I restored the .cfr file from backup, made a change using CFRB 7 and everything worked. Just to check for sanity, I, then, restored the file again, made a simple change using either CFRB 8 or 9 and, boom, broken again.&lt;br /&gt;&lt;br /&gt;The lesson here is to make sure you ask before you touch a ColdFusion report (.cfr) file with which version of ColdFusion/ColdFusion Report Builder it was created. Then, make the modifications only with that tool.&lt;br /&gt;&lt;br /&gt;This in the end may save you many hours of frustration.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-8459028059349518888?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/8459028059349518888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=8459028059349518888' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8459028059349518888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8459028059349518888'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/02/cf-coldfusion-report-builder-migration.html' title='CF: ColdFusion Report Builder migration errors with Invalid construct.A script statement must end with &quot;;&quot;'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2249497241119787727</id><published>2011-01-10T16:22:00.009-05:00</published><updated>2011-01-10T17:01:20.136-05:00</updated><title type='text'>CF: Explicit "undefined" in ColdFusion 9 results in Bug when using CustomTag Attribute collections</title><content type='html'>Adobe ColdFusion 9 introduced many new enhancements but as with any major release there are new behaviors and new problems galore.&lt;br /&gt;This particular bug I encountered deals with a change in behavior of component function processing. I encountered this while migrating an application from CF8 to CF9.&lt;br /&gt;In previous releases of ColdFusion an Argument that was not passed would not exist in the arguments scope. With ColdFusion 9, an argument is always created even if not passed if it is part of the arguments declaration in your function.&lt;br /&gt;&lt;br /&gt;For example this simple function:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;cffunction name&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=PURPLE&gt;"fTwo"&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;span class=cch1&gt;&lt;font color=gray&gt;   &lt;br /&gt;  &lt;/font&gt;&lt;/span&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;cfargument name&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=PURPLE&gt;"argA"&lt;/FONT&gt; default&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=PURPLE&gt;"1"&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;span class=cch1&gt;&lt;font color=gray&gt; &lt;br /&gt;  &lt;/font&gt;&lt;/span&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;cfargument name&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=PURPLE&gt;"argB"&lt;/FONT&gt; required&lt;FONT COLOR=BLUE SIZE=+1&gt;=&lt;/FONT&gt;&lt;FONT COLOR=PURPLE&gt;"no"&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;span class=cch1&gt;&lt;font color=gray&gt;  &lt;br /&gt;  &lt;/font&gt;&lt;/span&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;cfreturn arguments&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;span class=cch1&gt;&lt;font color=gray&gt;&lt;br /&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;lt;&lt;/FONT&gt;&lt;FONT COLOR=BLUE SIZE=+1&gt;/&lt;/FONT&gt;cffunction&lt;FONT COLOR=BLUE SIZE=+1&gt;&amp;gt;&lt;/FONT&gt;&lt;span class=cch1&gt;&lt;font color=gray&gt;&lt;br /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;a dump of this function will return:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;1: &lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfdump &lt;font color="RED"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"#fTwo()#"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;2: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;ARGA 1&lt;br /&gt;ARGB undefined&lt;br /&gt;&lt;br /&gt;Rather than just&lt;br /&gt;&lt;br /&gt;ARGA 1&lt;br /&gt;&lt;br /&gt;Thus ColdFusion 9 is introducing a new state in the variables, the Explicit "undefined".&lt;br /&gt;Since this is a new state all function working with CF objects/ i.e. variables will also need to be aware of it. And most are and, thus, little problem.&lt;br /&gt;&lt;br /&gt;However, if you introduce some slight alterations, e.g. call a custom tag from a component, this system fails.&lt;br /&gt;You will get errors as the IsDefined() function will identify something as defined while it is not.&lt;br /&gt;&lt;br /&gt;Let's introduce a simple custom tag (CT9Test) with the following 6 lines of code:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;1: &lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfdump &lt;font color="RED"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"#Attributes#"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;2: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfif IsDefined&lt;font color="BLUE" size="+1"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/font&gt;&lt;font color="PURPLE"&gt;"Attributes.ArgB"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;  &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;3: &lt;/span&gt;  Attributes B is defined&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;4: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfelse&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt; &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;5: &lt;/span&gt;  Attributes B is NOT Defined&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;6: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;/&lt;/font&gt;cfif&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;7: &lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;8: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;First let's call this custom tag from the function like so:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;1: &lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cffunction name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"fTwo"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;   &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;2: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argA"&lt;/font&gt; default&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"1"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt; &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;3: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argB"&lt;/font&gt; required&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"no"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;  &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;4: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cf_CT9Test attributeCollection &lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt; &lt;font color="PURPLE"&gt;"#Arguments#"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;5: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;/&lt;/font&gt;cffunction&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;6: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Nope. This is still good. No problem here. But, let's go ahead and break ColdFusion:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;1: &lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cffunction name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"fThree"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;   &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;2: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argA"&lt;/font&gt; default&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"1"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt; &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;3: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argB"&lt;/font&gt; required&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"no"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;  &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;4: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cf_CT9Test anotherVar&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"something"&lt;/font&gt; attributeCollection &lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt; &lt;font color="PURPLE"&gt;"#Arguments#"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;5: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;/&lt;/font&gt;cffunction&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;6: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;You see the difference?&lt;br /&gt;We are simply adding another parameter to be passed to the custom tag in addition to the attribute collection received from the function arguments.&lt;br /&gt;In the above case, the attributes.argB all of a sudden becomes defined. But since it is explicitly "undefined" using it will throw weird errors.&lt;br /&gt;Something like:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;if (IsDefined("attributes.argB") ) calc=attributes.argB + 1;&lt;/span&gt;&lt;br /&gt;will fail.&lt;br /&gt;&lt;br /&gt;The workaround to this is to go back to scenario one and not use any additional parameters when calling your custom tags and using attributeCollection. Package all parameters into one structure, e.g.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;1: &lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cffunction name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"fFour"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;     &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;2: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argA"&lt;/font&gt; default&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"1"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;   &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;3: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfargument name&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"argB"&lt;/font&gt; required&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"no"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;    &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;4: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cfset arguments&lt;font color="BLUE" size="+1"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/font&gt;anotherVar&lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt;&lt;font color="PURPLE"&gt;"something"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;5: &lt;/span&gt;  &lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;cf_CT9Test  attributeCollection &lt;font color="BLUE" size="+1"&gt;=&lt;/font&gt; &lt;font color="PURPLE"&gt;"#Arguments#"&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;6: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;font color="BLUE" size="+1"&gt;&amp;lt;&lt;/font&gt;&lt;font color="BLUE" size="+1"&gt;/&lt;/font&gt;cffunction&lt;font color="BLUE" size="+1"&gt;&amp;gt;&lt;/font&gt;&lt;span class="cch1"&gt;&lt;font color="gray"&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;7: &lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now that you know this. Happy migrating.&lt;br /&gt;-B&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2249497241119787727?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2249497241119787727/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2249497241119787727' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2249497241119787727'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2249497241119787727'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2011/01/cf-explicit-undefined-in-coldfusion-9.html' title='CF: Explicit &quot;undefined&quot; in ColdFusion 9 results in Bug when using CustomTag Attribute collections'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7248119450285618211</id><published>2010-12-29T10:37:00.002-05:00</published><updated>2010-12-29T10:49:31.659-05:00</updated><title type='text'>CF: Railo 3.2 Released</title><content type='html'>After much work the Railo team released the new version  (3.2) of &lt;a href="http://getrailo.org"&gt;Railo&lt;/a&gt; over Christmas.&lt;br /&gt;Railo is one of the Open Source ColdFusion application engines available. The other notable one is &lt;a href="http://www.openbluedragon.org/"&gt;Open Blue Dragon&lt;/a&gt;.&lt;br /&gt;If you are doing ColdFusion based programming this is something that should belong to your stable of tools that you are familiar with.&lt;br /&gt;In the past the discover-ability of Railo was harder as it was not as easy to understand how to get things going once you downloaded it. Though technically simply the step of getting it installed and going was a hurdle that made it harder than the Adobe engine.&lt;br /&gt;With this release among a myriad of enhancement installers were made available for multiple platforms. For example,  for the windows platform the comparable &lt;a href="http://www.getrailo.org/index.cfm/download/"&gt;Railo installer&lt;/a&gt; is one third the size of Adobe's while it handles both 32 and 64 bit installations.&lt;br /&gt;&lt;br /&gt;Happy Experimenting,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7248119450285618211?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7248119450285618211/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7248119450285618211' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7248119450285618211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7248119450285618211'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/12/cf-railo-32-released.html' title='CF: Railo 3.2 Released'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3193341611513452885</id><published>2010-12-01T03:00:00.000-05:00</published><updated>2010-12-01T03:00:13.494-05:00</updated><title type='text'>XJS: Using the debugger command to start a debugging session</title><content type='html'>The ability to kick of the an in-line step-by-step debugger was introduced in JavaScript early on. Since before JS version 1.5, I believe. However, practically speaking there were few client-side debuggers that could take advantage of this.&lt;br /&gt;Thus, the use of it has not been heavy even after the more ready availability of Browser development support and in-line debuggers. Today, all browsers support some sort of step-by-step debugger that can be used in concert with the debugger command to more effectively debug code, so perfect time to remind us of this option.&lt;br /&gt;&lt;br /&gt;Why would we need to use it?. Let use this snippet as an example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span &gt;&lt;b&gt;for&lt;/b&gt;&lt;/span&gt; &lt;span style=""  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span &gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; i&lt;span style=""  &gt;=&lt;/span&gt;&lt;span &gt;0&lt;/span&gt;&lt;span style=""  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i &lt;span style=""  &gt;&amp;lt;&lt;/span&gt;&lt;span style=""  &gt;=&lt;/span&gt; &lt;span &gt;10000&lt;/span&gt;&lt;span style=""  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; i&lt;span style=""  &gt;&lt;span style=""  &gt;+&lt;/span&gt;&lt;span style=""  &gt;+&lt;/span&gt;&lt;/span&gt;&lt;span style=""  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=""  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;   &lt;br /&gt; &lt;span &gt;&lt;b&gt;if&lt;/b&gt;&lt;/span&gt; &lt;span style=""  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;i&lt;span style=""  &gt;=&lt;/span&gt;&lt;span style=""  &gt;=&lt;/span&gt;&lt;span &gt;&lt;span style="font-weight: bold;"&gt;98&lt;/span&gt;&lt;/span&gt;&lt;span style=""  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style=""  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  debugger&lt;span style=""  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;span style=""  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;   &lt;br /&gt;&lt;span style=""  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;/pre&gt;Using conventional in-line debugging you would have to set a break-point, then iterate along until you reached the loop condition that you were interested in, i.e. 98. Using the debugger statement,  you simplify this drastically.&lt;br /&gt;&lt;br /&gt;Expanding this principle into use with ExtJS is easy. Giving the nested nature of much of the ExtJS code and heavy use of complex configuration objects setting breakpoints is sometimes a game of hit-and-miss.&lt;br /&gt;Using the debbuger statement you will still able to halt the execution at the right place even if you did not hit the correct break-point in your debugging tool.&lt;br /&gt;&lt;br /&gt;For example:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt; 1: &lt;/span&gt;listeners&lt;span  &gt;:&lt;/span&gt; &lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 2: &lt;/span&gt; render&lt;span  &gt;:&lt;/span&gt; &lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 3: &lt;/span&gt;  fn&lt;span  &gt;:&lt;/span&gt; &lt;span &gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 4: &lt;/span&gt;   &lt;span &gt;&lt;i&gt;//stop for debugging here&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt; 5: &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;   debugger&lt;span  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 6: &lt;/span&gt;   &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 7: &lt;/span&gt;   Ext&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;fly&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;clock&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getEl&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;parent&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;addClass&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span &gt;'x-status-text-panel'&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;createChild&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;cls&lt;span  &gt;:&lt;/span&gt;&lt;span &gt;'spacer'&lt;/span&gt;&lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 8: &lt;/span&gt;   &lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt; 9: &lt;/span&gt;   &lt;span &gt;&lt;i&gt;//Kick off the clock timer that updates the clock el every second:&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;10: &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;   &lt;span &gt;&lt;i&gt;//Would need to be set in application format&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;11: &lt;/span&gt;&lt;/i&gt;&lt;/span&gt;   Ext&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;TaskMgr&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;start&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;12: &lt;/span&gt;    run&lt;span  &gt;:&lt;/span&gt; &lt;span &gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;13: &lt;/span&gt;      Ext&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;fly&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;clock&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getEl&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;update&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;new&lt;/span&gt; Date&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;format&lt;span  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span &gt;'g:i:s A'&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;14: &lt;/span&gt;      &lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;15: &lt;/span&gt;   interval&lt;span  &gt;:&lt;/span&gt; &lt;span &gt;1000&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;16: &lt;/span&gt;   &lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;17: &lt;/span&gt;  &lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span  &gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;18: &lt;/span&gt;  delay&lt;span  &gt;:&lt;/span&gt; &lt;span &gt;100&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(238, 238, 238); background-color: rgb(255, 255, 255);"&gt;19: &lt;/span&gt; &lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: normal; color: rgb(204, 204, 204); background-color: rgb(255, 255, 255);"&gt;20: &lt;/span&gt;&lt;span  &gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Here we can stop when then rendering is activated to investigate code execution further.&lt;br /&gt;&lt;br /&gt;The debugger statment works in most browsers, i.e. Firefox with Firebug, IE 8, Chrome. In IE you will have to explicitly put the browser in debugging mode by clicking the "Start Debugging" button in the developer tools.&lt;br /&gt;&lt;br /&gt;Happy Debugging,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3193341611513452885?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3193341611513452885/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3193341611513452885' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3193341611513452885'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3193341611513452885'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/12/xjs-using-debugger-command-to-start.html' title='XJS: Using the debugger command to start a debugging session'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6658570736655358737</id><published>2010-11-20T12:22:00.004-05:00</published><updated>2010-11-22T09:00:27.774-05:00</updated><title type='text'>XJS: Avoiding of Anonymous Functions Example</title><content type='html'>One of the difficulties one faces quickly using the ExtJS framework is the code organization. Any project quickly grows into a jungle of anonymous functions and heavily nested configuration objects. Hard to read and hard to maintain.&lt;br /&gt;Examples commonly start simple but as soon as more elements are added they turn off newbies. A configuration object spanning multiple screens is not easy to digest, but this is how most online examples are presented. This, according to my informal survey, discourages new developers from proceeding.&lt;br /&gt;This, in my opinion, is one of the greater roadblocks to learning the framework and making scalable ExtJS apps. I understand that changes in ExtJS 4 will introduce a more mature MVC based application framework; however, the examples I have seen are still heavily reliant on multi-level nesting and anonymous functions.&lt;br /&gt;It is of course, a matter of preference, but I do find organizing code written in that fashion harder to read and manage long term.&lt;br /&gt;For once, common mistakes, such as missing a semicolon, comma, or bracket closure, result in disproportionate debugging time. On the other hand, having multiple team members working in their own "sandbox" is hard to do if everyone is trying to change the same file.&lt;br /&gt;Thus, I was looking for alternate organization but could not find a simple example to show that another approach was possible.&lt;br /&gt;&lt;br /&gt;Take this common ExtJS code as example (this is a fairly simple example in ExtJS realm). It draws a border layout based viewport:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;Ext&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;onReady&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:78%;color:blue;"&gt;new&lt;/span&gt; Ext&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Viewport&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;     layout&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'border'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;     items&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'north'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'&amp;lt;h1 class="x-panel-header"&amp;gt;Page Title&amp;lt;/h1&amp;gt;'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         autoHeight&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         border&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; false&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         margins&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'0 0 5 0'&lt;/span&gt;&lt;br /&gt;     &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'west'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         collapsible&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Navigation'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         width&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;200&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:green;"&gt;&lt;i&gt;// the west region might typically utilize a TreePanel or a Panel with Accordion layout&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;     &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'south'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Title for South Panel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         collapsible&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Information goes here'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;   id&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'southPanel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         split&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         height&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;100&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         minHeight&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;100&lt;/span&gt;&lt;br /&gt;     &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'east'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Title for the Grid Panel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         collapsible&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         split&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         width&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;200&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         xtype&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'box'&lt;/span&gt;&lt;br /&gt;         &lt;span style="color:green;"&gt;&lt;i&gt;// more nested code could be added here, e.g a GridPanel&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;     &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'center'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         xtype&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'tabpanel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color:green;"&gt;&lt;i&gt;// TabPanel itself has no title&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;         items&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Default Tab'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'T&lt;span style="FONT-WEIGHT: bold"&gt;ab conent&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+0;"&gt;&lt;span style="color:purple;"&gt;'&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;&lt;br /&gt;         }&lt;br /&gt;     }]&lt;br /&gt; }); &lt;br /&gt;});'&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The formatting is nicely done, but still requires some getting used to. Only a few nested elements in this one yet the complexity can be already seen. What if you had a team of developers each working on one of the panels?&lt;br /&gt;&lt;br /&gt;I prefer a more verbose but easier maintainable format that achieves the same result while allowing easier developer task separation (the use of multiple script tag is optional, I wanted to show a sense of separation of code):&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;script type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"text/javascript"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:green;"&gt;&lt;i&gt;//we define a namespace to use for organization. This is optional.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt; Ext&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;namespace&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;'startup'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;script&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;!&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;span style="font-size:78%;color:blue;"&gt;-&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;-&lt;/span&gt;&lt;/span&gt; panel definitions could be &lt;span style="color:red;"&gt;&lt;b&gt;in&lt;/b&gt;&lt;/span&gt; another file &lt;span style="font-size:78%;color:blue;"&gt;&lt;span style="font-size:78%;color:blue;"&gt;-&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;-&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;script type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"text/javascript"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:green;"&gt;&lt;i&gt;// each panel could be seperate script file maintained by seperate developer or dynamically included via&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt; &lt;span style="color:green;"&gt;&lt;i&gt;// app server such as PHP / Railo / etc.&lt;br /&gt;&lt;/i&gt;&lt;/span&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;northpanel &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'north'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'&amp;lt;h1 class="x-panel-header"&amp;gt;Page Title&amp;lt;/h1&amp;gt;'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         autoHeight&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         border&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; false&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         margins&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'0 0 5 0'&lt;/span&gt;&lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;westpanel &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'west'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         collapsible&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Navigation'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         width&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;200&lt;/span&gt;       &lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;southpanel &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'south'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Title for South Panel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         collapsible&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Information goes here'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;   id&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'southPanel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         split&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; true&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         height&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;100&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         minHeight&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:brown;"&gt;100&lt;/span&gt;&lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;centerpanel &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         region&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'center'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;         xtype&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'tabpanel'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt; &lt;span style="color:green;"&gt;&lt;i&gt;// TabPanel itself has no title&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;         items&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             title&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Default Tab'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;             html&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'Tab Conent.'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;         &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="color:green;"&gt;&lt;i&gt;//assemble panels here into array, alternatly this array could be the items definition&lt;br /&gt;&lt;/i&gt;&lt;/span&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;aItems &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;[&lt;/b&gt;&lt;/span&gt;startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;northpanel&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;westpanel&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;southpanel&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;centerpanel&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;]&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;script&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;script type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"text/javascript"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;DoInit &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="color:red;"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span style="color:green;"&gt;&lt;i&gt;//create view port     &lt;br /&gt;&lt;/i&gt;&lt;/span&gt;  &lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; bport &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;new&lt;/span&gt; Ext&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;Viewport&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;      layout&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; &lt;span style="color:purple;"&gt;'border'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;      items&lt;span style="font-size:78%;color:blue;"&gt;:&lt;/span&gt; startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;aItems&lt;br /&gt;  &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;    &lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;script&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;script type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"text/javascript"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span style="color:green;"&gt;&lt;i&gt;//the actual ExtJS onReady function remains very small&lt;br /&gt;&lt;/i&gt;&lt;/span&gt; Ext&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;onReady&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;function&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;{&lt;/b&gt;&lt;/span&gt;         &lt;br /&gt;  startup&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;DoInit&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt; &lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;}&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;;&lt;/b&gt;&lt;/span&gt; &lt;span style="color:green;"&gt;&lt;i&gt;//end onReady&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;script&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Of course, there is the element of preference and argument about throw away functions, e.g. only run once; I would still prefer good naming and definition as this is the long run makes my life easier.&lt;br /&gt;&lt;br /&gt;Feel free to comment.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6658570736655358737?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6658570736655358737/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6658570736655358737' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6658570736655358737'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6658570736655358737'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/11/xjs-avoiding-of-anonymous-functions.html' title='XJS: Avoiding of Anonymous Functions Example'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3170097306259666774</id><published>2010-11-16T14:00:00.005-05:00</published><updated>2010-11-16T16:55:55.509-05:00</updated><title type='text'>XJS: Sencha 2010 con impressions</title><content type='html'>&lt;div&gt;I am attenting the Sencha (formerly ExtJS) developer conference to learn about the future. Overall good energy at this conference. Definite feel of excitement about product and company from the developer community. Here are some early impressions:&lt;/div&gt;&lt;ul&gt;&lt;li&gt;Lots of activity since the company got funding&lt;/li&gt;&lt;li&gt;Company is trying to grow up and it shows: products are beeing build out, revenue model is being decided on / experimented with, business processes look raw around the edges. Overall this puppy is growing up.&lt;/li&gt;&lt;li&gt;Sencha has many projects in the cooking pot with some very innovative ones in the mix while still putting good improvements into the existing ones. The question will be, is the company going to be able to pull all this off or are they overloaded. Deliveries could slip, quality could suffer etc.&lt;/li&gt;&lt;li&gt;Their bread and butter ExtJS 4 is getting a dose of good overwhaul inlcluding things I have been griping about for a while. The main thing for me is that a best practices application structure is now supported out of the box, so you can finally organize your code for larger apps in a meaningfull way. (Yeah!!!) . My impression is that there are still some challenges to overcome with backward compatibility which they are working on. Many more good things of course, hope they can pull it off.&lt;/li&gt;&lt;li&gt;The developer interest is increasing, 3 x the number of developers attended this year.&lt;/li&gt;&lt;li&gt;Keynote from at&amp;amp;t cto John Donovan (he loves all phones and all people, yeah very politically correct answers all the way). The nugget from him was the statement that HTML5 is a viable application plattform and mobile apps will be written in it more  the future and at&amp;amp;t will support it on many devices with native device library connections. If you believe this, the future of Flash and Flex would look limited. Another conference attendee said "Adobe is the dead man walking". Wow!&lt;/li&gt;&lt;li&gt;The Sensha touch platform for mobile apps is going to be free. Cool.&lt;/li&gt;&lt;li&gt;Common Annoyance: "It works in webkit" myopia. Understandably browsers supporting HTML5 are cooler from developer perspective but many examples given did not work or broke when another browser was used (Firefox, IE). This is poor for any platform claiming universal compatibility. Hopefully this will improve next year.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Cheers,&lt;/div&gt;&lt;div&gt;-B&lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div&gt; &lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3170097306259666774?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3170097306259666774/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3170097306259666774' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3170097306259666774'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3170097306259666774'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/11/xjs-sencha-2010-con-impressions.html' title='XJS: Sencha 2010 con impressions'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6962059537524403471</id><published>2010-09-30T11:20:00.002-04:00</published><updated>2010-09-30T11:34:37.535-04:00</updated><title type='text'>CF: ORM EntityDelete without EntityLoad</title><content type='html'>I must admit I am not a fan of the EntityDelete() function. Its inability to handle multiple records always nagged me. I know I can allways go back to CFQUERY or use ormexecutequery(). But what nagged me the most appeared to be the need to do an EntityLoad before I could remove the entity/record. This could potentially introduce unneeded database reads and latency.&lt;br /&gt;e.g.:&lt;br /&gt;    myBook = EntityLoad("Book", 100, true);&lt;br /&gt;    EntityDelete(myBook);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Well it turnes out that the use of EntityLoad is not required. A colleague suggested I try the following instead which would eliminate the load operation, and since I thought that was pretty neat I am sharing ;o)&lt;br /&gt;&lt;br /&gt;    mybook = new Book();&lt;br /&gt;    mybook.setBOOKID(100);&lt;br /&gt;    EntityDelete(mybook);&lt;br /&gt;&lt;br /&gt;In this fashion, you are creating the object reference in memory and guaranteeing that there is only one DB interaction at DELETE.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6962059537524403471?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6962059537524403471/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6962059537524403471' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6962059537524403471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6962059537524403471'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/09/cf-orm-entitydelete-without-entityload.html' title='CF: ORM EntityDelete without EntityLoad'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-820922185664009876</id><published>2010-07-25T12:10:00.007-04:00</published><updated>2010-07-25T16:28:17.152-04:00</updated><title type='text'>VS2010: Visual Studio 2010 - finding web reference option when working with Windows Forms Applications</title><content type='html'>Something I ran into today made me do a double take. This could have originated from the initial configuration choice I made when setting up Visual Studio 2010 or the tool is trying to be so smart it starts to get confusing..&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However it happened, it does seem to make things more difficult when trying to create windows form applications. In particular, if you want to use a web-reference in your regular windows application the number of clicks has increased and discoverability has decreased.&lt;br /&gt;&lt;br /&gt;Adding web-references to consume web services in ASP.NET application is not impacted by this change. In particular the context sensitive links to add web-reference are gone when I am in the Solution Explorer working on a Windows Form Application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Qsm4KVMryjM/TEya7ykMTfI/AAAAAAAAAC8/PHtdxjRyQmk/s1600/vs2010_A.gif"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 356px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5497939597089066482" border="0" alt="" src="http://2.bp.blogspot.com/_Qsm4KVMryjM/TEya7ykMTfI/AAAAAAAAAC8/PHtdxjRyQmk/s400/vs2010_A.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Instead the only thing you can seemingly do is to add a service reference. Though you can start here, web services that are registered through this channel do not behave at all like the previous releases of Visual Studio. Thus, beware, this is not what you want to do if you want to consume a regular web service, especially ones that are not created with VS to begin with. To get to the plain Jane adding of a web service you have to walk through some additional steps.&lt;br /&gt;&lt;br /&gt;A) Select the "Add Service Reference..." option, then, click on the "Advanced..." button.&lt;/p&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Qsm4KVMryjM/TEyb8Dlrs0I/AAAAAAAAADE/FxE-2VBvPoA/s1600/vs2010_B.gif"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 319px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5497940701170348866" border="0" alt="" src="http://2.bp.blogspot.com/_Qsm4KVMryjM/TEyb8Dlrs0I/AAAAAAAAADE/FxE-2VBvPoA/s400/vs2010_B.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;B) Click on the "Add Web Service" button from the advanced screen:&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_Qsm4KVMryjM/TEycmFqtduI/AAAAAAAAADM/_16LrpPe7mg/s1600/vs2010_C.gif"&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 368px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5497941423282812642" border="0" alt="" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/TEycmFqtduI/AAAAAAAAADM/_16LrpPe7mg/s400/vs2010_C.gif" /&gt;&lt;/a&gt;&lt;br /&gt;Allright that should do it to bring you back into the old web service ways. &lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;B&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-820922185664009876?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/820922185664009876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=820922185664009876' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/820922185664009876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/820922185664009876'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/07/vs2010-visual-studio-2010-finding-web.html' title='VS2010: Visual Studio 2010 - finding web reference option when working with Windows Forms Applications'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Qsm4KVMryjM/TEya7ykMTfI/AAAAAAAAAC8/PHtdxjRyQmk/s72-c/vs2010_A.gif' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-423626907266906620</id><published>2010-07-17T09:48:00.005-04:00</published><updated>2010-11-22T09:08:11.851-05:00</updated><title type='text'>CF: The varExists() function -- Expanding IsDefined() to work with regular array and associative array notations.</title><content type='html'>Many times while working in ColdFusion code I am encountering the simple need to check for the existence of an index in an array, e.g. myArray[3]. While other languages may have had easier checks on this, in Adobe ColdFusion, I unfortunately, have to work around this scenario with many lines of code or different functions to call. Thus, I am able to construct fully well formed variable references and use them, but cannot check their validity in a simple fashion.&lt;br /&gt;&lt;br /&gt;For example, I can't do a simple call to a universal function such as IsDefined("myVar[3]"). In this simple scenario we could have used ArrayIsDefined(), however, the scenarios I normally deal with are not so simple. In my scenarios I am not sure about whether "myVar" is an array in the first place or whether the index is numeric. E.g. I may need to check myVar[checkIndex]; this maybe a strucure with an associative array notation which takes me back to square one. Along these lines, multi-dimensional arrays such as myArray[3][4] are equally unqualified for ArrayIsDefined().&lt;br /&gt;&lt;br /&gt;Similarly associative array notations that can be used with structures, e.g. myStruct["testNode"], equally do poorly on these checks and could require some sort of special checking and more lines of code.&lt;br /&gt;&lt;br /&gt;How about a combination of things:&lt;br /&gt;TestStruct.Animals['species'][1]['counts'][2]&lt;br /&gt;&lt;br /&gt;All of these scenarios go beyond the ability of IsDefined() or other functions and cause more code to be written. Maybe this would be an opportunity to expand in future version of ColdFusion but for now we're stuck or are we? (yeah, rhetorical question this one).&lt;br /&gt;&lt;br /&gt;I made this a test project and developed an alternative function, varExists(), to IsDefined(); it may not be usable in all scenarios but will come in handy in coding.&lt;br /&gt;The sample implementation can be downloaded here (&lt;a href="http://www.boncode.net/downloads/varExists.zip"&gt;varExists.zip&lt;/a&gt; (3KB)).&lt;br /&gt;&lt;br /&gt;The first objective was just to be able to handle the complex notation scenarios that commonly fail under IsDefined().&lt;br /&gt;&lt;br /&gt;e.g.:&lt;br /&gt;varExists("TestStruct.Animals['species'][1]['counts'][2]") should operate without a hitch on complex variable notations. While at the same time maintaining full backward compatibility with IsDefined(). So you should be able to do things like this varExists(varName), varExists should check for the existince of the content referenced by the content of varName, e.g. a string such as "TestStruct.myArray[2][1]".&lt;br /&gt;&lt;br /&gt;But, why stop there, the next thing that I commonly do once I check for the existence of a variable is to retrieve its value for some sort of operation, so I added this option as second argument. Thus, varExists will automatically return the value referenced as part of its operation if "True" is passed as second argument, e.g. varExists("myUserArray[33]",true). This would return the UserName at array index position 33.&lt;br /&gt;&lt;br /&gt;Another common task I perform when the value is not known or "undefined" is to assume a default value. Thus, I added this as third parameter. When a third parameter is supplied it will be returned, when the actual variable reference is undefined.&lt;br /&gt;For example:&lt;br /&gt;varExists("myUserArray[33]",true,"John Doe")&lt;br /&gt;would return "John Doe" if the array index 33 is not populated for some reason.&lt;br /&gt;&lt;br /&gt;&lt;p&gt;The example code has the test array and unit tests with sample scenarios. The hope is that eventually the ColdFusion language can accommodate these type of operations natively.&lt;/p&gt;&lt;p&gt;Happy experimenting.&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;B.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Addition:&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The &lt;a href="http://www.getrailo.org/"&gt;Railo &lt;/a&gt;CFML engine does not exhibit the flaw outlined in this article. Thus, if you use Railo, you probably will not encounter scenarios in which you can construct a valid variable reference but cannot check for its existence. The IsDefined() function works as expected, however, if you want the expanded functionality of retrieving variable values etc. you would still need to use the varExists() User Defined Function (UDF) provided here.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt;Best,&lt;/p&gt;&lt;p&gt;B.&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-423626907266906620?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/423626907266906620/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=423626907266906620' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/423626907266906620'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/423626907266906620'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/07/cf-varexists-function-expanding.html' title='CF: The varExists() function -- Expanding IsDefined() to work with regular array and associative array notations.'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2009832370541275400</id><published>2010-06-01T17:23:00.010-04:00</published><updated>2010-06-01T18:07:31.782-04:00</updated><title type='text'>CF: Connecting 64-bit Coldfusion to 32-bit MS Access databases</title><content type='html'>First off, don't ask me why you would want to do this, just go with the flow.&lt;br /&gt;In other words, let's not get bogged down on how you should not put anything on Microsoft Access anyway and accept the fact that there is still many applications that are perfectly happy with it ;o)&lt;br /&gt;The problem has existed for a while but it dawned on me more clearly as I was sitting in on a hands-on beginner CF class at &lt;a target="_blank" href="http://ncdevcon.com/"&gt;NC Dev Con&lt;/a&gt; and several of the participants immediately ran into this with their brand spanking new, high powered, Windows 7 64-bit computers.&lt;br /&gt;&lt;br /&gt;So it seems more common that you would want to take the 64-bit edition from Adobe for a spin. But as soon as you attempt to connect to anything 32 bit you receive non-descriptive errors such as:&lt;br /&gt;&lt;br /&gt;"&lt;span style="font-weight: bold;"&gt;Unable to update the NT registry. Variable DRIVERPATH is undefined.&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;Maybe dropping those options from the list of available drivers would have been wiser and less frustrating for users. Something for Adobe to ponder about I guess.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWBmy7GLxI/AAAAAAAAACc/pNIzgVopSJQ/s1600/s4_CFVersion.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 301px;" src="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWBmy7GLxI/AAAAAAAAACc/pNIzgVopSJQ/s400/s4_CFVersion.gif" alt="" id="BLOGGER_PHOTO_ID_5477927025270730514" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Microsoft does not have any (as of this writing at least) ODBC drivers for 64-bit Microsoft Access; in general, not much ODBC activity in a long time from the Microsoft camp. So, you might be well able to load up Office 2010 in 64 bit format; using the resulting databases for your projects, however, is a fairly complicated tasks.&lt;br /&gt;&lt;br /&gt;As with all workarounds there are many steps to complete, so here we go:&lt;br /&gt;&lt;br /&gt;1.) Download and Install 64 bit SQL Server 2005 Express Edition. You cannot use SQL Server 2008 Express edition, so don't try. It is lacking the needed OLE DB Provider.&lt;br /&gt;&lt;br /&gt;2.) Download and Install Management Tools&lt;br /&gt;&lt;br /&gt;3.) Download and Install Microsoft SQL Server JDBC drivers&lt;br /&gt;&lt;br /&gt;For steps 1 through 3 here is a nice tutorial by &lt;a target="_blank" href="http://www.fusioncube.net/index.php/coldfusion-sql-server-express"&gt;Steve Brownlee - Fusioncube&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;4. ) Copy your MDB somewhere, e.g. c:\temp&lt;br /&gt;&lt;br /&gt;5.) Created Linked Databases using Microsoft Jet 4.0 OLE DB Provider&lt;br /&gt;&lt;br /&gt;a) Linked Server Menu. Right click on the Linked server node and then click on "New Linked Server..." sub-menu option:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWA2iDHxTI/AAAAAAAAACE/-SYWsQJ_EV8/s1600/s1_LinkedServerMenu.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 337px;" src="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWA2iDHxTI/AAAAAAAAACE/-SYWsQJ_EV8/s400/s1_LinkedServerMenu.gif" alt="" id="BLOGGER_PHOTO_ID_5477926196107265330" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;b)linked server dialog. Product name can be anything you like. Data source should point to your access file:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Qsm4KVMryjM/TAWBQzgn26I/AAAAAAAAACM/Ktd1PaevvHY/s1600/s2_LinkedServerDialog.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 359px;" src="http://2.bp.blogspot.com/_Qsm4KVMryjM/TAWBQzgn26I/AAAAAAAAACM/Ktd1PaevvHY/s400/s2_LinkedServerDialog.gif" alt="" id="BLOGGER_PHOTO_ID_5477926647471004578" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;6.) Create DS in CF Admin&lt;br /&gt;&lt;br /&gt;a) create type other&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWCukMLHZI/AAAAAAAAACk/idPLVFmdELo/s1600/s5_AddDS.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 205px;" src="http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWCukMLHZI/AAAAAAAAACk/idPLVFmdELo/s400/s5_AddDS.gif" alt="" id="BLOGGER_PHOTO_ID_5477928258266406290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;b) specify data source connection properties&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Qsm4KVMryjM/TAWC9aFPMtI/AAAAAAAAACs/PDz4PCZ5A50/s1600/s6_DSDef.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 234px;" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/TAWC9aFPMtI/AAAAAAAAACs/PDz4PCZ5A50/s400/s6_DSDef.gif" alt="" id="BLOGGER_PHOTO_ID_5477928513250996946" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;7.) Create sample code for CF. Your query code has to be changed, so you might want to create a variable to hold your prefix to your tables in case you change from 64 bit to 32 bit and vice versa.&lt;br /&gt;&lt;br /&gt;Note that you have to use the four part syntax to query out of a linked MS Access to SQL database. You are just omitting two parts, there is also another syntax possible : Openquery(Linked_Server, 'Query') which I will not dig into.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Qsm4KVMryjM/TAWBcRZSwiI/AAAAAAAAACU/qhcTOB97tno/s1600/s3_QueryDialect.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 265px;" src="http://3.bp.blogspot.com/_Qsm4KVMryjM/TAWBcRZSwiI/AAAAAAAAACU/qhcTOB97tno/s400/s3_QueryDialect.gif" alt="" id="BLOGGER_PHOTO_ID_5477926844471886370" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To specify a query table in your access database you start with the name you  have entered in SQL Server while the creating the link. In my case this is  "Northwind". This name is followed by three periods (...) and, then, by the  actual table name:&lt;br /&gt;e.g. : NORTHWIND...EMPLOYEES&lt;br /&gt;&lt;br /&gt;Here is my example code:&lt;br /&gt;HelloNW.cfm file:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfquery name&lt;span style=";font-size:1px;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"selNorthwindEE"&lt;/span&gt; datasource&lt;span style=";font-size:1px;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Northwind"&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;SELECT *&lt;br /&gt;FROM NORTHWIND...EMPLOYEES&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;/&lt;/span&gt;cfquery&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfdump &lt;span style="color:RED;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"#selNorthwindEE#"&lt;/span&gt;&lt;span style=";font-size:1px;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;8.) Enjoy&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Qsm4KVMryjM/TAWDLIYYi6I/AAAAAAAAAC0/KgJ2FLL7Kdg/s1600/s7_QueryResult.gif"&gt;&lt;img style="display: block; margin: 0px auto 10px; text-align: center; cursor: pointer; width: 400px; height: 277px;" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/TAWDLIYYi6I/AAAAAAAAAC0/KgJ2FLL7Kdg/s400/s7_QueryResult.gif" alt="" id="BLOGGER_PHOTO_ID_5477928749017631650" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2009832370541275400?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2009832370541275400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2009832370541275400' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2009832370541275400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2009832370541275400'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/06/cf-connecting-64-bit-coldfusion-to-32.html' title='CF: Connecting 64-bit Coldfusion to 32-bit MS Access databases'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Qsm4KVMryjM/TAWBmy7GLxI/AAAAAAAAACc/pNIzgVopSJQ/s72-c/s4_CFVersion.gif' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-548511880168503558</id><published>2010-05-17T17:08:00.003-04:00</published><updated>2010-05-24T08:51:38.952-04:00</updated><title type='text'>CF:Flex: FOF: Flex on Fusion, thoughts on what it takes to create a unified framework</title><content type='html'>&lt;span style="font-weight: bold;"&gt;The Situation&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;If you have worked on either Flex or ColdFusion you know that nowadays there is more development frameworks than people know what to do with.&lt;br /&gt;At one point having a consistent pre-defined path to application development on either of these platforms meant you had to invent wheels many times over. Now, the situation has changed to one where you attempting to decide which framework to use; long discussions and passions are aroused.&lt;br /&gt;At some level this has become as counter-productive as the use of no framework was before.&lt;br /&gt;Here are the commonalities I noticed:&lt;br /&gt;&lt;br /&gt;a) Frameworks are for developers:&lt;br /&gt;&lt;br /&gt;You have to learn the platform, learn the framework and have some sort of knack for writing code.&lt;br /&gt;&lt;br /&gt;b) Frameworks only cover one or the other technology.&lt;br /&gt;&lt;br /&gt;They do not span technologies, even if your application is expected to. Thus if you have to write an app that uses a ColdFusion back-end and a Flex front-end; you have to put the puzzle together yourself. One may even say we are back where we were several years in the no framework days.&lt;br /&gt;&lt;br /&gt;I understand, there are wizards to get you started in both directions, e.g. CF wizards for flex, and flex wizards for CF, but a wizard a framework does not make ;o)&lt;br /&gt;&lt;br /&gt;Don't get me wrong. There are some cool things being done with scaffolding to generate fully fleshed out UIs that are generated from a database, a la Ruby. For example, check out &lt;a href="http://www.terrenceryan.com/blog/post.cfm/apptacular-coldfusion-builder-extension" target="_blank"&gt;Apptacular&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;c) Frameworks focus on developer application parts&lt;br /&gt;&lt;br /&gt;Frameworks focus on allowing programmers a base structure that can expanded. Most of this centers around the use of the MVC pattern in one form or the other. However, less attention is given on other services needed in order make an application complete or usable.&lt;br /&gt;&lt;br /&gt;For example commonly left to the programmers are things like internationalization, user management, rights management, currency and data management, skinning management.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The Thought&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Using frameworks either on ColdFusion or Flex is nothing new. Creating a Framework that spans both is. Thus the idea of Flex on Fusion (FoF) came into my head and just would not let go. I thought, well, now what? Do you really want to create yet another framework even if the idea sounds cool. Who would want to learn it? and Why?&lt;br /&gt;But, for some reason, the idea was persistent and would not easily go away by itself.&lt;br /&gt;More thinking occurred and I do think that this framework has to enable the user (not necessarily a developer) to quickly built full applications. More like the &lt;a href="http://www.magicsoftware.com/en/" target="_blank"&gt;Magic&lt;/a&gt; environment, more graphical, less focus on writing code.&lt;br /&gt;And so I am putting it out here to gather feedback and expand on it.&lt;br /&gt;&lt;br /&gt;The idea is not to obsolete all other frameworks, rather build a more user centric framework that can be used along with other frameworks. Thus, you should be able to use platform level frameworks to construct sub-pieces. Use the stength of each plattform, CF, for the database and logic, Flex, for advanced visualation and UI, in a combined stronger form.&lt;br /&gt;&lt;br /&gt;I am envisioning a startup process that walks the user through the basic steps, e.g. pointing at the database and determining a subdirectory to write the model implementation, etc. This is similar to other scaffolding models; however, the application that is built will also have a user and security model. More importantly, after the basic build is finished, there should be a UI that can be used to define the application further without coding. Adding more data/screens should all be doable via UI. In the extreme thought the UI would expose an IDE for the pieces that require coding.&lt;br /&gt;&lt;br /&gt;Once an application is generated, it can extended easily be extended while it is running by users with sufficient permissions.&lt;br /&gt;&lt;br /&gt;I will post some more detail describing screens and workflow in a bit.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-548511880168503558?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/548511880168503558/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=548511880168503558' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/548511880168503558'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/548511880168503558'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/05/cfflex-fof-flex-on-fusion-thoughts-on.html' title='CF:Flex: FOF: Flex on Fusion, thoughts on what it takes to create a unified framework'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-5635799127816579500</id><published>2010-04-15T12:13:00.003-04:00</published><updated>2010-04-15T12:19:40.388-04:00</updated><title type='text'>Java: VisualVM "Add JMX Connection..." missing from file menu</title><content type='html'>A quick note as I had not seen this before.&lt;br /&gt;This &lt;span id="SPELLING_ERROR_0" class="blsp-spelling-corrected"&gt;occurred&lt;/span&gt; to me on windows 2008 R2 server &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;platform&lt;/span&gt;.&lt;br /&gt;I looked and even compared log files among computers could not find anything conclusive that would cause this. But for some reason the option to add a JMX Connection was not available any longer in VisualVM tool.&lt;br /&gt;Not in context menu and not in File menu.&lt;br /&gt;&lt;br /&gt;Much trial and error followed but the solution was to redo the installation.&lt;br /&gt;Thus, the only thing that worked is to delete the &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; directory, &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-corrected"&gt;re extract&lt;/span&gt; the zip files to a different directory, then start the &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-error"&gt;exe&lt;/span&gt; with Administrative privileges.&lt;br /&gt;After the initial calibration, the Menu item for JMX Connection was available again.&lt;br /&gt;&lt;br /&gt;Yohoo!&lt;br /&gt;-B&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-5635799127816579500?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/5635799127816579500/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=5635799127816579500' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5635799127816579500'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5635799127816579500'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/04/java-visualvm-add-jmx-connection.html' title='Java: VisualVM &quot;Add JMX Connection...&quot; missing from file menu'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2444865122166615736</id><published>2010-04-15T09:58:00.010-04:00</published><updated>2010-04-15T12:21:34.062-04:00</updated><title type='text'>CF: Java: Using free VisualVM tool to monitor running ColdFusion Servers</title><content type='html'>You may have had a chance to use the &lt;a href="https://visualvm.dev.java.net/" target="_blank"&gt;&lt;span id="SPELLING_ERROR_0" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; &lt;/a&gt;tools in the past and found them &lt;span id="SPELLING_ERROR_1" class="blsp-spelling-corrected"&gt;helpful&lt;/span&gt; to get an idea on what is actually happening on the &lt;span id="SPELLING_ERROR_2" class="blsp-spelling-error"&gt;VM&lt;/span&gt; while your code is running.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 379px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460365383798863650" border="0" alt="" src="http://3.bp.blogspot.com/_Qsm4KVMryjM/S8cdYuUrtyI/AAAAAAAAABM/GdKzEMMARoI/s400/vvm1.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The &lt;span id="SPELLING_ERROR_3" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; tools can help you detect memory leaks in progress as well as other constraints on your server before it crashes. But even after a crash these tools are &lt;span id="SPELLING_ERROR_4" class="blsp-spelling-corrected"&gt;helpful&lt;/span&gt;. The tools are very graphical and easier to use than attempting to read thread dumps and heap dumps manually.&lt;br /&gt;&lt;br /&gt;Here are some simple steps to use this great &lt;span id="SPELLING_ERROR_5" class="blsp-spelling-corrected"&gt;tool set&lt;/span&gt; with &lt;span id="SPELLING_ERROR_6" class="blsp-spelling-error"&gt;ColdFusion&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1)&lt;/strong&gt; &lt;span id="SPELLING_ERROR_7" class="blsp-spelling-corrected"&gt;download&lt;/span&gt; java &lt;span id="SPELLING_ERROR_8" class="blsp-spelling-error"&gt;jdk&lt;/span&gt; 1.6.09 or later&lt;br /&gt;&lt;a href="http://java.sun.com/javase/downloads/index.jsp" target="_blank"&gt;http://java.sun.com/javase/downloads/index.jsp&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2)&lt;/strong&gt; Download Visual &lt;span id="SPELLING_ERROR_9" class="blsp-spelling-error"&gt;VM&lt;/span&gt;&lt;br /&gt;&lt;a href="https://visualvm.dev.java.net/"&gt;https://visualvm.dev.java.net/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3)&lt;/strong&gt; Configure &lt;span id="SPELLING_ERROR_10" class="blsp-spelling-error"&gt;Coldfusion&lt;/span&gt; &lt;span id="SPELLING_ERROR_11" class="blsp-spelling-error"&gt;jmx&lt;/span&gt; access&lt;br /&gt;Best way is to go to &lt;span id="SPELLING_ERROR_12" class="blsp-spelling-error"&gt;Coldfusion&lt;/span&gt; Administrator Java and &lt;span id="SPELLING_ERROR_13" class="blsp-spelling-error"&gt;JVM&lt;/span&gt; settings section.&lt;br /&gt;Add the following parameters:&lt;br /&gt;&lt;br /&gt;-Dcom.sun.management.jmxremote.port=8701&lt;br /&gt;-Dcom.sun.management.jmxremote.ssl=false&lt;br /&gt;-Dcom.sun.management.jmxremote.authenticate=false&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 93px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460366936800355202" border="0" alt="" src="http://3.bp.blogspot.com/_Qsm4KVMryjM/S8cezHtF44I/AAAAAAAAABU/AkUCQXLUr-I/s400/vvm2.GIF" /&gt;&lt;br /&gt;You can decide whether to use &lt;span id="SPELLING_ERROR_14" class="blsp-spelling-error"&gt;ssl&lt;/span&gt; or not, and also on the port to use. If you want to use &lt;span id="SPELLING_ERROR_15" class="blsp-spelling-error"&gt;jmx&lt;/span&gt; authentication I would recommend you read:&lt;br /&gt;&lt;a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#gdenl" target="_blank"&gt;http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#gdenl&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4)&lt;/strong&gt; Configure your Visual &lt;span id="SPELLING_ERROR_16" class="blsp-spelling-error"&gt;vm&lt;/span&gt; start up to point to your &lt;span id="SPELLING_ERROR_17" class="blsp-spelling-error"&gt;jdk&lt;/span&gt; if you have not set environmental variables:&lt;br /&gt;e.g. on Windows&lt;br /&gt;if you extracted the &lt;span id="SPELLING_ERROR_18" class="blsp-spelling-error"&gt;visualvm&lt;/span&gt; files into C:\Java\&lt;span id="SPELLING_ERROR_19" class="blsp-spelling-error"&gt;visualvm&lt;/span&gt;_122&lt;br /&gt;and&lt;br /&gt;Your &lt;span id="SPELLING_ERROR_20" class="blsp-spelling-error"&gt;JDK&lt;/span&gt; is located in C:\Java\jdk1.6.0_19&lt;br /&gt;then you can use the following command line:&lt;br /&gt;&lt;br /&gt;C:\Java\&lt;span id="SPELLING_ERROR_21" class="blsp-spelling-error"&gt;visualvm&lt;/span&gt;_122\bin\&lt;span id="SPELLING_ERROR_22" class="blsp-spelling-error"&gt;visualvm&lt;/span&gt;.&lt;span id="SPELLING_ERROR_23" class="blsp-spelling-error"&gt;exe&lt;/span&gt; --&lt;span id="SPELLING_ERROR_24" class="blsp-spelling-error"&gt;jdkhome&lt;/span&gt; "C:\Java\jdk1.6.0_19"&lt;br /&gt;&lt;br /&gt;I put it in a batch file that I can start &lt;span id="SPELLING_ERROR_25" class="blsp-spelling-corrected"&gt;easily&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5)&lt;/strong&gt; Start up the &lt;span id="SPELLING_ERROR_26" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; tool (it may have to go through calibration first, simply &lt;span id="SPELLING_ERROR_27" class="blsp-spelling-corrected"&gt;acknowledge&lt;/span&gt;), then, and establish a connection a &lt;span id="SPELLING_ERROR_28" class="blsp-spelling-error"&gt;JMX&lt;/span&gt; connection by right clicking on the local node and &lt;span id="SPELLING_ERROR_29" class="blsp-spelling-corrected"&gt;choosing&lt;/span&gt; "Add &lt;span id="SPELLING_ERROR_30" class="blsp-spelling-error"&gt;JMX&lt;/span&gt; Connection..."&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 306px; DISPLAY: block; HEIGHT: 284px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460367642641230466" border="0" alt="" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/S8cfcNKq6oI/AAAAAAAAABc/TbYLadT4Gmg/s400/vvm3.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;6)&lt;/strong&gt; Add connection parameters&lt;br /&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 263px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460368577862628146" border="0" alt="" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/S8cgSpI08zI/AAAAAAAAABk/P6w6_-RKW4s/s400/vvm4.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;Now you should be able monitor your server as it runs. I found this to be more stable than the Server Monitor in Enterprise versions of &lt;span id="SPELLING_ERROR_31" class="blsp-spelling-error"&gt;ColdFusion&lt;/span&gt; especially under load. It does not have all the same information but you can get a detailed breakdown of &lt;span id="SPELLING_ERROR_32" class="blsp-spelling-error"&gt;VM&lt;/span&gt; memory use.&lt;br /&gt;&lt;br /&gt;To get into the details of which CF code is using memory you have to generate a heap dump and use the heap walker to run the analysis. All the classes starting with cf... are your code running on the &lt;span id="SPELLING_ERROR_33" class="blsp-spelling-error"&gt;VM&lt;/span&gt;.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 320px; DISPLAY: block; HEIGHT: 242px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460369946807993986" border="0" alt="" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/S8chiU21hoI/AAAAAAAAABs/JqpGjyiwX1s/s320/vvm7.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;You also have the option to monitor remote &lt;span id="SPELLING_ERROR_34" class="blsp-spelling-error"&gt;ColdFusion&lt;/span&gt; servers as well. You monitor multiple remote and local CF instances in one console, however, unlike the local monitoring, you cannot generate a heap dump when using remote connections.&lt;br /&gt;&lt;br /&gt;Creating a remote &lt;span id="SPELLING_ERROR_35" class="blsp-spelling-error"&gt;connection&lt;/span&gt; involves two steps in &lt;span id="SPELLING_ERROR_36" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; after you enabled &lt;span id="SPELLING_ERROR_37" class="blsp-spelling-error"&gt;jmx&lt;/span&gt; access on &lt;span id="SPELLING_ERROR_38" class="blsp-spelling-error"&gt;ColdFusion&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;a)&lt;/strong&gt; Adding a remote host. You do that by right clicking on the "Remote" node in &lt;span id="SPELLING_ERROR_39" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 251px; DISPLAY: block; HEIGHT: 192px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460370407200231458" border="0" alt="" src="http://3.bp.blogspot.com/_Qsm4KVMryjM/S8ch9H85kCI/AAAAAAAAAB0/AsdmQSMxGRI/s400/vvm5.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;b)&lt;/strong&gt; Specify the host name and display name and connection &lt;span id="SPELLING_ERROR_40" class="blsp-spelling-error"&gt;jstatd&lt;/span&gt; port (this is the same port you set in your CF &lt;span id="SPELLING_ERROR_41" class="blsp-spelling-error"&gt;JVM&lt;/span&gt; &lt;span id="SPELLING_ERROR_42" class="blsp-spelling-corrected"&gt;start up&lt;/span&gt; parameters). You will need to use the Advanced Settings dialog to do this. The port should be the same you set in the &lt;span id="SPELLING_ERROR_43" class="blsp-spelling-error"&gt;ColdFusion&lt;/span&gt; Java and &lt;span id="SPELLING_ERROR_44" class="blsp-spelling-error"&gt;JVM&lt;/span&gt; settings for that instance of CF.&lt;br /&gt;&lt;br /&gt;&lt;img style="TEXT-ALIGN: center; MARGIN: 0px auto 10px; WIDTH: 400px; DISPLAY: block; HEIGHT: 296px; CURSOR: hand" id="BLOGGER_PHOTO_ID_5460370788448918290" border="0" alt="" src="http://1.bp.blogspot.com/_Qsm4KVMryjM/S8ciTUNq2xI/AAAAAAAAAB8/LphooSxC-WU/s400/vvm6.GIF" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;c)&lt;/strong&gt; Set up a remote &lt;span id="SPELLING_ERROR_45" class="blsp-spelling-error"&gt;JMX&lt;/span&gt; connection by right clicking on the server name node and &lt;span id="SPELLING_ERROR_46" class="blsp-spelling-corrected"&gt;choosing&lt;/span&gt; "Add &lt;span id="SPELLING_ERROR_47" class="blsp-spelling-error"&gt;JMX&lt;/span&gt; Connection...". This will bring up a similar window as in step 6 above. Fill in the server and port information and you should be able to see your server.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Another common use for the &lt;span id="SPELLING_ERROR_48" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; tool is analyse a Heap Dump after a &lt;span id="SPELLING_ERROR_49" class="blsp-spelling-error"&gt;VM&lt;/span&gt; crashes due to memory problems. You can open and walk through the final &lt;span id="SPELLING_ERROR_50" class="blsp-spelling-error"&gt;VM&lt;/span&gt; Heap state. To make C&lt;span id="SPELLING_ERROR_51" class="blsp-spelling-error"&gt;oldFusion&lt;/span&gt; produce a heap dump you will have to change the &lt;span id="SPELLING_ERROR_52" class="blsp-spelling-error"&gt;jrun&lt;/span&gt;.&lt;span id="SPELLING_ERROR_53" class="blsp-spelling-error"&gt;config&lt;/span&gt; file and add this &lt;span id="SPELLING_ERROR_54" class="blsp-spelling-error"&gt;config&lt;/span&gt; option:&lt;br /&gt;&lt;br /&gt;-XX:+&lt;span id="SPELLING_ERROR_55" class="blsp-spelling-error"&gt;HeapDumpOnOutOfMemoryError&lt;/span&gt;&lt;br /&gt;If there is a crash the heap dump should be a text file located in your {&lt;span id="SPELLING_ERROR_56" class="blsp-spelling-error"&gt;coldfusion&lt;/span&gt;}\bin folder.&lt;br /&gt;&lt;br /&gt;More information on how to use the &lt;span id="SPELLING_ERROR_57" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; tool is available on the &lt;span id="SPELLING_ERROR_58" class="blsp-spelling-error"&gt;VisualVM&lt;/span&gt; website; &lt;span id="SPELLING_ERROR_59" class="blsp-spelling-corrected"&gt;definitely&lt;/span&gt; worth a look. &lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt;-B.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2444865122166615736?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2444865122166615736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2444865122166615736' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2444865122166615736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2444865122166615736'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/04/cf-java-using-free-visualvm-tool-to.html' title='CF: Java: Using free VisualVM tool to monitor running ColdFusion Servers'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_Qsm4KVMryjM/S8cdYuUrtyI/AAAAAAAAABM/GdKzEMMARoI/s72-c/vvm1.GIF' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1953750045436401589</id><published>2010-03-16T09:55:00.009-04:00</published><updated>2010-03-25T14:40:19.598-04:00</updated><title type='text'>CF: Dynamically changing Application.cfc using server specific configuration files</title><content type='html'>This started as I was reading an old post from &lt;a href="http://www.bennadel.com/blog/905-Ask-Ben-Environment-Based-Application-cfc-Settings.htm" target="_blank"&gt;Ben Nadel&lt;/a&gt;.&lt;br /&gt;I did see that Ben was using a methodology to set up Application startup parameters in a special config function and commented on it.&lt;br /&gt;I wrote about our experience with externalizing these parameters into specific configuration files instead and Ben stated that copying could be a problem if you override the config files.&lt;br /&gt;Here then is my thoughts on how to keep external xml files to describe application specific settings, e.g. production vs test vs datasource names, timeouts, etc.&lt;br /&gt;Nothing new here right? But the goal is to be able to keep the configuration files without a headache and conflicts.&lt;br /&gt;Lets take a sample set of parameters in a file like so:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;wddxPacket version&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'1.0'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;header&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;data&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;struct&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'REQUESTERRORHANDLER'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;RequestErr.cfm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'VALIDATIONERRORHANDLER'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;ValidationErr.cfm&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'EnableErrorHandlers'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;No&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'DEBUG'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;No&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'ADMINEMAIL'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;change_please@mycompany.com&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'DATASOURCE'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;APPDS&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;'APPLICATIONNAME'&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;StandardName&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;string&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;struct&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;data&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;wddxPacket&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The trick here is to be able to have a system which allows you to keep different configuration files without fear of overwriting them; and, even if you do copy over them by accident (or even if you have many different ones), the system will be smart enough to pick the correct one.&lt;br /&gt;&lt;br /&gt;My implementation (Application.cfc) for this looks like this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfcomponent&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfscript&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;//start off by reading config file, read contents into this.stcConfig&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  initConfig();&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;//set application options from config file&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  this.Name=this.stcConfig.ApplicationName;&lt;br /&gt;  this.SessionManagement=&lt;/span&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"Yes"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;; &lt;br /&gt;  this.SessionTimeout=this.ConfigTimeout;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;//other application parameters can be set&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfscript&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"onApplicationStart"&lt;/span&gt; output&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"No"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- no need to lock app scope variables in this function unless called from&lt;br /&gt;     another function  ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;   &lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- now make the config file data available to the application scope (bsoylu 03-17-2010) ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset Application&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;stcConfig &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;stcConfig&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset Application&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ConfigFile &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ConfigFile&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- we are setting some dynamic Error Handlers ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif IsDefined&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"this.stcConfig.EnableErrorHandlers"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; and this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;stcconfig&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;EnableErrorHandlers&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cferror type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"REQUEST"&lt;/span&gt; template&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#this.stcConfig.REQUESTERRORHANDLER#"&lt;/span&gt; mailto&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#this.stcConfig.AdminEMail#"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;         &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cferror type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"VALIDATION"&lt;/span&gt; template&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#this.stcConfig.VALIDATIONERRORHANDLER#"&lt;/span&gt; mailto&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#this.stcConfig.AdminEMail#"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt; &lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- do other stuff now ...---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"OnRequestStart"&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfargument name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"CallPage"&lt;/span&gt; type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"string"&lt;/span&gt; hint&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"This is the page the user is calling. This argument is populated by CF automatically."&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- do your request work ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"OnRequestEnd"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- finish up your request code goes here ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt; &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"getIP"&lt;/span&gt; returntype&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"string"&lt;/span&gt; access&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"private"&lt;/span&gt; hint&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"return server main IP address"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfscript&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;//get Inet Address type object from JVM&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;   var objInetAddr = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"java.net.InetAddress"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).getLocalHost();&lt;br /&gt;   return objInetAddr.getHostAddress();&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfscript&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"initConfig"&lt;/span&gt; access&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"private"&lt;/span&gt; output&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Yes"&lt;/span&gt; hint&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"load config file"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cftry&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;    &lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- first check for server specific config file config.XXX.XXX.XXX.XXX.xml, e.g. config.196.18.12.78.xml ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset strConfigFile &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; getDirectoryFromPath&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;getCurrentTemplatePath&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:purple;"&gt;"config.#getIP()#.xml"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif not FileExists&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;strConfigFile&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- fall back to global config file ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset strConfigFile &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; getDirectoryFromPath&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;getCurrentTemplatePath&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; &lt;span style="font-size:78%;color:blue;"&gt;&amp;amp;&lt;/span&gt; &lt;span style="color:purple;"&gt;"config.xml"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;  &lt;br /&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif FileExists&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;strConfigFile&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cffile action&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"READ"&lt;/span&gt; file&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#strConfigFile#"&lt;/span&gt; variable&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"strConfigWDDX"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif iswddx&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;strConfigWDDX&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfwddx action&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"WDDX2CFML"&lt;/span&gt; &lt;span style="color:red;"&gt;&lt;b&gt;input&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"#Trim(strConfigWDDX)#"&lt;/span&gt; output&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"this.stcConfig"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- save the config file that we use ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;   &lt;br /&gt;              &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ConfigFile &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; strConfigFile&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;    &lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfelse&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;                    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfthrow type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"INIT"&lt;/span&gt; detail&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Incorrect Configuration File. No WDDX detected."&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfelse&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;                &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfthrow type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"INIT"&lt;/span&gt; detail&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Missing Configuration File. No global or server [#getIP()#] specific configuration file found."&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;            &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;                   &lt;br /&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- prepare timeouts ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif IsDefined&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"this.stcConfig.SessionTimeOutMinutes"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; and Val&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;stcConfig&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;SessionTimeOutMinutes&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt; GT &lt;span style="color:brown;"&gt;0&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ConfigTimeout &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; CreateTimeSpan&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:brown;"&gt;0&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;0&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;Val&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;stcConfig&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;SessionTimeOutMinutes&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:brown;"&gt;0&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfelse&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset this&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;ConfigTimeout &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; CreateTimeSpan&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:brown;"&gt;0&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;0&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:brown;"&gt;20&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;0&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfcatch type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Any"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;#cfcatch.detail#&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfoutput&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;   &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfabort&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;      &lt;br /&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfcatch&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt;     &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cftry&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfcomponent&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;The idea here that the Application.cfc selectivly loads configuration files. It looks for a server specific configuration file, e.g. config.10.10.1.100.xml , then a global configuration file, e.g. config.xml.&lt;br /&gt;Allmost all of the important work occurs in the initConfig() function. It determines the machine's IP address then alternatly looks for a machine specific configuration file, followed by a global configuration file. If neither can be found, we throw an error.&lt;br /&gt;&lt;br /&gt;Thus, even if I copied my development server's configuration file by accident to the production server it would not be of consequence for the production server. I am of course subject to the normal human errors. If I delete all configuration files I am hosed anyway etc.&lt;br /&gt;&lt;br /&gt;Try it out and let me know if this helps.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1953750045436401589?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1953750045436401589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1953750045436401589' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1953750045436401589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1953750045436401589'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/03/cf-dynamically-changing-applicationcfc.html' title='CF: Dynamically changing Application.cfc using server specific configuration files'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-9141155302683135517</id><published>2010-01-28T14:04:00.004-05:00</published><updated>2010-01-28T14:24:19.298-05:00</updated><title type='text'>CF: Flex: PGP Implementation for ColdFusion</title><content type='html'>&lt;a href="http://en.wikipedia.org/wiki/Pretty_Good_Privacy" target="_blank"&gt;Pretty Good Privacy (PGP)&lt;/a&gt; is a computer program that provides cryptographic privacy and authentication. &lt;br /&gt;PGP is often used for signing, encrypting and decrypting e-mails to increase the security of e-mail communications. It was created by Philip Zimmermann in 1991.&lt;br /&gt;&lt;br /&gt;The use of PGP in file exchanges has increased over the years and has become a common way of securing file contents. Thus, encountering this in more and varied projects is not unusual. &lt;br /&gt;&lt;br /&gt;There are several implementations for popular platforms such as Java and .net; I classified them into brought camps of heavy commercial, or hard to use open source; thus the availability of easy to&lt;br /&gt;implement PGP solutions for ColdFusions is limited. In particular, I found existing implementation rather difficult to use.&lt;br /&gt;Thus, I embarked on this project. To make a long story short, I ended up using the underlying work of the&lt;br /&gt;&lt;a href="http://www.bouncycastle.org" target="_blank"&gt;league of bouncy castle&lt;/a&gt; folks. The complete source code for those libraries can be downloaded from there. &lt;br /&gt;&lt;br /&gt;I implemented the most common scenarios (generate keys or key rings, encrypt and decrypt) and exposed all this through a ColdFusion component to the world. Thus the effort to use of PGP is reduced to one liners of code (which I like).&lt;br /&gt;&lt;br /&gt;Along the same lines, if you use Flex and needed a library to encrypt/decrypt this implementation can easily used as backend for that kind of scenario. A few tweaks to the main component should allow you to call on all the functions, read, write, generate keys etc.&lt;br /&gt;&lt;br /&gt;Of course, there is so much more that can be done with PGP. Time permitting I may expand this implementation to expose other functionality.&lt;br /&gt;&lt;br /&gt;You can download this from RIAForge (&lt;a href="http://pgp.riaforge.com" target="_blank"&gt;pgp.riaforge.com&lt;/a&gt;).&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-9141155302683135517?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/9141155302683135517/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=9141155302683135517' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9141155302683135517'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/9141155302683135517'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/01/cf-flex-pgp-implementation-for.html' title='CF: Flex: PGP Implementation for ColdFusion'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2647603615154281940</id><published>2010-01-07T14:38:00.007-05:00</published><updated>2010-01-10T09:27:45.174-05:00</updated><title type='text'>CF: Connecting ColdFusion to Microsoft Azure SQL</title><content type='html'>I am impressed by what Microsoft has been able to create with the Azure platform. The more I play with it the more I like it. What impresses me most is how simple it is to get going (I am comparing with Amazon). The big caveat here is that you use MS technologies. If so, Azure should be on the short list for evaluation.&lt;br /&gt;However, and, here I go again reversing myself, if you want to connect a ColdFusion front end to a Microsoft Azure SQL back end, things are a little more quirky. Please don't ask why you would do such a thing, just stay with me in that it is highly cool ;o)&lt;br /&gt;&lt;br /&gt;First, you should evaluate whether your application will give to this kind of setup. On the ColdFusion side you should have good control on the amount of data you exchange with the database(pagination and other techniques); you also should have some tolerance for higher latency; there is delay in the round trip to get data from Microsoft etc. &lt;br /&gt;&lt;br /&gt;Of course the usual evaluation of whether you are ok with hosting data in the cloud should take place. But on the other hand, taking this for a spin is easy enough.&lt;br /&gt;&lt;br /&gt;In my setup I am hosting the CF server on my laptop and MS is supplying the database.&lt;br /&gt;&lt;br /&gt;1) Learn about Azure: &lt;a href="http://www.microsoft.com/windowsazure/getstarted/" target="_blank"&gt;Learn about Azure things&lt;/a&gt; and then &lt;a href="http://www.microsoft.com/windowsazure/developers/sqlazure/" target="_blank"&gt;Create Account&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;2) Create your first database instance online using your browser&lt;br /&gt;&lt;br /&gt;3) Get your tools. You do not need to download the Visual Studio or other SDKs to work with SQL Azure, but you will need to use the &lt;a href="http://www.microsoft.com/sqlserver/2008/en/us/R2Downloads.aspx?pf=true" target="_blank"&gt;SQL Server 2008 R2 Management tools&lt;/a&gt;. Currently only available as CTP edition.&lt;br /&gt;&lt;br /&gt;4) Optional: Migrate some data. For me, using the &lt;a href="http://msdn.microsoft.com/en-us/library/ee621790.aspx" target="_blank"&gt;script wizard&lt;/a&gt; in the Management Studio worked the best. You can switch it to produce SQL Azure specific scripts, but you still have to tweak them. Your primary keys have to be clustered when creating tables.&lt;br /&gt;e.g.:&lt;br /&gt;&lt;br /&gt;CREATE TABLE [dbo].[TestTable](&lt;br /&gt; [Test_ID] [int] NOT NULL,&lt;br /&gt; [TestName] [nvarchar](50) NOT NULL,&lt;br /&gt; [TimeZoneOffsetHours] [smallint] NULL,&lt;br /&gt; [TimeZoneOffsetMins] [smallint] NULL,&lt;br /&gt; CONSTRAINT [PK_TestTable] &lt;span style="font-weight:bold;"&gt;PRIMARY KEY CLUSTERED&lt;/span&gt; (&lt;br /&gt; [Test_ID] ASC&lt;br /&gt;)WITH (STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5) Once you have some data we start with the ColdFusion parts. I have not been able to use the Adobe supplied drivers. I had to download the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=99B21B65-E98F-4A61-B811-19912601FDC9&amp;displaylang=en" target="_blank"&gt;Microsoft JDBC 2.0 drivers&lt;/a&gt;. When you extract the jdbc drivers there are two .jar files. For CF you will need to use [sqljdbc4.jar]. Copy this driver into [cfroot]\lib folder.&lt;br /&gt;&lt;br /&gt;6) Restart ColdFusion&lt;br /&gt;&lt;br /&gt;7) Configuring your Data Source in the ColdFusion administrator. Here it gets a little complicated. You need to create a data source of type "other". Also, you cannot use the connect strings that are supplied by MS directly, though pieces are useful. The current stance is that Microsoft does not support JDBC connection but if you can work it they are fine with it. To make it simple I am attaching an image: (please note the way in which we have to set the User name)(replace myID with the database User ID and myServer with your server name from Azure):&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Qsm4KVMryjM/S0ZA0QGYhDI/AAAAAAAAAA8/bO8hlMuSMlw/s1600-h/AzurePic.GIF"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 292px;" src="http://2.bp.blogspot.com/_Qsm4KVMryjM/S0ZA0QGYhDI/AAAAAAAAAA8/bO8hlMuSMlw/s400/AzurePic.GIF" border="0" alt=""id="BLOGGER_PHOTO_ID_5424094067633456178" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;8) Configure your connection settings. The Azure platform will drop your connection frequently. So maintaining connection is not really an option. This is what worked best for me to make it appear as if we had no connection issues.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_Qsm4KVMryjM/S0ZBAxWfdII/AAAAAAAAABE/JNi9GiayMRQ/s1600-h/AzureConnectionSettings.GIF"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 71px;" src="http://3.bp.blogspot.com/_Qsm4KVMryjM/S0ZBAxWfdII/AAAAAAAAABE/JNi9GiayMRQ/s400/AzureConnectionSettings.GIF" border="0" alt=""id="BLOGGER_PHOTO_ID_5424094282717820034" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Ok, hopefully this all worked out for you and you can take this for a spin.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2647603615154281940?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2647603615154281940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2647603615154281940' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2647603615154281940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2647603615154281940'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2010/01/cf-connecting-coldfusion-to-microsoft.html' title='CF: Connecting ColdFusion to Microsoft Azure SQL'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_Qsm4KVMryjM/S0ZA0QGYhDI/AAAAAAAAAA8/bO8hlMuSMlw/s72-c/AzurePic.GIF' height='72' width='72'/><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6762455280814137450</id><published>2009-12-24T15:31:00.012-05:00</published><updated>2009-12-24T16:15:08.507-05:00</updated><title type='text'>CF: Parsing Complex Fixed (Flat) Files</title><content type='html'>Despite many years of XML, the use of simple and complex flat files as a means of exchanging information between systems is still fairly common.&lt;br /&gt;Parsing simple, tabular, flat files like the one below does not really pose a large challenge as either the OS (Text Drivers) or CF (CFHTTP) have tools to read them in without much fanfare.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 1: Tabular Fixed File&lt;/em&gt;&lt;br /&gt;&lt;a href="http://1.bp.blogspot.com/_Qsm4KVMryjM/SzPVTfmyjXI/AAAAAAAAAAk/Wv0dOA9robQ/s1600-h/image002.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 76px;" src="http://1.bp.blogspot.com/_Qsm4KVMryjM/SzPVTfmyjXI/AAAAAAAAAAk/Wv0dOA9robQ/s400/image002.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5418909307535265138" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;However, many times over, the examples are not as simple. The data on each row may be different; relationships may exist between lines of data etc.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 2: Complex Fixed File&lt;/em&gt;&lt;br /&gt;&lt;a href="http://4.bp.blogspot.com/_Qsm4KVMryjM/SzPV5_InyPI/AAAAAAAAAAs/dfoH5a2BICc/s1600-h/image003.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 95px;" src="http://4.bp.blogspot.com/_Qsm4KVMryjM/SzPV5_InyPI/AAAAAAAAAAs/dfoH5a2BICc/s400/image003.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5418909968833693938" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For the complex files we normally write specialized parsers or transformations. Certainly a whole industry exists that deals with Extract Transform Load processes. Either choose requires considerable programming efforts. &lt;br /&gt;After writing a parser for the umpteens fixed file that someone wanted to have loaded, I thought there needs to be a better way. The short of all this is that I created a more generic component to deal with this in native ColdFusion. The solution was to split up the code and the file definition. &lt;br /&gt;&lt;br /&gt;Thus, in order to parse complex files, you provide an XML definition file which describes the flat file. Then call the component to do the heavy lifting.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Example 3: Flat File Definition XML&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://2.bp.blogspot.com/_Qsm4KVMryjM/SzPXOq4mBZI/AAAAAAAAAA0/Z-466ifOhZw/s1600-h/image005.gif"&gt;&lt;img style="display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 117px;" src="http://2.bp.blogspot.com/_Qsm4KVMryjM/SzPXOq4mBZI/AAAAAAAAAA0/Z-466ifOhZw/s400/image005.gif" border="0" alt=""id="BLOGGER_PHOTO_ID_5418911423686641042" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The outcome of such processing are standard ColdFusion objects that are easier to deal with and require less programmatic effort to implement.&lt;br /&gt;&lt;br /&gt;I posted this project on RIAForge (&lt;a href="http://fixedfilereader.riaforge.org/"&gt;FixedFileReader&lt;/a&gt;). It contains examples for different scenarios of varying complexity. I added skeletons for EDI X.12 and VCF4 formats.&lt;br /&gt;&lt;br /&gt;May not work for all, but if it does, it is likely that it will save a lot of time.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6762455280814137450?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6762455280814137450/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6762455280814137450' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6762455280814137450'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6762455280814137450'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/12/cf-parsing-complex-fixed-flat-files.html' title='CF: Parsing Complex Fixed (Flat) Files'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Qsm4KVMryjM/SzPVTfmyjXI/AAAAAAAAAAk/Wv0dOA9robQ/s72-c/image002.gif' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1342230211114781315</id><published>2009-11-18T09:58:00.006-05:00</published><updated>2009-11-18T11:29:14.134-05:00</updated><title type='text'>CF: Controlling Time Based Runtime Exceptions</title><content type='html'>Ultimately time controls everything. This is true in larger scheme of things but as well in writing and running ColdFusion code. Fortunately, many CF tags have built in time controls in forms of exceptions that can be thrown when a pre-specified time has been exceeded. Most tags implement this through a &lt;em&gt;timeout&lt;/em&gt; attribute.&lt;br /&gt;&lt;br /&gt;You, then, use a CFTRY/CFCATCH combination to handle timeout occurrences, e.g. a web page failed to respond, or FTP didn't connect, etc.&lt;br /&gt;&lt;br /&gt;However, this system breaks down if your intent is control multiple tags in combination, e.g. a combination of CFHTTP and CFFTP may take up to 30 seconds though individually CFHTTP or CFFTP may consume a variable amount of time.&lt;br /&gt;&lt;br /&gt;Similarly, you are running a multitude of small steps in a loop, e.g. loading 1000 records, or displaying 500 lines. Though each line will only take a fraction of a second to process the number of lines in aggregate will blow you out of the water.&lt;br /&gt;&lt;br /&gt;Normally in these cases we would wait on an overall page time out if we had one, then produce a generic catch all message saying your page has timed out and good luck trying this again.&lt;br /&gt;&lt;br /&gt;This may suffice generically speaking, but may prove to be frustrating for users and visitors of your apps and sites.&lt;br /&gt;&lt;br /&gt;What if you could instead be more pro-active. What if you could predict how long your processing is going to take, even on shared servers with varying loads?&lt;br /&gt;What if you could give users options to either proceed, adjust your number of iterations, or simply stop early because you will never finish the task at hand in the time given.&lt;br /&gt;&lt;br /&gt;Ideally your code would be very compact:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- check prediction  ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif objTC&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;WillTimeout&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- we will timeout lets do something about it ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt; ...&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Conceptually speaking this could have been done for a long time in CF, but practically I have seen few implementations.&lt;br /&gt;&lt;br /&gt;Let's look at what it would take to make this prediction using a scenario in which we have a repetitive core process that we need to time. Thus, it would be all about the ability to measure time for each loop. Thus we would&lt;br /&gt;a) need to start a timer, e.g. GetTickCount()&lt;br /&gt;b) end the timer, e.g. another GetTickCount()&lt;br /&gt;c) measure the difference between start and end time&lt;br /&gt;d) use the remaining iterations to come up with how much more time we need&lt;br /&gt;&lt;br /&gt;Simple, right? Indeed it is. But the downfall is that it doesn't work.&lt;br /&gt;The system breaks down because of the high variability in practice between each iteration of the loop. Using the built in CF function GetTickCount() we could establish a start and end time. But, when we measure the execution time between the two tick counts the results in this realm change quite a bit.&lt;br /&gt;&lt;br /&gt;So, will we have to implement something complex using Java JETM instead to get this working? You probably could, but it isn't necessary if we add a dose of statistics to the whole puzzle. Here is a modified approach:&lt;br /&gt;a) establish statistical validity threshold in number of iterations (e.g. how many time do I need to have gone through the loop to have a valid sample)&lt;br /&gt;b) still need to start a timer, e.g. GetTickCount()&lt;br /&gt;c) end the timer, e.g. another GetTickCount()&lt;br /&gt;d) measure the difference between start and end time&lt;br /&gt;e) update your statistics&lt;br /&gt;f) if validity threshold has been reached make prediction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This does seem to work a lot better but requires many more lines of code. Rather than put all of these lines of code into each template, I have abstracted the needed calls into a component.&lt;br /&gt;&lt;br /&gt;I would initialize the component (objTC) with the number of iterations (number of times I would need to go through the loop) and how many times I will need to have completed the loop to get a valid time prediction. In my example this would be 1000000 iterations with 150 completions. Or, something like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset objTC &lt;span style="font-size:+1;color:blue;"&gt;=&lt;/span&gt; CreateObject&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"component"&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"TimeControl"&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;init&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:brown;"&gt;1000000&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;,&lt;/b&gt;&lt;/span&gt;150&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Then within the loop I would start and end the main timer like so:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- start measuring  ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset objTC&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;start&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;End Measuring:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- end measuring  ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset objTC&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;end&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now that the component takes care of all the nasty statistics stuff I can keep my main code simple and have some functions to use to either provide feedback to user, or just check on the status of things.&lt;br /&gt;E.g. I could provide feedback like so:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif objTC&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;HasValidAverage&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- send the expected time to user&lt;br /&gt;       when this process will complete  ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;   &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt;  Expected completion at #objTC.getFinishTime()#&lt;br /&gt;   or (#objTC.getFinishSeconds()#seconds) &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:red;"&gt;&lt;b&gt;br&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;/&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;/&lt;/span&gt;cfoutput&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfflush&lt;span style="font-size:+1;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This is just a sample on how to handle it. I have put several more functions in the examlpe to play with. It may work well for some of your scenarios or not all. In any case, I do believe an improved feedback to user and more predictive code behavior based on execution time will reflect well on you as programmer. So feel free to play with samples and see whether this can get you started.&lt;br /&gt;&lt;br /&gt;The full sample code can be &lt;a href="http://www.boncode.net/downloads/Time.zip"&gt;downloaded here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1342230211114781315?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1342230211114781315/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1342230211114781315' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1342230211114781315'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1342230211114781315'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/11/cf-controlling-time-based-runtime.html' title='CF: Controlling Time Based Runtime Exceptions'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6019866469790334798</id><published>2009-11-14T17:49:00.006-05:00</published><updated>2009-11-14T22:07:23.456-05:00</updated><title type='text'>CF: Meetup presentation about debugging materials (Nov 12, 2009)</title><content type='html'>Thanks again to everyone attending the presentation. The goal was to get an idea about debug space and think about attacking debug problems by first identifying what area they originate from. Hope this gave everyone to use.&lt;br /&gt;&lt;br /&gt;Also we discussed with special focus on time based debugging from the performance perspective as well as from the perspective of handling time based exceptions predictevly. &lt;br /&gt;&lt;br /&gt;Dowload &lt;a href="http://www.boncode.net/downloads/CFMeetup.zip"&gt;presentation and code&lt;/a&gt; now.&lt;br /&gt;&lt;br /&gt;Several questions regarding the use of CFDUMP came up and here are couple of links to deeper treatment of advanced CDFDUMP tag in CF9. Additinal attributes can be specified to tweak its behavior:&lt;br /&gt;&lt;br /&gt;&lt;a href="http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7ef7.html"&gt;CFDUMP in CF9&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Cheers&lt;br /&gt;-Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6019866469790334798?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6019866469790334798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6019866469790334798' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6019866469790334798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6019866469790334798'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/11/cf-meetup-presentation-about-debugging.html' title='CF: Meetup presentation about debugging materials (Nov 12, 2009)'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7988544997407975085</id><published>2009-10-21T13:28:00.005-04:00</published><updated>2009-10-21T13:44:50.462-04:00</updated><title type='text'>CF: CFinNC presentations</title><content type='html'>Hallo everyone. First thanks for attending my sessions. If you did not attend and wanted to take a peak at what we covered please feel free to review the slides. Of course more fun was had during the sessions ;o)&lt;br /&gt;&lt;br /&gt;Download &lt;a href="http://www.boncode.net/downloads/CFinNC_Beginner.zip"&gt;Beginning Debugging Session&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Download &lt;a href="http://www.boncode.net/downloads/CFinNC_Advanced.zip"&gt;Advanced Debugging Session&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;I have inlcluded more slides and examples than we covered hoping that they can be usefull as well. All my material are distributed under &lt;a href="http://creativecommons.org/licenses/by/3.0/" target="_blank"&gt;creative commons license&lt;/a&gt;. Feel free to contact me with questions or comments.&lt;br /&gt;&lt;br /&gt;Generally, this conference showed that the spirit of CF is alive and well. It was an all volunteer event from the organization to the speakers and all the things in between. It introduced old and new people to CF and furthered networking in this Region. I hope we can make this an annual event.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7988544997407975085?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7988544997407975085/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7988544997407975085' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7988544997407975085'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7988544997407975085'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/10/cf-cfinnc-presentations.html' title='CF: CFinNC presentations'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-5854878075583794992</id><published>2009-10-13T21:59:00.003-04:00</published><updated>2009-10-13T22:04:39.131-04:00</updated><title type='text'>CF: CFinNC is all about debugging for me</title><content type='html'>My presentations for CFinNC will be all about debugging. There is a lot to talk about crunched into two 50 minutes segments.&lt;br /&gt;Debugging is the often hated but yet nonetheless very important part of the developer's life fraught with lots of frustration and brief moments of glorious joy when the culprits are found. I am trying to give both the beginner and advanced audiences multiple techniques and tools to make the shining moments more frequent and frustrating times less so.&lt;br /&gt;&lt;br /&gt;Here is my official description about the overall presentations:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Debugging can be a very frustrating exercise. Many times we find ourselves spending three times as long as it took us to develop the code to debug it. Especially code written by other developers seems time consuming to debug ;o)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;Understanding the debugging infrastructure will shortcut much of the confusion and help to quickly focus on the source of the problem. What can you do when &lt;cfdump&gt; has reached is limits? We will talk about techniques, tools, and tips available to the ColdFusion Developer to make this a "less" frustrating exercise.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope to see you there,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-5854878075583794992?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/5854878075583794992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=5854878075583794992' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5854878075583794992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5854878075583794992'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/10/cf-cfinnc-is-all-about-debugging-for-me.html' title='CF: CFinNC is all about debugging for me'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-8917085035630693174</id><published>2009-09-24T11:23:00.006-04:00</published><updated>2009-10-10T10:05:58.193-04:00</updated><title type='text'>General: Ordering from Adobe and how not to sell.</title><content type='html'>So during the CFUnited conference Adobe and organizers offered a special deal on ColdFusion to the attendees. I thought that this was a highly cool deal. Adobe supporting the very people that promote them every day.&lt;br /&gt;I quickly chatted up the Adobe people at the conference on how to accomplish this as I did have a project requiring deployment of 23 CF servers. They all were consistent, which is good; I need to talk to the Eastern Sales Rep (Dominick Conte) whom I could not find in person or in attendance anywhere, which is bad, but whose business cards where everywhere ;o)&lt;br /&gt;So, upon my return, I happily attempted to call Dominick. Different times, different dates; only voice mail answering. I thought the guy must be selling this stuff like hot-cakes as he never is available via phone; so I gave up and send an email to ask how one orders these hot deals offered by Adobe on the show.&lt;br /&gt;His initial response was that I was not really at the show. Interesting, approach; made me doubt my very existence for about a little less than 0.1 ms... ahhh... deep thoughts. Of course, I advised him how he can find out who attended and then was waiting for some sort of contact.&lt;br /&gt;Alas, again, no-go.&lt;br /&gt;I am now paraphrasing the emails that went back and forth thereafter:&lt;br /&gt;&lt;br /&gt;Me:&lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt; "hey wassup", "why you not talk to me?", and "how can I order your good stuff?" and "why is it so difficult to talk to you guys?".&lt;/span&gt;&lt;br /&gt;Dom: &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;"Yeah, I tried to talk to you"&lt;/span&gt; (I checked and no such phone logs), and &lt;span class="Apple-style-span"  style="font-family:'courier new';"&gt;" what the h..k do you want anyways?"&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is not going well I think, as I am very consitently asking this man who is in sales on how to place an order (partners, direct or what?). So, he finaly caves and shoots back an email that he is not really the dude to talk to and the only way I can get this offer is to talk to a company in Canada.&lt;br /&gt;&lt;br /&gt;WTH?&lt;br /&gt;&lt;br /&gt;This is considered easy to do business with? Wow!&lt;br /&gt;I dowloaded and deployed instances of Railo Server instead.&lt;br /&gt;&lt;br /&gt;Adobe, get your sales house in order. You are not customer friendly !&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Addendum:&lt;br /&gt;We finally did end up buying some licenses for different projects from Adobe through the reseller in Canada. The credit for this goes entirely to Adam Lehman who could get me a contact name for ordering.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;B.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-8917085035630693174?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/8917085035630693174/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=8917085035630693174' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8917085035630693174'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8917085035630693174'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/09/general-ordering-from-adobe-and-how-not.html' title='General: Ordering from Adobe and how not to sell.'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2034278960995240757</id><published>2009-09-02T10:35:00.004-04:00</published><updated>2009-09-02T10:44:36.493-04:00</updated><title type='text'>CF: CfinNC North Carolina ColdFusion / Flex / Air Conference - Oct 17-18, 2009</title><content type='html'>I will be presenting at the CFinNC conference this October. I will share some insight into working with SOLR, the search engine based on Apache Lucene as well as talk about debugging tips and tricks. If you have some insight you would like to share feel free to leave a comment.&lt;br /&gt;&lt;br /&gt;&lt;a title="CFinNC - Carolina ColdFusion / Flex / Air Conference - Oct 17-18, 2009" href="http://cfinnc.com/"&gt;&lt;img border="0" alt="CFinNC - Carolina ColdFusion / Flex / Air Conference - Oct 17-18, 2009" src="http://cfinnc.com/2009/cfinnc-125x125-presenter-3.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;u&gt;Here are the details on the conference:&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="http://cfinnc09.eventbrite.com/"&gt;Registration&lt;/a&gt; &lt;http:&gt;for CFinNC is now open! CFinNC is a free web development conference held in Raleigh, North Carolina during the weekend of October 17th and 18th with an International line-up of speakers presenting on timely and relevant topics on web development. Thanks to the generosity of our sponsors and the creativity of the planning committee, registration for the event will be free and includes entry to the weekend event and to all presentations.&lt;br /&gt;&lt;br /&gt;In order to keep the event free we have removed some hard costs and some benefits you normally get from paid-registration events.&lt;br /&gt;&lt;br /&gt;Please be aware of the following:&lt;br /&gt;&lt;br /&gt;1) You are responsible for paying for lunch for both days. We have enlisted the services of a local caterer and will be providing lunch each day for $10/day. This includes a sandwich, chips and drink. Please bring cash the day of the event! We will not be able to process credit cards!&lt;br /&gt;&lt;br /&gt;2) Limited Edition, Collectible CFinNC conference t-shirts will be available for purchase for $15 with any proceeds going to offset costs and possibly sponsor a planning committee dinner (if we sell them all).&lt;br /&gt;&lt;br /&gt;Lunch and shirt purchase is completely optional. You may indicate if you would like to purchase lunch and/or a t-shirt on the &lt;a href="http://cfinnc09.eventbrite.com/"&gt;registration &lt;http:&gt;form&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;For more information, please check the CFinNC website at: &lt;a href="http://www.cfinnc.com/"&gt;http://www.cfinnc.com&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-Cheers,&lt;br /&gt;Bilal&lt;http:&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2034278960995240757?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2034278960995240757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2034278960995240757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2034278960995240757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2034278960995240757'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/09/cf-cfinnc-north-carolina-coldfusion.html' title='CF: CfinNC North Carolina ColdFusion / Flex / Air Conference - Oct 17-18, 2009'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-2123531028503926165</id><published>2009-08-19T14:22:00.002-04:00</published><updated>2009-08-19T14:35:24.279-04:00</updated><title type='text'>CF: Adobe publishes hot fixes for ColdFusion</title><content type='html'>On August 17, 2009 Adobe published a number of &lt;a href="http://www.adobe.com/support/security/bulletins/apsb09-12.html"&gt;security updates&lt;/a&gt; to numerous versions of ColdFusion. This has led to some scrambling to test these issues, get them patched etc.&lt;br /&gt;So far the hotfixes did not appear to break anything but the packaging is lacking as many manual steps will have to be completed.&lt;br /&gt;I could not quite understand why these hotfixes could not have been bundled together as one fix that can be applied.&lt;br /&gt;To make our lives easier I have built an &lt;a href="http://boncode.net/downloads/CF801August2009Hotfixes.zip"&gt;installer&lt;/a&gt; for ColdFusion 8.0.1 running on Windows systems to do just that. You are free to use it at your own risk.&lt;br /&gt;&lt;br /&gt;The installer will update standalone installation of CF not J2EE/JEE installations.&lt;br /&gt;&lt;br /&gt;Thus the following hot fixes will be applied:&lt;br /&gt;CVE-2009-1872, CVE-2009-1875, CVE-2009-1876, CVE-2009-1877, CVE-2009-1878&lt;br /&gt;&lt;br /&gt;These JRUN only updates will not:&lt;br /&gt;CVE-2009-1873, CVE-2009-1874&lt;br /&gt;&lt;br /&gt;Cheers,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-2123531028503926165?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/2123531028503926165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=2123531028503926165' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2123531028503926165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/2123531028503926165'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/08/cf-adobe-publishes-hot-fixes-for.html' title='CF: Adobe publishes hot fixes for ColdFusion'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3353134674968456947</id><published>2009-08-19T14:12:00.002-04:00</published><updated>2009-08-19T14:21:58.286-04:00</updated><title type='text'>Impressions from CFUnited, August 12 through 15, 2009</title><content type='html'>Many people in the middle of a Golf course. Learned new stuff, rehashed old stuff.  The greats of ColdFusion held court, and Flex was the up and comer with attitude.&lt;br /&gt;The good:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Open source coldfusion is engaged and attempting to move things forward. Adobe is cooperating for now. Railo was there and willing; OpenBD was there in spirit.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;ColdFusion builder is here despite the CFEclipse and we can expect more opinions on why one is better than the other. Adobe did not want to play in this open source game.&lt;/li&gt;&lt;li&gt;ColdFusion 9 will have some expanded licensing options to make it easier to host things in the cloud.&lt;/li&gt;&lt;li&gt;ColdFusion has gained some momentum but still overall a nishe.&lt;/li&gt;&lt;li&gt;The food was pretty good.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;The Bad:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Presenters could focus more on content and less on opinion.&lt;/li&gt;&lt;li&gt;Some are born to present; others not so.&lt;/li&gt;&lt;li&gt;ColdFusion is still niche and we need to not get so high on ourselves.&lt;/li&gt;&lt;li&gt;Flex purist insistance that they do not need to know anything about CF.&lt;/li&gt;&lt;li&gt;No CFUnited backpacks for the masses. What is up with that?&lt;br /&gt;&lt;/li&gt;&lt;li&gt;One hour barely covers anything technical well. More multi-hour tracks digging into topics would be helpfull for people seeking pure technology how to.&lt;/li&gt;&lt;/ul&gt;There is probably more that I missed but there you have it.&lt;br /&gt;&lt;br /&gt;Cheers&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3353134674968456947?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3353134674968456947/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3353134674968456947' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3353134674968456947'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3353134674968456947'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/08/impressions-from-cfunited-august-12.html' title='Impressions from CFUnited, August 12 through 15, 2009'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7424211614256631269</id><published>2009-07-29T08:30:00.004-04:00</published><updated>2009-07-29T08:52:33.961-04:00</updated><title type='text'>CF: ColdFusion Serialization via Java API</title><content type='html'>This is a topic that has found many posts. Here is my spin ;o) Most of the posts focus on the success of serializing ColdFusion components. Though cool, many ask the same question: Why do this?&lt;br /&gt;Also to note is that ColdFusion has supported a mechanism to serialize complex data via WDDX for a long time (I believe since version 4).&lt;br /&gt;However, in my case, the need was not for serialization components but rather for compact serialization. In other words, use as little space (bytes/data) as possible. In addition, I needed to easily save and retrieve this information from a database in a text based format. Oh, yes, and handle complex data objects such as structures and arrays.&lt;br /&gt;WDDX, though usable, is very verbose and thus was out. Looking at the Java API and reading through posts I translated this, in the end, to two functions fSerialize and fDeserialize. You will need ColdFusion 8.0.1 or higher to make this work.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The fSerialize function:&lt;/span&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fSerialize"&lt;/span&gt; access&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"public"&lt;/span&gt; returntype&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"string"&lt;/span&gt;&lt;br /&gt; hint&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"uses java byte streams and Base64 encoding to serialize CF objects, this can be used instead of WDDX tag CFML2WDDX"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfargument name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"input"&lt;/span&gt; type&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"any"&lt;/span&gt; required&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Yes"&lt;/span&gt; hint&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"the CF object to be serialized"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfscript&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;  var objByteStream = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java.io.ByteArrayOutputStream"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).init();&lt;br /&gt;  var objOutStream = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java.io.ObjectOutputStream"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).init(objByteStream);&lt;br /&gt;  var objSerialized =&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;""&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:GREEN;"&gt;&lt;i&gt;//turn CF object in argument to out stream&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  objOutStream.writeObject(Arguments.input);&lt;br /&gt;  objOutStream.close();&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:GREEN;"&gt;&lt;i&gt;//take outstream and make bytearray&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  objSerialized = objByteStream.toByteArray();&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:GREEN;"&gt;&lt;i&gt;//encoded it and return&lt;br /&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  return BinaryEncode(objSerialized,&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Base64"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;);&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cfscript&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cffunction&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;fDeserialize function:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fDeserialize"&lt;/span&gt; access&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"public"&lt;/span&gt; returntype&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"any"&lt;/span&gt;&lt;br /&gt; hint&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"uses Base64 encoded Java Byte Array and turns to CF object. This can be used instead of WDDX WDDX2CFML"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfargument name&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Input"&lt;/span&gt; type&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"string"&lt;/span&gt; required&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Yes"&lt;/span&gt; hint&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"the Base64 encoded ByteArray that used to be a CF object to be deserialized"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfscript&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;  var objSerialized =BinaryDecode(Arguments.input,&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Base64"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;);&lt;br /&gt;  var inByteStream = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java.io.ByteArrayInputStream"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).init(objSerialized);&lt;br /&gt;  var objInStream = createObject(&lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"java.io.ObjectInputStream"&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;).init(inByteStream);&lt;br /&gt;  var objCF = objInStream.readObject();&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:GREEN;"&gt;&lt;i&gt;//return the read object&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  return objCF;  &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cfscript&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cffunction&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;These function on average were using 50% of the storage that a comparable serialized WDDX object would, so they achieved their objective for me. They will work on small components (cfc) but I have not tried to serialize very complex cfcs.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;-Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7424211614256631269?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7424211614256631269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7424211614256631269' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7424211614256631269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7424211614256631269'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/07/cf-coldfusion-serialization-via-java.html' title='CF: ColdFusion Serialization via Java API'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7613634213460336876</id><published>2009-05-20T09:50:00.003-04:00</published><updated>2009-05-20T10:15:22.102-04:00</updated><title type='text'>VSTS 2008: Database Load and Unit Test using Load Agents</title><content type='html'>There had to be a secret to this. Reading through the documentation, looking at examples, load testing with VSTS 2008 seemed a sophisticated affair, alas, only if you are working along the most popular path. More specifically only for web application testing.&lt;br /&gt;I, being a renegade, wanted to use it to do Database Load testing. There are great new facilities in VSTS 2008 to create Database Unit tests but none speaks of how to do a load test.&lt;br /&gt;I thought it would be easy enough to adapt the techniques in web-testing to database load testing. I found out I was very naive. I should have caught on when:&lt;br /&gt;a) There was no documentation at all, no video, no web post, no nothing from MS or anyone having done this.&lt;br /&gt;b) The number of errors I was getting when even trying to run it with one agent.&lt;br /&gt;&lt;br /&gt;My test setup initially:&lt;br /&gt;a) One workstation running controller and VSTS 2008&lt;br /&gt;b) One server running VSTS Load Agent&lt;br /&gt;c) A beefy SQL Server 2008 box to be load tested&lt;br /&gt;&lt;br /&gt;Load testing on my workstation was working great, everthing was as expected and I was hopefull that this could easily translate into working well on the agent system. In short, it did not:&lt;br /&gt;&lt;br /&gt;Here is the initial error I got:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;System.IO.FileNotFoundException: Could not load file or assembly&lt;/li&gt;&lt;/ul&gt;I thought the deployment was enabled automatically, playing with the deployment option on the Test Run Configuration was not very helpfull. I ended up copying the assembly files into the same directories on the Load Agent, only to get errors referencing core related assemblies of VSTS2008. So, I created install project to deploy those... you guessed it, a wild goose chase in which I tried so many different things only to end up banging my head against a concrete wall. I nearly concluded that VSTS 2008 could not be used to do load testing for a database with Load Agents when an idea struck. This one ended up working, but could have been easily documented. So Microsoft peeps take it to heart ...&lt;br /&gt;&lt;br /&gt;I changed the test rig in this fashion:&lt;br /&gt;a) Workstation with VSTS 2008 and controller + SP1&lt;br /&gt;b) Server with VSTS 2008 and Load Agent + SP1&lt;br /&gt;c) SQL Server 2008&lt;br /&gt;&lt;br /&gt;The solution, thus, is to install visual studio team system 2008 on the agent computer/server as well, then install the agent. What good is an agent that does not cover all test cases? That is something that Microsoft hopefully will resolve. There seem to be dependencies on VSTS core files, I played with it a little. You do not need:&lt;br /&gt;&lt;br /&gt;a) Any Crystal stuff&lt;br /&gt;b) SQL Server Express&lt;br /&gt;c) C++&lt;br /&gt;d) dotfuscator stuff&lt;br /&gt;e) Documentation or redistributables&lt;br /&gt;&lt;br /&gt;My test where in C# so I installed on support for it and no other language.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;br /&gt;Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7613634213460336876?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7613634213460336876/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7613634213460336876' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7613634213460336876'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7613634213460336876'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/05/vsts-2008-database-load-and-unit-test.html' title='VSTS 2008: Database Load and Unit Test using Load Agents'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1471248427254963113</id><published>2009-04-29T09:32:00.003-04:00</published><updated>2009-04-29T09:47:15.876-04:00</updated><title type='text'>Java: Connecting to MS SQL server with JDBC and JRE 1.6</title><content type='html'>So,&lt;br /&gt;I have this little Java project which requires that I connect to SQL Server 2005. Something I have done many times. Download the JDBC drivers from MS and copy them into the lib directory and do your shindig in the connection to get going.&lt;br /&gt;But, this time things have changed and the installation instructions are worthless at best.&lt;br /&gt;&lt;br /&gt;Here is what I did:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Downloaded the driver files from MS for JDBC 2.0&lt;/li&gt;&lt;li&gt;Unzipped to directory&lt;/li&gt;&lt;li&gt;Moved jar files (there are two files sqljdbc.jar and sqljdbc4.jar) to my lib directory&lt;/li&gt;&lt;li&gt;coded my connector to use Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")&lt;/li&gt;&lt;li&gt;Did some query code&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;And presto, nothing works as expected. Instead I get an exception with this in the stack trace:&lt;/p&gt;&lt;p&gt;&lt;em&gt;"The JDBC Driver version 2.0 does not support JRE 1.4. You must upgrade JRE 1.4 to JRE 5.0 or later when using the JDBC Driver version 2.0. In some cases, you might need to recompile your application because it might not be compatible with JDK 5.0 or later. For more information, see the documentation on Sun Microsystems Web site"&lt;/em&gt;&lt;/p&gt;&lt;p&gt;Complete bogusness as neither Microsoft or Sun contain much info about how to solve this. So, head scratching starts followed by experimentation. &lt;/p&gt;&lt;p&gt;Come to find out I made a mistake by copying both jar files packaged in the driver to lib. They contain similar classes and the sqljdbc.jar files classes' are used if both are copied. However, the sqljdbc.jar file classes are not ment to be used with jre/jvm 1.6+ . Why noone mention this in the provided install doc is a different question. &lt;/p&gt;&lt;p&gt;Solution:&lt;/p&gt;&lt;p&gt;a) Remove the not needed jar file (sqljdbc.jar)  from lib directory or&lt;/p&gt;&lt;p&gt;b)  specifically declare to use only the right one (sqljdbc4.jar)&lt;/p&gt;&lt;p&gt;Microsoft, please help us measly developers wasting time and state this in basic terms in your install doc.&lt;/p&gt;&lt;p&gt;There you have it.&lt;/p&gt;&lt;p&gt;Cheers,&lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;p&gt; &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1471248427254963113?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1471248427254963113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1471248427254963113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1471248427254963113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1471248427254963113'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/04/java-connecting-to-ms-sql-server-with.html' title='Java: Connecting to MS SQL server with JDBC and JRE 1.6'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6720096921383849040</id><published>2009-03-28T18:00:00.003-04:00</published><updated>2009-03-28T18:10:50.103-04:00</updated><title type='text'>CF: Unable to perform cfflush in cffunction</title><content type='html'>OK. This is not an obvious one, so I decided to document this behavior.&lt;br /&gt;Say you have several functions in components processing away happily, and you want to give the user some feedback to keep him/her entertained as well as keep their paws of the back buttons etc..&lt;br /&gt;You think doing couple of flushes during your processing may be a good way until you try and get this error:&lt;br /&gt;&lt;br /&gt;&lt;table border="0" cellpadding="0" cellspacing="0" width="500"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td id="tableProps2" align="left" valign="center" width="500"&gt; &lt;h1 id="textSection1" style="font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13pt; line-height: 15pt; font-size-adjust: none; font-stretch: normal; color: black;"&gt;Unable to  perform cfflush. &lt;/h1&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td id="tablePropsWidth" colspan="2" width="400"&gt;&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: 11pt; font-size-adjust: none; font-stretch: normal;font-family:verdana;font-size:8;color:black;"   &gt;You have called cfflush in an  invalid location, such as inside a cfquery or cfthread or between a CFML custom  tag start and end tag. &lt;/span&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;br /&gt;What to do? Since none of the hints apply to you. Your code looks like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fFlushIt"&lt;/span&gt; hint&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"flushes current content"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfargument name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"feedback"&lt;/span&gt; default&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;""&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;#Arguments.feedback#&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfflush&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cffunction&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fProcessing"&lt;/span&gt; returntype&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"numeric"&lt;/span&gt;&lt;br /&gt;   hint&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"does processing"&lt;/span&gt; output&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"No"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset &lt;span style="color:RED;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; x&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;10&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset &lt;span style="color:RED;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; y&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:BROWN;"&gt;20&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset fFlushIt&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Processing Complete"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfreturn x &lt;span style=";font-size:78%;color:BLUE;"  &gt;+&lt;/span&gt; y&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cffunction&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;The result is: #fProcessing()#&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;here comes the digging into the code and making guesses part. It seems that there is one more scenario cfflush won't like and this is if you call in within a call-tree (yes even nested stuff) in a function that has the output attribute declared as "No". Maybe a hint like that could be placed in the error to avoid all that brain scratching and wondering that goes along with this?&lt;br /&gt;Anyways change the function like this and it worked. Yeah !&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fProcessing"&lt;/span&gt; returntype&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"numeric"&lt;/span&gt;&lt;br /&gt; hint&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"does processing"&lt;/span&gt; output&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Yes"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Cheers,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6720096921383849040?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6720096921383849040/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6720096921383849040' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6720096921383849040'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6720096921383849040'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/03/cf-unable-to-perform-cfflush-in.html' title='CF: Unable to perform cfflush in cffunction'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1888024026067256481</id><published>2009-03-26T10:42:00.003-04:00</published><updated>2009-03-26T10:57:36.441-04:00</updated><title type='text'>Oracle: PLS-00103: Encountered the symbol ""</title><content type='html'>Triggers, triggers and more triggers.&lt;br /&gt;Thousands of them. Ran the scripts into Oracle using ColdFusion instead of SQLPlus only to find out that I now had thousands of invalid triggers.&lt;br /&gt;A little puzzling, as the same scripts worked like a charm everywhere else. I go use the oracle web enterprise manager to see whehter I can recompile them and make a few valid. Nada!&lt;br /&gt;Everytime the Enterrpise manager tries to compile the trigger I get the error:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;PLS-00103: Encountered the symbol ""&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is a sample trigger with issues:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;CREATE OR REPLACE TRIGGER INS_MySuperTrigger BEFORE INSERT ON &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;MySuperTriggerTable REFERENCING OLD AS OLD NEW AS NEW FOR EACH ROW &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;DECLARE&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  newid NUMBER;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;BEGIN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  If  :new.&lt;/span&gt;&lt;span style="font-family:courier new;"&gt;MySuperTrigger_ID&lt;/span&gt;&lt;span style="font-family:courier new;"&gt; IS NULL THEN&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    SELECT SEQMySuperTrigger.NextVal INTO newid FROM dual;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;    :new.MySuperTrigger_ID := newid;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;  End If;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;END;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is nuts. I use the generate SQL button of Enterprise manager to generate the SQL and copy and paste it into the Oracel SQL Developer UI, run the code without mods, and bingo; the trigger is valid and happy as a peach.&lt;br /&gt;&lt;br /&gt;What gives? Long hours wasted with different websites and options, casing, single and double quotes, Egyptian prayer beads..., you name it, I tried it.&lt;br /&gt;Until pulling a protocol sniffer to see what the difference is between Oracle Enterprise Manager and Oracle SQL Developer on the wire.&lt;br /&gt;&lt;br /&gt;Come to find out Oracle does not recognize Windows CRLF (Chr(13) + Chr(10))  as blank space, if you replace all the CRLF with LF this works like a charm. Seemingly, web based Oracle Enterprise Manager does not do this translation, while the Oracle SQL Developer tool does. Yack! Lesson learned, I now run the scripts through a parser before running them to Oracle via JDBC and get valid triggers all the time.&lt;br /&gt;&lt;br /&gt;Cheers,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1888024026067256481?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1888024026067256481/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1888024026067256481' title='7 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1888024026067256481'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1888024026067256481'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/03/oracle-pls-00103-encountered-symbol.html' title='Oracle: PLS-00103: Encountered the symbol &quot;&quot;'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>7</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-770455573232731507</id><published>2009-03-24T09:45:00.004-04:00</published><updated>2009-03-24T10:01:53.880-04:00</updated><title type='text'>MySQL: frustration with login at the command prompt or the space character mystery</title><content type='html'>Many years ago when trying to use MySQL I ran into this, but only get to note it down now because someone else run into this problem. I searched and lo and behold not much info out there, so I thought maybe a couple of pointers would be worth while.&lt;br /&gt;When using the command line mysql tool you can specify the username and password of the user during login.&lt;br /&gt;Many manuals describe the syntax as:&lt;br /&gt;&lt;br /&gt;mysql -h hostname -u root -p password&lt;br /&gt;or&lt;br /&gt;mysql --user=user_name --password=your_password db_name&lt;br /&gt;&lt;br /&gt;You think wow this is easy, right. I can interpret this very simply.&lt;br /&gt;I go to the command prompt and type:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;C:\&gt;mysql --user=root --pasword=mypass&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;but to my astonishment I would get:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;mysql: unknown variable 'pasword=mypass'&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here are couple of other beauties that are in the manuals and don't work at all like expected:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;C:\&gt;mysql -u root -p mypass&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Enter password: ******&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;ERROR 1045 (28000): Access denied for user &lt;/span&gt;&lt;a href="mailto:"&gt;&lt;span style="font-family:courier new;"&gt;'root'@'localhost'&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:courier new;"&gt; (using password: YES)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This could be very frustrating to someone new to MySQL on windows. Can't even login to get the client program started.&lt;br /&gt;&lt;br /&gt;The approach I found working for windows based installation is to ignore the manual and avoid space between parameters.&lt;br /&gt;Thus rather than using -u root, you will need to use -uroot. This will magically work. E.g.:&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;C:\&gt;mysql -uroot -pmypass&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Welcome to the MySQL monitor. Commands end with ; or \g.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;Your MySQL connection id is 19Server version: 5.0.67-community-nt &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:courier new;"&gt;MySQL Community Edition (GPL)&lt;br /&gt;Type 'help;' or '\h' for help. Type '\c' to clear the buffer.&lt;br /&gt;mysql&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Hope this will avoid some frustration out there.&lt;br /&gt;Cheers,&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-770455573232731507?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/770455573232731507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=770455573232731507' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/770455573232731507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/770455573232731507'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/03/mysql-frustration-with-login-at-command.html' title='MySQL: frustration with login at the command prompt or the space character mystery'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3445872185009409773</id><published>2009-03-19T18:10:00.004-04:00</published><updated>2009-03-19T18:24:46.816-04:00</updated><title type='text'>CF: ColdFusion functions and the case of the mysterious space</title><content type='html'>Spent lots of time trying to find out why a space was returned from a function call to a function in a component. We would place the output directly into a html form text control, but a space would always be added to the front of the expected return string.&lt;br /&gt;Broke out the old Hex editor to save and check file contents. Output each character at a time, just could not see why this would happen.&lt;br /&gt;Many hours later, a headache started to kick in. Time for a break. Then, a hunch started knocking at the back of my scull and got louder and louder.&lt;br /&gt;To prove it to myself, I created an intermediate variable into which I stored the function result. When this scheme was used, no space. If I used the function output in place, space! It turned out to be the Output attribute of the function definition. You will need to set it to 'No'. If you leave it off and attempt to use the function in place, Coldfusion will introduce a space in the return. Very, very annoying.&lt;br /&gt;&lt;br /&gt;Here is sample code to reproduce the problem, two function that are identical except one has the output attribute specified; if you use the function 2 inline CF will produce a space in front of the output; see the output for f2 below:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fFunction1"&lt;/span&gt; output&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"No"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset &lt;span style="color:RED;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; strReturn &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Hello World"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfreturn strReturn&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cffunction&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cffunction name&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fFunction2"&lt;/span&gt; &lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset &lt;span style="color:RED;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; strReturn &lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"Hello World"&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfreturn strReturn&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cffunction&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset sOutput1&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;fFunction1&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfset sOutput2&lt;span style=";font-size:78%;color:BLUE;"  &gt;=&lt;/span&gt;fFunction2&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;f1:--#fFunction1()#--&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;o1:--#sOutput1#--&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;f2:--#fFunction2()#--&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;o2:--#sOutput2#--&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;lt;&lt;/span&gt;&lt;span style=";font-size:78%;color:BLUE;"  &gt;/&lt;/span&gt;cfoutput&lt;span style=";font-size:78%;color:BLUE;"  &gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Output:&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;br /&gt;&lt;pre&gt;f1:--Hello World--&lt;br /&gt;o1:--Hello World--&lt;br /&gt;f2:-- Hello World--&lt;br /&gt;o2:--Hello World--&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3445872185009409773?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3445872185009409773/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3445872185009409773' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3445872185009409773'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3445872185009409773'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/03/cf-coldfusion-functions-and-case-of.html' title='CF: ColdFusion functions and the case of the mysterious space'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-3204847024444562348</id><published>2009-03-09T13:59:00.004-04:00</published><updated>2009-03-09T14:20:16.734-04:00</updated><title type='text'>CF: ColdFusion Impact of Content Type Declaration on the HTTP header with application/octet-stream</title><content type='html'>So, I  encountered this little problem with XML transmissions for a customer. They would receive regular XML streams to update their data and all was working dandy, until one it  didn't ;o)&lt;br /&gt;To CF it looked like all of a sudden the content of the HTTP traffic vanished, in other words we did not seem to have anything in GetHttpRequestData().content except for empty string.&lt;br /&gt;Of course, no one fessed up to having changed anything at all, so here I go digging through code and cannot find anything obvious and, then, I turn out the big guns: Protocol Sniffers and packet capture.&lt;br /&gt;Hah, I think, now I can show them that they are not sending any content, but instead I can see the content clearly in the packet capture which starts heavy head scratching and coffee sipping.&lt;br /&gt;More looking into code and I find that the only time we bypass GetHttpRequestData().content is if we are running a binary check, e.g. we have this condition:&lt;br /&gt;  &lt;strong&gt;&lt;em&gt;IsBinary(GetHttpRequestData().content)&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;From the protocol packets I can clearly see that the content is not binary so, at first, I cannot imagine how this condition would be even trigger and bypass the remainder of the processing until, seing the light, I remove the condition.&lt;br /&gt;Bingo, now I can see content but it is all wrong. It looks like CF has processed the content of the transmission to numeric values instead of XML strings.&lt;br /&gt;Dang!&lt;br /&gt;So in the end, more digging to see that the http content type declaration of the originating transmission had changed from text/xml to application/octet-stream; it looks like whenever CF received this it automatically converted the perfectly fine XML into an octet stream, which, then, turned the content to be binary data instead of leaving it as simple string. A simple misdeclaration by the customer which caused this hoopla.&lt;br /&gt;So after much searching I wish I could have been able to tell the RAW data in the transmission from the interpreted data. This would have made the diagnosis much simpler. So Adobe, in the future please consider adding the raw information to the GetHttpRequestData function, so we don’t have to guess what parts are being interpreted and what the transmission contained.&lt;br /&gt;For now, I went back to the customer and asked them to correct their content declaration.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-3204847024444562348?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/3204847024444562348/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=3204847024444562348' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3204847024444562348'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/3204847024444562348'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/03/cf-coldfusion-impact-of-content-type.html' title='CF: ColdFusion Impact of Content Type Declaration on the HTTP header with application/octet-stream'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-1699682451480048314</id><published>2009-02-22T11:04:00.002-05:00</published><updated>2009-02-22T11:17:39.033-05:00</updated><title type='text'>CF: Coldfusion and the perennial rounding bug</title><content type='html'>Through the years using any function that did implicit rounding in CF was not the safest thing to do. Many times when I thought this was resolved it came back with a vengeance to bite me in the you-know-what.&lt;br /&gt;Thus, the safe route to use is to go through the database to round anything, unless you really do not have any choice.&lt;br /&gt;This time it was the LSCurrencyFormat function which caused the headaches. It will round down at the .5 fraction rather than round up which is very annoying and disturbing at the same time. Here is a function specifically made for currency handling and it does not handle the basic calculations correctly.&lt;br /&gt;&lt;br /&gt;Example code (comparing the round behavior against LSCurrency):&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfloop from&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"0.001"&lt;/span&gt; to&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"0.009"&lt;/span&gt; step&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"0.001"&lt;/span&gt; index&lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt;&lt;span style="color:PURPLE;"&gt;"fraction"&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfset Amount &lt;span style="font-size:+1;color:BLUE;"&gt;=&lt;/span&gt; &lt;span style="color:YELLOW;"&gt;1.10&lt;/span&gt; &lt;span style="font-size:+1;color:BLUE;"&gt;+&lt;/span&gt; fraction&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt; &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;cfoutput&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  number: #Amount#  ls: #LSCurrencyFormat(Amount,'none')#&lt;br /&gt;  compare to rounded #Round(Amount *100)/100# &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:RED;"&gt;&lt;b&gt;BR&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;  &lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cfoutput&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:+1;color:BLUE;"&gt;/&lt;/span&gt;cfloop&lt;span style="font-size:+1;color:BLUE;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unfortunately, I  had flip back all the use of LSCurrencyFormat and pre-round the numbers via the database before passing them to this function. I do hope that Adobe does a little more testing on rounding for these in the future.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-1699682451480048314?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/1699682451480048314/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=1699682451480048314' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1699682451480048314'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/1699682451480048314'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/02/cf-coldfusion-and-perennial-rounding.html' title='CF: Coldfusion and the perennial rounding bug'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-8749165670453243449</id><published>2009-02-12T09:46:00.005-05:00</published><updated>2009-03-09T14:23:56.694-04:00</updated><title type='text'>CF: How to detect nested transactions within cftransaction</title><content type='html'>Sometimes it cannot be helped. You are expanding ColdFusion code and have to implement transactions. You have to, then, use components that cannot be changed, that, in turn, may have to do transactions. Now the problem, ColdFusion does not like nested transactions. Nested transactions are simply not supported.&lt;br /&gt;&lt;br /&gt;Well, at least if I could detect whether I am in a transaction I could write around this I think. But there is no way that I have found. No clear posting on how to do this.&lt;br /&gt;&lt;br /&gt;First approach I used was to create a function that would open and close a transaction, then detect the error thrown. If the error was thrown I was assuming that we were in a transaction and thus could not open a new one, a fuction like this:&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET &lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; blnReturn &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; false&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFTRY&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFTRANSACTION&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- emptry transaction tag ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;CFTRANSACTION&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFCATCH type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Any"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET blnReturn&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;true&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;CFCATCH&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;CFTRY&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFRETURN blnReturn&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Unfortunatly, this does not work. When CF throws an error for nesting, even within the try/catch block for the purposfully nested transaction, the transaction wrapper is removed. Thus you are hosed if an error occurs later down the execution.&lt;br /&gt;&lt;br /&gt;What to do then?&lt;br /&gt;&lt;br /&gt;After much researching and failure, here is the approach I did find working. The trouble with this is, that there is no guarantee that it will work in future versions of CF, which I hope will introduce a simple function like &lt;em&gt;InTransaction()&lt;/em&gt; . We are using the ColdFusion Java implementation of the Transaction Tag to find out whether we have a current transaction. This is the fully wrapped function.&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFFUNCTION name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"InTransaction"&lt;/span&gt; access&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"public"&lt;/span&gt; displayname&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"checks to see whether we are currently running a database transaction. returns true or false."&lt;/span&gt; output&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"No"&lt;/span&gt; RETURNTYPE&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"boolean"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET &lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; objTrans &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;""&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET &lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; blnActiveTransaction&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;false&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET &lt;span style="color:red;"&gt;&lt;b&gt;var&lt;/b&gt;&lt;/span&gt; objCurrentTrans&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;""&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- Call to CF implementation of TransactionTag to expose Java functions ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfobject type&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"Java"&lt;/span&gt; class&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"coldfusion.tagext.sql.TransactionTag"&lt;/span&gt; name&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"objTrans"&lt;/span&gt; action&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;&lt;span style="color:purple;"&gt;"create"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- objCurrentTrans will become undefined if the Java function call getCurrent() returns Null,&lt;br /&gt;otherwise this returns a pointer to current transaction instance ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfset objCurrentTrans &lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt; objTrans&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;.&lt;/b&gt;&lt;/span&gt;getCurrent&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;cfif IsDefined&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;(&lt;/b&gt;&lt;/span&gt;&lt;span style="color:purple;"&gt;"objCurrentTrans"&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&lt;b&gt;)&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFSET blnActiveTransaction&lt;span style="font-size:78%;color:blue;"&gt;=&lt;/span&gt;true&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;cfif&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;&lt;i&gt;&amp;lt;!--- return result ---&amp;gt;&lt;/i&gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;CFRETURN blnActiveTransaction&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;span class="cch1"&gt;&lt;span style="color:gray;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size:78%;color:blue;"&gt;/&lt;/span&gt;CFFUNCTION&lt;span style="font-size:78%;color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;This works in ColdFusion 8 and 7.&lt;br /&gt;&lt;br /&gt;Cheers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-8749165670453243449?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/8749165670453243449/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=8749165670453243449' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8749165670453243449'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/8749165670453243449'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2009/02/cf-detecting-nested-transactions.html' title='CF: How to detect nested transactions within cftransaction'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7170148036255393745</id><published>2008-09-13T10:42:00.004-04:00</published><updated>2008-09-13T11:27:22.793-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coldfusion'/><category scheme='http://www.blogger.com/atom/ns#' term='debug handler'/><category scheme='http://www.blogger.com/atom/ns#' term='ToFile.cfm'/><category scheme='http://www.blogger.com/atom/ns#' term='debug'/><category scheme='http://www.blogger.com/atom/ns#' term='techniques'/><title type='text'>CF: Silent Server Side Debugging</title><content type='html'>So you get this call. Customer says "Nothing is working"; you cannot replicate. When you go to your application or site everything is working just fine.&lt;br /&gt;Have you been there? I have many a time. Wouldn't it be great to have had the debug output (classic coldfusion format) when the customer ran this?&lt;br /&gt;Well you can. You can change the way coldfusion does the debugging in a fairly straight forward fashion, i.e. you can capture all debug information and save it to files for later analysis by changing the debug handler.&lt;br /&gt;You do this like so:&lt;br /&gt;&lt;br /&gt;1.) Download the sample file (&lt;a href="http://www.boncode.net/downloads/ToFile.zip"&gt;ToFile.zip&lt;/a&gt;).&lt;br /&gt;2.) Extract and place the file (ToFile.cfm) in your debug handlers directory [cfusion root]\wwwroot\WEB-INF\debug. If you installed  ColdFusion in C:\CfusionMX8  this would be the final directory to place the file in: C:\CfusionMX8\wwwroot\WEB-INF\debug&lt;br /&gt;3.) Log in to ColdFusion Administrator and navigate to Debugging &amp;amp; Logging:Debug Output Settings&lt;br /&gt;4.) Change the "&lt;b&gt; Select Debugging Output Format" &lt;/b&gt;drop down&lt;b&gt; &lt;/b&gt;to "&lt;span style="font-weight: bold;"&gt;ToFile.cfm&lt;/span&gt;"&lt;br /&gt;&lt;br /&gt;For each page that you are generating a debug file, the time needed as well as the file name to which the debug information was saved will be displayed at the bottom of the screen.&lt;br /&gt;You have the option to specify a variable in URL, Form, or Variables scope.&lt;br /&gt;Specify a variable named: "DebugSilent" to suppress the bottom text altogether.&lt;br /&gt;&lt;br /&gt;Be careful though how long you keep this on as it will generate many files that need to cleared out.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;-Bilal&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7170148036255393745?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7170148036255393745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7170148036255393745' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7170148036255393745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7170148036255393745'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/09/cf-silent-server-side-debugging.html' title='CF: Silent Server Side Debugging'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7737564245469356372</id><published>2008-07-29T13:38:00.009-04:00</published><updated>2008-07-29T14:03:46.944-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='coldfusion'/><category scheme='http://www.blogger.com/atom/ns#' term='java cast'/><category scheme='http://www.blogger.com/atom/ns#' term='FCK Rich Text'/><category scheme='http://www.blogger.com/atom/ns#' term='cfform'/><title type='text'>Using Richt Text TextArea results in error (java.lang.Double cannot be cast to java.lang.String)</title><content type='html'>Well you guessed correctly from the title. There is something odd going on.&lt;br /&gt;If we are passing on variables that are typed as numeric to an argument (height and width) that would conceivable accept numeric values we will get this error:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;java.lang.Double cannot be cast to java.lang.String&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here is sample code to reproduce this:&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset iHeight=Val(200)&amp;gt;&lt;br /&gt;&amp;lt;cfset iWidth=Val(500)&amp;gt;&lt;br /&gt;&lt;p&gt;&amp;lt;cfform name="myForm" method="POST" action="Self.cfm"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;cftextarea richtext="true"&lt;br /&gt;    toolbar="Basic"&lt;br /&gt;    name="MyRTField"&lt;br /&gt;    height="#iHeight#"&lt;br /&gt;    width="#iWidth#" value=""&amp;gt;             &lt;br /&gt;&amp;lt;/cftextarea&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/cfform&amp;gt;&lt;/p&gt;&lt;br /&gt;This could easily occur when passing values as returns from functions. I found two ways of avoiding this.&lt;br /&gt;a) specifically declare variables as strings&lt;br /&gt;&lt;br /&gt;&amp;lt;cfset iHeight="200"&amp;gt;&lt;br /&gt;&amp;lt;cfset iWidth="500"&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;b) introduce space when passing arguments so as to force an implicit conversion&lt;br /&gt;&lt;br /&gt;...&lt;br /&gt;height=" #iHeight# "&lt;br /&gt;width=" #iWidth# "&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7737564245469356372?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7737564245469356372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7737564245469356372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7737564245469356372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7737564245469356372'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/07/using-richt-text-textarea-results-in.html' title='Using Richt Text TextArea results in error (java.lang.Double cannot be cast to java.lang.String)'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-6164159592304288654</id><published>2008-07-01T11:02:00.004-04:00</published><updated>2008-07-01T12:59:27.359-04:00</updated><title type='text'>Micromarketing - Web 2.0+ and the evolution of human to machine marketing</title><content type='html'>It all started with search engines. People built sites and wanted other people to find them. This  was a submission game. If I submit my site to X engines, it would increase traffic by n. This type of site registration work was done mostly by generalists maybe using special submission software to make this repetitive task easier.&lt;br /&gt;However, as search engines became smarter, this stopped working well. Besides, the few surviving search engines where exploring the mechanisms on how to make more revenue and would for that reason alone want to control the results more actively.&lt;br /&gt;Thus, a change happened in marketing. Even before this happened I did make a bold prediction that we would have this new aspect of marketing appear. The human to machine specialist. Marketing before this was mostly an affair of humans trying to convince other humans to do things or spend money on things and services they presumably did not think to be needing otherwise.&lt;br /&gt;The common incarnation of the human to machine marketer was the search engine specialist. Now, here was a marketer blissfully unconcerned about any human audience, rather focusing his energies on how to influence a system (search engine), which in turn would yield the outcome (higher search results). Whole companies specialized in this and are still today providing these services to others.&lt;br /&gt;Banner companies appeared, and a sophisticated system of banner advertising that was content sensitive appeared. Things evolved and no one in their right mind wanted to click on banners any longer. Google ads was begotten and as most things Google, it drowned everything else out. Google rules the masses with Add text banners.&lt;br /&gt;Now, we have this Web 2.0 happening and some of the paradigms with sites and submissions went out the door. So, then, you may ask, what with this web 2.0 stuff happening, whatever that is, will happen to the human to machine people? Will this have any impact on how marketing will evolve? Of course, thanks for the lead in .... If I were free to opine (which I am) I am going to make a prediction. Marketing will change once more to adopt to the next level of message delivery. Machine to machine marketing, or more specifically machine to machine Micromarketing, will emerge.&lt;br /&gt;Sure, obvious you say; maybe so, but let me explain my particular take on this. Imagine a web application in new web 2.0 style, highly interactive, highly social (high stickiness). Maybe you and your buddies are watching a bike race unfold online. As you are looking at the leader riding his Schwinn bike to victory, in the background systems (machines) are negotiating advertising rates with Schwinn based on this event, i.e. sports (special section bike related), audience (your buddies, target group size, average incomes and ages, etc.); Schwinn's systems may have to bid automatically against a competitor (automated market rate auctions) to gain the rights to transparently overlay a marketing message on the race as the race unfolds.  This happens several times, as leaders change position, new Marketing messages are negotiated. This is target advertising driven to a next level, highly personalized, informative, automatic, integrated. Wow! You are right, there is no escape now, we will be truly slaves to our passions and exploited for our whims ;o)&lt;br /&gt;However, we are not there yet. There is a lot of work needed to create this next level of reality for marketing. Infrastructure and systems and protocols are just a few things.&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Negotiation protocol for marketing events. Probably something on top of WS standards, containing event information, exposure times, audiences, bid information.&lt;/li&gt;&lt;li&gt;Advertising systems that can recognize types of events and are policy driven (executing against a pre-defined marketing strategy) to react to 1000s+ add requests per second.&lt;/li&gt;&lt;li&gt;Micro-payment system: The ability needs to exist to pay for impressions or executions (clicks, seconds of videos watched, games played, names captured); maybe a quarter cent per incidence.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;Of course, some of this could be outsourced to specialist, which will then program your policies in their systems on your behalf. Maybe this could be the next Doubleclick service. Just say I didn't tell you so.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-6164159592304288654?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/6164159592304288654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=6164159592304288654' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6164159592304288654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/6164159592304288654'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/07/micromarketing-web-20-and-evolution-of.html' title='Micromarketing - Web 2.0+ and the evolution of human to machine marketing'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-4737564828947889349</id><published>2008-06-08T13:54:00.008-04:00</published><updated>2009-11-19T14:39:22.473-05:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='MP3'/><category scheme='http://www.blogger.com/atom/ns#' term='iPod'/><category scheme='http://www.blogger.com/atom/ns#' term='future'/><category scheme='http://www.blogger.com/atom/ns#' term='Apple'/><category scheme='http://www.blogger.com/atom/ns#' term='wireless carrier'/><title type='text'>Why the iPod must die</title><content type='html'>First of, I admit that I have owned an iPod. I owned it very briefly and did admire the attention that Apple has given to designing a well rounded MP3 player. However, I gave it away very quickly. I owned several other MP3 players before and after the iPod. The MP3 player that I am currently using is made by Samsung; and the main reason I bought it for was the radio tuner, followed by size and ease of use. Which overall brings me to the topic at hand, the future of the MP3 players in general and iPod in particular.&lt;br /&gt;The reasons that I did not keep my original iPod and also gave away multiple iPods that I received as promotional gifts and purchase bonus are very simple on one side but point out some of the issues that will, of course only in my humble opinion, doom its existence.&lt;br /&gt;To start with iTunes rubs me the wrong way. As a more technical person than the usual user, I did not like how iTunes took over my computer (with little to no choice), was consuming resources precariously and would not allow me to transfer tunes to anything else but iPod.&lt;br /&gt;I went on to discover something else about myself while dealing with the iPod (and other MP3) players. You could call it a journey of self discovery of sorts. Though the idea of downloading and assembling your own tunes seems pretty cool at first, the stark truth is, it is a LOT OF WORK.&lt;br /&gt;I did a completely statistically irrelevant survey to confirm my suspicions, I asked 7 people about their approach to iPod music management; astonishingly enough they did the same thing. Once they had loaded their favorite tunes, they made very few changes to their music play lists or downloaded music, ripped their CDs etc. Of course there are plenty of people who enjoy doing these things, they just don't seem to be in the majority.&lt;br /&gt;This must probably go under the more "dah" moments in live. We all relish the choice, but are not willing to put in the effort. Thus, I like the other people in my survey realized that this downloading and song organizing part of the iPod does not work for us as the maker intended.&lt;br /&gt;Thus, I am looking for the next wave of devices that truly promises to me the notion of complete choice by giving up any choice whatsoever. Counterintuitive you may say,"hah!" but not truly so I retort. I am thinking here of interactive, internet based radio available 24/7 with or without commercials, where I can pick a genre/type of music I feel like listening to, then I am able to make my preference known within the type by either fast forwarding or ranking the tunes. The new interactive radio station would learn my strange music ways and be able to quickly become adapt at knowing what to play to me, even be able to play medleys, cross music boundaries and present new bands/songs/artists to me.&lt;br /&gt;No more iTunes, no more needing to download anything, if I like a song I can ask for more frequent replay. I pay or not pay (via commercials) professionals to go out there and find the stuff I like. A serving of Indy... here you go, newest Pop/Rock, right away Sir...&lt;br /&gt;Now is this the stuff of far away future? Was I too quick to write the obituary of such an ingenuous device? I, of course, do not think so. The companies at the best position to deliver this are the companies that already sell us our daily other gadgets, such as the wireless carriers. They have realized this potential and working on services and devices that are nudging us ever closer towards this music nirvana. Unfortunately, they have only one way track thinking, e.g. make money directly on subscription services. Leaving out tremendous potential for ad dollars, cross marketing of goods (how about being able to buy tickets for a band you just heard that will be performing in your area. The carrier would know where you are located, they would know you just rated the song highly, bingo! you are ripe for the plucking.). I don't want to mention merchandising, but I think I just have. In other words there is potential beyond subscription for revenue.&lt;br /&gt;I also see potential for our friends from satellite Radio; they have the content, but they need to get off the bandwagon that radio is one directional. The radio of the future is interactive. Their gadgets need to be improved and maybe a free service would be available for people that do not want to do subscription, but would be willing to get commercials or merchandising messages etc. Wow, this could be cool.&lt;br /&gt;Apple is no dummy either. I believe, they have foreseen the death of the iPod already ;o) and I am convinced they are working diligently on the next best thing. What could this be? How could they capitalize on the trends I am predicting (crystal ball and all). iPhone is a start of course, but they just now get to a device that has sufficient bandwidth to access high quality music streams. What's the other way? Keep the best part of the iPod alive indefinetly and ensure it can get licensed easily and it gets into as many places as possible (Unfortunately licensing is not one of Apple's strengths). What am I talking about? The iPod's connection interface of course. Your radio clock has it, your car has it, your zip pocket in your pants will have it before you know it. It should become more ubiquitous than plain m&amp;amp;m's that don't melt in your hand. Thus, there could be a way in which the iPod could live on forever, however, its days as the music player of choice are numbered.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-4737564828947889349?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/4737564828947889349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=4737564828947889349' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4737564828947889349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/4737564828947889349'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/06/why-ipod-must-die.html' title='Why the iPod must die'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-5424333533419263346</id><published>2008-05-25T10:19:00.003-04:00</published><updated>2008-06-08T14:46:08.461-04:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='flex'/><category scheme='http://www.blogger.com/atom/ns#' term='conference'/><category scheme='http://www.blogger.com/atom/ns#' term='washington'/><category scheme='http://www.blogger.com/atom/ns#' term='figleaf'/><category scheme='http://www.blogger.com/atom/ns#' term='2008'/><title type='text'>FlexManiacs 2008</title><content type='html'>Just returned from the Flexmaniacs 2008 show put on by Figleaf. I would classify this as mixed bag show. It is an impressive array of presentations, presenters and topics that were being covered. To me though this all seemed still a little rough around the edges; it is the second year so a little slack can be given.&lt;br /&gt;Half the presentations I attended ended up having a low value for me whether it was content, presenters struggling with presentations or topics, etc.  Overall it was still a valuable conference to attend but the main part requiring improvement is to separate the bad presenters from the good and get to more consistent polished presentations.  I have never seen a conference where half the audience would leave within 10 min of a start of a presentation; I can imagine this to be a good blow to many a soul attempting to present.&lt;br /&gt;&lt;br /&gt;In brief:&lt;br /&gt;the good: The conference is pretty long enough and provides good coverage of topics to sniff into into get an idea. The weather was nice ;o)&lt;br /&gt;the bad: Need better individual presentations and presenters. Would like to see options to rate individual presenters (online or after each show) . Topics should be better described ahead of time (I sat through an hour of a Flash presentation when topic was Flex). An individualized schedule should be printable from the website. More networking forums needed.&lt;br /&gt;&lt;br /&gt;Would attend again but pick only the day I think has the biggest bang.&lt;br /&gt;&lt;br /&gt;Cheers.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-5424333533419263346?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/5424333533419263346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=5424333533419263346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5424333533419263346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/5424333533419263346'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/05/flexmaniacs-2008.html' title='FlexManiacs 2008'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8688578682638853763.post-7310210698143601551</id><published>2008-05-23T15:37:00.006-04:00</published><updated>2008-05-25T10:17:36.508-04:00</updated><title type='text'>CF: cfhttp and  The column name "" is invalid.</title><content type='html'>The other day we were looking at cfhttp to parse out a CSV (comma seperated values) file. It worked beautifully on the test systems but would not run when transferred to staging site.&lt;br /&gt;We would get this error consistently.&lt;br /&gt;&lt;span style="font-style: normal; font-variant: normal; font-weight: normal; line-height: 11pt; font-size-adjust: none; font-stretch: normal;font-family:verdana;font-size:8;color:black;"   &gt;&lt;h1 id="textSection1" style="color: black; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13pt; line-height: 15pt; font-size-adjust: none; font-stretch: normal;"&gt;&lt;span style="color: black; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 8pt; line-height: 11pt; font-size-adjust: none; font-stretch: normal;"&gt;&lt;h1 id="textSection1" style="color: black; font-family: verdana; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13pt; line-height: 15pt; font-size-adjust: none; font-stretch: normal;"&gt;             The column name "" is invalid.&lt;br /&gt;&lt;/h1&gt;&lt;/span&gt;&lt;/h1&gt;&lt;/span&gt;None of the internet resources regarding this was very helpful. So after many trial and errors we discovered that the webserver we posted this to had basic user authentication switched on, thus we needed to provide username and password attributes of the cfhttp tag for this to work.&lt;br /&gt;Another perfectly good example of how the simple things get you. Would have been helpful too if the cfhttp tag could throw a more meaningful error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8688578682638853763-7310210698143601551?l=boncode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://boncode.blogspot.com/feeds/7310210698143601551/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=8688578682638853763&amp;postID=7310210698143601551' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7310210698143601551'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8688578682638853763/posts/default/7310210698143601551'/><link rel='alternate' type='text/html' href='http://boncode.blogspot.com/2008/05/cf-cfhttp-and-column-name-is-invalid.html' title='CF: cfhttp and  The column name &quot;&quot; is invalid.'/><author><name>bman</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry></feed>
