Solved

Have to simulate Cfquery load times and cfflush isn't working!!! Thoughts?

Posted on 2014-02-10
4
342 Views
Last Modified: 2014-02-12
Hey guys -
I have to build a interactive loading bar to show page loads while various cfquery scripts run.  My goal was to use cfflush to break up the queries and run a javascript to update the loading bar.  For whatever reason, the whole page is just churning and then running all of the code at the end.  Here's my script (nprogress is the loading bar function I'm using, start() starting it, inc() increasing it):

  <script>
    NProgress.start();
 </script>


 BLA BLA
 <cfflush>

 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>

 
  <script>

NProgress.inc();
 </script>

 <cfflush>
 
 
 <BR><BR>adfajdlfkajsdflk
<cfquery datasource="MOLMS">
SELECT GETDATE() CurrentTime
WAITFOR DELAY '00:00:05' ---- 5 Second Delay
SELECT GETDATE() CurrentTime 
</cfquery>


  <script>

NProgress.inc();
 </script>

Open in new window


Any thoughts on why cfflush isn't dumping data?  Obviously the queries are fake, but since the time delay is happening on the SQL side, this is more or less the exact way the page would load if it was real data.  


Thanks!!
0
Comment
Question by:milestonetech
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 25

Expert Comment

by:dgrafx
ID: 39850261
try putting the following before your script & flush:

<cfoutput>#repeatString(" ", 73729)#</cfoutput>
<script>NProgress.inc();</script>
 <cfflush>
0
 

Author Comment

by:milestonetech
ID: 39850817
thanks for the response dgrafx, no luck man....
0
 
LVL 25

Accepted Solution

by:
dgrafx earned 500 total points
ID: 39851224
you should have some form of success
it may be your script NProgress.inc - i don't know what code you're using in it ...

here is a proof of concept

First run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

Then run this:
<cfloop from="1" to="10" index="ii">
      #getTickCount()#<br /><br />#repeatString(" ", 73729)#
      <cfthread action="sleep" duration="100" />
      <CFFLUSH>
</cfloop>
</cfoutput>
Done
<CFABORT>

The only difference is the use of repeatString which adds content so there is something to flush.
btw - the cfthread is acting as a time waster so as to test flushing.

let me know ...
0
 
LVL 25

Expert Comment

by:dgrafx
ID: 39854012
Thanks for the points!

I'm hoping this was of value to you and you didn't just accept for general purposes ...

Good Luck!
0

Featured Post

The Ultimate Checklist to Optimize Your Website

Websites are getting bigger and complicated by the day. Video, images, custom fonts are all great for showcasing your product/service. But the price to pay in terms of reduced page load times and ultimately, decreased sales, can lead to some difficult decisions about what to cut.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question