<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"><channel><title>RSS feed for InstantSpot site think-lab.net</title><link>http://think.instantspot.com</link><language>en-us</language><copyright>This work is Copyright &#xA9; 2009 by think-lab.net</copyright><generator>RSSVille ColdFusion FeedMaker, version 1.0</generator><pubDate>Sat, 07 Nov 2009 15:21:01 GMT</pubDate><item><title>ColdFusion Config Settings</title><link>http://think.instantspot.com/blog/2008/05/27/ColdFusion-Config-Settings</link><description>&lt;p&gt;Here is the problem I needed to come up with a way to allow my client admins to set alias&apos;s for entry forms and report headers. So I started looking at localization and quickly found that, that was not a good Idea at all so then I started looking at using ini files since ColdFusion has functions for reading and setting config keys. I also found that I didn&apos;t like using the config file for this so I created a table to store the infromation. Then I decided to do some test to see if the was some benefit to using a DB verses the ini file low and behold there is.&lt;br /&gt; This code block took [58ms] &lt;em&gt;to run&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cftimer label=&amp;quot;iniSettings&amp;quot; type=&amp;quot;debug&amp;quot;&amp;gt;  &amp;lt;cfscript&amp;gt;   iniFile = expandPath(&apos;config_1234_12.ini.cfm&apos;);   clientStruct  ={    clientNameLabel = getProfileString(iniFile, &amp;quot;client&amp;quot;, &apos;clientNameLabel&apos;),    clientNameHasValidation = getProfileString(iniFile, &amp;quot;client&amp;quot;, &apos;clientNameHasValidation&apos;),    clientNameValidation = getProfileString(iniFile, &amp;quot;client&amp;quot;, &apos;clientNameValidation&apos;)   };  &amp;lt;/cfscript&amp;gt;  &amp;lt;cfoutput&amp;gt;   &amp;lt;label&amp;gt;#clientStruct[&apos;clientNameLabel&apos;]#&amp;lt;/label&amp;gt;   &amp;lt;input type=&amp;quot;input&amp;quot; name=&amp;quot;clientName&amp;quot;&amp;gt;   &amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Click Me!&amp;quot; onclick=&amp;quot;validate()&amp;quot;&amp;gt;   &amp;lt;script&amp;gt;    function validate(){     &amp;lt;cfif IsBoolean(clientStruct[&amp;quot;clientNameHasValidation&amp;quot;]) AND clientStruct[&amp;quot;clientNameHasValidation&amp;quot;] is true&amp;gt;      #ReReplaceNoCase(clientStruct[&amp;quot;clientNameValidation&amp;quot;],&apos;~clientname~&apos;, clientStruct[&amp;quot;clientNameLabel&amp;quot;])#     &amp;lt;/cfif&amp;gt;    }   &amp;lt;/script&amp;gt;    &amp;lt;/cfoutput&amp;gt; &amp;lt;/cftimer&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;This code block took [2ms] &lt;em&gt;to run&lt;/em&gt;&lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cftimer label=&amp;quot;DBSettings&amp;quot; type=&amp;quot;debug&amp;quot;&amp;gt;  &amp;lt;cfscript&amp;gt;   args = {    cfSection = &amp;quot;client&amp;quot;   };      clientStruct=application.configSettingsService.queryToPropStruct(application.configSettingsService.getByAttributesQuery(argumentcollection=args));   if(StructKeyExists(clientStruct,&apos;&apos;)){      }  &amp;lt;/cfscript&amp;gt;  &amp;lt;cfoutput&amp;gt;   &amp;lt;label&amp;gt;#clientStruct[&apos;clientNameLabel&apos;]#&amp;lt;/label&amp;gt;   &amp;lt;input type=&amp;quot;input&amp;quot; name=&amp;quot;clientName&amp;quot;&amp;gt;   &amp;lt;input type=&amp;quot;button&amp;quot; value=&amp;quot;Click Me!&amp;quot; onclick=&amp;quot;validate()&amp;quot;&amp;gt;   &amp;lt;script&amp;gt;    function validate(){     &amp;lt;cfif IsBoolean(clientStruct[&amp;quot;clientNameHasValidation&amp;quot;]) AND clientStruct[&amp;quot;clientNameHasValidation&amp;quot;] is true&amp;gt;      #ReReplaceNoCase(clientStruct[&amp;quot;clientNameValidation&amp;quot;],&apos;~clientname~&apos;, clientStruct[&amp;quot;clientNameLabel&amp;quot;])#     &amp;lt;/cfif&amp;gt;    }   &amp;lt;/script&amp;gt;    &amp;lt;/cfoutput&amp;gt; &amp;lt;/cftimer&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;I know 58ms doesn&apos;t seem like much but remeber in this example its only one field and I have pages the have 50 fields that a client might alias.&lt;/p&gt;</description><pubDate>Wed, 28 May 2008 01:02:00 GMT</pubDate><guid>http://think.instantspot.com/blog/2008/05/27/ColdFusion-Config-Settings</guid><category>code,design,ColdFusion,CFC</category></item><item><title>ColdFusion Test</title><link>http://think.instantspot.com/blog/2008/03/11/ColdFusion-Test</link><description>&lt;p&gt;Here is a ColdFusion test that I found see how you do.&lt;/p&gt; &lt;p&gt;1.    Which of these are NOT legal variable names?&lt;br /&gt; a.    $myVar&lt;br /&gt; b.    my-Var&lt;br /&gt; c.    _true&lt;br /&gt; d.    my$Var&lt;br /&gt; e.    false &lt;br /&gt; &lt;br /&gt; 2.    What will this code produce? &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cfset test = RandRange(0, 1)&amp;gt; &amp;lt;cfif NOT test&amp;gt;     &amp;lt;cfset x = Val(100/test)&amp;gt; &amp;lt;cfelse&amp;gt;     &amp;lt;cfset x = Val(100/(test*0))&amp;gt; &amp;lt;/cfif&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt; 3.    Write code to output 1 to 1000, comma-delimited, (stepping by 1) without using the &lt;cfloop&gt; tag (e.g., 1,2,3,4,5&amp;hellip; etc):&lt;/cfloop&gt;&lt;/p&gt; &lt;p&gt;4.    List as many ColdFusion application scopes as possible and explain each briefly.&lt;br /&gt; &lt;br /&gt; 5.    Given a query &amp;ldquo;myQuery&amp;rdquo;, how would you get the column names that are returned by this query?&lt;br /&gt; &lt;br /&gt; 15. Given a query &amp;ldquo;myQuery&amp;rdquo;, how would you find out the total records returned by this query?&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; 6.    This is a query returned called &amp;ldquo;myQuery&amp;rdquo;:&lt;br /&gt; Row    Name        Company&lt;br /&gt; 1    Jeff    widget1&lt;br /&gt; 2    David    Solisys&lt;br /&gt; 3    Darryl    Adobe&lt;br /&gt; 4    Jim    widget1&lt;br /&gt; 5    Marie    Adobe&lt;br /&gt; &lt;br /&gt; Write code to return the following output given the query above:&lt;br /&gt; widget1&lt;br /&gt; Jeff    &lt;br /&gt; Jim    &lt;br /&gt; Solisys&lt;br /&gt; David&lt;br /&gt; Adobe&lt;br /&gt; Darryl&lt;br /&gt; Marie&lt;br /&gt; &lt;br /&gt; 7.    Given a query, &amp;quot;Products&amp;quot;, with the fields: &amp;quot;id&amp;quot;, &amp;quot;price&amp;quot;, and &amp;quot;description&amp;quot;, how can you output the price of the LAST row in the query without using either a loop or another query? &lt;br /&gt; &lt;br /&gt; 8.    Given a custom tag, &amp;quot;ListNoDupes&amp;quot;, that accepts the variables: &amp;quot;list&amp;quot; and &amp;quot;returnAs&amp;quot;. The last line of the tag is this: &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cfset SetVariable(&apos;caller.&apos; &amp;amp; attributes.returnAs, newList) /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt; What will happen on the page that calls this custom tag?&lt;br /&gt; a.    Nothing&lt;br /&gt; b.    A variable called &amp;quot;caller.returnAs&amp;quot; will be set as a local variable on the calling page&lt;br /&gt; c.    A request-scoped variable called &amp;quot;newList&amp;quot; will be created&lt;br /&gt; d.    A local variable will be set on the calling page with the same name as the value of the &amp;quot;returnAs&amp;quot; parameter passed into the custom tag.&lt;br /&gt; e.    If no variable called &amp;quot;returnAs&amp;quot; exists on the calling page, it will be created. If such a variable does exist, nothing will happen. &lt;br /&gt; &lt;br /&gt; 9.    Given this CFC: &lt;br /&gt; &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cfcomponent displayname=&amp;quot;Classroom&amp;quot;&amp;gt;     &amp;lt;cfset variables.students = ArrayNew() /&amp;gt;     &amp;lt;cfset variables.teacher = &amp;quot;&amp;quot; /&amp;gt;      &amp;lt;cffunction name=&amp;quot;addStudent&amp;quot; returntype=&amp;quot;void&amp;quot;&amp;gt;   &amp;lt;cfargument name=&amp;quot;student&amp;quot; type=&amp;quot;Student&amp;quot; required=&amp;quot;true&amp;quot;&amp;gt;   &amp;lt;cfset ArrayAppend(getStudents(), arguments.student) /&amp;gt;     &amp;lt;/cffunction&amp;gt;      &amp;lt;cffunction name=&amp;quot;getStudents&amp;quot; returntype=&amp;quot;array&amp;quot;&amp;gt;   &amp;lt;cfreturn variables.students /&amp;gt;     &amp;lt;/cffunction&amp;gt; &amp;lt;/cfcomponent&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt; You create 1 &amp;quot;Classroom&amp;quot; object, &amp;quot;classroom&amp;quot;, and 3 Student objects. You call the &amp;quot;addStudent()&amp;quot; method, passing in each of the three new students. At the end of this, what will this code produce?&lt;br /&gt; #ArrayLen(classroom.getStudents())#&lt;br /&gt; &lt;br /&gt; 10.    You&apos;ve been given a text file, &amp;quot;CityTemperatures.txt&amp;quot;. Each line in the file contains the temperatures for each day in the same week for different cities. &lt;br /&gt; Atlanta:   54,57,52,34,45,49,53&lt;br /&gt; Baltimore: 67,72,69,77,79,71,74&lt;br /&gt; Chicago:   81,72,79,74,76,67,72&lt;br /&gt; Denver:    68,64,75,69,72,63,68&lt;br /&gt; Can you read and display the low, high, and average temperatures for each city in 10 lines of code or less? &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; 11.    You have a query, &amp;quot;Products&amp;quot;, with the following columns: &amp;quot;id&amp;quot;, &amp;quot;price&amp;quot;, &amp;quot;description&amp;quot;, and &amp;quot;quantityOnHand&amp;quot;. You need to create a form with a checkbox for each row in the Products query, all using the name, &amp;quot;selectedProducts&amp;quot;. The problem is that you need to send information about both the id of the product chosen AND the quantity on hand. At first, you think of putting a hidden form field for each query row that would contain this info, but your co-worker casually remarks that she always does this without using any more form inputs than there are rows. What&apos;s her secret?&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; 12.    Look at this code: &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cfset susie = StructNew() /&amp;gt; &amp;lt;cfset susie.employer = &amp;quot;ibm&amp;quot; /&amp;gt;  &amp;lt;cfset me = StructNew() /&amp;gt; &amp;lt;cfset me.spouse = susie /&amp;gt;  &amp;lt;cfset me.spouse.employer = &amp;quot;self-employed&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; What&apos;s the value of susie.employer? &lt;br /&gt; &lt;br /&gt; 13.    You&apos;ve produced a two-dimensional array, &amp;quot;arr&amp;quot;, that you need to save as a client variable. What&apos;s the code for this? &lt;br /&gt; &lt;br /&gt; &lt;br /&gt; 14.    Explain this code:&lt;br /&gt; &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt; &amp;lt;cfdirectory action=&amp;quot;list&amp;quot; directory=&amp;quot;#ExpandPath(&apos;./images/mainpic/#ATTRIBUTES.MainPicDir#&apos;)#&amp;quot; sort=&amp;quot;ASC&amp;quot; name=&amp;quot;ImageList&amp;quot; filter=&amp;quot;*.*&amp;quot;&amp;gt;  &amp;lt;cfif ImageList.recordcount eq 1&amp;gt;      &amp;lt;cfoutput query=&amp;quot;ImageList&amp;quot;&amp;gt;         &amp;lt;img src=&amp;quot;./images/mainpic/#ATTRIBUTES.MainPicDir#/#ImageList.name /&amp;gt;     &amp;lt;/cfoutput&amp;gt;  &amp;lt;cfelseif ImageList.recordcount&amp;gt;      &amp;lt;cfset randImageNum = randrange(1,#ImageList.recordcount#)&amp;gt;     &amp;lt;cfoutput query=&amp;quot;ImageList&amp;quot; startrow=&amp;quot;#randImageNum#&amp;quot; maxrows=&amp;quot;1&amp;quot;&amp;gt;         &amp;lt;img src=&amp;quot;./images/mainpic/#ATTRIBUTES.MainPicDir#/#ImageList.name#&amp;quot; /&amp;gt;     &amp;lt;/cfoutput&amp;gt;     &amp;lt;/cfif&amp;gt; &lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt; 15.    In the previous code, what is does ATTRIBUTES.MainPicDir stand for? What does the ATTRIBUTES scope for this variable mean?&lt;/p&gt;</description><pubDate>Tue, 11 Mar 2008 15:44:00 GMT</pubDate><guid>http://think.instantspot.com/blog/2008/03/11/ColdFusion-Test</guid><category>ColdFusion,test</category></item><item><title>Handleing Results in Model-Glue </title><link>http://think.instantspot.com/blog/2008/03/10/Handleing-Results-in-ModelGlue-</link><description>&lt;p&gt;Ok I am not the world&amp;rsquo;s best blogger but I am going to give a shot.  So I am working on a &lt;a href=&quot;http://model-glue.com&quot;&gt;Model-Glue&lt;/a&gt; Application that I started about a year and a half ago.  And I am finally starting to reuse some of my functions.  For example I have a saveUserAddress function and a saveUserAccount function and in both of these function&amp;rsquo;s I add result named success if there wasn&amp;rsquo;t an error.  So here is the problem, we adding a new feature that allows a user to setup a new address and a new account on the same screen but in &lt;a href=&quot;http://model-glue.com&quot;&gt;Model-Glue&lt;/a&gt; if there is a result the next function will not be called. So to fix this problem I added an argument to the message in the modelglue.xml file like so.&lt;br /&gt; &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;message name=&amp;quot;SaveUserAddress&amp;quot;&amp;gt;     &amp;lt;argument name=&amp;quot;addResult&amp;quot; value=&amp;quot;false&amp;quot; /&amp;gt; &amp;lt;/message&amp;gt; &amp;lt;message name=&amp;quot;SaveUserAccount&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt; &lt;br /&gt; Then in the controller component I add some logic to account for this.&lt;br /&gt; &lt;br /&gt; &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;cfif arguments.event.ArgumentExists(&amp;quot;addResult&amp;quot;)&amp;gt;     &amp;lt;cfif arguments.event.getValue(&amp;quot;addResult&amp;quot;) EQ true&amp;gt;         &amp;lt;cfset arguments.event.addResult(&amp;quot;success&amp;quot;, true) /&amp;gt;     &amp;lt;/cfif&amp;gt; &amp;lt;/cfif&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;I know there some &lt;a href=&quot;http://www.mach-ii.com&quot;&gt;Mach-II&lt;/a&gt; guys  out there  so I would like to know how you handle this in &lt;a href=&quot;http://www.mach-ii.com&quot;&gt;Mach-II&lt;/a&gt;.&lt;/p&gt;</description><pubDate>Tue, 11 Mar 2008 00:40:00 GMT</pubDate><guid>http://think.instantspot.com/blog/2008/03/10/Handleing-Results-in-ModelGlue-</guid><category>code,ColdFusion,CFC,model-glue</category></item><item><title>Quick CFC Gotcha</title><link>http://think.instantspot.com/blog/2008/03/03/Quick-CFC-Gotcha</link><description>&lt;p&gt;Lets say you have a bean for an employee and it has getFirstName and setFirstName and lets you forget to put parenthesis like this &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;input type=&amp;quot;Text&amp;quot; name=&amp;quot;firstname&amp;quot; id=&amp;quot;firstname&amp;quot; value=&amp;quot;&amp;lt;cfoutput&amp;gt;#employeeBean.getFirstname#&amp;lt;/cfoutput&amp;gt;&amp;quot; /&amp;gt; &lt;/pre&gt;&lt;/div&gt; at then end when calling getFirstName you might expect to get an error but you wont you will get this &lt;div class=&quot;code&quot; &gt;&lt;pre&gt;&amp;lt;input type=&amp;quot;Text&amp;quot; name=&amp;quot;firstname&amp;quot; id=&amp;quot;firstname&amp;quot; value=&amp;quot;cfemployee2ecfc490364409$funcGETFIRSTNAME@25a2fe&amp;quot; /&amp;gt;&lt;/pre&gt;&lt;/div&gt; I am not sure why so if anyone knows why please leave a comment.&lt;/p&gt;</description><pubDate>Mon, 03 Mar 2008 14:50:00 GMT</pubDate><guid>http://think.instantspot.com/blog/2008/03/03/Quick-CFC-Gotcha</guid><category>code,ColdFusion,CFC</category></item><item><title>I am moving over .</title><link>http://think.instantspot.com/blog/2008/02/29/I-am-moving-over-</link><description>&lt;p&gt;I am moving my over to instantspot.&lt;/p&gt;</description><pubDate>Fri, 29 Feb 2008 06:06:00 GMT</pubDate><guid>http://think.instantspot.com/blog/2008/02/29/I-am-moving-over-</guid><category>General</category></item></channel></rss>