Posts filed under ‘ColdFusion’

CF9.0.1 CFLOCATION onRequestEnd problems…

Quick heads up! This has caused me serious headache.

The way onRequestEnd works in ColdFusion 9.0.1 has changed, it now executes the onRequestend method in the application.cfc after a redirect… This can seriously mess up some code like it did mine.

February 21, 2011 at 5:10 am Leave a comment

cfhttp I/O Exception: peer not authenticated Error

cfhttp I/O Exception: peer not authenticated Error

Continue Reading January 19, 2011 at 7:50 am 1 comment

EWay ColdFusion Component CFC – Payment Gateway

I’ve invested some time a while ago in creating a ColdFusion Component to integrate with Eway Payment Gateway. I’m not using them anymore and giving the Component away in return for a text link. If you want a copy of the component just leave a comment with the URL where I can find a link to any page of the following sites:

http://www.executiveresults.com.au
http://www.clickfind.com.au
pacificfox.com
http://www.thetoughspot.com.au
http://www.glovesboxing.com.au
http://www.cavemantraining.com.au

Following is bit of the CFC

<cfcomponent 
 displayname="Eway" 
 hint="Eway" 
 output="false" 
 author="Taco Fleur (taco.fleur@clickfind.com.au)" 
 version="1">

 <!--- Set instance variables --->
 <!---
 // http://www.eway.com.au/Support/Developer/PaymentsRebill.aspx
 --->
 <cfscript>
 this.constant.LIVE_GATEWAY_URI = "https://www.eway.com.au/gateway/rebill/manageRebill.asmx";
 this.constant.TEST_GATEWAY_URI = "https://www.eway.com.au/gateway/rebill/test/manageRebill_test.asmx";
 this.constant.GATEWAY = "TEST";                 // TEST or LIVE
 this.constant.LIVE_EWAY_CUSTOMER_ID = "";     // required, customer id assigned to you by eWay
 this.constant.TEST_EWAY_CUSTOMER_ID = "";
 
 variables.instance.userIdentity = 0;
 variables.instance.customerFirstName = "";             // required
 variables.instance.customerLastName = "";             // required
 variables.instance.ewayTotalAmount = 0;             // total amount in cents for the transaction, eg $1.00 = 100, maximum length 12
 // the test Total Amount should end in 00 or 08 to get a successful response (e.g. $10.00 or $10.08) - all other amounts will return a failed response
 variables.instance.ewayCustomerInvoiceRef = 0;         // reference to your own invoice system for the purchase
 variables.instance.rebillCCName = "";                 // required, customer's credit card number
 variables.instance.rebillCCNumber = "";             // required, customer's credit card number
 variables.instance.rebillCCExpMonth = "";             // required, expiry month of customer's credit card
 variables.instance.rebillCCExpYear = "";             // required, expiry year of customer's credit card. Format must be either (yy or yyyy) eg. 06 or 2006.
 variables.instance.rebillInitAmt = 0;                 // required, initial payment amount of the reBILL event. Enter 0 if initial payment is not required.
 variables.instance.rebillInitDate = lsDateFormat( now(), "dd/mm/yyyy" ); // required, date of the initial payment of the reBILL event. Enter today's date if no initial payment is required. Format dd/mm/yyyy.
 variables.instance.rebillRecurAmt = 0;                 // required, recurring payment amount of the reBILL. The value must be greater than 0.
 variables.instance.rebillStartDate = lsDateFormat( now(), "dd/mm/yyyy" ); // required, date of the first recurring payment. Format must of  dd/mm/yyyy
 variables.instance.rebillInterval = 1;                 // required, size of the interval between recurring payments (used in conjunction with RebillIntervalType). The value must be 1 to 31 only.
 variables.instance.rebillIntervalType = "Months";     // required, type of Interval. (1 = Days, 2 = Weeks, 3 = Months, 4 = Years). The value must be only 1 or 2 or 3 or 4. eg. Payments every 3 weeks, enter 3 in the RebillInterval field, and 2 in the RebillIntervalType field. 
 variables.instance.rebillEndDate = lsDateFormat( dateAdd( "y", 10, now() ), "dd/mm/yyyy" ); // required, date that recurring payments are to stop. Format must of  dd/mm/yyyy. This date must be after RebillStartDate.
 variables.instance.requestXML = xmlNew();
 variables.instance.responseXML = xmlNew();
 </cfscript>

…………..

You’ll get the component in return for a simple text link, the link needs to stay up for at least a year, once I send the component I’ll trust you’ll do the honorable thing 🙂

June 12, 2010 at 12:52 am Leave a comment

What is utm? utm_

UTM stands for Urchin Traffic Monitor and is originally part of Urchin 4, and was specifically designed to provide the most accurate measurements of unique website visitors. For businesses looking to get a deeper understanding of their online visitor behavior.

http://www.google.com/support/urchin45/bin/answer.py?hl=en&answer=28710

This extra information appears in the Google Analytics reports under Traffic Sources.

