Inline logic vs CFC vs SP
I'm drafting our first set of code standards, and I'm running into a philosophical debate which I'd like to open up to the community. Some would say our standard should be to place all queries and as much execution logic as possible into CFCs. The advantages of this are: most of your business logic is centralized; if you have to make major changes (like the time we had to copy most of an app's functionality over but change a large percentage of the schema references) it's easy to find most of the relevant code; and, you can often make major changes to an application without pushing more than one or two files to production. Others argue that code only belongs in a CFC if we can expect that code to be reused. So, if a piece of functionality is extremely specific, and therefore not likely to be called elsewhere, then why take the extra step of abstracting to an object. The pet peeve illustrated here is a submit handler page that contains nothing but a call to a CFC, which apparently annoys when business logic is expected on the handler page. Still others would have us put most logic in stored procedures (which produces the sub-debate of whether it's redundant to call a CFC that calls a stored procedure). First, I have to note that we are on Oracle, and personally I don't find it nearly as easy to debug stored procedures in Oracle as it is in SQL Server. Second, I have heard that performance improvement is minimal, and security differences aren't noteworthy provided that you're using cfqueryparam. Third, we would lose database portability (there has been talk of moving to SQL Server, which powers our SharePoint site; of course, there have also been rumblings of moving us to .Net in which case there's no particular advantage either way to storing business logic in the database layer versus the application layer). Then there are a couple of folks pushing for frameworks, but I don't think we're quite ready for that yet. So...inline code if reusability is unlikely? Everything in CFCs? Forget CFCs, go to stored procedures? Some rationale for when to use what? Very interested in hearing your opinions! Thanks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:352977 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
CF 10 and Sharepoint
We are upgrading our apps to CF10, and have an opportunity to rebuild our primary application (even in a diff language if we so choose). We also use Sharepoint 2010 for our intranet. The app in question involves a lot of document workflow (uploads/approvals), and the request has been made to (1) auto-generate documents based on other known information, (2) provide redlining and version histories. That sounds like Sharepoint. I don't think it's realistic to try to fit the entire app into Sharepoint, since my impression of Sharepoint is that it works great for what it was built for but woe to those daring to customize much (and personally I dislike the interface and find a lot of the functionality counterintuitive). Has anyone attempted to integrate Sharepoint functionality into your CF app? I understand the cfsharepoint tag does allow you to manipulate Sharepoint lists, but would that include providing document versioning and editing? Does Sharepoint even handle approval/rejection of documents? Is there a point at which it no longer makes sense to keep the app in CF if I have to make heavy use of Sharepoint...should we at least look seriously at moving to ASP.Net instead? Interested in those who have walked the path. Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351809 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Is CF slower than Java?
Thanks for the great analysis! He took out the speed issue comment. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351556 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Is CF slower than Java?
I'm giving feedback on a colleague's paper containing the following line: Cold Fusion is written in JAVA which means, generally, that a ColdFusion program will run slower than a program written directly in JAVA. If speed of the application were the primary consideration, PHP or JAVA is the clear choice. Now maybe I'm just used to hearing ColdFusion marketed as leveraging Java's speed; I suppose it makes sense that any extra layer is going to cost something in performance. A measurable difference, though? And since CF compiles to Java, and native Java would have to be compiled, isn't it possible that running CF is effectively identical to running Java? I can't find any proof of this assertion one way or the other. Does anyone know the answer? Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351540 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
StructDelete inside cfc
I'm trying to process dynamic form fields in a function. The first thing I need is to grab a value that I need for saving the data to the right user. If for some reason the value isn't there, I want to halt processing; else I want to remove the value from the structure so I can loop over the rest of the form scope and insert all numeric values. For some reason, it errors at the StructDelete line. This is CF8 if that matters. Error: Invalid CFML construct found on line 144 at column 68. ColdFusion was looking at the following text: recipient_id The CFML compiler was processing: A cfset tag beginning on line 140, column 10. Beginning of function: cffunction name=processSurvey returntype=boolean output=false hint=Takes the form structure and processes the completed form. Returns boolean indicating whether insert was successful cfargument name=FormStucture required=yes type=struct/ cfset var processSuccess = false / cfset var RKeyExists = false / cfset var insertText = false / cfset var qrySurveyInfo = / cfset var recipient_id = arguments.FormStructure.recipient_id / !--- saved to local var, delete from struct; error if it isn't there --- cfset RKeyExists = StructDelete(arguments.FormStructure, recipient_id, true) cfif StructIsEmpty(arguments.FormStructure) or NOT RKeyExists cfexit /cfif ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349321 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: DirectoryExists sometimes returning incorrect value
Very unlikely, the directory definitely exists, since it's our main repository for documents...we aren't creating it all the time, it's just a best practice that we're checking for existence. Could this same code be run concurrently by two threads/users? One thread could be int he process of creating the Dir when another does it's dirExists() check. You may want to toss a named lock around it to make sure only one process is messing with the directory at once. I'd use hash(dirpath) as the name of the lock to make it a clean unique URL with no special characters.. -Cameron On Tue, Dec 6, 2011 at 4:56 PM, Shannon Rhodes shan...@rhodesedge.comwrote: ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348994 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: DirectoryExists sometimes returning incorrect value
I understand and agree with your style preferences, but neither complaint with legacy code would cause issues. Since DirectoryExists returns a true/false, you don't need the IS No part of the statement. Also, DirectoryExists expects you to pass it a variable, so you don't need the quotes and pound signs around variables.dirpath: cfif NOT DirectoryExists(variables.dirpath) cfdirectory action=CREATE directory=#variables.dirpath# /cfif HTH, Carl On 12/6/2011 1:56 PM, Shann ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348995 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: DirectoryExists sometimes returning incorrect value
I honestly don't know; it's coming from the global variable for all of our applications. I guess I always assumed it had to do with mappings or something, since we can't have a relative path here. I can definitely strip it out and see if that solves the problem. The specified directory attribute value \\blah\AppDev\ParisDocs\blah\docs\ What is the double \\ for? Sometimes it is taken as equivalent as one single \, but some other time it may not. This could explain why DirectoryExists says it doesn't but it is found when being created. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348996 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
DirectoryExists sometimes returning incorrect value
This appears to happen randomly, making it difficult to replicate. Code will error that looks like this: cfif DirectoryExists(#variables.dirpath#) IS Nocfdirectory action=CREATE directory=#variables.dirpath#/cfif The error looks like this: The specified directory attribute value \\blah\AppDev\ParisDocs\blah\docs\ could not be created The most likely cause of this error is that (above) already exists on your file system. The exception occurred during a cfdirectory action = 'CREATE'. The directory definitely exists and most of the time the code works. What can I look at to discover why DirectoryExists would return No when it should be yes? Thanks in advance! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348985 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
Thanks all...it seems to have magically resolved itself after some server maintenance this weekend. I appeciate the help! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347726 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
Right. It can't find it. That's my problem: ColdFusion is supposed to create it automatically: ColdFusion automatically creates a WSDL file for any component referenced as a web service. For example, if you have a component named echo.cfc in your web root directory, you can view its corresponding WSDL file by requesting the component as follows: http://localhost/echo.cfc?wsdl; http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=webservices_19.html So folks, does anyone know what to do when ColdFusion fails to create the WSDL?? If you can't take the WSDL URL for your web service and load it in a browser ON the server, CF can't load it either. The 404 from your CFHTTP call is a good indication that CF simply can't find it. .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com Why would there be an issue resolving the domain? CFM files work fine from the same directory when called via url. Is there some other step to making a web service available that I'm missing here? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347690 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
WSDL 404 Error
I'm testing publishing my first web service. The CFC works fine---I can call any of the functions and dump the results to the screen. Everything I read online when researching how to turn this into a web service can be summarized as ColdFusion makes it easy---just make your method access remote, then call the cfc?wsdl and it will automatically create the WSDL file for you. Well, I don't know if this is unsupported in CF7 or what, but I get a 404 error if I try calling http://mydomain/mycfc.cfc?wsdl (actually, if I try to invoke as a web service, I get a stub error, but if I plug it into cfhttp I can see the page not found error returning). Where do I go from here? My guess is it's just not generating the WSDL for me, but I don't know why or what to do about it. Thanks in advance! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347644 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
On Fri, Sep 23, 2011 at 3:38 PM, Shannon Rhodes shan...@rhodesedge.comwrote: I'm over 50% positive this happens with useing OnRequest in applicatiton.cfc I can't remember the work around for this off top of head since I don't do internal WSDL calls often but believe it is due to how Application.cfc deals whith these request. If you can move your OnRequest logic to OnRequestStart and comment out OnRequest it might do the trick. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347650 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
No, same as the cfhttp call...but the cfc is there and functional as a normal object invocation. Can your server resolve http://mydomain/ ? Try to open the WSDL URL from a browser on the machine that is running CF. .:.:.:.:.:.:.:.:.:.:.:.:. Bobby Hartsfield http://acoderslife.com http://cf4em.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347651 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
Thanks but it's not onrequest, this is the entire application.cfc: cfcomponent displayname=Application output=true hint=Handle the application. !--- Set up the application. --- cfset THIS.Name = WebServiceApp / /cfcomponent ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347654 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
Why would there be an issue resolving the domain? CFM files work fine from the same directory when called via url. Is there some other step to making a web service available that I'm missing here? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347656 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: WSDL 404 Error
Yes access is remote. The only reason why I did any object invocation on the cfc was to test it. I'm merely excluding the possibility of error in the cfc itself. But that does me no good---it needs to be a web service. That's my dead end, you call the web service and get a 404. Can anyone tell me how to publish a web service with ColdFusion? And confirm that the WSDL should be created automatically in CF7 when ?wsdl is added at the end of the url? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:347660 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Application Variable Randomly Resetting
This is too bizarre for me to make heads or tails of it. Randomly, on production, we're getting a hard error because the application variable for our datasource is referring to the name of the QA dsn (which isn't defined on production) instead of the production dsn. It happened to me today...a hard error was buried in the nav area, and when I looked at the line number it referenced, it had the exact same variable name at the error line as it had in all the queries above it. It was as though it randomly changed what the variable resolved to after many successful queries above it (the rest of the page rendered just fine). When I clicked away and clicked back, the hard error was mysteriously gone. We've searched the entire production codebase for a reference to the QA DSN; nada. QA isn't even hosted on the same server. Any ideas where to look from here? Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346967 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Committing Line by Line Changes?
I've been charged with choosing versioning software for our team, and I'd like to recommend Subversion but there's a developer who wants a feature that I'm not sure Subversion (or other versioning tools) can accommodate: partial commits. For example, you may be working on a project where you've touched a lot of code that is not ready for check-in, but then a high priority change comes across your desk that requires you to make an unrelated change to one of these files and check it in. He wants to be able to pick and choose which lines of a changed file get checked in. Is that possible with any versioning tool?? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346355 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Emailing a file to an application
I was asked today if there's a way to use ColdFusion to basically email a document to an application rather than users having to save attachments to their systems and then upload to a CF application from there. So you'd email a file from, say, Outlook, with an identifying number in the subject line, and then automatically upload the attachment and otherwise run business logic to associate the file to the correct ID in the application (authenticating based on user's email address). It's easy enough to use CF to upload a file and run business logic, but I'm stuck on the idea of how it's going to parse out this information in the first place. I'm guessing you'd set up an email account to receive such files, then run a task to periodically comb through this account's inbox and somehow read the subject lines, from addresses, point to the attachment for upload, then archive the message. Anyone done anything like this or have any idea how you'd approach it? Thanks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346358 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Committing Line by Line Changes?
Yeah, what Dave said...I'm talking about committing part of a file, not part of a project. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346360 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Committing Line by Line Changes?
Great info, thanks for the fast replies! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346366 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Emailing a file to an application
Fantastic, thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346367 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Concantenate vs Pound Signs within Quotes
Is it merely a stylistic difference between cfset myvar = What do you think of #this#? / and cfset myvar = What do you think of this ? / Or is there a speed advantage to the latter which cancels out any increased readability in the former? Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340345 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Concantenate vs Pound Signs within Quotes
Thanks guys, that's about what I expected. As a stylistic difference, I would not advocate changing existing code to eliminate pound signs, whereas there are those who argue the speed advantage of moving to concantenation only. While I like concantenation, I see no problem with choosing ease of editing/readability sometimes if the speed difference is not perceptable. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:340351 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF Query to WDDX to Javascript. Possible?
It's been a long time since I've done this so this may not be useful, but isn't the returned packet a Javascript array? At least it was when I used to use cfwddx, so it was just a matter of normal array manipulation. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335517 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Extracting part of a string
Does this help? http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:61637 ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335528 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CF Query to WDDX to Javascript. Possible?
Sorry, meant as per John's suggestion cfwddx action = wddx2js, not the packet itself. No, WDDX is XML, not Javascript; it always has been. -- WSS4CF - WS-Security framework for CF http://wss4cf.riaforge.org/ On 20 July 2010 21:13, Shannon Rhodes shan...@rhodesedge.com wrote: It's been a long time since I've done this so this may not be useful, but isn't the returned packet a Javascript array? At least it was when I used to use cfwddx, so it was just a matter of normal array manipulation ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335537 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Need Advice on Processing After a Page Has Been Rendered
Ajax? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335466 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: CFSTOREDPROD question
Not sure if I'm understanding the question, but any cursors in your stored procedure would be a return type, i.e. you wouldn't be looping over it within the proc (unless it was looped/closed for related business logic). By the time you call the proc from CF, CF is just saving the result set for you, and then you have to do something else to loop over the result set. cfstoredprod doesn't have to close a cursor because it doesn't open one or loop over one. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335405 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Turning off try/catch
Just to follow up... -Mark, thanks for the LogBox info, I checked it out and it says it requires Railo and Open BlueDragon, so it's not for us but might work great for someone else. -Brad, thanks for letting me know about the exception info you were seeing in debugging. I don't see this, but I've sent a request to have them turn on enable robust exception info, under the assumption that it's off on dev and the reason why I'm not getting all the great info you're seeing in your debugging (guessing, but that would be great!), since we're on the same server version as you. -Andrew, thanks much for the big picture approach! You are correct, this is a larger question than my I wanna see my hard errors on dev problem. Your solution is by far the most robust, and well worth the time given that it would improve the architecture of all of our applications for both production and development purposes. I think my initial reaction was egad, I barely have enough time for this project as it is, I don't want to open this whole can of worms about exception handling generally. But, that doesn't make the solution any less correct! If we give this a little thought, there is good reason to implement several of the different handling options you suggested. To be perfectly honest, I think we tend to be lazy about our error handling; let cferror pick it up, email us the error, and post a standard error message to the user. Indeed, even as a user I can find it confusing that my data wasn't saved but I didn't receive an error message (as is the case where error handling triggers a database transaction rollback but does nothing else). ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335397 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to interpret log files?
About a dozen developers were making all manner of changes. Do the logs tell us nothing? There's no documentation at all on what the log messages mean? At least some kind of list of normal/expected actions? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335346 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Turning off try/catch
Thanks all, taking the global find/replace w/catch handler suggestion. Still...would be a nice admin option! Agreed that it would be awesome to have admin level options for cfdump as well, hint hint CF...considering that so far I haven't found an upgrade in CF9 that changes my work life in the least. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335348 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Oracle Stored Procedure Help
It might be easier for you to troubleshoot this in Toad or some other Oracle editor, to get the stored procedure working correctly before trying to call it from CF. Otherwise, it can be confusing for you as to which end is causing the problem (like sometimes I can verify code in Toad but there's a permissions issue causing it to tank in CF). Having said that, you know this is a problem with the proc, not with the call from CF, so you might want to google some resources for how to write Oracle stored procedures that return cursors. Mine typically have input parameters followed by one output parameter, a cursor, declared like so: PROCEDURE procName( (input params) p_cursorIN OUT CUSTOM_REF_CURSOR ) AS BEGIN OPEN p_cursor FOR (your query here) END procName ; ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335349 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: How to interpret log files?
We are attempting to interpret the event log. Seems like the logs are just a guessing game without documentation. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335350 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
How to interpret log files?
My boss sent us a snapshot of an event log after a 503 error shut down dev, and asked us if anyone could figure out what it meant. I spent some time searching online for some kind of guide to log messages, but I can't find anything at all. At very least, it would be nice to know what kind of log messages are normal/expected so that problem events will jump out a bit more. As far as a common sense reading, it looks like a pretty normal initialization of services, then it gets to No JDBC data sources have been configured for this server. I researched this error and discovered it was benign. The next 9 entries are all user x destroy entries (where x is some kind of servlet). I can't provide an explanation for what this means, though it seems vague enough that perhaps the log files will not be able to tell us why CF needed to be restarted...a shame, because on development, it very well could be a code issue. Thanks for any hints anyone can throw my way! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335297 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Extract an URL Variable name?
I did something like this relatively recently, with the added requirement that both the variable name and the value be encrypted (fun, eh). On top of that, there was a handler page that I had to ensure was continuing to attach all of my url vars to the url for cflocation. I'll give you my code snippets here and hopefully you can mine something useful out of them: Handler page looping through variables to attach url scope to cflocation url: cfset myhomepage = this is my link cfset urlscope = / cfloop collection=#url# item=key cfif decrypt(key,application.EncryptSeed,CFMX_COMPAT, 'Hex') EQ linkfrom!--- var lets me know it's coming from an email; reroute --- cfset myhomepage = different page here /cfif /cfloop !--- append any url variables --- cfloop collection=#url# item=key cfset urlscope = urlscope #key#=#url[key]# / /cfloop cfif len(urlscope) !--- then swap out the first for a ? and append to our link --- cfset urlscope = REReplace(urlscope, , ?) / cfset myhomepage = myhomepage urlscope / /cfif cflocation addtoken=no url=#myhomepage# Then on a given page where I needed to know if an ID had been passed in cfloop collection=#url# item=key cfif decrypt(key,application.EncryptSeed,CFMX_COMPAT, 'Hex') EQ project_id cfset request.project_id = decrypt(url[key],application.EncryptSeed,CFMX_COMPAT, 'Hex') / /cfif /cfloop If I'm passing an URL Variable - with the variable name itself being dynamic, what's the best was to extract the variable name (not the value) on the receiving page? As in: for: index.cfm?somevar=somevalue I need to return somevar on the receiving page as a value. or for: index.cfm?bigdog=bruto I need to return bigdog on the receiving page as a value. The receiving page won't know what the variable is in advance... Did that make any sense at all? __ Information from ESET NOD32 Antivirus, version of virus signature database 5263 (20100708) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335298 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Turning off try/catch
Thanks all, great suggestions. I especially like the find/replace option, since I don't have access to the administrator and log files here. Andrew, this is a dev site that I fully expect to error dozens of times, my main task being clean-up. It costs time and aggravation when these errors are handled so I have to detect the issue as a logical error rather than as a hard error. This is a new site based on an old site where about half the object references are now directed to a new schema, resulting in database errors. So yes, this is an example of a situation where hard errors to the screen are more efficient than gracefully degrading errors and having them quietly sent to admin. I heartily endorse proper use of try/catch in production environments, but dev is a different beast. Is there any global way to turn off try/catch handling? I believe I've heard of this for VB but I don't think I've come across it for CF. My issue is that I'm creating a new version of a site based on an existing codebase, and I have to update the schema references and some other cleanup. It's a lot easier to fix a hard error than to notice/track down logical errors (i.e. did the item I just saved not show up because it wasn't saved or because the query to display is wrong). It's clunky to go around commenting out try/catch blocks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335300 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Oracle Stored Procedure Help
I'm not completely clear if you're asking about how to write the proc or how to call the proc. You call the proc via ColdFusion like so: cfstoredproc procedure= datasource= username= password= cfprocparam dbvarname=in_varNameinProc cfsqltype=cf_sql_varchar value=theValue type=in cfprocresult name = whatWoudldHaveBeenNameinCfquery /cfstoredproc Put in the procedure name, prefix the schema name and the package name if applicable. DSN, user, pass, all normal from your cfquery experience. cfprocresult is the same as the name attribute in cfquery, i.e. the name you'll use to reference your result set. cfprocparam, you'll have one of these for each input variable, in order as they appear in the stored proc; the dbvarname is the name in the stored proc, the cfsqltype is the data type, then of course you reference the value you are passing in. If you're also needing to know how to write a stored proc in Oracle, that's probably beyond the scope of this list, but suffice it to say you need to ensure that the proc returns a cursor (result set). You mentioned an issue whenever you have more than one row of data...shot in the dark, but maybe your problem is related to the issue here: http://www.dba-oracle.com/t_pl_sql_plsql_select_into_clause.htm That one was a stickler for me when I moved from SQL Server, which is much more forgiving of these things. Best, Shannon I have never used stored procedures before but have been working on some code where they might be helpful to use with CFSTOREPROC instead of CFQUERY since I am dealing with a ton of records. Can anyone provide an example of a simple stored procedure which will return a set of data with more than 1 row? I got one to work when I am just getting 1 row of data but am getting errors when my stored procedure has more than 1 row. Thanks ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:335316 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Turning off try/catch
Is there any global way to turn off try/catch handling? I believe I've heard of this for VB but I don't think I've come across it for CF. My issue is that I'm creating a new version of a site based on an existing codebase, and I have to update the schema references and some other cleanup. It's a lot easier to fix a hard error than to notice/track down logical errors (i.e. did the item I just saved not show up because it wasn't saved or because the query to display is wrong). It's clunky to go around commenting out try/catch blocks. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334925 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Turning off try/catch
Thanks Eric, I do hope they consider it...like with debugging in general, which can be IP specific in the administrator. I can see many uses for this, and as I mentioned...other languages have acknowledged the usefulness of turning off error handlers for the purposes of development/debugging. My point in this case is that I'm purposely going to introduce tons of database errors and I want to see them so I can correct them (trust me, without getting into the gory details, swatting flies is the best approach here), but the catch blocks throughout the code are handling my errors so I have to dig deeper to see them. Since this is development, it's much more useful to eyeball a hard error and decide on a case by case basis if it needs to be fixed or if it's an example of an error that should be left alone to be handled by a catch block (rare). ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:334937 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Which code reuse method?
snipCustom tag is just that: a bit of code that can be called in a single tag, that's all. Nothing 'overkill' about it to implement for a simple computation. cf_getMyLink relativePath=/path/to/mytemplate.cfm environment=development / seems fairly straightforward./snip I somewhat disagree. The easiest way to deal with a straightforward code snippet that takes no input parameters is a simple cfinclude. I can copy/paste the code directly from the page for which it was originally written, and then done. With a custom tag, there is a tiny bit extra to consider (scope issues are different, handling the lack of an end tag). It's not that it's a big deal, I'm just wondering what the advantage would be. In this case, the advantage may well be simply the need to demonstrate code reuse to other developers who may use includes inappropriately---that is a compelling case. snipIf that is the case, I would recommend making it a custom tag and sticking it in the custom tags folder in the CF admin.That way it is avalible to everyone with out having to deal with mappings and all that./snip I'm unclear here...developers do not have access to the Administrator (only management), so I guess I'd need to make the case that they need to create a custom tags folder for us? ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333644 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Which code reuse method?
I'm probably overthinking this, but I have a really simple snippet of code that I want to make easily available to other developers in-house. It takes no input variables; all it does is figure out the correct link to reporting services based on the server environment (dev/QA/prod). Given the simplicity, should this just be an include? Or at most a UDF (though I fail to see the point there, since you have to include those too, and I'm not taking input parameters). Definitely a custom tag or a cfc seem like overkill. However, my secondary concern is that we do not have a process for sharing code in-house so I could see whatever method I choose turning into a sort of default method of code reuse (even when not appropriate). Also, I'm thinking if I'm really going to approach this properly I need to request a mapping to a folder above the web root rather than simply throwing in a new folder and calling it cfincludes. Mappings always turn into a PITA around here, but I want to do this right. Advice for getting this team moving in the right direction (noting I am not in management here)? Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333573 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Which code reuse method?
Great tips, thanks all! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:333583 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Join on subquery fails from CF
I'm trying to join on a subquery using Oracle 9i; the join is successful if I run it in the Toad editor (even if I take the CF debugging code and run it in Toad), but for some reason I get a table does not exist error if the same query is run from cfquery. I can't even begin to imagine why that would be the case; to my knowledge cfquery just passes the SQL to Oracle. I'm willing to rewrite the query with a workaround, but I can't think of another way to do it. Basically, I have an action table in which an item may have been submitted multiple times before finally being approved. I need to retrieve only the most recent submit date. I need this date both in my SELECT statement and as a WHERE clause filter. I was trying to solve this by joining on a correlated subquery that selected the max date from my action table. Any other ideas for how to achieve this? Thanks! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332870 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Join on subquery fails from CF
So obvious I completely missed it! Thanks to you both...someone switched the dev dsn to point at QA, doh. All is well, thanks much! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:332873 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Best Way to Handle Multiple Related Selects?
Thanks for the suggestions, all. I ended up simply handling it with WDDX and old-fashioned Javascript. I was pretty disappointed that CF's new bind options proved to be a poor solution for more advanced needs, but in this case my lists are of reasonable length so AJAX is probably overkill anyway. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328752 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Best Way to Handle Multiple Related Selects?
Iâm trying to get four related selects to work---basically, you can change any one of the selects and it will reload the other 3 based on your selection. I tried, and abandoned, the cfselect binding approach because I was unhappy with the number of changes I had to make to my CFCs in order to accommodate maintaining a blank âSelectâ¦â at the top of each select box and also pre-selecting options if loaded in edit mode (the changes felt like a hack and rendered the functions un-usable by other pages). So Iâm now trying to use cfajaxproxy, calling a function on change of any select which reloads the other selects for me (creating a separate proxy instance for each and and using a different function for every setCallbackHandler). However, the asynchronous nature of the calls got me in the end: some selects would not reload correctly because the values they are dependent on (i.e. the other selectsâ values) had not changed before being used for another selectâs query. For example, I have CIO chosen in select one, Applications Development in select two, and the third list has the ColdFusion team and the Java team. I change CIO to CFO and now the CFC that queries the options for the third select is looking for all teams that fall under the CFO *and* applications development---no such thing, so no options (whereas what I wanted was all teams under the CFO). I need the directorate level to reload (i.e. the current value goes back to nothing selected) BEFORE I attempt to load the third select. So I thought the solution would involve use of setSyncMode() but this has not solved my problem so far. I had trouble finding usage examples, so possibly thatâs the problem and/or maybe I need to also run setAsyncMode() after my problematic callback function is completed? I canât believe that what Iâm trying to do is so unique. Iâm sure someone out there has an elegant solution to share. Many thanks! ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328610 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Session Variables Erroneously Timing Out
I'm stumped and I hope someone can help me.I have a user login application set up which has been working fine.Now, out of the blue, the session variable I use to test whether the user is logged in seems to be either resetting itself or timing out rapidly.The result is that I can log in and see the main menu, but then when I click any other link I'm getting redirected back to the login page.This used to work fine, so I would assume that maybe it's just me...I did just download a new firewall so who knows.But, I had the same problem about a month ago on another site---same user login code I've been using forever, and testing was infuriating because sometimes it would work and sometimes it wouldn't, or it would work fine for me but not for someone else; in that case, I thought maybe it was an MX thing since I had just upgraded, but the site causing me my current problems is still on 5.0.I did a Google search and I see other people posting similar problems with session variables sometimes timing out for no apparent reason, but no one seemed to post a solution.Any ideas?Thanks! Shannon Rhodes [EMAIL PROTECTED] [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Scheduled Tasks
I have a scheduled task set up to check the database to see if we have any mass mailings pending to go out at that time, then cfmail is used to handle the mailing, and finally the database is updated so the mailing is marked as sent.My question is how do I handle potential problems...I'm not terribly worried about the database going down because the mailing will still be considered unsent and will go out the next time the task is executed.But, suppose the mail server is down, will a try/catch block handle that, even though it's not a programming problem?Will cfmail error if there is a mail server problem, and if so how do you handle a situation where maybe half of your mail went out prior to the server going down?The to emails are read from an uploaded text file so it's not like there's an easy way to flag the database at the point of failure.And what if it's a scheduler error---how would I ever know the emails weren't going out, other than to make sure I always have them cc the sender?Thanks in advance for any advice. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
XML and Quark
I don't know if this is an option for you, but we have several publications that have to go both online and into Quark, and this is solved by maintaining the information in a database then using CF to write out a text file with the appropriate QuarkXpress tags.The desktop publishing person just downloads a text file and flows it into Quark.If that would work, it would be easy to also use CF to write the XML version. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Follow-up: Dynamic Nav and evaluate()
I just want to thank you guys for nudging me in the right direction on this navigation issue.I also thought I'd follow up for the benefit of anyone else building CF navigation. Tom Kitta That is quite complex navigation you got there. Do your navigation links change so much? How about using a database to populate your navigation or XML based menus? You were right, Tom, I switched to a database solution and the logic was MUCH simpler.I guess I originally started out storing everything in arrays because I didn't think I'd be storing a lot of information, I figured the information would change infrequently, and I didn't count on the need to create relationships between the various pieces of information.It made infinitely more sense to have database tables for primary, secondary, and tertiary nav. Barney Boisvert You can pretty much remove all your evaluate() calls and replace with struct references if you're on CFMX.I'm not sure about the scope of all your variables, so I can't give you specific solutions, but here are some ideas to get you started. evaluate(request.arnav#request.subnav#) is the same as this request[arnav#request.subnav#] evaluate(#thissection#[LinkDetail][1]) is the same as this (assuming the variable name stored in 'thissection' is in the 'variables' scope) variables[thissection][linkDetail][1] Wow, you completely blew my mind with this one!I knew that structures/arrays were supposed to be the solution to the evaluate() problem, but I thought that meant having to actually create the structures each time I needed them, which turned out to be impossibly painful at times. When I plugged in your code, it worked like a charm.I didn't realize that all scopes are structures now.This is fantastic, and the code runs much faster. Thanks guys! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Dynamic Nav and evaluate()
I'm building dynamic site navigation and I'm concerned about processing speed.I'm trying to break a bad habit by eliminating my use of evaluate(), but I just can't seem to figure out how to work around it. Here's what I have: *Variables are initialized in globals.cfm, called from application.cfm; among these are a series of two-dimensional arrays for each major section (primary nav) of the site.These arrays contain the primary section's sub-navigation, i.e. the absolute link and the display label.I also have a separate array which keeps track of which directories should be considered part of which section.Another array defines the primary (left) nav links/labels.The _javascript_ text is also created, for the rollovers. *In application.cfm, I figure out the directory I'm currently in, and then figure out which section that directory belongs to.Then I set any variables specific to that section (for example, META tags). *I build the left-nav by looping through my primary nav array, checking each time to see if the current index is the section that I'm currently in (so I know whether or not to loop through the sub-nav). *The sub-nav is where I get stuck.I have to use a dynamic variable to figure out which array to call based on the section I'm in (Request.ARNav Request.SubNav).Next thing you know, I'm using evaluate() like crazy: CFLOOP INDEX=LinkDetail FROM=1 TO=#ArrayLen(evaluate(Request.ARNav#Request.SubNav#))# cfif cgi.script_name does not contain '#evaluate(#ThisSection#[LinkDetail][1])#' a href=""> #evaluate(#ThisSection#[LinkDetail][2])#/a cfelse ##8594; #evaluate(#ThisSection#[LinkDetail][2])# /cfif /CFLOOP It works, but it's ugly and I haven't tested download time yet (it's fine on my dsl but who knows on dial-up), but I'm really afraid that between this and all the image files for our new design, and all the various sections of my site that depend on dynamic content, I'm going to be looking at a slooow site.I'm starting to think that maybe this is one of those cases where I should have stopped trying to code everything and just created a cfinclude nav file for each separate section of the site with the sub-nav hard-coded in, but then I wouldn't have the luxury of formatting my current page's nav option differently, which provides a nice visual rep of where you are.Any thoughts/advice?Sorry for the long post.Thanks! [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]
Re: trimming question
Yeah, something's up, I'm supposed to be on digest. - Original Message - From: Kunal Pewekar [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Sent: Thursday, September 25, 2003 12:48 PM Subject: Re: trimming question errrhow did i suddenly start getting these email again ? im sure i unregistered long back. and infact stopped getting the email until 1 hour back. any changes made on the server side or soemthing ? Original Message Follows From: [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: CF-Talk [EMAIL PROTECTED] Subject: Re: trimming question Date: Thu, 25 Sep 2003 10:40:33 -0600 (MDT) yes, exactly At 23:57 24/09/2003 -0600, you wrote: what would be the proper way to trim this up? cfset Dealer = #ReReplace(form.Dealer,[^]*,,ALL)# Trim in what sense? Looks like a fairly sound regex to strip markup tags. Are you wanting to control whitespace as well? Gyrus [EMAIL PROTECTED] http://norlonto.net/gyrus/dev PGP key available ~| Purchase from House of Fusion, a Macromedia Authorized Affiliate and support the CF community. http://affiliates.macromedia.com/t.asp?id=2439p=go/dr_text_aff1 Message: http://www.houseoffusion.com/lists.cfm?link=i:4:138452 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Design Structure and cfinclude
I want to thank everyone for your interesting perspectives on this. Definitely I was planning on using external js and css files for the standard stuff, but I was also looking for the flexibility to throw in an individual function or style on a page when they are not likely to be needed elsewhere, so as not to bloat those external files needlessly. Sounds to me like the solution is to dictate such things by section rather than by page. So, here is what I have done, for anyone who is interested: 1. In Application.cfm I test for the existence of my dsn variable and if it is not defined I include my globals.cfm file which initializes all of my universal variables. Then I test to see what section of the site I'm in. I'm using cfset thisDirectory = GetToken(cgi.path_info, 1, /) which I hope works in the long run (I only care about the top level directory), then I loop through a 2-dim array in which the first element is the section title and the second element is a list of the directories that I want to be considered part of that section. When thisDirectory is found in that list, I set Request.SubNav equal to the value of the first element, i.e. the navigational section in which this page belongs. I use cfswitch to include a different file for each section of the site, in which cfparam is used to set a default Request.PageTitle, Request.METADescription, and request.METAKeywords, and a section-specific css and js file name is defined. 2. Each page will carry cfset Request.PageTitle = My Specific Page Title if I Want to Override the Default (optional; I'm not using Verity because, for whatever reason, the collections are constantly going down and the host's response is just to restart every time I complain) cfinclude template=../includes/design/header.cfm (required; would prefer to use mappings rather than a relative link, but when I tried on the test site it brought down CF on my live site!) 3. header.cfm tests to see whether url.print is defined; if so, a print-friendly header is included, otherwise defaultheader.cfm is included (yeah, I guess I could also use a custom tag, I'm thinking about whether it offers a significant advantage) 4. defaultheader.cfm uses #Request.PageTitle# in the title area, plus #Request.METAKeywords# and #Request.METADescription# where appropriate, and includes the css and js files for this section. nav.cfm is included, in which I loop over my navigation based on the value of Request.SubNav (I have a 2-dim array containing url and link title for each sub-section's navigation, as well as one for main level nav. This allows me to pull up the sub-nav for the section I'm in, and pull this section's nav to the top; admittedly, this might be overcomplicating matters a bit when a static nav at this point would probably be just as easy to update). Finally, the image containing the name of the sub-section as the heading for content is called. 5. Lastly, OnRequestEnd.cfm has cfinclude template=includes/design/footer.cfm which tests for url.print and delivers an appropriate footer based on this. The advantage is that I don't have to include a footer on each individual page; the disadvantage is that I can't use cflocation (since it doesn't call OnRequestEnd.cfm). [Naturally, other code snippets are also available for include, such as cfinclude template=../includes/design/BackToTop.cfm which will put a formatted back to top link at the bottom of long pages; too bad there's no way to programmatically figure the length of a page and include it automatically!] The only part I'm still hesitant about is the navigation. I really do wonder if I'm making it more complicated than it needs to be. Thanks everyone! This was my first post and I'm impressed by the friendliness and helpfulness of each of you. ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137796 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Signup for the Fusion Authority news alert and keep up with the latest news in ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Design Structure and cfinclude
We all know that cfinclude is perfect for design headers and footers, but now that I'm actually redesigning my site to take advantage of this, I'm running into some perplexing problems. (Please don't suggest FuseBox, that's way overkill for this site and I don't have the time for it). My initial thought was: set up an Application.cfm and OnRequestEnd.cfm in each major section, which would call a header/footer for that section. I would be able to pass a url variable to request a print-friendly version instead, or to request no display at all (for action only templates). Global variables would be cfparam'ed, and one page title and set of meta tags would be defined per section. Voila, new pages can be content-only without even a cfinclude line---everything would be called by the section's Application.cfm. As I'm getting into this, I'm finding that I don't like the loss of page-specific flexibility. I'm told that dynamically generated meta tags often are missed by search engines, for example, and I don't have a way to override the standard section page title for pages that really ought to have their own title. I'm also stuck with defining all CSS and JS in one long file, even if some style definitions and JS functions are only needed on one page, because I've made the header of my document standardized. Seems to me I'm adding all kinds of unnecessary download time. Plus, my section specific Application.cfm idea kind of forces me to model my directories after my site navigation, when I'd actually prefer to avoid a lot of third level directories and keep pages logically grouped instead (after all, navigation sometimes changes over time anyway, but who wants to move directories around). I think I need a balance between letting CF templates do it all for me, and the tedious work of writing in each page information that is probably the same 80% of the time in a given section. Can anyone suggest a best practices approach to using cfinclude for design elements? Should I hard code in most of the head area of documents, so I can put in page-level titles, meta tags, and page-specific styles JavaScript, followed by a cfinclude containing the remainder of the head with links to the master style sheet, and any design code that will not change, followed by another include for section-specific design images? Any suggestions are appreciated! ~| Message: http://www.houseoffusion.com/lists.cfm?link=i:4:137675 Archives: http://www.houseoffusion.com/lists.cfm?link=t:4 Subscription: http://www.houseoffusion.com/lists.cfm?link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm
Subject: RE: Form question
Here's a tip if you end up considering the option of converting your Word form to HTML. To remove those nasty Office-specific tags, you can download this HTML clean-up: http://office.microsoft.com/downloads/2000/Msohtmf2.aspx Yes, you'll still have a little clean-up because it's still abusing CSS somewhat, but it makes the HTML much more palatable. Of course, if you have Acrobat I'd go with Susan's suggestion about the PDF. Question for Susan: I attempted to do just what you suggested (created an Acrobat form containing a button with the action to submit to a CF page as well as to print). I ended up giving up on the idea because its behavior seemed too erratic. I had to add security so no one could copy or alter the text (legal mumbo jumbo) and with the form secured I could press the submit button all day and nothing was going to happen (though it would still print). If I took off the security, it would sometimes submit but mostly just print. If I took off the print option, it would submit but it wouldn't e-mail the contents as I'd set it up with CFMAIL (same way I've done a million times with HTML forms), and probably related to that was the problem that it would choke if the person didn't include an e-mail address (though it was not a required field and no other field had that problem). Also, when my CF page appeared upon submit, my address bar displayed a path on the c:\ drive (probably to Acrobat Reader) so I don't know if that will cause end user confusion or not. I gave up, thinking this is too crazy, but I'll persevere if you say PDF submissions do in fact work with CF. (I'm not even going to TRY populating the PDF form from the database!!!). Oh, and thanks everybody for your great answers to my question yesterday (just got them on Digest). Shannon Rhodes [EMAIL PROTECTED] SNIP Date: Wed, 01 Aug 2001 15:13:26 -0500 From: Susan Allen [EMAIL PROTECTED] I've done a lot of converting Word docs to .pdf and building the form functionality into the .pdf. You can add a button (and code it NOT to show on the form if it is printed) that will call a .cfm and do whatever: write to the database, etc. You can also fill the .pdf form automatically from a database. Is that too clungy for you? I've used it very successfully for an app that required a lot of mathematical calculations based on a few inputs; the .pdf does all the math, and then the results are written to the db. It takes some time to get the form the way you want, but it looks like the users' paper they were used to, and you can build a good deal of functionality into it via java. -Original Message- From: Tangorre, Mike [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 10:31 AM Well you could save the word doc as HTML, then open the document up and add the HTML for the fields. BE WARNED, Microsoft HTML is nasty to work in... all kinds of crazy things going on. -Original Message- From: Braver, Ben [mailto:[EMAIL PROTECTED]] Sent: Wednesday, August 01, 2001 1:06 PM But I'm being asked to convert an existing paper-style MS Word document to a web form where info can be captured and emailed. My question is: is there a way to overlay form elements onto an existing doc saved as HTML without doing the form over from scratch? Thanks. /SNIP ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Question: Creating a primary key field
Is it possible to query which was the last ID number created (autonumber field in Access) for the purpose of adding 1 to explicitly state the new ID number for a newly created record? The reason why I ask is that I'm having trouble inserting my new info into two separate tables because I need the newly created ID number for table A to be inserted into table B. If I can't guess what the number will be, I'm stuck trying to take the user through a second page where I insert into table A then turn around and query the new record to insert the new field into table B. That leaves me with the problem of what to do if the user abandons the application on the second page, leaving no new record created in table B. This may sound like screwy application design (and maybe it is, I'm still pretty new at this), but the problem is that table A contains contact information, while table B contains all other information (class registration, payment methods, etc), and they have a one-to-one relationship because I may need to change which person the info is associated with (it's possible that a person will register and pay for a class, but a co-worker will attend in their place). I can't make the classID a primary key in table B either (the person could decide to switch classes) so I just have an autonumber as a primary key. Argh! All suggestions welcomed. TIA, Shannon [EMAIL PROTECTED] FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists