|
you are welcome...
"My advice to you is to get married. If you find a good wife, you will be happy; if not, you will become a philosopher." Socrates
|
|
|
|
|
What? No snappy comeback or vulgarity for telling you to search?
only two letters away from being an asset
|
|
|
|
|
hi i am loading 500000 records in to a datatable and going thro each and every record. It is taking a large amount of time .
Is there any possibility or efficient ways in which we can handle it easily....less memory resouse utilization is must plzzzz
help me........
thanks.....
|
|
|
|
|
Where is the data being loaded from? Why are you loading some much? What do you mean, "going thro each and every record"? Lots of unanswered questions here.
only two letters away from being an asset
|
|
|
|
|
i am making a connection to a text file thro ODBC connectivity and filling the datatable.... tht txt file may contain records from 5000 to 500000+
i need to loop thro each record and do some processing...?
|
|
|
|
|
chandler83 wrote: filling the datatable
Do you mean the table in the database or DataTable object?
only two letters away from being an asset
|
|
|
|
|
You should prepare your data ( do the loop ) then process it to the DB all at once, or at least in batches. One DB call per record will indeed take forever.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
you can use paging to minimize the mount of data you are retrieving , or if you are searching then maybe you can do that process on the SQL Server side or whatever you are using...
|
|
|
|
|
I had to update/insert a couple of 1000's records once. What I did was concatenate the inserts (delimit with ";") and fire it up to the database at once...
eg.
"INSERT INTO YOURTABLE (COLNAMES) VALUES (COLVALUES);INSERT INTO YOURTABLE (COLNAMES) VALUES (COLVALUES);...;INSERT INTO YOURTABLE (COLNAMES) VALUES (COLVALUES);"
In your case don't do it at once, but in blocks.
Hope this helps.
V.
No hurries, no worries
|
|
|
|
|
Please help to run following code(c#) from msdn(url==>http://msdn.microsoft.com/msdnmag/issues/04/12/ServiceStation/default.aspx)
//the code is
using System;
using System.Web;
using System.Web.Hosting;
using System.Net;
using System.IO;
...
class Program
{
static void Main(string[] args)
{
//error occurs at this line,error message is given below
MySimpleHost msh = (MySimpleHost)
ApplicationHost.CreateApplicationHost(
typeof(MySimpleHost), "/", Directory.GetCurrentDirectory());
HttpListener listener = new HttpListener();
listener.Prefixes.Add("http://localhost:8081/");
listener.Prefixes.Add("http://127.0.0.1:8081/");
listener.Start();
Console.WriteLine(
"Listening for requests on http://localhost:8081/");
while (true)
{
HttpListenerContext ctx = listener.GetContext();
string page = ctx.Request.Url.LocalPath.Replace("/", "");
string query = ctx.Request.Url.Query.Replace("?", "");
Console.WriteLine("Received request for {0}?{1}",
page, query);
StreamWriter sw = new
StreamWriter(ctx.Response.OutputStream);
msh.ProcessRequest(page, query, sw);
sw.Flush();
ctx.Response.Close();
}
}
}
public class MySimpleHost : MarshalByRefObject
{
public void ProcessRequest(string p, string q, TextWriter tw)
{
SimpleWorkerRequest swr = new SimpleWorkerRequest(p, q, tw);
HttpRuntime.ProcessRequest(swr);
}
}
when I run the code the compiler shows following error message
Could not load file or assembly 'wserver, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The system cannot find the file specified.
What should I put in /bin directory?
Should I add assembly in GAC?
Thanks
tandukar
|
|
|
|
|
What version of .NET ? Why don't you have IIS ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
I've been programming under the assumption that taking a lock out on an object will get an exclusive lock out, so no other thread can enter any region that uses the same object as a lock.
i.e.
<br />
void Read()<br />
{<br />
lock(obj)<br />
{<br />
}<br />
}<br />
<br />
void Write(data)<br />
{<br />
lock(obj)<br />
{<br />
}<br />
}<br />
Now i was thinking that a synronous call to Read and Write would lock 'obj' and prevent two threads from
doing different things at the same time.
However, while debugging an app (That i had tested with numerous multi threaded scenarios and had no problems), i found that i could have a breakpoint in Read and a breakpoint in write, and they would hit alternatively, while there was still logic to be executed in both blocks. This has made me wonder whether i'm totaly wrong about the whole locking mechanism and whether a lock is only obtained for a particular region of code, rather than the object itself.
Alternativly, could this be an issue with Debugging and stepping through multi threaded apps?
Can anyone shed any light on the subject please?
Cheers
Tristan RHodes
|
|
|
|
|
The Catalyst wrote: Now i was thinking that a synronous call to Read and Write would lock 'obj' and prevent two threads from
doing different things at the same time.
That's correct. Only one thread can be running the code inside Read/Write at any point in time (assuming they're sharing the locked object obj )
The Catalyst wrote: However, while debugging an app (That i had tested with numerous multi threaded scenarios and had no problems), i found that i could have a breakpoint in Read and a breakpoint in write, and they would hit alternatively, while there was still logic to be executed in both blocks.
Where did you put the breakpoint? The breakpoint would hit the lock statement, but would block if you try to execute the thread.
The Catalyst wrote: whether a lock is only obtained for a particular region of code, rather than the object itself.
Now that's confusing. The lock does not lock the object passed to the lock statement, it only uses the object as a kind of token to indicate the thing this thread should lock on.
|
|
|
|
|
Many programs written with inheritance could be written with composition instead, and vice versa. Rewrite classes Point3, Circle4 and Cylinder to use composition, rather than inheritance. After you do this, assess the relative merits of the two approaches for both the Point3, Circle4, Cylinder problem, as well as for object-oriented programs in general. Which approach is more natural, why?
is he here want one in inheritance and one without inheritance ????
am i right
thanks
|
|
|
|
|
Yes, he wants one of each.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Hi,
Im developing an app like a Image Manager, using database, categories, nodes, etc...
Now I have to put the images in a ListView, I will retrieve the list of images from the Database and try to show them on the LargeIconsView, I tried to search something about it to do it in the right way, but no luck by the moment.
And im thinking to thumbnalize the images ( due they are like 14-22MB ) and place them in a indexed ImageList to show them.
Am I getting the right way ?
Many thanx in advance,
|
|
|
|
|
Yes, that would be the way to go.
Christian Graus - C++ MVP
'Why don't we jump on a fad that hasn't already been widely discredited ?' - Dilbert
|
|
|
|
|
Thanx mate,
Then time to precache, thumbanilze, and optimize a good ImageList, a find out how to serialize it to the HDD.
Thanx again for your reply,
|
|
|
|
|
Just out of sick curiosity, is there a function in the .NET Framework that I can call that is guaranteed to block forever? Right now I'm creating a new ManualResetEvent object, then calling its WaitOne() method.
The reason for this is that I'm calling a ton of Stream.BeginRead() methods from my Main() method, and the delegates called when these reads complete eventually take over program execution. I'm pretty sure that this is bad coding style, but this is just for an experimental application, not a production app.
Thanks!
|
|
|
|
|
public void NeverExit()
{
while (true)
;
}
? What was so difficult?
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|
|
Well, yeah - but I was hoping for something that didn't burn clock cycles like mad. My program *does* have other threads doing real work, after all.
Like I said, this is strictly an academic exercise for my own sake. If indefinitely suspending the Main() thread is the wrong way of going about this, I'm certainly open to alternatives.
BTW, I also thought of using Thread.Suspend(), but unfortunately it has been deprecated.
|
|
|
|
|
So, throw a Thread.Sleep(10) in the while loop.
Dave Kreskowiak
Microsoft MVP - Visual Basic
|
|
|
|
|
Vega02 wrote: If indefinitely suspending the Main() thread is the wrong way of going about this, I'm certainly open to alternatives.
You mean like blocking on an Event until another thread signals it?
led mike
|
|
|
|
|
Well, yeah, but in my case no other thread will ever signal it. Creating a ManualResetEvent and waiting on it to perform an indefinite block - something just feels wrong about doing that.
|
|
|
|
|
As mentioned below Thread.Sleep(Timeout.Infinite) is what you want.
Formula 1 - Short for "F1 Racing" - named after the standard "help" key in Windows, it's a sport where participants desperately search through software help files trying to find actual documentation. It's tedious and somewhat cruel, most matches ending in a draw as no participant is able to find anything helpful. - Shog9
Ed
|
|
|
|