January 6, 2009

Pages


Search Site


Topics



Archives

Tweets

Entries for month: May 2007

I registered as a potential Scorpio Beta Tester

May 16 2007 by Adam
Thank you for completing the Scorpio Participation Survey and for your interest in Scorpio Prerelease Program. After the Product Team reviews your responses, you will be notified with an email. Sincerely, – Adobe Prerelease Programs Team
When I completed this "survey" a week or two ago I was under the impression that I was too late in the game to get a shot at beta testing, but if I heard Mr. Adam Lehman correctly at the CFUG meeting, he was encouraging us to do just this, if we hadn't already. So, now the roller coaster that my hopes and dreams ride with every exciting opportunity that comes along is on its way back up another hill!

Posted in ColdFusion | Scorpio |

Philly CFUG Scorpio Presentation

May 15 2007 by Adam
Of course there have been numerous blogs about features announced at other meetings (I liked this one, and this one, among many others) but tonight I attended our very own CFUG meeting, and not only that, it was my first. Among all of the new tags and functionality announced, I think I'm most excited about the return of the debugger, the new image handling, the ability for CFLoop to natively parse files (by line, or by bytes), the server monitoring utilities, and of course the AJAX tags. I would have liked to have seen the debugger in action, but we were pushing 3 hours as it was with fairly few questions, and had to bail before they started drawing names to give away schwag (including a copy of Scorpio itself!), since my carpooling buddy was out passed his curfew. The CFPDF tag set looks interesting and very useful, but my current clients don't do a whole lot with PDFs and my past clients only made limited use of PDF forms. I can see that it has great potential, but I don't see myself putting it to great use for a while. One thing that this has reminded me of, for sure, is that I have become very comfortable inside my box. For the most part, the things that I've been developing could run just fine on CF5. (I blame the customer!) I have come away from the meeting inspired to learn some of the great things that MX7 made available, but at the same time, I feel like I'm already spoiled and have absolutely no motivation to try and learn AJAX "the hard way." Why should I bother, when I've seen how easy it will be in just a few short months? I'm not sure how much of this has already been announced, but here's a list of stuff that caught my attention enough for me to write down:
  • New Database drivers: SQL Server 2005, Oracle 10g, MySQL 4 & 5 (finally!), PostgreSQL 8, and more!
  • Nested CFTransactions!
  • <CFDBINFO> – Interrogate a database for its tables, procedures, views, etcetera.
  • Even though there is a heavy (unofficial) lean towards Eclipse being the standard IDE, they are continuing to develop RDS, i.e. the new security features and user roles. Am I mistaken, or does Eclipse not work over RDS? Is this just an effort to support both, or some sort of unresolved confliction within the team?

Posted in AJAX | CFUG | ColdFusion | Scorpio |

Application.cfm: Determining environment

May 09 2007 by Adam
As I mentioned two weeks ago, application.cfm tweaking is important, but reaching the best compromise between efficiency, readability, and functionality is highly subjective and there are exceptions to every rule. The question of how to manage application.cfm in multiple environments or between servers in a cluster is one that every developer you asked would probably answer differently. You could have separate versions of the file for every server, you could have a flag set at the top that indicates what set of code to run, you could check CGI variables… there are a hundred ways to skin a cat. My personal preference is to use CFFile. But before you start to criticize me based on the overhead of reading a file, hear me out. If you still disagree with me, feel free to leave a comment to that effect! Before diving in to the code, let's consider some rules of thumb.
  1. You want your production environment to be the fastest path through the code, for what I hope are obvious reasons.
  2. You want the default case to be production, so that if all else fails, at least production will work.
  3. Your solution should be extensible and scalable for the addition of future environments.
I will admit up front that more overhead is required to use a CFFile tag than to check the contents of a CGI variable or request scope variable, or quite possibly any other method. But with that said, this method is set it and forget it. In order to implement this method, we need to add a small text file to every server.

