[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

catharinus

2/25/2011 9:49:00 AM

Helloi my friends

I want to show a html-table with more than 1000 records on an html
page. The first time I did this, it took only 3 seconds to display
this, the second time, the page didn\'t react. So there is a memory
problem. Anybody? Thanks...

I use the following statement:

<body>
<h2>LIst with words</h2>
<p></p>
<table>
<div style="overflow:auto; height:300px;width:764px;">
<a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
<a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
</div>
</table>
<br>


Catharinus
21 Answers

Helmut_Meukel

2/25/2011 12:07:00 PM

0

Catharinus formulierte Freitag :
> Helloi my friends
>
> I want to show a html-table with more than 1000 records on an html
> page. The first time I did this, it took only 3 seconds to display
> this, the second time, the page didn\'t react. So there is a memory
> problem. Anybody? Thanks...
>
> I use the following statement:
>
> <body>
> <h2>LIst with words</h2>
> <p></p>
> <table>
> <div style="overflow:auto; height:300px;width:764px;">
> <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> </div>
> </table>
> <br>
>
>
> Catharinus

How is this related to VB6?
Just curious.

Helmut.


catharinus

2/25/2011 3:06:00 PM

0

On 25 feb, 13:07, Helmut_Meukel <Helmut_Meu...@bn-hof.invalid> wrote:
> Catharinus formulierte Freitag :
>
>
>
>
>
> > Helloi my friends
>
> > I want to show a html-table with more than 1000 records on an html
> > page. The first time I did this, it took only 3 seconds to display
> > this, the second time, the page didn\'t react. So there is a memory
> > problem. Anybody? Thanks...
>
> > I use the following statement:
>
> > <body>
> > <h2>LIst with words</h2>
> > <p></p>
> > <table>
> > <div style="overflow:auto; height:300px;width:764px;">
> > <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> > <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> > </div>
> > </table>
> > <br>
>
> > Catharinus
>
> How is this related to VB6?
> Just curious.
>
> Helmut.- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Where else shoul I ask this question?
just curious...

Mayayana

2/25/2011 3:17:00 PM

0

You didn't really explain what you're trying to do.
You want to load a webpage into a WebBrowser
control? It didn't work so you conclude that there's
a "memory problem"?

You didn't say how you're loading the page. Are
you writing it to disk and then using WB.Navigate?
That should work. You can also do it dynamically,
using the DOM and the WB.Document object. Either
way, you need to watch out for
the slowdown caused by extreme string concatenation.
As the string gets bigger it slows down dramatically
because giantString & "<BR>" requires a new string
allocation bigger than giantString.


One thing is certain: Your HTML has numerous errors.
You need to write that properly before you start
troubleshooting the loading of the page. It looks like
you probably copied a snippet from somewhere. (Maybe
Microsoft? They're pages are notably messy, with lots
of empty P and DIV tags. I still don't know what <P></P>
does. I can't see an effect.) What you seem to be doing
could be done like this:

<HTML><HEAD><TITLE></TITLE></HEAD>
<BODY>
<h2>LIst with words</h2>
<div style="overflow:auto; height:300px;width:764px;">
<a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
<a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
</div>
</BODY></HTML>

But things won't line up using that method. It would
probably be better to put a TABLE *inside* the DIV.
(The DIV is only for scrolling as you have it written.)
Here's a sample that would look better:

<HTML><HEAD><TITLE></TITLE>
<STYLE>
TD {font-family: verdana; font-size: 13px;}
..TD1 {width: 50px;} /* controls width of 1st column */
</STYLE>
</HEAD>
<body>
<h2>LIst with words</h2>
<div style="overflow:auto; height:300px;width:764px; border-style: solid;
border-width: 1px;">
<TABLE WIDTH=700 CELLPADDING=3>
<TR><TD CLASS="TD1"><a href="00000001.htm">Alie</a></TD><TD>Female
Name</TD></TR>
<TR><TD CLASS="TD1"><a href="00000001.htm">Ed</a></TD><TD>Male
Name</TD></TR>
</TABLE>
</div>
</BODY></HTML>

If you set up that basic format you could
then use insertAdjacentHTML to dynamically
add each line. That may be faster than
string concatenation, and it provides a more
flexible situation for you. Once you're accessing
the DOM the page can be changed/updated in
all sorts of ways from code. (Be sure to add
a reference to mshtml.tlb so that you get
intellisense for the DOM.)

|
| I want to show a html-table with more than 1000 records on an html
| page. The first time I did this, it took only 3 seconds to display
| this, the second time, the page didn\'t react. So there is a memory
| problem. Anybody? Thanks...
|
| I use the following statement:
|
| <body>
| <h2>LIst with words</h2>
| <p></p>
| <table>
| <div style="overflow:auto; height:300px;width:764px;">
| <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
| <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
| </div>
| </table>
| <br>
|
|
| Catharinus


catharinus

2/25/2011 11:42:00 PM

0

On 25 feb, 16:16, "Mayayana" <mayay...@invalid.nospam> wrote:
>   You didn't really explain what you're trying to do.
>   You want to load a webpage into a WebBrowser
> control? It didn't work so you conclude that there's
> a "memory problem"?
>
>   You didn't say how you're loading the page. Are
> you writing it to disk and then using WB.Navigate?
> That should work. You can also do it dynamically,
> using the DOM and the WB.Document object. Either
> way, you need to watch out for
> the slowdown caused by extreme string concatenation.
> As the string gets bigger it slows down dramatically
> because giantString & "<BR>" requires a new string
> allocation bigger than giantString.
>
>   One thing is certain: Your HTML has numerous errors.
> You need to write that properly before you start
> troubleshooting the loading of the page. It looks like
> you probably copied a snippet from somewhere. (Maybe
> Microsoft? They're pages are notably messy, with lots
> of empty P and DIV tags. I still don't know what <P></P>
> does. I can't see an effect.) What you seem to be doing
> could be done like this:
>
> <HTML><HEAD><TITLE></TITLE></HEAD>
> <BODY>
> <h2>LIst with words</h2>
> <div style="overflow:auto; height:300px;width:764px;">
> <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> </div>
> </BODY></HTML>
>
> But things won't line up using that method. It would
> probably be better to put a TABLE *inside* the DIV.
> (The DIV is only for scrolling as you have it written.)
> Here's a sample that would look better:
>
> <HTML><HEAD><TITLE></TITLE>
> <STYLE>
> TD {font-family: verdana; font-size: 13px;}
> .TD1 {width: 50px;} /* controls width of 1st column */
> </STYLE>
> </HEAD>
> <body>
>  <h2>LIst with words</h2>
>  <div style="overflow:auto; height:300px;width:764px; border-style: solid;
> border-width: 1px;">
> <TABLE WIDTH=700 CELLPADDING=3>
>  <TR><TD CLASS="TD1"><a href="00000001.htm">Alie</a></TD><TD>Female
> Name</TD></TR>
>  <TR><TD CLASS="TD1"><a href="00000001.htm">Ed</a></TD><TD>Male
> Name</TD></TR>
> </TABLE>
> </div>
> </BODY></HTML>
>
>  If you set up that basic format you could
> then use insertAdjacentHTML to dynamically
> add each line. That may be faster than
> string concatenation, and it provides a more
> flexible situation for you. Once you're accessing
> the DOM the page can be changed/updated in
> all sorts of ways from code. (Be sure to add
> a reference to mshtml.tlb so that you get
> intellisense for the DOM.)
>
> |
> | I want to show a html-table with more than 1000 records on an html
> | page. The first time I did this, it took only 3 seconds to display
> | this, the second time, the page didn\'t react. So there is a memory
> | problem. Anybody? Thanks...
> |
> | I use the following statement:
> |
> | <body>
> | <h2>LIst with words</h2>
> | <p></p>
> | <table>
> | <div style="overflow:auto; height:300px;width:764px;">
> | <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> | <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> | </div>
> | </table>
> | <br>
> |
> |
> | Catharinus

Thanks Mayayana for your profound explanation.
I will search an example on the internet and try to use it for my
purpose
Thanks again
Catharinus

Mayayana

2/26/2011 4:03:00 AM

0

>
I will search an example on the internet and try to use it for my
purpose
>

I have something that does a similar operation.
I don't know how much help it would be because it's
part of a fairly complex HTA program, but the code
does use insertAdjacentHTML to dynamically create
and fill table columns. It might be worth a look.

http://www.jsware.net/jsware/ms...

If you download the MBase MSI editor you'll find
an HTA webpage program powered by VBScript.
An MSI is like an SQL database, with dozens of
tables that can have from 2 to 8+ columns and
typically has 1-100+ records per table. If you
look at the LoadTable sub in the HTA file you'll
see the code that dynamically displays the records
for a selected table, by building a TABLE tag with
a TR for each record, a TD for each column, and
then filling i the column data. It's fairly quick, even
though it's VBScript.


catharinus

2/26/2011 9:40:00 AM

0

On 26 feb, 05:03, "Mayayana" <mayay...@invalid.nospam> wrote:
> I will search an example on the internet and try to use it for my
> purpose
>
>
>
>   I have something that does a similar operation.
> I don't know how much help it would be because it's
> part of a fairly complex HTA program, but the code
> does use insertAdjacentHTML to dynamically create
> and fill table columns. It might be worth a look.
>
> http://www.jsware.net/jsware/ms...
>
>  If you download the MBase MSI editor you'll find
> an HTA webpage program powered by VBScript.
> An MSI is like an SQL database, with dozens of
> tables that can have from 2 to 8+ columns and
> typically has 1-100+ records per table. If you
> look at the LoadTable sub in the HTA file you'll
> see the code that dynamically displays the records
> for a selected table, by building a TABLE tag with
> a TR for each record, a TD for each column, and
> then filling i the column data. It's fairly quick, even
> though it's VBScript.

Wow, looks very complete. But I am not sure whether my Provider does
support use of this. Thanks

Mayayana

2/26/2011 2:54:00 PM

0

>
Wow, looks very complete. But I am not sure whether my Provider does
support use of this. Thanks
>

Provider? You don't need to use VBS or an HTA.
It was just meant to be a sample of what you
need to do in terms of the IE object model. Using
the WB.Document is exactly
the same thing as using the Document object in
webpage scripting. The only difference is that
when you reference mshtml.tlb in VB you get
an object model that's strongly typed .... sort of.
For instance, a TABLE is not just an Object. It's
an HTMLTable.

I was assuming that you're working in VB with
a WB control. If this is something like ASP server
side then you should ask in an ASP group. If you
don't find what you want in terms of webpage code
then you can write to me if you like. (The email
address is in the download, but email must be
sent from a real email address. Webmail from
gmail, hotmail, facebook, yahoo, live.com is auto-
deleted from the server.) I do a lot with
the IE object model, HTML, CSS, etc. But my own
site is on Unix. What little I know about server-side
operations is limited to things like PHP includes. I
don't know anything about the ASP equivalent.

Also, if you're actually serving this page to any
browser from server-side then you'll need to test
the specific HTML. You might have to build the HTML
differently for different browsers because IE will
often render differently from other browsers. And
different versions of IE are incompatible. The closest
I've been able to come to a universal fit is to have
2 page versions: One for IE in quirks mode, and one
for all other browsers. I don't support non-quirks IE
at all. It would require a different page for every version
of IE.


Jason Keats

2/27/2011 5:42:00 AM

0

Catharinus wrote:
> Helloi my friends
>
> I want to show a html-table with more than 1000 records on an html
> page. The first time I did this, it took only 3 seconds to display
> this, the second time, the page didn\'t react. So there is a memory
> problem. Anybody? Thanks...
>
> I use the following statement:
>
> <body>
> <h2>LIst with words</h2>
> <p></p>
> <table>
> <div style="overflow:auto; height:300px;width:764px;">
> <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> </div>
> </table>
> <br>
>
>
> Catharinus


Catharinus, you still haven't provided any useful information to help us
answer your question.

I agree with Mayayana. Your HTML is invalid, and if you're generating it
as a text file then string concatenation is an issue (it's slow).

That is why anyone doing a lot of string concatenation needs a class
(like the .NET StringBuilder class) to help. Many in this group have
provided such a class in the past - even me.

Here's a simple one that I've used in ASP:

Class CStringBuilder

Private mlCurrentLength
Private mlUpperBound
Private mlLastCellUsed
Private msBuffer()

Private Sub Class_Initialize()
Clear 2000
End Sub

Private Sub Class_Terminate()
Erase msBuffer
End Sub

Public Sub Append(ByVal sValue)
mlLastCellUsed = mlLastCellUsed + 1

If mlLastCellUsed > mlUpperBound Then
mlUpperBound = mlUpperBound * 2
ReDim Preserve msBuffer(mlUpperBound)
End If

msBuffer(mlLastCellUsed) = sValue

mlCurrentLength = mlCurrentLength + Len(sValue)
End Sub

Public Sub Clear(ByVal lInitialUpperBound)
Erase msBuffer
mlCurrentLength = 0
mlLastCellUsed = -1
mlUpperBound = lInitialUpperBound
ReDim msBuffer(mlUpperBound)
End Sub

Public Property Get Length()
Length = mlCurrentLength
End Property

Public Property Get ToString()
ToString = Join(msBuffer, "")
End Property

End Class


You can obviously add the data types if you're using it in VB6.

I often generate HTML reports as text files, then load them via the
default browser.

Sometimes this involves using a function to turn an ADO recordset into a
HTML table using a class like the one above.

Would such a function be useful to you?

catharinus

2/27/2011 2:05:00 PM

0

On 27 feb, 06:41, Jason Keats <jke...@melbpcDeleteThis.org.au> wrote:
> Catharinus wrote:
> > Helloi my friends
>
> > I want to show a html-table with more than 1000 records on an html
> > page. The first time I did this, it took only 3 seconds to display
> > this, the second time, the page didn\'t react. So there is a memory
> > problem. Anybody? Thanks...
>
> > I use the following statement:
>
> > <body>
> > <h2>LIst with words</h2>
> > <p></p>
> > <table>
> > <div style="overflow:auto; height:300px;width:764px;">
> > <a href="00000001.htm">Alie</a>&nbsp;&nbsp;&nbsp;Female Name<br>
> > <a href="00000001.htm">Ed</a>&nbsp;&nbsp;&nbsp;Male Name<br>
> > </div>
> > </table>
> > <br>
>
> > Catharinus
>
> Catharinus, you still haven't provided any useful information to help us
> answer your question.
>
> I agree with Mayayana. Your HTML is invalid, and if you're generating it
> as a text file then string concatenation is an issue (it's slow).
>
> That is why anyone doing a lot of string concatenation needs a class
> (like the .NET StringBuilder class) to help. Many in this group have
> provided such a class in the past - even me.
>
> Here's a simple one that I've used in ASP:
>
> Class CStringBuilder
>
> Private mlCurrentLength
> Private mlUpperBound
> Private mlLastCellUsed
> Private msBuffer()
>
> Private Sub Class_Initialize()
>      Clear 2000
> End Sub
>
> Private Sub Class_Terminate()
>      Erase msBuffer
> End Sub
>
> Public Sub Append(ByVal sValue)
>      mlLastCellUsed = mlLastCellUsed + 1
>
>      If mlLastCellUsed > mlUpperBound Then
>          mlUpperBound = mlUpperBound * 2
>          ReDim Preserve msBuffer(mlUpperBound)
>      End If
>
>      msBuffer(mlLastCellUsed) = sValue
>
>      mlCurrentLength = mlCurrentLength + Len(sValue)
> End Sub
>
> Public Sub Clear(ByVal lInitialUpperBound)
>      Erase msBuffer
>      mlCurrentLength = 0
>      mlLastCellUsed = -1
>      mlUpperBound = lInitialUpperBound
>      ReDim msBuffer(mlUpperBound)
> End Sub
>
> Public Property Get Length()
>      Length = mlCurrentLength
> End Property
>
> Public Property Get ToString()
>      ToString = Join(msBuffer, "")
> End Property
>
> End Class
>
> You can obviously add the data types if you're using it in VB6.
>
> I often generate HTML reports as text files, then load them via the
> default browser.
>
> Sometimes this involves using a function to turn an ADO recordset into a
> HTML table using a class like the one above.
>
> Would such a function be useful to you?- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -

Thanks Jason

I tried to build a simple website to easily show just the content of
one table (with more than a 1000 records). And I only showed part of
the code I used in the hmtl-page, because I thougth that was the only
important part I should show to you.

I see that you suggest using .Net for this problem. I thought it would
be easier to solve. So I need to invest time in this solution.Thanks
anyway.
Carharinus

Jason Keats

2/27/2011 10:19:00 PM

0

Catharinus wrote:
>
> I tried to build a simple website to easily show just the content of
> one table (with more than a 1000 records). And I only showed part of
> the code I used in the hmtl-page, because I thougth that was the only
> important part I should show to you.

The HTML is the least important part of your problem. You haven't said
how you're retrieving the data, or how you're creating the HTML.

We can only assume you're using too much string concatenation.

> I see that you suggest using .Net for this problem. I thought it would
> be easier to solve. So I need to invest time in this solution.Thanks
> anyway.
> Carharinus

No, Catharinus, I did not suggest using .NET. I just said that it has a
class called StringBuilder that avoids the concatenation problem - which
is why you need to use a function such as the one provided.

Is your data in an ADO recordset, or not?