ColdFusion

add news feed

tweet a story

A few years ago, I created a user defined ColdFusion function - toJava() - that tried to me "smart" about the way it cast ColdFusion values into Java values. Unfortunately, it turns out that I was basically re-creating a feature that C...
A few years ago, I created a user defined ColdFusion function - toJava() - that tried to me "smart" about the way it cast ColdFusion values into Java values. Unfortunately, it turns out that I was basically re-creating a feature that ColdFusion already had; only, I didn't really understand how it worked. I'm talking about the javaCast() function. And, more spe ... Read More »
about 5 hours ago
This question came in via a reader and let to some interesting aspects of the ZingChart engine embedded in ColdFusion 10 (remember though that this is Enterprise only). The reader wanted to replace the numeric labels on the Y-Axis with s...
This question came in via a reader and let to some interesting aspects of the ZingChart engine embedded in ColdFusion 10 (remember though that this is Enterprise only). The reader wanted to replace the numeric labels on the Y-Axis with strings instead. From my experience with ZingChart in the past, I assumed this was probably possible. The engine is incredibly powerful and has about a bazillion options. I reached out to the company on Twitter and with their help, I was able to get it working. First, let's start with a simple bar chart. //sample data data = queryNew("name,age", "cf_sql_varchar,cf_sql_integer", [ {name:"Ray",age:40}, {name:"Dave",age:41}, {name:"Todd",age:38}, {name:"Scott",age:55} ]); writedump(data); I've got a fake query (and fake data, Scott really isn't that old) that I pass to cfchart. Here is the result. The goal now is to change the y-axis values so that I can label a few values from young, to medium, and to old. There are two things you need to do in order to make this work. First, you need to specify your y-axis values instead of letting this happen automatically. For a chart involving age, this is rather easy. Depending on your data this may or may not be a big deal. This can be done via the yaxisvalues attribute of cfchart: yaxisvalues="#[10,20,30,40,50,60,70]#". That helps define the actual range on the yaxis. To define the labels, you will use the yaxis attribute. This takes a structure of options. I believe the documentation for what you can send is defined here, but I'm not entirely sure about that. With the ZingChart folks helping me out on Twitter, I was told specifically what to pass - a labels key. Let's look at an updated example. Notice how some of the labels are blank. This creates the effect of a chart with only the string labels, not the numbers. If you want to keep the numbers as well as the strings, simply include them in the labels. All in all, pretty nice. You can do other things with the labels including rotating them, sizing them, etc. As I said, ZingChart has a huge amount of options. For those of you not using ColdFusion 10 Enterprise, it may be worth purchasing as is and just using it natively. The price is $250 for a single domain and while there are many free options out there, I've been very impressed with ZingChart and their technical support. (As I mentioned above, they helped me out on Twitter and this is not the first time they have done so.)
about 10 hours ago
At InVision App , we often have heated debates about the importance of thumbnails vs. the importance of naming conventions. I am the loud minority that loves naming conventions; everyone else loves thumbnails. Until recently, I had only...
At InVision App , we often have heated debates about the importance of thumbnails vs. the importance of naming conventions. I am the loud minority that loves naming conventions; everyone else loves thumbnails. Until recently, I had only ever argued my point based on gut-feelings; but, in the last few days, I've had a mome ... Read More »
1 day ago
Just a quick note that my article on the new linting API in Brackets was just published: New Linting API. The article discusses how the extension API for Brackets Sprint 31 was updated to provide better support for linting operati...
Just a quick note that my article on the new linting API in Brackets was just published: New Linting API. The article discusses how the extension API for Brackets Sprint 31 was updated to provide better support for linting operations.
2 days ago
A few months ago I released an extension for Brackets called JSDownloader. The idea behind the extension was rather simple. I wanted a quick and easy way to grab my favorite JavaScript libraries. Yes, I realize there are tools out there ...
A few months ago I released an extension for Brackets called JSDownloader. The idea behind the extension was rather simple. I wanted a quick and easy way to grab my favorite JavaScript libraries. Yes, I realize there are tools out there that do this already. But those tools just didn't work well for me. As an example, I tried Bower once to grab a copy of jQuery and discovered it downloaded a large number of other files as well. To be clear, there is a good reason for that!. But it just wasn't what I personally needed. From that need JSDownloader was built. But there was big flaw with the extension. I couldn't add support for jQuery Mobile because the jQM library contains a few images. Right now the Bracket's File API allows you to read and write files, but does not provide access to binary data. There has been a workaround for a few releases though - using Node. I blogged about using Node with Brackets Extensions a few months ago. I never got around to updating JSDownloader because, well, it felt like overkill to me. Also, I held out hope that the core File API would eventually support it. Last week I stopped being lazy and got around to fixing it. I do not believe my solution is the best, but if you have the same need for your extension, you can now copy what I did. My extension pretty much only calls out to Node for the file save operation so in theory, it should be easy to re-use in a totally different extension. Here is a bit of the code. First, I'll start off with the call to Node from my main JavaScript file in the extension. var suPromise = nodeConnection.domains.downloader.fetchStuff(filesToGet,pathToUse); suPromise.done(function(port) { $span.html("Done!"); ProjectManager.refreshFileTree(); }); In the snippet above, filesToGet is simply an array of files for a particular JavaScript library. For jQuery, this is one file. For jQuery Mobile, this is a JavaScript file, a CSS file, and a few images. Finally, pathToUse is simply the current project directory. So basically - Node will be told what to get and where to save it. Actually - let me amend the previous statement a bit. In order to make the logic a bit simpler, I'm passing an array of file names that also include an optional path that is a subdirectory. This allows me to store the jQuery Mobile images in a subdirectory called "images". This will be underneath the main directory specified in pathToUse. Again - I'm not saying this is the most elegant solution! Now let's look at the Node code. I want to be clear here - my confidence in this portion is not terribly high. I've got one main concern I'll share at the end. function fetchStuff(urls,basePath) { urls.forEach(function(item, idx, urls) { var fileName = item.href.split("/").pop(); var fullPath; if(item.path) { fullPath = basePath + item.path + fileName; //does item path exist? if(!fs.existsSync(basePath+item.path)) { fs.mkdirSync(basePath+item.path); } } else { fullPath = basePath + fileName; } // Credit: http://stackoverflow.com/a/5294619/52160 var file = fs.createWriteStream(fullPath); function resHandler(res) { var imagedata = ''; res.setEncoding('binary'); res.on('data', function(chunk){ imagedata += chunk; }); res.on('end', function(){ fs.writeFile(fullPath, imagedata, 'binary', function(err){ if (err) throw err; console.log('File saved.'); }); }); } if(item.href.indexOf("https") === 0) { https.get(item.href, resHandler); } else { http.get(item.href, resHandler); } }); return 1; } For the most part this should make sense. The thing that concerns me the most is the return 1 at the end. I'm pretty sure that is wrong and makes the extension report immediately that it has completed the download. Since I'm talking about pretty small files here I'm not concerned, but it is something I'd like t
2 days ago
Two thumbs up! Kirk's main objective was to answer the question of why bad things happen. He did answer it, but the completeness of the answer rests solely on the viewer's ability to comprehend it. In parallel, Kirk juxtaposed a thought ...
Two thumbs up! Kirk's main objective was to answer the question of why bad things happen. He did answer it, but the completeness of the answer rests solely on the viewer's ability to comprehend it. In parallel, Kirk juxtaposed a thought provoking study of the mind and nature of God and His love for mankind with a real-world story of a good family who lost a child. I believe it was a very risky and m
M
5 days ago
Last year, at cf.Objective(), I was watching Elliott Sprehn give a presentation on Production Ready JavaScrip t. In part of the presentation, he was talked about client-side errors and recommended that everyone log client-side errors ...
Last year, at cf.Objective(), I was watching Elliott Sprehn give a presentation on Production Ready JavaScrip t. In part of the presentation, he was talked about client-side errors and recommended that everyone log client-side errors to the server. To be honest, before he mentioned it, I don't think that it had ever occurred to m ... Read More »
M
6 days ago
While it may not be as useful as my last extension, I whipped up a quick extension this week called HTMLEscaper. All it does is escape HTML. I know - not very exciting, right? After switching to PrismJS I realized that I needed to es...
While it may not be as useful as my last extension, I whipped up a quick extension this week called HTMLEscaper. All it does is escape HTML. I know - not very exciting, right? After switching to PrismJS I realized that I needed to escape any HTML characters in my code samples. I've been using this tool (HTMLEscape.net) but I really wanted something in Brackets. Here is a quick screen shot of it in action: You can install it now via the Brackets Extension manager or grab the code on GitHub: https://github.com/cfjedimaster/brackets-htmlescaper.
7 days ago
First off, I'm not a CSS expert. So, let that frame what I'm about to say: The vast majority of "float" styles can be replaced with some form of relative and absolute positioning . Whenever possible, I try to avoid using "float"; and so...
First off, I'm not a CSS expert. So, let that frame what I'm about to say: The vast majority of "float" styles can be replaced with some form of relative and absolute positioning . Whenever possible, I try to avoid using "float"; and so far, it has been working out quite nicely. Obviously, some situations require float; if you need rows and columns (and it doesn't call for a Table element), you're gonna need to float those elements; if you need pixel-perfect white-space ... Read More »
7 days ago
@siok @ShearsBilly @InVisionApp Yeah, looks like a Google JS file is hanging:
@siok @ShearsBilly @InVisionApp Yeah, looks like a Google JS file is hanging:
8 days ago