473,657 Members | 2,556 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with delay at Javascript start

I have managed to communicate between forms and Java applets. A button
press sends the content of the text area to an applet, a second button
gets some text from the applet and puts it into the textarea.

However, at the start, there is a delay of several seconds, before any
of the buttons react to a click. After the first reaction has happened,
all further clicks work immediately.

Is this meant to be so, or can I speed up the first event handler a bit?

Jan 16 '06 #1
14 4654
Rene Grothmann wrote:
I have managed to communicate between forms and Java applets. A button
press sends the content of the text area to an applet, a second button
gets some text from the applet and puts it into the textarea.

However, at the start, there is a delay of several seconds, before any
of the buttons react to a click. After the first reaction has happened,
all further clicks work immediately.
Maybe the user agent is just busy loading the JVM or the JVM is busy loading
the applet?
Is this meant to be so, or can I speed up the first event handler a bit?


In that case, no. In fact, you should avoid using Java applets.
PointedEars
Jan 16 '06 #2
No, the applet has long started and is running perfectly. If anything
is slowly starting, it is Javascript, or at least it's connection to
Java.
In fact, you should avoid using Java applets.


You must be kidding. You don't know what I use applets for. The advise
is not appropriate, nor is it feasible.

Jan 16 '06 #3
Rene Grothmann wrote:
No, the applet has long started and is running perfectly. If anything
is slowly starting, it is Javascript, or at least it's connection to
Java.
Then you should post some code.
In fact, you should avoid using Java applets.


You must be kidding. You don't know what I use applets for.


Which is why I did say "should avoid using" and not "should not use".
The advise is not appropriate,
It is. Using Java applets has profound negative impact on load and
system performance, and another plugin is required for them to work.
nor is it feasible.


That depends on the application, of course. I did not debate that.
PointedEars
Jan 16 '06 #4
VK

Rene Grothmann wrote:
I have managed to communicate between forms and Java applets. A button
press sends the content of the text area to an applet, a second button
gets some text from the applet and puts it into the textarea.

However, at the start, there is a delay of several seconds, before any
of the buttons react to a click. After the first reaction has happened,
all further clicks work immediately.

Is this meant to be so, or can I speed up the first event handler a bit?


While DOM parsing goes relatively quickly, the initial JVM launch takes
much longer (depending on the complexity of your applet and on the
amout of custom classes to load / total .jar size if you use .jar)

If you went so far that you can communicate DOM<>Applet, then have
relevant buttons on the page as disabled="true" and extend init{}
method in applet to enable these buttons.

Jan 16 '06 #5
Since you obviously do not believe me, that the JVM has nothing to do
with it, go to the following page:

http://www.rene-grothmann.de/Test/Scripting.html

Wait until the applet has started, wait longer, wait still longer, then
press "Get". On my system, you get a 6 second delay, before there is
any reaction. After the first time, everything goes quicker.

Jan 17 '06 #6
Rene Grothmann wrote:
Since you obviously do not believe me, that the JVM has nothing to do
with it, go to the following page:

http://www.rene-grothmann.de/Test/Scripting.html

Wait until the applet has started, wait longer, wait still longer, then
press "Get". On my system, you get a 6 second delay, before there is
any reaction. After the first time, everything goes quicker.

I get a near instant response every time.

Andrew Poulos
Jan 17 '06 #7
VK

Rene Grothmann wrote:
Since you obviously do not believe me that the JVM has nothing to do
with it, go to the following page:

http://www.rene-grothmann.de/Test/Scripting.html

Wait until the applet has started, wait longer, wait still longer, then
press "Get". On my system, you get a 6 second delay, before there is
any reaction. After the first time, everything goes quicker.


Yes, because the first time JVM has to be fully initialized wich is a
rather long process. After that everything goes quicklier. As JVM
initialization is an expensive process, system usually doesn't dismiss
JVM right after page unload but keeps it for another few minutes (in
case if it's needed again).

Games to play:
1) Restart your computer and open the page with applet. Ovserve your
delay.
2) After delay disappears, close the window, count to three and open it
again. Observe that there is no delay (JVM has been kept for you).
3) Close the window and go take a cup of caffee. Come back and observe
the delay (system got tired to wait and dismissed JVM).

