|
Dear Sirs,
Thanks for your sharp responses. It didn't throw me off, but it seemed a bit redundant, that's all. The clarity is indeed blinding as to what happens, but the intent is still - to me - less than clear. I'm beginning to see why this might be necessary, but I still can't think of an example. A specific example could be great, if you please.
In Christ,
Aaron Laws
http://ProCure.com
|
|
|
|
|
I need to know which library or class to use to record and play .wav files in C#
please mention if the library needs to be downloaded, added or it's already inside visual studio 2005/2008
If it's a class,if it is a C# class or I need to implement it or copy its code
Thanks in advance
|
|
|
|
|
|
I do reading and writing from/to a socket. But both are done asynchronously...I've noticed whenever my application is running, the taskmanager systray icon shows 100%, and it so happens tht my app is responsible for this too...
|
|
|
|
|
In which language are you developping?
When I developped in C++ Builder (VCL, the same from delphi) I got this type of problem.
My solution was to use a home-made dll at that time, calling the API directly.
If you don't have a choice of changing the component used, try simple setting the priority of the process to a lower one. Not a real solution, but at least will make the rest of the operating system more responsible.
|
|
|
|
|
|
Hi,
if your program is using all CPU cycles, it is most likely you did something stupid in your code, such as implementing a loop that always or under certain conditions does not wait on anything (no blocking read, no time delay). Here is the simplest bad example:
while(true) {
if (DataAvailable()) ReadData();
}
Now assume DataAvailable is a simple method that most often returns false... your loop is spinning at the speed of light, wasting all the cycles of a CPU core while not doing much useful work. Just add a Thread.Sleep(100) or so in there.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
so whts the technique to optimize this...?
|
|
|
|
|
if your code has one or more loops like the one I have shown, then using a blocking read or adding a time delay is the solution, as I have told you already.
and that is not "optimization", it is "elimination of bad mistakes".
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Then I guess my only go is to use a ManualResetEvent...will this cause further performance problems?
|
|
|
|
|
deostroll wrote: will this cause further performance problems?
1. how could anyone tell, without seeing any of the code?
2. there are no performance problems, there is a design problem.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
Well, most of the code is open source. I'm making use of the dotnettelnet[^] libraries. It is used to connect to machines via telnet.
They've given a test client which shows the basic usage of the library...thinking that that is the apt implementation I went and coded based on the example shown for the test client...which used the while loop.
Since you've suggested it prob must be the while loop I completely removed that construct. But then I began wondering how do I make my app wait until all the work is done...Due to the particular pattern of implementation of this library, a manual reset event came to mind...
If you do plan to look at it...know this...there is a DataAvailable event triggered by the wrapper class when ever we have received data over the (socket) connection. That is where I code my logic; reading the incoming stream and performing actions.
PS: to get the source code go 2 the link that point to the project's actual sourceforge page...its all there...
|
|
|
|
|
deostroll wrote: If you do plan to look at it..
No, I don't.
deostroll wrote: there is a DataAvailable event
such event is normally intended for you to read the data that is already there, and not to wait for more. The event should fire again when more comes in.
The alternative is to have a separate thread for reading, with a loop, waisting time, either through a blocking read or a thread.Sleep
The end.
Luc Pattyn
I only read code that is properly indented, and rendered in a non-proportional font; hint: use PRE tags in forum messages
|
|
|
|
|
r u suggesting tht I've a while construct wherein I just do a Thread.Sleep(), and loop it until my job is done...
while (JobDone)<br />
{<br />
Thread.Sleep(5*1000);<br />
}
PS:I can update JobDone via another thread...
|
|
|
|
|
hi.
i work in ASP.NET 2005 & creat a website project.
i want open picture with open dialog .please tell me who i can load picture with open dialog?
i am beginner .
whether i need a componet as toolbar?
please help me.
i need help body.
|
|
|
|
|
Psst. See the bit at the top left? You know, where it says "C#"?
If you look really closely, you might find a button near that saying "ASP.NET". If you press that, you stand a better chance of a useful answer.
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Did you want help or not ? Did you post to the ASP.NET forum yet ?
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi All,
Can anybody tell me that how to open Select User Dialog box in C#?
In Service Manager --> LogOn Tab :--> Select This Account and Click Browse Button ?
I wanna open this dialog box where u can select/find user ?
Reply ASAP.
Thanking You,
Sunil G.
|
|
|
|
|
Message Closed
modified 23-Nov-14 7:22am.
|
|
|
|
|
The code is in C++.
And in C# project he is using C++ DLL.
Can u give the code which is in C#?
|
|
|
|
|
I wish to know is there a way that I can send any clase that uses the System.IO.Stream base to a function.
public void Display(System.IO.Stream _data)
{...}
System.IO.FileStream _file=System.IO.File.Open(_FileName.ToString(), System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite, System.IO.FileShare.ReadWrite);
Display(_file); <- works fine,
System.IO.StreamWriter writer = new System.IO.StreamWriter("Filepath.txt");
Display(writer); <- No GO.
woops!! yes its true it works for FileStream its StreamReader inwhich doesnt.
modified on Tuesday, November 3, 2009 1:50 PM
|
|
|
|
|
You cant, at first you can use the StreamReader(Stream) constructor, Pass your FileStream instance to convert FileStream to StreamReader.
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
I have found some libs that can do this. Libs like ICSharpCode.SharpZipLib.BZip2.BZip2.Decompress(stream in,stream out);
I want to know how can they do this? I tried several ways but all with failure.
|
|
|
|
|
Need to do some more RnD regarding this...
Thanks
Md. Marufuzzaman
Don't forget to click [Vote] / [Good Answer] on the post(s) that helped you.
I will not say I have failed 1000 times; I will say that I have discovered 1000 ways that can cause failure – Thomas Edison.
|
|
|
|
|
Makes no sense to me, FileStream derives from Stream
|
|
|
|