|
CJ942002 wrote: I want to validate this web site address.
What do you mean by "validate?" Are you wanting to know if it's a well-formed URL, or if the URL actualy works? If the latter, try IsDestinationReachable().
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
Hi
Whats the Difference between ASSERT and VERIFY macro?
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
They hide that information in the documentation.
From the description of ASSERT:
In the Release version of MFC, ASSERT does not evaluate the expression and thus will not interrupt the program. If the expression must be evaluated regardless of environment, use the VERIFY macro in place of ASSERT.
Judy
|
|
|
|
|
JudyL_FL wrote: They hide that information in the documentation.
So we are lucky that you have access to their documents.;)
|
|
|
|
|
The easiest way to find this out is by hovering over one of those words in the IDE and pressing the F12 key. That will take you to the actual macro where you can see what it does.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
HI,
I was developed the source code for time and frequency calculation.
i put two text boxes one for time value another for frequency value.
Both are float data type.
formula is :- frequency = 1 / time * 1000
and also Time =1 / frequency * 1000;
In Time text box kill focus event this( frequency = 1 / time * 1000 ) formula work properly and show one answer in float value in frequency text box.
but
In frequency text box kill focus event (Time =1 / frequency * 1000) formula did not work properly.
ex:
i put 1550 in time text box
answer 0.545161 is shown on frequency text box
then i move the cursor in to reverse ie, time text box it display 1550.000732 instead of 1550.
any body solve my problem as quick as early.
Thanking you.
vivek
|
|
|
|
|
Hi,
The way floats/doubles are stored in binary makes it impossible to exactly represent
most values, especially the ones that seem like round numbers to humans thinking
using base ten.
So 4, 2, 1, 0.5, 3.5, 3.75 and many others are representable exactly (basically since
they all equal an integer divided by some power of 2); but 3.6 and 3.8 and an infinite
number of other values are not.
Now whatever float/double function you call, if it returns a float/double will suffer
from the same phenomenon. So the only way to really get "3.6" or "3.8" is by using a
function that not only rounds but returns a string. I trust there are some formatting
methods that do just that in every programming language; In .NET languages
ToString() should be one of them, given an appropriate format specifier.
BTW: to circumvent this problem, especially for monetary numbers, they introduced
the "decimal" data type (which basically stores decimal digits).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- before you ask a question here, search CodeProject, then Google
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get
- use PRE tags to preserve formatting when showing multi-line code snippets
|
|
|
|
|
pnpvivek@gmail.com wrote: i put 1550 in time text box
answer 0.545161 is shown on frequency text box
My math says that should have been 1 / 1550 * 1000, or 0.645161.
pnpvivek@gmail.com wrote: then i move the cursor in to reverse ie, time text box it display 1550.000732 instead of 1550.
any body solve my problem as quick as early.
Have you tried using %.0f instead of just %f ?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are late :P
--[^]
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
BTW
I sometimes have problems with delayment on the site an post a message more than once. Just making a reload of the forum and deleting the multiple messages does not take a lot of time, and would be nice from you.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
HI,
I was developed the source code for time and frequency calculation.
i put two text boxes one for time value another for frequency value.
Both are float data type.
formula is :- frequency = 1 / time * 1000
and also Time =1 / frequency * 1000;
In Time text box kill focus event this( frequency = 1 / time * 1000 ) formula work properly and show one answer in float value in frequency text box.
but
In frequency text box kill focus event (Time =1 / frequency * 1000) formula did not work properly.
ex:
i put 1550 in time text box
answer 0.545161 is shown on frequency text box
then i move the cursor in to reverse ie, time text box it display 1550.000732 instead of 1550.
any body solve my problem as quick as early.
Thanking you.
vivek
|
|
|
|
|
HAI,
I was developed the source code for time and frequency calculation.
i put two text boxes one for time value another for frequency value.
Both are float data type.
formula is :- frequency = 1 / time * 1000
and also Time =1 / frequency * 1000;
In Time text box kill focus event this( frequency = 1 / time * 1000 ) formula work properly and show one answer in float value in frequency text box.
but
In frequency text box kill focus event (Time =1 / frequency * 1000) formula did not work properly.
ex:
i put 1550 in time textbox
answer 0.545161 is shown on frequency text box
then i move the cursor in to reverse ie, time text box it display 1550.000732 instead of 1550.
any body solve my problem as quick as early.
Thanking you.
vivek
|
|
|
|
|
Please delete your two other messages.
This is not an error, it is due to floating point precision. Just don't print the decimals you don't need in the text box.
|
|
|
|
|
use trunc to quit decimals without rounding, or floor to round always down.
Is something annoying, I had it as well and didn't find a way to do it but this one.
BTW:
1 / 1550 * 1000 = 0,64516129032258064516129032258065 and not 0,54516
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
hi all
I use vs6
I have to find a way to change the default language of WinXP/Win2K
I can get the default language by use function GetSystemDefaultLCID.
if the return val of GetSystemDefaultLCID != 1037
i have to change it to 1037.
Is some one know the way.
TNX
|
|
|
|
|
This seems to be interesting. Have you achieved this? I could not find a solution immediately.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
no, if you can think about any solution i be glad to see that.
TNX
|
|
|
|
|
Hi All,
I'm got an interesting problem and I'm trying to think of the best way to get around it.
I've got to import some data into structs held currently held in a std::vector. It's basically 3D position data. My struct looks something like this:
struct vertex<br />
{<br />
float x;<br />
float y;<br />
float z;<br />
}
Now, when I read in the data from the file I am going to get a lot of duplicate values, i.e. a vertex where x,y & z match an already existing point.
What I'd like to do is something like this:
- Read x,y,z from file.
- Check if vertex struct with those three values already exists in the vector.
- If yes, return the index in the vector that points to the existing record.
- If no, insert a new vertex record with the values and return it's index.
The issue I'm having is how to quickly determine if the values are already in there. The simpliest solution would be for every value read from the file, loop through the vector start-to-end looking for it.
However, we could be looking at an insane ammount of data here and I can see this getting slower and slower as the vector gets larger and larger.
Can anyone recommend a solution?
- Jed
|
|
|
|
|
NJed wrote: Can anyone recommend a solution?
Keep them in a hash-set instead (you'll need to supply your own operator == ) and if the order is important, keep the pointers to them in a vector.
|
|
|
|
|
Could you point me to an example? I can't say I've ever used a hash before.
- Jed
|
|
|
|
|
Or just make your own validation methode before saving.
BOOL CYourClass::ValidateVertex (vertex vData, int ArrayLimit)
{
int nError = 0;
for (int = 0; i < ArrayLimit; i++)
{
if ((m_YourVector[i].x == vData.x) && (m_YourVector[i].y == vData.y) && (m_YourVector[i].z == vData.z))
{
nError++;
break;
}
}
;
if (nError)
return FALSE;
;
return TRUE;
}
;
;
do
{
if (ValidateVertex (vNowReading, nAlreadySavedVertex))
{ SaveTheDataAtTheEndOfYourVector (vNowReading);
nAlreadySavedVertex++;
}
} while (FileNotEnded);
Or something like this.
BTW if you dont know a priori how large the vector is going to be, because of repetitions... would not be better to use a list instead a vector ??
The only and biggest problem... if there are a LOT of data... the validation will take longer as the saved data amount increases. But this should be always the same, no matter which methode you use.
Hope it helps
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi all,
Is there any specific property in rich edit control so that by enabling it only we can enter text in that in second/third.. line succesively by pressing enter key.Actually while getting the dialog box run i am able to get the functionality of ENTER key in Rich edit control but when i am running the project i am not able to get the functionality of ENTER key.Is there any specific reason for this.
Please guide regarding this.
Regards,
Mayank
|
|
|
|
|
Are you talking about the ES_WANTRETURN style?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|