cfflush - flushing quits sometimes in middle of loop
I have a page where a query resultset of various documents to be emailed or faxed to clients is being looped over. These can take up to 10 seconds to process, so I flush the progress to the browser so the user can see that document x of y total has been sent (or has failed). Y is usually 200, and never more than that. This is infrequent, but sometimes the flush just stops flushing to the browser during a random iteration in the loop, even though the process is still running in the background and runs all the way to completion. I'm using CF8, viewing on IE9 (I have also viewed on IE8; I have yet to see this happen using IE8. So far has only happened on IE9). I use divs to mimic table rows, as IE will not flush actual table rows one at a time; it waits until the whole table is done and only then renders it to the screen. I also set a very low interval so it doesn't wait too long before flushing the next bit of html. My code basically looks like this (btw - I didn't see any tags to enclode a codeblock; will try to keep this neat...): cfset objDocSender = createObject(some cfc) cfflush interval=10 cfoutput Processing documents...#repeatString( , 10)# !---this to force IE to render--- /cfoutput cfoutput div id=row div id=cell class=headerWork Request ID/divdiv id=cell class=headerDelivery Method/divdiv id=cell class=headerSuccess/divdiv id=cell class=headerProgress/div /div /cfoutput cfloop query=qryDocsToSend cftry cfset blnSuccess['#qryDocsToSend.DocID[currentrow]#'] = objDocSender.sendDocument(#qryDocsToSend.DocID[currentrow]#, '#qryDocsToSend.Delivery_Method[currentrow]#') cfcatch cfset blnSuccess['#qryDocsToSend.DocID[currentrow]#'] = false /cfcatch /cftry cfoutput div id=rowcfif NOT blnSuccess['#qryDocsToSend.DocID[currentrow]#'] class=red/cfif div id=cell#qryDocsToSend.DocID[currentrow]#/divdiv id=cell#qryDocsToSend.Delivery_Method[currentrow]#/divdiv id=cellcfif blnSuccess['#qryDocsToSend.DocID[currentrow]#']YcfelseN/cfif/divdiv id=cell#qryDocsToSend.currentrow# of #qryDocsToSend.recordcount# processed./div /div /cfoutput cfif blnSuccess['#qryDocsToSend.DocID[currentrow]#'] NEQ true cfset intNumFailed = intNumFailed + 1 cfset lstFailedIDs = listAppend(lstFailedIDs, '#qryDocsToSend.DocID[currentrow]#') /cfif /cfloop cfoutput br div style=clear:both; br#qryWRsToSend.recordcount - IntNumFailed# recordcfif qryWRsToSend.recordcount - IntNumFailed NEQ 1s werecfelse was/cfif sent.br cfif intNumFailed GT 0 #IntNumFailed# failed.br /cfif /div /cfoutput Has anyone else experienced this kind of behavior with cfflush? Thanks, Christophe ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:355865 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Asynchronous action inside CFC function
Hi I have a function that gets some binary data, uses that data to do a cffile action=write, and then returns the file's path as a string. I'm experiencing a problem that suggests the function is doing the return before the write action has completed. In the code below, will the function wait for the write action to complete before it sends the return? I'm almost certain it will not; is there a way to force the function to wait for the write to complete before it returns strWPTempFilePath, such as cftransaction or something along those lines? cfset strWPTempFilePath = request.stcApplicationData.strTempImageDirectory createUuid() .pdf cffile action=WRITE file=#strWPTempFilePath# output=#r_docBinData# addNewLine=no / cfreturn strWPTempFilePath ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:353141 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
problem using cfheader to create csv file from query
I'm running into a problem using cfheader, and wondering if there's a workaround. What's happening is this: I have a form page, and onSubmit of the form, a js validation function is called. This performs a number of tasks in addition to validation, and during its execution it looks at the document object. On the action page, a query is generated and fed to a custom changeQueryToCSV(query) function. Ultimately I want the user to be able to view (in Excel) and/or save the resulting .csv to their own pc. I use this at the bottom of my action page to make it happen: [code] cfcontent type=application/csv cfheader name=Content-Type value=text/csv cfheader name=Content-Disposition value=attachment; filename=myFile.csv cfoutput#csvStringThatWasReturnedByFunction#/cfoutput [/code] The problem is that the content type is being changed, and this seems to wipe out the DOM document object. When I submit the form, a dialog box comes up asking if I want to view or save myFile.csv, which I want. But then a js error pops up saying that document.all is not defined. As an attempt at working around, I used iframe. So the action page has only the iframe tags, with the src being another cfm page which contains all of the action code. This seems to work; document.all is defined in this case. But both the form page and the action page happen inside a modal window, which I want to close as soon as it's done executing. Any code on the action page (which has the iframe tags) to close the window causes it to close before the view/save dialog box appears. I also tried using window.open() on the action page instead of iframe, but I don't want any visible window to actually pop up. I've tried using cfmodule and cfinclude with no lock. Might cfthread work here? Mostly, I'm wondering if there's any other way to do what needs to be done (create csv file user can save to own pc) without using cfheader. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351322 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Get text value from xmlsearch()
Is there any way to get the 09-09-2009 string using xmlSearch() for the below xml? employee startDate09-09-2009/startDate /employee I've been doing something like this, which is a real pain: arrDate = xmlSearch(xml, //employee/startDate); strDate = arrDate[1].XmlText; It seems that xmlSearch() must always return an array and is unable to return a string, which makes sense, but using the above code has gotten old, real fast. ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:349008 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Function to decode string?
I have a string variable that I'm using dynamically in an XML document, so it's necessary to use XMLFormat() or HTMLEditFormat() to change special characters like , , and so that the XML doesn't break. However, I need to convert those back to their literals before saving to the DB, i.e., I need gt; to be converted back to , and amp; to be converted back to , etc. Is there a CF function that will do this? I haven't been able to find one. Also, not for CF but for web dev in general, is there a standard term for the gt;, nbsp;, etc. format? Thanks! ~| Order the Adobe Coldfusion Anthology now! http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346836 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm
Re: Cfcontent MS Excel 2007 errors?
I've had the same problem, although the file will open after the user clicks yes. I Looked to see if there's a different MIME type to use for .xlsx files vs. .xls files, and there is (see http://blogs.msdn.com/vsofficedeveloper/pages/Office-2007-Open-XML-MIME-Types.aspx). But using that mime type didn't help at all; the file saved can't even be opened. ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329368 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
cfcontent with excel 2007
Have seen a few posts around the web with this problem, but no evident solution. I have a cfm page that I want to make exportable to excel 2007 (.xlsx file). From what I've seen here: http://blogs.msdn.com/vsofficedeveloper/pages/Office-2007-Open-XML-MIME-Types.aspx it looks like the correct MIME type for Excel 2007 (.xlsx) files is NOT vnd.ms-excel, but rather application/vnd.openxmlformats-officedocument.spreadsheetml.sheet . So, when the proper url var is passed to the page, I include these lines of code: cfcontent type=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet cfheader name=Content-Type value=application/vnd.openxmlformats-officedocument.spreadsheetml.sheet cfheader name=Content-Disposition value=filename=report.xlsx And in that case the user is prompted to open or save the .xlsx file. However, Excel 2007 can't open the file; it gives an error message saying that the file format is not valid. No problem if I export it all using vnd.ms-excel as the MIME-type instead, but then it saves as an .xls file, not an .xlsx file. Any help on how I can get it to save as an .xlsx file? (Using CF8). Thanks, CM ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329370 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cftransaction
Thanks everyone - looks like the sproc is indeed committing on the backend. I do miss writing my own queries... ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329154 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
cftransaction
Hi all, I understand the gist of cftransaction, but I've tried using it with a conditional rollback on an action page in the below example and it doesn't seem to work. saveDataToDatabase() submits data to a stored procedure, which always returns a string: empty string if the data was saved, or a message stating what the problem was if not. cfset allReturnMessages = cftransaction cfloop cfset returnMessage = someCFC.saveDataToDatabase() cfset allReturnMessages = allReturnMessages returnMessage br /cfloop cfif len(trim(allReturnMessages)) cftransaction action=rollback / /cfif /cftransaction I'm not including cftry in this example, just to illustrate that I'm not looking for a database or other type of CF error per se - rather, I'm looking for any return message from the stored proc that isn't an empty string, such as sorry - everything is otherwise kosher, but this stored proc is coded not to save the data if field x is above value y. That's not a database error as far as CF is concerned, so cftry wouldn't catch it. But in testing this code, I've found that the rollback doesn't take place, even when the cfif statement is true. Am I not using cftransaction correctly? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329092 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: cftransaction
Good catch - you're right; I would normally include a cfif to append the return string and the br to allReturnMessages only if the return string isn't empty. The stored proc was written by someone else, so I'm not 100% sure what's happening with it, which is part of the problem. I suppose what I should be asking is - is it even possible to do what I'm trying to do? Which is, loop over a variable number of records to be saved or updated, and after the loop has finished, test to see if ANY of them have gotten a positive-length string back from the proc, and if so, rol lback ALL of them? ~| Want to reach the ColdFusion community with something they want? Let them know on the House of Fusion mailing lists Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329102 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
You've gotta love this bit of code: REreplace(arguments.strInputString,(.)(.),\1#arguments.strDelimiter#\2#ar guments.strDelimiter#,ALL) lol Oh come on, that's funny! :OD Yeah, I know. :) I haven't added regex to my knowledge repertoire yet, so I just modified the code snippet offered in the third post (#REreplace(list,(.)(.),\1,\2,,ALL)#). Mine's not as pretty as it could be, but is a vast improvement from my original function. I created a string 360k chars long for testing - this function processed it 9 times faster than my old function (which loops through every char in the string). ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320755 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
I'd be interested to know how the code I suggested performs in comparison to the regex with the 360k string - in theory it outperform it: cfset myList = ArrayToList( myString.toCharArray() ) / Running on CF8, I used cftimer to test execution time on a string 360K long (all alphanumerics, just alphabet appended with 1 to 0 and concatenated 10,000 times). No cfdump or output; just a cfset statement. My original function - over 60 seconds, times out. this.s**tCan(). ArrayToList( myString.toCharArray() ) - 188 ms StringToDelimListRE() (the one with the ASCII breasts (Hah, I missed that)) - 172 ms listFromChars() - 125 ms I'm not 100% positive on which ones will/will not accept non-alphanumerics in the string; didn't test for that in all cases. Anyone else care to time these out? In any ase, there's something to be said for using only 1 line of code - well worth the price of a few millseconds in my book, so long as I don't have to run this process on War Peace... ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320765 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: String to List?
I just noticed that listFromChars() is essentially 1 line of code, also. My bad... Bottom line for me is to learn regex and more Java! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320766 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
String to List?
Disclaimer - I haven't had to do any fancy string manipulation in a while... I had thought that ANY string can be treated like a list (for example, such that abcdef can be treated as a list containing six elements and a delimiter of ). Not so, I recently discovered when I tried to use listChangeDelims(abcdef, ,, ). I wanted to input abcdef and get a,b,c,d,e,f returned, but CF doesn't recognize an empty value as a valid delimiter for any of its list functions...and it doesn't accept an empty value as the second argument in replace(), either. So I wrote a function that'll do what I want, taking a string and the desired delimiter as arguments, then looping through each character in the string and inserting the delimiter after it (except for the last character in the string). But as one might imagine, it's SLOW for very long strings. String and list manipulation is kid stuff, or so I'd thought...surely there's a faster, simpler means? ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320709 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: String to List?
Thanks all! Good stuff all around...really must get myself locked onto regex one of these days :). I came up with this: cffunction name=stringToDelimListRE access=public returnType=string output=false hint=Takes a string argument and inserts the second argument between each character. Using reg ex, is much, much faster than the original looping function. cfargument name=strInputString type=string required=yes cfargument name=strDelimiter type=string required=no default=, cfset var strNewList = !--- account for empty string as input string --- cfif arguments.strInputString EQ cfreturn /cfif !--- account for empty value of strDelimiter --- cfif not len(arguments.strDelimiter) cfset arguments.strDelimiter=, /cfif cfset strNewList=REreplace(arguments.strInputString,(.)(.),\1#arguments.strDelimiter#\2#arguments.strDelimiter#,ALL) !--- Get rid of 'hanging' delimiter at end of list --- cfset strNewList=mid(strNewList,1,len(strNewList)-1) cfreturn strNewList /cffunction ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:320734 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Recursion to retrieve blog thread - help please
I feel I should know how to do this, but I haven't really had to write a function like this yet. We have a blog site where, currently, users can post entries to their own respective blog, and replies can be made to that entry. Entries are kept in an entries table, and replies are kept in a replies table. Each reply belongs to a parent entry, so entryId is a foreign key within the replies table. I've been tasked with modifying the site so that replies can be made to replies, so you can have multi-level threads. I've done this, by adding parentReplyId as a column in the replies table. Each reply still has the entryID of the entry that ultimately started the thread to which it belongs, but now parentReplyId gives additional info - if this is null, then the reply is a top-level reply, made to an entry directly, and if it is not null, then the reply has been made to another reply. Now it comes down to writing a cfc function that will retrieve an entry's reply nodes in the correct order, following each reply down the tree until it dead ends and then continuing on at the next level up (I'm sure there's a more technical term for this type of structure). So ultimately I'll be able to display reply A on the page with its child replies indented below it, and any of their child replies further indented below them, etc., until there are no more and its on to reply B...like how you see replies displayed on Daily Kos and Livejournal. I'm really not sure how this is typically done in a CFC function, or if I'm best off with returntype query, or returntype array, or if maybe this can be done in a single SQL query. But I've a strong feeling that it's done with recursion. Help please? Thanks, Christophe ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314869 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Recursion to retrieve blog thread - help please
Thank you very much - this works beautifully! ~| Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to date Get the Free Trial http://ad.doubleclick.net/clk;207172674;29440083;f Archive: http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314889 Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Re: Preventing cache in IE with cfheader
Instead of messing with HTTP headers, just append a random variable to the image URL: img src=image.gif?638232 / Jochem Thanks! Works perfectly. The developer I work with points out that sometimes you might want the image cached unless it has been updated, and the solution to that is saving the modification date of the image in the DB, and outputting that to the image url as an integer. To express a date in integer form, we typically use the number of seconds that have passed between a fixed date in the past and the date in question. So, img src=image.gif?#datediff('s', application.startDate, getImageQuery.lastModificationDate)# /. Christophe ~| Upgrade to Adobe ColdFusion MX7 Experience Flex 2 MX7 integration create powerful cross-platform RIAs http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJQ Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276951 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Preventing cache in IE with cfheader
I'm having trouble getting IE not to cache image files on a particular page. I have a page where image files can be uploaded and overwrite existing files (similar to a Myspace type page that displays your picture; you can upload another gif or jpg via form field, submit, and then page refreshes). The file uploads, but the browser is still caching; the refreshed page still shows the old image file. In order to prevent browser caching of image files, I've used cfheader name=Expires value=#GetHttpTimeString(Now())#, and also added cfheader name=Pragma value=no-cache cfheader name=cache-control value=no-store for good measure. Firefox seems to respond to this, but not IE(7). Am I doing something wrong, or is IE just a less than optimal browser? ~| Deploy Web Applications Quickly across the enterprise with ColdFusion MX7 Flex 2 Free Trial http://www.adobe.com/products/coldfusion/flex2/?sdid=RVJU Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276812 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Re: Preventing cache in IE with cfheader
I'm having trouble getting IE not to cache image files on a particular page. I have a page where image files can be uploaded and overwrite existing files (similar to a Myspace type page that displays your picture; you can upload another gif or jpg via form field, submit, and then page refreshes). The file uploads, but the browser is still caching; the refreshed page still shows the old image file. In order to prevent browser caching of image files, I've used cfheader name=Expires value=#GetHttpTimeString(Now())#, and also added cfheader name=Pragma value=no-cache cfheader name=cache-control value=no-store for good measure. Firefox seems to respond to this, but not IE(7). Am I doing something wrong, or is IE just a less than optimal browser? Further puzzling - the info on following post didn't seem to help... http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:50692 ~| Macromedia ColdFusion MX7 Upgrade to MX7 experience time-saving features, more productivity. http://www.adobe.com/products/coldfusion?sdid=RVJW Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:276832 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Passing a query string as a single url variable
Trying to pass a custom query string to a template through the URL, example (assume all inside cfoutput tags): cfset qrystr=name=Janeeyes=brownhair=blondnumber=2125551234 Here is the qrystr encoded: #URLEncodedFormat(qrystr)#br a href=http://www.hfdkldf.com/main.cfm?action=saveinfoqrystr=#URLEncodedFormat(qrystr)#save her info/a Testing this out, I'm seeing that the second line's output indeed shows qrystr with = and replaced by %3D and %26, respectively. However, when I mouseover the link on line 3 and look at the URL in the status bar, I see the link's url does not have qrystr encoded. So, the receiving template is going to see qrystr only as name=Jane, and not the full string. How can I pass qrystr in the URL so that it remains encoded and will be received with it's complete value? I could use the replace function to custom encode qrystr myself, and then decode it at the receiving template, but I thought the whole point of a function like URLEncodedFormat was to avoid having to do that. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:241622 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
cfhttp and tab-delimited
If I have a tab-delimited text file I want to make into a query object using cfhttp, how should I enter the value for the delimiter attribute in the cfhttp tag? The O'Reilly book demonstrates how to write it for comma-delimited: cfhttp URL=http://...file.txt; name=myquery delimiter=, textqualifier= But not for tab-delimited. Also, if each row in the file ends with carriage return, do I need to use a special value for the textqualifier attribute? ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236065 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: cfhttp and tab-delimited
Thanks! ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:236080 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: maintaining state in multipage form
It sounds like a session variable containing an array of checkboxes and their selected values might be in order. Assuming the user has cookies enabled (or if you pass the session tokens on the URLs) this should be fairly simple to implement. -Justin I'd considered using a session var, but then it occurred to me that there's no way to save the checked values to a session list or array until the submit button has been clicked. I could start on page 1, check a few boxes, and then click on the link for page 2 (or 3 or 4). At that point, page 1's checked boxes have been forgotten. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235191 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: maintaining state in multipage form
True, but then the user needs to be able to go back to any form page they've been to, uncheck boxes if they want, and have those values effectively removed from the session array... ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235201 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: maintaining state in multipage form
Think I might have the solution - in the session array or list, save each element in the list as [widgetid]|[pagenumber]. Submit each page to the next, appending the session var with the checked widgets' ids, but first REMOVE all widgets from the list that have the submitting page's number. That way, widgets remain in the session var if and only if they are still checked (I'm overwriting the page's contents with each submission, for all intents and purposes.) Thanks much- I'll post again on how well it works... ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235217 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: maintaining state in multipage form
The only problem with that is that the form isn't linear; in addition to to the previous page/next page links, each page has a direct link, so the user can go straight to page 56 if they don't want to have to click next page 55 times. But you're right; the bottom line is that each click needs to result in the page's form vars being passed to the next page, which means either 56+ submit buttons or maybe some kind of onClick=form.submit() mechanism. It's a little simpler since I'm dealing only with checkboxes (all have the same name), so I get a comma-delimited list with each submit without having to do a loop, but then the question is how to remove widget IDs from the cumulative list if the user goes back and unchecks them. E.G., user goes to a page and checks the boxes for widgets 42, 44, and 61. Later they go back to that page, uncheck widget 42, and visit another page. Widget 42 has been unchecked, but it still hasn't been removed from the cumulative list, because unchecked checkboxes submit nothing. Hence my idea to create a list or structure that looks like widgetID|pagenumber, widgetID|pagenumber, widgetID|pagenumber... with each submission, first remove all elements from the cumulative list that have pagenumber=submitting page's pagenumber, and then append the received widget IDs currently being passed. ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235273 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
maintaining state in multipage form
I've taken over a web application where at one point, the user has a long list of items to choose from to be compared to one another. Each product has a checkbox next to it, and after checking off those products the user wants to see, the user submits the form and views a comparison table. This would be simple if the form were all on one page, but it's not. Since there can be potentially be a lot to choose from, the form is codes to display only 30 or so items at a time. There's hyperlink navigation at the bottom of the page to go to next/previous page, or to go to page x, in order to see other items. Clicking on any of these links executes a new request and the previous page's checkboxes lose their state. So right now the user can only compare items if they happen to be listed on the same page in the same group of 30. I need the user to be able to check boxes on any page and jump around to other pages of the form, checking or unchecking as they want, and have the form maintain it's overall state for when they finally submit. Any leads on where I can get some tips on how to do this? Thanks, Christophe ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:235161 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
cfgraph problem
This is a troublesome problem Iâm having with Cfgraph (using CF 6.1). Iâm thinking that the root of the problem may be that Iâm trying to create a graph that has 2 scale axes, rather than 1 scale axis and 1 item axis. In any event, Iâd greatly appreciate the help of any gurus or sub-gurus out there⦠What Iâm trying to do isnât all that complicated. Iâm basically trying to create a scatter graph, for all Manhattan rental apartments in our database, in which every apartment in the table is represented by a dot on the graph, with its x value being the rent per month, and its y value being the apartmentâs number of bedrooms. So the query âget_aptinfoâ returns something like: Aptnumbdrm Rent 0.0 1000 0.0 1095 1.0 1100 1.0 2000 1.5 2300 2.0 2495 âAptnumbdrmâ is the column in the table that holds the apartmentâs number of bedrooms, which is (almost) always within the range of 0 (for studios) to 5, in steps of 0.5. So, 0, 0.5, 1.0, 1.5, 2.0, etc. In the rare case that the number of bedrooms exceeds 5, itâs still of a value x.0 or x.5. âRentâ is the column that holds the apartmentâs rent per month in dollars (which can be any integer value between 1,000 and 40,000. What Iâm running into is this â setting rent on the x axis, and number of apartments on the y axis, the x axis doesnât render in proper order (even though the query is set to order by rent and thereâs a âsortxaxis=yesâ parameter in the cfchart tag) : cfchart sortxaxis=yes format=flash chartheight=600 chartwidth=750 scalefrom=0 scaleto=5 gridlines=11 labelformat=number xaxistitle=Rent per Month yaxistitle=No. of Bedrooms show3d=no cfchartseries type=scatter query=get_aptinfo itemcolumn=rent valuecolumn=aptnumbdrm serieslabel=Price and No. of Bedrooms for Rentals in Manhattan seriescolor=red paintstyle=plain markerstyle=triangle / /cfchart I tried switching the x axis and y axis so that rent is the valuecolumn and aptnumbdrm the itemcolumn, but that doesnât help. In that case, the x axis is still out of order, and now all points with 0 BR, 0.5 BR, etc. are overlayed as though they have the same x and y values when they in fact donât. Now, hereâs where it really gets screwy â when I try to overlay 2 datasets (e.g., all rental apartments in Manhattan that have brokerâs fees for the renter, and all rental apartments in Manhattan that do not). Like this: cfchart sortxaxis=yes format=flash chartheight=600 chartwidth=750 scalefrom=0 scaleto=5 gridlines=11 labelformat=number xaxistitle=Rent per Month yaxistitle=No. of Bedrooms show3d=no cfchartseries type=scatter query=get_fee_aptinfo itemcolumn=rent valuecolumn=aptnumbdrm serieslabel=Price and No. of Bedrooms for Rentals in Manhattan seriescolor=red paintstyle=plain markerstyle=triangle / cfchartseries type=scatter query=get_nofee_aptinfo itemcolumn=rent valuecolumn=aptnumbdrm serieslabel=Price and No. of Bedrooms for No Fee Rentals in Manhattan seriescolor=green paintstyle=plain markerstyle=circle / /cfchart In this case, same problem. The x axis is not in order, and the increments arenât to scale, either (e.g., goes from a hash at 1095, to a hash at11950, to a hash at 1300â¦) So, am I doing something wrong? Is there any way to accomplish what Iâm trying to do using cfgraph? Thanks, Christophe ~| Message: http://www.houseoffusion.com/lists.cfm/link=i:4:232161 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
Trouble connection to local database
I'm trying to set up a local dev/testing environment on my PC, using CFMX 6.1 and SQL Server 2000 (both installed on my local box). I've got the correct un and pw for CF to get into the database, but each time I try to set the DSN in CF administrator, it gives me an error saying: Connection verification failed for data source: Localdb []java.sql.SQLException: [Macromedia][SQLServer JDBC Driver]Error establishing socket. Connection refused: connect The root cause was that: java.sql.SQLException: [Macromedia][SQLServer JDBC Driver]Error establishing socket. Connection refused: connect Which sounds like it isn't a un/pw problem, but an outright refusal of SQL server to allow the CF app server any connection at all. Am I overlooking something? In CF admin, the info for the DSN is simple - data source name is localdb, name of the database in SQL is localdb, server is localhost, un is sa, and pw has been entered correctly. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222111 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: Trouble connection to local database
Forgot to add, after you do the Service Pack, get the latest updates from Macromedia especially the macromedia_drivers.zip. Sorry do not remember which HotFix it was. Thanks! Looks like DLing and installing Servce Pack 4 was all I had to do - SQL Server DSNs in CF are connecting and validating fine now. ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:222138 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
Get character in string at position X?
I can do this in Javascript, but I've been through the index of my CF book and haven't found the a CF function that will return the character at position X in a given string. (I tried treating the string as a list, using the listGetAt function and specifying as the delimiter, but CF balked at that...) Can anyone help me out? Thanks! ~| Discover CFTicket - The leading ColdFusion Help Desk and Trouble Ticket application http://www.houseoffusion.com/banners/view.cfm?bannerid=48 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213141 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: Get character in string at position X?
I can do this in Javascript, but I've been through the index of my CF book and haven't found the a CF function that will return the character at position X in a given string. (I tried treating the string as a list, using the listGetAt function and specifying as the delimiter, but CF balked at that...) Can anyone help me out? Thanks! Of course I find something right after posting...looks like the Mid function does this. Any other practices to suggest? Thanks! ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:213143 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
CFMX and memory Leaks
I have ColdFusion MX and SQL Server 2000 running on the same WIN 2003 Server. We run a pretty query intensive site, and we've had problems with SQL Server memory leaks for a long time which I'd really like to clean up so we don't have to stop and restart SQL Server every 24 hours...Stopping and restarting SQL Server reset it, but looking at the performance monitor over the course of 24 hours, you can watch the total SQL server server memory creeping up toward the target server memory until it maxes out and the site slows waaay down I've been told that this has to do with our site's code, specifically SQL queries, and I'm trying to educate myself on what the best coding practices are to prevent these leaks. I'm not sure where to start - I've always tried to build efficient queries, and follow proper cflocking practices, but I inherited this site, and I'm not even sure what kinds of bad coding would cause SQL server leaks. Can anyone give me some tips, or point me in the right direction? Thanks... ~| Find out how CFTicket can increase your company's customer support efficiency by 100% http://www.houseoffusion.com/banners/view.cfm?bannerid=49 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:197553 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
cfhttp - connection refused
I have a template that accesses another local template through cfhttp: cfhttp url=http://www.mysite.com/directory/session_tracker_update.cfm; method=post cfhttpparam type=formfield name=yes value=no /cfhttp cfset get_sessions = #cfhttp.filecontent# And then displays #get_sessions# a few lines down. It used to be that cfhttp.filecontent came back as a number, but ever since last night (when we had a firewall installed) it's coming back as connection refused. I figure probably has something to do with the firewall blocking a port somewhere, but I don't understand why the cfhhtp request is being refused. Does cfhttp use some obscure port? Note, from my browser here at the office, I can connect to http://www.mysite.com/directory/session_tracker_update.cfm just fine, and the browser displays the number I'm looking for... ~| Logware (www.logware.us): a new and convenient web-based time tracking application. Start tracking and documenting hours spent on a project or with a client with Logware today. Try it for free with a 15 day trial account. http://www.houseoffusion.com/banners/view.cfm?bannerid=67 Message: http://www.houseoffusion.com/lists.cfm/link=i:4:191955 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