Campaign Source (utm_source) Required. Use utm_source to identify a search engine, newsletter name or other source.
Example: utm_source=google
Campaign Medium (utm_medium) Required. Use utm_medium to identify a medium such as email or cost-per- click.
Example: utm_medium=cpc
Campaign Term (utm_term) Used for paid search. Use utm_term to note the keywords for this ad.
Example: utm_term=running+shoes
Campaign Content (utm_content) Used for A/B testing and content-targeted ads. Use utm_content to differentiate between ads or links that point to the same URL.
Examples: utm_content=logolink or utm_content=textlink
Campaign Name (utm_campaign) Used for keyword analysis. Use utm_campaign to identify a specific product promotion or strategic campaign.
Example: utm_campaign=spring_sale

Following is a ColdFusion CFC to get the values passed in the URM variables.

<cfcomponent
 displayname="UrchinTrafficMonitor"
 hint=""
 output="false"
 author="Taco Fleur (taco.fleur@clickfind.com.au)"
 version="1">

 <!--- Set instance variables --->
 <cfscript>
 variables.instance.referrer = "";
 variables.instance.campaignSource = ""; // referrer: google, citysearch, newsletter4
 variables.instance.campaignMedium = ""; // marketing medium: cpc, banner, email
 variables.instance.campaignTerm = ""; // identify the paid keywords
 variables.instance.campaignContent = ""; // use to differentiate ads
 variables.instance.campaignName = ""; // product, promo code or slogan
 </cfscript>

 <cffunction
 access="public"
 name="init"
 output="false"
 returntype="UrchinTrafficMonitor">

 <cfargument
 name="referrer"
 type="string"
 required="yes">

 <cfscript>
 setReferrer( arguments.referrer );
 doInitialize();
 return this;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setReferrer"
 output="false"
 returntype="void">

 <cfargument
 name="referrer"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.referrer = arguments.referrer;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getReferrer"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.referrer;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setCampaignSource"
 output="false"
 returntype="void">

 <cfargument
 name="campaignSource"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.campaignSource = arguments.campaignSource;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getCampaignSource"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.campaignSource;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setCampaignMedium"
 output="false"
 returntype="void">

 <cfargument
 name="campaignMedium"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.campaignMedium = arguments.campaignMedium;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getCampaignMedium"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.campaignMedium;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setCampaignTerm"
 output="false"
 returntype="void">

 <cfargument
 name="campaignTerm"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.campaignTerm = arguments.campaignTerm;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getCampaignTerm"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.campaignTerm;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setCampaignContent"
 output="false"
 returntype="void">

 <cfargument
 name="campaignContent"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.campaignContent = arguments.campaignContent;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getCampaignContent"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.campaignContent;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="setCampaignName"
 output="false"
 returntype="void">

 <cfargument
 name="campaignName"
 required="yes"
 type="string">

 <cfscript>
 variables.instance.campaignName = arguments.campaignName;
 </cfscript>

 </cffunction>

 <cffunction
 access="public"
 name="getCampaignName"
 output="false"
 returntype="string">

 <cfscript>
 return variables.instance.campaignName;
 </cfscript>

 </cffunction>

 <cffunction
 access="private"
 name="doInitialize"
 output="false"
 returntype="void">

 <cfscript>
 variables.queryString = listLast( getReferrer(), "?" );
 variables.url = structNew();
 </cfscript>
 <cfloop
 index="item"
 list="#variables.queryString#"
 delimiters="&">
 <cfscript>
 variables.key = listFirst( item, "=" );
 variables.value = listLast( item, "=" );
 if ( not structKeyExists( variables.url, variables.key ) ) {
 structInsert( variables.url, variables.key, urlDecode( variables.value ) );
 }
 else {
 listAppend( variables.url[ variables.key], urlDecode( variables.value ) );
 }
 </cfscript>
 </cfloop>

 <cfscript>
 if ( structKeyExists( variables.url, "utm_source" ) ) {
 setCampaignSource( variables.url[ "utm_source" ] );
 }
 if ( structKeyExists( variables.url, "utm_medium" ) ) {
 setCampaignMedium( variables.url[ "utm_medium" ] );
 }
 if ( structKeyExists( variables.url, "utm_term" ) ) {
 setCampaignTerm( variables.url[ "utm_term" ] );
 }
 if ( structKeyExists( variables.url, "utm_content" ) ) {
 setCampaignContent( variables.url[ "utm_content" ] );
 }
 if ( structKeyExists( variables.url, "utm_campaign" ) ) {
 setCampaignName( variables.url[ "utm_campaign" ] );
 }
 </cfscript>

 </cffunction>

</cfcomponent>

Code to call the CFC.

<cfscript>
 variables.UrchinTrafficMonitor = createObject( "component", "UrchinTrafficMonitor" ).init( referrer = "http://www.clickfind.com.au/?utm_source=clickfind&utm_medium=cpc&utm_term=advertising&utm_content=ad1&utm_campaign=online+promo");
</cfscript>
<cfdump var="#variables.UrchinTrafficMonitor.getCampaignMedium()#">
<cfabort>

