|
|
|
|
I am using a temporary variable to store some temporary values, which I will not be required to use once I have done some operation. Can I kill them (clear from memory) those variables once I am done with them. I am trying to get an inverse of a 1000*1000 size, so I am using a lot of temporary variables for Gauss Elimintion process. Will I be able to decrease the computation time required if I am to clear those variables from memory?
Regards,
Amit
|
|
|
|
|
If it doesn't have a dispose method, you can't clear it. You should look for calculations that get repeated and see if you can replace them with a lookup table.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
amitmohanty wrote:
Will I be able to decrease the computation time required if I am to clear those variables from memory?
how?? Unless you consume so much memory that you cause system to swap (which I doubt in this case), I fail to see how this will speed up computation?? Memory consumption and time go against each other... besides AFAIK GC is optimized for cleaning small local varibles, so even if you could clear em yourself, maybe it wouldn't be the best idea.
OT: I see you keep working with matrices... it would be nice topic for an article
David
|
|
|
|
|
How do I write binary files, FileStream works with files in binary form, but doesn't read or write in binary. I want a way to actually write files in binary, 1's and 0's.
Thanks for input.
|
|
|
|
|
The FileStream class is binary, and it uses bytes to achieve that.
I think what you are looking for is a bit-stream class. Remember, the smallest unit for files are bytes, not bits (ie. You cannot have a file with, say, 4 bits, or 0.5 bytes). Therefore, FileStream works on binary bytes. As far as I know, System.IO does not provide a bit-stream class, so you may have to create your own wrapper class over an existing byte-stream class.
> whoami
The system is unable to identify you when you don't even know your name!
|
|
|
|
|
Binary is a form of count with a base of 1. So:
0000 = 0
0001 = 1
0010 = 2
0011 = 3
0100 = 4
0101 = 5
0110 = 6
0111 = 7
1000 = 8
1001 = 9
1010 = 10
1011 = 11
1100 = 12
1101 = 13
1110 = 14
1111 = 15
I need a way to write files in that format, so that humans cannot read the data.
|
|
|
|
|
Binary is base 2, not 1.
You're looking for the BinaryReader and BinaryWriter classes, here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
So to use the binary writer, do I need to convert my strings to binary first?
|
|
|
|
|
No, you can check out MSDN documentation on BinaryWriter.Write(String) .
However, this may still not achieve the results you want. A person can still open the binary file in Notepad and see that string.
> whoami
The system is unable to identify you when you don't even know your name!
|
|
|
|
|
No I don't care if they see they document, but in true binary a file is unreadable my the human eye, at least easily, they can convert it but that is beside the point. If anyone has every used QuickBasic/QBasic before they should know what I am talking about.
|
|
|
|
|
If you are trying to do something similar to records in QuickBasic, then I suggest you use System.Runtime.Serialization.Formatters.Binary.BinaryFormatter to achieve your purpose. This is actually the fastest way ion terms of performance, but it is the easiest.
If performance is important to you, then have a look at this article.
|
|
|
|
|
ExpertComing wrote:
but in true binary a file is unreadable my the human eye,
Only numbers qualify for this statement. String data is still readable.
And yes, I used QBasic in the past...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
QBasic and QuickBasic. Happy days!
|
|
|
|
|
Like I said, it's "in the past." I'm not proud of it! :->
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Dave Kreskowiak wrote:
ExpertComing wrote:
but in true binary a file is unreadable my the human eye,
Only numbers qualify for this statement. String data is still readable.
It would be fun to write real "binary" writer - it would produce stream of characters '0' and '1' Totally unreadable, just as ExpertComing wants! yeah, and totally useless, too.
David
|
|
|
|
|
But imagine the compression ratios you could get on a file with only 2 different bytes in it
|
|
|
|
|
haha
David
|
|
|
|
|
HI all,
I am pretty new to the whole C# and Visual Studio scene and I am having a problem with closing my forms. I have a main form open, then after clicking a button (ie search) I pop-up another window. When I have finished with the window the user must close it, but everytime you click it it will close both the window and the main form instead of just the window.
I have tried:
- this.Close();
- this.Close(frmSearch);
- Form.ActiveForm.Close();
But to no avail.
Any help would be great!
Cheers Guys
Carnal (Car-Lan) Car and Computer Club http://carnalonline.org.
|
|
|
|
|
I preassume that you create instance of form when you click button(search).
FormSearch search = new FormSearch();
search.show();
to close this you can use
search.Close();
This will close only search form.
And if the close button is on search form itself, you should be able to use this.Close();
- ashish
|
|
|
|
|
Thanks for the reply but that doesnt seem to work. It closes the form but still closes the whole system.... I am totally out of ideas! If anyone can help that would be great!
|
|
|
|
|
try looking at the close() events... maybe there is a close there somewhere ... and also try looking for Application.Exit method ... maybe you place something like this in your app
its me =Þ
grim zax
|
|
|
|
|
Is there a way to upgrade Visual Studio 2003 to the new language specifications for C# 2.0?
Dave
|
|
|
|