|
yup., one of my nerd friends is helping on the networking side of the app.. needs to read about Socket Buffer and Listening..
anyways., got a lot of hints from you guys on how to start my C++ adventure, hope it works for me.,
am trying to change my programming path from VB to C++., i wish myself good luck.
Thank you again.
|
|
|
|
|
I'm creating a new program. The ONLY thing which is important for me is the running time of the program. Should I use a regular expressions, or maybe should I write my own search code?
|
|
|
|
|
yftah1989 wrote: The ONLY thing which is important for me is the running time of the program.
Just leave your main() function empty. It can't get any faster than that.
Seriously, what are you trying to search for and in what?
|
|
|
|
|
yftah1989 wrote: Should I use a regular expressions, or maybe should I write my own search code
You should use the faster approach.
Seriously it may depend on a some factors like the complexity of your regex queries and the efficiency of your own search code (standard regex code is usually quite fast)
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
I am going to create a setup wizard application using property sheet.But I don't know how to use progress bar in property sheet.
My requirement is to update progress as we move from one property page to another.
Please provide some suggestions/samples.
Thanks,
Sachin
|
|
|
|
|
Hi sir,
Can i set the float caption to CLabelControl.
means i want to pass a Flaot value to CLabelControl.
i.e CLabelControl m_st;
m_st.SetCaption(float value); ///
Thanks
Raj
|
|
|
|
|
I guess Setcaption should accept a CString.
if that is the case, then you can format your float value to a string and then pass it to the SetCaption().
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Hi!
I've two list boxes. These two list boxes contain similar elements at similar ids. i.e If List1 contains "Apple" as item0, List2 also contains "Apple" as item0. Similarly both the lists has 9 elements.My requirement is:
If I select "Apple" from List2, Apple could not be selected from List1. How to do this?
|
|
|
|
|
Why don't you prompt a warning message to the user (on duplicate selection) and then deselect the item?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi!
Thanks for the reply. I'm getting the selected item index for List box2 using this line:
oppId = opplist->getSelected(); . Then I'm trying to change the visiblity
of the corresponding item in list box1 using this code:
void CTeamSelectState::GUIEvent(CGameManager* pManager,const SEvent& event)
{
IGUIListBox *playerCty;
if((event.GUIEvent.EventType == gui::EGET_LISTBOX_CHANGED)||(event.GUIEvent.EventType == gui::EGET_LISTBOX_SELECTED_AGAIN))
{
IGUIListBox *opplist = (IGUIListBox *)event.GUIEvent.Caller;
int oppId = opplist->getSelected();
printf("oppId:%d \n",oppId);
if(oppId >= 0 && oppId < 9)
playerCtyExclude(oppId, playerCty);
else
{
printf("Error:");
return;
}
}
}
The function playerCtyExclude() is defined as follows:
void CTeamSelectState::playerCtyExclude(int oppId, IGUIListBox *player)
{
for(int i = 0; i < 9; i++)
{
if(i == oppId)
player->getElementFromId(oppId)->setVisible(false);
else
player->getElementFromId(oppId)->setVisible(true);
}
}
When I select any item in the second list box, application crashes. How to achieve my task?
|
|
|
|
|
As I said I wouldn't try to hide the item.
By the way, what framework are you using?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
|
Do you mean the IrrLicht Engine ?
Why don't you post in the framework forum [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi sir,
I am finding the pow of some values,If it is for smaller values,i am getting the result properly.
But if for larger values like (where result will be like2.20700e+007)
I am using this code:
result = pow(temp1,temp3);
res.Format("%2d",result);
result is in float and i am getting value as 2.20700e+007
then i am trying to convert it into CString,so that i can tokenize the result in this way(2.20700)
But i am getting junk values while converting,its not converting properly.
Am i doing any thing wrong or any other way to convert it to CString,where i can get the value properly
Thanks
Raj
|
|
|
|
|
as you said, you are going to operate on larger values, the problem should be that, your resultant value is exceeding the 4 byte boundary, and you are getting improper result.
by the way, what are the values you are passing to pow?
what is the result you are getting, and what is the result you are expecting?
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
chandu004 wrote: what are the values you are passing to pow?
The value varies,depends on some condition.
ex: pow(0.2365,-0.3445)....
chandu004 wrote: what is the result you are getting
result = pow(temp1,temp3); // Here i a am getting the result as 2.20700e+007
chandu004 wrote: what is the result you are expecting?
I am expecting the same result in CString
res.Format("%2d",result); // here i am getting some junk values in res.
I hope i cleared u
Thanks
Raj
|
|
|
|
|
look at the following url.
http://www.elook.org/programming/c/pow.html[^]
there he says that,
There's a domain error if base is zero and exp is less than or equal to zero
i think you may have to do some workaround on this.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
If result is a float you should use %f instead of %d.
|
|
|
|
|
You're trying to format a float with a decimal (i.e integer) format specifier. Use %f instead.
Ash
PS: Ooops, that'll teach me to leave a respsonse unsent while I go to a meeting.
|
|
|
|
|
Does anyone know what kind of HANDLE hToken should be passed as the first parameter?
|
|
|
|
|
A token for the user as explained here[^].
It's time for a new signature.
|
|
|
|
|
When I am on windows xp or later, I could get SERVICE_CONTROL_SESSIONCHANGE event by calling RegisterServiceCtrlHandlerEx and HandlerEx .But when I am on windows 2000 ,the SERVICE_CONTROL_SESSIONCHANGE event does not support windows 2000.
And now I am willing to get the logon and logoff event on windows 2000 in my service (win32 service), I could not find any method.
|
|
|
|
|
Hello all and congratulate for new theme of site.
float f1,f2;
bool b;
float f1 = 10.0;
float f2 = f1 / 3;
b = f1 == (f2 * 3.0);
WHY always b is 0 (false). Really aren't f1 and f2 equal?
If it is, why?
THankS in AdVanCE. . .
|
|
|
|
|
Because when you deal with floating point values, equality cannot be expressed.
because one of the number cannot be accurately be represented as a binary number thus leading to rounding errors that should be taken into account by the developers.
see this : http://docs.sun.com/source/806-3568/ncg_goldberg.html[^]
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: Because when you deal with floating point values, equality cannot be expressed.
Comparisons work very well with floating point numbers, e.g. equality. Arithmetics, on the other hand, is tampering with accuracy.
|
|
|
|