This is why on Java-applet-intensive sites (almost no left, but in the
past) one usually has an applet on every single page to keep JVM
running. If some page doesn't need an applet, you still insert 10px x
10px (minimum allowed size) "JVM holder" applet, wich simply renders
background in the page background color. This ensures that JVM will be
initialized only once per site visit.

Nothing to do with JavaScript though.

Jan 17 '06 #8
Thanks Andrew. So maybe it is my Firefox and its JavaScript
implementation. I checked in other Browsers (IE) and the delay is
almost non-existent.

Jan 17 '06 #9
Rene Grothmann wrote:
Thanks Andrew. So
So?

<URL:http://jibbering.com/faq/faq_notes/pots1.html#ps1P ost>
<URL:http://www.safalra.com/special/googlegroupsrep ly/>
maybe it is my Firefox and its JavaScript implementation.
Certainly not; you have to distinguish between the (ECMAScript)
language implementation and the AOM/DOM that can be accessed with it.

Probably the problem is caused by Mozilla/5.0 rv:0.9.4.1+ and its
Netscape plugin support implementation as I observe the same delay
here in

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8)
Gecko/20060110 Debian/1.5.dfsg-4 Firefox/1.5 Mnenhy/0.7.3.0

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20051007
Debian/1.7.12-1

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805
Netscape/7.2

and

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3

but not in

Opera/8.51 (X11; Linux i686; U; en)

using the same plugin version each time, Java(TM) Plug-in 1.4.2_05-b04.

That delay occurs in Mozilla/5.0 only if the JVM has not been started
before by either browser; not on uncached reload, for example. (Once
running, here the process java_vm is not terminated/killed before the
respective browser process [group] is terminated/killed.)
Regarding <URL:http://www.rene-grothmann.de/Test/Scripting.html> :
<html>
The DOCTYPE declaration is missing. <URL:http://validator.w3.or g/>
<head>
<title>Test</title>
<script language="JavaS cript">
Should be

<script type="text/javascript">

See numerous previous discussions here.
function get ()
`get' is potentially harmful as _JavaScript_ identifier since there is the
`get' keyword to define a getter:

<URL:http://developer.mozil la.org/en/docs/Core_JavaScript _1.5_Guide:Crea ting_New_Object s:Defining_Gett ers_and_Setters >
{ document.form.t ext.value=docum ent.zirkel.getS tring();
}

</script>
</head>

<body>
With the recommended changes above and below, it should be at least

<meta http-equiv="Content-Script-Type" content="text/javascript">
<script type="text/javascript">
function getValue(oInput )
{
if (getValue.o && oInput)
{
oInput.form.ele ments['text'].value = getValue.o.getS tring();
}
}
</script>
</head>

<body onload="getValu e.o = document.getEle mentById('zirke l');">
<h1>JavaScrip t Delay Problem</h1>
<p align="center">
<APPLET name="zirkel"
CODE="Test.clas s" WIDTH="200"
HEIGHT="100">
Should be at least

<applet id="zirkel" code="Test.clas s" width="200" height="100"></applet>

See also
<URL:http://java.sun.com/j2se/1.4.2/docs/guide/plugin/developer_guide/using_tags.html >
(Take into account that the scripts used there are not to be recommended as
they are.)
</p>

<p align="left">
`align="left"' is the default for this element and left-to-right text, and
therefore unnecessary to set here.

<URL:http://www.w3.org/TR/html4/present/graphics.html#a def-align>
[...]
<form name="form" onSubmit="retur n false;">
The `action' attribute is missing.

<URL:http://www.w3.org/TR/html4/interact/forms.html#h-17.3>