C:\env.txt on my development server: DEV I'm sure you can extrapolate this to be applicable for your other servers, right? Test should say "TEST", Staging should say "STAGE", and so forth. With one exception: Don't create a file for Production. Or at least, you don't have to. And your code will run precisely 4.3 iotas of a second faster if you don't. Because once you've created these files, you should add this code to your application.cfm:

<cfif not isDefined("application.env") or isDefined("url.resetAppVars")>     <cfif not FileExists("C:\ENV.TXT")>         <cfset application.env = "production">     <cfelse>         <cffile action="read" file="C:\ENV.TXT" variable="application.env">         <cfset application.env = trim(lcase(application.env))>     </cfif> </cfif>
Now, going back to my three rules above:
  1. Production is the fastest path through this code, assuming you don't create the ENV.TXT file in that environment.
  2. The default case is production: If the file doesn't exist, assume production!
  3. Scalable? Check! Adding a new testing server called Test2? Make it's file contents "TEST2" and you're off and running.
Now that you've defined your environment, it's time to set some environment specific variables. Hopefully you remember that you should only set your application variables when they don't exist in memory! I've already demonstrated how to accomplish this above: Check whether or not one of them is defined first. And while you're making that check, you should always give yourself the ability to refresh them at your will, which is why I included the check for the variable url.resetAppVars. Instead of restarting ColdFusion services to reset your application variables, you can simply append ?resetAppVars=true to your URL. When setting your environment specific variables, the same rules apply: Production should be the fastest path through your code, the default case, and your solution should be easily scalable. I like this approach.
<cfif not isDefined("application.myVariable") or isDefined("url.resetAppVars")>     <cflock scope="application" type="exclusive" timeout="30">         <cfif application.env is "production">             <cfset application.myVariable = "my value for production">         <cfelseif application.env is "dev">             <cfset application.myVariable = "my value for development">         </cfif>     </cflock> </cfif>

Posted in Best Practices | ColdFusion |

Bummer! No CFUnited for me!

May 07 2007 by Adam
I need to learn not to get so excited about tentative plans until they are more firm. As it turns out, my involvement with my current project is so "crucial" (in my boss' terms), and the schedule is so tight, that we can't afford the time off to send me to CFUnited, even though the location is right, the cost would be justified, and the content would be beneficial. I suppose there's always next year – and with any luck it'll be somewhere more exotic. In the meantime, I'm looking for a conference to attend this fall instead; and I'll have to try to get my fill of Scorpio information from the May 15th presentation. I've been working on the follow-up to my application.cfm tweaks post that I promised, but I am somewhat deterred until I find an adequate solution for posting code. Perhaps I'll just use codeShare and then update it later when I find a more permanent solution.

Posted in CFUnited | ColdFusion | Scorpio |

On posting code

May 04 2007 by Adam
As this is a free wordpress.com blog, I unfortunately don't have the ability to edit the CSS of my theme. I tried every single theme offered, even the pink ones, and none of them have adequate support for the <code> tag, in my opinion. I don't think I'm asking too much: a fixed width font, and horizontal scrolling instead of wrapping. So I set to work on applying every free theme available and checking out how the code in my first post appeared. Needless to say, I was not happy. Most themes do use a fixed-width font, but none of them offer horizontal scrolling instead of wrapping. The closest I found was a theme called Freshy 1.0. I didn't dwell on it long (why bother? It doesn't have horizontal scrolling!) but its author did find a way to number the lines, which is an added bonus. Except that wrapped lines were given a new line number every time they wrap, which is inaccurate. I've noticed that Dave Shuck, who I mentioned in my last post, likes to use codeShare, which has a really nice polish to it – but only archives your submissions for up to 8 weeks, as best I can tell. I hate running into dead links, let alone finding code examples that are no longer available. I can see myself writing a permanently archiving clone of codeShare if I can't get a theme solution in place. I've offered to modify a few of the free themes to include better support for the tag, so we'll see where that goes. In the meantime, if anyone is aware of other creative solutions like codeShare that don't purge your submissions I'm quite interested.

Posted in Meta |