<?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/"
	>

<channel>
	<title>Jake Churchill</title>
	<atom:link href="http://www.reynacho.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.reynacho.com</link>
	<description>... on Flex, ColdFusion, FarCry, and much more ...</description>
	<pubDate>Mon, 08 Feb 2010 22:08:16 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>FCKEditor Firefox 3.6 Bug (Year 2010 Bug)</title>
		<link>http://www.reynacho.com/2010/02/fckeditor-firefox-36-bug-year-2010-bug/</link>
		<comments>http://www.reynacho.com/2010/02/fckeditor-firefox-36-bug-year-2010-bug/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 22:08:16 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.reynacho.com/?p=254</guid>
		<description><![CDATA[The new version of Firefox broke my FCKEditor!  They didn&#8216;t do it on purpose I&#8217;m sure, but it did, in fact, break it.  I am using what I consider the standard implementation in ColdFusion (that does not come bundled with ColdFusion).  I updated my Firefox to the most recent version (3.6) which [...]]]></description>
			<content:encoded><![CDATA[<p>The new version of Firefox broke my FCKEditor!  They didn</code>&#8216;t do it on purpose I&#8217;m sure, but it did, in fact, break it.  I am using what I consider the standard implementation in ColdFusion (that does not come bundled with ColdFusion).  I updated my Firefox to the most recent version (3.6) which was released on January 28 and BOOM!  Goodbye WYSIWIG.  </p>
<p>The implementation uses the standard CFC (fckeditor.cfc) which includes a function in a file called &#8220;fckutils.cfm&#8221;.  Line 47 of that function looks like this:</p>
<p><code>stResult = reFind( "gecko/(200[3-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );</code></p>
<p>This new release was released in 2010 so the first part of the string after &#8220;gecko/&#8221; fails.  Changing that line to this will fix the problem:</p>
<p><code>stResult = reFind( "gecko/(20[0-9][0-9][0-1][0-9][0-3][0-9])", sAgent, 1, true );</code></p>
<p>I can&#8217;t really take the credit.  I found the solution on <a href="http://www.petefreitag.com/">Pete Freitag&#8217;s blog</a>.  Here&#8217;s his post:  <a href="http://www.petefreitag.com/item/737.cfm">http://www.petefreitag.com/item/737.cfm</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2010/02/fckeditor-firefox-36-bug-year-2010-bug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ColdFusion using Java for regex replace</title>
		<link>http://www.reynacho.com/2010/02/coldfusion-using-java-for-regex-replace/</link>
		<comments>http://www.reynacho.com/2010/02/coldfusion-using-java-for-regex-replace/#comments</comments>
		<pubDate>Wed, 03 Feb 2010 14:21:22 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.reynacho.com/?p=251</guid>
		<description><![CDATA[Yesterday, I found myself needing more than ColdFusion could supply.  I had a variable with content that came from a WYSIWYG editor.  Some of that content was the result of inserting images into the content.  By default the image source was set to the absolute path from the webroot (i.e. /images/imagefile.jpg).  [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday, I found myself needing more than ColdFusion could supply.  I had a variable with content that came from a WYSIWYG editor.  Some of that content was the result of inserting images into the content.  By default the image source was set to the absolute path from the webroot (i.e. /images/imagefile.jpg).  This worked great for the web, but I needed the same content to be sent via email which did not work so well.</p>
<p>I needed to find all instances of the &#8220;src&#8221; attribute and tack on a domain so the ending result would be http://domain.com/images/imagefile.jpg and therefore would be email friendly.  I tried several ways of doing this (combinations of REFind, REMatch, etc) but everything ended up being more difficult than it should have been.</p>
<p>Luckily, a ColdFusion String maps directly to a Java String so even though the docs might not suggest it, there are methods available for use.  The one I wanted was &#8220;replaceAll()&#8221;.  It does a simple regex replace and allows for backreferencing ($1, $2, etc).  Backreferencing is key to not lose content that I needed (i.e. /images/imagefile.jpg).  So, here&#8217;s the code that finally made my day:</p>
<p><code>&lt;cfset domainName = "http://domain.com" /&gt;<br />
&lt;cfset contentVariable = contentVariable.replaceAll("src=\""(\/.+?)\""", "src=\""#domainName#$1\""") /&gt;</code></p>
<p>Full documentation on Java&#8217;s String functions can be seen at the <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html">Java Docs -> String</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2010/02/coldfusion-using-java-for-regex-replace/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ColdFusion VirtualMerchant CFC</title>
		<link>http://www.reynacho.com/2010/02/coldfusion-virtual-merchant-cfc/</link>
		<comments>http://www.reynacho.com/2010/02/coldfusion-virtual-merchant-cfc/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 14:33:59 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://www.reynacho.com/?p=240</guid>
		<description><![CDATA[One of the biggest requests I get is to explain how I integrated a ColdFusion app with the VirtualMerchant Gateway.  It was actually quite simple.  The difficulty lies in the lack of documentation and help from VirtualMerchant.  Their gateway does not seem to allow for much customization or control.
If you want to [...]]]></description>
			<content:encoded><![CDATA[<p>One of the biggest requests I get is to explain how I integrated a ColdFusion app with the VirtualMerchant Gateway.  It was actually quite simple.  The difficulty lies in the lack of documentation and help from VirtualMerchant.  Their gateway does not seem to allow for much customization or control.</p>
<p>If you want to have a user click a button and be sent to VirtualMerchant&#8217;s payment terminal for the payment processing, it&#8217;s great.  But it is more difficult to allow the user to stay on your site and use VirtualMerchant only for the payment processing.</p>
<p>Here&#8217;s what I did:</p>
<p><span id="more-240"></span></p>
<p>I used a CFHTTP approach (pretty standard) for passing data to VirtualMerchant.  One of the allowed attributes is called <strong>ssl_result_format</strong> which tells VirtualMerchant how to send the results of the processing back to you.  Use <strong>ASCII</strong> which tells it to just return a simple text response, similar to what a small receipt printer would give you.  Once you have those results, it is simply a matter of parsing the data to get what you want.  Here&#8217;s that function:</p>
<p><code>&lt;cffunction name="convertResponse" returntype="struct" access="private"&gt;<br />
	&lt;cfargument name="response" default="" required="true" type="string"&gt;<br />
	&lt;cfset var stReturn = StructNew()&gt;<br />
	&lt;cfloop from="1" to="#ListLen(response,Chr(10))#" step="1" index="i"&gt;<br />
		&lt;cfset stReturn[trim(ListFirst(ListGetAt(response,i,Chr(10)),'='))] = trim(ListLast(ListGetAt(response,i,Chr(10)),'='))&gt;<br />
	&lt;/cfloop&gt;<br />
	&lt;cfreturn stReturn&gt;<br />
&lt;/cffunction&gt;</code></p>
<p>And for convenience (and so people don&#8217;t have to contact me directly all the time), here is the CFC that I used for the entire thing.  There are only 2 methods (one above to convert the response) and one to send data to VirtualMerchant.  I can&#8217;t link directly to it because it is a CFC file and this blog is on a ColdFusion server so by default it will try to take you to the CF Administrator to explore the CFC.  So, here is the code in full:</p>
<p><code>&lt;cfcomponent hint="Interacts with the Virtual Merchant Payment Gateway" output="false"&gt;<br />
	<span /><br />
	&lt;cffunction name="doProcess" output="true"&gt;<br />
		&lt;cfargument name="order" type="struct" required="false" default=""&gt;<br />
		&lt;cfargument name="customer" type="struct" default=""&gt;<br />
		&lt;cfargument name="merchant_id" type="string" required="true" default=""&gt;<br />
		&lt;cfargument name="user_id" type="string" required="true" default=""&gt;<br />
		&lt;cfargument name="pin" type="string" required="true" default=""&gt;<br />
		&lt;cfargument name="test_mode" type="string" required="false" default="false"&gt;<br />
		&lt;cfargument name="show_form" type="string" required="false" default="false"&gt;<br />
		&lt;cfargument name="transaction_type" type="string" required="false" default="ccsale"&gt;<br />
		<span /><br />
		&lt;cfset var stReturn = StructNew()&gt;<br />
		<span /><br />
		&lt;cfif arguments.test_mode NEQ "false" AND arguments.test_mode NEQ "true"&gt;<br />
			&lt;cfset arguments.test_mode = "false"&gt;<br />
		&lt;/cfif&gt;<br />
		&lt;cfif arguments.show_form NEQ "false" AND arguments.show_form NEQ "true"&gt;<br />
			&lt;cfset arguments.show_form = "false"&gt;<br />
		&lt;/cfif&gt;<br />
		&lt;cfif NOT ListFindNoCase("CCSALE,CCAUTHONLY,CCCREDIT,CCBALINQUIRY",arguments.transaction_type)&gt;/<br />
			&lt;cfset arguments.transaction_type = "ccsale"&gt;<br />
		&lt;/cfif&gt;<br />
		<span /><br />
		&lt;cfhttp method="post" url="https://www.myvirtualmerchant.com/VirtualMerchant/process.do" timeout="60" throwonerror="true"&gt;<br />
			<!--- Identifiers ---><br />
			&lt;cfhttpparam type="formfield" name="ssl_merchant_id" value="#arguments.merchant_id#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_user_id" value="#arguments.user_id#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_pin" value="#arguments.pin#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_show_form" value="#arguments.show_form#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_test_mode" value="#arguments.test_mode#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_transaction_type" value="#arguments.transaction_type#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_customer_code" value="1111"&gt;<br />
			<span /><br />
			<!--- Customer Info ---><br />
			&lt;cfhttpparam type="formfield" name="ssl_first_name" value="#arguments.customer.firstName#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_last_name" value="#arguments.customer.lastName#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_avs_address" value="#arguments.customer.address1#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_address2" value="#arguments.customer.address2#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_city" value="#arguments.customer.city#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_state" value="#arguments.customer.state#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_avs_zip" value="#arguments.customer.zip#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_phone" value="#arguments.customer.dayPhone#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_email" value="#arguments.customer.email#"&gt;<br />
			<!--- shipping ---><br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_first_name" value="#arguments.customer.firstName#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_last_name" value="#arguments.customer.lastName#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_address1" value="#arguments.customer.shipaddress1#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_address2" value="#arguments.customer.shipaddress2#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_city" value="#arguments.customer.shipcity#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_state" value="#arguments.customer.shipstate#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_zip" value="#arguments.customer.shipzip#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_ship_to_phone" value="#arguments.customer.shipdayphone#"&gt;<br />
			<span /><br />
			<!--- Transaction Info ---><br />
			&lt;cfhttpparam type="formfield" name="ssl_invoice_number" value="#arguments.order.invoice#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_amount" value="#arguments.order.cartTotal#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_salestax" value="#arguments.order.taxvalue1+arguments.order.taxvalue2#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_card_number" value="#arguments.order.ccnumber#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_cvv2cvc2_indicator" value="1"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_cvv2cvc2" value="#arguments.order.cccvv2#"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_exp_date" value="#arguments.order.ccmonth##Right(arguments.order.ccyear,2)#"&gt;<br />
			<span>&amp;nbsp;</span><br />
			<!--- Receipt/Redirect Info ---><br />
			&lt;cfhttpparam type="formfield" name="ssl_result_format" value="ASCII"&gt;<br />
			&lt;cfhttpparam type="formfield" name="ssl_receipt_link_method" value="POST"&gt;<br />
		&lt;/cfhttp&gt;<br />
		<span /><br />
		&lt;cfset stReturn = convertResponse(trim(cfhttp.fileContent))&gt;<br />
		&lt;cfset stReturn.originalFileContent = cfhttp.FileContent&gt;<br />
		&lt;cfreturn stReturn&gt;<br />
	&lt;/cffunction&gt;<br />
	<span /><br />
	<span /><br />
	<!--- for use in gateway response ---><br />
	&lt;cffunction name="convertResponse" returntype="struct" access="private"&gt;<br />
		&lt;cfargument name="response" default="" required="true" type="string"&gt;<br />
		&lt;cfset var stReturn = StructNew()&gt;<br />
		&lt;cfloop from="1" to="#ListLen(response,Chr(10))#" step="1" index="i"&gt;<br />
			&lt;cfset stReturn[trim(ListFirst(ListGetAt(response,i,Chr(10)),'='))] = trim(ListLast(ListGetAt(response,i,Chr(10)),'='))&gt;<br />
		&lt;/cfloop&gt;<br />
		&lt;cfreturn stReturn&gt;<br />
	&lt;/cffunction&gt;<br />
&lt;/cfcomponent&gt;</code></p>
<p>Of course, you may need to change some of the first method depending on your implementation and if VirtualMerchant&#8217;s gateway response ever changes, we (myself included) will all need to change how we parse the data.</p>
<p>I hope this helps out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2010/02/coldfusion-virtual-merchant-cfc/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Farcry Navigation Move Permissions</title>
		<link>http://www.reynacho.com/2009/09/farcry-navigation-move-permissions/</link>
		<comments>http://www.reynacho.com/2009/09/farcry-navigation-move-permissions/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 20:26:21 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Farcry]]></category>

		<guid isPermaLink="false">http://www.reynacho.com/?p=233</guid>
		<description><![CDATA[I received a question today about how to stop the contributor policy group from being able to re-order navigation nodes.  There are a lot of things that you can control via the group permissions section.  For some information on those, see this post:  http://www.reynacho.com/?p=49.
However, these permissions deal primarily with the approval process [...]]]></description>
			<content:encoded><![CDATA[<p>I received a question today about how to stop the contributor policy group from being able to re-order navigation nodes.  There are a lot of things that you can control via the group permissions section.  For some information on those, see this post:  <a href="http://www.reynacho.com/?p=49">http://www.reynacho.com/?p=49</a>.</p>
<p>However, these permissions deal primarily with the approval process and webtop sections.  dmNavigation does not go through the standard approval process and basically everyone can access the site tab.  So, how do we accomplish this?</p>
<p>Basically, we set up node-specific permissions.  I have discussed this before in creating a <a href="http://www.reynacho.com/?p=25">Members Only Section</a> but we can control users who have webtop access in a similar way.  </p>
<p>In order to stop contributors from being able to re-order Navigation Nodes, we need to turn off the &#8220;Move&#8221; menu and sub-menu.  How do we do that?  Well, a quick read through /core/tags/navajo/overview.cfm gave me my answer.  Please do not read this file without a king-sized bottle of Ibuprofen handy.  In my version 4.0 install around line 1244 I found my answer.  Move checks to make sure the user has &#8220;Edit&#8221; permissions on the node in question.  So, let&#8217;s turn those off:</p>
<ol>
<li>Make sure you are logged in as an admin</li>
<li>Go to the Site Tab and find the node you want to limit</li>
<li>Right click and select &#8220;Permissions&#8221;</li>
<li>Change the select box to Contributor (or any other group you wan to affect)</li>
<li>Change &#8220;Edit&#8221; to &#8220;No&#8221; (or &#8220;Inherit&#8221; if you&#8217;ve already set this to &#8220;No&#8221; on a parent node)</li>
</ol>
<p>And there you go, the Contributor group no longer gets the &#8220;Move&#8221; menu.  </p>
<p>On a side note, thank you to the guys on <a href="http://groups.google.com/group/farcry-dev/browse_thread/thread/62e18374543fbd84">this thread</a> for bringing this up.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/09/farcry-navigation-move-permissions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Delete Mail via POP Script</title>
		<link>http://www.reynacho.com/2009/07/delete-mail-via-pop-script/</link>
		<comments>http://www.reynacho.com/2009/07/delete-mail-via-pop-script/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 15:24:49 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[ColdFusion]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=224</guid>
		<description><![CDATA[I&#8217;ve had an issue come up several times in the last month where I&#8217;ll get several thousand emails from sites on errors or notifications or whatever.  I have no choice but to be on the list to receive the emails and I was sick of trying to manage all of them (most of them [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve had an issue come up several times in the last month where I&#8217;ll get several thousand emails from sites on errors or notifications or whatever.  I have no choice but to be on the list to receive the emails and I was sick of trying to manage all of them (most of them just got deleted anyway) so I thought I&#8217;d write a script to do the deleting for me.  You can see the script below (with certain data such as usernames and passwords removed for privacy):<br />
<span id="more-224"></span><br />
<code>&lt;Cfsetting requesttimeout="330"&gt;<br />
<span></span><br />
&lt;cfparam name="url.startRow" default="1"&gt;<br />
&lt;cfparam name="url.maxRows" default="1000"&gt;<br />
&lt;cfparam name="url.action" default="FIND"&gt;<br />
&lt;cfset mailToDeleteFile = "absolute path to your mail file (I used mailToDelete.txt in the same directory as this script)"&gt;<br />
&lt;cfset lFromItemsToDelete = List of FROM items to delete (i.e. error@domain.com)&gt;<br />
<span></span><br />
&lt;cfoutput&gt;<br />
	Action: &lt;u&gt;#url.action#&lt;/u&gt;&lt;br /&gt;<br />
	Start Row: &lt;u&gt;#url.startRow#&lt;/u&gt;&lt;br /&gt;<br />
	Max Rows: &lt;u&gt;#url.maxRows#&lt;/u&gt;&lt;br /&gt;<br />
	&lt;cfif fileExists(mailToDeleteFile)&gt;<br />
		&lt;cffile action="read" file="#mailToDeleteFile#" variable="fileRead"&gt;<br />
		Messages marked for deletion: &lt;u&gt;#ListLen(fileRead,Chr(13)&amp;Chr(10))#&lt;/u&gt;&lt;br /&gt;<br />
		Delete Messages File: <a href="mailToDelete.txt" target="_blank">mailToDelete.txt</a><br />
	&lt;/cfif&gt;<br />
&lt;/cfoutput&gt;<br />
<span></span><br />
&lt;cfflush /&gt;<br />
<span></span><br />
&lt;cfif url.action eq "find"&gt;<br />
	<!--- a little cleanup ---><br />
	&lt;cftry&gt;<br />
		&lt;cfif url.startRow eq 1 AND FileExists(mailToDeleteFile)&gt;<br />
			&lt;cffile action="delete" file="#mailToDeleteFile#" /&gt;<br />
		&lt;/cfif&gt;<br />
		&lt;cfcatch type="any"&gt;&lt;/cfcatch&gt;<br />
	&lt;/cftry&gt;<br />
	<span></span><br />
	&lt;cftry&gt;<br />
		&lt;cfpop action="getHeaderOnly" server="my_mail_server" timeout="300" username="my_username" password="my_password" maxrows="#url.maxRows#" startrow="#url.startRow#" name="popResults"&gt;<br />
		<span></span><br />
		&lt;cfloop from="1" to="#popResults.recordcount#" step="1" index="i"&gt;<br />
			&lt;cfif ListFindNoCase(lFromItemsToDelete, popResults.from[i])&gt;<br />
				&lt;cffile action="append" file="#mailToDeleteFile#" output="#popResults.uid[i]#"&gt;<br />
			&lt;/cfif&gt;<br />
		&lt;/cfloop&gt;<br />
		&lt;cfcatch type="any"&gt;<br />
			&lt;cfset url.startRow = url.startRow - url.maxRows&gt;<br />
		&lt;/cfcatch&gt;<br />
	&lt;/cftry&gt;<br />
	<span></span><br />
	&lt;cfoutput&gt;<br />
		&lt;cfif popResults.recordcount LT url.maxRows&gt;<br />
			&lt;cfset url.action = "DELETE"&gt;<br />
			&lt;cfset url.maxRows = 100&gt;<br />
			&lt;cfset url.startRow = 1&gt;<br />
		&lt;/cfif&gt;<br />
		&lt;meta http-equiv="refresh" content="1,index.cfm?startRow=#url.startRow+url.maxRows#&amp;maxRows=#url.maxRows#&amp;action=#url.action#"&gt;<br />
	&lt;/cfoutput&gt;<br />
<span></span><br />
&lt;cfelseif url.action eq "delete"&gt;<br />
	&lt;cftry&gt;<br />
		&lt;cffile action="read" file="#mailToDeleteFile#" variable="fileRead"&gt;<br />
		&lt;cfset uidsToDelete = "&gt;<br />
		&lt;cfloop from="#url.startRow#" to="#url.startRow+url.maxRows-1#" step="1" index="i"&gt;<br />
			&lt;cfif i LTE ListLen(fileRead,Chr(13)&amp;Chr(10))&gt;<br />
				&lt;cfset uidsToDelete = ListAppend(uidsToDelete,ListGetAt(fileRead,i,Chr(13)&amp;Chr(10)))&gt;<br />
			&lt;/cfif&gt;<br />
		&lt;/cfloop&gt;<br />
		&lt;cfpop action="delete" server="my_mail_server" timeout="300" username="my_username" password="my_password" uid="#uidsToDelete#"&gt;<br />
		&lt;cfcatch type="any"&gt;<br />
			&lt;cfif NOT FindNoCase('Invalid list index',cfcatch.Message)&gt;<br />
				&lt;cfset url.startRow = url.startRow - url.maxRows&gt;<br />
			&lt;/cfif&gt;<br />
		&lt;/cfcatch&gt;<br />
	&lt;/cftry&gt;<br />
	&lt;cfif isDefined('fileRead') AND url.startRow LTE ListLen(fileRead,Chr(13)&amp;Chr(10))&gt;<br />
		&lt;cfoutput&gt;<br />
			&lt;meta http-equiv="refresh" content="1,index.cfm?startRow=#url.startRow+url.maxRows#&amp;maxRows=#url.maxRows#&amp;action=#url.action#"&gt;<br />
		&lt;/cfoutput&gt;<br />
	&lt;cfelse&gt;<br />
		&lt;cfoutput&gt;<br />
			&lt;br /&gt;&lt;br /&gt;&lt;h2&gt;Finished!&lt;/h2&gt;<br />
		&lt;/cfoutput&gt;<br />
		<!--- a little cleanup ---><br />
		&lt;cftry&gt;<br />
			&lt;cfif FileExists(mailToDeleteFile)&gt;<br />
				&lt;cffile action="delete" file="#mailToDeleteFile#" /&gt;<br />
				&lt;cfoutput&gt;<br />
					&lt;meta http-equiv="refresh" content="1,index.cfm?startRow=#url.startRow+url.maxRows#&amp;maxRows=#url.maxRows#&amp;action=#url.action#"&gt;<br />
				&lt;/cfoutput&gt;<br />
			&lt;/cfif&gt;<br />
			&lt;cfcatch type="any"&gt;&lt;/cfcatch&gt;<br />
		&lt;/cftry&gt;<br />
	&lt;/cfif&gt;<br />
&lt;/cfif&gt;</code></p>
<p>When reading the file, you can see that basically it just goes through and pops your mail server 1000 messages at a time and if it finds someting in the lFromItemsToDelete it adds that message&#8217;s uid to a file.  So, if you are getting messages from the email address &#8216;errors@domain.com&#8217; add that and any other items in standard list format.</p>
<p>After it&#8217;s found all the messages to delete, it goes through and deletes them 100 at a time.  The script takes care of itself so if you just browse to it, it&#8217;ll start finding messages and then start deleting them automatically once they are all found.  Hope this helps save someone the time I spent sifting through junk emails.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/07/delete-mail-via-pop-script/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex 2 Datagrid not highlighting row (UPDATE)</title>
		<link>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row-update/</link>
		<comments>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row-update/#comments</comments>
		<pubDate>Thu, 21 May 2009 16:24:56 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=192</guid>
		<description><![CDATA[I recently posted a solution about the DataGrid in Flex 2 not highlighting rows correctly after certain events (specifically double-clicking a row).  You can read that post here.
I wanted to simply update the code sample that I gave for the overridden drawRowBackground() method.  The code I had before was from Flex 3 and [...]]]></description>
			<content:encoded><![CDATA[<p>I recently posted a solution about the DataGrid in Flex 2 not highlighting rows correctly after certain events (specifically double-clicking a row).  You can <a href="http://jake.cfwebtools.com/2009/05/20/flex-2-datagrid-not-highlighting-row/">read that post here</a>.</p>
<p>I wanted to simply update the code sample that I gave for the overridden drawRowBackground() method.  The code I had before was from Flex 3 and introduced a bug that I (for the life of me) couldn&#8217;t find.  So, I re-wrote it much more simply and this time it takes full advantage of the super class&#8217;s implementation rather than using Flex 3&#8217;s source.  Here you go:</p>
<p><code>override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void<br />
{<br />
	var rowColor:uint = color;<br />
	if( this.selectedIndices.indexOf(rowIndex) != -1 )<br />
	{<br />
		rowColor = getStyle("selectionColor");<br />
	}<br />
	super.drawRowBackground(s, rowIndex, y, height, rowColor, dataIndex);<br />
}</code></p>
<p>You can see, I&#8217;m simply overriding the color which is all I wanted to do in the first place.  I don&#8217;t know why the best solutions always come after you leave and revisit the code but so be it. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row-update/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex 2 Datagrid not highlighting row</title>
		<link>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row/</link>
		<comments>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row/#comments</comments>
		<pubDate>Wed, 20 May 2009 14:20:25 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=188</guid>
		<description><![CDATA[I had an issue in a Flex 2 project yesterday where a Datagrid would not highlight the selected row.  All the styles were set up for this but it still would not work.  The unfortunate matter is that this project (at least for the time being) is stuck in Flex 2 which is [...]]]></description>
			<content:encoded><![CDATA[<p>I had an issue in a Flex 2 project yesterday where a Datagrid would not highlight the selected row.  All the styles were set up for this but it still would not work.  The unfortunate matter is that this project (at least for the time being) is stuck in Flex 2 which is not open source.</p>
<p>I dug into the Flex 3 source code for Datagrid (I don&#8217;t recommend this unless you need to).  I found a method called drawSelectionIndicator() which gets called to set up the selection.  There are several methods that get called overall but the one that finally does the background color is drawRowBackground().  Somewhere down the line, the color being passed to drawRowBackground was not what was set in the stylesheet (see below).  So, I created a custom DataGrid class that extended the original and overrode the drawRowBackground method.  The source code is from Flex 2 so I made a few changes to make it work in Flex 2.  Here it is:<br />
<span id="more-188"></span><br />
<code>override protected function drawRowBackground(s:Sprite, rowIndex:int, y:Number, height:Number, color:uint, dataIndex:int):void<br />
{<br />
    var background:Shape;<br />
    if (rowIndex &lt; s.numChildren)<br />
    {<br />
        background = Shape(s.getChildAt(rowIndex));<br />
    }<br />
    else<br />
    {<br />
        background = new FlexShape();<br />
        background.name = "background";<br />
        s.addChild(background);<br />
    }<br />
    <span></span><br />
    background.y = y;<br />
    <span></span><br />
    // Height is usually as tall is the items in the row, but not if<br />
    // it would extend below the bottom of listContent<br />
    var tempHeight:Number = height;<br />
    var height:Number = Math.min(height,<br />
                                 s.height -<br />
                                 y);<br />
    if( height &lt; 0 )<br />
	height = tempHeight;<br />
    <span></span><br />
    // set the row color to what was passed in<br />
    var rowColor:uint = color;<br />
    // if the row is selected, override the row color with the selectionColor from the stylesheet<br />
    if( this.selectedIndices.indexOf(rowIndex) != -1 )<br />
    {<br />
	rowColor = getStyle("selectionColor");<br />
    }<br />
    var g:Graphics = background.graphics;<br />
    g.clear();<br />
    g.beginFill(rowColor, getStyle("backgroundAlpha"));<br />
    g.drawRect(0, 0, this.width, height);<br />
    g.endFill();<br />
}</code></p>
<p>The main addition here is the check for this.selectedIndices.indexOf(rowIndex) != -1.  This checks to see if the row is selected or not.  If it is, it gets the selectionColor from the styles and uses that instead of the default color that was passed in.</p>
<p>This might not be the most elegant solution but in my case it worked. </p>
<p>Oh yeah, here are the styles for the DataGrid that I referenced:</p>
<p><code>.QuoteList<br />
{<br />
	backgroundAlpha: 1;<br />
	backgroundColor: #000000;<br />
	alternatingItemColors: #000000, #040084;<br />
	headerColors: #ebe9ee, #cccccc;<br />
	horizontalGridLines: true;<br />
	horizontalGridLineColor: #ffffff;<br />
	verticalGridLineColor: #ffffff;<br />
	rollOverColor: #4844c8;<br />
	textRollOverColor: #ffffff;<br />
	borderThickness: 0;<br />
	selectionColor: #4844c8;<br />
	color: #ffffff;<br />
	textSelectedColor: #ffffff;<br />
	headerStyleName: "QuoteListHeaderStyle";<br />
}<br />
<span></span><br />
.QuoteListHeaderStyle {<br />
	color: #000000;<br />
	fontWeight: bold;<br />
	textDecoration: none;<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/05/flex-2-datagrid-not-highlighting-row/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Flex Dynamic casting of data</title>
		<link>http://www.reynacho.com/2009/05/flex-dynamic-casting-of-data/</link>
		<comments>http://www.reynacho.com/2009/05/flex-dynamic-casting-of-data/#comments</comments>
		<pubDate>Fri, 15 May 2009 19:46:39 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=180</guid>
		<description><![CDATA[I have been playing around with an AIR application which stores data to a local SQLite DB.  I have a very basic settings table which is nothing more than a key/value paring of settings.  The keys all match up with variables in the Model.  So, there&#8217;s a setting for &#8220;fontFamily&#8221; which is [...]]]></description>
			<content:encoded><![CDATA[<p>I have been playing around with an AIR application which stores data to a local SQLite DB.  I have a very basic settings table which is nothing more than a key/value paring of settings.  The keys all match up with variables in the Model.  So, there&#8217;s a setting for &#8220;fontFamily&#8221; which is both the key and the Model variable name.  I had the following basic settings:</p>
<ul>
<li>fontFamily (String)</li>
<li>fontColor (uint)</li>
<li>backgroundColor (uint)</li>
<li>startAtLogin (Boolean)</li>
</ul>
<p>The way SQLite works, it is just easier to store things as VARCHARs and convert them as needed, so how was I going to convert all of these?</p>
<p>My initial thought was to use a switch statement.  That way I could cast each variable based on the key.  That wouldn&#8217;t be so bad for this small amount of settings but it simply would not do for a larger application.  I know that the data stored in the DB is going to be able to be converted to whatever data type I need (i.e. &#8220;true&#8221; can be converted to Boolean, &#8220;#FFFFFF&#8221; can be converted to uint, etc).  So, I came up with this snippet of code that&#8217;s been working great for me so far.  All settings are loaded into an acSettings ArrayCollection in the model initially so that is what I&#8217;m looping over:</p>
<p><code>if( Model.getInstance().acSettings.length )<br />
{<br />
	var settingVO:SettingVO;<br />
	var className:Class;<br />
	<span></span><br />
	for( var i:int = 0; i &lt; Model.getInstance().acSettings.length; i++ )<br />
	{<br />
		settingVO = Model.getInstance().acSettings.getItemAt(i) as SettingVO;<br />
		className = Class( getDefinitionByName( getQualifiedClassName( Model.getInstance()[settingVO.key] ) ) );<br />
		Model.getInstance()[settingVO.key] = settingVO.value as className;<br />
	}<br />
}</code></p>
<p>Piece by piece, here&#8217;s what happens:</p>
<ul>
<li>I first get the variable in the model correponding with the current setting key: <b>Model.getInstance()[settingVO.key]</b></li>
<li>Then I get the class name of the model variable with this: <b>getQualifiedClassName( </b>Model.getInstance()[settingVO.key] <b>)</b></li>
<li>Then I get the class definition with this:  <b>getDefinitionByName( </b>getQualifiedClassName( Model.getInstance()[settingVO.key] ) <b>)</b></li>
<li>Finally, I cast that as a Class using  <b>Class(</b> getDefinitionByName( getQualifiedClassName( Model.getInstance()[settingVO.key] ) ) <b>);</b></li>
</ul>
<p>The result is that I get whatever the classname of the variable is stored as a class in my &#8220;className&#8221; variable which I use in casting in a loop.</p>
<p>Just so you know there&#8217;s nothing else going on, my SettingVO class is nothing more than this:</p>
<p><code>package com.reynacho.Reminder.vo<br />
{<br />
	[Bindable]<br />
	public class SettingVO<br />
	{<br />
		public var settingID		:	Number;  // primary key<br />
		public var key			:	String;<br />
		public var value			:	String;<br />
		<span></span><br />
		public function SettingVO (settingID:Number, key:String, value:String)<br />
		{<br />
			this.settingID		=	settingID;<br />
			this.key			=	key;<br />
			this.value 			=	value;<br />
		}<br />
	}<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/05/flex-dynamic-casting-of-data/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reboot XP PC over Remote Desktop</title>
		<link>http://www.reynacho.com/2009/05/reboot-xp-pc-over-remote-desktop/</link>
		<comments>http://www.reynacho.com/2009/05/reboot-xp-pc-over-remote-desktop/#comments</comments>
		<pubDate>Fri, 08 May 2009 22:12:09 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Misc]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=176</guid>
		<description><![CDATA[I work from home sometimes and in the past have had to reboot my PC due to the usual random reasons.  Over a Remote Desktop connection it does not give you that option by default.  It just gives you the option to log off or disconnect.  
Servers give you the option to [...]]]></description>
			<content:encoded><![CDATA[<p>I work from home sometimes and in the past have had to reboot my PC due to the usual random reasons.  Over a Remote Desktop connection it does not give you that option by default.  It just gives you the option to log off or disconnect.  </p>
<p>Servers give you the option to reboot so I thought, why not PCs?</p>
<p>Well, there is a way and you don&#8217;t have to jump through any major hoops to do it.  Simply open the run dialog or a command shell and type<br />
<code>shutdown -r</code></p>
<p>the -r is VERY important here, otherwise, you&#8217;ll just shutdown your computer.</p>
<p>I hope that helps someone.</p>
<p>EDIT:  Please not this is on Windows XP Pro.  I&#8217;m not sure about other Operating Systems</p>
<p>EDIT 5/20/2009:  The easiest way yet is to hit Alt+F4 and select &#8220;Restart&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/05/reboot-xp-pc-over-remote-desktop/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamically instantiate a class</title>
		<link>http://www.reynacho.com/2009/04/dynamically-instantiate-a-class/</link>
		<comments>http://www.reynacho.com/2009/04/dynamically-instantiate-a-class/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 22:55:28 +0000</pubDate>
		<dc:creator>Jake Churchill</dc:creator>
		
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://jake.cfwebtools.com/?p=169</guid>
		<description><![CDATA[I ran into a problem today where the most elegant solution was to dynamically instantiate a class.  However, I couldn&#8217;t for the life of me figure out how to do that.  Basically, the situation was this:

Dispatch Event A
If Event A Fails, Dispatch Event B, then re-dispatch Event A.

This dealt with a SQLite database [...]]]></description>
			<content:encoded><![CDATA[<p>I ran into a problem today where the most elegant solution was to dynamically instantiate a class.  However, I couldn&#8217;t for the life of me figure out how to do that.  Basically, the situation was this:</p>
<ol>
<li>Dispatch Event A</li>
<li>If Event A Fails, Dispatch Event B, then re-dispatch Event A.</li>
</ol>
<p>This dealt with a SQLite database and query statements.  I want to run a Select query but if the table has not yet been created, I need to create the table then re-try the query.  Here&#8217;s what I ended up doing&#8230;</p>
<p>In the fault of the select statement I dispatch the create table event and pass it an optional string (the class that I want to instantiate).  In the create table command, I then dynamically create that class and instantiate it.  Here&#8217;s the code:</p>
<p><strong>Fault of Select Command:</strong><br />
<code>new CreateTableEvent("com.test.cairngorm.events.SelectAllEvent").dispatch();</code></p>
<p><strong>Create Table Event:</strong><br />
<code>package com.test.cairngorm.events<br />
{<br />
	import com.adobe.cairngorm.control.CairngormEvent;<br />
<strong></strong><br />
	public class CreateTableEvent extends CairngormEvent<br />
	{<br />
		public static const CREATE_TABLE_EVENT:String = "com.test.cairngorm.events.CreateTableEvent";<br />
		public var nextAction:String;<br />
		// constructor<br />
		public function CreateTableEvent(nextAction:String=")<br />
		{<br />
			this.nextAction = nextAction;<br />
			super( CREATE_TABLE_EVENT );<br />
		}<br />
	}<br />
}</code></p>
<p><strong>Result of Create Table Command:</strong><br />
<code>// sourceEvent.nextAction is the string that I passed in<br />
if( sourceEvent.nextAction.length )<br />
{<br />
        // dynamically create a class based on the string<br />
    	var c:Class = Class( getDefinitionByName( sourceEvent.nextAction ) );<br />
        // instantiate that class into a generic Object<br />
    	var o:Object = new c();<br />
        // test if the object is a CairgormEvent.<br />
        // if so, dispatch that event<br />
    	if( o is CairngormEvent )<br />
    		CairngormEventDispatcher.getInstance().dispatchEvent(CairngormEvent(o));<br />
}</code></p>
<p>Thank you very much to <a href="http://thillerson.wordpress.com/2007/03/01/runtime-class-instantiation-in-actionscript-30/">http://thillerson.wordpress.com/2007/03/01/runtime-class-instantiation-in-actionscript-30/</a> for pointing me in the right direction.  </p>
]]></content:encoded>
			<wfw:commentRss>http://www.reynacho.com/2009/04/dynamically-instantiate-a-class/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
