|
hi guys, I need help to read a block of data from a text file.
I m using StreamReader object and its method ReadBlock, which is supposed to write certain number of characters into a char[] buffer, but when I debug the code actually the buffer is not being written, all the values are empty.
Please help.
|
|
|
|
|
Show the code, including var declarations and initialization, plus any errors/exceptions.
Does it work at all ? up to a point ? or what ?
|
|
|
|
|
How to pass user defined oracle type as argument to a stored procedure using c#. anyone pls help.
|
|
|
|
|
Dear All,
We have a requirement in our MDI application wherein we have to load the child form with all the master data (from DB) only once. Basically after the form is loaded the first time, the subsequent instances need to load very quickly and not query the DB again.
I am not sure how we can achieve this in MDI. Can you give your valuable suggestion?
Please let me know incase you have additional queries.
Thanks and regards,
ATUL
|
|
|
|
|
Implement a singleton pattern for your db class and cache the db query
only two letters away from being an asset
|
|
|
|
|
If your using DataSet's to retrive the data then you can cache them. The next time the app needs the data it just grabs the cached DataSet.
|
|
|
|
|
Does anyone have a good tutorial or reference as to how to implement a website search function? I used to doing this in coldfusion with verity search and just wanted to know how to go about doing so in .net C#. Thanks in advance to all that reply.
|
|
|
|
|
|
Hey!
I have some performance problems when I am using a third party dll to read and write to a GSM phone. I first used these commands to read and write in my main thread and noticed that when executing these commands, the application froze for a couple of seconds. The commands worked but the behavior was annoying. I then thought that running these commands in threadd separated from the main thread would solve the problem but it didn't. The application still freezes when using the read and write commands. Does anyone have any idea why? I though threads would solve these kinds of problems.
/Hampus
|
|
|
|
|
Hi,
First of all I assume it is working ?
And I hope the DLL is not doing some GUI stuff of its own.
I guess you only have the DLL, that is not the source, nor a technical description.
You could have a look at the CPU load it creates: open Task Manager, Performance tab
and watch the curve while trying to read/write the GSM. If its close to 100% then
they probably have a busy loop, which is harming your main thread's behavior.
If so, you may try to set a lower priority for that thread;
gsmThread.Priority=ThreadPriority.BelowNormal;
that should solve the GUI part, but may cause the GSM DLL to malfunction...
If CPU load isnt high, they somehow execute (part of) their stuff on the main thread anyhow,
and your thread is pointless.
|
|
|
|
|
Yes, the dll works as it should, it's just slow. It's not doing any GUI stuff.
I have checked the CPU load and it's never close to 100%, rather like 50% but I still tested setting the threadpriority to belownormal but it didn't help.
Does it matter that the object I create, which is defined in the dll and is the object I use to read and write with, is not created in the tread but in the main thread?
/Hampus
|
|
|
|
|
Hampus@foi wrote: rather like 50%
that could mean it is fully loading one of two CPU cores. Do you have either hyperthreading
or a Core Duo CPU ? if so, they have a busy loop, but then the other (half of) CPU might
(or might not) keep your GUI alive. Or they have an internal thread that they (temporarily)
switch to a higher (maybe real-time) priority to make sure they dont miss something.
If so, there is nothing you can do about it (you might notice it with some third-party
tool such as TaskInfo), that might confirm but not solve it.
Hampus@foi wrote: Does it matter that the object I create, which is defined in the dll and is the object I use to read and write with, is not created in the tread but in the main thread?
I dont expect it to matter. Does their documentation say anything about that ?
I guess you will have to contact your DLL vendor...
|
|
|
|
|
Their documentation does not mention anything about their product that could be considered negative, not even in the FAQ
I have contacted them but they have yet not answered...
Thanks anyway!
/Hampus
|
|
|
|
|
You're welcome.
Please post the outcome, if and when.
|
|
|
|
|
In a new atempt to solve this, I tested to create and initialize the write object in the write thread so that it doesn't exist anywhere else but in the thread and this actually seems to have solved the problem. My application no longer freezes when writing data to the GSM phone. I have not tried changing the read process yet but it should probably give the same result.
/Hampus
|
|
|
|
|
Hampus@foi wrote: Does it matter that the object I create, which is defined in the dll and is the object I use to read and write with, is not created in the tread but in the main thread?
You are kidding right? Of course that could matter if they are performing any time consuming task(s) during initialization, which it certainly sound like they are. All you would have to do is put some time elapsed code around the initialization to find out.
|
|
|
|
|
Hi,
I use C# with CsGL to build the 3D models based OpenGL.Now i want to plaint the texture with the class OpenGLTexture2D.But when i use the phrase
"private OpenGLTexture2D tex = new OpenGLTexture2D(@"text.bmp");"
to construct the class,there will report the error of
"TypeInitializationException was unhandled" in the phrase
"Application.Run(new MainForm());" in the file of Program.cs.
How can i deal with this problem? i use the vs2005 and csgl 1.4.1.0
Thanks....
|
|
|
|
|
They are probably not following guidelines and throwing exceptions from a constructor, or in this case a static constructor (as from the exception type).
|
|
|
|
|
Seems like the constructor of OpenGLTexture2D is throwing.
Split the line private OpenGLTexture2D tex = new OpenGLTexture2D(@"text.bmp");
into a member declaration without initializer,
plus an initializer statement somewhere in your code:
tex = new OpenGLTexture2D(@"text.bmp");
and put a try-catch around it, so you catch the exception and learn from all the details
Exception.ToString() holds for you.
|
|
|
|
|
|
The problem has done,tanks....

|
|
|
|
|
Just curiosity , Did anyone have idea of how many methods a single C# class can allow ?
I heard, it is compiler dependent If true, what is the maximum no allowed by the standard compiler ?
Thanks,
Vythees
|
|
|
|
|
vytheeswaran wrote: how many methods a single C# class can allow ?
We can have as we can.
For More Details:
MSDN[^]
Regards,
Satips.
|
|
|
|
|
Where does that article answer the OP's question? Or did you just chuck some keywords in to Google and hit "I'm feeling lucky"?
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
Ready to Give up - Your help will be much appreciated.
My website
|
|
|
|
|
Thanks for Info,
But I read in one article that E-Bay once hits the compiler limit in max number of methods in single class.
Thanks,
Vythees
|
|
|
|