|
Your code is very confusing. As Luc suggested, I wonder if it would compile.
karayel_kara wrote: while (it < iterasyon && mmse <= 0.00001)
{
mmse = 0;
mae = 0;
for (int nf = 0; nf < orneksay; nf++)
{
mmse += hesaplas(ndata, nf);
trains(nf);
}//nf
I see the delay happening in this block. But we cannot help you till the time we don't know the initial value of mmse and what does hesaplas(ndata, nf) do?
Also, what is the value of orneksay?
There are so many loopholes here.
Suggestion:
Add two int counters. one in while loop and one in for loop just to notice how many times does this loop run. If this number is too high, you should probably consider ways to reduce them.
|
|
|
|
|
thanks for reply.
i take notice of a point,
when i look at cpu using, i observer my code is using cpu %25 and i have quad pc so i can't use %75 of my cpu performance
is there this problem solution ?
not: orneksay=dataset
|
|
|
|
|
No buddy... it is not.
You are working on a single thread and it will try to squeeze as much time of processor as it can. I wouldn't suggest trying multithreading till the time you haven't sorted number of loops.
I have a feeling that its just number of loops. Could you do that counter and tell us how many times while loop runs and how many times for loop runs?
|
|
|
|
|
I have generated the AXLAPIService.cs file through wsdl.exe as the CSCO readme states. I have made all of the associated changes that are listed throughout the readme as well. Everytime the constructor is called an InvalidOperationException occurs. Currently the Inner Exception is "There was an error reflecting type 'APIRequest'.". I have regenerated the class modifying the namespace as well twice now. Has anyone seen this type of error? Is it a namespace issue?
The exception message reads "There was an error reflecting type 'RemoveLineReq'." Earlier it was on another type before I regenerated the class. Any help is appreciated.
|
|
|
|
|
Hi All,
I wrote some simple application with thread.
I getting exceptoin that say 'Specified cast is not valid.'
I dont know what i did wronge.
Code attached.
Thanks.
public struct SomeStruct
{
public Int32 t1;
public Int32 t2;
public SomeStruct(Int32 t1_, Int32 t2_)
{
t1= t1_;
t2= t2_;
}
}
private void Thread1(Int32 T1, Int32 T2)
{
object t = new SomeStruct(T1, T2);
Thread RunningThread= new Thread(Mathod1);
RunningThread.Start(t);
}
public void Mathod1(object ap)
{
Mathod2(((SomeStruct)ap).T1, ((SomeStruct)ap).T2);
}2
|
|
|
|
|
What's the signature of "Mathod2"?
|
|
|
|
|
|
Ok, then time to trace it...
Set a breakpoint on the line that's crashing, and verify that the parameter being passed is the proper type.
|
|
|
|
|
did it already - the object is fine and the parameters are there.
|
|
|
|
|
Have you tried breaking it down?
SomeStruct ss = (SomeStruct)ap;
Mathod2(ss.T1, ss.T2);
Functionally no different, but should confirm exactly where the problem is.
If the exception happens on the first line, then double-check "ap", because it isn't the right type. If the exception happens on the second line, then either your Mathod2 signature is wrong, or you're hitting a problem inside Mathod2()
(By the way, it's "Method", not "Mathod" )
|
|
|
|
|
The exception happaned in the first line
The exception is System.InvalidCastException was unhandled.
|
|
|
|
|
Then the parameter being passed to Mathod1() isn't a SomeStruct... I know you said you checked it, but check again.
|
|
|
|
|
If i change the struct to class - and using 'is' operator to see if this class type is SomeStruct i get back true as a result ( check it on the code ).
|
|
|
|
|
Ok, just put in the code and ran it... No cast exception... Though I did notice that in SomeStruct, your fields are "t1" and "t2", while when you pass them to Mathod2, you're referring to them as "T1" and "T2". Isn't that giving a compiler error?
|
|
|
|
|
Yes,
The T1 and t1 are my mistake ... in the original code its right.
|
|
|
|
|
Ok, well the code you pasted here works. From what you're saying, I gather you summarized it to post here, and it looks like whatever is causing the problem, you didn't include here.
So either you'll need to post the original code (Or at least the few lines around where the exception is hitting), or I won't be able to help.
|
|
|
|
|
Hi everyone, I am very much in need to know how to develop windows ce application.
It may not be the correct forum to ask but I don't know any place to ask.
I have two questions.
1. How do I start developing app for window ce 6.0.
2. I have an application written in vs c++/cli.Is there any way I can run the app on window ce 6.0.
I have the device and SDK and other necessary tools.
thanks in advance for your help.
|
|
|
|
|
|
I'm new to C# but I have java experience. For my class project I want to import a picture and be able to move it around with the joystick on a controller. I have found some code segments on how to code in a controller in c# but if someone can point me in the right direction that would be great.
Thanks
|
|
|
|
|
It would be helpful to know what type of application it will be, web or windows?
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
It would be for windows. The project is involving a jet pack picture that i made on PS and I need to make it move around in the application with a joystick
|
|
|
|
|
Hey,
I cant execute application through cmd, when the application trying to read the argument which was sent to it (text file), it fails...
when i'm truing to execute it through the IDE (vs2008), it works ok...
that's what i did in the main method :
static void Main(string[] args)
{
int choice = 0;
if (args.Length == 0)
choice = 1;
else
choice = 2;
switch(choice)
{
case 1:
{
string[] text = Directory.GetFiles("allText");
Console.WriteLine(DateTime.Now.ToString());
foreach (string fileName in text)
{
string substring = fileName.Substring(8);
ReadData_Logic rd_l = new ReadData_Logic(substring);
rd_l.runThreadsAndDecrypt();
rd_l.printKey(substring.Substring(0, fileName.Length - 15).Insert(0, "encryptedKey\\") + "_result.txt");
}
Console.WriteLine(DateTime.Now.ToString());
} break;
case 2:
{
Console.WriteLine(DateTime.Now.ToString());
string fileName = args[0];
Console.WriteLine(fileName); <big><--- for debug, here i do see the correct file name</big>
ReadData_Logic rd_l = new ReadData_Logic(fileName);
rd_l.runThreadsAndDecrypt();
rd_l.printKey(fileName + "_result.txt");
Console.WriteLine(DateTime.Now.ToString());
} break;
}
}
what wrong with the code ?
thanks
|
|
|
|
|
Works fine for me,
ConsoleApplication1.exe ad
31/03/2010 3:20:19 PM
ad
31/03/2010 3:20:19 PM
|
|
|
|
|
This may sound like a stupid question, but are you sure it is the code? Are you giving the program a fully qualified path to the file, or relying on a relative path, which would differ depending on your debug or release mode? Is teh file in the directory where you run the app?
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
the argument file is in the same directory as the executable file...
I tried to send the argument through the IDE itself, it works great there...
|
|
|
|