|
Yes. Changes were applied, solution was saved, rebuild was done. VS did a graceful exit and when I return I get the same message. In fact, examination of the configuration properties page reveals that the setting is correct - but for some reason the compiler is not acting in accordance with the setting until you follow the "set it false/apply/set it true/apply" methodology described above.
|
|
|
|
|
hi,
Want to dynamically generate a xml format from sql server . The data base has about 15 parent child relationship tables.
What is the best approach in .net environment
thanks.
jag
|
|
|
|
|
Maybe use DataSets.
<br />
System.Data.DataSet ds;<br />
ds.WriteXml("xmlFileName", System.Data.XmlWriteMode.WriteSchema);<br />
ds.WriteXmlSchema("xmlSchemaFileName");<br />
also look into SQLXML , you can actually write T-SQL to return back pure XML from sql server.
R.Bischoff
.NET, Kommst du mit?
|
|
|
|
|
Hy,
Help in progress bar.
I like alter scrolling in progress bar, but Windows Form
|
|
|
|
|
|
Done with writing the post or the program?
I passionately hate the idea of being with it, I think an artist has always to be out of step with his time.
-Orson Welles
|
|
|
|
|
Quick question:
Is an instance of a struct an object? If not, what is it? What about an instance of an enum ?
Thanks,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
Nope.
The C# struct keyword maps to the System.ValueType class.
An enum is an instance of System.Enum, which derives from ValueType.
Of course, both of these ultimately derive from System.Object. It's just that the CLR loads System.ValueType and its derived classes into the stack, whereas System.Object gets loaded onto the heap.
Conclusion of the day, don't believe a developer, his mind is always changing.
-Stephane Rodriguez.
|
|
|
|
|
Here's my dilemma:
I'm writing some documentation where I refer to an instance of the DateTime struct. When I originally wrote it, I referred to it as the "DateTime object". But then I said, well it's not really an instance of a class, so is it really an "object"?
After I had posted my question (above), I started thinking about what makes an instance of something an "object". And it would seem to me that how it's allocated (stack or heap) should not matter.
Isn't an object an instance of a type that has properties and/or methods?
If that's the criteria then an instance of DateTime should be considered an object, even if it's not an instance of class. It has properties and methods which means that it behaves like an object. Am I right?
Regards,
Alvaro
Hey! It compiles! Ship it.
|
|
|
|
|
If you look at the MSDN docs, it says:
The DateTime value type represents dates and times with values ranging from 12:00:00 midnight, January 1, 0001 Anno Domini (Common Era) to 11:59:59 P.M., December 31, 9999 A.D. (C.E.)
I would either call it a type or a value type...but not an object. Because any programmer who absolutely adores CLR internals and is very picky about semantics is going to say, "Oh, it's an object, allocated on the heap."
I have also lived some years in Spain, and there people don't accept that you speak bad spanish. I usually compensate by speaking loud and accusing people of being stupid because they don't understand me. It usually works quite well.
-jhaga on non-native languages
|
|
|
|
|
hi !
i need to know all (my) network-interfaces-addresses.
(so all addresses
iep = new IPEndPoint(IPAddress.Any,port);
sock.Bind(iep);
would affect
is this:
127.0.0.1
+
all addresses i get with
{
IPHostEntry hostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress[] address = hostInfo.AddressList;
}
????
thanks
andi
|
|
|
|
|
I have this call
Invoke(new TreeViewThreadCallback(this.InsertNode), new object[] {node});
I want to stop this thread so I can initiate another on it.
please help
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I've trouble getting this work, not sure why. Trying to write encrypted to a memory stream. Exception was thrown with everycall to MemoryStream.Close(): "System.NotSupportedException. Memory Stream is not expandable"
code looks like this:
ASCIIEncoding AE = new ASCIIEncoding ();
byte[] buffer = new byte [10];
buffer = ASCIIEncoding.GetBytes("ABCDE");
byte[] Key = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16};
byte[] IV = {0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16};
TcpClient TCP = new TcpClient("localhost",11000);
NetworkStream NetStream = TCP.GetStream();
RijndaelManaged RMCrypto = new RijndaelManaged();
MemoryStream mstream2 = new MemoryStream(buffer, 5, 5, true, true);
CryptoStream cstream2 = new CryptoStream(
mstream2,
RMCrypto.CreateEncryptor(Key, IV),
CryptoStreamMode.Write);
StreamWriter cswriter = new StreamWriter(cstream2);
cswriter.Write(AE.GetBytes("AA"));
cswriter.Flush();
cswriter.Close(); <---- EXCEPTION HERE! "memory stream is not expandable"???
Help! What happenned here?
norm
|
|
|
|
|
Your code is a bit confuse:
norm wrote:
byte[] buffer = new byte [10];
buffer = ASCIIEncoding.GetBytes("ABCDE");
Why are you initializing if you are going to set it on the next line?
norm wrote:
MemoryStream mstream2 = new MemoryStream(buffer, 5, 5, true, true);
CryptoStream cstream2 = new CryptoStream(
mstream2,
RMCrypto.CreateEncryptor(Key, IV),
CryptoStreamMode.Write);
Doing this will write on the MemoryStream. This would be ok, but why don't you use the default constructor (which creates an expandable memorystream)? See what's on MSDN about the constructor you used:
Initializes a new non-resizable instance of the MemoryStream class based on the specified region of a byte array, with the CanWrite property set as specified.
This means you'll never be able to write more than the size of "ABCDE" in ASCII encoding, i.e., 5 bytes. This is very low, and some compression schemes add salt. If you eliminate the "buffer" variable, you probably will get the code working right.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
Thanks, first of all.
Quote: "byte[] buffer = new byte [10];
buffer = ASCIIEncoding.GetBytes("ABCDE");"
>> This is merely cut-&-paste mistakes. Forget it.
The following constructors allows me to specify that the stream is expandable.
MemoryStream mstream2 = new MemoryStream(buffer, 5, 5, true, true);
Using another overload, "Capacity" is NOT expandable and is set to length of input/specified "buffer".
MemoryStream mstream2 = new MemoryStream(buffer);
QUESTION: I tried both ways. Now, how do I work with default constructor that takes no argument? How can I associate a buffer to the stream after construction?
memoryStream.GetBuffer() retrives buffer. But there's no SetBuffer member for me to associate MemoryStream with a buffer.
Thanks.
norm
|
|
|
|
|
norm wrote:
memoryStream.GetBuffer() retrives buffer. But there's no SetBuffer member for me to associate MemoryStream with a buffer.
Byte[]'s are not expandable, so any MemoryStream you create with them will make your stream fixed-size. Either pass a buffer bigger or use a memorystream-managed buffer.
This is what I don't get. Why do you need to set the memorystream buffer? After all, if I understood you correctly, what you need is a byte[] with the encrypted data, right?
Why can't you simply call memoryStream.GetBuffer() and create it with new MemoryStream() ?
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
hi !
maybe:
you defined your buffer with size 10.
your memorystream size is set to 5.
andi
|
|
|
|
|
Thanks, tried that. But the problem is that memorystream is not resizable - but even that shouldn't be the problem since Close() throw an exception complaining that memory stream is not resizable even if I'm just writing ONE character to it!? I didn't Seek() on the memory stream - so, should be writing from beginning - if so, i'd just be overwriting ONE character/byte. The buffer has 10 bytes in it. I don't see how why we need to 'expand' the memorystream in the first place.
norm
|
|
|
|
|
>I didn't Seek() on the memory stream - so, should be writing from beginning
i thought you set the position to the end! (buffer, 5, 5!!!!!!!, true, true)
andi
|
|
|
|
|
I use:
MemoryStream(buffer);
when I Seeked(). By the way, not sure if the following overload make the stream expandable or not:
public MemoryStream(byte[], int, int, bool, bool);
MSDN didn't state explicitly that the memory stream is expandable or not as in other versions/overloads. But IF it is, it's the only overload that takes a byte array as argument AND expandable.
Anyway, how can you use default constructor:
MemoryStream mem = new MemoryStream();
and associate a buffer with it later on?
norm
|
|
|
|
|
norm wrote:
The buffer has 10 bytes in it. I don't see how why we need to 'expand' the memorystream in the first place.
Because it seems that the stupid memorystream will try to trim the buffer for you (instead of leaving the rest of unneeded data untouched). And it can't, as byte[]'s are fixed size.
And yes, the error message is very misleading.
You can do it on anything you choose - from .bat to .net - A customer
|
|
|
|
|
Daniel Turini wrote:
You can do it on anything you choose - from .bat to .net - A customer
>> it's a lot more painful doing .bat
Daniel Turini wrote:
Because it seems that the stupid memorystream will try to trim the buffer for you (instead of leaving the rest of unneeded data untouched). And it can't, as byte[]'s are fixed size.
>> don't get it, can you elaborate a little more?
norm
|
|
|
|
|
Jeez norm, what kind of application are you writing? First the crypto stuff, now this...
Flight to Redmond - £200
Bulldozer Rental - £100
Destroying the MS campus single handedly for not doing an Academic upgrade, PRICELESS!
-Jonny Newman
|
|
|
|
|
i'm workinng for dexter in his secret laboratory
norm
|
|
|
|
|
Shweet. Now, does DeeDee bug you too?
Hawaian shirts and shorts work too in Summer.
People assume you're either a complete nut (in which case not a worthy target) or so damn good you don't need to worry about camouflage...
-Anna-Jayne Metcalfe on Paintballing
|
|
|
|
|