|
 |
aspx thread: Stringbuilder
Message #1 by "Dave" <Dave@n...> on Tue, 27 Aug 2002 12:01:13 -0500
|
|
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
Message #2 by "Mike Amundsen" <mike@a...> on Tue, 27 Aug 2002 13:10:19 -0400
|
|
Maybe post your code for us to review.
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #3 by Avnish Soni <Avnish.Soni@p...> on Tue, 27 Aug 2002 13:20:31 -0400
|
|
Hi
I would like upload files to the server in vb.net. Any help will be
appreciated.
Thanks
avi
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 1:10 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Maybe post your code for us to review.
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=3D1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=3D1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
http://www.patni.com
World-Wide Partnerships. World-Class Solutions.
=AD__________________________________________________________________
The information transmitted is intended only for the person or entity
to
which it is addressed and may contain confidential and/or privileged
material. Any review, retransmission, dissemination or other use of, or
taking of any action in reliance upon, this information by
persons or entities other than the intended recipient is prohibited.If
you
received this in error, please contact the sender and delete the
material
from any computer.
=AD__________________________________________________________________
Message #4 by "Dave" <Dave@n...> on Tue, 27 Aug 2002 12:56:08 -0500
|
|
Mike,
Thanks for the article! I found the problem to be a webmail interface &
not what I was doing in the string builder. It seems the webmail is
cutting up strings wherever it likes! I noticed this when I got the
second reply to this and there was an extra line of text from you that I
didn't get in the first one! =) I also tested it with a different
address with a different web mail interface to make sure! Anyway, your
article brings up a question...
I was using something like this...
'StackTrace
.Append("<TABLE BORDER=0 WIDTH=100% CELLPADDING=1 CELLSPACING=0><TR><TD
STYLE=""background-color: silver; color: black;font-weight:
bold;font-family: Arial;"">StackTrace:</TD></TR><TR><TD
STYLE=""background-color: white; color: black;font-family: Arial;"">" &
Ex.StackTrace & "</TD></TR></TABLE>")
Here's where my question comes in...
To use the EnsureCapacity I need a length, Won't something like this put
me back in the same boat as using a string and concatenating it?
Dim strAppend As String
strAppend = "<TABLE BORDER=1 WIDTH=100% CELLPADDING=1
CELLSPACING=0><TR><TD STYLE=""background-color: silver; color:
black;font-weight: bold;font-family: Arial;"">Message:
here</TD></TR><TR><TD STYLE=""background-color: white; color:
black;font-family: Arial;"">" & Ex.Message & "</TD></TR></TABLE>"
.EnsureCapacity(strAppend.Length)
.Append(strAppend)
strAppend = "Some other trace or whatnot!"
Repeat task of ensure & append
Thanks for your help!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 1:10 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
Message #5 by "Mike Amundsen" <mike@a...> on Tue, 27 Aug 2002 17:19:32 -0400
|
|
Well, the question I think you have is this:
"does re-allocating space for the object work the same as doing typical
concatenation (destroying old objects and creating new ones and, thus,
using up memory and running slowly)?"
basically, yes. The re-allocation will cost similar to standard
concatenation. The good news is you can allocate a large block at first
and avoid many 'little' concatenations as you build your string.
While it may not be possible for you to avoid the immutable costs
altogether, StringBuilder can go a long way to reducing the expense.
Hope this helps.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:56 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Mike,
Thanks for the article! I found the problem to be a webmail interface &
not what I was doing in the string builder. It seems the webmail is
cutting up strings wherever it likes! I noticed this when I got the
second reply to this and there was an extra line of text from you that I
didn't get in the first one! =) I also tested it with a different
address with a different web mail interface to make sure! Anyway, your
article brings up a question...
I was using something like this...
'StackTrace
.Append("<TABLE BORDER=0 WIDTH=100% CELLPADDING=1 CELLSPACING=0><TR><TD
STYLE=""background-color: silver; color: black;font-weight:
bold;font-family: Arial;"">StackTrace:</TD></TR><TR><TD
STYLE=""background-color: white; color: black;font-family: Arial;"">" &
Ex.StackTrace & "</TD></TR></TABLE>")
Here's where my question comes in...
To use the EnsureCapacity I need a length, Won't something like this put
me back in the same boat as using a string and concatenating it?
Dim strAppend As String
strAppend = "<TABLE BORDER=1 WIDTH=100% CELLPADDING=1
CELLSPACING=0><TR><TD STYLE=""background-color: silver; color:
black;font-weight: bold;font-family: Arial;"">Message:
here</TD></TR><TR><TD STYLE=""background-color: white; color:
black;font-family: Arial;"">" & Ex.Message & "</TD></TR></TABLE>"
.EnsureCapacity(strAppend.Length)
.Append(strAppend)
strAppend = "Some other trace or whatnot!"
Repeat task of ensure & append
Thanks for your help!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 1:10 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #6 by "Dave Buckner" <Dave@N...> on Tue, 27 Aug 2002 22:03:17 -0500
|
|
Mike,
This has helped a lot, I thank you!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 4:20 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Well, the question I think you have is this:
"does re-allocating space for the object work the same as doing typical
concatenation (destroying old objects and creating new ones and, thus,
using up memory and running slowly)?"
basically, yes. The re-allocation will cost similar to standard
concatenation. The good news is you can allocate a large block at first
and avoid many 'little' concatenations as you build your string.
While it may not be possible for you to avoid the immutable costs
altogether, StringBuilder can go a long way to reducing the expense.
Hope this helps.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:56 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Mike,
Thanks for the article! I found the problem to be a webmail interface &
not what I was doing in the string builder. It seems the webmail is
cutting up strings wherever it likes! I noticed this when I got the
second reply to this and there was an extra line of text from you that I
didn't get in the first one! =) I also tested it with a different
address with a different web mail interface to make sure! Anyway, your
article brings up a question...
I was using something like this...
'StackTrace
.Append("<TABLE BORDER=0 WIDTH=100% CELLPADDING=1 CELLSPACING=0><TR><TD
STYLE=""background-color: silver; color: black;font-weight:
bold;font-family: Arial;"">StackTrace:</TD></TR><TR><TD
STYLE=""background-color: white; color: black;font-family: Arial;"">" &
Ex.StackTrace & "</TD></TR></TABLE>")
Here's where my question comes in...
To use the EnsureCapacity I need a length, Won't something like this put
me back in the same boat as using a string and concatenating it?
Dim strAppend As String
strAppend = "<TABLE BORDER=1 WIDTH=100% CELLPADDING=1
CELLSPACING=0><TR><TD STYLE=""background-color: silver; color:
black;font-weight: bold;font-family: Arial;"">Message:
here</TD></TR><TR><TD STYLE=""background-color: white; color:
black;font-family: Arial;"">" & Ex.Message & "</TD></TR></TABLE>"
.EnsureCapacity(strAppend.Length)
.Append(strAppend)
strAppend = "Some other trace or whatnot!"
Repeat task of ensure & append
Thanks for your help!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 1:10 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
Message #7 by "Mike Amundsen" <mike@a...> on Wed, 28 Aug 2002 00:47:23 -0400
|
|
Glad to be able to contribute!
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave Buckner [mailto:Dave@N...]
Sent: Tuesday, August 27, 2002 11:03 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Mike,
This has helped a lot, I thank you!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 4:20 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Well, the question I think you have is this:
"does re-allocating space for the object work the same as doing typical
concatenation (destroying old objects and creating new ones and, thus,
using up memory and running slowly)?"
basically, yes. The re-allocation will cost similar to standard
concatenation. The good news is you can allocate a large block at first
and avoid many 'little' concatenations as you build your string.
While it may not be possible for you to avoid the immutable costs
altogether, StringBuilder can go a long way to reducing the expense.
Hope this helps.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:56 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Mike,
Thanks for the article! I found the problem to be a webmail interface &
not what I was doing in the string builder. It seems the webmail is
cutting up strings wherever it likes! I noticed this when I got the
second reply to this and there was an extra line of text from you that I
didn't get in the first one! =) I also tested it with a different
address with a different web mail interface to make sure! Anyway, your
article brings up a question...
I was using something like this...
'StackTrace
.Append("<TABLE BORDER=0 WIDTH=100% CELLPADDING=1 CELLSPACING=0><TR><TD
STYLE=""background-color: silver; color: black;font-weight:
bold;font-family: Arial;"">StackTrace:</TD></TR><TR><TD
STYLE=""background-color: white; color: black;font-family: Arial;"">" &
Ex.StackTrace & "</TD></TR></TABLE>")
Here's where my question comes in...
To use the EnsureCapacity I need a length, Won't something like this put
me back in the same boat as using a string and concatenating it?
Dim strAppend As String
strAppend = "<TABLE BORDER=1 WIDTH=100% CELLPADDING=1
CELLSPACING=0><TR><TD STYLE=""background-color: silver; color:
black;font-weight: bold;font-family: Arial;"">Message:
here</TD></TR><TR><TD STYLE=""background-color: white; color:
black;font-family: Arial;"">" & Ex.Message & "</TD></TR></TABLE>"
.EnsureCapacity(strAppend.Length)
.Append(strAppend)
strAppend = "Some other trace or whatnot!"
Repeat task of ensure & append
Thanks for your help!
Dave
-----Original Message-----
From: Mike Amundsen [mailto:mike@a...]
Sent: Tuesday, August 27, 2002 1:10 PM
To: ASP+
Subject: [aspx] RE: Stringbuilder
Also, there is a way to 'test' the stringbuilder object to see if the
string you are going to add will 'fit' you can also allocate space for
the stringbuilder to work with.
I wrote a short article on this for ASPnetPRO:
http://www.aspnetpro.com/features/2002/04/asp200204ma_f/asp200204ma_f.as
p
the docs should also fill out the details on capacity monitoring.
MCA
Mike Amundsen
mca@E...
host your .NET Apps @ EraServer.NET
-----Original Message-----
From: Dave [mailto:Dave@n...]
Sent: Tuesday, August 27, 2002 1:01 PM
To: ASP+
Subject: [aspx] Stringbuilder
Hey all,
Some of the data I am appending to a string builder is getting cut off!
Is there a max length or something that is preventing me from adding a
long string? If I break my string up and append 2 chunks, All is well!
Any ideas?
Dave
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
---
ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442
ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450
These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.
---
|
|
 |