|
Great Peter!
I have found something interesting related to the topic to share here.
http://en.wikipedia.org/wiki/Rounding[^]
It is mentioned "For example, if an integer divided by 7 is rounded to an integer, a computational rounding error up to 1/14 in the division (which is much more than is possible in typical cases) does not affect the outcome." -- I am confused. I think the rounding error should always be from 0 to 0.5, why the rounding error is up to 1/14?
regards,
George
|
|
|
|
|
Hi all,
i am developing a application for ANPR system. My appliaction using thread pool.registerwaitforsingleobject to grab the frames per 40 msec and signal the other thread for processing the frame. My appliaction has crashing becuase of out of memory error. i am running this appliaction in a hi-spec computer. please find my source below.
Main thread
{
Grabframe gf = new Grabframe();
gf.run();
manualresetevent anprevent = new manualresetevent(false);
.. create instance for anprclass anprobj
anprprocessthread(anprobj.run);
anprprocessthread.start();
}
class Grabframe
{
void run()
{
manualresetevent me = new manualresetevent(false);
waitortimercallback thread_method = waitortimercallback(grabframe);
Threadpool.registerwaitforsingleobject(me,thread_method,stateobj,40,false);
me.set();
}
void grabframe(object state,bool timeinterval)
{
...grab the frame
//signal anpr thread
anprevent.set();
}
}// end class grabframe
//anprthread
class anpr
{
void run()
{
anprevent.waitone();
..do anprprocess
.. get frame from global
}
}// end anpr class
Actually i have tried to reset manualresetevent on threadpool obj 'me' and my application didn't crash but the performance of the anpr is dropped.
please provide me suggestion as soon as possible.
Thanks.
sumathi
|
|
|
|
|
sumathi pandarinathan wrote: My appliaction has crashing becuase of out of memory error.
This is likely related to GDI+ issues. Investigate that code.
|
|
|
|
|
Hi,
i have found the line which is causing out of memory error.
please find the below program and it working similar my application.
namespace ConsoleApplication1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
///
class testclass
{
public void show(Object O)
{
Console.WriteLine("Welcome to C#", "TestClass1 Object");
}
}
class testclass1
{
public void show(Object O)
{
Console.WriteLine("Welcome to ThreadPool", "TestClass2 Object");
}
}
class Example
{
static int CountDown= 20;
public static void WaitToShow(Object Obj, bool signaled)
{
if (Obj != null)
Console.WriteLine(CountDown--);
}
}
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: Add code to start application here
//
//AutoResetEvent MyEvent = new AutoResetEvent(false);
ManualResetEvent MyEvent = new ManualResetEvent(false);
testclass t1 = new testclass();
testclass1 t2 = new testclass1();
ThreadPool.RegisterWaitForSingleObject(MyEvent, new WaitOrTimerCallback(Example.WaitToShow),t1,40,false);
//ThreadPool.QueueUserWorkItem(new WaitCallback(t1.show));
//ThreadPool.QueueUserWorkItem(new WaitCallback(t2.show));
MyEvent.Set();
Console.WriteLine("****CountDown Program******");
Thread.Sleep(10000);
Console.ReadLine();
}
} // end clas
}
In the above example program, i commented the line " MyEvent.Set();" and doesn't gave me out of memory error. but if i didn't comment it then the appliaction getting crashed.
Actually i need to set manualresetevent, since the performance is very good.
please suggest me any solution for how to avoid increasing memory when i set manualresetevent.
Thanks.
Sumathi
|
|
|
|
|
How do i rename the buttons on a folderbrowserdialog?
|
|
|
|
|
You cannot. You have to build your own custom dialog inheriting from the CommonDialog[^] class.
|
|
|
|
|
You can not rename buttons on folder browser dilaog
|
|
|
|
|
I attended the VS2005 Launch Event and I was told there that with this control, new in 2.0, it was possible to prevent user from uploading a file that is too big.
I can use that feature in my website, but all I could find was the myUploadControl.PostedFile.ContentLength property which is only available AFTER the file has been uploaded.
Of course it would be very stupid to wait untill the user has uploaded his oversized file and then saying "sorry you can't upload this file, it's too big"...
Now I have the problem that, when the user selects e.g. a 5mb file he gets a "page cannot be displayed" instantly because 5mb exceeds the default limit of 4mb in asp.net.
I only want to allow a user to upload files that are maximum 2mb, if he selects a 3mb (or even 4gb) file I want to give him a message that the selected file is too big.
How can I accomplish this ?
|
|
|
|
|
Unfortunately on the server side, in ASP.NET, you can't tell the file size before the request is fully uploaded to the server, because the ASP.NET pipeline is invoked only at that time. When a file is greater than 10 MB (default), the request is killed by the ASP.NET runtime.
I am not aware of any client-side method available for determining the file size, unless you want to use Flash.
|
|
|
|
|
Dario Solera wrote: Flash
Or an ActiveX Control
Or a Java Applet.
Vasudevan Deepak Kumar
Personal Homepage Tech Gossips
A pessimist sees only the dark side of the clouds, and mopes; a philosopher sees both sides, and shrugs; an optimist doesn't see the clouds at all - he's walking on them. --Leonard Louis Levinson
|
|
|
|
|
I am trying to retrieve the all the cells selected by user in the worksheet of Excel using C#. Can anyone help ?
|
|
|
|
|
Varad_Rajan wrote: I am trying to retrieve the all the cells selected by user in the worksheet of Excel using C#.
Why dont you just ask the user? Seriously, without giving us even a hint of what you are doing, will not get you an answer.
|
|
|
|
|
I want to detect if a key is held down during the start up of my program, i.e. in
static void Main()
Is this possible to achieve? I want to make a safe mode that will be entered if the user holds down the shift key when starting the program.
|
|
|
|
|
|
One way I can think of is to add a reference to System.Windows.Forms if you don't have it already and use the following:
static void Main(string[] args)
{
Keys modifiers = Control.ModifierKeys;
Console.WriteLine(modifiers);
}
The modifiers enumeration will have the keys held down (only works for the modifier keys, i.e. Control , Shift , Alt etc).
I doubt it. If it isn't intuitive then we need to fix it. - Chris Maunder
|
|
|
|
|
Thanks! This works like a charm!
|
|
|
|
|
Hello everyone,
Is Concole.WriteLine and other Console write methods, like Console.Write thread safe? I can not find any related information from MSDN about the thread safety of this method.
thanks in advance,
George
|
|
|
|
|
George_George wrote: I can not find any related information from MSDN about the thread safety of this method.
Not directly, but it can be worked out from the documentation.
Console.WriteLine is a wrapper for Console.Out.WriteLine. Console.Out is an instance of a TextReader, and in the documentation for TextReader it says: "Thread Safety Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe."
|
|
|
|
|
So great, Colin!
regards,
George
|
|
|
|
|
|
Thanks Dave,
Your reply is very clear.
regards,
George
|
|
|
|
|
Hi All
I am using ICSharpCode.SharpZipLib.FastZip to unzip files we receive over the internet in C#.NET2. The problem I am having is that some of the zipped files we receive contains folders with the files we want in those folders. What I need is for it to unzip the files in the zipped folder directly to the 'target directory'.
I.e.
C:\zippedfiles.zip //Contains - "folder\zippedfile.txt"
//When unzipping it, I need it to be
C:\zippedfile.txt
//NOT
C:\folder\zippedfile.txt
That's it. Any help would be great, thanks in advance.
Kiefie
The man with a plan...now where'd that plan go?
|
|
|
|
|
Hello i am working with a chat in c# and there´s one thing left to do, a list of members who are in the chat, in a listbox. tried for hours but i am not comming anywhere so now i am asking for help.. so please can some one help me //Bobbziz
Waddatah
|
|
|
|
|
If you are using a client server approach, you would probably be best off if you made a function to retrieve a list of the users from the server.
|
|
|
|
|
Hey i trying to make a application thats run on background and write to a file how long user was running a application
Ex.
if user click on word then write to a file user clict on word time: 11:01 or somthing like that.
and if user clickt on internet explorer then write to file user clickt on internet explorer time: 11-03.
i hope you can help me.
Sorry my english,
|
|
|
|