Re: Well - I feel like an idiot.
change anything... Also reads and writes to application variables should be locked so the outer CFIF is not necessarily a good idea. The outer CFIF is necessary so that once initialization is over, subsequent requests won't even try to obtain a lock. Otherwise, every request will try to obtain a lock. By the way, this is a familiar idiom in java called double-checked locking. I'm glad it works in CF, because it may fail in java. See http://www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html = I-Lin Kuo Macromedia CF5 Advanced Developer Sun Certified Java 2 Programmer __ Do you Yahoo!? The all-new My Yahoo! - Get yours free! http://my.yahoo.com ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189048 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: OT: query optimization
Paul Malan wrote: That is a huge improvement! The execution time is lower than 10 seconds now - that's amazing. I think that is still rather long. Can you update the execution plan and index pages if you need it to go even faster? For clarification, when I set up the index all I did was give it a name and tell it which column to index, then pressed OK. Nothing more to it? Do I need to do anything to tell the db to create the index, or does it just do that when I name it? That should be enough. Did you do that for the tick, ordr and ordl tables or just for one? Jochem ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189049 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: QofQ: SELECT DISTINCT
Hi Ryan. That custom tag is no help as I need to DISTINCT on three columns. As a work around for the moment, I'm creating a table in the mySQL datasource and then populating it, doing the select and then deleting the table and it is about 100 times (really) quicker. The QofQ takes about 2 seconds and the work around takes about 0.02 seconds, which just seems silly as it is doing so much more work. Andrew. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189050 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Coldfusion IIS behind firewall
Hi CF-Talkers! I havea little problem here , hope someone can help me. I have two sites in IIS configured with one Coldfusion MX server. both sites are named site1.myhost.xx and site2.myhost.xx and are viewable from the local network working perfectly.! Well i tried to put one of them online ( internet viewable ) settings some parameters on my firewall and DNS. The problem : I can see only the site1.myhost.xx itself with and index.cfm behind scene but if i call it directly or call another file like http://site1.myhost.xx/index.cfm , i get an error 404 i have set only the port 80 open for internet connections.. Coldfusion uses another one?.. What' going on here?.. anyone can help me?.. please! Happy New Year ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189051 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: QofQ: SELECT DISTINCT
Andrew, How does the query you're querying get created in the first place? Is there a way to 'clean' it further 'up' the chain? -Joe On Fri, 31 Dec 2004 12:20:28 +, Andrew Dixon [EMAIL PROTECTED] wrote: Hi Ryan. That custom tag is no help as I need to DISTINCT on three columns. As a work around for the moment, I'm creating a table in the mySQL datasource and then populating it, doing the select and then deleting the table and it is about 100 times (really) quicker. The QofQ takes about 2 seconds and the work around takes about 0.02 seconds, which just seems silly as it is doing so much more work. Andrew. ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189052 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
I'm just gonna throw this out there. Would this be better?: cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock Person 1 comes in, Application.init is not defined, so they start initting the app. Person 2 comes in, and waits for the lock. Person 1 inits the app and releases the lock Person 2 gets the lock, sees it is already defined, and is all set I can understand why your fix worked, however I think the above code will accomplish the same thing. As someone else said, you'll grab the lock every time, but I believe that will be negligible in all cases except the one where the app is actually be initialized. At 04:01 AM 12/31/2004, you wrote: Subject: Well - I feel like an idiot. From: Jim Davis [EMAIL PROTECTED] Date: Fri, 31 Dec 2004 00:00:41 -0500 Thread: http://www.houseoffusion.com/cf_lists/index.cfm/method=messagesthreadid=37377forumid=4#189043 I've been having trouble with my application starting up under load. Couldn't figure it out. Once it got going the application purred like a contented cat, but the start up was another matter. Under even moderate load the app would kill JRun. Not good. Finally figured it - and I'm a dumb ass. I have code like this in the system to handle start up tasks (which might take as long as 10 seconds to complete): cfif NOT IsDefined(Application.Init) cflock name=InitApplication timeout=30 throwontimeout=yes ... long init process ... cfset Application.Init = true / /cflock /cfif See the problem? I didn't. Of course (like most things this works in development fine - but under load the first thread will begin the process and ALL the other active threads will queue up waiting to START IT AGAIN! Damn I'm dumb. The following code stops this from happening. Check the marker, then wait for the lock - but then CHECK THE MARKER again to make sure you have to do it! cfif NOT IsDefined(Application.Init) cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock /cfif Completely eliminated all my start up issues. I suppose I could just get rid of the outer CFIF but then I'd be setting the lock on every page - I've a gut feeling that's heavier than just doing the CFIF. Jim Davis -- Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Books: http://www.instantcoldfusion.com My Recording Studio: http://www.fcfstudios.com My Energetic Acoustic Rock Band: http://www.farcryfly.com -- When did Reality Become TV ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189053 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Jeffry Houser [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 8:48 AM To: CF-Talk Subject: Re: Well - I feel like an idiot. I'm just gonna throw this out there. Would this be better?: cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock Yeah - that's actually what I said in my original post. It would definitely work but I'm guessing (nothing more that that) that checking the variable is lighter than obtaining the lock THEN checking the variable. Since this code is in Application.CFM I want it to be run on the first request then ignored as quickly as possible by all requests. Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189055 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
Humbly, I was wrong on the locks on application variables.. thats information to file for later, thanks. But I can't see how both CFIFs are necessary... The outer cfif will likely never affect anything. If two people hit the site, one request behind another, they'll both fire all the way up to the cflock at the same speed, and as we all know, that's where the magic comes in.. cflock single threads on the init process and one is done before the other.. The outer cfif will not catch anything that the inner cfif does not. I do wonder if it might be smarter to set application.init to SOMETHING before the init process inside the cflock... but I doubt that would change anything either. This is funny, we're arguing tiny fractions of time here.. On Fri, 31 Dec 2004 08:48:06 -0500, Jeffry Houser [EMAIL PROTECTED] wrote: I'm just gonna throw this out there. Would this be better?: cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock Person 1 comes in, Application.init is not defined, so they start initting the app. Person 2 comes in, and waits for the lock. Person 1 inits the app and releases the lock Person 2 gets the lock, sees it is already defined, and is all set I can understand why your fix worked, however I think the above code will accomplish the same thing. As someone else said, you'll grab the lock every time, but I believe that will be negligible in all cases except the one where the app is actually be initialized. At 04:01 AM 12/31/2004, you wrote: Subject: Well - I feel like an idiot. From: Jim Davis [EMAIL PROTECTED] Date: Fri, 31 Dec 2004 00:00:41 -0500 Thread: http://www.houseoffusion.com/cf_lists/index.cfm/method=messagesthreadid=37377forumid=4#189043 I've been having trouble with my application starting up under load. Couldn't figure it out. Once it got going the application purred like a contented cat, but the start up was another matter. Under even moderate load the app would kill JRun. Not good. Finally figured it - and I'm a dumb ass. I have code like this in the system to handle start up tasks (which might take as long as 10 seconds to complete): cfif NOT IsDefined(Application.Init) cflock name=InitApplication timeout=30 throwontimeout=yes ... long init process ... cfset Application.Init = true / /cflock /cfif See the problem? I didn't. Of course (like most things this works in development fine - but under load the first thread will begin the process and ALL the other active threads will queue up waiting to START IT AGAIN! Damn I'm dumb. The following code stops this from happening. Check the marker, then wait for the lock - but then CHECK THE MARKER again to make sure you have to do it! cfif NOT IsDefined(Application.Init) cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock /cfif Completely eliminated all my start up issues. I suppose I could just get rid of the outer CFIF but then I'd be setting the lock on every page - I've a gut feeling that's heavier than just doing the CFIF. Jim Davis -- Jeffry Houser, Web Developer, Writer, Songwriter, Recording Engineer AIM: Reboog711 | Phone: 1-203-379-0773 -- My Books: http://www.instantcoldfusion.com My Recording Studio: http://www.fcfstudios.com My Energetic Acoustic Rock Band: http://www.farcryfly.com -- When did Reality Become TV ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189054 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Tony Hicks [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 9:38 AM To: CF-Talk Subject: Re: Well - I feel like an idiot. Humbly, I was wrong on the locks on application variables.. thats information to file for later, thanks. No need to be humble about it. The pre-MX locking implementation was perhaps the biggest gaff in the history of CF and is still one of the most confusing things. Let's just all be happy that they fixed it in MX. ;^) But I can't see how both CFIFs are necessary... The outer cfif will likely never affect anything. If two people hit the site, one request behind another, they'll both fire all the way up to the cflock at the same speed, and as we all know, that's where the magic comes in.. cflock single threads on the init process and one is done before the other.. The outer cfif will not catch anything that the inner cfif does not. It will catch everybody AFTER this process is complete. You're absolutely right about the behavior while the initialization is running - but after it's done the outer CFIF means that all visitors simply check the status and move on rather than obtain a lock and THEN check the status. I may not have been clear, but this code is in Application.CFM - which means its run by every request. Because it's so central I want this code to run as fast as possible. I do wonder if it might be smarter to set application.init to SOMETHING before the init process inside the cflock... but I doubt that would change anything either. I considered it, but I didn't see any benefit to the init process. That process, itself, doesn't have to be as optimized (it's only run once... now). It's getting past it when it has been run that needs to be optimized. This is funny, we're arguing tiny fractions of time here. Tiny fractions of fractions to be sure! But isn't that what optimization is all about. ;^) This code, as an aside, is on a site that gets lots of traffic in short (two day) burst. In case the little optimizations do actually pay off. Jim Davis ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189056 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: OT: query optimization
I think that is still rather long. Can you update the execution plan and index pages if you need it to go even faster? You're right, it is still too long. And it turns out it's taking about 15 seconds on average, even slower than I thought. I updated the execution plan scrshot and the indexes as well. (I did add the index to all three applicable tables.) The link again is http:www.redmondinc.com/sos/index.html I had never seen your technique of using what looks like a subquery in the join segment of a query - I'm guessing further optimization is available using another one of those? In fact when I learn how to do that I bet I can apply similar tricks to most of my reports and really speed things up all across the app. The funny thing is, our company is so new to modern technology, people were buying me drinks just for getting them the data, even when hung the db server for 90 seconds. Maybe if I really get things humming they'll buy me a new car or something... (I have 2 sql books en route, by the way... I'm not a slacker, I'm doin' the work. I'm babystepping.) Thanks again for your time and advice. -Paul ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189057 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: OT: query optimization
Paul Malan wrote: You're right, it is still too long. And it turns out it's taking about 15 seconds on average, even slower than I thought. I updated the execution plan scrshot and the indexes as well. (I did add the index to all three applicable tables.) The link again is http:www.redmondinc.com/sos/index.html The costliest step is still the final aggregation in order to perform the DISTINCT. I'm afraid I can't see enough details in the graphical execution plans to see what is really going on there. (Which join type is hidden behind the popup?) I had never seen your technique of using what looks like a subquery in the join segment of a query - I'm guessing further optimization is available using another one of those? If that actually eliminates rows early in the process it can help a lot. Can you give me the recordcount of the following queries: SELECT DISTINCT proj_code, cust_job_num, cust_code, order_code FROM ordr; SELECT DISTINCT tkt_code, tkt_date, truck_code, po, truck_net_wgt, hler_code, order_code FROM tick; SELECT DISTINCT prod_descr, order_code FROM ordl; (We don't need the same query for the truc table since truc.truck_code is the primary key and hence by definition unique.) Jochem ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189058 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Extract year from date field
How do I extract the year from a date field such as 2005-10-12? I'm using datepart in the Query as: datepart(yy,report_date), but when I try to output it as: cfoutput query=populatedropdown #datepart(, populatedropdown.report_date)# /cfoutput it gives an form field not found error. Here is the query: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery Thank you. Robert O. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189059 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extract year from date field
Robert Orlini wrote: How do I extract the year from a date field such as 2005-10-12? I'm using datepart in the Query as: datepart(yy,report_date), but when I try to output it as: cfoutput query=populatedropdown #datepart(, populatedropdown.report_date)# /cfoutput it gives an form field not found error. Here is the query: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery This query only returns months, so how can you extract a year from that? Jochem ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189060 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: QofQ: SELECT DISTINCT
Hi, I agree with Joe, try doing the query as a stored procedure if applicable. Also if it is still a long running stored procedure check out the indexing of the query. HTH, Anticlue On Fri, 31 Dec 2004 08:41:56 -0500, Joe Rinehart [EMAIL PROTECTED] wrote: Andrew, How does the query you're querying get created in the first place? Is there a way to 'clean' it further 'up' the chain? -Joe On Fri, 31 Dec 2004 12:20:28 +, Andrew Dixon [EMAIL PROTECTED] wrote: Hi Ryan. That custom tag is no help as I need to DISTINCT on three columns. As a work around for the moment, I'm creating a table in the mySQL datasource and then populating it, doing the select and then deleting the table and it is about 100 times (really) quicker. The QofQ takes about 2 seconds and the work around takes about 0.02 seconds, which just seems silly as it is doing so much more work. Andrew. ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189061 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extract year from date field
Thanks Jochem. How would I extract the year from 2005-10-12 please? -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 10:47 AM To: CF-Talk Subject: Re: Extract year from date field Robert Orlini wrote: How do I extract the year from a date field such as 2005-10-12? I'm using datepart in the Query as: datepart(yy,report_date), but when I try to output it as: cfoutput query=populatedropdown #datepart(, populatedropdown.report_date)# /cfoutput it gives an form field not found error. Here is the query: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery This query only returns months, so how can you extract a year from that? Jochem ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189062 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extract year from date field
dateformat(variable, '') That should do the trick. --Ben Robert Orlini wrote: Thanks Jochem. How would I extract the year from 2005-10-12 please? ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189063 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extract year from date field
Robert Orlini wrote: Thanks Jochem. How would I extract the year from 2005-10-12 please? Year(). Jochem ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189064 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extract year from date field
In cf?? Year(date) Pascal -Original Message- From: Robert Orlini [mailto:[EMAIL PROTECTED] Sent: 31 December 2004 16:57 To: CF-Talk Subject: RE: Extract year from date field Thanks Jochem. How would I extract the year from 2005-10-12 please? -Original Message- From: Jochem van Dieten [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 10:47 AM To: CF-Talk Subject: Re: Extract year from date field Robert Orlini wrote: How do I extract the year from a date field such as 2005-10-12? I'm using datepart in the Query as: datepart(yy,report_date), but when I try to output it as: cfoutput query=populatedropdown #datepart(, populatedropdown.report_date)# /cfoutput it gives an form field not found error. Here is the query: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery This query only returns months, so how can you extract a year from that? Jochem ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189065 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Possible to pass formatting to Excel from CF?
I have a conference registration page that stores data in a semi-colon delimited .txt file. I have a .cfm file that lets the user dump this out into Excel form using cfcontent and cfheader and cfoutput query. It opens in Excel (not Excel inside Explorer) and prompts the user to open or save as attendees.xls. It works very slick, and I am not having any problems running it. I would like to be able to pass Excel formatting to the new Excel file such as 'Freeze Panes', 'Sort', etcbasically trying to make it as dummy-proof as possible. Is this possible? Here's my code template: html head titleAttendees/title InvalidTag http-equiv=Content-Type content=text/html; charset=iso-8859-1 STYLE type=text/css BODY {background-image: url(../../images/picture.gif); background-attachment:fixed} /STYLE /head CFCONTENT TYPE=application/msexcel CFHEADER NAME=Content-Disposition VALUE=attachment; filename=attendees.xls body bgcolor=#CC CFHTTP Method=get url=http://..filename.txt; name=CurrentRegistered delimiter=; textqualifier= TABLE border=1 bgcolor=#FF THEAD TR THheader_1/TH THheader_2/TH . . . THheader_n/TH /TR /THEAD TBODY CFOUTPUT query=CurrentRegistered TR TD#data_1#/TD TD#data_2#/TD . . . TD#data_n#/TD /TR /CFOUTPUT /TBODY /TABLE /body /html I can affect the background color and cell borders inside the table settings, but is there a way to pass more dynamic features? (ie: freezing the header row) ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189066 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Possible to pass formatting to Excel from CF?
Hi, Dave Ross did a great job explaining how to exploit POI which basically allows you to create your own excel sheet. Check out http://www.d-ross.org/index.cfm?objectid=9C65ECEC-508B-E116-6F8A9F878188D7CA HTH, Anticlue http://www.anticlue.net On Fri, 31 Dec 2004 11:37:28 -0400, Dale Thelen [EMAIL PROTECTED] wrote: I have a conference registration page that stores data in a semi-colon delimited .txt file. I have a .cfm file that lets the user dump this out into Excel form using cfcontent and cfheader and cfoutput query. It opens in Excel (not Excel inside Explorer) and prompts the user to open or save as attendees.xls. It works very slick, and I am not having any problems running it. I would like to be able to pass Excel formatting to the new Excel file such as 'Freeze Panes', 'Sort', etcbasically trying to make it as dummy-proof as possible. Is this possible? Here's my code template: html head titleAttendees/title InvalidTag http-equiv=Content-Type content=text/html; charset=iso-8859-1 STYLE type=text/css BODY {background-image: url(../../images/picture.gif); background-attachment:fixed} /STYLE /head CFCONTENT TYPE=application/msexcel CFHEADER NAME=Content-Disposition VALUE=attachment; filename=attendees.xls body bgcolor=#CC CFHTTP Method=get url=http://..filename.txt; name=CurrentRegistered delimiter=; textqualifier= TABLE border=1 bgcolor=#FF THEAD TR THheader_1/TH THheader_2/TH . . . THheader_n/TH /TR /THEAD TBODY CFOUTPUT query=CurrentRegistered TR TD#data_1#/TD TD#data_2#/TD . . . TD#data_n#/TD /TR /CFOUTPUT /TBODY /TABLE /body /html I can affect the background color and cell borders inside the table settings, but is there a way to pass more dynamic features? (ie: freezing the header row) ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189067 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
I understand completely what your saying, just had a different view on it, that's all. Two cfifs don't hurt anything really... I just try to avoid them whenever possible.. I mean its possible to let cf do the deciding in some cases without using CFIF/CFSWITCH/*shudder* IIF. Wanna see? You were clear on the application.cfm bit. Happy New Year folks On Fri, 31 Dec 2004 10:03:24 -0500, Jim Davis [EMAIL PROTECTED] wrote: -Original Message- From: Tony Hicks [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 9:38 AM To: CF-Talk Subject: Re: Well - I feel like an idiot. Humbly, I was wrong on the locks on application variables.. thats information to file for later, thanks. No need to be humble about it. The pre-MX locking implementation was perhaps the biggest gaff in the history of CF and is still one of the most confusing things. Let's just all be happy that they fixed it in MX. ;^) But I can't see how both CFIFs are necessary... The outer cfif will likely never affect anything. If two people hit the site, one request behind another, they'll both fire all the way up to the cflock at the same speed, and as we all know, that's where the magic comes in.. cflock single threads on the init process and one is done before the other.. The outer cfif will not catch anything that the inner cfif does not. It will catch everybody AFTER this process is complete. You're absolutely right about the behavior while the initialization is running - but after it's done the outer CFIF means that all visitors simply check the status and move on rather than obtain a lock and THEN check the status. I may not have been clear, but this code is in Application.CFM - which means its run by every request. Because it's so central I want this code to run as fast as possible. I do wonder if it might be smarter to set application.init to SOMETHING before the init process inside the cflock... but I doubt that would change anything either. I considered it, but I didn't see any benefit to the init process. That process, itself, doesn't have to be as optimized (it's only run once... now). It's getting past it when it has been run that needs to be optimized. This is funny, we're arguing tiny fractions of time here. Tiny fractions of fractions to be sure! But isn't that what optimization is all about. ;^) This code, as an aside, is on a site that gets lots of traffic in short (two day) burst. In case the little optimizations do actually pay off. Jim Davis ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189068 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
On Fri, 31 Dec 2004 08:48:06 -0500, Jeffry Houser [EMAIL PROTECTED] wrote: I'm just gonna throw this out there. Would this be better?: No, it wouldn't. You would cause every single request to the server to be single threaded at this point: cflock name=InitApplication timeout=30 throwontimeout=yes cfif NOT IsDefined(Application.Init) ... long init process ... cfset Application.Init = true / /cfif /cflock Under load, this creates a bottleneck. The double checked lock is the correct approach: if not inited lock if not inited do init /if /lock /if The most common case in terms of execution is with the app already inited so you need to ensure that does not lock. The startup case just needs to be thread-safe (since that's when you're modifying application scope data). -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 6 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189069 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extract year from date field
On Fri, 31 Dec 2004 10:43:43 -0500, Robert Orlini [EMAIL PROTECTED] wrote: How do I extract the year from a date field such as 2005-10-12? cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery You need to change your query so returns years as well as months - otherwise there is no year to extract later on: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month, datepart(yy,report_date) as year from report where datepart(yy,report_date) = '2005' /cfquery Then you can refer to populatedropdown.year. Mind you, if your query really does just search by year like that, you *know* what the year is since you specified it in the query! -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 6 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189070 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Array issue
I have an array that I am using in a security table. The system does a query for a UserID in a table and returns all of the modules that the user has access to. The ModuleID is simply the Autonumber in an access table. The array builds fine. Using the following code below this is what I get and where the error is... CODE cfoutputContents: #ArrayToList(session.moduleaccess)#/cfoutput RETURNED Contents: 1,7,10,14,13 CODE cfif ArrayToList(session.moduleaccess) CONTAINS 3TRUEcfelseFALSE/cfif RETURNED TRUE The error in this is that I need to see of the user has access to module 3. He/She does not, but since they have access to module 13 the system sees it has having a 3. How do I check to see if an array contains a 3? -Original Message- From: CF-Talk [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 6:01 AM To: CF-Talk Subject: CF-Talk: Digest every 8 hours CF-Talk 31-Dec-04 Issue:1443 In this issue: CF+XPath cfapplication/clientvariable Error after Upgrade to MX 6.1 cfapplication/clientvariable Error after Upgrade to MX 6.1 CFC encapsulation CFC encapsulation CFC encapsulation My Init() in my CFC...am I on the right track? OT: query optimization OT: query optimization OT: query optimization OT: query optimization OT: query optimization OT: query optimization QofQ: SELECT DISTINCT QofQ: SELECT DISTINCT QofQ: SELECT DISTINCT query optimization shopping cart, session variables - best practices shopping cart, session variables - best practices Upgraded CF5 to CFMX - applications not working Upgraded CF5 to CFMX - applications not working Webservice output in browser Webservice output in browser Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189071 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Array issue
You need to use the ListFind() function. CONTAINS, or ListContains() can get you in trouble. ;-) You might also check CFLib.org for an ArrayFind() function so you don't have to build it yourself. MAD -Original Message- From: Michael C.Grove [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 11:54 AM To: CF-Talk Subject: Array issue I have an array that I am using in a security table. The system does a query for a UserID in a table and returns all of the modules that the user has access to. The ModuleID is simply the Autonumber in an access table. The array builds fine. Using the following code below this is what I get and where the error is... CODE cfoutputContents: #ArrayToList(session.moduleaccess)#/cfoutput RETURNED Contents: 1,7,10,14,13 CODE cfif ArrayToList(session.moduleaccess) CONTAINS 3TRUEcfelseFALSE/cfif RETURNED TRUE The error in this is that I need to see of the user has access to module 3. He/She does not, but since they have access to module 13 the system sees it has having a 3. How do I check to see if an array contains a 3? -Original Message- From: CF-Talk [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 6:01 AM To: CF-Talk Subject: CF-Talk: Digest every 8 hours CF-Talk 31-Dec-04 Issue:1443 In this issue: CF+XPath cfapplication/clientvariable Error after Upgrade to MX 6.1 cfapplication/clientvariable Error after Upgrade to MX 6.1 CFC encapsulation CFC encapsulation CFC encapsulation My Init() in my CFC...am I on the right track? OT: query optimization OT: query optimization OT: query optimization OT: query optimization OT: query optimization OT: query optimization QofQ: SELECT DISTINCT QofQ: SELECT DISTINCT QofQ: SELECT DISTINCT query optimization shopping cart, session variables - best practices shopping cart, session variables - best practices Upgraded CF5 to CFMX - applications not working Upgraded CF5 to CFMX - applications not working Webservice output in browser Webservice output in browser Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189072 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extract year from date field
Thank you Sean. How can I apply the DISTINCT to the year as well? It gives me an error when I add it in front of datepart(yy,report_date) -Original Message- From: Sean Corfield [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 12:49 PM To: CF-Talk Subject: Re: Extract year from date field On Fri, 31 Dec 2004 10:43:43 -0500, Robert Orlini [EMAIL PROTECTED] wrote: How do I extract the year from a date field such as 2005-10-12? cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery You need to change your query so returns years as well as months - otherwise there is no year to extract later on: cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month, datepart(yy,report_date) as year from report where datepart(yy,report_date) = '2005' /cfquery Then you can refer to populatedropdown.year. Mind you, if your query really does just search by year like that, you *know* what the year is since you specified it in the query! -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 6 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189073 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Array issue
From: Dawson, Michael [mailto:[EMAIL PROTECTED] You need to use the ListFind() function. CONTAINS, or ListContains() can get you in trouble. ;-) You might also check CFLib.org for an ArrayFind() function so you don't have to build it yourself. I would also ask why you are making your list an array? Yes, string manipulation in CF is slow, but how involved is your usage of the string of modules? Do you really need the array? Mike ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189074 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Extract year from date field
How do I extract the year from a date field such as 2005-10-12? cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery Not to be a wiseass...but if that's the query, it'll always be 2005 :) It looks like your query gets all of the months of reports from 2005. If you wanted to get all of the distinct years for all reports, you could do the following: cfquery name=populatedropdown datasource=test select distinct(datepart(yy,report_date)) as reportYear from report /cfquery cfoutput query=populatedropdown#reportYear# /cfoutput -Joe -- For Tabs, Trees, and more, use the jComponents: http://clearsoftware.net/client/jComponents.cfm ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189075 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Tony Hicks [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 2:03 PM To: CF-Talk Subject: Re: Well - I feel like an idiot. Either I like to stick my foot in my mouth, or I'm feeling gutsy but I was looking at livedocs for application variables on another thing and it did say for data integrity you SHOULD lock. http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Appli cations_with_CFML/sharedVars6.htm http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Appli cations_with_CFML/sharedVars8.htm#1154837 Yeah - but they're wrong. ;^) As I said - this is one of the biggest, most confused topics in CF. The way I like to say it is that if you don't understand locking then ALWAYS lock. You'll lose some performance, but won't corrupt your app. In the Pre-MX days failure to lock could mean server death however - the internal structures used to store memory resident variables were not, themselves, thread safe. Failure to lock would often cause server memory corruption. This could even happen (because of those internal structures) that a simple read could happen before a write was finished leaving the read with corrupted data. In MX the internal structures are thread safe themselves. However that doesn't mean you can't screw things up. The biggest potential problems is race conditions - conditions were two requests accessing the same variables would cause confusion or incorrect data. To prevent race conditions you lock your code - and if you don't know if you'll have a race condition then you should probably lock to be safe. Also you don't have to worry as much about reads - the read will always work (even if it doesn't give you the data that you think it should). In MX not locking will just cause application-level problems, not server-level problems. If you understand the issues at play you can safely optimize your code by not locking in many cases. But the core advice of always lock is definitely the safer option. Jim Davis ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189077 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Extract year from date field
Thanks -Original Message- From: Joe Rinehart [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 1:51 PM To: CF-Talk Subject: Re: Extract year from date field How do I extract the year from a date field such as 2005-10-12? cfquery name=populatedropdown datasource=test select distinct(datepart(m,report_date)) as month from report where datepart(yy,report_date) = '2005' /cfquery Not to be a wiseass...but if that's the query, it'll always be 2005 :) It looks like your query gets all of the months of reports from 2005. If you wanted to get all of the distinct years for all reports, you could do the following: cfquery name=populatedropdown datasource=test select distinct(datepart(yy,report_date)) as reportYear from report /cfquery cfoutput query=populatedropdown#reportYear# /cfoutput -Joe -- For Tabs, Trees, and more, use the jComponents: http://clearsoftware.net/client/jComponents.cfm ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189078 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: OT: query optimization
(Which join type is hidden behind the popup?) Sorry I left that covered up this time... Look here: http://www.redmondinc.com/sos/exe_plan.gif Is that sufficient? Can you give me the recordcount of the following queries: SELECT DISTINCT proj_code, cust_job_num, cust_code, order_code FROM ordr; -- 712 rows SELECT DISTINCT tkt_code, tkt_date, truck_code, po, truck_net_wgt, hler_code, order_code FROM tick; -- 4724 rows SELECT DISTINCT prod_descr, order_code FROM ordl; -- 705 rows That's probably what you were asking for in your first message; sorry I misunderstood... thanks! -paul ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189079 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
But the core advice of always lock is definitely the safer option. I don't think I agree with the always lock mentality. This inevitably leads to deadlocks, and I don't believe ColdFusion handles deadlocks in a graceful way. By that I mean that ColdFusion does not roll back all operations in a lock (as if it were a transaction) when killing off deadlock victims. Consequently, you still end up with inconsistent or corrupted data, and the end user sees hard error messages. So, unless you fully understand locking and its side effects, I would not recommend that you lock your code. Even understanding all this, I would recommend locking judiciously. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189080 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Ben Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 3:18 PM To: CF-Talk Subject: RE: Well - I feel like an idiot. But the core advice of always lock is definitely the safer option. I don't think I agree with the always lock mentality. This inevitably leads to deadlocks, and I don't believe ColdFusion handles deadlocks in a graceful way. By that I mean that ColdFusion does not roll back all operations in a lock (as if it were a transaction) when killing off deadlock victims. I'm not sure how this relates in CF... The only real way that I know of to get a real deadlock in CF is to nest lock requests. Like the following: cflock scope=Application ... cflock scope=Session ... /cflock /cflock And even then is only a real problem if you are inconsistent with the nesting order of the lock requests. I don't think CF does anything special about this however - the templates just timeout normally unable to finish their work. In other words I don't believe CF has the concept of deadlock victims, but I could be wrong. As far as I can tell when a lock request times out, it's dead - it either skips the locked code (being unable to obtain the lock) or ends the template with an error (depending on how you set up the lock request). I'm way too tired to consider this clearly, but I'm not sure I see the potential for a deadlock where some locked code is run and would need to be rolled back (I'm not sure how you would roll back arbitrary code even then). Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189081 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
I'm not sure how this relates in CF... The only real way that I know of to get a real deadlock in CF is to nest lock requests. Like the following: cflock scope=Application ... cflock scope=Session ... /cflock /cflock As far as I know, it's only possible via nested locks. There's actually a good deal on deadlocks in the ColdFusion documentation: http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/shared52.htm http://livedocs.macromedia.com/coldfusion/6.1/htmldocs/shared52.htm And even then is only a real problem if you are inconsistent with the nesting order of the lock requests. But what happens if you call a UDF, CFC method or custom tag within a lock? Each of these provides a degree of encapsulation, meaning you don't know what they might be doing. I don't think CF does anything special about this however - the templates just timeout normally unable to finish their work. I think you're correct. In fact, I was trying to argue that the problem is that ColdFusion does not recognize deadlocks like an RDBMS would, for instance. ColdFusion can't detect a deadlock situation, choose a deadlock victim, and rollback the changes that that script has made. In other words I don't believe CF has the concept of deadlock victims, but I could be wrong. As far as I can tell when a lock request times out, it's dead - it either skips the locked code (being unable to obtain the lock) or ends the template with an error (depending on how you set up the lock request). I used the term deadlock victims in the first paragraph to mean the templates were victims of a deadlock situation, not that ColdFusion had determined that they were deadlocked victims and treated them as such. Sorry for the confusion. I'm way too tired to consider this clearly, but I'm not sure I see the potential for a deadlock where some locked code is run and would need to be rolled back (I'm not sure how you would roll back arbitrary code even then). The issue with race conditions is that you end up with data that's in an inconsistent state. If you have two templates that get terminated because of a deadlock situation, both templates could have updated some information, but not all. In other words, the end result of a race condition and a deadlock is the same: inconsistent data. Instead of a race condition (which can often be harmless), you caused a deadlock. Neither process finished. Some data reflects the state before each template ran. Some data, after. With a deadlock, the user gets an error in the process. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189082 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Array issue
Thanks As always you guys came through. The answer to my problem was cfif ListFind(session.ModuleList, 3) I don't know much about lists or arrays, so I really don't know the available functions. As for why I am using an array I found a piece of code in a book that seem to resolve an issue. When a person logs into my site The system check one table to see if they have a correct id and password, checks their status and their security level. If all is good and the users level is admin then they have access to everything. If they are just a user, then the system runs an additional query to see what system modules the user has access to. This is in a separate table and simply looks for the user id and module id. The modules that the user has access to are placed in an array and stored in a session variable. Depending on the page that the user is on and the section of the system they may or may not see various links based on the module access. I also place an if statement at the beginning of each individual module checking whether or not they have access. -Original Message- From: CF-Talk [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 2:01 PM To: CF-Talk Subject: CF-Talk: Digest every 8 hours CF-Talk 31-Dec-04 Issue:1444 In this issue: Array issue Array issue Array issue Coldfusion IIS behind firewall Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field Extract year from date field OT: query optimization OT: query optimization OT: query optimization Possible to pass formatting to Excel from CF? Possible to pass formatting to Excel from CF? QofQ: SELECT DISTINCT QofQ: SELECT DISTINCT Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. Well - I feel like an idiot. ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189083 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Ben Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 4:28 PM To: CF-Talk Subject: RE: Well - I feel like an idiot. But what happens if you call a UDF, CFC method or custom tag within a lock? Each of these provides a degree of encapsulation, meaning you don't know what they might be doing. Which is exactly why you have to be consistent with locking. ;^) Generally nesting concerns would only happen with scope level locking or site-wide name-level locks. In those cases, despite the encapsulation of extensions you'll need to know something about the application architecture to create them in first place (I think). In other words I don't believe CF has the concept of deadlock victims, but I could be wrong. As far as I can tell when a lock request times out, it's dead - it either skips the locked code (being unable to obtain the lock) or ends the template with an error (depending on how you set up the lock request). I used the term deadlock victims in the first paragraph to mean the templates were victims of a deadlock situation, not that ColdFusion had determined that they were deadlocked victims and treated them as such. Sorry for the confusion. No problem - this is just a topic I'm very interested in. I'm way too tired to consider this clearly, but I'm not sure I see the potential for a deadlock where some locked code is run and would need to be rolled back (I'm not sure how you would roll back arbitrary code even then). The issue with race conditions is that you end up with data that's in an inconsistent state. If you have two templates that get terminated because of a deadlock situation, both templates could have updated some information, but not all. In other words, the end result of a race condition and a deadlock is the same: inconsistent data. True - but that would be a failure of design, not of locking. If your template is doing something outside of locks that would affect code inside of locks like that I would think you'd need to reevaluate how you're doing things. Instead of a race condition (which can often be harmless), you caused a deadlock. Neither process finished. Some data reflects the state before each template ran. Some data, after. With a deadlock, the user gets an error in the process. That depends - but I agree in theory. I still stand by my belief that locking is safer than unlocking if you don't know what you're doing. In most cases data integrity is more important than experience and since nested locks are the only way to create a deadlock in CF it seems to me rare that a novice would encounter the issue. Of course I think we both can agree that the preferred thing is to actually gain an understanding of threaded requests and locking before writing a CF application. ;^) In practice I actually write much more like you're talking about: very few locks. Since I know (or at least think I know) what's what I feel confident in choosing when to an when not to lock. Then I get bitten in the ass by something the code that I started the thread with. ;^) (I know that wasn't really a locking issue per se, but it's definitely in the ballpark.) Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189084 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Array issue
I didn't have a part in the suggestion but I'm glad it works. I saw it and being a list fan like I am.. I would have suggested it too... I would suggest one other thing though... your summary seems like to goes beyond too much... just a thought.. I'd put pages relating to each module in a seperate folder.. I'd name them m1, m2, m3m19 etc... The code at the top of each page, or even in application.cfm would look like this... cfset mgranted = 0 CFIF Admin_Identifier_Field eq 1 (or whatever means admin is on) cfset mgranted = 1 CFELSE cfset nlevel = ListGetAt(cgi.script_Name,listlen(cgi.script_name,/)-1,/) CFIF listFind(AccessLevels,Right(nLevel,len(nLevel)-1) cfset mgranted = 1 /CFIF /CFIF And that would parse out the folder name that contained the level. You check for mgranted to equal 1. Now code to configure links to custom controls... cfif not isDefined(Application.ArrControls) cfset Application.ArrControls = ArrayNew(2) cfset Application.ArrControls[1][1] = A...Link for Access Level 1/A cfset Application.ArrControls[1][2] = A...Link for Access Level 1/A cfset Application.ArrControls[1][3] = A...Link for Access Level 1/A cfset Application.ArrControls[2][1] = A...Link for Access Level 2/A cfset Application.ArrControls[3][1] = A...Link for Access Level 3/A cfset Application.ArrControls[3][2] = A...Link for Access Level 3/A cfset Application.ArrControls[4][1] = A...Link for Access Level 4/A cfset Application.ArrControls[4][2] = A...Link for Access Level 4/A /cfif cfset AppControls = Application.ArrControls Now the code to get the right links for the right users. cfoutputcfloop from=1 to=#ArrayLen(AppControls)# index=a1 cfif (ListFind(AccessLevels,a1) or Admin_Identifier_Field eq 1) and ArrayLen(AppControls[a1]) middot; cfloop from=1 to=#ArrayLen(AppControls[a1])# index=a2 #AppControls[a1][a2]# middot; /cfloopbr /cfif /cfloop/cfoutput Here's another way to do the above... Its a better method I'd say... Just don't know if it will work.. never tried it. cfoutputcfloop from=1 to=#ArrayLen(AppControls)# index=a1 cfif (ListFind(AccessLevels,a1) or Admin_Identifier_Field eq 1) and ArrayLen(AppControls[a1]) #ArrayToList(AppControls[a1], | )#br /cfif /cfloop/cfoutput ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189085 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
Many session-based sites run well without any cflocks but they're smaller sites.. It doesn't seem to me to be a policy of knowing what your doing or not, its more about the fact that you don't ever want data mixed up, ever. To me its worth a few more lines of code to always protect my user's data. I can see where locking or not locking application variables could be harmless but I stand firm on sessions needing to be locked. On Fri, 31 Dec 2004 16:52:00 -0500, Jim Davis [EMAIL PROTECTED] wrote: -Original Message- From: Ben Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 4:28 PM To: CF-Talk Subject: RE: Well - I feel like an idiot. But what happens if you call a UDF, CFC method or custom tag within a lock? Each of these provides a degree of encapsulation, meaning you don't know what they might be doing. Which is exactly why you have to be consistent with locking. ;^) Generally nesting concerns would only happen with scope level locking or site-wide name-level locks. In those cases, despite the encapsulation of extensions you'll need to know something about the application architecture to create them in first place (I think). In other words I don't believe CF has the concept of deadlock victims, but I could be wrong. As far as I can tell when a lock request times out, it's dead - it either skips the locked code (being unable to obtain the lock) or ends the template with an error (depending on how you set up the lock request). I used the term deadlock victims in the first paragraph to mean the templates were victims of a deadlock situation, not that ColdFusion had determined that they were deadlocked victims and treated them as such. Sorry for the confusion. No problem - this is just a topic I'm very interested in. I'm way too tired to consider this clearly, but I'm not sure I see the potential for a deadlock where some locked code is run and would need to be rolled back (I'm not sure how you would roll back arbitrary code even then). The issue with race conditions is that you end up with data that's in an inconsistent state. If you have two templates that get terminated because of a deadlock situation, both templates could have updated some information, but not all. In other words, the end result of a race condition and a deadlock is the same: inconsistent data. True - but that would be a failure of design, not of locking. If your template is doing something outside of locks that would affect code inside of locks like that I would think you'd need to reevaluate how you're doing things. Instead of a race condition (which can often be harmless), you caused a deadlock. Neither process finished. Some data reflects the state before each template ran. Some data, after. With a deadlock, the user gets an error in the process. That depends - but I agree in theory. I still stand by my belief that locking is safer than unlocking if you don't know what you're doing. In most cases data integrity is more important than experience and since nested locks are the only way to create a deadlock in CF it seems to me rare that a novice would encounter the issue. Of course I think we both can agree that the preferred thing is to actually gain an understanding of threaded requests and locking before writing a CF application. ;^) In practice I actually write much more like you're talking about: very few locks. Since I know (or at least think I know) what's what I feel confident in choosing when to an when not to lock. Then I get bitten in the ass by something the code that I started the thread with. ;^) (I know that wasn't really a locking issue per se, but it's definitely in the ballpark.) Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189086 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Stress Testing Cold Fusions Limits
You guys have some impressive knowledge.. I think I do too :) but I admire yours.. I wanted to ask a question... Where you say cold fusion on a single box really peaks out? I mean without clustering and everything... where would you say its too much load? I've been having a few issues but its cfmx related... problems that didn't exist in 5.. And I want to know a good next move. Also.. I want to toss traffic at my own site and let my error reporter run and see how far I can crank it up.. good weekend project.. Anyone got any recommendations on a good program to... bombard your site with traffic? ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189087 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
Which is exactly why you have to be consistent with locking. ;^) I don't see how consistency directly relates to what I was talking about. Modular code generally knows very little about its context: that's the whole point. You can be entirely consistent and still end up with deadlocks if one piece of code isn't aware of what's going on around it. Generally nesting concerns would only happen with scope level locking or site-wide name-level locks. The names used in name level locks are completely arbitrary. What happens when you call a third party CFC that just happens to use the same name that you use? Better yet, what happens when your cfc, which locks the session scope, accesses a singleton registry which locks the application scope? In those cases, despite the encapsulation of extensions you'll need to know something about the application architecture to create them in first place (I think). You're assuming you have access to and an intimate knowledge of all the code in question. I used a third party CFC in a recent project. It's encrypted, so I have no idea what locks it might create, what scope they are or what it names them, etc. We used the Component Kit in another project. That stores quite a bit of information in the server scope of all places. How did that information get there? True - but that would be a failure of design, not of locking. If your template is doing something outside of locks that would affect code inside of locks like that I would think you'd need to reevaluate how you're doing things. All failures are a failure of design. :) The point I was trying to make is that you have to know a good deal about locking and how your code will be used to lock properly. Otherwise, you end up deadlocks instead of race conditions. The end result is the same: inconsistent data. Consequently, I don't believe that the lock everything paradigm is any better than not locking at all. That depends - but I agree in theory. I still stand by my belief that locking is safer than unlocking if you don't know what you're doing. This is clearly something we disagree on. I'm sure I'm biased because I've seen far more deadlock issues than race conditions. In most cases data integrity is more important than experience and since nested locks are the only way to create a deadlock in CF it seems to me rare that a novice would encounter the issue. If the novice is locking everything, then deadlocks are sure to ensue. ColdFusion does nothing to prevent the loss of data integrity in a deadlock situation. Of course I think we both can agree that the preferred thing is to actually gain an understanding of threaded requests and locking before writing a CF application. ;^) Yes, but short of that, I would not recommend locking everything. I would recommend the opposite: do not lock unless you have a reason to. In practice I actually write much more like you're talking about: very few locks. Since I know (or at least think I know) what's what I feel confident in choosing when to an when not to lock. And you've probably had very few deadlock issues. I do the same. I generally have a handful of well named locks in any application. I've had very few deadlock issues and, in almost a decade of Web programming, I can probably count the number of race conditions I've seen on one hand. Then I get bitten in the ass by something the code that I started the thread with. ;^) (I know that wasn't really a locking issue per se, but it's definitely in the ballpark.) I know what you mean. It's always when I'm most sure of myself that I'm the furthest from being right. :) I actually had to write my own locking routines in ASP a couple of years ago. ASP lacks anything analogous to the cflock tag. To make a long story short, I discovered the hard way that locking was a far more intricate and delicate process than I had thought. I came back to ColdFusion with a new found respect for locking issues. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189088 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
Many session-based sites run well without any cflocks but they're smaller sites.. It doesn't seem to me to be a policy of knowing what your doing or not, its more about the fact that you don't ever want data mixed up, ever. Which can happen as the result of deadlocks. To me its worth a few more lines of code to always protect my user's data. I don't believe Jim or I are arguing against locking or that locking causes code to become too verbose. We simply disagree over whether or not people who do not understand locking should lock every block of code that is stored in a shared scope. I can see where locking or not locking application variables could be harmless but I stand firm on sessions needing to be locked. It depends more on the data and its use then the actual ColdFusion scope involved. Some applications store data pertaining to user sessions in the server scope. Personally, I'm not a big fan of this, but I'm sure others have their reasons. Ben Rogers http://www.c4.net v.508.240.0051 f.508.240.0057 ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189089 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Tony Hicks [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 5:35 PM To: CF-Talk Subject: Re: Well - I feel like an idiot. Many session-based sites run well without any cflocks but they're smaller sites.. It doesn't seem to me to be a policy of knowing what your doing or not, its more about the fact that you don't ever want data mixed up, ever. To me its worth a few more lines of code to always protect my user's data. I can see where locking or not locking application variables could be harmless but I stand firm on sessions needing to be locked. As I've been saying (in my opinion) if you're unsure, lock. However if you are sure that not locking will not cause any issues, then its only better performance to drop needless code. Most people would agree that many (if not all) session reads (for example) don't need to be locked (depending on the application of course). For example consider the common practice of placing a LastAccessed timestamp in your session scope. This variable is updated with the current when a user makes a request. If two templates attempt to update the value at the same time it doesn't matter (at least to my application): the time is only used to determine if a session is stale so either time is fine as they're both essentially the same. Personally I wouldn't lock that write in CFMX (in previous versions I would). To me it's always about the current situation. I agree in general that session data generally needs to be locked, but each situation presents different circumstances. Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189090 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
I've never had a session write or a session read fail on me, because thank God, right after I learned what a session was, someone sent me to research CFLOCK. But I've seen them fail on other cf sites... a session read actually.. no data was being written at the time... I was browsing a forum one day and I don't know what happened but I posted a response to someone and I was posting as a different user... A user who I'd never met so I had no access to his account. I don't know what happened.. it probably wasn't strictly a read... something invisible in the site.. like a lastAccessed variable was probably being set, and whadya know, I come out as a different user. I had to email the guy and tell him to change his password because if it happened to me, it could happen to others and while I didn't look up his password, someone else could have. That is (or at least was) the apparent flaw to cf's sessions.. its not one field that gets switched... it was the whole session. On Fri, 31 Dec 2004 17:53:15 -0500, Jim Davis [EMAIL PROTECTED] wrote: -Original Message- From: Tony Hicks [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 5:35 PM To: CF-Talk Subject: Re: Well - I feel like an idiot. Many session-based sites run well without any cflocks but they're smaller sites.. It doesn't seem to me to be a policy of knowing what your doing or not, its more about the fact that you don't ever want data mixed up, ever. To me its worth a few more lines of code to always protect my user's data. I can see where locking or not locking application variables could be harmless but I stand firm on sessions needing to be locked. As I've been saying (in my opinion) if you're unsure, lock. However if you are sure that not locking will not cause any issues, then its only better performance to drop needless code. Most people would agree that many (if not all) session reads (for example) don't need to be locked (depending on the application of course). For example consider the common practice of placing a LastAccessed timestamp in your session scope. This variable is updated with the current when a user makes a request. If two templates attempt to update the value at the same time it doesn't matter (at least to my application): the time is only used to determine if a session is stale so either time is fine as they're both essentially the same. Personally I wouldn't lock that write in CFMX (in previous versions I would). To me it's always about the current situation. I agree in general that session data generally needs to be locked, but each situation presents different circumstances. Jim Davis ~| Special thanks to the CF Community Suite Silver Sponsor - New Atlanta http://www.newatlanta.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189091 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: Well - I feel like an idiot.
-Original Message- From: Ben Rogers [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 5:43 PM To: CF-Talk Subject: RE: Well - I feel like an idiot. Which is exactly why you have to be consistent with locking. ;^) I don't see how consistency directly relates to what I was talking about. Modular code generally knows very little about its context: that's the whole point. You can be entirely consistent and still end up with deadlocks if one piece of code isn't aware of what's going on around it. True - but that mean you shouldn't be consistent with your code. At the very least any extensions that you or your team's written would be unable to cause such deadlocks. Generally nesting concerns would only happen with scope level locking or site-wide name-level locks. The names used in name level locks are completely arbitrary. What happens when you call a third party CFC that just happens to use the same name that you use? Better yet, what happens when your cfc, which locks the session scope, accesses a singleton registry which locks the application scope? Although name-level locking is arbitrary it's not at all random. Steps can be taken to minimize name conflicts (and if there are name conflicts you're most likely going to have more issues than deadlocks). For example in my persistent CFCs I use UUIDs as the lock names. Furthermore in CFMX I don't personally use scope locking at all - that eliminates most of the causes of contention that we're talking about. As for a session lock being in place at the same time as an application lock - so what? You can only get a deadlock in CF if those locks are nested in BOTH places. The CFC in question would have to lock the application then session (or vice versa) and the singleton would have to do the reverse. As far as I can see that's the only way to get a deadlock in that case. In those cases, despite the encapsulation of extensions you'll need to know something about the application architecture to create them in first place (I think). You're assuming you have access to and an intimate knowledge of all the code in question. I used a third party CFC in a recent project. It's encrypted, so I have no idea what locks it might create, what scope they are or what it names them, etc. We used the Component Kit in another project. That stores quite a bit of information in the server scope of all places. How did that information get there? Then those are issues with your application. Personally I would ask the developer of those third party tools to document the locking strategy of the extension. For what it's worth I don't think that any CFMX extension should EVER scope lock exactly for the reasons that you mention. Only name locks should be used and then steps should be taken to prevent name contention. This isn't too dissimilar to the issues in the Java world with distributing packages. The whole com.mysite.packagename convention was promoted to prevent this kind of name contention. I think the same kind of methodology could be adapted to prevent lock name contention as well. True - but that would be a failure of design, not of locking. If your template is doing something outside of locks that would affect code inside of locks like that I would think you'd need to reevaluate how you're doing things. All failures are a failure of design. :) The point I was trying to make is that you have to know a good deal about locking and how your code will be To true. I stand corrected. ;^) This is clearly something we disagree on. I'm sure I'm biased because I've seen far more deadlock issues than race conditions. I might just be the kind of code we see. I tend to see a lot of racing due to bad UI design (don't get me started on THAT however). Framesets, popup windows, poor design leading to multiple windows, etc. A lot of cases are just potential race conditions - the clichéd example is the single shopping cart linked to multiple windows. I don't honestly think I've ever seen a real problem related to that, but that's the example everybody quotes. ;^) If the novice is locking everything, then deadlocks are sure to ensue. ColdFusion does nothing to prevent the loss of data integrity in a deadlock situation. I'm not sure about that (which means, of course, that I could be wrong). Again - you need nested locks and an inconsistent nesting in multiple templates. I rarely see nested locks at all, much less in novice code. Since CFMX was released I can't remember a case where I've ever needed to nest locks. In previous versions the classic issues was always the application-then-session nesting. This nearly ALWAYS showed up due to bad code like this: cflock scope=Application ... cflock scope=session ... cfquery datasource=#Application.myDSN# password=#session.password# ... /cfquery /cflock /cflock Of course even in earlier
Re: Stress Testing Cold Fusions Limits
Tony, Finding out where an application peaks out is a complex question and depends on your code and the database etc. Charlie Arehart spoke before our user group a few years back on the subject of load testing. I also believe he wrote an article on the subject in CFDJ though I couldn't locate it with a quick search. I've actually used one of the tools he spoke of that night by a company called OpenDemand and I believe they have a free web trial. There is also a free load tester from Microsoft and another one from a German company. If you can locate either that article or Charlie's powepoint it should answer most of the questions you might have. I know that I learned an awful lot about my application after I did some basic load testing. Rick Mason On Fri, 31 Dec 2004 16:38:42 -0600, Tony Hicks [EMAIL PROTECTED] wrote: You guys have some impressive knowledge.. I think I do too :) but I admire yours.. I wanted to ask a question... Where you say cold fusion on a single box really peaks out? I mean without clustering and everything... where would you say its too much load? I've been having a few issues but its cfmx related... problems that didn't exist in 5.. And I want to know a good next move. Also.. I want to toss traffic at my own site and let my error reporter run and see how far I can crank it up.. good weekend project.. Anyone got any recommendations on a good program to... bombard your site with traffic? ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189093 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Stress Testing Cold Fusions Limits
Hi, Check out grinder out and see if it helps. http://www.anticlue.net/archives/000395.htm The one main drawback is that you need to have multiple sessions on multiple PCs, because it overwhelms the local pc's nic card since they normally are lower end. The other program that is great for load testing is load runner from Mercury Interactive. I believe there is a 10 day trail version. HTH, Elyse http://www.anticlue.net On Fri, 31 Dec 2004 18:38:28 -0500, Rick Mason [EMAIL PROTECTED] wrote: Tony, Finding out where an application peaks out is a complex question and depends on your code and the database etc. Charlie Arehart spoke before our user group a few years back on the subject of load testing. I also believe he wrote an article on the subject in CFDJ though I couldn't locate it with a quick search. I've actually used one of the tools he spoke of that night by a company called OpenDemand and I believe they have a free web trial. There is also a free load tester from Microsoft and another one from a German company. If you can locate either that article or Charlie's powepoint it should answer most of the questions you might have. I know that I learned an awful lot about my application after I did some basic load testing. Rick Mason On Fri, 31 Dec 2004 16:38:42 -0600, Tony Hicks [EMAIL PROTECTED] wrote: You guys have some impressive knowledge.. I think I do too :) but I admire yours.. I wanted to ask a question... Where you say cold fusion on a single box really peaks out? I mean without clustering and everything... where would you say its too much load? I've been having a few issues but its cfmx related... problems that didn't exist in 5.. And I want to know a good next move. Also.. I want to toss traffic at my own site and let my error reporter run and see how far I can crank it up.. good weekend project.. Anyone got any recommendations on a good program to... bombard your site with traffic? ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189094 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Stress Testing Cold Fusions Limits
On Fri, 31 Dec 2004 16:38:42 -0600, Tony Hicks [EMAIL PROTECTED] wrote: Where you say cold fusion on a single box really peaks out? It completely depends on your application and the traffic patterns it sees. I've been having a few issues but its cfmx related... problems that didn't exist in 5.. And I want to know a good next move. One of the most common issues people encounter moving from CF5 to CFMX is database driver performance. Do you have the latest 6.1 Updater installed? Anyone got any recommendations on a good program to... bombard your site with traffic? OpenSTA, WAST (Microsoft) are free. We use Segue Silk Performer here at Macromedia but that costs $$$. -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 6 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189095 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: Well - I feel like an idiot.
On Fri, 31 Dec 2004 14:18:07 -0500, Jim Davis [EMAIL PROTECTED] wrote: http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Appli cations_with_CFML/sharedVars6.htm http://livedocs.macromedia.com/coldfusion/6/Developing_ColdFusion_MX_Appli cations_with_CFML/sharedVars8.htm#1154837 Yeah - but they're wrong. ;^) And this is not likely to be corrected for Blackstone I'm afraid. The docs need a serious going over in terms of locking and that just isn't possible in the current timeframe. I suggest you visit the LiveDocs pages and add comments about this... -- Sean A Corfield -- http://www.corfield.org/ Team Fusebox -- http://www.fusebox.org/ Breeze Me! -- http://www.corfield.org/breezeme Got Gmail? -- I have 6 invites to give away! If you're not annoying somebody, you're not really alive. -- Margaret Atwood ~| Special thanks to the CF Community Suite Silver Sponsor - RUWebby http://www.ruwebby.com Message: http://www.houseoffusion.com/lists.cfm/link=i:4:189096 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
RE: If you really need work as a CF Programmer let me know.
I think it really depends, Johnny. It depends on your experience and even education - the contractor can charge more for you based on these things. It also depends on the government agency. I've been on two defense contracts, and I know that my boss charges double what I make. Even though your employer pays benefits and has other expenses, there's definitely a good deal of leeway. Of course you could also be a subcontractor which means less for your employer, but in any case, I think $65-80K is pretty normal in this area for developers with at least three years of experience in either CF or ASP, and having the higher-end skills like .net, java, etc., will clinch it. Of course there are lots of companies that simply don't have this kind of cash - startups come to mind - and so can't offer much. Now it's one thing to accept a job at a non-profit for $30K if you believe in the cause enough to take a big cut in pay from what you might get elsewhere. But some companies just don't understand what the going rate for a developer is, or have this misconception that coding is so easy that it shouldn't be a high-paying position. Eventually they either learn that they have to match the going rate, or they get what they pay for. I don't know if employers are still pulling things like this, but I remember back during the bubble in late '99 when I was looking, a startup company with 20-30 people was offering me $40K when others companies were offering at least $15-20K more. They justified this by saying that there was an incentive plan in the works that would make for much more income due to getting projects done. I ended up turning them down not only for that but because they said I could not do freelance work in my free time! It just smelled fishy. A friend's wife went to work there and they eventually emploded like so many others, but she said they never had any kind of incentive plan while she worked there (basically from within a few weeks after I said no to them to about two years later when they folded). As for clearances, they are useful and worth more, and this is why it's a good idea to look for jobs that will not only require one but also allow you to apply for one there. I think it's unfair require current security clearances in so many positions because it means there are few places where you can get your foot in the door so to speak, but I guess there are much worse things to overcome than this! Levi Wallach - [EMAIL PROTECTED] Blog: http://twelveblackcodemonkeys.blog-city.com Pictures: http://wallachexpressions.smugmug.com/Photos%20by%20Levi -Original Message- From: Johnny Le [mailto:[EMAIL PROTECTED] Sent: Friday, December 31, 2004 4:33 PM To: CF-Jobs-Talk Subject: Re: If you really need work as a CF Programmer let me know. Hi Wallach and Jeff, I am in DC. I consider myself as an Advanced Developer. I am looking for mid or senior positions. However, when it comes to ColdFusion and J2EE or COM object, I am clueless. So I feel like I don't everything about ColdFusion. I don't see many job listings that offers over $70k. Most of them are between $45k-$65k. Once I got an offer for $30k (I turned it down). I told several people I want $75k and they just laughed and said they can't afford that. I don't have secret clearance. I thought CF Developers who don't have secret clearance don't really make over $80k. Also most jobs in DC are with government contractors. They want their shares of the profit too. If they offered developers over $70k, they won't have much profit. This is the first time I heard about CF developers making over $80k in DC. So I didn't have much confidence in asking for more than $65k. That's why I want to confirm that CF developers (not teamleads or project managers) are indeed making over $80k in DC. If so, then I won't accept just any offer coming my way and wait for a good one. Although, like Jeff said, I may accept a job for less if I think I may gain a lot of experience from it. Johnny ~| Special thanks to the CF Community Suite Silver Sponsor - CFDynamics http://www.cfdynamics.com Message: http://www.houseoffusion.com/lists.cfm/link=i:11:2146 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/11 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:11 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11 Donations Support: http://www.houseoffusion.com/tiny.cfm/54
Re: If you really need work as a CF Programmer let me know.
Yah, I think $65-80K is normal too. The original message says I have never been offered less then 80k. The never... less than 80k was my concern, and made me wonder if I am underpaid. Johnny I think it really depends, Johnny. It depends on your experience and even education - the contractor can charge more for you based on these things. It also depends on the government agency. I've been on two defense contracts, and I know that my boss charges double what I make. Even though your employer pays benefits and has other expenses, there's definitely a good deal of leeway. Of course you could also be a subcontractor which means less for your employer, but in any case, I think $65-80K is pretty normal in this area for developers with at least three years of experience in either CF or ASP, and having the higher-end skills like .net, java, etc., will clinch it. Of course there are lots of companies that simply don't have this kind of cash - startups come to mind - and so can't offer much. Now it's one thing to accept a job at a non-profit for $30K if you believe in the cause enough to take a big cut in pay from what you might get elsewhere. But some companies just don't understand what the going rate for a developer is, or have this misconception that coding is so easy that it shouldn't be a high-paying position. Eventually they either learn that they have to match the going rate, or they get what they pay for. I don't know if employers are still pulling things like this, but I remember back during the bubble in late '99 when I was looking, a startup company with 20-30 people was offering me $40K when others companies were offering at least $15-20K more. They justified this by saying that there was an incentive plan in the works that would make for much more income due to getting projects done. I ended up turning them down not only for that but because they said I could not do freelance work in my free time! It just smelled fishy. A friend's wife went to work there and they eventually emploded like so many others, but she said they never had any kind of incentive plan while she worked there (basically from within a few weeks after I said no to them to about two years later when they folded). As for clearances, they are useful and worth more, and this is why it's a good idea to look for jobs that will not only require one but also allow you to apply for one there. I think it's unfair require current security clearances in so many positions because it means there are few places where you can get your foot in the door so to speak, but I guess there are much worse things to overcome than this! Levi Wallach - [EMAIL PROTECTED] Blog: http://twelveblackcodemonkeys.blog-city.com Pictures: http://wallachexpressions.smugmug.com/Photos%20by%20Levi Johnny ~| Special thanks to the CF Community Suite Gold Sponsor - CFHosting.net http://www.cfhosting.net Message: http://www.houseoffusion.com/lists.cfm/link=i:11:2147 Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/11 Subscription: http://www.houseoffusion.com/lists.cfm/link=s:11 Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.11 Donations Support: http://www.houseoffusion.com/tiny.cfm/54