Tag Archive for coldfusion

CF HTML5 Validation Gotcha

I spent some time scratching my head over this one and thought I’d share.

<cfset userAgent = trim(listGetAt(CGI.HTTP_USER_AGENT, 2, ';'))> <!--- This only works for IE --->
<cfset outtaDate = 'MSIE 8.0, MSIE 7.0b, MSIE 7.0, MSIE 6.1, MSIE 6.01, MSIE 6.0b, MSIE 6.0'> <!--- List all the versions of IE that are out of date --->
<cfif ListFindNoCase(outtaDate, userAgent, ',') NEQ 0> <!--- We're not gonna bump em from the site, but we will display a warning to those visitors using the older versions of IE --->
<div class="outtaDate">You are using an out of date version of Internet Explorer and this site <b>WILL NOT</b> display correctly. If you are using Windows Vista or Windows 7, please use Windows Update and upgrade to Internet Explorer 9 or newer. If you are using Windows XP and earlier which cannot upgrade to Internet Explorer 9, please download the latest version of <a href="http://www.mozilla.org" target="_blank">Firefox</a>, <a href="http://www.google.com/chrome" target="_blank">Chrome</a>, <a href="http://www.opera.com" target="_blank">Opera</a> or <a href="http://www.apple.com/safari/" target="_blank">Safari</a> to see this site correctly.</div>
</cfif>

I’m using this code to identify older versions of IE that don’t support CSS3 and/or HTML5. Maybe I should be identifying browsers a better way, but the problem here lies within the listGetAt on line 1.

This code will trip up the W3C Markup Validation Service marking your code invalid with one of ColdFusion’s styles from an error… ColdFusion’s pumping out an error to the service… even though the running site won’t pump out an error at all.

Here is ColdFusion’s exception error to the W3C service:

In function ListGetAt(list, index [, delimiters]), the value of index, 2, is not a valid as the first argument (this list has 1 elements).&nbsp;Valid indexes are in the range 1 through the number of elements in the list.

I’m sure this isn’t a big deal since most people aren’t identifying browsers with their code or even coding in HTML5 for that matter, let alone valid HTML5 to use the W3C service (hopefully it’s more than I think).

Either way, I don’t know why the validator service is getting that error, having tested the code on virtually every browser without any problems (old and current alike). And I can’t really tell whether the problem is with CF or the W3C’s tool, but it’s not having any sort of effect on the live code, which is always a good thing.

CFX: Feature Requests Part 2 – New Tags & Functions

Before we get into the tags, I’d first like to mention I firmly believe SES URLs need to somehow make their way into ColdFusion.  The root of ColdFusion is making development life simple, and there is nothing simple about setting up SES URLs, particularly if you don’t know regular expressions.  I think this should be enabled/disabled at the application scope level and be a well thought out, simple process that doesn’t require IIS or Apache URL rewriting… it’s all done seamlessly in CFX.

With that said, here are some new tags I’d like to see:

  • CFTRAIL – This will leave a breadcrumb trail.  I initially thought this would be a feature that would require the use of SES URLs in the application scope, but thinking further, I think it could still be done with the developer providing parameters.
  • CFBROWSER – Web browser detection baby!

And while we’re at it lets add some parameters to CFLOCATION to allow delayed cflocating:

<CFLOCATION from="now()" delay="dd:hh:mm:ss" />

Lets also add a parameter to CFDIV to allow that loading icon to be customized:

<CFDIV icon="/images/yourAnimatedIcon.gif" />

This being ideal for loading user custom-created pages from a database, I think one of the features I would use the most is the ability to loop over cfcase in a cfswitch:

<CFSWITCH expression="#whatever#">
<cfloop query="yourQuery">
<cfcase value="#query.Column#"></cfcase>
</cfloop>
<cfdefaultcase></cfdefaultcase>
</cfswitch>

And finally some new functions I’d also like to see:

  • dollarformat() – oops!  Already exists.
  • encryptStruct()
  • encryptArray()
  • queryToArray(my.query,[dimension])

Coming next week
CFX: Feature Requests Part 3 – Everything Else

CFX: Feature Requests Part 1 – Addons & Frameworks

Even though I was unable to attend, Max 2011 produced some good things in the way of announcements for ColdFusion 10 (I like CFX better).  Most of what was announced though seemed like obvious steps forward of things that needed to be addressed, and not necessarily features that will make you jump out of your seat to line up and buy the product the second it’s released.  And I don’t really want to cover these features which can be easily found via Google.

Seeing as I’m not part of the alpha/beta of Zeus, what I do want to cover are some things that I believe would make CFX the product that would make you get in line and a product you can’t live without.

Today’s software and programming world is plagued with modularization. It is no longer just the language that is chosen for a project, but also the framework on which it’s built.