Source
Every referral to a web site has an origin, or source. Examples of sources are the Google search engine, the AOL search engine, the name of a newsletter, or the name of a referring web site.

Medium
The medium helps to qualify the source; together, the source and medium provide specific information about the origin of a referral. For example, in the case of a Google search engine source, the medium might be “cost-per-click”, indicating a sponsored link for which the advertiser paid, or “organic”, indicating a link in the unpaid search engine results. In the case of a newsletter source, examples of medium include “email” and “print”.

Term
The term or keyword is the word or phrase that a user types into a search engine.

Content
The content dimension describes the version of an advertisement on which a visitor clicked. It is used in content-targeted advertising and Content (A/B) Testing to determine which version of an advertisement is most effective at attracting profitable leads.

Campaign
The campaign dimension differentiates product promotions such as “Spring Ski Sale” or slogan campaigns such as “Get Fit For Summer”.

May 31, 2010 at 4:47 am Leave a comment

encodeURIComponent ColdFusion

JavaScript encodeURIComponent converted to ColdFusion. This is used for OAuth.

			
 <cffunction 
 access="private" 
 name="doPercentEncode" 
 output="false" 
 returntype="string">

 <cfargument 
 name="stringToEncode" 
 type="string" 
 required="yes">

 <cfscript>
 variables.encodedString = arguments.stringToEncode;
 variables.encodedString = replace( variables.encodedString, "!", "%21", "all" );
 variables.encodedString = replace( variables.encodedString, "*", "%2A", "all" );
 variables.encodedString = replace( variables.encodedString, "##", "%23", "all" );
 variables.encodedString = replace( variables.encodedString, "$", "%24", "all" );
 variables.encodedString = replace( variables.encodedString, "%", "%25", "all" );
 variables.encodedString = replace( variables.encodedString, "&", "%26", "all" );
 variables.encodedString = replace( variables.encodedString, "'", "%27", "all" );
 variables.encodedString = replace( variables.encodedString, "(", "%28", "all" );
 variables.encodedString = replace( variables.encodedString, ")", "%29", "all" );
 variables.encodedString = replace( variables.encodedString, "@", "%40", "all" );
 variables.encodedString = replace( variables.encodedString, "/", "%2F", "all" );
 variables.encodedString = replace( variables.encodedString, "^", "%5E", "all" );
 variables.encodedString = replace( variables.encodedString, "~", "%7E", "all" );
 variables.encodedString = replace( variables.encodedString, "{", "%7B", "all" );
 variables.encodedString = replace( variables.encodedString, "}", "%7D", "all" );
 variables.encodedString = replace( variables.encodedString, "[", "%5B", "all" );
 variables.encodedString = replace( variables.encodedString, "]", "%5D", "all" );
 variables.encodedString = replace( variables.encodedString, "=", "%3D", "all" );
 variables.encodedString = replace( variables.encodedString, ":", "%3A", "all" );
 variables.encodedString = replace( variables.encodedString, ",", "%2C", "all" );
 variables.encodedString = replace( variables.encodedString, ";", "%3B", "all" );
 variables.encodedString = replace( variables.encodedString, "?", "%3F", "all" );
 variables.encodedString = replace( variables.encodedString, "+", "%2B", "all" );
 variables.encodedString = replace( variables.encodedString, "\", "%5C", "all" );
 variables.encodedString = replace( variables.encodedString, '"', "%22", "all" );
 return variables.encodedString;
 </cfscript>

 </cffunction>

May 17, 2010 at 1:01 am Leave a comment

CFHTTP Connection Failure

If you’re getting a “Connection Failure” error when using the ColdFusion CFHTTP tag and have absolutely no idea what the problem could be as surfing the page via the browser works, then the web server most likely compresses the content and ColdFusion can’t handle the output.

To fix this issue just add the following two cfhttpparam tags to the request, they will tell the remote web server not to return a compressed response.

<cfhttpparam type=”header” name=”accept-encoding” value=”deflate;q=0″>
<cfhttpparam type=”header” name=”te” value=”deflate;q=0″>

September 28, 2009 at 9:05 pm 8 comments

CFPOP GMail

To check gmail with cfpop you need to use the following code before you make your cfpop call

<cfscript>
javaSystem = createObject( “java”, “java.lang.System” );
jProps = javaSystem.getProperties();
jProps.setProperty( “mail.pop3.socketFactory.class”, “javax.net.ssl.SSLSocketFactory” );
jProps.setproperty( “mail.pop3.port”, 995 );
jProps.setProperty( “mail.pop3.socketFactory.port”, 995 );
</cfscript>

<cfpop action=”getheaderonly” name=”rsEmail” startrow=”1″ maxrows=”50″ server=”pop.gmail.com” port=”995″ username=”your@username.com.au” password=”yourpassword”>

May 24, 2009 at 11:54 pm Leave a comment

Older Posts


Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 19 other followers

Archives

Top Rated

Top Clicks

  • None

Blog Stats

  • 168,294 hits

%d bloggers like this: