|
I think the link[^] is sufficient for explanation
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
Pay no attention to those other two impostors. See this article instead.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
See this[^] post also.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Leela: Fry, you're wasting your life sitting in front of that TV. You need to get out and see the real world.
Fry: But this is HDTV. It's got better resolution than the real world <
|
|
|
|
|
ok ok! don't struggle mates! i will see all of them and appreciate.
thanx a lot :*
|
|
|
|
|
I am using std::vector in my project. Later on, however, this will change into csr::vector , a container defined in namespace csr that implements the same functions etc.
I am writing std::vector everywhere in my code and I was wondering if I could do something like this
#define vect std::vector
use vect in the code and change only the #define when I have to switch to csr type of vector.
Could this cause any issues??
|
|
|
|
|
You may also exploit the using directive for the purpose:
using std::vector;
...
vector<int> v;
...
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,
In your top level header (usually stdafx.h) switch the vector type:
#ifdef USE_STD_VECTOR
#include <vector>
using std::vector;
#else
#include "csr_vector.h"
using csr::vector;
#endif
This allows you to set different Project Configurations in MS Visual Studio terminology: Win32 Std Debug, Win32 CSR Debug, etc ... differing by defining (or not) USE_STD_VECTOR at configuration level.
cheers,
AR
When the wise (person) points at the moon the fool looks at the finger (Chinese proverb)
|
|
|
|
|
If you're going to entirely replace std::vector with csr::vector you could simply use vector everywhere instead of std::vector .
When including the header file you could then write -
#include <vector>
using namespace std; Then when you're switching to the other namespace you simple change that to -
#include <vector>
using namespace csr; By the way, why are you planning to not use std::vector ?
|
|
|
|
|
the other answers all speak about the use of "using", but you could use as well a typedef as in:
#ifdef USE_STD_VECTOR
typedef std::vector vector;
#else /* ! defined(USE_STD_VECTOR) */
typedef csr::vector vector;
#endif /* USE_STD_VECTOR */
then everywhere you used std::vector you just use vector.
Cheers
|
|
|
|
|
Hi all,
i want to use memo filed in my access database to store more than 255 char.
please tell me how can i use memo filed in access database and CRecordSet?
if possible please exlain me with example how can use it and how can insert and update data in memo field.
thanks in advance.
|
|
|
|
|
Le@rner wrote: i want to use memo filed in my access database to store more than 255 char.
By default, a Memo field can store up to 2GB of data, so 255 characters is not a problem.
Le@rner wrote: please tell me how can i use memo filed in access database and CRecordSet?
Much like you would any of the other field types. What specific issue(s) are you having?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
In access table i m using a Field with Data Type Memo.
in CRecordSet derived class of this table,memo field is RFX_Text type and its variable is of CStringW type.
Than in my application i want to store more than 255 char in this field but some error or exception generate here.
error is "mfc internal error: unable to load error string from resource" and generate CDBException at memory location 0x0885fb9c..
please help me for this.
modified on Wednesday, November 10, 2010 12:13 AM
|
|
|
|
|
Using the debugger, set a breakpoint on the call to Update() , and then step into the internal MFC code until you find where LoadString() is being called.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
hi
i created a new project, a dialog based MFC application.
i inserted a button in the dialog with id IDC_BUTTON1.
i added a member variable of type AcButton derived from CButton to the dialog object to handle WM_LBUTTONDOWN on the button.
1. why is the button enabled while there's no handler for the IDC_BUTTON1 command and i've not included ON_COMMAND_UPDATE_UI in the message map of the dialog? in another words, why the button is enabled by default?!
in this case, i see that the AcButton::OnLButtonDown is called.
in the resource editor, i disable the button. in such a case, the AcButton::OnLButtonDown is not called anymore by clicking on the button. instead, the WM_LBUTTONDOWN is received by the dialog (the parent of the button).
2. who decides to do this?!
3. how can i make mouse events be received by a control in a dialog which cannot be focused nor get enabled? let's say eg. a static text, how can get the mouse events?
i hope i could clarify my three questions. plz answer my by numbers.
thx
|
|
|
|
|
What does the 890818 stand for? *curious*
|
|
|
|
|
this kind of tag is helpful in the following ways for me:
1. i may find my own posts between a plenty of posts without requirement to read them one by one.
2. today is the 18th of the 8th month of the year of 1389. we totally use a different calendar which is the most accurate one in the world, instead of Gregorian. this helps me find when i had posted the question.
3. this makes ppl like u ask the question as a reply to my post. then i get happy to have an answer to my question, for a short moment of the time. lol
|
|
|
|
|
From Ole Server Application do we have to call this (WM_QUERYENDSESSION)
|
|
|
|
|
Member 2883067 wrote: From Ole Server Application do we have to call this (WM_QUERYENDSESSION)
What you precisely mean with this sentence? The WM_QUERYENDSESSION message is sent by Windows in the initial steps of a shutdown.
If you want to shutdown the operating system (turn-off, reboot, ...) you should use the ExitWindowsEx Function (Windows)[^], that logs off the interactive user, shuts down the system, or shuts down and restarts the system. It sends the WM_QUERYENDSESSION message to all applications to determine if they can be terminated.
For an example on how to use that API, see How to Shut Down the System (Windows)[^]
|
|
|
|
|
I am working on a database application, developed in 'C' programming language, which talks to database through the odbc drivers. What is the best way to track/troubleshoot the 'crash' errors like NULL pointers, memory crashes, etc? As the application is a huge code base, I am looking for one smart way to track the application crashes. Please suggest, if any?
|
|
|
|
|
If you are not already using it, then the best first step is to use your debugger. You cannot do any advanced debugging without a debugger.
|
|
|
|
|
coder21k wrote: What is the best way to track/troubleshoot the 'crash' errors like NULL pointers, memory crashes, etc? As the application is a huge code base, I am looking for one smart way to track the application crashes.
Write a crash report to identify application version, environment, registers, calling stack etc. Then assign each maintainer time to investigate and fix crashes, for a huge code base you probably have multiple teams/maintainers. If you have a ticket systems for defects the teams can create individual bug tickets after investigation and narrowing down the cause of a crash, marked as important. Application crashes are not only annoying for end users, they should be handled with high priority because they could be a sign for quality/security/development weaknesses. As an alternative you could add stress and penetration tests to your test strategy.
Hope it helps
/M
|
|
|
|
|
hi,
i'm working on a project that capture real time temperature.I managed to capture the real time temperature but when i tried to send the captured values to another device it displayed weird characters eg' ?.After which i did some research again on the codings.I found out that the software i'm using doesn't support %f and i'm required to do some conversion to it.I came up with the codes but its unable to work.Please advice.
my original codes:
void loop(){
float tmpVALUE=0; char dataToSend[100];
if(!BT.createConnection("0003190D102D","02"))
{
USB.println("");
USB.print("--- CONNECTION -- MTU: ");
USB.print(BT.connection_mtu[0],BYTE);
USB.print(BT.connection_mtu[1],BYTE);
USB.println(BT.connection_mtu[2],BYTE);
}
else USB.println("Connection failed");
tmpVALUE = SensorEvent.readValue(SENS_SOCKET5);
if(tmpVALUE>0.5)
{
tmpVALUE=((tmpVALUE-0.5)/0.01);
}
else
{
tmpVALUE=tmpVALUE/0.01;
}
delay(100);
XBee.print("Temperature: ");
XBee.println(tmpVALUE);
delay(5000);
sprintf(dataToSend,"%f",tmpVALUE);
if(!BT.sendData(dataToSend)) USB.println("Data sent OK");
else USB.println("Error while sending data");
modifed
void loop()
{
float testVal=7.3812849; char dataToSend[100];
char converttmpVALUE[100];
if(!BT.createConnection("0003190D102D","02"))
{
USB.println("");
USB.print("--- CONNECTION -- MTU: ");
USB.print(BT.connection_mtu[0],BYTE);
USB.print(BT.connection_mtu[1],BYTE);
USB.println(BT.connection_mtu[2],BYTE);
}
else USB.println("Connection failed");
tmpVALUE = SensorEvent.readValue(SENS_SOCKET5);
if(tmpVALUE>0.5)
{
tmpVALUE=((tmpVALUE-0.500)/0.010);
}
else
{
tmpVALUE=tmpVALUE/0.010;
}
delay(100);
XBee.print("Temperature: ");
XBee.println(tmpVALUE);
delay(5000);
sprintf(dataToSend,"%s",ftoa(converttmpVALUE,testVal,4));
char *ftoa(char *a, double f, int precision)
{
long p[] = {0,10,100,1000,10000,100000,1000000,10000000,100000000};
char *ret = a;
long heiltal = (long)f;
itoa(heiltal, a, 10);
while (*a != '\0') a++;
*a++ = '.';
long decimal = abs((long)((f - heiltal) * p[precision]));
itoa(decimal, a, 10);
return ret;
}
if(!BT.sendData(dataToSend)) USB.println("Data sent OK");
else USB.println("Error while sending data");
|
|
|
|
|
Check what kind of character encoding is supported by the target device.
|
|
|
|
|
[Warning]
Bound-checkings (and any other check) are left to the reader...
[/Warning]
void ftoa(char *buf, float f, int p)
{
int i, n;
unsigned long l
for (n=0; n<p; n++)
f *= 10;
l = (long) (f + .5);
for (n=0; l>0; n++, l/=10)
{
if (n==p)
{
buf[n]='.';
n++;
}
buf[n]= (l % 10) + '0';
}
for(i=0; i<n/2;i++)
{
char c;
c = buf[i];
buf[i] = buf[n-1-i];
buf[n-1-i]= c;
}
buf[n]='\0';
}
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 replying.The solution you gave me doesn't work as my editor gave me an error:(In function 'void loop()':
error: expected primary-expression before 'char').Maybe you would like to take a look at the whole code as I've been trying several methods but it still doesn't work.I'm just a beginner in c++ so do bear with me.Thanks
float tmpVALUE=0;
int n=0;
void setup(){
SensorEvent.setBoardMode(SENS_ON);
XBee.setMode(XBEE_ON);
delay(50);
USB.begin();
USB.println("USB port started...");
USB.close();
BT.ON();
if( BT.flag & BT_ERROR_ON ) USB.println("Error, 'ROK' not received");
else USB.println("BT module ready...");
if(!BT.init()) USB.println("Init OK");
}
void loop()
{
float tmpVALUE=0; char dataToSend[100];
char converttmpVALUE=0;
if(!BT.createConnection("0003190D102D","02"))
{
USB.println("");
USB.print("--- CONNECTION -- MTU: ");
USB.print(BT.connection_mtu[0],BYTE);
USB.print(BT.connection_mtu[1],BYTE);
USB.println(BT.connection_mtu[2],BYTE);
}
else USB.println("Connection failed");
tmpVALUE = SensorEvent.readValue(SENS_SOCKET5);
if(tmpVALUE>0.5)
{
tmpVALUE=((tmpVALUE-0.5)/0.01);
}
else
{
tmpVALUE=tmpVALUE/0.01;
}
delay(100);
XBee.print("Temperature: ");
XBee.println(tmpVALUE);
delay(5000);
sprintf(dataToSend,"%s",converttmpVALUE);
ftoa(char* buf,float f,int p);
{
int i, n;
unsigned long l
for (n=0; n<p; n++)
f *= 10;
l = (long) (f + .5);
for (n=0; l>0; n++, l/=10)
{
if (n==p)
{
buf[n]='.';
n++;
}
buf[n]= (l % 10) + '0';
}
for(i=0; i<n/2;i++)
{
char c;
c = buf[i];
buf[i] = buf[n-1-i];
buf[n-1-i]= c;
}
buf[n]='\0';
}
if(!BT.sendData(dataToSend)) USB.println("Data sent OK");
else USB.println("Error while sending data");
if(!BT.removeConnection()) USB.println("Connection removed");
else USB.println("Error while removing connection");
if(!BT.removeTrustedDevice("0003190D102D")) USB.println("Trusted Device removed");
else USB.println("Error while removing trusted device");
delay(5000);
}
|
|
|
|