Skip to content

Instantly share code, notes, and snippets.

View 65's full-sized avatar

Duncan Isaksen-Loxton 65

View GitHub Profile
@65
65 / url.txt
Created March 11, 2012 07:38
Discount Images on Amazon ECS images
http://images.amazon.com/images/P/0976925524.01._PE20_SCMZZZZZZZ_.jpg
@65
65 / associateid.cfm
Created March 11, 2012 07:36
Using Your Associates ID with Amazon ECS
<cfset ASIN = "">
<!--- The asin code you just picked --->
<cfset accesskey = "">
<!--- Your unique API access key --->
<cfset ASIN = "sixfive-21">
<!--- Your associates ID --->
<cfset var AmazonURL = "http://ecs.amazonaws.co.uk/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=#accesskey#&AssociateTag=#associateTag#&Operation=ItemLookup&MerchantID=All&ItemId=#ASIN#&ResponseGroup=Medium">
@65
65 / DocPath.cfm
Created March 10, 2012 20:47
URL rewriting with your web server - its not hard!
<cfif ListLen(DocPath) eq 1 and ListFind("admin,[add other physical root directories here as list items]", ListFirst(DocPath))>
<cflocation url="/#ListFirst(DocPath)#/index.cfm" addtoken="no"/>
</cfif>
@65
65 / cfout.bat
Created March 10, 2012 20:42
Debugging server hangs with JVM thread dumps
cd \
cd c:\cfusionmx7\bin\
cfstart > c:\temp\cfout.txt
@65
65 / cfstat.bat
Created March 10, 2012 20:39
See inside your server with cfstat
cd \
cd c:\cfusionmx7\bin\
cfstat 1 > c:\temp\cfstat.txt
@65
65 / itempicked.cfm
Created March 10, 2012 20:36
Using the Amazon Ecommerce Services in ColdFusion
<cfset ASIN = ""><!--- The asin code you just picked --->
<cfset accesskey = ""><!--- Your unique API access key --->
<cfset AmazonURL = "http://ecs.amazonaws.co.uk/onca/xml?Service=AWSECommerceService&AWSAccessKeyId=#accesskey#&Operation=ItemLookup&MerchantID=All&ItemId=#ASIN#&ResponseGroup=Medium">
<cfhttp url="#AmazonURL#" method="get" timeout="60">
<cfset productxmldata = "#XMLParse(cfhttp.fileContent)#">
<cfset productxml = productxmldata.XMLRoot>
<cfdump var="#productxml#">
@65
65 / ReplacenoCase.cfm
Created March 10, 2012 20:24
converting a Java ByteArray to a String and ColdFusion Variable
#ReplacenoCase(ReplacenoCase(pageOut.write(f.Content[1], 0, len(f.Content[1])),"<","&lt;","ALL"),">","&gt;")#
@65
65 / checkout.cfm
Created March 10, 2012 20:13
IIF DE difference between ColdFusion 7 and 8
#iif(arguments.CallingPage eq 'Checkout',DE('return checkPaymentForm();'),'')#
@65
65 / sleep.cfm
Created March 10, 2012 20:03
Sleep and pause a ColdFusion or Java thread
<cfset thread = CreateObject("java", "java.lang.Thread")>
<cfset thread.sleep(5000)>
@65
65 / concatnulloff.sql
Created March 10, 2012 19:59
concatenation of null values in SQL from a join of tables
set CONCAT_NULL_YIELDS_NULL OFF
select distinct (select CategoryName +'/' from Category where CategoryID = epc.CategoryParentID ) + CategoryName as CategoryName
from Category epc