I am an anti-framework guy.  I honestly don’t get the buzz or see the benefit.  Inheriting someone else’s mistakes and relying on them because I’m too lazy to code the features myself isn’t a blessing for me or any of my clients.  It may save time to slap together a site in a few minutes, but does it really save time in the long run (and then have to keep that framework up-to-date… no thanks)?  Having jumped from framework to framework I’ve become a naysayer.  However, for the world of framework-lovers and the fact that ColdFusion is for everyone, lets modularize: Read more

ColdFusion CreateODBCDate Love

I was writing a mySQL query that only included dates in the results after today, and thought I’d share a quick problem I ran into.

SELECT column1, column2
FROM table
WHERE columnDate >= NOW()

Unfortunately, the NOW() function in mySQL will not include today.  Of course if I wanted to exclude today I’d take off the =.  I’m sure there’s a way to fidget with it and get it to do what I want in mySQL, but with a simple ColdFusion function I was able to get the result I was looking for.

SELECT column1, column2
FROM table
WHERE columnDate >= <cfqueryparam value="#CreateODBCDate(now())#" cfsqltype="cf_sql_date" />

Sexy!

Trendecide’s Back!

So I made somewhat a half-assed attempt to reinvent myself for the past 5+ years on another domain that no one has any clue about.  To my own credit, I took a major shift in careers and wanted to sample some different avenues.  We’ll get to that some other time, but the fact remains this domain continues to receive more traffic than my other did to this day.

Ultimately I think it means my return to using the right tool for the right job instead of a dire loyalty to ColdFusion (I made a conscious decision to ONLY use ColdFusion for ALL my web development).  My PvPGN days are long behind me, although I still only play Blizzard games (mostly Warcraft).  But my web development days seem to continue as much as I try and leave them behind me, particularly Fireworks, ColdFusion, CSS and mySQL, but most recently PHP once again.

For those who don’t know I guess it would be appropriate to reintroduce myself and explain where I came from and a brief background.

I’m Rick Smith… the name of my rock band in high school was ‘Trendecide’ and hence the alias.  Don’t ask about the music because we were horrible, but it was a lot of fun and I’m glad I did it.

Although I had tinkered with our Commodore, I would say my interest in computers really started with doing free e-mail with Juno on our 286 and then getting hooked on AOL 1.0, which led me to help start up a couple of computer businesses in the late ’90s that both failed.  Despite the failure, I did manage to walk away with a tremendous amount of knowledge in hardware which I continue to use to this day.  I currently will only build my own desktops and servers.

In 2000 I began web consulting, which led to teaching myself Photoshop, a friend turned me to Macromedia Fireworks and Flash and then ultimately led me to begin coding Perl addons for Matt Mecham’s Ikonboard (2000 was a VERY busy year) and doing web development for the PvPGN project.  Not happy with Perl, I switched to programming classic ASP in 2001 and then followed Matt Mecham and began programming PHP addons for Invisionboard in 2002, most notable were my skins and msSQL contributions.

Although I mostly did design work, I pretty much programmed PHP exclusively when it came to code, but Macromedia stepped in and I began to see the power and ease of ColdFusion.

I began working for a St. Louis area e-commerce company in 2003 and pretty much abandoned everything else I was doing.  PvPGN and Ikonboard went out the door and despite the fact I was doing mostly design and programming in ASP, I began extensively using ColdFusion.  Invisionboard’s decision in 2004 to no longer be free was the nail in the coffin for me and I refused to contribute any longer and devoted 100% of my development to ColdFusion, even uninstalling PHP altogether from my servers (finally reinstalling it again this month).

I worked for myself again from 2004 to 2006 exclusively programming ColdFusion applications for clientele.

In 2006 I applied to work at the local fire department to shut a friend up.  Although I managed to get on the list, I threw it out not wanting or even expecting to be called (I was #25 on the list).  I accepted a job as a contractor with the US Air Force programming classic ASP applications into ColdFusion applications (the programs had to work with other apps programmed in just about every other language from ASP and .NET to Java and PHP… yeah CF can do that) and slowly became burned out until I was called by the fire department in 2008 (I did attend Adobe MAX in 2007).  With a great amount of skepticism by both myself and all those who knew me, I accepted the job with the idea I would actually have an opportunity to develop on my off days (our department works a 24 hour shift with 72 hours off).  As it turns out, I fell in love with the job at fire academy and immediately took a one year break from web development.  My Chief let out word about my past, which led me to be contracted by my city to develop their website.

So now in 2011, I’m a full-time firefighter and a part-time developer.  And rather than exclusively use ColdFusion, I’m more into getting the job done right with really whatever technology suits for the project.  My expertise lies in design, ColdFusion, PHP, CSS, XML, mySQL, msSQL, SEO and computer hardware.

Although I never really went away, I’m looking forward to being a part of the community once again.