How I Got Started in CF

How I Got Started In ColdFusion

In high-school, I took a class in QBasic. And it was awesome – super awesome!! The moment I turned a line of code into a visual screen element, I was hooked. I knew from that very moment that computer programming was what I wanted to do with the rest of my life. And, when I started applying for colleges shortly thereafter, I made sure to declared my major as “Computer Science”.

In these applications, I always applied to the Liberal Arts colleges – my mom wanted me to have a well-rounded education. But, due to a system glitch (ironic!), I was eventually accepted to the School of Engineering at Tufts University. At first, I tried to switch back to Liberal Arts; but, when I found out that engineers didn’t have to take a foreign language requirement… “Sorry mom, they said I couldn’t switch schools.” Six additional engineering credits was well worth the complete absence of verb conjugation exercises.

In college, I was introduced to classic computer programming languages like C, C++, Java, Lisp, and SQL. I also started getting into web programming with languages like [classic] ASP and PHP. For a few semesters, I even acted as a Teaching Assistant in the web development classes. I really loved that I could create widely available content on the web. But, ASP and PHP never felt good. They got the job done; but, they never made things easy.

Then, I got an internship at Koko Interactive (a.k.a. Kokopelli New Media) here in NYC. I spent my first summer learning all about HTML, JavaScript, Photoshop, ImageReady, and Flash. And, when I wasn’t reading, I was the in-house Quality Assurance (QA) guy.

As it turns out, I’m pretty good at breaking other people’s code. I would get sent a link for testing and would return shortly with several pages of changes that needed to be made. Needless to say, I was quite the popular guy. One day, I delivered a list of edits to a frustrated programmer who told me to, “stop giving me lists and just fix the problems yourself!”

And so, they started teaching me ColdFusion.

ColdFusion 4.5, I believe.

As my first learning project in ColdFusion, I created a small web application that would allow me to aggregate a collection of quotes that I had collected about Love and Relationships. Yes – I have always and will always be a hopeless romantic.

When I showed this application to one of the managers, she jokingly said, “You don’t actually believe in all this crap, do you?” Of course I do – it’s Love. But, that’s neither here nor there.

What’s important is that when I started using ColdFusion, it was like the whole world suddenly made sense. It was like getting high-fived simultaneously by Chuck Norris and Arnold Schwarzenegger – sure you may dream about such an experience, but you always know deep down inside that it’s just a dream.

But, with ColdFusion, it was happening! Here was this language that was insanely powerful and, at the very same time, insanely easy to use. Unlike any of the other programming languages that I’ve tried, ColdFusion just made “sense;” it was the “right” solution in all the ways that things like ASP and PHP were wrong.

That was something like 9 years ago and I haven’t looked back. Since then, my love for ColdFusion has continued to grow. With each new release of the language, it continues to become even more powerful, even more efficient, and even more invaluable. With ColdFusion 10 on the horizon, it is a mature language. And, as it continues to adapt to the changing web world, I have no doubt that it will continue to hit the sweet spot of need – the perfect mixture of power and ease-of-use.

bit of a long post, i know, but i couldn’t quite figure out where to cut it off… so i ended up just re-posting almost the entire thing… and why would i do that, you might be wondering?

simple – as one of a few that uses CF, or at least it sure as hell seems that way these days, i found it rather interesting to read about it through the eyes of somebody else… brought back quite a few memories for me, as well.

ColdFusion 8 Rules

9 ways ColdFusion 8 will rule web development

