Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / April 2007

Tip: Looking for answers? Try searching our database.

Dealing with delay in processing

Thread view: 
Doogie - 12 Apr 2007 14:45 GMT
Hi,
I am trying to modify an ASP 3.0 app and am running into an issue.
Essentially the part that I'm modifying queries the database and
returns a record count.  This part is done using
"Microsoft.XMLHTTP".

The call to the database has a very slight delay (not sure if it's
cause of our code or the Microsoft object).  But the app does not
wait
for the data call to return before processing the rest of the
functionality in the method.  So my check on the record count is
always 0, even though sometimes there are records in there (because
the variable I assign the record count to does not get set before the
check on that variable is done).

I have been looking at ways to pause apps in java and came across
setInterval and clearInterval.  But that is not working like I'd
expect.  Here's what I'd like to do:

1.  Call my db method (where the record count variable is assigned).
2.  Use setInterval to wait until that record count variable is
actually set.
3.  Proceed with my code.

I may not understand how the set and clear interval methods work so
am
posting some of the code.  This code has two problems:
  1.  It does not clear out the interval like I'd expect - it's as
if
the interval value is different each time (which make sense but I'm
not sure how to set it up to perform that work I put in the check
detail count method otherwise):
  2.  It runs the CompleteInvoice piece without waiting on the
setInterval piece to stop.  So I'm still in the same boat as before.

Any help would be greatly appreciated!

function CallComplete()
{
   var numberOfInvoiceRows =
spnTableDisplay.firstChild.tBodies[0].rows.length

   for(var index = 0; index < numberOfInvoiceRows; index++)
   {
       g_TotalDetailRows = -1   --THIS IS MY RECORD COUNT VARIABLE
       var rowObj =
spnTableDisplay.firstChild.tBodies[0].rows[index]
       GetDetails(rowObj)  --INSIDE THIS METHOD THE RECORD COUNT
VARIABLE IS SET
       vendorType =
rowObj.cells[2].children("txt_VENDOR_TYPE_AN").value
       interval = setInterval("CheckDetailCount()", 1000)
   }

   CompleteInvoice()

}

function CheckDetailCount()
{
   if (g_TotalDetailRows != -1)
   {
      clearInterval(interval)
      if (g_TotalDetailRows < 1)
       {
          alert("The invoice row for vendor type '" + vendorType +
"'
does not have a detail row.")
          return
       }
   }
Lew - 12 Apr 2007 15:07 GMT
> Hi,
> I am trying to modify an ASP 3.0 app and am running into an issue.

This is a Java newsgroup.

> Essentially the part that I'm modifying queries the database and
> returns a record count.  This part is done using
> "Microsoft.XMLHTTP".
> ...
> I have been looking at ways to pause apps in java and came across

You show us no Java.  This is a Java newsgroup.

> setInterval and clearInterval.  But that is not working like I'd
> expect.  Here's what I'd like to do:
[quoted text clipped - 6 lines]
> am
> posting some of the code.  This code has two problems:

It's not Java, and this is a Java newsgroup.

> function CallComplete()

This is not Java syntax.

> {
>     var numberOfInvoiceRows =

Not Java syntax.

> spnTableDisplay.firstChild.tBodies[0].rows.length
>
>     for(var index = 0; index < numberOfInvoiceRows; index++)
>     {

Sorry.  You are not using Java.

Signature

Lew

Doogie - 12 Apr 2007 15:42 GMT
Thanks for the help. :)

what is the difference between java and java script (for my
information)?
Andrew Thompson - 12 Apr 2007 15:52 GMT
..
>what is the difference between java and java script..?

Chase the links..
<http://www.physci.org/codes/javafaq.html#js>

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Lew - 13 Apr 2007 02:39 GMT
Doogie wrote:
> .
>> what is the difference between java and java script..?

Basically, they are just different languages, like, say, BASIC and FORTRAN.
Or PHP and Ruby.  Or SNOBOL and COBOL.

Briefly, Javascript is a (primarily) client-side scripting language with
dynamic typing and no compilation phase.  Java is a full-bore, strongly-typed
object-oriented computer language that has a compilation phase.  Typically,
Javascript runs directly in a user's browser on the client machine.  Java code
runs just about anywhere, in or out of browsers, client or server.

Signature

Lew

Andrew Thompson - 13 Apr 2007 03:15 GMT
..
>..Java is a full-bore, strongly-typed
>object-oriented computer language that has a compilation phase.  Typically,
>Javascript runs directly in a user's browser on the client machine.  

I always find it odd when people mention that Java
is an OO* language, but fail to mention that ..so is
JavaScript!

(*Though admittedly, your OO comment was immediately
preceded by *strongly* *typed*, whereas JS is not strongly
typed, so perhaps I am reading too much into the mention
of 'OO'.)

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Lew - 13 Apr 2007 05:07 GMT
Lew wrote:
>> Java is a full-bore, strongly-typed
>> object-oriented computer language that has a compilation phase.    

> I always find it odd when people mention that Java
> is an OO* language, but fail to mention that ..so is
[quoted text clipped - 4 lines]
> typed, so perhaps I am reading too much into the mention
> of 'OO'.)

Javascript does support a flavor of object manipulation.  I consider it not
enough to represent the orientation of the language.  Java is almost so
object-oriented you'd have to call it an "object-obsessed" language.
(Autoboxing is Java's way of covering its embarrassment at having primitives
about.)

And, yes, I did use the phrase "strongly-typed" for Java.  You are correct
that I deem that the more significant part of that particular comparison.

My intent wasn't to comprehensively compare the languages but to provide to
the OP enough information to honor their question and to portray that the
languages are, indeed, different.

Signature

Lew

Andrew Thompson - 13 Apr 2007 05:57 GMT
>Lew wrote:
>>> Java is a full-bore, strongly-typed
>>> object-oriented computer language that has a compilation phase.    

(Andrew)
>> I always find it odd when people mention that Java
>> is an OO* language, but fail to mention that ..so is
(JS)

>Javascript does support a flavor of object manipulation.  I consider it not
>enough to represent the orientation of the language.  Java is almost so
>object-oriented you'd have to call it an "object-obsessed" language.

LOL

(snip)
>My intent wasn't to comprehensively compare the languages..

Thanks for clarifying.

Signature

Andrew Thompson
http://www.athompson.info/andrew/

Lew - 13 Apr 2007 16:56 GMT
> (snip)
>> My intent wasn't to comprehensively compare the languages..

An ellipsis comprises three period characters and should be set off by a
single space.

(Just giving you a poke in the ribs, there, Andrew.)

Signature

Lew



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.