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

<channel>
	<title>#Adam.Blog# &#187; Dumbass</title>
	<atom:link href="http://blog.adampresley.com/tag/dumbass/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.adampresley.com</link>
	<description>I&#039;m bringin&#039; nerdy back.</description>
	<lastBuildDate>Fri, 03 Sep 2010 15:59:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<atom:link rel="hub" href="http://pubsubhubbub.appspot.com"/><atom:link rel="hub" href="http://superfeedr.com/hubbub"/><atom:link rel="hub" href="http://github.com/tonyg/rabbithub"/>		<item>
		<title>Dumbass Code of the Day &#8211; 10/08/2009</title>
		<link>http://blog.adampresley.com/2009/dumbass-code-of-the-day-10082009/</link>
		<comments>http://blog.adampresley.com/2009/dumbass-code-of-the-day-10082009/#comments</comments>
		<pubDate>Thu, 08 Oct 2009 22:55:17 +0000</pubDate>
		<dc:creator>Adam Presley</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Dumbass]]></category>

		<guid isPermaLink="false">http://blog.adampresley.com/?p=605</guid>
		<description><![CDATA[Welcome to another edition of &#8220;Dumbass Code&#8221;. Here&#8217;s a snippet that&#8217;s fun. This bit of code gets a list of product IDs, iterates over them, and if the product ID is greater than zero, and less than 999,999 then it is a &#8220;special&#8221; type of product and is not counted. In this case a &#8220;special&#8221; [...]


Related posts:<ol><li><a href='http://blog.adampresley.com/2009/dumbass-code-of-the-week-10052009/' rel='bookmark' title='Permanent Link: Dumbass Code of the Week &#8211; 10/05/2009'>Dumbass Code of the Week &#8211; 10/05/2009</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Welcome to another edition of &#8220;Dumbass Code&#8221;. Here&#8217;s a snippet that&#8217;s fun. This bit of code gets a list of product IDs, iterates over them, and if the product ID is greater than zero, and less than 999,999 then it is a &#8220;special&#8221; type of product and is not counted. In this case a &#8220;special&#8221; product is a shipping record, or handling, etc&#8230; And &#8220;not counted&#8221; is done by using the listRest ColdFusion method to remove an item. I hadn&#8217;t even HEARD of this method till now, and it turns out that it just removes the first element from a list. Okaaaayyy&#8230;</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!-- this gets a count of actual products --&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> prodlist <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">ValueList</span><span style="color: #0000FF;">&#40;</span>getProds.product_id<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> <span style="color: #0000FF;">listlen</span><span style="color: #0000FF;">&#40;</span>prodlist<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">gt</span> <span style="color: #FF0000;">0</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfloop</span> <span style="color: #0000FF;">index</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;thisprodid&quot;</span> <span style="color: #0000FF;">list</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#prodlist#&quot;</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> <span style="color: #FF0000;">999999</span> <span style="color: #0000FF;">lt</span> <span style="color: #0000FF;">evaluate</span><span style="color: #0000FF;">&#40;</span>thisprodid<span style="color: #0000FF;">&#41;</span> or <span style="color: #0000FF;">evaluate</span><span style="color: #0000FF;">&#40;</span>thisprodid<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">lt</span> <span style="color: #FF0000;">0</span> <span style="color: #0000FF;">&gt;</span></span>
			<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> prodlist <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">listrest</span><span style="color: #0000FF;">&#40;</span>prodlist<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfloop</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> numprods <span style="color: #0000FF;">=</span> <span style="color: #0000FF;">listlen</span><span style="color: #0000FF;">&#40;</span>prodlist<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>


<p>Kind of odd eh? Seems like a lot of unnecessary processing to just get a count. How about something like this?</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Get a count of actual products ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> numProducts <span style="color: #0000FF;">=</span> <span style="color: #FF0000;">0</span> <span style="color: #0000FF;">/&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfloop</span> <span style="color: #0000FF;">query</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;getProds&quot;</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> getProds.product_id <span style="color: #0000FF;">GT</span> <span style="color: #FF0000;">0</span> <span style="color: #0000FF;">&amp;&amp;</span> getProds.product_id <span style="color: #0000FF;">LT</span> <span style="color: #FF0000;">999999</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> numProducts++ <span style="color: #0000FF;">/&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfloop</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>


<p>Hmmm.</p>


<p>Related posts:<ol><li><a href='http://blog.adampresley.com/2009/dumbass-code-of-the-week-10052009/' rel='bookmark' title='Permanent Link: Dumbass Code of the Week &#8211; 10/05/2009'>Dumbass Code of the Week &#8211; 10/05/2009</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.adampresley.com/2009/dumbass-code-of-the-day-10082009/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Dumbass Code of the Week &#8211; 10/05/2009</title>
		<link>http://blog.adampresley.com/2009/dumbass-code-of-the-week-10052009/</link>
		<comments>http://blog.adampresley.com/2009/dumbass-code-of-the-week-10052009/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 22:06:19 +0000</pubDate>
		<dc:creator>Adam Presley</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Dumbass]]></category>

		<guid isPermaLink="false">http://blog.adampresley.com/?p=601</guid>
		<description><![CDATA[Today&#8217;s Dumbass Code of the Week is brought to you by code from my current job. This code, written circa 2002, is real, and has not been modified or harmed in any way during the posting of this blog entry. Are you ready for it?? 1 2 3 4 5 6 7 8 9 10 [...]


Related posts:<ol><li><a href='http://blog.adampresley.com/2009/dumbass-code-of-the-day-10082009/' rel='bookmark' title='Permanent Link: Dumbass Code of the Day &#8211; 10/08/2009'>Dumbass Code of the Day &#8211; 10/08/2009</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<p>Today&#8217;s <strong>Dumbass Code of the Week</strong> is brought to you by code from my current job. This code, written circa 2002, is real, and has not been modified or harmed in any way during the posting of this blog entry. Are you ready for it??</p>


<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
</pre></td><td class="code"><pre class="cfm" style="font-family:monospace;">	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> <span style="color: #0000FF;">Find</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;@&quot;</span>, attributes.sEmail<span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">GT</span> <span style="color: #FF0000;">0</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfif</span> <span style="color: #0000FF;">Find</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;.&quot;</span>, attributes.sEmail, <span style="color: #0000FF;">Find</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;@&quot;</span>, attributes.sEmail<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">GT</span> <span style="color: #0000FF;">Find</span><span style="color: #0000FF;">&#40;</span><span style="color: #009900;">&quot;@&quot;</span>, attributes.sEmail<span style="color: #0000FF;">&#41;</span><span style="color: #0000FF;">&gt;</span></span>
			<span style="color: #808080; font-style: italic;">&lt;!--- Set the Message the user will see if the process does not succed. ---&gt;</span>
			<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> UserMessage <span style="color: #0000FF;">=</span> <span style="color: #009900;">&quot;&lt;p&gt;A password could not be found for the email address #attributes.sEmail#.&lt;/p&gt;&quot;</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfelse</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
			<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> attributes.sEmail <span style="color: #0000FF;">=</span> <span style="color: #009900;">&quot;Invalid Email Address&quot;</span><span style="color: #0000FF;">&gt;</span></span>
			<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> UserMessage <span style="color: #0000FF;">=</span> <span style="color: #009900;">&quot;&lt;p&gt;Invalid Email Address.&lt;/p&gt;&quot;</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfelse</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> attributes.sEmail <span style="color: #0000FF;">=</span> <span style="color: #009900;">&quot;Invalid Email Address&quot;</span><span style="color: #0000FF;">&gt;</span></span>
		<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> UserMessage <span style="color: #0000FF;">=</span> <span style="color: #009900;">&quot;&lt;p&gt;Invalid Email Address.&lt;/p&gt;&quot;</span><span style="color: #0000FF;">&gt;</span></span>
	<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfif</span><span style="color: #0000FF;">&gt;</span></span></pre></td></tr></table></div>


<p>Take a good long look at it. What will the outcome of this &#8220;Lost Password&#8221; functionality be? Mmmmm, tasty.</p>


<p>Related posts:<ol><li><a href='http://blog.adampresley.com/2009/dumbass-code-of-the-day-10082009/' rel='bookmark' title='Permanent Link: Dumbass Code of the Day &#8211; 10/08/2009'>Dumbass Code of the Day &#8211; 10/08/2009</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://blog.adampresley.com/2009/dumbass-code-of-the-week-10052009/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
