|
your answer was very helpful for me thank you.
but may I ask a question? what is it? and how can I fill it?
double[ , , ,] m_array4 = new double[,,,];
Thanks
|
|
|
|
|
A 4-dimensional array of doubles - and the first time I've seen one.
Like this: m_array4[x,y,z,w] = 1.0;
|
|
|
|
|
Not like that!
If you look back at my previous answer, that is a rectangular array (doubles or ints, bools or TextBoxes, it doesn't matter what the type is) so you have to tell the compiler how big it is!
double[ , , ,] m_array4 = new double[,,,]; Will give a compilation error, because new double[,,,] does not specify all (or indeed any) of the dimensions. Without them, the space cannot be allocated, and it will complain.
double[ , , ,] m_array4 = new double[3,4,5,6]; Will do it, but - remember I said they get big quickly? - it allocates space for 360 doubles...
Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together.
Manfred R. Bihy: "Looks as if OP is learning resistant."
|
|
|
|
|
Thanks for answer. 
|
|
|
|
|
These are multidimensional arrays. For more information, see here[^].
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
|
For some reason, while reading a GZip file I am having an issue where it stops after about 24K characters; it never reaches the end of file (I have tried it on several Gzip files of differing sizes, each containing one text file).
I created a small console app to replicate the problem, see below. Any insight would be welcomed...
Framework is .NET 3.5
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.IO.Compression;
namespace GZipDump
{
class Program
{
static void Main(string[] args)
{
UInt64 charsRead = 0;
string file;
if (args.Length > 0)
file = args[0];
else
{
Console.Write("GZip file to be read (full path): ");
file = Console.ReadLine();
}
using (GZipStream gz = new GZipStream(new FileInfo(file).OpenRead(), CompressionMode.Decompress))
{
byte[] bytes = new byte[1];
while (gz.Read(bytes, 0, 1) > 0)
{
Console.Write(Convert.ToChar(bytes[0]));
charsRead++;
}
}
Console.WriteLine("\n\nCompleted.");
Console.WriteLine("Characters Read: " + charsRead);
Console.ReadLine();
}
}
}
|
|
|
|
|
I've never treated the GZipStream like that, but you could try using one of the decompression example out of MSDN found here[^]. If you don't retrieve the original file out of the zip, you may be dealing with a different compression that isn't supported. If you do, then it'd be something to do with how you're reading it out here.
Give it a whirl and see what happens.
|
|
|
|
|
Unfortunately, that example is .NET 4.0 specific. This line:
Decompress.CopyTo(outFile);
Will not work in 3.5, because the CopyTo method does not exist (in fact, if you change the framework version in the link you provided, the example disappears). The example at this url at MSDN (the class page itself) does use the 3-parameter Read method (it is 3.5).
Part of my objective is to "read" the contents of a Gzip file *without* extracting it to disk. However, having it stop early is a problem...
|
|
|
|
|
Now that I have access to VS today, I can test your code. After creating a GZip file with .NET, via the following code:
using (GZipStream gz = new GZipStream(new FileInfo(file).Create(), CompressionMode.Compress))
{
byte[] bytes = File.ReadAllBytes(file);
gz.Write(bytes, 0, bytes.Length);
}
I then ran your code against it and it worked just fine. The question I have is are you accessing a file that isn't local? If so, this may be the source of your problem. Otherwise, you might want to create the zip file with .NET and see if that solves your problem.
|
|
|
|
|
Hello Everybody,
I was create a file with the use of serialize and store here some object information.
then I was create a new project and write code here for deserialize the information.
now it generate some error regarding Assemblyinfo. So pls give me some solution for this issue.
The Error Message is : Unable to find assembly 'serialization' version =1.1.1.1,Culture = Natural,PublicKeyToken = null
If you can think then I Can.
|
|
|
|
|
Have you checked your references? Are you missing one? Is it the correct version?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Are you using the XML serializer? The .NET XML serializer (well, the deserializer side) throws exceptions when it deserializes because of the way its implemented internally. They create an in-memory assembly on the fly, etc. and do a bunch of wacky stuff. It *is* however a handled exception by .NET and you shouldn't even see it inside your application unless you have First Chance Exceptions turned on. Nothing you can do about it besides turning First Chance Exceptions off or going to the binary serializer / deserializer.
|
|
|
|
|
I didn't know that - useful info
|
|
|
|
|
No i m not using XML Serializer. But now i m using XML serializer and It works successfully.
Thanks sir
If you can think then I Can.
|
|
|
|
|
How to implement a general graph represented by adjacency matrix? methods for adding, removing and searching for edges and nodes. thank you
|
|
|
|
|
Go to Google.com and start typing: Adjacency Matrix Graph. Start reading the links you find.
|
|
|
|
|
I dont find implementation in C#.
|
|
|
|
|
But did you find the logic for it? Now, here's a radical thought. You want to be a programmer? Then don't be lazy and write this code yourself.
|
|
|
|
|
If you need to add nodes, an adjacency matrix may not be the best choice. You can still get away with it if you know in advance the maximum number of nodes that you may need to add.
|
|
|
|
|
Unfortunately I have to use. Can I use List<list<t>>?
|
|
|
|
|
I've kind of programmed myself into a corner. I just changed my application to use David Hall's Task Scheduler Library for Net, so now the app requires elevated permissions (run as Administrator). However, I discovered that when I 'run as administrator' the app's connection to QuickBooks fails. Some research led me to find that the QuickBooks SDK will not work with elevated permissions on Windows 7. So now part of my app requires elevated permission and part of it requires non-elevated permission.
I think I can get around this by splitting the task scheduler code off in a separate process like this example:
"A new process with elevated privileges can be spawned from within a .NET application using the "runas" verb. An example using C#:"
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName = "C:\\Windows\\system32\\notepad.exe";
proc.StartInfo.Verb = "runas";
proc.Start();
So my question is, is this the only way? Are there other, better alternatives? Thanks.
|
|
|
|
|
Do what? Run half the app as elevated and the other not? No. The elevated portion must run as a seperate process. There is no such thing as running the app as both at the same time.
|
|
|
|
|
Last night I came to the conclusion that it could not be done. But it's always difficult to prove a negative, so thanks for the confirmation.
|
|
|
|
|
try this shell command
using System.Diagnostics;
using Microsoft.VisualBasic;
private void button1_Click(object sender, System.EventArgs e)
{
Interaction.Shell("C:\\Documents and Settings\\Jerry\\My Documents\\Calck.exe", (AppWinStyle) 2, false, -1);
}
|
|
|
|