Ben Forta and Adobe are getting into full swing with ColdFusion 8 Scorpio Pre-Release tour. Last night Ben gave us in Seattle a taste of things to come. Here is why it will kick the tar balls out of everything else on the market.ColdFusion 8
  1. Built in AJAX widgets. Create AJAX windows, auto complete forms, calendar popups, grids, WYSIWYG editors, and much more. All using simple ColdFusion based tags and generating industry standard solutions such as Prototype and Yahoo User Interface Javascript.
  2. Native JSON support. ColdFusion components now know if they are called by a web browser and will return JSON formated data automatically. You can also create JSON packets directly or consume them and turn them into native ColdFusion objects.
  3. .NET (and Java!) integration. Pull in .NET objects and use them like native ColdFusion objects. Combine .NET and Java on the same page if you like. Easily the best web based middleware solution.
  4. Microsoft Exchange integration. Love it or hate it, most organizations use Exchange religiously. Now you can read and update email, calendars, tasks and much more. No change to the Exchange server is required.
  5. Flash based presentation builder. Combine HTML, Audio, Flash Movies, Images, and CFCharts to create spiffy flash based presentations on the fly. Just wrap your existing pages in CFPRESENTATION and you are on your way.
  6. Full PDF integration. Create, combine, update, and interact with PDF files using CFPDF and CFPDFFORM tags.
  7. Native image manipulation functions. Blur, sharpen, draw, rotate, stream to browser, and much much more. This finally brings ColdFusion’s image support in line with PHP and other frameworks while keeping it so simple that even I could use it.
  8. Across the board enhancements. Improvements in security, speed, Flash Forms, Report Builder, and more.
  9. Administration API. Now you can access, audit, and snapshot all the information the server knows about itself. No longer is ColdFusion a black box. Audit long running processes, most frequently run queries, and bottle necks. SnapShot the server before making your change or doing a reset so that you can analyze potential problems later.

Admittedly I am a ColdFusion fan boy, but I know that it isn’t for everyone. Still, ColdFusion is easily the BMW (both in price and in raw engineered quality) of the web application languages out there. With ColdFusion 8 it now becomes possible to build and integrate a vast amount of functionality with only a few lines of code. Imagine letting users quickly create their own presentation by uploading photos and editing slides using a WYSIWYG editor. Then, when they are all done, they can view and share it on the web via Flash or push it to a PDF file. ColdFusion 8 lets you wrap up all this up into a tight package using heavily documented yet extremely simple tags. No scripting required!

man, i hope like hell my buddy ron can get a copy of CF8 and install it on the webserver here… cuz i sure as hell wouldn’t mind playing around with it when it rolls out!

(hat tip: donrico)


i’ve noticed on quite a few sites how they leave something like “12 hours, 54 minutes ago…” as the datestamp on things like comments and posts, and was wondering how to go about doing in in CF… so i asked my buddy ron if he’d seen or done anything like that already, since he’s a CF guru, and here’s some code he threw my way… already threw it up over at NippleByte to try it out.

