request scope in cfc... really so bad?
Thoughts? If CFCs were EJBs, you would have external config info that you would look up using JNDI (or something, I'm not quite up to snuff on J2EE). Let's say I am careful and create well named variables like... request.cfcname.datasource = MyDatasource; request.cfcname.timeout = 300; etc, all in one file called cfcname.cfm that is included in application.cfm. Contract with the developer is you have to include cfcname.cfm in your application.cfm before calling the CFC. Am I such a bad guy? I guess worst case scenario is Macromedia decides not to support it one day, but I haven't heard anything about that. It's just such a pain if there's 10 variables in your app that are required by 10 different CFCs, passing them in as args to the constructor seems awkward. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: request scope in cfc... really so bad?
yep, though I guess my question is really, why not use request scope, rather than how to work around it. There are probably lots of ways to do it without using request scope, but request seems like the least overhead. From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 9:36 AM To: CF-Talk Subject: RE: request scope in cfc... really so bad? Why not make a configuration CFC (basically an encapsulated struct), that you can pass to all the various CFCs?Instantiate that CFC into the application scope, initialize it with the parameters, and then pass that single course-grained view of the configuration data to each individual CFC that needs it. Cheers, barneyb -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 9:29 AM To: CF-Talk Subject: request scope in cfc... really so bad? Thoughts? If CFCs were EJBs, you would have external config info that you would look up using JNDI (or something, I'm not quite up to snuff on J2EE). Let's say I am careful and create well named variables like... request.cfcname.datasource = MyDatasource; request.cfcname.timeout = 300; etc, all in one file called cfcname.cfm that is included in application.cfm. Contract with the developer is you have to include cfcname.cfm in your application.cfm before calling the CFC. Am I such a bad guy? I guess worst case scenario is Macromedia decides not to support it one day, but I haven't heard anything about that. It's just such a pain if there's 10 variables in your app that are required by 10 different CFCs, passing them in as args to the constructor seems awkward. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: request scope in cfc... really so bad?
right, i guess web service is a good example. thanks for all the feedback. From: Kola Oyedeji [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 10:17 AM To: CF-Talk Subject: RE: request scope in cfc... really so bad? Simon Generally its good for your cfc to be well encapsulated such that it doesn't know anything about its environment. This will make it more re-useable. Consider this - what happens if you need to call the cfc as a web service in future you've just lost that flexibility. If you have no plans to do this and you know that these variables will always be available in *every application* you write then its not a problem. But if you plan to re-use it I would pass the variables in, remember you can put them in a structure and pass them into an initialization function using attributesCollection (I think) although you loose the type checking of cfarguement. Hope that helps Kola -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED] Sent: 18 June 2004 17:59 To: CF-Talk Subject: RE: request scope in cfc... really so bad? yep, though I guess my question is really, why not use request scope, rather than how to work around it. There are probably lots of ways to do it without using request scope, but request seems like the least overhead. From: Barney Boisvert [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 9:36 AM To: CF-Talk Subject: RE: request scope in cfc... really so bad? Why not make a configuration CFC (basically an encapsulated struct), that you can pass to all the various CFCs?Instantiate that CFC into the application scope, initialize it with the parameters, and then pass that single course-grained view of the configuration data to each individual CFC that needs it. Cheers, barneyb -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED] Sent: Friday, June 18, 2004 9:29 AM To: CF-Talk Subject: request scope in cfc... really so bad? Thoughts? If CFCs were EJBs, you would have external config info that you would look up using JNDI (or something, I'm not quite up to snuff on J2EE). Let's say I am careful and create well named variables like... request.cfcname.datasource = MyDatasource; request.cfcname.timeout = 300; etc, all in one file called cfcname.cfm that is included in application.cfm. Contract with the developer is you have to include cfcname.cfm in your application.cfm before calling the CFC. Am I such a bad guy? I guess worst case scenario is Macromedia decides not to support it one day, but I haven't heard anything about that. It's just such a pain if there's 10 variables in your app that are required by 10 different CFCs, passing them in as args to the constructor seems awkward. _ [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
RE: request scope in cfc... really so bad?
right,i guess web service is a good example. thanks for all the responses. [Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]
updater2 99% cpu
when I install the updater2 I get a 99% cpu and server hangs on some pages. other pages work. I'm gonna do more testing but was wondering if anyone had similar experience. gonna try reinstalling the connector. apache 1.3.27, rh 7.3, ibm jre 1.3.1 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Get the mailserver that powers this list at http://www.coolfusion.com
RE: updater2 99% cpu
it was hanging on CFQUERY's that were doing inserts. (to oracle 8.1.7) uninstalled it for now. -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED]] Sent: Friday, December 13, 2002 8:56 AM To: CF-Talk Subject: updater2 99% cpu when I install the updater2 I get a 99% cpu and server hangs on some pages. other pages work. I'm gonna do more testing but was wondering if anyone had similar experience. gonna try reinstalling the connector. apache 1.3.27, rh 7.3, ibm jre 1.3.1 ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: IIS or MX Caching Files or some odd thing
yep, since that one instance would be shared by all users of your application. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 4:28 PM To: CF-Talk Subject: RE: IIS or MX Caching Files or some odd thing If I stored a component instance in the application scope: cfobject component = lfcomponents.lfinsert_record name = application.ComponentInstance.lfInsertData Would I need to lock each usage of it? Brook At 03:33 PM 12/5/2002 -0800, you wrote: Can't take credit, it is an old one off the forums. Guess I'm the Milli Vanilli of cf-talk. ;) -Original Message- From: Lee Fuller [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 3:06 PM To: CF-Talk Subject: RE: IIS or MX Caching Files or some odd thing Hey now.. Wait! I posted that many moons ago.. And I was only a life saver. And now you, Simon, are a GOD? NOT FAIR!!! ;) | -Original Message- | From: Rob Rohan [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 3:04 PM | To: CF-Talk | Subject: RE: IIS or MX Caching Files or some odd thing | | | Simon you are a god. | | Thank you | | Rob | | http://treebeard.sourceforge.net | http://ruinworld.sourceforge.net Scientia Est Potentia | | -Original Message- | From: Simon Stanlake [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 2:40 PM | To: CF-Talk | Subject: RE: IIS or MX Caching Files or some odd thing | | | Have you tried turning off 'cacherealpath'? | | it is in cfmx | dir/runtime/servers/default/SERVER-INF/jrun.xml. There is a | line like ... | | attribute name=cacheRealPathtrue/attribute | | change this to false and give er a restart. | | I'm not sure if I understand your symptoms but I had an issue | with Apache/MX and virtual directories getting files mixed | up, and this setting solved it. | | Cheers, | Simon | | -Original Message- | From: Rob Rohan [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 2:30 PM | To: CF-Talk | Subject: IIS or MX Caching Files or some odd thing | | | Hey everyone I need some help, | | I think this is an IIS issues, but am unsure. We are setting | up duel NT/MX boxes with several web sites and it looks like | this (sorry if you're not using a fixed width) | | +===+ | | load bal | | /+===+\ |/ \ | box1+==+box2+==+ | MX | siteAip |MX | siteAip | | IIS | siteBip |IIS | siteBip | | +==++==+ |\/ | \ / | +===+ | | cfm files | | +===+ | | This issues is - if we save a file in site A (fileA.cfm) - | the file shows up for site B as well - sometimes. It is NOT | in the directory for site B. It seems to be cached between | sites some how. Even if I do ip addresses: | http://xxx.xxx.xxx.xxx/fileA.cfm (siteA) http://xxx.xxx.xxx.xxx/fileA.cfm (siteB) that gives the same file - sometimes. But, again it is not in the root of site B. We have checked the mappings in IIS several (thousand) times, and it looks right (mapped to different directories on the cfm files box (non unc)) and the load balancer does no caching (so sayth the salesman). I know this isn't enough information for a lot of help, but I am not allowed to give more. If anyone could suggest anything to check - I would be very appreciative. Thanks in advance, Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
RE: IIS or MX Caching Files or some odd thing
Have you tried turning off 'cacherealpath'? it is in cfmx dir/runtime/servers/default/SERVER-INF/jrun.xml. There is a line like ... attribute name=cacheRealPathtrue/attribute change this to false and give er a restart. I'm not sure if I understand your symptoms but I had an issue with Apache/MX and virtual directories getting files mixed up, and this setting solved it. Cheers, Simon -Original Message- From: Rob Rohan [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 2:30 PM To: CF-Talk Subject: IIS or MX Caching Files or some odd thing Hey everyone I need some help, I think this is an IIS issues, but am unsure. We are setting up duel NT/MX boxes with several web sites and it looks like this (sorry if you're not using a fixed width) +===+ | load bal | /+===+\ / \ box1+==+box2+==+ MX | siteAip |MX | siteAip | IIS | siteBip |IIS | siteBip | +==++==+ \/ \ / +===+ | cfm files | +===+ This issues is - if we save a file in site A (fileA.cfm) - the file shows up for site B as well - sometimes. It is NOT in the directory for site B. It seems to be cached between sites some how. Even if I do ip addresses: http://xxx.xxx.xxx.xxx/fileA.cfm (siteA) http://xxx.xxx.xxx.xxx/fileA.cfm (siteB) that gives the same file - sometimes. But, again it is not in the root of site B. We have checked the mappings in IIS several (thousand) times, and it looks right (mapped to different directories on the cfm files box (non unc)) and the load balancer does no caching (so sayth the salesman). I know this isn't enough information for a lot of help, but I am not allowed to give more. If anyone could suggest anything to check - I would be very appreciative. Thanks in advance, Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting.
RE: IIS or MX Caching Files or some odd thing
Can't take credit, it is an old one off the forums. Guess I'm the Milli Vanilli of cf-talk. ;) -Original Message- From: Lee Fuller [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 05, 2002 3:06 PM To: CF-Talk Subject: RE: IIS or MX Caching Files or some odd thing Hey now.. Wait! I posted that many moons ago.. And I was only a life saver. And now you, Simon, are a GOD? NOT FAIR!!! ;) | -Original Message- | From: Rob Rohan [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 3:04 PM | To: CF-Talk | Subject: RE: IIS or MX Caching Files or some odd thing | | | Simon you are a god. | | Thank you | | Rob | | http://treebeard.sourceforge.net | http://ruinworld.sourceforge.net Scientia Est Potentia | | -Original Message- | From: Simon Stanlake [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 2:40 PM | To: CF-Talk | Subject: RE: IIS or MX Caching Files or some odd thing | | | Have you tried turning off 'cacherealpath'? | | it is in cfmx | dir/runtime/servers/default/SERVER-INF/jrun.xml. There is a | line like ... | | attribute name=cacheRealPathtrue/attribute | | change this to false and give er a restart. | | I'm not sure if I understand your symptoms but I had an issue | with Apache/MX and virtual directories getting files mixed | up, and this setting solved it. | | Cheers, | Simon | | -Original Message- | From: Rob Rohan [mailto:[EMAIL PROTECTED]] | Sent: Thursday, December 05, 2002 2:30 PM | To: CF-Talk | Subject: IIS or MX Caching Files or some odd thing | | | Hey everyone I need some help, | | I think this is an IIS issues, but am unsure. We are setting | up duel NT/MX boxes with several web sites and it looks like | this (sorry if you're not using a fixed width) | | +===+ | | load bal | | /+===+\ |/ \ | box1+==+box2+==+ | MX | siteAip |MX | siteAip | | IIS | siteBip |IIS | siteBip | | +==++==+ |\/ | \ / | +===+ | | cfm files | | +===+ | | This issues is - if we save a file in site A (fileA.cfm) - | the file shows up for site B as well - sometimes. It is NOT | in the directory for site B. It seems to be cached between | sites some how. Even if I do ip addresses: | http://xxx.xxx.xxx.xxx/fileA.cfm (siteA) http://xxx.xxx.xxx.xxx/fileA.cfm (siteB) that gives the same file - sometimes. But, again it is not in the root of site B. We have checked the mappings in IIS several (thousand) times, and it looks right (mapped to different directories on the cfm files box (non unc)) and the load balancer does no caching (so sayth the salesman). I know this isn't enough information for a lot of help, but I am not allowed to give more. If anyone could suggest anything to check - I would be very appreciative. Thanks in advance, Rob http://treebeard.sourceforge.net http://ruinworld.sourceforge.net Scientia Est Potentia ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
RE: Shall I start Pulling my Hair
on oracle test works cfquery name=test datasource=ds select name as thisisthefieldname1 from tbl_fields where fieldid = 12 /cfquery cfoutput #test.thisisthefieldname1# /cfoutput returns the correct value. cfdump shows one column called 'thisisthefieldname1'. I would check the JDBC implementation to see if alias of more than 12 characters is supported. good luck, simon -Original Message- From: Shahzad.Butt [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 03, 2002 8:00 AM To: CF-Talk Subject: RE: Shall I start Pulling my Hair ID is varchar.. It goes to IF and gives error on DETAILFIELD1. Just make simple query with alias of more than 10 chars and test. -Original Message- From: Randell B Adkins [mailto:[EMAIL PROTECTED]] Sent: 03 December 2002 15:49 To: CF-Talk Subject: Re: Shall I start Pulling my Hair First check to see if the field ID is a numeric or TEXT field. if it is Numeric then the WHERE line should be: WHERE ID = 12 not '12' Single Quotes are not used in numeric fields. Then I would also change the output line to read: CFIF myQuery.recordcount gt 0 cfoutput#myQuery.Detailfield1# cfelse NO RECORDS /CFIF [EMAIL PROTECTED] 12/03/02 10:23AM Whats wrong with this simple code CFQuery Name=myQuery Datasource=Test Select J_Sname.AccountNumber AS DetailField1 From J_Sname Where ID = '12' /CFQuery CFOutput #myQuery.DetailField1# /CFOutput It gives error 'Element DETAILFIELD1 is undefined in myQuery. ' But if I use DETAILFIE1 (or anyother letter not more than 10 characters) instead of DETAILFIELD1 it works. As I pop in 11th character for my alias it gives error. Is there any limit of characters in AS inside query in CFMX? Application Server: Coldfusion MX DB: SQLServer 2000 Shahzad Butt (Development Engineer) JJ FastFood Distribution Ltd. Office: +44 (0) 1992 701 722 Mobile: +44 (0) 7803 584 873 Fax: +44 (0) 1992 701 604 7 Solar Way, Innova Park, Enfield, London, EN3 7XY ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
sessionquery.recordcount
hi, we have the following code... cfquery name=session.myResults datasource=#request.ds# select * fromtheTable /cfquery !--- create an array of 1's to use in queryAddColumn --- cfset defaultValueArray = ArrayNew(1) cfloop index=i from=1 to=#session.myResults.recordCount# cfset defaultValueArray[i] = 1 /cfloop occasionally, we exit this piece of code and the length of the array is different from the length of the query. ie: arraylen(defaultValueArray) != session.myResults.recordCount. It seems to me that this should never happen. I've changed the name of the table and the session variable, but otherwise the code is a cut-and-paste. I realize there are a bunch of different ways to do this, but I want to know what causes this behaviour. Has anyone else seen something similar? recordcount not always returning the right value? cfloop bailing out early? funniness when storing queries in the session scope? thanks, simon ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm
RE: sessionquery.recordcount
well, we want to add a column called 'selected' using addQueryColumn. the best way to do this (would probably be faster too) would be to go cfquery name=session.myResults datasource=#request.ds# select theTable.*, 1 as selected from theTable /cfquery I will probably end up doing this, just wanted to figure out what was going on. thanks, simon -Original Message- From: Timothy Heald [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 10:12 AM To: CF-Talk Subject: RE: sessionquery.recordcount The only time I have gotten a record count higher than I thought it should be was when I was using aggregate functions. So I would get 1, even if there was really nothing returned (because the result was a 0). Aside from that, what are you doing that requires this? Maybe we could figure out a better way of doing it? Tim -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 1:04 PM To: CF-Talk Subject: sessionquery.recordcount hi, we have the following code... cfquery name=session.myResults datasource=#request.ds# select * fromtheTable /cfquery !--- create an array of 1's to use in queryAddColumn --- cfset defaultValueArray = ArrayNew(1) cfloop index=i from=1 to=#session.myResults.recordCount# cfset defaultValueArray[i] = 1 /cfloop occasionally, we exit this piece of code and the length of the array is different from the length of the query. ie: arraylen(defaultValueArray) != session.myResults.recordCount. It seems to me that this should never happen. I've changed the name of the table and the session variable, but otherwise the code is a cut-and-paste. I realize there are a bunch of different ways to do this, but I want to know what causes this behaviour. Has anyone else seen something similar? recordcount not always returning the right value? cfloop bailing out early? funniness when storing queries in the session scope? thanks, simon ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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
RE: sessionquery.recordcount
I should clarify, I'm getting a lower record count than I expect. ie: querylen=5000, arraylen=1537 (or something). thanks for the replies, simon -Original Message- From: Timothy Heald [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 10:12 AM To: CF-Talk Subject: RE: sessionquery.recordcount The only time I have gotten a record count higher than I thought it should be was when I was using aggregate functions. So I would get 1, even if there was really nothing returned (because the result was a 0). Aside from that, what are you doing that requires this? Maybe we could figure out a better way of doing it? Tim -Original Message- From: Simon Stanlake [mailto:[EMAIL PROTECTED]] Sent: Wednesday, November 27, 2002 1:04 PM To: CF-Talk Subject: sessionquery.recordcount hi, we have the following code... cfquery name=session.myResults datasource=#request.ds# select * fromtheTable /cfquery !--- create an array of 1's to use in queryAddColumn --- cfset defaultValueArray = ArrayNew(1) cfloop index=i from=1 to=#session.myResults.recordCount# cfset defaultValueArray[i] = 1 /cfloop occasionally, we exit this piece of code and the length of the array is different from the length of the query. ie: arraylen(defaultValueArray) != session.myResults.recordCount. It seems to me that this should never happen. I've changed the name of the table and the session variable, but otherwise the code is a cut-and-paste. I realize there are a bunch of different ways to do this, but I want to know what causes this behaviour. Has anyone else seen something similar? recordcount not always returning the right value? cfloop bailing out early? funniness when storing queries in the session scope? thanks, simon ~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribeforumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq 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