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

<channel>
	<title>monkeyflash.com &#187; ColdFusion</title>
	<atom:link href="http://monkeyflash.com/category/coldfusion/feed/" rel="self" type="application/rss+xml" />
	<link>http://monkeyflash.com</link>
	<description>Greg Lunn's blog, with tutorials on Flash, CSS, ActionScript and more.</description>
	<lastBuildDate>Wed, 31 Dec 2008 18:13:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Index your site using VSpider</title>
		<link>http://monkeyflash.com/tutorials/using-vspider/</link>
		<comments>http://monkeyflash.com/tutorials/using-vspider/#comments</comments>
		<pubDate>Sun, 05 Nov 2006 20:09:44 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.monkeyflash.com/?p=77</guid>
		<description><![CDATA[Recently I needed to use Verity&#8217;s Spider (Vspider) to crawl my dynamic website to create a collection that could then be searched.  I was able to find useful information here and there but not just one place that had all the answers.  I&#8217;m not going to pretend to have all the answers, but [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to use Verity&#8217;s Spider (Vspider) to crawl my dynamic website to create a collection that could then be searched.  I was able to find useful information here and there but not just one place that had all the answers.  I&#8217;m not going to pretend to have all the answers, but hopefully you will find this beginning-to-end tutorial of making a dynamic site searchable using Vspider helpful.</p>
<p>The last several versions of ColdFusion have shipped with a 3rd-party indexing engine called Verity.  Creating standard Verity collections is covered in most ColdFusion books in great detail.  The standard indexing is great if you have static .html or .cfm pages but what if you have pages that are mostly database driven?<span id="more-77"></span></p>
<p>That&#8217;s where Vspider comes in.  Vspider is a crawling tool that will go out on your website and index your dynamic pages.  It&#8217;s not perfect, but it does come free with ColdFusion for local site use.  Similar products can cost thousands of dollars, so Vspider is worth a look.</p>
<h3>Let&#8217;s build an example</h3>
<p><strong>Step 1</strong> &#8211; To use Vspider locally your site needs to resolve using the localhost domain.  To test this, just open a browser on your server and type in <code>http://localhost/</code>.  If your home page shows up then you are good to go.  If it doesn&#8217;t you will need to change your IIS settings to point the localhost domain to your site.  It is also fine for your home page to be in a subdirectory like <code>http://localhost/mysite/</code>.</p>
<p><strong>Step 2</strong> &#8211; Choose a directory on your server to store a text file that you will call from the command prompt.  I choose the <code>verity</code> directory under my CF installation directory.</p>
<p>Next create a text document using Notepad to contain all of your command calls.  Using a text document is much easier that typing the same thing over and over into the command prompt.</p>
<p>You can reference the <a href="http://livedocs.macromedia.com/coldfusion/7/htmldocs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=ColdFusion_Documentation&amp;file=00001778.htm">Adobe livedocs</a> for all of the Vspider commands but your document should look something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">-style c:\cfusionmx\verity\data\stylesets\coldfusionvspider\
-collection c:\cfusionmx\verity\collections\newsite
-exclude http://localhost/newsite/_mmServerScripts/*
-exclude http://localhost/newsite/_notes/*
-exclude http://localhost/newsite/admin/*
-start http://localhost/newsite/index.cfm
-cgiok</pre></div></div>

<p>I saved this text file at <strong>myindex.txt</strong>.</p>
<p><strong>Step 3</strong> &#8211; Once the file is created you are ready to index your pages.  First open a command prompt window by selecting <strong>Start -&gt; Run</strong>, enter <code>cmd</code>, and click <strong>Run</strong>.  I normally change my directory to the c: directory by entering <code>cd C:\</code>.  Next you use the <code>cmdfile</code> command to call the Vspider command file that we created earlier.  The call looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;">vspider -cmdfile c:\cfusionmx\verity\myindex.txt</pre></div></div>

<p class="image"><img src="/images/verity3.gif" alt="Code entered into Notepad and Command Prompt." /></p>
<p class="caption">Text file and Command Prompt code.</p>
<p><strong>Step 4</strong> &#8211; Open CF administrator and browse to the <strong>Verity Collections</strong> section.  Create a collection by filling out the form under <strong>Add New Verity Collections</strong>.  The name of your collection should be the same as the collection you created during indexing.  For this example it is <code>newsite</code>.  Choose the Language setting <strong>Englishx</strong> as your language because this is the language that Vspider uses.  Under <strong>Path</strong> you will want to enter the directory location where your collection was stored during indexing.  For this example it is <code>c:\cfusionmx\verity\collections</code>.</p>
<p class="image"><img src="/images/verity4.gif" alt="Verity Collections panel under CF Administrator." /></p>
<p class="caption">Settings as they appear in CF Administrator.</p>
<p><strong>Step 5</strong> &#8211; Once you&#8217;ve entered the collection into CF Administrator you should see the collection in the list under Verity Collections.  The number of documents in the collection should match the number indexed by Vspider.  At this point the collection has been created and mapped and is ready for use.</p>
<p>Now it&#8217;s time to create a search form to test your collection.  The following form will do the trick.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;post&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;search_action.cfm&quot;</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;criteria&quot;</span> <span style="color: #000066;">size</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;30&quot;</span> <span style="color: #000066;">maxlength</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;50&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Search&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>Place this form in a CFM file and save it at <code>search.cfm</code>.</p>
<p>You&#8217;ll also need an action page to process your search form.  This page will include a <code>cfsearch</code> call and a <code>cfoutput</code> to display the results.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfsearch</span> collection<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;newsite&quot;</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;GetResults&quot;</span> criteria<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#Form.criteria#&quot;</span> suggestions<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;1&quot;</span> status<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;info&quot;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> count<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;1&quot;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfoutput</span> <span style="color: #0000FF;">query</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;GetResults&quot;</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfoutput</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfset</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfsearch</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">dl</span> <span style="color: #0000FF;">class</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;searchresults&quot;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #808080; font-style: italic;">&lt;!--- Remove the http://localhost from the URL ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">dt</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #0000FF;">#count#</span>. <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">a</span> <span style="color: #0000FF;">href</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#replace(URL,&quot;</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #0000FF;">#Title#</span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">a</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">dt</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #000000; font-weight: bold;">dd</span><span style="color: #0000FF;">&gt;</span></span><span style="color: #0000FF;">#Context#</span><span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">dd</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #000000; font-weight: bold;">dl</span><span style="color: #0000FF;">&gt;</span></span>
&nbsp;
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> count<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;count&quot;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfset</span><span style="color: #0000FF;">&gt;</span></span></pre></div></div>

<p>If this search page will reside under the same domain as your site then the above example should work just fine.  If not then you can replace <code>http://localhost</code> with your site domain.</p>
<p>Save the action page as <code>search_action.cfm</code> in the same directory as <code>search.cfm</code>. View <code>search.cfm</code> in a browser, and use the form to test your collection.</p>
<p>The trick for me in this process was learning that you must index your website using Vspider BEFORE you create the collection in CF Administrator.  If you create the collection in CF Administrator first, Vspider will return a list of errors during indexing, none of which explain the problem.</p>
<p><em>-Guest Article by Richard Baldwin</em></p>
]]></content:encoded>
			<wfw:commentRss>http://monkeyflash.com/tutorials/using-vspider/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMS and ColdFusion MX 7</title>
		<link>http://monkeyflash.com/tutorials/sms-and-coldfusion/</link>
		<comments>http://monkeyflash.com/tutorials/sms-and-coldfusion/#comments</comments>
		<pubDate>Mon, 20 Jun 2005 20:07:34 +0000</pubDate>
		<dc:creator>Greg</dc:creator>
				<category><![CDATA[ColdFusion]]></category>
		<category><![CDATA[Tutorials]]></category>

		<guid isPermaLink="false">http://www.monkeyflash.com/?p=75</guid>
		<description><![CDATA[In a recent discussion about an upcoming project, the idea of &#8220;reaching beyond the browser&#8221; came up.  We wanted to provide students (our target audience) with an avenue to provide feedback in addition to the web.  After our meeting we had two questions to answer: What was the best way to provide interaction [...]]]></description>
			<content:encoded><![CDATA[<p>In a recent discussion about an upcoming project, the idea of &#8220;reaching beyond the browser&#8221; came up.  We wanted to provide students (our target audience) with an avenue to provide feedback in addition to the web.  After our meeting we had two questions to answer: What was the best way to provide interaction to mobile devices, and what could we use in our current infrastructure that would allow us to talk to mobile devices?</p>
<p>The answers were SMS (Short Message Service) and ColdFusion MX 7.  Thanks to the awesome Macromedia MAX conference in November, I was aware that ColdFusion MX 7 was going to include a new Event Gateway that allowed a ColdFusion application to send and receive SMS messages.  My next step was to set up a sample application, so our team members could see how it would work.<span id="more-75"></span></p>
<p>I was able to find a good overview of how a CF application and a mobile device communicate using SMS here: </p>
<p><strong><a href="http://www.macromedia.com/software/coldfusion/event_gateways/">http://macromedia.com/software/coldfusion/event_gateways/</a></strong></p>
<p>What I couldn&#8217;t find was a good step-by-step CF SMS example, so I pieced together what I could find and created this one. In this tutorial we will set up a CF gateway and create a sample application that will receive SMS messages as votes for candidates and send a confirmation message to the voter.</p>
<p><strong>Step 1</strong> &#8211; Locate your <strong>sms-test.cfg</strong> file in your CF installation directory under gateway\config\.</p>
<p><strong>Step 2</strong> &#8211; Copy this file and save it in the same directory as <strong>vote.cfg</strong> or a name of your choosing.</p>
<p>If you open this file you will see all of the settings that your Gateway Instance will use to send and receive messages.  Since this is a test application, we will use the default settings that point the Gateway Instance to IP 127.0.0.1, port 7901, and phone number 5551212.    </p>
<p><strong>Step 3</strong> &#8211; Create a blank CFC called <strong>vote.cfc</strong> and save it under your web root in a folder of your choosing.  This will be the file that processes all incoming SMS messages.</p>
<p><strong>Step 4</strong> &#8211; Login to CF Administrator and make sure the SMS Test Server is running under Event Gateways and Settings.</p>
<p><strong>Step 5</strong> &#8211; Create a new Gateway Instances in the CF Administrator under Event Gateways and Gateway Instances.</p>
<blockquote style="margin-left: 25px;"><p><strong>Gateway ID:</strong> SMS Vote &#8211; 5551212<br />
<strong>Gateway Type:</strong> SMS Gateway<br />
<strong>CFC Path:</strong> <em>web root</em>\subfolder\vote.cfc<br />
<strong>Configuration File:</strong> <em>cf rootdir</em>\gateway\config\vote.cfg<br />
<strong>Startup Mode:</strong> Automatic</p></blockquote>
<p><strong>Step 6</strong> &#8211; Start the SMS Vote &#8211; 5551212 Gateway Instance and make sure it is the only SMS Instance running.</p>
<p><strong>Step 7</strong> &#8211; Now that your Gateway is up and running we will add our SMS processing code to our <strong>vote.cfc</strong>.</p>
<p>First, we create our component and define our only method with the name <strong>onIncomingMessage</strong>.  This is the method that the gateway will call whenever there is an incoming message.  The only argument supplied by the gateway is a structure called CFEvent that contains information about the incoming message.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfcomponent</span> displayname<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;SMS Voting Listener&quot;</span> <span style="color: #0000FF;">hint</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Process SMS messages.&quot;</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cffunction</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;onIncomingMessage&quot;</span> output<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;no&quot;</span><span style="color: #0000FF;">&gt;</span></span>
   <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfargument</span> <span style="color: #0000FF;">name</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;CFEvent&quot;</span> <span style="color: #0000FF;">type</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;struct&quot;</span> <span style="color: #0000FF;">required</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;yes&quot;</span> <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>Next we pull the incoming message and the sender&#8217;s phone number out of the structure.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Get message data and sender number---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> voterMessage<span style="color: #0000FF;">=</span>arguments.CFEvent.<span style="color: #0000FF;">data</span>.message <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> voterNumber<span style="color: #0000FF;">=</span>arguments.CFEvent.originatorID <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>We will also need to create a return structure to pass back to the gateway.  The command value is set to submit which will send the return message, the gatewayid is set as the source address for the message, and the destination address is set as the voter&#8217;s phone number.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Set up return struct with needed arguments---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue<span style="color: #0000FF;">=</span><span style="color: #0000FF;">structNew</span><span style="color: #0000FF;">&#40;</span><span style="color: #0000FF;">&#41;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.command<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;submit&quot;</span> <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.sourceAddress<span style="color: #0000FF;">=</span>arguments.CFEvent.gatewayid <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.destAddress<span style="color: #0000FF;">=</span>voterNumber <span style="color: #0000FF;">/&gt;</span></span></pre></div></div>

<p>Next we will use a switch statement to process the incoming message.  If the message is &#8220;Carrie&#8221; or &#8220;Bo&#8221; then we will insert the vote and voter&#8217;s phone number into our database.  We also set the return message that thanks our user for voting.  If the incoming message wasn&#8217;t a candidate&#8217;s name then we return a &#8220;Not a voting option&#8221; message.</p>
<p>Note: Be sure to create a database and datasource (called &#8220;SMSVotes&#8221; in this example) for this code to use.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Add vote to db if incoming msg is a name and set return msg ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfswitch</span> expression<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;#voterMessage#&quot;</span><span style="color: #0000FF;">&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfcase</span> <span style="color: #0000FF;">value</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Carrie&quot;</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfquery</span> <span style="color: #0000FF;">datasource</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;SMSVotes&quot;</span><span style="color: #0000FF;">&gt;</span></span>
            INSERT INTO Votes(Phone, Vote)
            VALUES ('<span style="color: #0000FF;">#voterNumber#</span>', 'Carrie')
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfquery</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.shortMessage<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Thank you for voting for &quot;</span> <span style="color: #0000FF;">&amp;</span> voterMessage <span style="color: #0000FF;">/&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfcase</span><span style="color: #0000FF;">&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfcase</span> <span style="color: #0000FF;">value</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Bo&quot;</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfquery</span> <span style="color: #0000FF;">datasource</span><span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;SMSVotes&quot;</span><span style="color: #0000FF;">&gt;</span></span>
            INSERT INTO Votes(Phone, Vote)
            VALUES ('<span style="color: #0000FF;">#voterNumber#</span>', 'Bo')
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfquery</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.shortMessage<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Thank you for voting for &quot;</span> <span style="color: #0000FF;">&amp;</span> voterMessage <span style="color: #0000FF;">/&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfcase</span><span style="color: #0000FF;">&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfdefaultcase</span><span style="color: #0000FF;">&gt;</span></span>
        <span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfset</span> retValue.shortMessage<span style="color: #0000FF;">=</span><span style="color: #009900;">&quot;Not a voting option: &quot;</span> <span style="color: #0000FF;">&amp;</span> voterMessage <span style="color: #0000FF;">/&gt;</span></span>
    <span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfdefaultcase</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfswitch</span><span style="color: #0000FF;">&gt;</span></span></pre></div></div>

<p>Lastly, we return our return structure with all the information the gateway needs to send our voter a confirmation message.</p>

<div class="wp_syntax"><div class="code"><pre class="cfm" style="font-family:monospace;"><span style="color: #808080; font-style: italic;">&lt;!--- Send the return struct to gateway ---&gt;</span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;</span><span style="color: #990000; font-weight: bold;">cfreturn</span> retValue <span style="color: #0000FF;">/&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cffunction</span><span style="color: #0000FF;">&gt;</span></span>
<span style="color: #333333;"><span style="color: #0000FF;">&lt;/</span><span style="color: #990000; font-weight: bold;">cfcomponent</span><span style="color: #0000FF;">&gt;</span></span></pre></div></div>

<p><strong>Step 8</strong> &#8211; Now we need to test our application and to do this we will use a cell phone emulator that is installed with CF 7.  Go to Start -> Programs -> Macromedia -> ColdFusion MX 7 -> SMS Client Application.  This will launch a command prompt window along with a Java popup that is pre-filled with default connection information, which we will use.</p>
<p>Once you connect, you will see a simulated cell phone interface useful for testing purposes.  You can type your message by using the keypad on the cell phone or by selecting the text box and typing with your keyboard.  Try voting for Carrie, Bo, and a non-candidate to see if your application is working properly.  </p>
<p>That&#8217;s it!  That is all you need to do to get an example SMS application up and running.  As laid out in the Macromedia link above, you will need to set up an account with a SMSC (Short Message Service Center) such as AT&#038;T, Verizon, or Sprint to actually be able to send and receive SMS messages.  This provider will receive all the incoming SMS messages over their mobile network and then forward that message over TCP/IP to your ColdFusion server. After the SMSC provides you with settings for your <strong>vote.cfg</strong> file, you will be SMS enabled.  </p>
<p>I hope you found this tutorial useful. Now go forth and start texting!</p>
<p><em>-Guest Article by Richard Baldwin</em></p>
]]></content:encoded>
			<wfw:commentRss>http://monkeyflash.com/tutorials/sms-and-coldfusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
