IRC Networks
Irc Logs Stats
Start date: 2007-09-27 02:48:27
Last update: 2008-10-24 20:19:38
Channels: 41
Logged Lines: 6230436
Size: 1822.40 MB
Powered by
Channel Info
Network: freenodeChannel: #csharp |
Search in www.irclog.org
Log from #csharp at freenode 2006-08-31
[20:24]<znmnzz_>but i would probably try to OSS as much as possible (network and security libs to enable external auditting)
[20:24]<znmnzz_>client code (desktop app) to allow people to script
[20:24]<znmnzz_>but keep the backend and web services proprietary
[20:24]<znmnzz_>so i can feed da family
[20:25]<znmnzz_>with possibility of publishing a standard reference version of the backend for Free, or relicensing old code base under GPL i guess
[20:26]<slnzzzd>how can I deal with richtextbox freezing my entire program when it's displaying a large amount of text? I can't seem to find a way to perform that in a separate thread
[20:27]<fzzrjs>sperrry: how much text is a lot?
[20:28]<slnzzzd>it depends, I display what I get via socket. I dont want my entire GUI to lock when its being displayed, as it's happening now
[20:29]<fzzrjs>sperrry: it doesn't sound like you've narrowed it down much..
[20:29]<slnzzzd>narrowed what down?
[20:29]<fzzrjs>sperrry: the bug -- it could be a lot of things
[20:29]<slnzzzd>there is no bug
[20:30]<fzzrjs>sperrry: then teh locking is in spec, and you have no question ;)
[20:30]<fzzrjs>sperrry: you're asking for help => problem, problem => bug
[20:30]<slnzzzd>richtextbox runs on the same thread as the rest of the GUI, when it's doing its work no other control can do its own
[20:31]<fzzrjs>do you have any idea how much text you're trying to display?
[20:31]<fzzrjs>500bytes? 500k? a gig?
[20:31]<slnzzzd>your definition of a bug differs from mine then.. but anyway how do I display it in other thread, or deal with it in some other way
[20:32]<slnzzzd>it's enough to freeze my GUI for few seconds and that's not acceptable
[20:33]<fzzrjs>*maybe* it doesn't matter, but it seems like it would be a good thing to know
[20:34]<fzzrjs>(and a realtively easy thing to check)
[20:34]<slnzzzd>it's not a continous flow of text, it comes in bursts. like in a chat program when you're getting flooded, for example
[20:34]<fzzrjs>it's rtf, right? (rtftextbox.Rtf = textString is causing the slow down?)
[20:34]<slnzzzd>and when that happens my program locks until it's done displaying it
[20:34]<slnzzzd>plain text
[20:34]<fzzrjs>hm..
[20:35]<fzzrjs>ok, so you're setting the .Text property?
[20:35]<fzzrjs>can you profile that bit of code, just to make sure?
[20:35]<slnzzzd>when I try to create it in a different thread I get this. Cross-thread operation not valid: Control 'Form1' accessed from a thread other than the thread it was created on
[20:35]<fzzrjs>yeah
[20:35]<slnzzzd>how can I fix that
[20:36]<fzzrjs>I don't know how to make the gui be managed by multiple threads -- I do find it hard to believe that the display of the text is really causing the slowdouwn
[20:36]<fzzrjs>(unless you're displaying an immense ammount of text.. over a 5 megs, or so)
[20:37]<slnzzzd>you do? create a richtextbox, and display 1000 lines in a loop. that's 5KB. your program will lock for a second or two
[20:38]<fzzrjs>because of the loop...
[20:38]<fzzrjs>I just wrote an app that uses a rich text box to display rtf text
[20:39]<fzzrjs>and it will show 5-10k docs (haven't tried larger) with no noticable delay
[20:39]<slnzzzd>because it's running in the same thread as the rest of the GUI
[20:39]<fzzrjs>yes, because the loop is running in the gui thread
[20:39]<slnzzzd>showing them how?
[20:39]<fzzrjs>textBox.Rtf = doc.contents;
[20:40]<fzzrjs>doc.contents is a string that is asasembled in advance
[20:40]<slnzzzd>how about you try reading line by line
[20:40]<slnzzzd>and then Appending each line
[20:40]<fzzrjs>hm..
[20:40]<fzzrjs>are you doing something like this?
[20:40]<slnzzzd>yes
[20:40]<fzzrjs>string newLine = socket.gettextt(); // pseudocode
[20:41]<slnzzzd>yes
[20:41]<fzzrjs>textbox.Text = textbox.Text + newline;
[20:41]<fzzrjs>?
[20:41]<slnzzzd>I call AppendText
[20:41]<slnzzzd>but that's the same
[20:42]<fzzrjs>hm..
[20:42]<fzzrjs>(append text should be more efficient than what I wrote above, unless the compiler can optomize the first one, but yeah)
[20:43]<fzzrjs>I really don't know :(
[20:43]<fzzrjs>if i were you, I'd create a small multi-threaded app to verify that it is indeed the AppendText call that is causing the slow down (or do this with a good profiler)
[20:44]<fzzrjs>if indeed it is, (assuming you haven't already done that) then I really don't know what to do
[20:44]<svlnvnz>i've set the selectcommad on the data adapter and then filled the dataset , now i change the parameters of the command and try to refill the dataset, nothing happen, can't i do this?
[20:44]<slnzzzd>can't richtextbox run on a separate thread? maybe I'm doing it wrong
[20:45]<fzzrjs>it seems like I read something about using com or whatnot to have clients and servers draw different portions of a gui, but that's way out of my realm
[20:45]<fzzrjs>(I'm not really a windows programmer..)
[20:47]<sdnffdxdlld>you read the socket asyncronously
[20:47]<znmnzz_>man i have new found respect for people who are windows programmer
[20:47]<znmnzz_>it's a really huge and complex platform
[20:48]<znmnzz_>when i was a teen i thought it'd be easy to grok all the major dev stacks
[20:48]<znmnzz_>pipedream
[20:49]<svlnvnz>loool
[20:50]<slnzzzd>largos hmm you were right
[20:50]<slnzzzd>I just created a small two thread program, I'm looping and AppendingText in the second thread and GUI is not locked
[20:51]<fzzrjs>sperrry: thanks for trying that
[20:52]<slnzzzd>so it's something else that's locking my program
[20:52]<fzzrjs>as smellyhippy mentioned.. are you reading from the socket in a separate thread?
[20:53]<slnzzzd>and I have no idea how to find out what. is there a profiler in VisualStudio?
[20:53]<fzzrjs>or is there any other processing going on in there?
[20:53]<slnzzzd>I'm using async sockets
[20:53]<sdnffdxdlld>aye do it using the sync methods and it wont block
[20:53]<sdnffdxdlld>ahhhh so then whats eating up your UI thread?
[20:53]<sdnffdxdlld>is it the shear size of text?
[20:54]<fzzrjs>there's a prog. called dev partner that does profiling, but I'm not sure how to get it (I don't think it's free)
[20:54]<sdnffdxdlld>aye devpartner is expensive
[20:54]<fzzrjs>smellyhippy: it shouldn't be, or the test app would have exhibited the same behavior
[20:54]<sdnffdxdlld>(I wish i had a copy)
[20:54]<slnzzzd>don't think so, I just Appended 10 000 lines in a separate thread, it took few seconds but my GUI was not locked
[20:54]<fzzrjs>we use it at work, but I haven't really tried it
[20:54]<sdnffdxdlld>ahhh right
[20:54]<sdnffdxdlld>is there anyway you could append the string using a string builder then pass it to the rtb?
[20:55]<fzzrjs>smellyhippy: that would probably take longer..
[20:55]<fzzrjs>smellyhippy: any optomizations in RTB.AppendText would be lost
[20:55]<sdnffdxdlld>SpikeLite msdn2 richtextbox
[20:55]<slycnlyvn>smellyhippy, RichTextBox Class (System.Windows.Forms): http://msdn2.microsoft.com/en-us/library/system.windows.forms.richtextbox.aspx
[20:58]<slnzzzd>it's not appendtext problem, I'm doing the same thing as in the test program, and probably a lot slower too since I'm getting it from the socket and in test program I"m just looping
[20:58]<fzzrjs>sperrry: you can start stubbing out portions of your program with things that are known to be fast
[20:58]<fzzrjs>eg: replace the socket.gettext with a function that just returns a constant string
[20:58]<fzzrjs>see if that helps... if not, then stub something else..
[20:58]<slnzzzd>I'll try
[20:59]<fzzrjs>it's painfully slow, but w/out a profiler you don't have lots of options
[21:00]<sdnffdxdlld>.AppendText doesnt have any optimizations
[21:00]<sdnffdxdlld>try using the string builder
[21:00]<sdnffdxdlld>it'll soon be obvious if it doesnt help at all







