|
Hi Experts,
I have a server written in C++, Client is in JAVA and middle-ware is CORBA, now we are planing to replace CORBA by web Service(SOAP or REST). we don't want to make any changes in our business logic just want to replace CORBA by web service. Can anyone give some idea how do i approach. since I googled a lot, how to write a REST or SOAP service in C++ but didn't get any lead.
Please do let me know if you seek any further info
Thanks in advance
RYK
|
|
|
|
|
I've been getting this error when I compile in my Consumer/Producer Multi-threaded program. Can someone please help me ? Here is my code
#include <iostream>
#include <stdio.h>
#include <pthread.h>
#include <assert.h>
#include<complex>
# define BSIZE 10
# define NUM_THREADS 5
using namespace std;
typedef struct {
char buf[BSIZE];
int occupied;
int nextin;
int nextout;
pthread_mutex_t mutex;
pthread_cond_t more;
pthread_cond_t less;
} buffer_t;
buffer_t buffer;
void producer(buffer_t *b, char item)
{
pthread_mutex_lock(&b->mutex);
while (b->occupied >= BSIZE)
pthread_cond_wait(&b->less, &b->mutex);
assert(b->occupied < BSIZE);
b->buf[b->nextin++] = item;
b->nextin %= BSIZE;
b->occupied++;
pthread_cond_signal(&b->more);
pthread_mutex_unlock(&b->mutex);
}
char consumer(buffer_t *b)
{
char item;
pthread_mutex_lock(&b->mutex);
while(b->occupied <= 0)
pthread_cond_wait(&b->more, &b->mutex);
assert(b->occupied > 0);
item = b->buf[b->nextout++];
b->nextout %= BSIZE;
b->occupied--;
pthread_cond_signal(&b->less);
pthread_mutex_unlock(&b->mutex);
return(item);
}
int main(int argc, char* argv[] )
{
pthread_t ptid;
pthread_attr_t attr;
pthread_attr_init(&attr);
pthread_create(&ptid, &attr, producer , NULL);
}
modified 13-Apr-15 22:13pm.
|
|
|
|
|
|
Hey Guys,
I am trying to execute the following chunk of code.
int **p = (int**)new int(5);
cout << *p;
I am getting output 00000005
As per my understanding , we don't need to typecast return value from new, as it automatically does.
Like in the following statement
int *ap = new int(20);
We don't need to do that, So why I need to do in case of double pointer??
Second thing is, in cout statement, I need to put pointer deference operator once not twice. Even after that i am getting strange output like 00000005
Please someone help me.
Thanks
Amrit
|
|
|
|
|
Amrit Agr wrote: So why I need to do in case of double pointer??
Who said you do? This ought to work just fine:
int **p = new (int*);
*p = new int;
**p = 5;
cout << **p;
delete *p;
delete p;
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
here, p is a pointer to int*.that means p can point to an int pointer and that pointer will point an int type of data.
when you do this , (int**) new int (5) ; you are actually forcing (casting) p to point to an int pointer (memory address) with value 5 ..(It actually should not be done because you don't know anything about memory address 0x5 )... however and as you made p to store something(a memory address with value 5) you also allocated memory for that purpose ......
and the typecasting was necessary as first case is very different than the second case....
in the second case --- ap is an int pointer and with new command you allocated 4 bytes of memory for ap .. and ap is now pointing to that memory location and as you passed 20 in the constructor so now that memory address is storing 20....
But, p is not an int pointer ..it's a pointer to int pointer ...so it should be passed a valid memory address in the constructor call .. not an int(what you did -- by passing 5)..that's why you had to cast...
and the answer to your last question is ... p is just a pointer (it maybe a pointer to another pointer but it still is a pointer)..and when we want to know what value a pointer is pointing to we put * (deference op.) before that pointer (only once)!
Hope,you got that
|
|
|
|
|
I am a beginner in programming and have to write a solitaire program(C++) just like what we play in windows. I have no idea where or how I should start my program. I never write a game in any computer language and I have already stuck at the beginning for 2 weeks. Can you help??
btw I just need to finish the game logic and give it to my teammate to work on graphic(GUI).
now I just write a few line about checking whether the move in those 7 piles are valid or not and create 52 cards in a class by using array but cannot generate each card uniquely.
|
|
|
|
|
That is not a simple question to answer in a forum like this. You should start with a couple of classes:
Card - contains properties such as value and suit.
Player - contains a List of cards.
Some general methods:
A randomiser that deals the cards around.
Play that selects a card and figures out where it can be placed
etc.
Quite a lot to think about before you start coding, or worrying about the UI.
|
|
|
|
|
Dear all.
I am using kinect SDK2.0. Kinect sensor 2.0; visual studio 2012 & openCV 2.4.10 installed in my system.\
I am new to this kinect platform.I am looking for c++ code test some simple code. I have tested code with SDK2.0 . those are working fine. But i didnt find the code where they add images features resources . code to track object
I would like to detect object like in youtube video
<a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A">object tracking using opencv</a>[<a href="https://www.youtube.com/watch?v=bSeFrPrqZ2A" target="_blank" title="New Window">^</a>]
|
|
|
|
|
Hi all,
i need to simulate mouse events using hooks.
I read the the msdn articles about hook and how they are used but I felt that they are complex!!
could any one help me or guide me on how to do the following:
- just send one mouse event to a window that is not mine. The window is a running application such as notepad, so I just need to send the right click for example to it!
thanks for any help
|
|
|
|
|
Hooking is about capturing messages that are sent ot other applications. If you want to send a message then you just need to use the SendMessage function[^]. Although you will first need to get the handle to the Window via FindWindow[^].
|
|
|
|
|
Hi Richard,,
I used the SendMessage() function many and many times, what it did is only close the handled application!!
I used also, PostMessage() and it did the same!
I used sendInput() and there is no response at all..
that's why I went to hook..
otherwise If there is a reliable way I will not go to hooking at all..
could you help in this please,,
if you need some code i will post, but if you provide me with a reliable code that can really send the mouse event to the application without moving the cursor, I will be thankful for you really
|
|
|
|
|
Omarkkk wrote: I used the SendMessage() function many and many times, what it did is only close the handled application Then you need to do some debugging to find out why, and what you are doing wrong. Sorry, I have no sample code for you, I have not actually used this feature for some time.
|
|
|
|
|
I did some debugging now,,
it says "unable to read memory" for the handled window!!
do you know why is that ??
thanks,
|
|
|
|
|
What says it, where, in your code, in the debugger, what are you trying to do at that point ... ?
|
|
|
|
|
hi Richard
switch (LOWORD(wParam)){
case 1:
HWND handle = FindWindow(NULL,TEXT("untitled - notepad"));
if (!handle){
::MessageBox (hwnd,TEXT("Window Not Found"),TEXT("Window Not Found"),MB_OK);
}
else
{
::SetActiveWindow(handle);
send message:
SendMessage(handle, MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE,NULL,NULL);
SendMessage(handle, MOUSEEVENTF_LEFTDOWN,NULL,NULL);
SendMessage(handle, MOUSEEVENTF_LEFTUP,NULL,NULL);
the "handle" is handling notepad application..
I checked the handling number using spy++ and it's the same which appears in the debugger which is 0x005e0656
the debugger says
- handle 0x005e0656 {unused=??? } HWND__ *
unused <Unable to read memory>
could you take a look on that please ..
thanks
|
|
|
|
|
MOUSEEVENTF_MOVE is not a valid Windows message; you are just sending nonsense values.
The debugger message is just telling you that the Handle's value does not point to a valid portion of memory. This is expected since handles are arbitrary values used by the Windows OS.
|
|
|
|
|
do you have any idea of how we can solve this problem ??
|
|
|
|
|
You need to understand the use of all the windows messages which all have names beginning WM_ , and are documented in MSDN. The links I gave you earlier will lead you to some of them. You can also look at the SendInput function[^] which may make it easier to achieve what you want.
|
|
|
|
|
1) extract question.zip
2) runtime\debug
3) run sample.exe
4) click "button1"
program is crash
why crash? why crash?
DLL program is vc6.0 MFC extension dll
EXE program is VS2013 dialog base program
i wonder why terminate program.
please modify source dll or exe
I prefer to modify the source rather than the exe dll.
If there is no way
[question]
1) vs2013 Do Not use the extension dll created in vc6.0?
2) modify dll program?
3) modify exe program?
4) both modify? What do you need to fix?
download link
|
|
|
|
|
Sorry, this site does not provide a service like this. You need to use your debugger to identify where the crash occurs and why. You can then come back here with the details, and people will try to help you.
|
|
|
|
|
|
I'm not sure that this is anything to do with managed C++/CLI, however ...
If you have a problem with some code that you downloaded from the internet, then you need to go back and talk to the person or people who provided it. But something called workingbutcrap is not very inspiring. And if you have issues with an article here on CodeProject then you should use the forum at the end of the article.
|
|
|
|
|
Hi All,
I'm facing the following strange problem using MFC Grid Control (by Chris Maunder) in my VS2010 MFC application:
I've included the CGridCtrl control in a dialog in order to let the user to edit data. It works fine but sometime when I open the dialog the cells content is not displayed but it's covered by the cell background color.
Unfortunately I can't solve the problem because it only happens randomly. I tried to call Invalidate() to both the CGridCtrl control and the dialog but it doesn't solve.
Any help would be greatly appreciated.
Thanks in advance.
Gianni
|
|
|
|
|
Please do not post the same question in multiple forums.
|
|
|
|