Posts

Showing posts from 2011

Creating an environment safe wrapper for cfmail

The one thing that always makes me nervous when testing other people's code, is who is this going to email? Well many years back I created a cf_email custom tag that wrapped cfmail with some special if logic before it to determine if it was in production or different environment. The logic for is easy comparenoCase(server.serverLevel,"PRODUCTION") EQ 0 and there was another script that got included in the application.cfm file "server.cfm" that loaded the server variables. But the issue I ran into lately, was I needed to use one of the newer features within cfmail that wasn't hard coded into my wrapper. So knowing that coldfusion added the support to attributeCollection=attributes and seeing the Ray Camden had a nice blog post on CFASSOCIATE . I asked one of my co-workers to work on it :-D But anyways, we came up with the below code. The below code allows the same features within coldfusion to be used for within the customTag, but now we can add ...

Null Values within SQL Select Statement with CFQUERYPARAM

I was working on code where I wanted to store nulls into the database and query based on those nulls. <cfquery name="qRetrieve" datasource="#getDSN().getName()#"> select semesterID,Major_ID,Campus_ID,AdmTypeReqID,startDate,startOrEndFlag from isFull where semesterID = <cfqueryparam value="#arguments.DTO.getsemesterID()#" cfsqltype="CF_SQL_INTEGER"> AND Campus_ID = <cfqueryparam value="#arguments.DTO.getCampus_ID()#" cfsqltype="CF_SQL_INTEGER"> AND startOrEndFlag = <cfqueryparam value="#arguments.DTO.getstartOrEndFlag()#" cfsqltype="CF_SQL_INTEGER"> AND AdmTypeReqID= <cfqueryparam value="#arguments.DTO.getAdmTypeReqID()#" cfsqltype="CF_SQL_INTEGER" null="#iif(arguments.DTO.getAdmTypeReqID(),true,false)#"> </cfquery> Notice the last line is using the function IIF instide the null attribute of cfqueryparam.  In the SQL Inse...

coldbox environment safe email service

Almost a year ago I updated an interceptor I built for coldBox to allow our non-production environments (development and testing) to have a smart configuration that it DOES NOT send the email to the production users.  And I just realized that I never wrote a blog post on it. Using the core functionality of coldbox, I configure our development and test environments to have its own configuration. ie. function configure() {      environments = {           localDevelopment = "URL.local",           development = "URL"      }; } function localDevelopment() {      //Register interceptors as an array, we need order      local.newInterceptors = {class="EnvironmentSafeMailService",           properties={EmailTrace=true, EmailSend=false, EmailOverrideAddress="email@address.com"}      }; ArrayAppend(interceptors ,local.newI...

coldfusion builder 2 extension not displaying browse button on type=projectdir

I'm in the process of creating an extension that fires from the RDSView (from a database table).  Basically I would like it to create 7 files for me by using the table's columns I selected.  *PERFECT*, I got the files being created, but I have to TYPE in the LOCATION to store the files <-- WHAT --  Yes, I said I have to type in the full path to where I want the files to be stored. So my question to anyone who might see this blog is -->  Is there a way via (call back, response, etc) in an cfbuilder extension for the user to pick the project and/or folder as an input? PS.  if you read this and don't know the answer, please "socialize" it (tweet, FaceBook, etc) so possibly the correct person with the answer can answer it.  *THANKS* **UPDATE 9/29/2011** I was able to email a contact at Adobe with this issue, and after working back and forth, it came up that the input of  type="projectdir" does NOT work when using a REMOTE server. How disappoin...

coldfusion builder extensions on remote servers

Image
If you have read my past posts you know I run my development environment with vmware workstation, where I have a "production" like setup on a vm server running within vmware workstation on my development machine.  I do this to keep my laptop footprint small, so if i need to start it up to fix a production issue, I don't have my development environment interrupting my production debugging. But that is not my point in this article, I just switched to coldfusion builder to use the extensions feature it supports.  But when I first setup the server configuration and extensions in builder it would run but not write any files to my workspaces.  The error it provided was pointing my laptop's workspaces and not the server's directories. Surprisingly, I have found no other person blog about this (maybe it was my search criteria), but I am hoping this little blog posts help others in need out there. The solution is in the "mappings" configuration for the serv...