|
Cedric, could you please suggest a way to accomplish this ?.
Thanks & Regards
Vishrant Shah
|
|
|
|
|
Can't you simply replace C++ by a scripting language like Python (as I suggest in my previous reply) ?
And why do you need a conversion ? What are you trying to achieve in fact ? Don't reply with what you said in your first post: try to explain the high-level design that brought you to this akward "solution".
|
|
|
|
|
We are doing Financial derivative pricing in C++ using Monte Carlo model. We have a Monte Carlo code which spits out the price of F'derivatives depending upon the payoff formula e.g. max(S-K), (S^2-K^2) ... So, we don't know what payoff formula will be fed in at the runtime. The formula will be specified by a trader/pricer through a VB front-end, which we need to interpret in C++ code, and use it in the Monte Carlo simulation program.
Thanks & Regards
Vishrant Shah
|
|
|
|
|
Vishrant Shah wrote: The formula will be specified by a trader/pricer through a VB front-end, which we need to interpret in C++ code, and use it in the Monte Carlo simulation program.
So the problem has really nothing to do with either C++ or VB. All you are trying to do is interpret some formula entered as text and execute it in real time. This requires some form of parser that will split your string into its constituent tokens and either convert into some format as specified by the simulator, or compute a value via the rules of mathematics. I think you may find many examples, through Google, of simple calculator programs, which you could adapt to your needs.
|
|
|
|
|
You may host the Windows Script Control (download here [^]) in your application.
Since it is an Active X component, its usage (here some examples [^], unfortunately addressing only VB6 applications) maybe a bit complex if you're not experinced in COM programming.
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]
|
|
|
|
|
It's a daunting task: good luck!
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]
|
|
|
|
|
Hello all
Though its linux problem I thought I will give a try to my age old forum as the problem seems to be typical memory management ...ok here I go ..
We have a class which has members listed as below in the declaration
class SOAP_CMAC MyUserProfile
{
public:
std::string name;
std::string name2;
std::string firstName;
public:
LONG64 pwdStatus;
std::string setType;
public:
class NotifyOptions *mNotifyOptions;
LONG64 USCOREtype;
std::string USCOREmacAddress;
std::string USCOREipAddress;
public:
MyUserProfile() { }
virtual ~MyUserProfile() { }
};
In the run time after object for MyUserProfile is created , reference to std::strings USCOREmacAddress and USCOREipAddress are crashing due to segmentation fault!
The lines which crash due to segmentation fault are doing an assign operation
USCOREmacAddress.assign(“char string”);
But reference to std::strings name , name2 , firstName and settype do not crash .
Upon observation I found that the line class NotifyOptions *mNotifyOptions is in between the two sections . So I moved the line class NotifyOptions *mNotifyOptions ; to the end of the class declaration . This made the reference to name , name2 , firstName , settype also to crash !!! . It seems this object mNotifyOptions which will be created at run time is somehow the reason for the crash happening on std::string objects ….But I am at wits end to know what it is and how to solve it …
The point is : we migrated from gcc library 2.4. to 2.6 . And after this this problem surfaced without any modifications in the code present in both situations ….
Any help guys on this problem ?
with warm regards
redindian
|
|
|
|
|
If you are not getting any additional warning messages from the compiler with 2.6, then I would check to make sure that all modules were being compiled with the new 2.6 library. Delete all the object modules first if you have to.
|
|
|
|
|
class NotifyOptions *mNotifyOptions;
this is only a pointer, which got to get assigned to an object to work with. As
mNotifyOptions = new NotifyOptions();
in such strange cases you should watch the memory for changes
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi Hans
Could you plesae elaborate your point ?
I understand the memory will be allocated to the pointer of the class object at runtime .
But why and how should it affect the adjacent std::strings ? Also the point I am wondering is that the memory of std::string comes from stack while that of mNotifyOptions is from heap .
regards
redindian
|
|
|
|
|
you got to code it somewhere in your code!!!
mNotifyOptions = new NotifyOptions();
Did you?
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
I would do a search and see if the implementation of malloc was modified between gcc library 2.4 to 2.6. My guess is that if the implementation of malloc changed, memory could be allocated differently using 2.6 over 2.4. You may have already had a memory bug previously using 2.4 but it did not manifest itself until the memory was allocated in some different way using the new library.
Apparently somewhere code is overwriting memory in your class corrupting the private contents of the strings or corrupting the internal datastructures of malloc itself. You need to watch the memory locations for the strings to narrow down when the contents of those strings become corrupted.
One clarification ... do the seg faults happen only when setting the string value or anytime you use the contents of the string ?
|
|
|
|
|
class SOAP_CMAC MyUserProfile
{
public:
std::string name;
std::string name2;
std::string firstName;
LONG64 pwdStatus;
std::string setType;
class NotifyOptions *mNotifyOptions;
LONG64 USCOREtype;
std::string USCOREmacAddress;
std::string USCOREipAddress;
MyUserProfile() { }
virtual ~MyUserProfile() { }
};
void main( void )
{
MyUserProfile mup;
mup.USCOREmacAddress = "1234"; <<--- this crashes?
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"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
|
|
|
|
|
Good day.
I need the next: to get an access to a disk under Windows platform. Access should be an exlusive.
What I already have found:
int res = DeviceIoControl( hDevice, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &dw, NULL );
hDevice- handle created by CreateFile(...)
This function with FSCTL_LOCK_VOLUME will block the disk so no one be able to get an access untill I unblock BUT function fails if there any application has already opened the disk.
I need some kind of "chkdsk /f" behaviour: if there's any handle to this disk I can tear them.
Thank you.
I'm not like them, but I can pretend.
|
|
|
|
|
Hi
How to create Multi page images ??
|
|
|
|
|
raju_Code wrote: How to create Multi page images ??
Run a loop and create an one page image in each iteration? Seriously, read the guidelines and include more details.
Also, what's wrong with the previous reply given to you? Why not continue the conversation there by replying to the person who answered you, instead of creating a new thread each time?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Sorry Mr.rajesh ...
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
raju_Code wrote: How to create Multi page images ??
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]
|
|
|
|
|
Sorry!!!
~~~~~~~~~~~~~Raju~~~~~~~~~~~~~
|
|
|
|
|
could you tell me what is it?
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Thanks for your response!!!!
How to create Multi page image file
for example
its combination of more than one images..
Just i explain rough coding ...
CImage __Image[4];<br />
__Image[0].Load(_T("1.tif"));<br />
__Image[1].Load(_T("2.tif"));<br />
__Image[2].Load(_T("3.TIF")); <br />
__Image[4].Save(_T("output.tif"))=_Image[0]+__Image[1]+__Image[2];
// The final image output shout be 3 pages per image
Thanks!
|
|
|
|
|
you can make a image with three images on it and its very easy and dont need to lot of work and then you save it on a bmp or jpg file.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
Dear all,
I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader.
Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers.
I usually use winscard in visual C++ 6.0.
Those two function have just two dynamic variable, handle of reader and list of reader name.
Do anybody know how separated contact reader type from contactless reader type without insert any smartcard?
Please help me...
Thanks before....
|
|
|
|
|
Dear all,
I get a program that can recognize reader type (contact or contactless reader) before any smart card is inserted into reader.
Generally I used SCardEstablishContext[^] and SCardListReaders[^] functions in order to load name of readers.
Those two function have just two dynamic variable, handle of reader and list of reader name.
Do anybody know how separated contact reader type from contactless reader type without insert any smartcard?
Please help me...
Thanks before....
|
|
|
|
|
Message Closed
modified 19-Feb-21 1:21am.
|
|
|
|