Skip to content

Instantly share code, notes, and snippets.

View bennadel's full-sized avatar
💭
Life's a garden, dig it!

Ben Nadel bennadel

💭
Life's a garden, dig it!
View GitHub Profile
@bennadel
bennadel / code-1.cfm
Created March 24, 2014 23:03
StructAppend() the Forgotten Function
// Copy the URL into the Attributes sturct. Unless we want to explicitly get
// information from the FORM variables (as we do in add/edit screens), we are
// just going to get it from the Attributes object to make things simpler and
// the scoping more consistent.
REQUEST.Attributes = Duplicate(URL);
// Now, go over the form variables and copy those into attributes.
for (LOCAL.Key in FORM){
REQUEST.Attributes[ LOCAL.Key ] = FORM[ LOCAL.Key ];
}
@bennadel
bennadel / code-1.txt
Created March 24, 2014 23:03
Running Multiple Instance of Homesite
HKEY_CURRENT_USER\Software\Macromedia\HomeSite5
@bennadel
bennadel / code-1.cfm
Created March 24, 2014 23:03
Short-Circuit Evaluation Is Fast
if (REFindNoCase( "slurp|googlebot|....", CGI.http_user_agent )){
@bennadel
bennadel / code-1.sql
Created March 24, 2014 23:06
SQL LIKE Directive Faster Than LEN() Method
SELECT
u.id
FROM
[user] u
WHERE
LEN( u.last_name ) > 0
@bennadel
bennadel / code-1.sql
Created March 24, 2014 23:06
SQL Query Order of Operations
FROM
contact c
INNER JOIN
display_status d
ON
(
c.display_status_id = d.id
AND
d.is_active = 1
AND
@bennadel
bennadel / code-1.cfm
Created March 24, 2014 23:06
CreateDate() Much Faster Than DateFormat() For Date-Only Creation
CreateDate( [YEAR], [MONTH], [DAY] )
@bennadel
bennadel / code-1.cfm
Created March 24, 2014 23:07
Updated Session Management And Web Spiders & Bots
// Create a lowercase version of the user agent so we can run without
// NoCase checks.
strTempUserAgent = LCase( CGI.http_user_agent );
// Check user agent.
if (
(NOT Len(strTempUserAgent)) OR
// We are gonna try to optimize even a little bit more. A good number
// of the spider names end in "bot". If we check for names that have
@bennadel
bennadel / code-1.txt
Created March 24, 2014 23:07
ColdFusion SQL Error - [Table ....] Is Not Indexable By Name
[Table (rows 1 columns ID, PREFIX, FIRST_NAME, MIDDLE_NAME, LAST_NAME, SUFFIX, WORKING_NAME): [ID: coldfusion.sql.QueryColumn@c4736a] [PREFIX:
coldfusion.sql.QueryColumn@17542e7] [FIRST_NAME:
coldfusion.sql.QueryColumn@17b5ee7] [MIDDLE_NAME:
coldfusion.sql.QueryColumn@93ab1f] [LAST_NAME:
coldfusion.sql.QueryColumn@c79c37] [SUFFIX:
coldfusion.sql.QueryColumn@e0eb96] [WORKING_NAME:
coldfusion.sql.QueryColumn@8af270] ] is not indexable by name
@bennadel
bennadel / code-1.cfm
Created March 24, 2014 23:07
SQL LIKE Clause Case Sensitive in ColdFusion MX Query-of-Query
<cfquery name="qFiles" dbtype="query">
SELECT
name
FROM
qAllFiles
WHERE
name LIKE '%.jpg'
</cfquery>
@bennadel
bennadel / code-1.txt
Created March 24, 2014 23:07
Null Pointers Are Another Name For Undefined Values
The system has attempted to use an undefined value, which usually indicates a programming error, either in your code or some system code.
Null Pointers are another name for undefined values.