ColdFusion Muse

CF 10 Does Not Honor "Maxrows" on Sybase Stored Procedures

In working with CF 10 on a site that uses Sybase as a backend database server one of our tasks was to convert various "inline" queries over to stored procedures. In some cases these queries used the "maxrow" attribute to limit the number of rows returned to the driver. Personally I usually revert to LIMIT or TOP (or whatever the DB Server syntax provides) for that purpose. With maxrows the DB server works just as hard (my best guess) and the driver simply counts the number of rows sent to the buffer and limits it there. In other words, I have always suspected that maxrows limits the number of rows sent from the DB Server and not the number of rows actually produced by the query. Still there are situations where it hardly matters in either case - and maxrows has a purpose there I guess.

So when it came time to convert our queries over to stored procedures - and with a requirement to change as little as possible on the DB Server - we dutifully added the maxrow attribute to our cfprocresult tag like so:

<Cfprocresult maxrows="15" name="blah"/>
But to our suprise this had no effect. Sybase (or perhaps the Sybase db driver) simply failed ot honor the maxrows attribute. This might be one of those cases where only some drivers or DB servers are capable of implementing the attribute for a stored proc. For example the attribute dbvarname used on the cfprocparam tag is ignored by several DB servers (MSSQL among them). You must place your params in the correct order instead. Still, I wish an appropriate error message would be thrown rather than simply allowing the stored proc to execute and ignoring the attribute like a quirky basement dwelling uncle. Anyway I thought it was worth blogging this nuance of the Sybase driver for the 6 ColdFusion servers out there still connected to Sybase. :)

Debugging and a Return to Dodge City

One of the things the Muse likes best about ColdFusion is the excellent debug information provided during development. Of course you should never ever leave debugging enabled on a production server. Not only are you generating a great deal of additional data with each request (adding overhead), you are potentially exposing a mother lode of technical information that a nefarious hacker would salivate to see. But during development, the debug information is where you ought to live. Indeed, if you are not constantly checking the debug information start doing it now - make a habit of it! You will learn things about performance, iterations, database interactions, cookies, paths, and all sorts of goodies that will make you a better programmer.

I've had my head buried in the debug information since I started with ColdFusion. Back then (in the Wild West days of CF 4.01) we never heard of newfangled ideas like "cfqueryparam". We just stuffed our variables into queries willy nilly and trusted the good Lord to protect us. It feels like I have spent the last 7 or 8 years cleaning up after code written like that. But writing queries in the raw (unprotected I mean... I don't generally code naked, although I did experiment in college) had one main advantage. As you probably know a lot of debugging goes back to the database. The debug output pre-cfqueryparam was "well formed" query code that could be copied and pasted directly into a query tool like MSSQL studio or Navicat. This made debugging pretty easy. You could swipe a problem query out of the debug, run it and tweak it unit it gave you what you needed, then past it back into CF. But that changed when we all started using CFQUERYPARAM.

[More]

The Journey: Winning the Clone Wars Part 1

In my last post on this topic back in September, Phase II - The Clone Wars, I discussed the first phase of our business development. We talked about how I tried to duplicate my own skills and energies by hiring likeminded folks, and how this led to a lack of diversity and innovation. In this post we will pick up on some of the solutions to those issues. Let me say at the outset that some of these issues (founders syndrome for example) are systemic and require constant vigilance and an ongoing effort to resolve. After all, we didn't come up with this list overnight at Denny's and pop in the next morning with neat and tidy solutions to all of them. Some of the items on our list (the need for sales, the value of diversity, the importance of management, team building etc.) required some convincing and cajoling and even some hard knocks to move us in the right direction. But I can say that in spite of "peaks and valleys" (which was incidentally my nickname in high school) we are moving in the right direction. So let's talk about solutions for moving off of the clone model and to something more workable for a larger, team-oriented staff.

[More]

Work for the Muse and Change Your Life

CF Webtools is looking for bright, talented, and motivated developers with high skill sets in ColdFusion, .NET and Mobile development (including IOS and Droid). We value developers who:

  • Take ownership of a problem and find a solution.
  • Participate in the community through lists, blogging, user groups etc.
  • Have a high skill set and a professional learning ethic.
  • Know how to communicate technology concepts across disciplines.
  • Respects and honors our customers.
  • Have a great sense of humor.
  • Love being a part of a "family" of developers who work together without a lot of drama.
