473,804 Members | 4,181 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Indeterminate progress bar

13 New Member
Hi Guys

I need some help making a javascript progress bar. It can be a GIF image too and not so complex code is required. I am giving a sample code below and try to explain what I need.

<!-- Page1 code -->

[HTML]<html>
<body>
<form action="sec_tes t.php" method="post">
Enter the website address:
<input type="text" name="Path">
<input type="submit">
</form>
</body>
</html>
[/HTML]
<!-- Page2.php -->

Expand|Select|Wrap|Line Numbers
  1. <?php
  2. $r=$_POST["Path"];
  3. $output=`tracert $r`;
  4. echo "<pre>";
  5. echo $output;
  6. echo "</pre>";
  7. ?>
What I need help with is that. All progress bars I have found in javascript have a specific timeout condition. But in my case, it is indefinite. Say if the user enters www.google.com, then the time it takes will vary from the time it would take to tracert www.yahoo.com. My actual code is more complex than this and might take 5 - 30 mins to load also. So I need some condition which tells that before the page loads and displays the result in Page2, it should display the loading bar and once the results are displayed, the loading bar should disappear. It can be a GIF image or a proper progress bar or anything for that matter. Could someone please give me some directions. I am fairly new to development and any help will be much appreciated. Its urgent too, kindly reply asap.

Thanks!!!


If javascript is not the right thing I should be working on, please let me know :)
Nov 8 '07 #1
21 8123
mrhoo
428 Contributor
did you say 5 - 30 minutes?
Nov 8 '07 #2
techieGirl
13 New Member
did you say 5 - 30 minutes?
PS: Tracert is just an example to replicate the problem that I am facing.

I am using a tool like Nessus through command line on Windows. It might take 5min to run a scan or may take 30min also, depending on the user input. I have done all the processing and it works fine. It runs the scan and displays the output too. However, there is a very long delay and Page1 seems to be halted for quite a long time.

But the problem is, even if I write a loading bar script in Page2, it will not display the loading bar until command prompt has finished processing and returns the result. This has been done using backticks in PHP

Expand|Select|Wrap|Line Numbers
  1.  
  2. $output=`tracert www.xyz.com`
  3.  
  4.  
or I can do it using Windows Scripting Host (WSH) too using the code below.

Expand|Select|Wrap|Line Numbers
  1.  
  2. $WshShell = new COM("WScript.Shell");
  3.   $ret="tracert.bat";     //batch file has the command --> tracert www.xyz.com
  4.   $oExec = $WshShell->Run($ret, 7, true);
  5.   break;
  6.  
  7.  
I am actually fine by just displaying some text saying... "Your Scan is running, please wait..."

Does not need to be a progress bar necessarily but I think I will be able to figure it out myself. Just need a tip from someone how this text can be displayed when I submit the website address and before the tracert is complete. Also, how to make it disappear when tracert returns its output.

Should I have some onunload javascript on Page1 instead of having it on Page2 onload, which can process tracert command in command prompt and then call Page2.php so that I can display the results. I am open to all options if I can display some progress indicator between the two pages.

Thank you in advance!
Nov 8 '07 #3
techieGirl
13 New Member
I don't know if anyone read my question. But I don't need it now. I think its late for the answer. Thanks :)
Nov 9 '07 #4
techieGirl
13 New Member
I don't know if anyone read my question. But I don't need it now. I think its late for the answer. Thanks :)
Hi All

Luckily I have again got some time to work on it. Can anyone please help?

Thanks...Your help will be much appreciated.
Nov 13 '07 #5
acoder
16,027 Recognized Expert Moderator MVP
You can display an image that could already be present on the page, e.g.
[HTML]<img id="image" src="progress.g if" style="display: none">[/HTML] The style setting hides the image. Once you are ready to show it, set the display property to "block" or "inline", e.g.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("image").style.display = "block";
Nov 13 '07 #6
techieGirl
13 New Member
You can display an image that could already be present on the page, e.g.
[HTML]<img id="image" src="progress.g if" style="display: none">[/HTML] The style setting hides the image. Once you are ready to show it, set the display property to "block" or "inline", e.g.
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("image").style.display = "block";
Thanks for your reply. Displaying the image is not a problem but it displays the image after the command tracert is finished. Because tracert processing takes control from the web page and does not let any other command execute before it has finished processing.

I will be trying some Flash preloaders I think. Thanks for replying for my query.

Thanks!!!
Nov 16 '07 #7
acoder
16,027 Recognized Expert Moderator MVP
So why not display the image before the tracert command is executed?
Nov 16 '07 #8
techieGirl
13 New Member
I am sorry if this is an annoying one. If you try to run the command and make two php files doing this, you will notice that as soon as the user clicks Submit website address, the form gets submitted and the control is taken over by tracert command. Backticks function

