|
mass85 wrote: Most of the temp values are 0... which is of course incorrect. Do you know, what might be the reason for that?
No idea whatever, but obviously some part of your randomiser is incorrect.
mass85 wrote: int uniform(int X){
h = int ( double (X) / q );
X = a*(X - q*h) - r*h;
if (X < 0) X = X + m;
return X;
}
Try using more meaningful variable names as it can often aid in problem diagnosis.
|
|
|
|
|
This function is an implementation of a math formula...
I have finally found the bug!
And it was in the part of code pasted here. You couldn't find it, because you don't know whole design of this simulator In fact not whole coreUpLinkRatio array was initialized because of wrong for loop parameters after copying and pasting blocks of code without proper check of all details...
It should be this:
for(int i = 1 + repeaters; i < staNr; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
...instead of this:
for(int i = 0; i < AC; i++){
coreUpLinkRatio[i] = x;
for(int j = 0; j < (runsNr*(2*beMsgsToObserve + shift + runShift)); j++)
x = uniform(x);
}
Thank you for your help!
|
|
|
|
|
mass85 wrote: I have finally found the bug!
Congratulations!
So when you wrote: There are no uninitialized variables in this block of code. I don't think there are any in whole program.
You did not realize that: In fact not whole coreUpLinkRatio array was initialized.
A good lesson to be learned here, methinks.
mass85 wrote: Thank you for your help!
My pleasure; I just wish my own bugs were as easy to find!
|
|
|
|
|
Developing this project learned me a lot, believe me. I found all the bugs I noticed (it hadn't been always like that before) and the more bugs I noticed and found the faster debugging was in the future. But this bug was a little bit different, that's why I wouldn't have found that without you insisting on uninitialized variable to be the problem.
But what was the problem in fact? Was the uninitialized part of array filled with zeros? It would explain why getUpLinkRatio returned zeros for most of the staAddresses. Core of the multiplicative generator can't be equal to 0, because it would return always 0.
Good luck in your debugging!
|
|
|
|
|
Hi, i am not familiar to win32 api so this may seen a easy question, i have a handle to a menu item, how can i action (virtual press that menu) and run it's method. I want to do this from other program ,from my programm i want to control menus from other apps(i already read the menus,i have handles to them).
Thx.
I found that it will work in most cases with WM_command
simion314
modified on Sunday, September 20, 2009 7:02 AM
|
|
|
|
|
Use FindWindow() to find the other program and use SendMessage()/PostMessage() (probably a WM_COMMAND message) to "press" the button.
|
|
|
|
|
How do you bind a Microsoft Forms TextBox in a Access 2002 Memo Field in VC++ 6? I am using this but just get a blank field
CWnd* pDSC = GetDlgItem(IDC_ADODC1);
pEdit = GetDlgItem(IDC_TEXTBOX1);
pEdit->BindDefaultProperty(0x16,VT_BSTR, _T("Synopsis"), pDSC);
|
|
|
|
|
|
Please must delete this post and re-post in the C# forum yourself.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Why didn't you post this question here[^] the first place?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
i want to compile the c/c++ programs using commands in cmd promt in windows
|
|
|
|
|
|
|
I have a problem. I make a program like this:
One Form, 2 ListBoxs, 1 grammar file and SAPI. ListBox1 have 3 items (Blue, Green, White). ListBox2 is empty. Grammar file have 'Blue', 'Green' and 'White'.
When i talk 'Blue', 'Green' or 'White' the program recognize the word and add to ListBox2.
In Windows XP (Sapi 5.1) the program works wonderful. In Windows Vista when i talk 'Blue', 'Green', 'White' the word in ListBox1 is selected and nothing happen to ListBox2 (Windows Vista recognize, not my program). How can i fix it?
modified on Saturday, September 19, 2009 12:03 PM
|
|
|
|
|
FredBrina wrote: SAPI
I'm not familiar with this API, what is its purpose?
Can you post the portion of code that has the problem? Everyone then has a better idea of what your program is trying to do.
|
|
|
|
|
SAPI = Speech Recognition API from Microsoft. Windows Vista (english version) have the version 5.3. Windows XP u can install version 5.1. I dont post the code because i am using Borland C++ and the code is bigger. My program recognize the words with no problems. The problem is: In Windows Vista the native recognize program seems to try to recognize first then my program.
|
|
|
|
|
FredBrina wrote: The problem is: In Windows Vista the native recognize program seems to try to recognize first then my program.
I don't quite understand what you are saying here, but rereading your original post it sounds as though the SAPI is recognising the word you speak, and selecting that item into one of the list boxes. You then expect some action in the other listbox which works in XP but not in Vista. Have you checked the differences between the two SAPI versions for any known errors? Have you checked the relationship between the two list boxes?
FredBrina wrote: I dont post the code because i am using Borland C++ and the code is bigger.
Without seeing the code where the problem is occurring it is impossible to make any further guesses as to what may be happening.
|
|
|
|
|
Yes, Sapi is recognising the word. The problem is: Windows XP -> my program recognize. Windows Vista -> Windows Vista recognize. See the problem:
The program now:
ListBox1 = "Blue", "White" ...
ListBox2 = Empty
Grammar file = "Blue", "White" ...
When i talk "Blue", Windows Vista recognize the word and select the item. My program not recognize!
The program fixed:
ListBox1 = "B.l.u.e", "W.h.i.t.e" ...
ListBox2 = Empty
Grammar file = "Blue", "White" ...
When i talk "Blue", Windows Vista didnt recognize (ListBox1 now have "B.l.u.e"). My program recognize!
|
|
|
|
|
Well I can't say that I understand your explanation, but I'm happy that your problem is resolved.
|
|
|
|
|
Actually I did not resolve my problem. Only demonstrated that speech recognition of my program works on Windows Vista.
|
|
|
|
|
How do I prevent the voice recognition native Windows Vista work? It is activated before the speech recognition of my program. He recognizes the text of the listbox and then do not let my program to "act".
When I replace the text of the Listbox ("blue" -> "b.l.u.e.") speech recognition native windows vista can not find anything. So my program can act.
|
|
|
|
|
I am running under Windows Vista. I am adapting to Visual C++ a program which I wrote under Borland C++. It called these:-
DIR :: a struct type which contained the running information on looking through a directory.
Functions:-
opendir(---)
readdir(----) :: step to the next file in the directory
closedir(----)
Please what are their Visual C++ equivalents?
|
|
|
|
|
I think this[^] may have the information you are looking for.
|
|
|
|
|
Check out FindFirstFile[^] and FindNextFile[^] for starters.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
In Visual C++, please how can I stop automatic redirecting of library function names to 2-byte character forms, e.g. SetDlgItemText to SetDlgItemTextW?
modified on Saturday, September 19, 2009 9:57 AM
|
|
|
|