function howLongSince(dateIn) {
  timeSince = "";
  currDate = now();
  // Calculate years
  years = dateDiff ("yyyy", dateIn, currDate);
  if (years gt 0) {
    timeSince = years & " years";
    dateIn = dateAdd ("yyyy", years, dateIn);

  // Calculate months
  months = dateDiff ("m", dateIn, currDate);
  if (months gt 0) {
    timeSince = timeSince & IIF(timeSince is not "", DE (", "), DE (""))
                & months & " month" & IIF(months gt 1,DE("s"),DE(""));
    dateIn = dateAdd ("m", months, dateIn);

seems to work pretty good, though i dont know if i have to drill down all the way to the Seconds of a timestamp… seems a little excessive, but i might add that to the funtion… at the moment, i have it getting the Year, Month, Day, Hour, and Minute of the datestamp… had me looking around for it, so i figured somebody might find it usefoo out there.

Random Captcha CFC

i was playing around with creating my own little random text image, much as you see on blogs and sites these days to help weed out the spam factor… got a basic one working, and then ended up over at the Wikipedia page for Captcha and downloaded this opensource Captcha CFC, which works alot better than my own.


only thing that seemed to missing from the example code was generating a random text string (unless i missed something), so here’s some server-side scripting that i used:

//select a random alphanumeric character
function generateRandomChar()
    c = "";
    while (c is "") {
		c = chr(randRange(48,122));
		if (asc(c) ge 48 and asc(c) le 57) break;
		if (asc(c) ge 65 and asc(c) le 90) break;
		if (asc(c) ge 97 and asc(c) le 122) break;
		c = "";
    return c;

//generate random string with passed in length param
function generateRandomString(strLen)
    str = "";
    for (i=0;i lt strLen; i=i+1) {
		str = str & generateRandomChar();
    return str;

figure somebody might find it usefoo… havent posted any code snips in awhile.

(hat tip: ron)

IIS Rewrite Help

okay, i started to play around with this ISAPI_Rewrite that my buddy ron installed on the new webserver for this new “mini-babe-digg” style website i started to play around with, and i’m having a great time [sarcasm] try’n to wrap my polish head around these URL rewriting expressions… this is what i have so far, but it’s not working and was hoping some of ya might have some insight ‘n help a foO brutha out:

RewriteRule /([^/?]+)(?:/([^/?]+))?/? /index.cfm?inc=$1(?2&p=$2)(?3&p2=$3)(?4&p3=$4) [I,L]
RewriteRule ([^?]*/)(?.*) $1index.cfm$2 [I,L]

basically want to take a URL and be able to have some kinda way to pass in multiple url params… where something like “/index.cfm?inc=whatever&p=001&p2=002&p3=003″ would be transformed to “/whatever/002/003/004/” ………nahmean?

be even better if i could make it so the URL param’s wasn’t hardcoded, but i havent quite figured out how the hell that’s done…. *scratches head*

Post Link Form – Tags Input

i got the basic Registration form done, as well as the Login… now i started on the Post Link form, and was wondering what the best, or at least the common practise, way to go about the “tags” input… seems that alot of sites simply use a single input field with a comma delimited list, so that’s what i went with:

form input for tags (comma delimited list)

guess i’m just curious if this is the best approach, from a users perspective… is it intuitive enough? would it be better to have seperate input elements for each tag, and maybe add some code to dynamically add more input’s as you “add” the tag to the form? just type’n out loud as i think about it…. hmmm.


seems like one of the things i still get alot of emails about are the flash vids i post around here… so for those running with CF, here’s a nice little custom tag that you can include in your pages that will automatically write the appropriate code to include the flash video player and load the FLV of your choosing into it — CF_FLVPLayer

<cf_FLVPlayer width="468" height="264" 
streamName="<![CDATA[content_low, 50, content_mid, 150, content]]>"
isLive="false" bufferTime="2">

as i’ve said before, i typically use Sorenson Squeeze to “rip” video clips to FLV format, and then upload them to a directory on the webserver… afterwards, i pipe in the name of the vid file into a javascript function that simply writes the flash vid player code to the page, loading the video file of my choice… really is pretty easy, though it does tend to take me a few minutes and a few steps to do it…. on the flipside, i enjoy posting lil vid clips that catch my eye… heh.

p.s. i need to get a copy of 4.3….

CF on Wheels

doesnt seem like CF has gotten much luv around here in awhile, so here’s something i found pretty damn kewl awhile back and forgot about until the other day… you’ve all heard about Ruby on Rails, and the noise it’s made in development circles, so is it really all that surprising that some engineer’n CF guru’s came up with ColdFusion on Wheels? Wink

ColdFusion on Wheels

speaking of kewl, here’s something that emil hit me with, which is pretty spiffy — esp. if you look into the code’age… Canvas in IE (demo)

speaking of code’age, here’s one that i saw over at the Daily WTF and for some reason kinda stuck… figured some of ya might get a kick outta it, too… heh.

Nathan: Steve, you know how ++ will increment, right?
Steve: Right ….
Nathan: Okay, so how do you increment by 11?

interesting, in a geeky sorta way, to read through the comments.

CF: PDA Sniffer

i’m pretty sure that i’ve blogged or posted this code before, but i might be wrong… anywho, i just got pinged with two quick emails asking for some code’age, so i figure i might as well just go ahead and post it in case anybody else is curious… it’s not complicated or overly fancy, but it works. course, i use ColdFusion around here, but logic is logic, no matter what language or platform you’re running with Wink

CF Code: Sniff Mobil Agents

<!--- Catch Mobile/PDA's and redirect --->
<cfset httpCatchWords = "PDA,PalmOS,PalmSource,
	Blackberry,Nokia,Windows CE,Symbian,Smartphone,
	ReqwirelessWeb,SonyEricsson,WhatsUp" />
<cfloop list="#httpCatchWords#" index="cw">
  <cfif FindNoCase(cw,cgi.http_user_agent)>
    <cfset isMobile = 1 />
    <cfbreak />

<cfif isMobile>
  <cflocation url = "/pda/" addtoken="no" />
  <cfabort />

as mentioned in the previous post, if you have any agents (keywords) that you think i’m missing from the list being looked for in the http_user_agent string, lemme know and i’ll add it to the list… these are just the ones i knew of off the top of my head back when i added this to my main template here… if it see’s one of these words in the agent string, it’ll automatically redirect to the PDA version of my site.

CF:Template Code

i’ve been asked about the CF code i use in my main template here at least twice in the last day, so i figure i’ll go ahead and just post it… in case anybody else out there finds it of interest. basically, you set a param with the default page to include into your main template, and then you can pass in new pages to be included via the URL paramater.

ColdFusion Code:

<cfparam name="inc" default="blog" />

<cfset dir = GetDirectoryFromPath(GetCurrentTemplatePath()) />
<cfsetting enablecfoutputonly="yes">
  <cfif Len(inc) LT 1 OR CompareNoCase(inc, "index.cfm") EQ 0
      OR FileExists("#dir##inc#.cfm") IS "false">
    <cfset inc="blog" />
<cfsetting enablecfoutputonly="no">
<cfinclude template="#inc#.cfm" />

as usual, there’s probably a dozen different ways to go about it, but this is pretty much the way i’ve been doing it for the last couple years on most of my sites.

RSS Function()

i got an email from a buddy asking if i’d share some CF code for parse’n an RSS feed… i’ve blogged and posted some code before, but being the lazy punk that i am, i simply copy/pasted some of my code into a quick reply email… figured i’d go ahead and post another blog with it, in case there’s anybody else looking for a quick CF function() to use… here’s the UDF function that i use to parse/display the feeds shown in the FooNews “ajax” tab above:

<!--- Function: getRSS_Feed() --->
<cffunction name="getRSS_Feed" returntype="string">
  <!--- Pass in RSS Feed to parse, default is yahoo top stories --->
  <cfargument name="feed" type="string"
                default="yahoo_topstories" required="false" />
  <!--- Pass in Count param, how many to display back --->
  <cfargument name="count" type="numeric" default="5" required="false" />
  <!--- This variable is for this function's use only --->
  <cfset var feedContent = "" />
  <cfset var rssfeedfile = "" />
  <cfsavecontent variable="feedContent">
    <cfset xmlFeed = "./xml/" & arguments.feed & ".xml" />
    <cfset RSSFeedPath = ExpandPath(xmlFeed) />
    <cffile action="read" file="#RSSFeedPath#" variable="rssfeedfile" />
    <cfset myXMLDoc = XMLParse(rssfeedfile) />
    <cfset myItems = XMLSearch(myXMLDoc, "/rss/channel/item") />
    <cfset loopLen = arrayLen(myItems) />
      <cfloop from="1" to="#count#" index="i">
        <a href="#myItems[i].link.xmltext#"
  <cfreturn feedContent />

the default feed i use is the Yahoo! Topstories feed, but if i want to pass in another local RSS feed that get’s pulled and saved to the webserver every hour, i simply pass in the name of the XML file, like this:

<cfset getRSS_Digg = getRSS_Feed('digg') />

which would pull in the digg.xml file into the function, parse it, and spit it out in a ul/li format.

if you happen to be looking for something like this, well, i hope it helps Wink

Update: Related Posts

last week i had the misfortune of Homesite taking a nose dive right when i was saving the backend UDF library of queries that i have running alot of the query functions around here… and i’ve had to slowly figure out which ones i had, so i could re-code them out… i’ve managed to do most of them, i think, though i know i still have a few out there that i’ve missed — which really sucks, since alot of time has gone into them over the last year or so. *sigh*

anyfoo, i just added another backend query function, getBlogByCategory(), that takes two arguements… the blog CategoryID and the number of posts to return, so i can call on the function from any page with something like this:

<cfset blogByCat = getBlogByCategory(#val(query.category_id)#,5) />

which would return the latest 5 blog posts per the category i pass into it.

been quite awhile since i’ve actually touched or added anything to my homegrown FooBlog code, so that’s kewl… now you’ll see the latest few blog entries listed under the post/permalink you’re viewing over in the sidebar area… not a big deal, but i thought it’s a nice little addition and probably something i should’ve added a long time ago Wink

the sudden impulse came a lil bit ago when i hit some blog, and they had the last 10 blog entries listed over on the right… which i thought was kinda odd, since i’m on the blog and it already has all of them displayed on the page… so why would i need the extra links pointing to what i have right in front of my eyeballs? which got me to thinking, so i hoped over into Homesite…

update: i also added a “Flickr” tab to the top nav…..

GTalk and CF7

now this is pretty damn kewl, and something i hadn’t even thought about… taking advantage of the new Gateways in ColdFusion 7 to connect and interact with Google Talk — how effin badass would that be? Big Smile

Google-Talk and the ColdFusion MX 7 XMPP IM Gateway

Since Google’s new Instant Messaging network and IM client, “Google-Talk” is based on the Jabber/XMPP IM protocol standard, as has been noted by some already in the ColdFusion community, you can indeed use the Jabber/XMPP IM Gateway included with Macromedia ColdFusion MX 7 to connect to the Google-Talk IM Service network. And as Google says on their Google-Talk Developer page, Google wants to “…encourage the developer community to create new and innovative applications that leverage our service.”

The Jabber/XMPP protocol standard has been reviewed and formalized by the IETF and W3C and that’s one of the reasons we picked the XMPP IM protocol to include with ColdFusion MX 7.

One of the things that’s particularly interesting about Google-Talk using an IM standard protocol is that for the first time, a major IM network is potentially accessible to application developers (depending on Google’s final user agreement with the Google-Talk network of course).

All kinds of interesting applications can be created using IM “bots” that can represent Enterprise entities such as ERP systems, etc, and the fact that a ColdFusion CFC can “know” when you’re online (presence) can really make things interesting. An application can automatically IM the support rep that’s currently online, for example, increasing the chances of a faster response. A PO system “bot” might send an IM to a manager or VP asking for approval for a PO, since it saw he/she was currently online, or escalate to someone who IS online if a PO request is getting stale needs immediate attention.

Another super-cool idea is to use the “status” of an online entity/buddy/bot to communicate real-time data that’s constantly changing. In the case of this type of data, you only care about the latest possible value (stock price, for example). Using the IM Gateway Helper “setStattus()” function allows you to set a custom status message for a bot that buddies can see. This can be a great way to keep buddies (or subscribers to the “bot”) instantly up to date. They’ll see the highly visible message or data just by glancing at the “bot” in their buddy list. This saves potentially oodles of email update status messages, where all you’d care about is the last one anyway.

(hat tip: chris)

FooMobile Code

i got an email the other day asking if i had blogged some code or written an AF() article about switch’n to a “PDA” version of the site… the article about mobile versions of one’s site template yesterday reminded me of it, and thought i’d go ahead and post some CF code, since i dont think i did the last time around… or maybe i did and foogot? hell, i dunno.

CF Code

<cfset httpCatchWords =
      "PDA,PalmOS,PalmSource,Blackberry,Nokia,Windows CE,
      Symbian,Smartphone,ReqwirelessWeb,SonyEricsson,WhatsUp" />
<cfloop list="#httpCatchWords#" index="cw">
   <cfif FindNoCase(cw,cgi.http_user_agent)>
      <cfset isMobile = 1 />
      <cfbreak />

<cfif isMobile>
   <cflocation url = "/pda/" addtoken="no" />
   <cfabort />

basically, i’m just looping through the cgi.http_user_agent string from the HTTP Header, and if i find any of the “catch words” i’m looking for (PDA, PalmOS, etc.), then i set a variable… then if that variable has any value, i redirect to the uber-simple FooMobile version of my blog for small handhelds and shit…

it’s simple and straightforward, and seems to work okay for now.

Flash Form Upload

this is pretty damn kewl, and just shows off more of the functionality behind the new cfform tag in ColdFusion MX 7 Big Smile

File Upload with ColdFusion Flash Forms

yet another reason why i’m looking forward to one day being able to play around with CF7 around here… be kewl to play around with this kinda stuff, y’know? *sigh*

apparantly makes use of some of the new I/O functions in the lastest Flash player (v8), something i didnt know it had or did… almost makes me wonder if there’s a Flash only version of this out there, if that’s even possible? i dunno.

MXNA Reader — another killer example of native flash with ColdFusion.

nice breeze demo of new Studio 8 features

ColdFusion vs. PHP

this is a rather long ass post, i know, but i found it pretty damned interesting and thought i’d (re)post it… it’s a post by Peter Beckman on the [WD] digest listserv that i’ve been subscribed to for years now, in reply to a lil debate that’s been raging back-n-forth… good points are made about both PHP and ColdFusion Wink

Peter Beckman wrote:
1. With the same hardware, PHP will run faster and better than ColdFusion under the same load. We moved our site from CF to PHP last month and we can now serve pages under 1 second (CF was 3-5 seconds), server load is down from 2 to .2, and we’re serving MORE page views than we could with CF.

I’m not biased either way when it comes to PHP or ColdFusion (I love them both for different reasons), but making a sweeping statement that PHP is up to 5 times faster than CF is simply not accurate.

All I said was that _I_ saw a speed increase and a load decrease. I did not say I did benchmarks and across all possible situations CF is faster than PHP; however, in my situation, it was, and yes, up to 5 times faster.

I’d say they were equal when doing about 100,000 page views a day, but when we passed that mark, CF did not continue to serve pages as fast as PHP cold beyond the 100,000 page view mark with the hardware we ran it on. We even had a CF consultant come in and tune our system.

I’ve used both for as long as they have been available to use and while each has it’s unique set of advantages and disadvantages in a given situation, I’ve never experienced this type of performance gap unless there were some issues with poor code quality.

We ported the code from CF to PHP, line-by-line, not improving the code at all. Queries were not rewritten or optimized, loops were left alone, etc. Any “poor code quality” that was in CF was ported to PHP.

2. PHP is more of a *real* language, not tag-based. I found that I could consolidate code much more easily with PHP than CF, and that the data structures were more mature and robust than in CF.

This is an argument that is extremely over emphasized. There is no such thing as a “real language”; there is OO and there is procedural and both are perfectly valid. PHP is more OO, CF is more procedural, but can be implemented in any number of OO-like frameworks; Mach-II [01] (also available for PHP [02]) comes to mind. If you need libraries of related functions that share data and OO development practices, use CFC’s; that’s what they are for.

By *real* I mean more similar to C, which almost every compiled application I know of is written in. But I’m a Unix guy, I don’t speak about Windows.

In addition, using less code to achieve the same results (tag based development), isn’t a bad thing. In CF, creation and clean up of objects are handled by the server, while in PHP you have to deal with allot of this routine stuff manually. Generally speaking, CF development is faster than PHP development simply because the tags are so much easier to use.

True, it is not. It is great for a non-developer, running a site with a small user base. For the developer, though, it over-simplifies, sometimes making more complex tasks much more complex than they need to be in other languages.

As for creation and clean-up of objects, are you talking about memory usage? Or what? I don’t know of things I “have to clean up manually.” Also, I think that CF vs PHP in development time can depend on the task, but If you have a developer who knows both well, I don’t see either taking more time than the other. I think development time, it’s a wash. And the more complex the task, IMO PHP will be better at it than CF.

We all know nothing is free.

PHP is free. Maybe the hardware isn’t, but we aren’t talking about hardware.

This same type of argument was used to support ASP over CF years before PHP was considered a reliable development language; we later learned just how untrue the “free” theory was. Just because there is no charge to use PHP does not mean it there is no cost associated with using it–training, maintenance, support, third-party tools.

What Pay-for software doesn’t require the same? CF you pay for first, then you have to pay for all the rest of that. PHP you get for free, and if you can learn it, maintain it and support it yourself, then the only cost is your time. Which ain’t free technically, but we’re talking about the software.

Can you provide numbers that show where PHP is more widely used than CF in a business environment? I’ve looked but haven’t found anything definitive.

You are always limited to the functions of any language you use… that is unless you want to extend the language itself. As far as I know, there are no significant functionality differences between the most recent versions of CF and PHP.

Show me 3 ways to do an if/else statement in CF. In PHP:

  1. if ($foo) { echo $bar; } else { echo $foob; }
  2. if ($foo) echo $bar; else echo $foob;
  3. echo $foo?$bar:$foob;

Pass multi-dimentional arrays via a GET in CF, without having to parse the query_string.

There are, however, some significant features available in CF that aren’t built into PHP, although I am sure you can achieve the same results with third-party tools. For example: integrated business reporting, Flash forms, on the fly PDF or FlashPaper 2 generation, interfaces to mobile phones using SMS and IM using XMPP, sourceless distribution, J2EE integration and deployment, easy access to JSP, servlets, or EJBs, access to .Net via Web services, enterprise searching. There are more examples, but these are probably the most meaningful.

Yep, they aren’t built into PHP. Why? BLOAT! Most people don’t need that stuff, and so your basic PHP install gives you a fast, pared down language. All of that other stuff? There are 3rd party libraries and tools to get PHP to do it, but you add them as you need them, not dump them all into the language in case someone MIGHT need them.

We can’t really “do more” in either language. We may, however, be able to complete specific tasks or achieve certain goals easier or more efficiently in one than the other… and that is where we should make our decisions. At the end of the day, successful developers make decisions based on how much productivity, efficiency, and functionality can be squeezed from a particular language and framework, not which tool makes our coding buddies think we’re uber-leet.

For most people, they don’t care — CF or PHP both get the job done. For me, I deal with high volume sites, and CF has shown me that using the same hardware and same DB integration I can get 3-5 times the performance out of PHP.

If you aren’t dealing with a high volume site, and CF is more cost effective, use it! If PHP is, use that! If you’re just going to do “if this” and “then that” either language is fine. It’s the deeper, application development stuff that PHP is better at in my opinion.


i got an IM yesterday from jorge, and he asked if i had some CF code lay’n around to grab a random Link/URL from the database to display back to the webpage… i looked around and sent him some code’age, but then he turned around and shot me some code that he found… thought it was interesting how many different ways you can go about doing this sorta thing, and thought i’d go ahead and blog it real quick (in case i ever wanna look it up)

Random Link with CFMX

<cfquery name="qRandLink" datasource="#dsn#">
    SELECT Name, URL
    FROM LinkScroller

<cfloop query="qRandLink">
   <cfset myLinks[CurrentRow][1] = Name />
   <cfset myLinks[CurrentRow][2] = URL />

    <cfset LinkID = RandRange(1, qRandLink.recordcount) />

CF7: Rich TextArea

this is exactly why i cant wait to be able to play around with ColdFusion MX 7 Big Smile

Rich TextArea for flash CFForms

yeah, i’ll readily admit to being a lil green with envy when i saw this, since it’s one of the things i’ve been wanting to play around with ever since i went to that Macromedia seminar last year, and saw Ben Forta up on stage showing off some of the new featues… i’ve also wanted a flash based RTE for awhile, too, since it is almost universal and solves alot of issues i’ve had.

as soon as i can play with CF7, can probably expect to see something like this around here… *nods head*

(hat tip: spiraldev)

p.s. checkout the new Satellite feature on Google Maps — incredible, cool, and kinda… scary.

p.p.s. if you have a mobile with web access, can you hit this site and tell me what you see? playing around with a “pda” version of my blog, which is very simple and strips out the images of my blog posts, etc…

Connection Failure

sorry to geek out a lil here, but i’m seriously getting frustrated here…. i signed up for an Application ID over at the Yahoo! Developer’s Network, thinking that since my HoverSearch() script suddently decided to stop working, that i’d give Yahoo! a try… after a few clicks i quickly saw how the URL’s are used, and the XML data that it returns to me… so i started on another CFM page to snag that Yahoo! xml data and parse it, much as i’ve been doing with the various RSS feeds i’ve been playing with around here for awhile now.

except this time it keeps throwing me the error “Connection Failure” when i try to use cfhttp to “get” the file, storing it in a server-side variable for me to access… wtf? of course, i Google it, and click over to a post at about exactly this issue…. bear with me, i’m thinking as i type this, dammit.

here’s a snippet of my CF code, where #feed# is the Yahoo! web service feed i’m pulling:

<cfhttp url="#feed#" method="get" resolveurl="no">
<cfhttpparam type="Header" name="Accept-Encoding" value="deflate;q=0" />
<cfhttpparam type="Header" name="TE" value="deflate;q=0" />
<cfdump var="#cfhttp.fileContent#" />
<cfabort />

anybody have any ideas or insight into this problem? i’m so confused…

[update] this is the data i’m getting back when i ouput the HTTP Header status_code, header, and fileContent:

200 OK
HTTP/1.1 200 OK Content-Type: text/xml; charset=”utf-8″ Connection: close P3P: policyref=””, CP=”CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV” Date: Thu, 17 Mar 2005 05:58:13 GMT
Connection Failure

HTTP Caching and xmlHttpRequest

one of the things that was really bugging the hell outta me about using the xmlHttpRequest object for both the GET and POST of data for the FooComments, was that it would pulled a cached copy in IE… though it doesnt in Firefox. unless you went into the ‘Internet Options > Temporary Internet Files > Settings’ and set it to check for newer versions of stored pages to: Every visit to the page.

so i checked around and it seems that this is a known bug or “feature” of IE:

Yet to analyse this in detail but seems to a difference in behaviour between IE and Mozilla’s XMLHttpRequest implementations.

Neither should cache POST requests but IE caches GET requests (presumably using the normal browser cache) unless told not to by the server with “Dont Cache” headers.

so i added some CF code to add the no-cache HTTP header information to the page requests, adding these three lines of code to my application.cfm

<!--- No-Cache HTTP Headers --->
<cfheader name="expires" value="#now()#" />
<cfheader name="Pragma" value="no-cache" />
<cfheader name="cache-control" value="no-cache, no-store, must-revalidate" />

i’ve changed my IE option to “Automatically”, and it seems to be working now… but thought i’d blog about it to get some feedback to make sure… as well as throw’n this out there, so if yer messing around with xmlHttpRequest, you might want to be aware of the cache’n issue.

ColdFusion MX 7, Unleashed

ColdFusion MX 7wow, i cant believe it’s finally here! that’s right… after the last year or more hearing about this next version of ColdFusion (codename: “blackstone”), it’s amazing to see that it’s really out! i’ve been itching to get my hands of a copy of CFMX7 when it came out, just to play around with some of the new features… so of which look pretty damn awesome.

obviously the ones that come to mind is one that i’ve wanted to see CF have native support for since i started using it… and that’s PDF/FlashPaper support, and it looks like that call has been answered, and with typical CF ease and simplicity…. just use <cfdocument> and declare the output as “PDF”… damn, gotta luv that Big Smile

lots of other features, such as the Rich Flash Forms that have me curious and wanting to play around with… as well as the new reporting features, with server-side XSLT2 support for defining your forms layout, etc..

hopefully my buddy Ron will get his paws on a copy and maybe get it setup on a box, even if just to play around with and see how it performs… i’ve heard some good things about it from a couple CF guys, but most will hold off rolling something like an upgrade to CFMX7 for awhile, since that’s just the prudent thing to do, y’know? esp. for live production webservers…