For more info on what it takes to be a CFWT consultant check out my post on You Might be a Muse All-Star.

Our positions are full-time remote telecommute. On rare occasions they might require some travel. We pay a competitive salary and benefits. CF Webtools maintains sites on virtually all ColdFusion and Database platforms. Our work is challenging, enervating, sometimes hair-pulling, but never boring. Our development group is lively, talented and a true mentoring community (and growing more so daily). If that sounds like a place you would like to work (and you meet our high skill-set standards) send your resume to jobs@cfwebtools.com - or contact the Muse directly if you like. Tweet me @cfwebtools or use the "Ask a Muse" link on this blog (I'm easy to find). You can also call 402 408 3733 and ask for Mark or Jason - we'll be thrilled to speak with you about our opportunity. The official job posting may be found on our corporate site at the Job Openings page.

Please note - while I'm getting better, I'm not am often pulled in many directions. If you feel like I have "dropped the ball" when you sent me a resume in the past - you are probably right. Please don't hesitate to contact me again. I'll make sure that Jason and Melissa (who handle the details) don't let you fall through the cracks this time.

The Journey: Phase II - The Clone Wars

I was recently chastised by a twitter follower (a beat down in 140 characters or less) for starting series that I fail to finish. So I'm coming back to my "Journey" series to add to the CF Webtools story a bit. When last we met on the subject I spoke of the 3 attitudes you need to succeed in the consulting business:

  • Work Hard and Be Patient
  • Be a People Person First
  • Avoid Perfection Paralysis and Do What You Can Do
With those thoughts in mind I'd like to talk about Phase One of your consulting business - building Clones.

More of Me

Anyone who's ever been successful as a contractor and thought about expanding has thought to themselves, "If I only had 2 of me." Aside from the obvious stress it would put on my wife you would think that having 2 of the Muse would be exceedingly useful. But knowing me, I would doubtless be playing golf right now leaving me behind to do all this work. That's just like me. It would make me so angry I'd be beside myself. Still, the idea is compelling when you are starting out - so compelling that you think about it a great deal when contemplating that all important first hire.

Consulting businesses are often started by knowledge experts with little or no business experience. When expanding such a business the first choice is usually "more of the same". In my case since I worked a certain way, I geared all my documentation, proposals, and estimates to the skill set of the Muse. So what did I look for in my first hire? Muse II of course (same level of action with a weaker plot I guess). It made sense to expand the current way of doing business by simply gathering similar skill sets to myself and dividing the work up amongst them. My first hire (Jason Herbolsheimer who is now CF Webtools VP of development) was an energetic can-do programmer able to find creative solutions to difficult problems. He worked at a similar speed to my own and was (and still is) a terrific people person. It was a great fit. Suddenly we were able to do roughly twice the work as before. In fact, my first 3 hires where like that. They were proven CF developers who I had known previously. Two of them had worked with me at my previous Job. The 4 of us divided up our customers and simply worked them in the same manner that I had worked them when I was an individual contractor.

This approach reminds me of that moving company "2 men and a truck" (would that be a "Mac" truck?). My guess is they started out as 2 men... and a truck. When they decided to expand they were probably considered changing their name to 4 men and 2 trucks, then 6 men and 3 trucks. There's some magic to this approach. It actually works well in many cases - especially if you assemble the right folks. If your team members work well independently and have the right soft-skills (inner-directed, owning problems, eclectic skill set, customer driven etc.), it can work quite well. The 4 of us did fine and had a great time along the way. I know of 3 or 4 consulting companies who operate at this level and intentionally stay at this level. And why not? They make good money, have very low overhead, and the level of responsibility is less crushing. Still, if you plan to expand beyond a handful of developers, the "clone model" (not to be confused with cloning an actual model which my wife says is out of the question) comes with some penalties.

[More]

The Phonetic Enforcer - Customer Service Run Amuck

From the absurdist school of customer service I bring you another tale of woe and frustration (and comic insight).

I write for a living. I know most folks think I actually code, troubleshoot, run a company etc - but in truth a large part of my job is to communicate in email, documents and instant messaging. Recently I got to thinking about purchasing a new software that would help me with style and editing (I'm a notoriously wordy writer). I started poking around and found this link with some excellent choices so I started reviewing them. I settled on one of them (I won't say which but it was pale and misty) for my first trial. It was inexpensive and appeared to have an easy interface. More importantly it seemed to be able to jump to life within any software I was using. Since I use Word, Evernote, Outlook, Gmail, Google docs, and Homesite (for blog writing using hand coded HTML) I thought that was a great feature.

I downloaded a copy and tried it out on a few things - emails mostly. I liked it so I purchased a licensed. I began with a document that I was prepping. Uh oh.... the software has a 10,000 character limit - it won't scan more than 10,000 characters at a time. That's a non-starter for me - and it's too bad. The software was really nice and slick - and I was digging it. I contacted support and they were extremely helpful in answering my questions and confirming that it would not meet my needs. I asked for a refund (I'd had my license about an hour) and they said "no problem". They forwarded me to "Lee" in the payments department. That's when the trouble started. Here's a rough outline of how it went.