Following the recommendations above and below, the `name' attribute will no
longer be necessary to be set.
<p align="center">
Better than `<center>', but stylesheets should be used for presentation, not
markup. See the URI above.
<button onClick="get()" >Get</button>


The same can be achieved more compatible and without annoying users without
client-side script support

<script type="text/javascript">
document.write( '<input type="button"'
+ ' onclick="getVal ue(this);" value="Get">');
</script>
HTH

PointedEars
Jan 17 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1920
by: Chris Leonard | last post by:
Hi. I've copied some code from a book which will enable me to make a layer around a page, my aim is to do something a little more complex but this I thought would get me started. Anyway, I've run into a problem before I even start! The script works OK, it runs the image in from the left hand side quite nicely, great. Problem I have it always scrolls up to the top of the page, when the link I click maybe 2 or 3 screens below (does that...
1
1767
by: David Li | last post by:
I am having a lot of problem with following code. To start with I have a working sets of code and the top level SystemC code looks like this: ----------working main.cpp start here ------------------- #include "C:\SystemC\systemc-2.0.1\src\systemc.h" #include "stimulus.h" #include "display.h" #include "fir.h"
4
1240
by: Jonathan (Pickles) Sklan-Willis | last post by:
I need several things in HTML or Javascript. It canNOT be a server side script, it is for a standalone project in HTML ONLY! PAGE 1 is a simple blank page where there will be an on.click so that if the screen is clicked it goes to PAGE 2. There will be a delay of 3 seconds while it says PLEASE WAIT. PAGE 2 has a one line form (the form has a validation scheme and the OK button will only be able to be pressed once a certain amount of...
2
1183
by: Jonathan (Pickles) Sklan-Willis | last post by:
I need several things in HTML or Javascript. It canNOT be a server side script, it is for a standalone project in HTML ONLY! PAGE 1 is a simple blank page where there will be an on.click so that if the screen is clicked it goes to PAGE 2. There will be a delay of 3 seconds while it says PLEASE WAIT. PAGE 2 has a one line form (the form has a validation scheme and the OK button will only be able to be pressed once a certain amount of...
6
1361
by: JonH | last post by:
I have an annoying problem, that I am only recieving from IE. A user can click a drop down box and type and IE will return a result, within the select box, of a word beginning with the last letter that was pressed. If a list box holds three values : Jon, Orange, and Nancy it will jump to each one if Jon is typed. For instance, if Jon is typed. IE will jump to J - Jon, then 0 - Orange, and will end up on N - Nancy. I hope I explained it...
11
5051
by: garyusenet | last post by:
For this first time today I used the System.Diagnositcs namespace to launch a program from my c# code. The program launches OK but I have something which has completely stumped me. The SetWindowPos method does not work. If I run the code as it is presented below, app.exe launches in its own window and is displayed at the top left part of the screen. However it isn't repositioned which is what the last piece of code should do. HOWEVER if...
4
782
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I make a 10 second delay? ----------------------------------------------------------------------- There is no built-in way to pause execution in javascript such as a sleep function, but hosts usually provide a method of some form. Web browsers are designed for event driven programming and only provide the « setTimeout » and « setInterval »...
4
1519
by: STIAdmin | last post by:
Happy Holidays to all of you! This is my first time posting. I'm working on a web project and trying to get this done before Christmas. The limitation is that I'm using an out of the box program and I don't have the skills to change it quickly, and it only outputs in a structured way... so I am not able to go dig into the code of the out-of-box program and solve it. This it the first time I've really dug into JS. My JS knowledge is very...
1
1781
by: Christoph Boget | last post by:
I'm experiencing a very odd problem and it's happening only in IE6. IE7, Safari, Opera and Firefox are all working properly. What's happening is that I'm using XHR request responses to update the pages DOM, there appears to be a conflict and/or race condition that pretty much locks the browser down for several minutes until one of the requests times out. A huge red flag stands out to me from the XHR object documentation...
0
8397
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
8310
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8827
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...
1
8503
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
7333
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
6167
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
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2731
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
2
1957
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.