If you use MS Outlook and you subscribe to any of the email lists from figleaf.com, you may have noticed the informative way that messages are displayed. The "sender" is identified as the list server but the address of the actual sender is also included with the tag line of "on behalf of". So, if boy@george.com sends a message to list-serve@rollingstone.com, the from would be displayed as list-serv@rollingstone.com on behalf of boy@george.com. It took a while for me and my good friend Tracy Rice figure out how to do this in Coldfusion.
Read More
It's pretty common these days for mail servers to require SMTP authentication. The problem is that the CFMAIL tag has no place for a username and password when sending mail. Not to worry, you can use the "username:password@mydomain.com" syntax in the "server" attribute of the tag to authenticate. For Example:
You can also use the same server syntax in the mail server text box in CF admin. If your server doesn't use SMTP but uses "POP before SMTP" you can solve that problem by hitting a mailbox first with CFPOP then sending your mail. Dan Vega has a great explanation of that technique.
Before you read this, if you are a bona fide CSS guru, don't laugh at me. Remember I'm just a Coldfusion code jockey with only a bare minimum of aesthetic sensibility and I see CSS with the same approximate mystery as I see women's obsession with shoe shopping. That being said, this is a neat trick for alternating row colors. You know what I mean - you have this long query that is going to be displayed in tabular HTML. You'd like to alternate each row to make the data stand out and be easier to read.
Read More
There's a very interesting post and discussion on Brian Kotek's blog today dealing with the use of the function "isDefined( )" vs "structKeyExists( )". If you've been programming since the days of CF 4.x and "parameterexists()" you'll know that using isDefined() can be a delicate experience at times. It becomes especially tricky in CFMX where the way variables are initiated has changed. In the old days you could have a variable in the variables scope that included a period in the name, and unless you specifically called "structNew()" it would stand as primitive variable in the variables scope. Take this Example:
Read More
Here's a tip on application variables from the inestimably knowledgeable Sean Corfield. In my previous post on Application Variables I used a pretty typical example of how they are initialized. I checked for the existence of a particular application variable. If it did not exist, I would lock and set all the variables. Sean pointed out that this approach is still subject to threading issues. To start with, here's the original example.
Read More
Getting a handle on Application variables can be difficult. Even folks who know what they are sometimes use them incorrectly. There are 2 common forms of simple application variables (we'll leave the discussion of objects and CFCs for another time). There is the "set once read many" variable. Usually these are "settings" for the application - things like paths and data source names - Application.dsn, or Application.imagePath.
Then there is the "global tally" variable. This is less common, but it is usually some variable that is incremented or updated throughout the life of the application. For example, it might be a variable to track the number of logged in users. This variable is actually set (sometimes frequently) as the application is used. The main thing to remember about an application variable is that it lives beyond the request or session. It's something that is put in place as a variable and stays put for every user of the application. Some call it persistence - but the OO purist pee their pants when they hear that so I will refrain (too bad too, it's a good word for it). Let's focus on that first example of "set once read many".
Read More
This is a follow up to the post titled "Getting the ID field after an Insert". I recently saw someone struggle with this because of an easily made syntax error.
Consider this code:
Follow up post on doing this in MS Access.
Some developers use the "NOT" keyword in a unique fashion. Instead of only using it inside of a logic statement they take advantage of CFMX dynamic pound sign evaluation features to treat NOT like it is a function. This is misleading. NOT is not a function. It is an Operand that affects the logic of a statement. The only reason it seems like a function is that CFMX servers have a nifty feature that allows for you to put expressions between pound signs in output code. For example, if you put #1+3+5+8# in between cfoutput tags on a CFMX server the result would be the number 17 sent to the output buffer. That's nifty all right, but that's not all.
Read More