<?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/"
	xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Sid's FishNet</title>
	<atom:link href="http://sidfishes.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://sidfishes.wordpress.com</link>
	<description>Where Coldfusion Is Usually The Catch Of The Day</description>
	<lastBuildDate>Fri, 29 May 2009 20:10:15 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='sidfishes.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/e6f0a38f4dbe3f38c5dc6c6e6883c4f9?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Sid's FishNet</title>
		<link>http://sidfishes.wordpress.com</link>
	</image>
			<item>
		<title>Adding a Twitter Feed To Your Site</title>
		<link>http://sidfishes.wordpress.com/2009/05/29/adding-a-twitter-feed-to-your-site/</link>
		<comments>http://sidfishes.wordpress.com/2009/05/29/adding-a-twitter-feed-to-your-site/#comments</comments>
		<pubDate>Fri, 29 May 2009 19:50:16 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=79</guid>
		<description><![CDATA[With CF8 and the cffeed it&#8217;s easy to add a feed of your tweets to your site. I&#8217;ve found this is a really good way of getting followers on Twitter. I&#8217;ve used cfpod and cffeed below
I like to style my cfpod&#8217;s but IE (at least to IE7 and as per usual)  has &#8220;issues&#8221; so i [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=79&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>With CF8 and the cffeed it&#8217;s easy to add a feed of your tweets to your site. I&#8217;ve found this is a really good way of getting followers on Twitter. I&#8217;ve used cfpod and cffeed below</p>
<p>I like to style my cfpod&#8217;s but IE (at least to IE7 and as per usual)  has &#8220;issues&#8221; so i just do a browser sniff and use a couple of variables to make the pod look the same in all browsers</p>
<div style="font-weight:normal;padding-left:30px;">&lt;CFIF FindNoCase(&#8220;msie&#8221;, CGI.HTTP_USER_AGENT, &#8220;1&#8243;)&gt;<br />
&lt;CFSET podstyle = &#8220;color:##000000;text-align:center&#8221;&gt;<br />
&lt;CFSET podHT = &#8220;75&#8243;&gt;<br />
&lt;CFELSE&gt;<br />
&lt;CFSET podstyle = &#8220;color:##FFFFCC;background-color:##6699CC;text-align:center&#8221;&gt;<br />
&lt;CFSET podHT = &#8220;65&#8243;&gt;<br />
&lt;/CFIF&gt;<br />
&lt;cfpod headerStyle=&#8221;#podStyle#&#8221;   name=&#8221;twitpod&#8221; height=&#8221;#podHT#&#8221; width=&#8221;290&#8243; title=&#8221;Me On Twitter &#8211; Latest&#8221;&gt;<br />
&lt;div style=&#8221;font-weight:normal;&#8221;&gt;<br />
&lt;cfset feedurl=&#8221;http://search.twitter.com/search.atom?q=yourTwitterName -@yourTwitterName&#8221; /&gt;<br />
&lt;cffeed source=&#8221;#feedurl#&#8221; properties=&#8221;feedmeta&#8221; query=&#8221;feeditems&#8221; /&gt;<br />
&lt;cfoutput query=&#8221;feeditems&#8221; maxrows=&#8221;1&#8243;&gt;<br />
&lt;span style=&#8221;font-size:.7em;margin-top:-5px;&#8221;&gt;<br />
#dateformat(listfirst(feeditems.publisheddate,&#8221;T&#8221;), &#8220;mm/dd/yy :hh:mm&#8221;)#<br />
&lt;/span&gt;<br />
&lt;span style=&#8221;font-size:.8em;&#8221;&gt;<br />
#REReplaceNoCase(feeditems.Content, &#8220;&lt;[^&gt;]*&gt;&#8221;, &#8220;&#8221;, &#8220;All&#8221;)#&lt;br&gt;<br />
&lt;/span&gt;<br />
&lt;/cfoutput&gt;<br />
&lt;a href = &#8220;http://twitter.com/yourTwitterName&#8221; style=&#8221;text-decoration:underline;&#8221; target=&#8221;_blank&#8221;&gt;Subscribe To My Twitter Feed&lt;/a&gt;<br />
&lt;/div&gt;<br />
&lt;/cfpod&gt;</div>
<p>My twitter account is a corporate presence so I don&#8217;t want other people&#8217;s tweets showing on my site.  If you were just to set your feed url to</p>
<p>http://search.twitter.com/search.atom?q=yourTwitterName</p>
<p>you would get all hits for yourTwitterName, even those posts from others who are @replying to you.  This might not be an issue for some I want to make sure only -my- tweets show up in the feed. Just add</p>
<p>-@yourTwitterName</p>
<p>to the search.atom criteria and this will exclude any @yourTwitterName search results</p>
<p>One other thing you may notice is that I&#8217;ve added a html stripping rereplace funciton.</p>
<p>#REReplaceNoCase(feeditems.Content, &#8220;&lt;[^&gt;]*&gt;&#8221;, &#8220;&#8221;, &#8220;All&#8221;)#</p>
<p>This is a good idea for feeds and any source for which you have no control over. I don&#8217;t want visitors to my site to have any issues with potential attacks propagated through Twitter (or any other service). We&#8217;ve already seen a couple of Twitter &#8220;worms&#8221; and I don&#8217;t need a potential XSS vulnerability introduced on my site. (paranoid..yes but that&#8217;s a -good- thing)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/79/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/79/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/79/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=79&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/05/29/adding-a-twitter-feed-to-your-site/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Protect your admin interface.</title>
		<link>http://sidfishes.wordpress.com/2009/05/26/protect-your-admin-interface/</link>
		<comments>http://sidfishes.wordpress.com/2009/05/26/protect-your-admin-interface/#comments</comments>
		<pubDate>Tue, 26 May 2009 17:08:23 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=75</guid>
		<description><![CDATA[Just a quickie today.
Many websites require an admin interface to handle the public facing areas of  the site. While these can and should be protected with -strong- passwords, as a web developer we always want to provide an attacker with the smallest possible &#8220;attack surface&#8221;. What an attacker can&#8217;t access, they can&#8217;t hack*.
You can make [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=75&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Just a quickie today.</p>
<p>Many websites require an admin interface to handle the public facing areas of  the site. While these can and should be protected with -strong- passwords, as a web developer we always want to provide an attacker with the smallest possible &#8220;attack surface&#8221;. What an attacker can&#8217;t access, they can&#8217;t hack*.</p>
<p>You can make a simple change to the application.cfm/cfc file of your admin interface to provide a greater level of security.</p>
<p><code>&lt;cfswitch expression="#cgi.REMOTE_ADDR#"&gt;<br />
&lt;cfcase value="123.45.67.89"&gt;</code></p>
<p>&#8211; all your application.cfm code &#8211;</p>
<p>&lt;/cfcase&gt;</p>
<p>&lt;cfdefaultcase&gt;</p>
<p>&lt;cflocation url=&#8221;yourpublicfacingpage.cfm&#8221; addtoken=&#8221;no&#8221;&gt;</p>
<p>&lt;/cfdefaultcase&gt;</p>
<p>&lt;/cfswitch&gt;</p>
<p>This limits access to your admin site to a single IP address. You could hard code this if it&#8217;s your site or you could make it a variable and read  from an ini file where a client sets the value.</p>
<p>If you want to allow access from multiple IPs just create a list</p>
<p>&lt;cfcase value=&#8221;<code>123.45.67.89</code>, <code>123.45.65.90</code>&#8221; delimiters=&#8221;,&#8221;&gt;</p>
<p>To use this in application.cfc, just add the code to onRequestStart</p>
<p>* It&#8217;s important to note that this is -not- foolproof since cgi variables -can- be spoofed. There is some debate on whether remote_addr can be spoofed but since security best practice -always- assumes the worst, make sure you&#8217;ve got a nice, strong password to protect your admin interface.</p>
<p>Extra tip:</p>
<p>Use a strong -Username- as well as a strong password. It&#8217;s an awful lot harder to brute force attack a website with a username that won&#8217;t likley be found in a dictionary or by social engineering/target research</p>
<p>If your name is  Frank make your username Fr4an8k . This way an attacker has to figure our what the Uname is before even starting on the pwd. Most will simply move on. (and never, ever use a username such as &#8220;admin&#8221;)</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/75/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/75/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/75/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=75&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/05/26/protect-your-admin-interface/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>CF, XSS &amp; SQLi &#8211; Keeping Your Users Safe</title>
		<link>http://sidfishes.wordpress.com/2009/03/17/60/</link>
		<comments>http://sidfishes.wordpress.com/2009/03/17/60/#comments</comments>
		<pubDate>Tue, 17 Mar 2009 20:20:30 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[cfqueryparam]]></category>
		<category><![CDATA[exploit]]></category>
		<category><![CDATA[global script protection]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[SQL Injection]]></category>
		<category><![CDATA[XSS]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=60</guid>
		<description><![CDATA[I&#8217;ve recently been thinking a lot (more) about web security, specifically XSS (Cross Site Scripting) and SQLi (SQL injection). Coldfusion is one of, if not the easiest, web scripting language to code securely. Straight out of the box, it&#8217;s harder to run an SQLi attack against than most. (please&#8230; I said harder, not impossible)
here&#8217;s a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=60&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;ve recently been thinking a lot (more) about web security, specifically XSS (Cross Site Scripting) and SQLi (SQL injection). Coldfusion is one of, if not the easiest, web scripting language to code securely. Straight out of the box, it&#8217;s harder to run an SQLi attack against than most. (please&#8230; I said harder, not impossible)</p>
<p>here&#8217;s a pretty good discussion about this with several of the top CF &#8220;experts&#8221; at <a href="http://www.experts-exchange.com/Database/MySQL/Q_22479194.html">EE</a></p>
<p>Bottom line for a CF coder is that using cfqueryparam will eliminate your SQLi risk. It&#8217;s an Adobe recommended best practice</p>
<blockquote><p>Adobe recommends that you use the cfqueryparam tag within every cfquery tag, to help secure your databases from unauthorized users. For more information, see Security Bulletin ASB99-04, &#8220;Multiple SQL Statements in Dynamic Queries,&#8221; in the Security Zone, www.adobe.com/devnet/security/security_zone/asb99-04.html, and &#8220;Accessing and Retrieving Data&#8221;  in the ColdFusion Developer&#8217;s Guide.</p></blockquote>
<p>From LiveDocs</p>
<p>and you&#8217;re <a href="http://www.thetechherald.com/article.php/200909/3034/Report-SQL-Injection-attacks-compromised-500-000-sites-in-2008">crazy</a> not to use it.</p>
<p>You may actually see a performance boost using it as well.</p>
<blockquote><p>If the DBMS doesn&#8217;t have to parse, analyze, and validate as much text, it&#8217;ll be able to respond to requests quicker and more efficiently</p></blockquote>
<p><a href="http://www.adobe.com/devnet/coldfusion/articles/ben_forta_faster.html">Faster and Safer Queries Using The cfqueryparam tag</a></p>
<p>However, just because you use cfqueryparam don&#8217;t get smug. You still may be vulnerable to exploits. XSS is harder to deal with and while CF does have some built in protection you can enable, it doesn&#8217;t protect you in all cases.</p>
<p>In CF8 (and maybe CF7..I can&#8217;t remember) CFadmin has a Server Settings &gt; Settings &gt; Enable Global Script Protection.</p>
<p>This is to &#8220;Specify whether to protect Form, URL, CGI, and Cookie scope variables from cross-site scripting attacks&#8221;. Sounds great. Check that box and your done. Safe and sound? Not so much.</p>
<p>Submit the following form with Global Script Protection (GSP) disabled. You should see an alert box which means you&#8217;re hax0red. Enable GSP and you won&#8217;t get the alert and you&#8217;re safe. However, while GSP is good for protecting against js hacks like alert(&#8216;Gotcha?&#8217;) it -won&#8217;t- do anything to protect you against an iFrame attack. I&#8217;ve simulated one here using a visible iFrame, an actual iFrame used in an attack would be hidden. You&#8217;ll notice that the injected iFrame shows up whether GSP is enabled or not. This is because an iFrame is not actually a &#8220;script&#8221; so it&#8217;s not filtered. To fix this we need to strip html tags from input (which you should never allow to be submitted in any case) by using reReplaceNoCase and the regex &lt;[^&gt;]*&gt;</p>
<p>As you can see, this eliminates the iFrame issue. This also defeats the JS inject issue as well even without GSP enabled.</p>
<p>&lt;cfoutput&gt;<br />
&lt;cfif structkeyexists(form, &#8220;f1&#8243;)&gt;<br />
&lt;div style=&#8221;margin:50px;padding:35px;border:1px solid;width:350px;&#8221;&gt;<br />
Did you see the JS Alert???&lt;br&gt;<br />
#form.f1#<br />
&lt;/div&gt;<br />
&lt;/cfif&gt;<br />
&lt;cfif structkeyexists(form, &#8220;f2&#8243;)&gt;<br />
&lt;cfset myvar = rereplacenocase(form.f2,&#8221;&lt;[^&gt;]*&gt;&#8221;, &#8220;&#8221;, &#8220;All&#8221;)&gt;<br />
&lt;div style=&#8221;margin:50px;padding:35px;border:1px solid;width:350px;&#8221;&gt;<br />
#myvar#<br />
&lt;/div&gt;</p>
<p>&lt;/cfif&gt;<br />
&lt;cfif structkeyexists(form, &#8220;f3&#8243;)&gt;<br />
&lt;div style=&#8221;margin:50px;padding:35px;border:1px solid;width:350px;&#8221;&gt;<br />
I&#8217;m an injected iframe&lt;br&gt;<br />
#form.f3#&lt;br&gt;<br />
That&#8217;s bad ;(<br />
&lt;/div&gt;<br />
&lt;/cfif&gt;<br />
&lt;cfif structkeyexists(form, &#8220;f4&#8243;)&gt;<br />
&lt;cfset myvar = rereplacenocase(form.f4,&#8221;&lt;[^&gt;]*&gt;&#8221;, &#8220;&#8221;, &#8220;All&#8221;)&gt;<br />
&lt;div style=&#8221;margin:50px;padding:35px;border:1px solid;width:350px;&#8221;&gt;<br />
No iframe here<br />
#myvar#<br />
&lt;/div&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cfoutput&gt;<br />
&lt;hr&gt;<br />
&lt;div style=&#8221;margin:50px;padding:35px;border:1px solid;width:350px;&#8221;&gt;<br />
&lt;h2&gt;XSS Demo&lt;/h2&gt;&lt;br&gt;<br />
&lt;form name=&#8221;1&#8243; method=&#8221;post&#8221; action=&#8221;index.cfm&#8221;&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;f1&#8243; value=&#8221;&lt;script&gt;alert(&#8216;Gotcha?&#8217;)&lt;/script&gt;&#8221;&gt;&lt;br&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;f2&#8243; value=&#8221;&lt;script&gt;alert(&#8216;I am harmless&#8217;)&lt;/script&gt;&#8221;&gt;&lt;br&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;f3&#8243; value=&#8221;&lt;iframe src=http://www.google.com style=width:200px;height:200px;font-size:.7em&gt;&lt;/iframe&gt;&#8221;&gt;&lt;br&gt;<br />
&lt;input type=&#8221;text&#8221; name=&#8221;f4&#8243; value=&#8221;&lt;iframe src=http://www.google.com style=width:200px;height:200px;font-size:.7em&gt;&lt;/iframe&gt;&#8221;&gt;&lt;br&gt;<br />
&lt;input type=&#8221;submit&#8221;&gt;<br />
&lt;/form&gt;</p>
<p>&lt;/div&gt;</p>
<p>I&#8217;ve got a couple of free tools to recommend as well.<br />
<a href="http://www.cfwebstore.com/index.cfm?fuseaction=page.download&amp;downloadID=18"><br />
SQL Injection Blocker v.3</a> by Mary Jo Sminkey</p>
<p>This is a &#8220;blacklist&#8221; tag which looks at common CGI variables and checks them for common SQLi keywords like insert|delete|select|update etc and for other nasty bits which don&#8217;t belong in form submits. You just cfinclude it in application.cfm or cfc and it should head off most attacks. Note:this is -not- meant as a replacement for everything I&#8217;ve outlined above. It&#8217;s an added layer.</p>
<p>I figure it&#8217;s a good idea to find out if a site is under attack ASAP so I customized blocker.cfm by adding a log variable to each cgi variable section<br />
ie:<br />
log =url;<br />
log =form;<br />
etc</p>
<p>and then output the log as well as a cgi.remote_addr (attacker IP) in a cfmail which gets sent to me via SMS when blocker intercepts a hack attempt. This gives me the time, remote ip and details of the hack.</p>
<p>Another set of tools I just came across and really like are the ExploitMe plugins for firefox from <a href="http://www.securitycompass.com/exploitme.shtml">Security Compass</a> They do SQLi, XSS and Access Control Checking</p>
<p>You can also use HP Lab&#8217;s <a href="https://h30406.www3.hp.com/campaigns/2008/wwcampaign/1-57C4K/index.php?mcc=DNXA&amp;jumpid=in_r11374_us/en/large/tsg/w1_0908_scrawlr_redirect/mcc_DNXA">scrawlr</a> for SQLi</p>
<p>If you have already been hacked with a SQLi attack you can use <a href="http://www.owasp.org/index.php/Category:OWASP_Scrubbr">scrubbr</a> from OWASP.org  to help sanitize your db.</p>
<p>Take Out? Always use cfqueryparam, always use rereplacenocase to remove html and test, test, test.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/60/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=60&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/03/17/60/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating User Feedback With CFWindow</title>
		<link>http://sidfishes.wordpress.com/2009/02/12/creating-user-feedback-with-cfwindow/</link>
		<comments>http://sidfishes.wordpress.com/2009/02/12/creating-user-feedback-with-cfwindow/#comments</comments>
		<pubDate>Thu, 12 Feb 2009 17:14:38 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[cfwindow]]></category>
		<category><![CDATA[error messages]]></category>
		<category><![CDATA[EXT javascript]]></category>
		<category><![CDATA[Window.create]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=53</guid>
		<description><![CDATA[I hate javascript alert(&#8216;boxes&#8217;). They&#8217;re boring, ugly and a lousy way to do user feedback. I recently put together the following demonstration of a more elegant system to present error message and feedback to user based on the coldfusion CFWindow tag. If you&#8217;ve never used CFwindow before, this tag automagically creates a div which can [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=53&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I hate javascript alert(&#8216;boxes&#8217;). They&#8217;re boring, ugly and a lousy way to do user feedback. I recently put together the following demonstration of a more elegant system to present error message and feedback to user based on the coldfusion CFWindow tag. If you&#8217;ve never used CFwindow before, this tag automagically creates a div which can be populated with pretty much anything; dynamic data, images, even flash.</p>
<p>One thing to note about this code is that nowhere in the code will you actually see &lt;cfwindow&#8230;&gt; which is the tag  built-in to Coldfusion. the CFWindow tag is very simple to use but in order to make your app really stand out, we need to get into the API which is built from the amazing <a href="http://extjs.com/">EXT javascript library</a> This allows us to dynamically set the window size, change the header style of the window and much more.</p>
<p>Have a look at the code. I&#8217;ve commented a lot (for me anyways) throughout the code so it should be fairly straightforward.</p>
<p>One note of warning. WordPress likes to mess with some of the text in and especially &#8221; quotes even using the code tag so this may require a bit of cleaning up after you cut and paste.<br />
<code><br />
&lt;!---<br />
Error &amp; Messages 2.0</p>
<p>PreReqs: CF8, Basic Knowledge of CFWindow and java_script<br />
Database not required<br />
Files required: index.cfm (This file) and msgWindow.cfm</p>
<p>contents of msgWindow.cfm</p>
<p>&lt;cfoutput&gt;<br />
&lt;!--- displays the content of url.msg which is passed in the ColdFusion.Window.create call ---&gt;<br />
&lt;span style="font-size:.8em;font-family:tahoma;"&gt;<br />
#url.msg#<br />
&lt;/span&gt;<br />
&lt;/cfoutput&gt;</p>
<p>Both files must be in the same directory.</p>
<p>Description<br />
java_script alert() messages are so turn of the century. This tutorial uses CFwindow to create custom error and informational messages. The main function is showMsg() which creates the window and takes several parameters to set up how it looks and what messages are displayed. Unlike basic usage of the cfwindow tag, this uses the Coldfusion AJAX API (via cfajaximport) to create windows at runtime (so you don't have to know how they're going to look or  what they'll contain in advance)</p>
<p>We also take advantage of changing styles of the cf window (didn't know you could do that?) to provide appropriate visual cues for the user.</p>
<p>Since we are creating the window at runtime, it gives us the opportunity to automagically resize the window to fit our message text. This is something you can't do with the simple cfwindow tag as you have to hard code the window size in advance and it can look a bit clunky as a one size fits all message box.</p>
<p>The simplest usage of this function is</p>
<p>function sayHello(){<br />
var d = new Date();<br />
var msg = 'Hello World';<br />
var wid = d.getMinutes()+d.getSeconds();<br />
showMsg(wid, 'Message',msg, 75,400);<br />
}</p>
<p>You can use this on any page to call a window. You can put pretty much anything in the message including html<br />
---&gt;<br />
&lt;!--- index.cfm ---&gt;<br />
&lt;!--- import the cfwindow tag so we can call via ColdFusion.Window.create at runtime ---&gt;<br />
&lt;CFAJAXIMPORT TAGS="cfwindow"&gt;<br />
&lt;html&gt;<br />
&lt;head&gt;<br />
&lt;style ="text/css"&gt;<br />
/*change the default cfwindow style and make the header text red*/<br />
.errHdr { background: url(/CFIDE/scripts/ajax/resources/ext/images/default/layout/panel-title-greylight-bg.gif) repeat-x ;<br />
color:#ff0000;<br />
font:normal 11px tahoma, verdana, helvetica;<br />
text-align: center;<br />
padding:5px;<br />
font-weight:bold;}<br />
.x-dlg .x-dlg-close {<br />
background-image: url(/CFIDE/scripts/ajax/resources/ext/images/default/basic-dialog/close.gif);<br />
}<br />
/*change the default cfwindow style*/<br />
.msgHdr { background: url(/CFIDE/scripts/ajax/resources/ext/images/default/layout/panel-title-greylight-bg.gif) repeat-x ;<br />
color:#000;<br />
font:normal 11px tahoma, verdana, helvetica;<br />
text-align: center;<br />
padding:5px;<br />
font-weight:bold;}<br />
.x-dlg .x-dlg-close {<br />
background-image: url(/CFIDE/scripts/ajax/resources/ext/images/default/basic-dialog/close.gif);<br />
}<br />
&lt;/style&gt;</p>
<p>&lt;script type="text/javascript"&gt;<br />
function showMsg(){<br />
//create the window<br />
//param 1 = showMsg.arguments[0] (wid)<br />
//param 2 = showMsg.arguments[1]  (header text)<br />
//param 3 = windowurl and showMsg.arguments[2](msg variable)<br />
//cfwindowparams {height:showMsg.arguments[3],width:showMsg.arguments[4]<br />
// the other params can be hardcoded since we want error messages to be modal and closeable.<br />
//(you could expand this technique to have even more control if you want)<br />
ColdFusion.Window.create("myWindow"+showMsg.arguments[0], showMsg.arguments[1], "msgWindow.cfm?msg=" + showMsg.arguments[2], {height:showMsg.arguments[3],width:showMsg.arguments[4],modal:true,closable:true, draggable:false,resizable:false,center:true,initshow:true,refreshOnShow:true});<br />
//apply styles based on header message<br />
///you could have as many styles as you want and use a switch block instead of if else<br />
if(showMsg.arguments[1]=='Error Message')<br />
{<br />
document.getElementById(ColdFusion.Window.getWindowObject("myWindow"+showMsg.arguments[0]).header.id).className = "errHdr";<br />
}<br />
else{<br />
document.getElementById(ColdFusion.Window.getWindowObject("myWindow"+showMsg.arguments[0]).header.id).className = "msgHdr";<br />
}<br />
// clear window objectCache<br />
ColdFusion.objectCache["myWindow"+showMsg.arguments[0]] = null;<br />
}</p>
<p>function showHelp()<br />
//this is the basic info box. A slighlty more advanced version of hello world<br />
{<br />
var d = new Date()<br />
var msg = 'This displays an informational message. You can populate this statically, from a db on page load or via an ajax call.'<br />
msg = msg + ' Notice how the header style of the CFWindow changes based on param 2 of the showMsgjava_script call'<br />
msg = msg + ' You can even include html, links and images &lt;div&gt; &lt;a href=\"http://fusebox.org\"&gt;Get Fusebox&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;img src=\"http://fusebox.org/css/images/fuseboxlogo.gif\" style=\"width:300px;\"&gt;&lt;/div&gt;'<br />
msg=msg + ' &lt;br&gt; just rememberjava_script wants you to escape the double quotes with a front slash \\"'<br />
var wid = d.getMinutes()+d.getSeconds()<br />
showMsg(wid, 'Help Window',msg, 275,450);</p>
<p>}</p>
<p>function checkField()<br />
//this function checks for a value in a form field and pops up an error if none exists<br />
//&lt;standard rant&gt; Remember! Client side validation is a convenience and not a security decision.<br />
//Always use sever side validation and cfqueryparam &lt;/standard rant&gt;<br />
{<br />
if (document.getElementById('testField').value=='')<br />
{<br />
var d = new Date()<br />
var msg = 'Please Enter A Value.'<br />
msg = msg + ' You can use this for client side error checking, ajax return errors etc. '<br />
msg = msg + 'Notice the change in header based on the style errHdr. You can populate this statically like we are doing here, from a db on page load or via an ajax call.'</p>
<p>var wid = d.getMinutes()+d.getSeconds()<br />
showMsg(wid, 'Error Message',msg, 130,400);<br />
return false;}<br />
else<br />
{<br />
return true;<br />
}<br />
}</p>
<p>function showWindowResize(theVal)<br />
{<br />
//This function show how we can dynamically fit the window to the message<br />
//for simplicity we'll just set up a single long msg string. In real life you'd probably be pulling various length'ed<br />
//strings from a db<br />
var msg = 'This displays an informational message. You can populate this statically, from a db on page load or via an ajax call.'<br />
msg = msg + ' Thejava_script looks at the &lt;span style=\"font-size:1.3em;\"&gt;size&lt;/span&gt; of the string passed and resizes the cfWindow to -fit- (mostly)'<br />
msg = msg + ' Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim'<br />
msg = msg + ' veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. '<br />
msg = msg + ' Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. '<br />
msg = msg + ' Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum'<br />
msg = msg + ' &lt;strong&gt;Neque porro quisquam est&lt;/strong&gt;, qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit, sed quia non numquam'<br />
msg = msg + ' eius modi tempora incidunt ut labore et dolore magnam aliquam quaerat voluptatem. Ut enim ad minima veniam, quis '<br />
msg = msg + ' nostrum exercitationem ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi consequatur Quis autem '<br />
msg = msg + ' vel eum iure reprehenderit qui in ea voluptate velit esse quam nihil molestiae consequatur, vel illum qui dolorem eum'<br />
msg = msg + ' fugiat quo voluptas nulla pariatur'</p>
<p>//we'll trim the message to various lengths to show how the code resizes the window.<br />
//we're taking the values passed by button onclick event and trimming the string using substr<br />
// you wouldn't usually need this in a standard application.</p>
<p>switch  (theVal){<br />
case 150:<br />
msg = msg.substring(0,120)<br />
break;<br />
case 300:<br />
msg = msg.substring(0,250)<br />
break;<br />
case 500:<br />
msg = msg.substring(0,450)<br />
break;<br />
case 600:<br />
msg = msg.substring(0,550)<br />
break;<br />
case 700:<br />
msg = msg.substring(0,650)<br />
break;<br />
case 800:<br />
msg = msg.substring(0,750)<br />
break;<br />
case 1000:<br />
msg<br />
break;<br />
}<br />
//for the demo we'll get the message length and assign it to a variable to show in the header of the cfwindow<br />
// wouldn't usually be used in an application although it does show how you can add messages to a header<br />
hdr = 'Message Length is ' + msg.length</p>
<p>//determine the length of the msg variable and set the window ehight accordlingly. vHeight will need<br />
//to be adjusted based on your font size, whether you want scroll bars etc.<br />
if(msg.length &lt; 150) {<br />
vHeight = 85;<br />
} else if(msg.length &gt; 149 &amp;&amp; msg.length &lt; 300) {<br />
vHeight = 125;<br />
} else if(msg.length &gt; 299 &amp;&amp; msg.length &lt; 500) {<br />
vHeight = 175;<br />
} else if(msg.length &gt; 499 &amp;&amp; msg.length &lt; 600) {<br />
vHeight = 200;<br />
} else if(msg.length &gt; 599 &amp;&amp; msg.length &lt; 700) {<br />
vHeight = 225;<br />
} else if(msg.length &gt; 699 &amp;&amp; msg.length &lt; 800) {<br />
vHeight = 285;<br />
} else {<br />
vHeight = 400;<br />
}<br />
//variable wid is a timestamp that will help ensure that each window instance is unique to avoid caching issues<br />
var d = new Date()<br />
var wid = d.getMinutes()+d.getSeconds()<br />
//a non-demo would not use the hdr length variable<br />
//showMsg(wid, 'Help Window', vHeight,400);</p>
<p>//this is the main call<br />
//the attributes passed are<br />
//wid = unique timestamp<br />
//header title<br />
//msg = message body<br />
//vHeight = cfwindow height variable<br />
//cfwindow width = 400 could be a variable here as well but is static for this demo<br />
showMsg(wid, 'Help Window ' + hdr, msg, vHeight, 400);<br />
}<br />
&lt;/script&gt;<br />
&lt;/head&gt;<br />
&lt;script  type="text/java_script"&gt;<br />
function sayHello(){<br />
var d = new Date();<br />
var msg = 'Hello World';<br />
var wid = d.getMinutes()+d.getSeconds();<br />
showMsg(wid, 'Message',msg, 75,400);<br />
}</p>
<p>&lt;/script&gt;</p>
<p>&lt;body&gt;</p>
<p>&lt;button onClick="showHelp();"&gt;Help with Image and Link&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(150);"&gt;Show Window Resize 150 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(300);"&gt;Show Window Resize 300 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(500);"&gt;Show Window Resize 500 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(600);"&gt;Show Window Resize 600 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(700);"&gt;Show Window Resize 700 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(800);"&gt;Show Window Resize 800 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;button onClick="showWindowResize(1000);"&gt;Show Window Resize +800 Chars&lt;/button&gt;    &lt;br&gt;<br />
&lt;form method="post" action="index.cfm" onSubmit="return checkField();"&gt;<br />
&lt;input type="text" name="testField" id="testField"&gt;<br />
&lt;input type="submit" value="TestMe Without a Value"&gt;</p>
<p>&lt;/form&gt;<br />
&lt;/body&gt;</p>
<p>&lt;/html&gt;</code></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/53/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/53/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/53/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=53&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/02/12/creating-user-feedback-with-cfwindow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Modifying IIS 6 to allow subdomains using a wildcard ssl certificate to use port 443</title>
		<link>http://sidfishes.wordpress.com/2009/01/23/modifying-iis-6-to-allow-subdomains-using-a-wildcard-ssl-certificate-to-use-port-443/</link>
		<comments>http://sidfishes.wordpress.com/2009/01/23/modifying-iis-6-to-allow-subdomains-using-a-wildcard-ssl-certificate-to-use-port-443/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 15:23:00 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Sides]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[SSL]]></category>
		<category><![CDATA[Wildcard]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=47</guid>
		<description><![CDATA[History: By default, IIS websites cannot use the same SSL port (443) for a site using the same IP address. Websites with different IPs can all use port 443. This situation is typical of a standard SSL certificate which is issued to a single host header (ie: secure.website.com). Any other attempt to connect to a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=47&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>History: By default, IIS websites cannot use the same SSL port (443) for a site using the same IP address. Websites with different IPs can all use port 443. This situation is typical of a standard SSL certificate which is issued to a single host header (ie: secure.website.com). Any other attempt to connect to a site via https through a different host header (ie: www.website.com) causes a certificate error (this is by design).</p>
<p>This becomes an issue when trying to install a wildcard SSL certificate. Wildcard certificates provide the ability to secure all subdomains on the root domain using a single certificate. (*.website.com)  examples:</p>
<p>root domain &#8211; website.com</p>
<p>subdomains -admin.website.com, shop.website.com,etc</p>
<p>However, after you&#8217;ve installed a wildcard certificate and try to set up the subdomain to use SSL port 443, you will receive a Port In Use error. You will not be able to start the subdomain websites with the port set to 443.  The IIS MMC (inetmgr.mmc) does not provide a method of resolving this so you must use the command line. (Start -&gt; Run -&gt; cmd)</p>
<p>You need to determine the site identifier of the subdomain you wish to modify. To determine &lt;site identifier&gt; Open IIS MMC, click on Web Sites and view the Identifier number next to the subdomain website.  In the following script, replace &lt;site identifier&gt; with the number shown in the IIS MMC and change subdomain.website.com to the subdomain you wish to modify.  Run the script with the modifications and you should now be able to browse to https://subdomain.website.com with no error.</p>
<p>cscript.exe c:\inetpub\adminscripts\adsutil.vbs set /w3svc/&lt;site identifer&gt;/SecureBindings &#8220;:443:subdomain.website.com&#8221;</p>
<p>if you have multiple subdomains, you could create a batch file to run the scripts.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=47&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/01/23/modifying-iis-6-to-allow-subdomains-using-a-wildcard-ssl-certificate-to-use-port-443/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>A Coldfusion Who&#8217;s Online Widget</title>
		<link>http://sidfishes.wordpress.com/2009/01/09/a-coldfusion-whos-online-widget/</link>
		<comments>http://sidfishes.wordpress.com/2009/01/09/a-coldfusion-whos-online-widget/#comments</comments>
		<pubDate>Fri, 09 Jan 2009 18:52:42 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[visitor tracking]]></category>
		<category><![CDATA[who's online]]></category>
		<category><![CDATA[Widget]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=42</guid>
		<description><![CDATA[Last week I set up Ray Camden&#8217;s Lighthouse Pro , a open source issue/bug tracking Coldfusion application. We are going to use this internally for project and bug tracking. One bit of functionality I wanted that wasn&#8217;t included was a Who&#8217;s Online function so everyone could see who was using the site at any given [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=42&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Last week I set up Ray Camden&#8217;s <a href="http://lighthousepro.riaforge.org/" target="_blank">Lighthouse Pro</a> , a open source issue/bug tracking Coldfusion application. We are going to use this internally for project and bug tracking. One bit of functionality I wanted that wasn&#8217;t included was a Who&#8217;s Online function so everyone could see who was using the site at any given time. This gives me to opportunity to &#8220;gently&#8221; prod folks who are resistant to using the new program that &#8220;it&#8217;s the way we now do things&#8221;.  Change is hard you know.</p>
<p>This code is not specifically tied to any app and can be dropped in any system using application.cfc.  It would be good for forums, intranets or any other &#8220;social web&#8221; app where knowing who&#8217;s online may be a benefit.</p>
<p>The first bit is to define the struct we are going to use to store the information and to populate it with the newly logged in user.</p>
<p>On thing to note here is that I&#8217;m using a combination of CFID and Username to give me my user_cfid which is the key we are looking for. The reason for this is that we want to be able to allow multiple users with the same name to use the application. If we just keyed on username, the system couldn&#8217;t tell there were more than one and we could see name overlap problems. Because CFID is set with the session, it&#8217;s &#8220;reasonably&#8221; unique, especially when combined with username. For greater overlap prevention or for systems which only use jsessionid&#8217;s, you could use createuuid() intead of CFID.</p>
<p>Application.cfc onRequest in your successful login section<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-</p>
<p>&lt;!&#8212; begin Who&#8217;s Online section &#8212;&gt;<br />
&lt;cfparam name=&#8221;session.whosOnFirst&#8221; default=&#8221;"&gt;<br />
&lt;!&#8212; Test for existence of UserInfo and create if necessary  &#8212;&gt;<br />
&lt;cflock timeout=&#8221;15&#8243; scope=&#8221;APPLICATION&#8221; type=&#8221;EXCLUSIVE&#8221;&gt;<br />
&lt;cfif NOT isDefined(&#8220;Application.UsersInfo&#8221;)&gt;<br />
&lt;cfset Application.UsersInfo = StructNew()&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cflock&gt;<br />
&lt;cfif isDefined(&#8216;form.userName&#8217;)&gt;<br />
&lt;!&#8212; create new user info for the struct &#8212;&gt;<br />
&lt;cflock name=&#8221;#CreateUUID()#&#8221; timeout=&#8221;15&#8243; type=&#8221;EXCLUSIVE&#8221;&gt;<br />
&lt;cfset user_cfid = Evaluate(CFID) &amp; &#8220;,&#8221; &amp; form.userName&gt;<br />
&lt;cfset user_time = Now()&gt;<br />
&lt;/cflock&gt;<br />
&lt;!&#8212; set a session id so we can use it to verify that this session is still active in application.cfm &#8212;&gt;<br />
&lt;cfset session.whosOnFirst = user_cfid&gt;<br />
&lt;cflock scope=&#8221;APPLICATION&#8221; type=&#8221;EXCLUSIVE&#8221; timeout=&#8221;15&#8243;&gt;<br />
&lt;!&#8212; If the user does not exist in the struct, insert it &#8212;&gt;<br />
&lt;cfif NOT StructKeyExists(Application.UsersInfo, user_cfid)&gt;<br />
&lt;cfset temp = StructInsert(Application.UsersInfo, user_cfid, user_time)&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cflock&gt;<br />
&lt;/cfif&gt;<br />
&lt;!&#8212; end Who&#8217;s Online section &#8212;&gt;<br />
the second bit does the updating and checking of user activity and either updates or deletes the user from the tracking struct</p>
<p>Application.cfc onRequest<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&lt;!&#8212; Begin Who&#8217;s Online section &#8212;&gt;<br />
&lt;!&#8212; determines timeout to heck if user still is active.<br />
set to 0 will check on each page load and will cause list to change a lot as people &#8220;timeout&#8221;<br />
while viewing or working on pages<br />
set to 10 minutes will give a more general idea of activity.<br />
remember that activity timeout and session timeout may be different.<br />
&#8212;&gt;</p>
<p>&lt;!&#8212; handle application timeout &#8212;&gt;<br />
&lt;cflock timeout=&#8221;15&#8243; scope=&#8221;APPLICATION&#8221; type=&#8221;EXCLUSIVE&#8221;&gt;<br />
&lt;cfif NOT isDefined(&#8220;Application.UsersInfo&#8221;)&gt;<br />
&lt;cfset Application.UsersInfo = StructNew()&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cflock&gt;</p>
<p>&lt;cfset ActivityTimeout = 0&gt;<br />
&lt;!&#8212; if we still have a session id but have been cleared from the struct reset the struct<br />
this would be due to having an activity online timeout which is shorter than<br />
your session timeout. &#8212;&gt;</p>
<p>&lt;!&#8211; check if session exists &#8211;&gt;<br />
&lt;cfif structKeyExists(session,&#8221;whosOnFirst&#8221;)&gt;<br />
&lt;!&#8211; check if key in who&#8217;s online exists &#8211;&gt;<br />
&lt;cfif NOT StructKeyExists(Application.UsersInfo, session.whosOnFirst)&gt;<br />
&lt;cfset temp = StructInsert(Application.UsersInfo, session.whosOnFirst, now())&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cfif&gt;</p>
<p>&lt;cfloop collection=&#8221;#Application.UsersInfo#&#8221; item=&#8221;uName&#8221;&gt;<br />
&lt;!&#8212; if the struct matches the session id then it&#8217;s us so update our activity time &#8212;&gt;<br />
&lt;cfif structKeyExists(session,&#8221;whosOnFirst&#8221;)&gt;<br />
&lt;cfif uName eq session.whosOnFirst&gt;<br />
&lt;cfset user_cfid = uName&gt;<br />
&lt;cfset user_time = Now()&gt;<br />
&lt;cfset temp = StructUpdate(Application.UsersInfo, user_cfid, user_time)&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cfif&gt;<br />
&lt;!&#8212; look for values in the struct which are larger than ActivityTimeout<br />
and delete them as their timeout period will have expired.   &#8212;&gt;<br />
&lt;cfif Evaluate(DateDiff(&#8220;n&#8221;, StructFind(Application.UsersInfo, uName), Now())) GT ActivityTimeout&gt;<br />
&lt;cfset StructDelete(Application.UsersInfo, uName)&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cfloop&gt;<br />
&lt;!&#8212; end Who&#8217;s Online section &#8212;&gt;</p>
<p>This last bit is the display section which you can place on any page you want the widget to appear.</p>
<p>whosOnFirst.cfm<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;-<br />
&lt;div style=&#8221;padding:5px;&#8221;&gt;<br />
&lt;cflock scope=&#8221;APPLICATION&#8221; type=&#8221;EXCLUSIVE&#8221; timeout=&#8221;10&#8243;&gt;<br />
&lt;cfoutput&gt;<br />
Users Online : #StructCount(Application.UsersInfo)#&lt;br&gt;<br />
&lt;cfloop collection=&#8221;#Application.UsersInfo#&#8221; item=&#8221;uName&#8221;&gt;<br />
&lt;cfif Uname eq session.whosOnFirst&gt;<br />
&lt;div style=&#8221;font-weight:bold;border-top:1px dashed;border-bottom:1px dashed;&#8221;&gt;#listlast(UCASE(Uname))#&lt;/div&gt;&lt;!&#8212; this is me &#8212;&gt;<br />
&lt;cfelse&gt;<br />
&lt;div&gt;#listlast(UCASE(Uname))# &lt;br&gt;<br />
&lt;span style=&#8221;font-size:.7em;&#8221;&gt;<br />
Last Activity : #timeformat(structfind(Application.UsersInfo,uname), &#8220;hh:mm:ss&#8221;)#<br />
&lt;/span&gt;&lt;/div&gt;<br />
&lt;/cfif&gt;<br />
&lt;/cfloop&gt;<br />
&lt;/cfoutput&gt;<br />
&lt;/cflock&gt;<br />
&lt;/div&gt;</p>
<p>For apps that allow both registered users and guests, you could add an additional logic section to onRequestStart which determines if a user is browser as a guest and then set user_cfid as</p>
<p>&lt;cfset user_cfid = Evaluate(CFID) &amp; &#8220;,&#8221; &amp; &#8220;Guest&#8221;&gt;</p>
<p>Since CFID is &#8220;unique-ish&#8221; we can combine it with multiple Guests and not have overlap. For larger volume sites which could have many guests, I&#8217;d recommend using the createUUID() as recommend above.</p>
<p>Word of warning: I&#8217;m not sure what performance implications there would be on a heavily visited forum site.  You would also want to either limit the number of users displayed by the collection cfloop, or add some css to allow for scrolling of the div so you didn&#8217;t have a list that had 300-400 visible users.</p>
<p>Have Fun.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/42/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=42&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2009/01/09/a-coldfusion-whos-online-widget/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Foxpro, Coldfusion File Read Error</title>
		<link>http://sidfishes.wordpress.com/2008/12/19/foxpro-coldfusion-file-read-error/</link>
		<comments>http://sidfishes.wordpress.com/2008/12/19/foxpro-coldfusion-file-read-error/#comments</comments>
		<pubDate>Fri, 19 Dec 2008 19:10:03 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[File Read  Error]]></category>
		<category><![CDATA[Foxpro]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=39</guid>
		<description><![CDATA[I&#8217;m right in the middle of final testing for my UPSConnect/Coldfusion app and I started  to see a bunch of errors popping up in my logs and my app stopped working.
The specific error was
[ODBC Visual FoxPro Driver]Error reading file
Hmm. I verified that the remote folder was accessible and the datasource verified in CFAdmin. Still no [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=39&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I&#8217;m right in the middle of final testing for my UPSConnect/Coldfusion app and I started  to see a bunch of errors popping up in my logs and my app stopped working.</p>
<p>The specific error was</p>
<p>[ODBC Visual FoxPro Driver]Error reading file</p>
<p>Hmm. I verified that the remote folder was accessible and the datasource verified in CFAdmin. Still no go.  Couldn&#8217;t even perform a simple select on any of the dbf files</p>
<p>One thing is different today is I&#8217;m testing after UPS End of Day procedure has been run. This procedure &#8220;archives&#8221; the days shipments by copying them into new tables and emptying the working tables.  So I thought maybe there might be an issue with the driver accessing empty tables (although I was 99.9% sure that I had selected on empty table before)</p>
<p>Then I had a thought.  Uncheck good old &#8221; 					 						 Maintain connections across client requests&#8221;  in CFadmin&gt;Datasources&gt;Advanced Settings</p>
<p>Sure enough, that fixed the problem. I can select on my tables again.</p>
<p>Now I&#8217;m not sure -why- my datasource would work for 2 months with this setting enabled and then -not- but at least it&#8217;s working.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/39/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/39/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/39/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=39&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2008/12/19/foxpro-coldfusion-file-read-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Calculating a UPS Shipment Number From a Tracking Number</title>
		<link>http://sidfishes.wordpress.com/2008/11/19/calculating-a-ups-shipment-number-from-a-tracking-number/</link>
		<comments>http://sidfishes.wordpress.com/2008/11/19/calculating-a-ups-shipment-number-from-a-tracking-number/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 22:18:47 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[Base26]]></category>
		<category><![CDATA[cfscript]]></category>
		<category><![CDATA[UPS]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=30</guid>
		<description><![CDATA[I may be the only person who ever needs to calculate a UPS Shipment Number. The project I&#8217;m working on requires me to create this value for a custom commerical invoice.
The format of the shipment number is
123X59M7CH
and the tracking number format is
1Z 123X56 66 2075 4864
Sort of the same &#8230; but not. The first part [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=30&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I may be the only person who ever needs to calculate a UPS Shipment Number. The project I&#8217;m working on requires me to create this value for a custom commerical invoice.</p>
<p>The format of the shipment number is</p>
<p>123X59M7CH</p>
<p>and the tracking number format is</p>
<p>1Z 123X56 66 2075 4864</p>
<p>Sort of the same &#8230; but not. The first part of the shipment number is your account number. That was -easy-. Second part, a bit more involved. Turns out, that this number is generated using base26 encoding. Base26 is rarely used but it is here. I&#8217;ve put together a custom tag which does the conversion for you. Just pass it a tracking number.</p>
<p>&lt;cfset trackingNum=&#8221;1Z 123X56 66 2075 4864&#8243;&gt;<br />
&lt;cf_base26Encoder trackingNum=&#8221;#trackingNum#&#8221; output=&#8221;shipNum&#8221;&gt;<br />
&lt;cfoutput&gt;ShipmentNumber:#shipNum#&lt;/cfoutput&gt;</p>
<p>&#8212;&#8212;save code below as base26Encoder.cfm &#8212;&#8212;<br />
&lt;CFPARAM NAME=&#8221;attributes.trackingNum&#8221; DEFAULT=&#8221;string&#8221;&gt;<br />
&lt;CFIF NOT isDefined(&#8220;attributes.trackingNum&#8221;)&gt;<br />
&lt;CFTHROW MESSAGE=&#8217;Error in custom Tag &lt;B&gt;&lt;/B&gt;:&lt;BR&gt;Attribute trackingNum not found&#8217;&gt;<br />
&lt;/CFIF&gt;<br />
&lt;CFIF attributes.trackingNum eq &#8220;&#8221;&gt;<br />
&lt;CFTHROW MESSAGE=&#8217;Error in custom Tag &lt;B&gt;&lt;/B&gt;:&lt;BR&gt;Attribute trackingNum can not be empty&#8217;&gt;<br />
&lt;/CFIF&gt;<br />
&lt;!&#8212; UPS Tracking Number Anatomy<br />
1st 2 digits &#8211; Lead numbers<br />
next 5 &#8211; Acct Number<br />
next 2 &#8211; service class<br />
next 7 tracking number<br />
last digit &#8211; check digit<br />
&#8212;&gt;<br />
&lt;cfscript&gt;<br />
//remove any spaces<br />
tN1 = replace(attributes.trackingNUm,&#8221; &#8220;, &#8220;&#8221;,&#8221;all&#8221;);<br />
//get the tracking number and check digit<br />
tN = right(tN1,8);<br />
//strip the check digit<br />
tN = left(tN,7);<br />
//get the account number<br />
aNum = replace(replace(left(tN1,7), tN, &#8220;&#8221;),&#8221;1Z&#8221;, &#8220;&#8221;);<br />
//do the base26 calculations based on UPS requirements<br />
//discard remainders so use int()<br />
p1 = int(tN/26^4);<br />
p2 = int((tN-(p1*26^4))/26^3);<br />
p3 = int((tN-(p1*26^4)-(p2*26^3))/26^2);<br />
p4 = int((tN-(p1*26^4)-(p2*26^3)-(p3*26^2))/26);<br />
p5 = int((tN-(p1*26^4)-(p2*26^3)-(p3*26^2)-(p4*26)));<br />
//set up conversion lists<br />
l1 = &#8220;0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25&#8243;;<br />
l2 = &#8220;3,4,7,8,9,B,C,D,F,G,H,J,K,L,M,N,P,Q,R,S,T,V,W,X,Y,Z&#8221;;<br />
l3 = p1 &amp; &#8220;,&#8221; &amp; p2 &amp; &#8220;,&#8221; &amp; p3 &amp; &#8220;,&#8221; &amp; p4 &amp; &#8220;,&#8221; &amp; p5;<br />
&lt;/cfscript&gt;<br />
&lt;cfset sNum = &#8220;&#8221;&gt;<br />
&lt;!&#8212; loop through our base26 numbers, find in l1 and get corresponding value from l2 &#8212;&gt;<br />
&lt;cfloop list=&#8221;#l3#&#8221; index=&#8221;x&#8221;&gt;<br />
&lt;cfset v= listgetat(l2,listFind(l1,x))&gt;<br />
&lt;cfset sNum = snum &amp; v&gt;<br />
&lt;/cfloop&gt;<br />
&lt;CFSET &#8220;caller.#attributes.output#&#8221; = aNUm&amp;sNUm&gt;<br />
Hope someone else finds this useful.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/30/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/30/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/30/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=30&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2008/11/19/calculating-a-ups-shipment-number-from-a-tracking-number/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Newspaper Columns Using CFscript and CSS</title>
		<link>http://sidfishes.wordpress.com/2008/11/11/newspaper-columns-using-cfscript-and-css/</link>
		<comments>http://sidfishes.wordpress.com/2008/11/11/newspaper-columns-using-cfscript-and-css/#comments</comments>
		<pubDate>Tue, 11 Nov 2008 23:16:30 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Coldfusion]]></category>
		<category><![CDATA[cfscript]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[newspaper columns]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=27</guid>
		<description><![CDATA[Someone asked me how to break up a text block into 3 columns (like a newspaper). While this isn&#8217;t necessarily the best way to format a webpage (scroll down, scroll up, scroll down ), it is a familiar format.
Thanks to a neat little cfscript function from theLazyCoder, it turns out to be fairly simple.
The code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=27&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Someone asked me how to break up a text block into 3 columns (like a newspaper). While this isn&#8217;t necessarily the best way to format a webpage (scroll down, scroll up, scroll down ), it is a familiar format.</p>
<p>Thanks to a neat little cfscript function from <a title="fullLeft Function" href="http://thelazycoder.com/1/2007/07/53.Full-Left-Word-Count-with-Whole-Words.cfm" target="_blank">theLazyCoder</a>, it turns out to be fairly simple.</p>
<p>The code takes a block of text courtesy the <a title="LI Generator" href="http://www.lipsum.com/feed/html" target="_blank">Lore Ipsum Generator</a> and chops it up into 3 sections for your page. You could simply use left mid and right but you would get words that were cut off in the middle. Using the fullLeft function we get the closest full word to the end of each column and then we just subtract the previous section using replace. For the third column, we replace both the first and second column text.</p>
<p>For a 7 in tall page using default font size, 950 characters seems to fit about right.</p>
<p>col1 = fullLeft(mytext,950); //get the full word closest to 950 chars<br />
col2 = fullleft(replace(mytext,col1,&#8221;"),950); //get the full word closest to 950 chars &#8211; the chars in col1<br />
col3 = fullleft(replace(mytext,col1 &amp; col2,&#8221;"),950); //get the full word closest to 950 chars &#8211; the chars in col1 and col2</p>
<p>Once we&#8217;ve broken it up this way we can simply apply a little newspaper-ish CSS and you&#8217;ve got 3 columns justified with gutters.</p>
<p>Limitations:</p>
<p>Doesn&#8217;t deal with multiple pages</p>
<p>Doesn&#8217;t allow for handling characters when there are more than the 3 columns allow</p>
<p>The Code</p>
<p>&lt;cfset myText = &#8220;Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc non sem. Curabitur nunc lectus, consequat non, consectetuer non, gravida ut, ante. Integer faucibus molestie risus. Vestibulum consectetuer blandit risus. Pellentesque id nulla. Phasellus sem. Donec sit amet urna ac nunc fringilla aliquam. Nulla venenatis congue felis. Etiam molestie tortor eu risus. In at tortor. Ut eget mauris. In non erat eu urna gravida ornare.<br />
Curabitur leo sem, tincidunt sed, suscipit eu, congue eu, sem. Mauris tincidunt nisl sed leo. Nullam eget dolor non mi feugiat vestibulum. Pellentesque orci. Sed purus. Vestibulum tempus, ante pellentesque dapibus blandit, quam felis hendrerit enim, egestas molestie elit magna ut pede. Cras in quam non nulla lobortis rutrum. Nam sollicitudin adipiscing risus. Etiam quis urna. Ut et orci. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Aenean arcu mi, aliquam sed, laoreet in, vulputate sed, ante. Suspendisse sagittis ipsum rutrum ipsum. Quisque urna. Maecenas id lectus.<br />
Suspendisse lobortis lacus ut tortor. Quisque tincidunt mauris et arcu. Morbi justo nunc, malesuada ac, suscipit in, convallis at, nibh. Morbi accumsan erat ac urna. Sed gravida. Phasellus tristique. Donec volutpat dictum turpis. Nam vel ante. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed eu odio facilisis mi ornare interdum. Curabitur quam mauris, cursus sed, ultrices a, tincidunt eget, enim. Morbi in nunc sed ipsum sagittis commodo. Curabitur augue. In mattis nibh eu arcu. Donec mattis metus non tortor. Nulla et erat. Ut tempor. Aliquam tincidunt urna porttitor augue. Ut elit augue, suscipit a, pulvinar et, porta et, lacus.<br />
Proin felis purus, ornare nec, auctor vel, adipiscing ac, ligula. Nam faucibus tristique justo. Nunc tristique metus vel quam. Vestibulum ultrices massa a sapien. Praesent sit amet diam vitae elit vestibulum facilisis. Maecenas pretium massa a sem. Vestibulum lobortis. Nulla arcu arcu, laoreet eget, scelerisque non, dapibus vitae, sem. Sed tempus, sapien id consectetuer lacinia, dolor elit aliquet diam, in malesuada nulla lacus eget erat. Vestibulum consectetuer sapien a felis. Curabitur et erat a neque laoreet rutrum. Curabitur ac leo ut purus dapibus dignissim. Ut tincidunt, urna eget interdum ultrices, enim urna sollicitudin leo, nec tincidunt ligula mi sed ipsum. Maecenas imperdiet massa quis neque. Ut vel lectus id magna malesuada imperdiet. Ut nec quam. Aliquam enim lorem, luctus at, fermentum et, tempor at, neque. Integer in enim sit amet lorem auctor viverra.<br />
Etiam vitae elit. Integer bibendum augue tincidunt dui. Sed semper consectetuer dui. Pellentesque volutpat egestas nunc. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.<br />
&#8220;&gt;</p>
<p>&lt;cfscript&gt;<br />
col1 = fullLeft(mytext,950);<br />
col2 = fullleft(replace(mytext,col1,&#8221;"),950);<br />
col3 = fullleft(replace(mytext,col1 &amp; col2,&#8221;"),950);</p>
<p>//fullLeft function from: http://thelazycoder.com/1/2007/07/53.Full-Left-Word-Count-with-Whole-Words.cfm<br />
function fullLeft(str, count) {<br />
if (not refind(&#8220;[[:space:]]&#8221;, str) or (count gte len(str)))<br />
return Left(str, count);<br />
else if(reFind(&#8220;[[:space:]]&#8221;,mid(str,count+1,1))) {<br />
return left(str,count);<br />
} else {<br />
if(count-refind(&#8220;[[:space:]]&#8221;, reverse(mid(str,1,count)))) return Left(str, (count-refind(&#8220;[[:space:]]&#8221;, reverse(mid(str,1,count)))));<br />
else return(left(str,1));<br />
}<br />
}<br />
&lt;/cfscript&gt;<br />
&lt;cfoutput&gt;<br />
&lt;div style=&#8221;width:2in;padding:5px;height:7in;overflow:hidden;top:50px;position:absolute;text-align:justify;&#8221;&gt;<br />
#col1#<br />
&lt;/div&gt;<br />
&lt;div style=&#8221;width:2in;padding:5px;height:7in;overflow:hidden;left:2.5in;position:absolute;top:50px;text-align:justify;&#8221;&gt;<br />
#col2#<br />
&lt;/div&gt;<br />
&lt;div style=&#8221;width:2in;padding:5px;height:7in;overflow:hidden;left:4.875in;position:absolute;top:50px;text-align:justify;&#8221;&gt;<br />
#col3#<br />
&lt;/div&gt;<br />
&lt;/cfoutput&gt;</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=27&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2008/11/11/newspaper-columns-using-cfscript-and-css/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
		<item>
		<title>Port Panic</title>
		<link>http://sidfishes.wordpress.com/2008/10/30/port-panic/</link>
		<comments>http://sidfishes.wordpress.com/2008/10/30/port-panic/#comments</comments>
		<pubDate>Thu, 30 Oct 2008 23:13:50 +0000</pubDate>
		<dc:creator>sidfishes</dc:creator>
				<category><![CDATA[Main Courses]]></category>
		<category><![CDATA[Incident Response]]></category>
		<category><![CDATA[malware]]></category>
		<category><![CDATA[UDP port]]></category>

		<guid isPermaLink="false">http://sidfishes.wordpress.com/?p=22</guid>
		<description><![CDATA[Today was one of those days. The network was down when I got to work, so even before my first cup of coffee I was fielding &#8220;I can&#8217;t..&#8221; and &#8220;It doesn&#8217;t&#8230;&#8221; We&#8217;ve been having some issues with one of our older 3com switches and that was my first thought. I did a reboot of that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=22&subd=sidfishes&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>Today was one of those days. The network was down when I got to work, so even before my first cup of coffee I was fielding &#8220;I can&#8217;t..&#8221; and &#8220;It doesn&#8217;t&#8230;&#8221; We&#8217;ve been having some issues with one of our older 3com switches and that was my first thought. I did a reboot of that switch but that didn&#8217;t clear things up. It did bring back internet but my fileserver was still offline (ping-able) but nobody could connect. I did a reboot of that server and while I was waiting for it to come back up I had a look at the last vulnerability scan for our AD/DNS server. This scan is done by eEye software&#8217;s <a title="BLINK" href="http://www.eeye.com/html/products/blink/index.html" target="_blank">Blink</a> which is built on the highly regarded <a title="RETINA" href="http://www.eeye.com/html/products/retina/index.html" target="_blank">Retina</a> vulnerability scanner.  I hadn&#8217;t checked the scan results for a while (bad me, I know&#8230; but at least I AM  scanning. Are you??) And the thing that immediately caught my attention was a HUGE number of open UDP ports. (in the thousands!!) The port numbers range from 49157 to 65529.</p>
<p>Immediately I&#8217;m thinking I&#8217;ve either been hacked or someone has set up some P2P on our network. I was pretty sure it wasn&#8217;t someone internal so I immediately went into intrusion event management mode. Checking logs, current firewall traffic, A/V scans and then a bunch of malware scans. Blink is has a good set of tools for this and it was coming up empty. I went to my next line of defense which is good old <a title="SpyBot" href="http://www.safer-networking.org/index2.html" target="_blank">Spybot</a>. Again the system came up clean.  I also used a tool from eSet (makers of NOD32 A/V) called <a title="SysInspector" href="http://www.eset.com/download/sysinspector.php" target="_blank">SysInspector</a>. This is a useful utility I found on a <a title="sans.org" href="http://isc.sans.org" target="_blank">sans.org diary posting</a>. Nothing out of the ordinary there either. Lastly, I did a scan with <a title="RootKit Revealer" href="http://technet.microsoft.com/en-ca/sysinternals/bb897445.aspx" target="_blank">RootKit Revealer</a> from <span style="text-decoration:line-through;">sysinternals</span> err Microsoft. Again, nothing.</p>
<p>I should point out that by this time everything is working fine for all my users. You might be thinking that by this time, I&#8217;m feeling a bit better about things. Nope. In fact I&#8217;m even more worried as I&#8217;ve got a ton of open UDP ports and I can&#8217;t find a reason why. My next move is to create a custom rule for the Blink software firewall, blocking the open UDP ports and log the results. All of a sudden, the Blink service goes to 100% cpu and I&#8217;m getting a -lot- of denied log entries for all of these various ports. Each of these ports seems to be trying to contact a different external IP. Now I&#8217;m thinking I&#8217;m really screwed. Someone is operating some kind of server on my -clean- system!</p>
<p>But then&#8230; I get a call. &#8220;I just lost my internet&#8221;, then another. Then -I- can&#8217;t browse to some sites. Hmmm. DNS? I did an ipconfig /flushdns /registerdns on my workstation and now I have no name resolution. Ok. It&#8217;s DNS related for sure. I go back to my AD/DNS server and remove my newly created rule repeat the ipconfig and viola&#8230; the internets are back.</p>
<p>So, I did a google search for UDP 49157 to 65529 and didn&#8217;t really turn up anything. But I did finally come up with a mention of them being part of the dynamic or emphemeral port range. Once I found that out I found the <a title="UDP/TCP Ports" href="http://en.wikipedia.org/wiki/List_of_TCP_and_UDP_port_numbers" target="_blank">wikipedia entry</a> which gave my the entire range of these ports (49152–65535). With that and a quick search, I was finally led to an article on <a title="TechTarget" href="http://searchsecurity.techtarget.com/news/column/0,294698,sid14_gci1320469,00.html" target="_blank">TechTarget</a> which has an explanation.</p>
<p><em>&#8220;This security update also introduces a new default for DNS port settings for Windows Server 2000 and Windows Server 2003 — dynamic default socket port ranges have changed from 1025 through 5000, to the new range of 49152 through 65535. We encourage you to review the firewall settings in your environment to ensure that traffic between servers in the dynamic port range of 49152 through 65535 is allowed. Windows Vista and Windows Server 2008 already have the default port range of 49152 to 65535. For additional information, <a href="http://www.microsoft.com/technet/security/bulletin/2008/ms08-037">please review the MS08-037 bulletin</a>.&#8221;</em></p>
<p>Lightbulb moment. All those open ports are supposed to be there. They are the ports which are used by the new DNS patch to avoid the DNS cache vulnerability of July 2008.  Sigh. I probably could have stopped after rebooting the fileserver (oh, about 6 hours ago)</p>
<p>I don&#8217;t feel that it was a wasted day for a couple of reasons. Firstly, like most other short handed IT folks, I never make the time to do incident response simulations. This was a good -simulation-. Secondly, I&#8217;m pretty confident that my various levels of security, patching and updating are doing their jobs. Lastly, I&#8217;m happy to report a clean bill of health for my server room.</p>
<p>It&#8217;s too late for that cup of coffee, but it&#8217;s just the right time for a drink,</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/sidfishes.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/sidfishes.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/sidfishes.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/sidfishes.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/sidfishes.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/sidfishes.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/sidfishes.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/sidfishes.wordpress.com/22/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/sidfishes.wordpress.com/22/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/sidfishes.wordpress.com/22/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=sidfishes.wordpress.com&blog=5113000&post=22&subd=sidfishes&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://sidfishes.wordpress.com/2008/10/30/port-panic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/22c2c8cc2fc568b639969a4f089eff8b?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">sidfishes</media:title>
		</media:content>
	</item>
	</channel>
</rss>