|
I need the source code to design and implement a simple multi-threaded server to concurrently process multiple client requests using the Solaris pthread library as part of course work for my university. The server must support concurrent operation since many independent clients can simultaneously send requests to the server. I am to use thread pools, shared buffer, client threads, dispatcher threads and worker threads as part of the software components for the server. I don't know anyone who knows much about this . Any help on obtaining the source code will be very much appreciated. Thank You
|
|
|
|
|
Hi All,
I need to implement this,
typedef struct
{
T1 m;
T2 m;
T3 m;
........
}XX;
XX a;
....
note T1,T2,T3... has no basic class, I hope
a function can auto visit the data member one by one like this
for(int pos=0; pos
|
|
|
|
|
I don't know what you want but here is my answer:
template<typename T, int INDEX>
struct XX
{
T m[INDEX];
};
Also, this post belongs in the Visual C++ forum.
-- modified at 12:16 Sunday 19th February, 2006
|
|
|
|
|
Since you placed your posted problem here, you get a C++/CLI answer:
using namespace System;
using namespace System::Reflection;
public ref struct Record
{
String ^ name;
int age;
};
int main(array<System::String ^> ^args)
{
Record ^ rec = gcnew Record;
rec->name = "George Washington";
rec->age = 274;
array<FieldInfo ^> ^ fieldInfo;
Type ^ recordType = Record::typeid;
fieldInfo = recordType->GetFields(
static_cast<BindingFlags>(
BindingFlags::Public | BindingFlags::Instance));
for (int i = 0; i < fieldInfo->Length; ++i)
{
Console::WriteLine("{0} = {1}",
fieldInfo[i]->Name,
fieldInfo[i]->GetValue(rec));
}
return 0;
}
-- modified at 13:34 Sunday 19th February, 2006
|
|
|
|
|
Hi!
I'm currently trying to get a program working that's supposed to display only a message
meaning without a window.
I've retrieved from various locations source code for this but every time there's
at least one error in the compile.
I'm using Borland C++ 5.5 as my compiler in a DOS-environment.
This is the source of the code that isn't working:
<br />
msgonly.cpp:<br />
<br />
#include <windows.h><br />
<br />
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam);<br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
MSG msg;
WNDCLASSEX wcx;
<br />
ZeroMemory(&wcx,sizeof(WNDCLASSEX));<br />
wcx.cbSize = sizeof(WNDCLASSEX);
wcx.style = NULL;<br />
wcx.lpfnWndProc = (WNDPROC)MainWndProc;
wcx.cbClsExtra = 0;
wcx.cbWndExtra = 0;
wcx.hInstance = hInstance;
wcx.hIcon = NULL;
wcx.hCursor = NULL; <br />
wcx.hbrBackground = NULL;<br />
wcx.lpszMenuName = NULL;
wcx.lpszClassName = "MessageOnly";
wcx.hIconSm = NULL;
<br />
if (!RegisterClassEx(&wcx))<br />
return 0;<br />
<br />
hwndMain = CreateWindowEx(WS_EX_LEFT, <br />
"MessageOnly",
NULL,
0,
0,
0,
0,
0,
HWND_MESSAGE,
0,
hInstance,<br />
0);<br />
<br />
if (!hwndMain)<br />
return 0;<br />
<br />
ShowWindow(hwndMain,SW_SHOW);<br />
while (GetMessage(&msg,NULL,0,0))<br />
{<br />
TranslateMessage(&msg);<br />
DispatchMessage(&msg);<br />
}<br />
<br />
return 0;<br />
}<br />
<br />
LRESULT CALLBACK MainWndProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam)<br />
{<br />
switch (msg)<br />
{<br />
case WM_DESTROY:<br />
PostQuitMessage(0);<br />
break;<br />
default:<br />
return DefWindowProc(hwnd,msg,wParam,lParam);<br />
}<br />
return 0;<br />
}<br />
This is the error I get:
<br />
Error E2451 msgonly.cpp 33: Undefined symbol 'hwndMain' in function __stdcall WinMain(HINSTANCE__ *,HINSTANCE__ *,char *,int)<br />
Can anyone help me with this?
Thanks!
|
|
|
|
|
Hmmm... the include's supposed to be
<br />
#include < windows . h ><br />
I don't know why it never displays this kind of thing...
|
|
|
|
|
At least you have to declare the hwndMain anywhere in your code. For example on the top of the WinMain function as: HWND hwndMain; !
THis is typical for beginners. You have do read and understand the error or warning messages from your compiler.
|
|
|
|
|
That seems to do the trick.
Thanks!
I might have made a typical novice mistake, but at least I've learned something
|
|
|
|
|
Hi,
Let me explain using a very simple example: finding all combinations of 2
from a set of 6 letters {A, B, C, D, E, F}. The first combination is AB and the
last is EF
The total number of possible combinations is: n!/(r!(n-r)!)=6!/(2!(6-2)!)=15
combinations
Let me show you all the combinations first:
AB
AC
AD
AE
AF
BC
BD
BE
BF
CD
CE
CF
DE
DF
EF
I want to print all the comibinations..........
Regards
James
|
|
|
|
|
|
void PrintCom(char *letterSet,int setLen)
{
int NoOfCom=0;
for(int i=0;i<setLen;i++)
{
for(int j=i+1;j<setLen;j++)
{
cout<<letterSet[i]<<letterSet[j];
NoOfCom++;
}
cout<<endl;
}
cout<<NoOfCom<<endl;
}
the letterSet is a pointer of the set array,setLen is the length of the array.
|
|
|
|
|
Hi, i use srand ( ) in order to fill in an array with values but i want to esure that each value will appear only one time.
Is there something i can do with the function to avoid comparing array elements to check it?
Thanks
chrizpl
|
|
|
|
|
Someone might have a clever way of doing that but here is my suggestion that avoids checking the "random" array. Create a KeyValue type collection that contains the number range values as keys (0, 1, 2, 3, etc.) and a value initially false. Before adding a random number in the "random" array, search the KeyValue collection with the random number. If the value is false, add it to the "random" array and then set the value to true.
-- modified at 7:13 Saturday 18th February, 2006
|
|
|
|
|
Can you be more clear please? What i want to do is to fill up a 2-d[3][3] array with numbers from 0-8. I want each number to be appear in my array but only one time. Each time i run my program i want the sequence of the numbers to change.
example of how i want to look like my array is: 3 5 7
2 1 0
4 6 8
chrizpl
|
|
|
|
|
Sounds like a homework assignment and you are using native C++ (not C++/CLI). Since you can not check the array that has the numbers randomly placed without repeats. My suggested solution still stands with a modification. If the number range is 0 through 8, create a boolean array that holds 9 boolean numbers set to false. When your "srand function expression" creates a random number, check it against the array using its index. If the result is false, add the number to the random arranged array and set the indexed cell to true.
Think of your randomly arranged array as a shopping cart, and your shopping list is a list of numbers to be found and placed in the shopping cart. As you place the number in the cart, you scratch the number out so that you won't place that number in the cart again.
I gave you too much. If you can not figure out what I gave you. You need to review what you have not learned well.
-- modified at 9:00 Saturday 18th February, 2006
|
|
|
|
|
TBD
modified 28-Jan-14 19:19pm.
|
|
|
|
|
Ever heard about a nice thing called google ?
|
|
|
|
|
|
Hello people.
like Windows::Forms::Form->Controls holds the control collection. I need to know what controls lies on another application.
Any Idia ?
|
|
|
|
|
Nevermind. I found the answer. It's two APIs:
EnumChildWindow and RealGetWindowClass.
|
|
|
|
|
Thanks guys, i managed finally to do the program!
|
|
|
|
|
|
The question is that i have almost no idea how to do it. this is my second semester in c++. So i'd like just to give me an idea what to include in my functions or just the way of thought i have to follow. I'm definetely not asking for the source code or for someone else to do it for me. Just the way i have to think...
sorry, i didn't understand what do you mean about the [^]
chrizpl
|
|
|
|
|
chrizpl wrote: i have almost no idea how to do it
how to do what ??
chrizpl wrote: So i'd like just to give me an idea what to include in my functions
all demends on what you want to achieve, but here again, explain the 1st point.
chrizpl wrote: i didn't understand what do you mean about the [^]
did you click on the link and read the linked post ??
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
Ok, i'll try to be as more specific i can.
When running the program the 1st time will appear on the screen a grid with numbers from 1-8 randomly. The user what have to do is to solve the puzzle, putting the numbers in ascending using either the arrows keys, either other keys which we'll define. Each time the user makes a move, a new grid will appeared on the screen.
My questions are:
1)Ok, i have to use a 2-d (3x3)array of type int and fill it with the numbers (let's say using rand()). But what about the element which has to be empty? I tried it and the compiler put a random number in the element which i didn't specify a value. So what i have to do in order to stay blank and recognize it as black?
2)i understand that i must use a function which will identify the legal moves that the user is able to do. But how? Is there a way to have direct access on the grid?
3)how the program will understand that the grid has been solved? the exercice was saying that numbers could be of the form 1 2 3
4 5 6
7 8
or of 1 2 3
8 4
7 6 5 .....
That's for now, i hope i wrote them in the proper way
thanks
chrizpl
|
|
|
|