[More]

Muse Review: Exploring CouchDB With Matt Woodward

On Saturday I sat in on ColdFusion genius Matt Woodward's session on practical couchDB. I have experience with both Memcached and MongoDB so I thought I was prepared for the general sense of what you could do with CouchDB (which I had never explored). I assumed it was just another "no SQL" database. But Matt demonstrated some things that were new to me and I am intrigued enough to experiment with them - hopefully engendering a few more "CouchDB" blog posts. Here's a couple pros and cons gleaned from the presentation.

[More]

Muse Reviews: Charlie Arehart on ColdFusion 10 Server Options at Cfobjective

I'm sitting in on Charlie Areharts workshop regarding how ColdFusion 10 and Tomcat live together and how to configure it. It's obvious that a good deal of my specialized JRUN knowledge will be less than useful in a couple years but I'm really excited about the change. Charlie does a good job of identifying:

  • Where everything is at - log files and config files live in new locations now.
  • What should you watch for - lots of new files and folders that may or may not be useful to fool with.
  • What you should not be paying attention to. Tomcat is an app server that can do far more than just serve up jsp (or cfm) files. Charlie spent some time helping us understand what to ignore.

Of Note...

Charlie identified a Tomcat filter (valve) called CralwerSessionManager that can truncate a session for an indexing bot to be very short-lived. That could be very useful for high traffic sites as those of you who have written extensive bot checking code to shorten the session timeout can attest. This would handle that automatically (if I understand what he's saying) at the server app level. He also identified some "listeners" that look interesting. I'm really looking forward to understanding more about Tomcat.

One of the new features is to save sessions after a restart. to do this you have to modify context.xml by uncommenting a node and adding a path. The Muse will try to write this up in his own style at some point. The gotchas are that it has to be a graceful shutdown (not a crash) and it can be a lengthy process which may negate the purpose on a busy server with a great many sessions. Still, under certain circumstances it would be a real plus I think. Another option is to use the built in Tomcat Persistent Session Manager which is able to save to a database or individual files.

Resources

As usual Charlie's presentation is replete with tons of URL resources so I'm going to point you to his site Carehart.org.

Muse Review - Code Reviews With Jim Priest at Cfobjective

Great workshop on Code Review by Jim Priest (The Crumb). Jim demoed a product called Review Board a product that integrates with Git or SVN and provides a mechanism and workflow for reviewing code in a team. Like coding standards it is probably more important that you do review code than exactly how you review it. Spending some time looking at what you and your team is doing with an eye toward improvement and consistency. Great Seminar Jim - I learned a lot.

Addendum - Jim also mentioned Smart Bear as a good resource for code reviews.

Muse Review - Intro to HTML 5 With Ray Camden at Cfobjective

Sitting in on the first third of Ray's HTML 5 intro. He has a "buttload" of code (his word - one wonders about the capacity but I digress) and with his usual efficiency he has posted all his sample code on github here. Great quote from Ray.

"Whenever I hear descriptions of HTML 5 it reminds me of a drug commercial. It's one sentence of benefits followed by 2 minutes of horrible side effects."

Instead of focusing on esoteric things like canvas, Ray's preso spends a lot of times on form features. This is one of the best things about HTML 5. There are simple and straightforward ways to make forms more usable. A great example is the autocomplete implemented entirely on the client side and entirely without Javascript.

<input type="text" name="foo" list="gurus">
<datalist id="gurus">
<option>Ray</option>
<option>Ben (the elder)</option>
<option>Ben (the younger)</option>
<option>Sean</option>
<option>Muse</option>
<option>
</datalist>


The really cool thing is that datalist is ignored by older browsers and picked up by more modern browsers. It sures beats having to gin up some Ajaxian bindings (not that there's anything wrong with that). There's still be times when you need use Ajax for autocomplete when you have a query to run or a huge dataset. But it sure makes those simple select fields easier and provides a great user experience. Remember you have to have that Doctype added so your browser knows to try to render in HTML 5.

As usual Ray teases out some of the most practical and useful tidbits - things that can be used immediately. Make sure and check out the excellent samples at github. Ray also recommends Can I Use - a great site to test your HTML version code.

Muse Reviews - Key Note, Day One at Cfobjective

Rakshith Naresh and Hemant Khandelwal from Adobe did an outstanding job at the keynote. They are not the most compelling speakers but like a lot of engineers their eyes light up when they engage on the topic of their favorite technology (in this case ColdFusion 10). I was impressed by the litany of efforts and initiatives they have underway - and the general direction of the platform. Key notes (some of this old news):

  • Extensive HTML 5 support (video, sockets, canvas, charts)
  • Major security enhancements
  • Better update and upgrade paths with automatic install and rollback from within the admin.
  • More thought and effort toward expanding the number of developers through extending Java skills as well as supporting the community through events like CF Objective.
I'll have more to say throughout the week as I visit some workshops. Best quote was from Ben Forta (via video) who said "ColdFusion supports HTML 4, HTML 5,...every version of HTML. ColdFusion supports HTML 6 and it's not even been invented yet".

The big news or announcement was that ColdFusion 10 will be available on the AWS cloud as an AMI in the near future in both medium and large instances with a price point of 60-80 dollars per month. The Muse thinks this will make a VPS deployment within reach of some folks who currently suffer through shared CF hosting nightmares.

Cfobjective - the Social

Cf.Ojective - the Social

Last night was the reception for Cfobjective. I met some old friends as well as some fantastic new folks. CF Webtools standouts Ed Bartram, Jason Durham and Denny Springle were all there schmoozing with the geek crowd. Dan Skaggs spoke with me about an interesting new product that I'll have to keep an eye on. I met a fellow named Steve who was originally from Ireland but his brogue was slightly disappointing (come on Steve - don't assimilate!). I spent some time With Jordan and Mike the guys from the outstanding Vivio Tech (check them out if you don't already know who they are - they have a booth). I caught up with Dan Vega. I met Steve Withington (again) and finally ended up the night hob-knobbing with Charlie Arehart, Scott Strutz (or Nathan Strozz... something with a single syllable "st" sound) and (a new frend) Darren Pywell who brought us Fusion Reactor.

Like most geek crowds we are a largely male audience, but this year's conference features a lot more women than I remember. Actually that could be my imagination but it's helped along by the fact that virtually all of them sat at the same table. That's one single table (if that gives the rest of you an idea of volume). The rest of the room gave them about 10 foot of padding and I saw many a male developer circling carefully. The Muse - who's lack of inhibition is exceeded only by a lack of modesty (and who's old enough to have fathered most of the folks here)- sauntered up and chatted with them for a while. By the time I left the reception they had at least one non-estrogen dominant member (I'm going on looks here) so perhaps they were making progress... or perhaps he was an unwelcome intruder (ticks are bad in MN). I couldn't tell.

In any case it's shaping up to be a fantastic conference and CF 10 is all the buzz. I'll be checking in throughout the day so keep an eye out for new tidbits. Remember, I'm wandering around in a Red shirt trying my best to be gregarious. Make sure and say hello!

Muse Abroad - the Ugly ColdFusian

Muse readers - next week I'll be in Minneapolis MN at the Cf.objective conference. I'll be waxing eloquent in the ad hoc room (TBD) about 2 topics near to my heard. The first is web sockets and the second is consulting. It seems like that's something these conferences could do well to address as the employment landscape changes. Indeed if you are a consultant, freelancer, company owner or whatever and you want Muse tips on getting paid, landing contracts, selling yourself and your technologies, saving troubled customers, getting beyond your skill set, hiring your first and tenth employee etc. - come to that one for a lively discussion. If you are a corporate lackey you can come too, but we may look at you suspiciously out of the corner of one eye.

I also have a new plan for cfobjective this year. Since I actually don't do a lot of hard core programming any more I'm not going to dig into a specific topic and try to gain a lion's share of expertise. Instead my plan is to:

  • Flit from room to rom and booth to booth and pick up as much general knowledge and witty banter as I can.
  • Tweet copiously from the conference about everything and anything of interest to me. My twitter handle is @cfwebtools and the hash tag for cf.objective is #cfobjective.
  • Blog a few times per day. Naturally these will not be my typical wordy tomes of dubious length. Instead I plan on a few paragraphs highlighting various workshops or interesting thoughts or even people I've met who are blog-worthy.
Of course I will mention names and companies so if you want to give me a heads up about your workshop so I can stop in and say something nice (and the Muse is always positive - no worries there), let me know. I'll be happy to oblige.

If you are going to be at CF Objective and would like to chat about consulting, working for CFWT, the next big thing, why CF is dead (again - Lord Beric eat your heart out), or anything else I'd be thrilled to meet you and hear about your latest project or pet mice or see your knitting or whatever. I'll make it a point to wear a RED SHIRT every day. I'm 6', a little pudgy, balding, with lovely blue eyes (says my wife), a little too verbal and over-confident, and I'll be hanging around everywhere like a ubiquitous traveling salesman. So don't be shy - if you see me give a shout! Let's have a drink, pants Ray, make fun of Mark Drew's accent or at least put soap in the hotel fountain or something. Don't leave me hanging.

Datasource Attribute in Application.cfc

You may know about the "datasource" property in ColdFusion 9. It allows you to create a variable in your Application.cfc file called "datasource" and then skip the "datasource" attribute of your query tags. That's pretty neato. Here's how it works. In the Application.cfc properties...

<!---Application.cfc--->
<cfscript>
    this.name = 'mort';
    this.sessionmanagement = true;
    this.datasource = 'myDsn';
</cfscript>
....
Then in any component that is "inside" of my application "mort" above I can do something like this:
<!--- myMethods.cfc --->
<cffunction name="getAllUsers">
    <cfset var 'myQry = ''/>
    <cfquery name="myQry">
        SELECT username, email
        FROM     users
    </cfquery>
    <cfreturn myQry/>
</cffunction>
Do you notice what is missing? There's no "datasource" attribute in the cfquery tag. ColdFusion automatically picks up the datasource from the Application.cfc instead. It's a nice time saving effort that reduces code and allows for fewer mistakes. Good for multi-tenant code too.

A Minor Detail

There is one issue that I was made aware of with this approach. Super genius guru Phillip Senn had a head scratching problem where he would set this variable in Application.cfc. Periodically he began getting and error which said:

The value of the attribute datasource, which is currently "" is invalid.
He tried some different things - working with the application names and extended properties of the Application.cfc but nothing seemed to help. Finally he ran the var scope checker which identifies places where un'varred variables exist inside of CFCs. He found several un'varred variables. After he fixed them the problem went away.

So if you are using this Application based this.datasource approach and you get some random errors where the variable seems undefined - or seems defined as a blank string - start looking for vars that are not properly scoped within your components. It may just fix you right up.

Able Commerce 5 on CF - Email Problem

A while back a product called "Able Commerce Builder" (ACB) was a popular (or pseudo popular) platform for CF folks. This would have been as far back as 1999. At some point they hired one of those developers who believe his technology choices are up there with the Scripture and the Holy Grail – but "he chose poorly".

He rewrote the entire application in Java with a ColdFusion facade. He moved everything into objects and the code became a byzantine maze of object instantiation and java arrays and objects and looping. Of course none of ColdFusion's strengths were on display (easy to read code, modifiable queries, list handling, looping and outputing, query objects etc. Thankfully ACB moved on to .NET and left CF behind - and good riddance! They were giving it a bad name. I trust their new platform was written by actual .NET developers - let's hope anyway. I wish them well.

Over the past couple of days ACB on CF has risen its ugly head again. I've been trying (with the help of super Tech Kevin Fatkin at Edge Web) to fix an issue with an ACB server. After an upgrade of the JVM and some hotfixes on a CF server running ACB, the customer discovered email had suddenly stopped going out. The fix for that is simple right? Check out the cfmail tags, double-check resolution, run a few telnets etc. Install a cert etc. Ah... if it were only that easy. In fact ACB under the hood (in keeping with its face melting decision making) reinvented the wheel and deployed its own Java based mail classes. Something changed, email is not going out, and we can't modify it the code in any real way. It's enough to make me want to have my leg chewed off by a Laplander. Fortunately if you have this problem we actually did find a solution.

[More]

More Entries




Blog provided and hosted by CF Webtools. Blog Sofware by Ray Camden.