Skip to content

Instantly share code, notes, and snippets.

View 65's full-sized avatar

Duncan Isaksen-Loxton 65

View GitHub Profile
@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 / 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 / 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 / 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
@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 / imgresize.cfm
Created March 10, 2012 19:54
cfimage vs imagecr3 quality comparison
<cfoutput>
<cfloop from="10" to="100" index="i" step="10">
<cfimage source="bridge.jpg" name="myImage">
<cfimage source="#myImage#" action="resize" width="#i#%" height="#i#%" destination="bridge_#i#.jpg" overwrite="true">
<cfx_imagecr3 load="#ExpandPath('bridge.jpg')#" resize="#i#%" save="#ExpandPath('cr_bridge_#i#.jpg')#">
<p>#i#%<img src="bridge_#i#.jpg">
<img src="cr_bridge_#i#.jpg">
</cfloop>
<img src="bridge.jpg">
</cfoutput>
@65
65 / errors.txt
Created March 10, 2012 19:29
Using Smartermail Web Services and API to create domains with ColdFusion
Web service operation AddDomain with parameters {PopPort={110},PrimaryDomainAdminLastName={Master},ShowSpamMenu={1},MaxRecipients={200},SmtpPort={25},MaxLists={0},authPassword={cosmo81Ad1m1n},MaxMailboxSizeInMB={50},ShowListMenu={0},authUserName={serv3rAdm1nU53r},ShowStatsMenu={1},IP={192.168.30.2},RequireSmtpAuthentication={1},ImapPort={143},MaxDomainSizeInMB={250},MaxDomainAliases={0},PrimaryDomainAdminUserName={emailmaster},ShowDomainAliasMenu={0},DomainName={newdomain.com.au},MaxAliases={100},ListCommandAddress={list-admin},Path={D:\SmarterMail\Domains\newdomain.com.au},ShowContentFilteringMenu={1},PrimaryDomainAdminPassword={somRa2dompassword},MaxDomainUsers={5},MaxMessageSize={20000}} cannot be found.
The error occurred in C:\development\localhost\httpdocs\scribble.cfm: line 40
38 : <cfinvokeargument name="RequireSmtpAuthentication" value="1">
39 : <cfinvokeargument name="ShowListMenu" value="0">
40 : <cfinvokeargument name="ListCommandAddress" value="list-admin">
41 : </cfinvoke>
42