|
He didn't have one the code he used is posted in a past relpy on this thread.
|
|
|
|
|
very perceptive expert but in case you didnt notice that was me (wowowee) who posted the previous code. and yeah i forgot to declare a connection string.
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|