[PHP]
`tracert www.xyz.com`;
[/PHP]

This command is similar to

[PHP]
$WshShell = new COM("WScript.Sh ell");
$tra="tracertCh eck.bat"; //command for tracert www.xyz.com
$oExec = $WshShell->Run($tra, 7, true);
[/PHP]

What this code does is - it says on the Page 1 and does not load the tracert results until the command is finished. Also, it immediately passes the control to the command (or runs the batch file).

I even tried to make it from TRUE to FALSE but what that does is that it passes the control to Page2 immediately and starts exexuting the rest of the code on that page and there is no means left to track whether cmd has finished processing or not.This leads to another problem since I am using a database in the backend which fetches the results from SQL Server 2005. And I have SQL queries written on that page2. It starts executing the SQL queries at the same time resulting in incorrect results. And there is no place like - after submitting the Page1 and before executing Page2.

I admit it is difficult for me to explain the situation but I would like to ask you a favour please. Please try to run it. It will make sense to you what I am saying.

If I put a progressing.gif on Page 2, it will not display it until the command has finished processing and IE stays on Page 1 itself.

Thank you for trying to help me. If I get a solution, I will post it.

Regards.
Nov 18 '07 #9
acoder
16,027 Recognized Expert Moderator MVP
How about putting the progress image on page 1 and displaying that as soon as submit is clicked?
Nov 18 '07 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
1268
by: Jakob Bieling | last post by:
Hi, in a post from 1995 ('why pass references?') in this group, Steve Clamage said reading the value of an indeterminate pointer (no dereferencing taking place) is undefined behavior. While I am in no doubt about this, I could not find it in the Standard. Apart from the fact that I did not know where to look, the search function did not turn up anything useful. Can somebody please provide a page/paragraph number? Thanks!
19
2706
by: Holger Hasselbach | last post by:
- The value of the object allocated by the malloc function is used (7.20.3.3). - The value of any bytes in a new object allocated by the realloc function beyond the size of the old object are used (7.20.3.4). Something like this (include and checkings omitted): p = malloc(sizeof(*p) * 5); p = 1; p = 1; p = 1;
3
1997
by: Mantorok Redgormor | last post by:
In this context would an indeterminate value lead down the path to undefined behavior? (void)foo->member; I want to keep my interface consisent in my program so I have this one function which is passed an argument that it doesn't need. So I can only think of using it this way as a viable method
2
1235
by: Brett | last post by:
If I have a certain process that will require an indeterminate amount of time to complete, how should I handle that on my progress bar? Would I just start over once the bar reach the end? Thanks, Brett
1
4121
by: daniel_xi | last post by:
Hi all, I am running a VS 2003 .NET project on my client machine (Win 2000 SP4, ..NET framework 1.1), running an ASP.NET application on a remote web server (Win 2000 Server, IIS 6.0, .NET framework 1.1). The application implements a Progress Bar webcontrol, that pops up in a window, using the HttpHandler interface, on the event of a button click. The handler's process request routine reads the status of the progress by querying the...
1
2273
by: Rajarshi | last post by:
Hi, I have a web application built using mod_python.Currently it behaves like a standard CGI - gets data from a form, performs a query on a backend database and presents a HTML page. However the query can sometimes take a bit of time and I'd like to show the user some form of indeterminate progress indicator (spinning dashes etc). My searching seems to indicate that this is based on some form of asynchronous calls (AJAX) and I'm not sure...
0
899
by: veerbala82 | last post by:
Hi, I am having a problem that I have been trying to solve for the last 2 weeks. This might be seen in many travel sites like lastminute.com. The situation is simple. I need an indeterminate progress bar. I enter the search criteria/parameters (From/To Date & Destination) in page ‘A’. I click the search button now. I need to be transferred to Page ‘B’, which is empty but consists of a progress bar like image displaying any message and then I...
1
4641
by: Silgd1 | last post by:
Hi All..... I am using netbeans 6.1 to create a web application(visual web jsf pages). I have a heavy task I need to run, so I run the task in a separate thread which is started from a button_action. Once the button is clicked, it sets visible a woodstock component progress bar(Indeterminate) to show the heavy task is running. The problem I am having is try to get the progress bar to "disappear" once the heavy task has completed and the...
1
8343
by: Silgd1 | last post by:
Hi All..... I am using netbeans 6.1 to create a web application(visual web jsf pages). I have a heavy task I need to run, so I run the task in a separate thread which is started from a button_action. Once the button is clicked, it sets visible a woodstock component progress bar(Indeterminate) to show the heavy task is running. The problem I am having is try to get the progress bar to "disappear" once the heavy task has completed and the...
0
9706
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10575
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10330
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9144
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7616
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5520
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4297
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2990
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.