|
Mister youbo,
i'm goin to answer you, but before, here some comments i have to say to you, which i want you to take from the good, wise side...
you've been asking several question like this one, which are obviously from a beginner. You still can ask when you don't understand, but a better solution would be to learn the C/C++ languages a bit deeper to get rid of these by yourself.
ok then, let's go:
youbo wrote: node->next = (struct ListEntry *) malloc(sizeof(struct ListEntry));
it seems to me that you have a linked list, and that you code in C (correct me if i'm wrong).
a linked list is compound of nodes; each node stores a value, and has a link (pointer) to the node next to it in the list.
for what i understand here, node might be defined as a struct (ListEntry ), and next is defined inside it to being a pointer to another node (ListEntry* ).
for the right par of the assignment operator, we have a call the the malloc() function.
malloc() is used to allocate memory dynamically on the heap. you give it an integer parameter which tells it the amount of memory to allocate. here, sizeof(struct ListEntry) ; that mean, "allocate the amount which a ListEntry structure regularly takes in memory".
then, as malloc() returns a void* (a pointer to anything), we must translate it to the type of pointer which will store the returned value, by using a cast operation. that's performed with the (struct ListEntry*) prepending the malloc call.
then, once the memory is allocated, the address of that memory is returned, and casted to the type of a "pointer to a node in the list", we can assign this to the next member of the node struct (thus the syntax node->next )
any more questions ?
|
|
|
|
|
I gave you a 5; even though I found your explanation a bit confusing and I know multiple ways to link structures together: Single, Double, Single with parent child, Double with parent child, and various trees.
They really do need to spend some quality time trying to figure it out on their own.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
John R. Shaw wrote: gave you a 5; even though I found your explanation a bit
thanks John.
please, tell me what's confusing you, so that i can modify the most consequently
also, i too know veral kind of linked lists, but as the OP is a beginner, I didn't want to give him too much useless explanations...
|
|
|
|
|
Your wording was confusing (at first glance) and an example would have helped, especially for a beginner. “baeten” gave an example (although it is not a unidirectional list), since I posted, and that combined with what you said should help them figure it out.
If I was not so tired, I probably would have made it simpler (like ‘baeten”):
It is trying to allocate the next node in a linked list, which is equivalent to adding a new link to a chain. The allocation may fail so make sure that malloc does not return NULL.
node : A memory pointer to type ListEntry ; that is the address of a memory block containing a ListEntry structure (a node).
node->next : The next link in the chain; a pointer to the next structure (node).
….
A linked list looks like this in memory node->next->next->next->NULL , where NULL is the end of the list (or chain).
…
Or something like that; I am not in the right frame of mind right now. You did a good job and they need to search for a tutorial and spend time playing with lists.
Good night, or day (5 A.M. here).
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Hi,
that's a unidirectional list.
if your struct ListEntry is :
struct ListEntry {
char value[50];
struct ListEntry * next;
}
you allocate the first element, so you have a string and a blank pointer.
struct ListEntry *First = (struct ListEntry*)malloc(sizeof(struct ListEntry*));
First->next = NULL;
strcpy(First->value,"empty");
now you set the next-pointer to a new allocation of a new struct.
First->next = (struct ListEntry*)malloc(sizeof(struct ListEntry*));
So you can reach the new Element by dereferencing the node->next : node->next->value.
You should always store and save the first element.
Each time you like to add a new element you need to loop from the first element to the last
( which is the element with the next-pointer as NULL )
If you have 5 elements with numbers into it, it can be represented this way :
|"one"|0x4567| ---> |"two"|0x4568| --> |"three"|0x4569| ---> |"four"|0x4570| ---> |"five"|NULL|
|
|
|
|
|
OK,i will remember your idea!toxxct
|
|
|
|
|
If you want to reply to toxcct , than you have to use the reply button at the end of the message comes from toxcct .
This is an hidden rule of this forum-board.
-- modified at 4:57 Thursday 27th September, 2007
Russell
|
|
|
|
|
Russell` wrote: toxxct
misspelt. toxcct
|
|
|
|
|
|
How to identify given image is too dark or light?
Input format of the file is tif and jpg.
|
|
|
|
|
By taking a look at it I suppose...
Please don't mark your topic with the word Urgent.
Waldermort
|
|
|
|
|
WalderMort wrote: Please don't mark your topic with the word Urgent.
'5' for this
|
|
|
|
|
images are made of pixel, then every pixel has got a color, the color is a combination of red-green-blue (RGB).
white is RGB(255,255,255), black is RGB(0,0,0).
Convert your image in a gray scale:
take the color of every pixel (r,g,b) then compute c=(r+g+b)/3, so the gray pixel of a new image can be RGB(c,c,c), but you can simply store c somewhere.
Then compute the mean value of c on all the image and compare it with a treshold.
do something like this:
if c_mean is less then 50 the image is too dark
if c_mean is greater then 200 the image is too light
hope helps
Russell
|
|
|
|
|
Russell` wrote: compute c=(r+g+b)/3,
But the brightness is not simply the average, right? Red has low intensity compared to others. I dont remember the exact ratio.
- NS -
|
|
|
|
|
I think you are right.
If you find the right formula please post it here, I'll be happy to learn it.
In this case I think that him doesn't need an accurate extraction of the gray-scale, the simple formula (r+g+b)/3 can be enough.
Russell
|
|
|
|
|
Russell` wrote: If you find the right formula please post it here
The one I know is Y = 0.3*R + 0.59*G + 0.11*B
Russell` wrote: the simple formula (r+g+b)/3 can be enough
If it is not for human recognition... right?
- NS -
|
|
|
|
|
NS17 wrote: Y = 0.3*R + 0.59*G + 0.11*B
Yes! I was forgetting this!
(r+g+b)/3 it only an approssimation of the right formula... I used this in past to implement a fast algorithm, but of course it isn't exact.
Russell
|
|
|
|
|
What exactly are those constants 0.3 , 0.59 and 0.11 ?
Sreedhar DV
[Real success is having courage to meet failure without being defeated.]
|
|
|
|
|
Our eye is more sensitive on the green light and less on red.
So, that constants are related to the features of the human eye.
hope it helps.
Russell
|
|
|
|
|
make a bitmap out of and test the pixels. -> CXImage article at CP
Greetings from Germany
|
|
|
|
|
I am trying to call a web service on Pocket PC (ARM processor) using HTTPSendRequest. But when doing InternetReadFile it is giving me incomplete string like this
|
|
|
|
|
I got such incomplete information after calling this web service 2 to 3 times. Initially 2 times i got blank reply.
Now When I used HTTPQueryInfo it showed following message
H T T P / 1 . 1 4 0 0 B a d R e q u e s t
S e r v e r : M i c r o s o f t - I I S / 5 . 0
D a t e : F r i , 2 8 S e p 2 0 0 7 0 8 : 3 5 : 5 1 G M T
X - P o w e r e d - B y : A S P . N E T
X - A s p N e t - V e r s i o n : 2 . 0 . 5 0 7 2 7
C a c h e - C o n t r o l : p r i v a t e
C o n t e n t - L e n g t h : 0
My web service contains just one method “HelloWorld” which does not take any input parameters and returns the “HelloWorld” string to the calling application.
My code of calling web service is following.
LPTSTR AcceptTypes[2] = {TEXT("text/xml"), NULL};
DWORD dwFlags = INTERNET_FLAG_NO_CACHE_WRITE |INTERNET_FLAG_KEEP_CONNECTION;
HINTERNET hNet = InternetOpen(L"EvcWebService", INTERNET_OPEN_TYPE_PRECONFIG,
NULL, NULL, 0 );
if (hNet)
{
HINTERNET hSession = InternetConnect(hNet, _T("10.37.54.93"), INTERNET_DEFAULT_HTTP_PORT, _T(""), _T(""), INTERNET_SERVICE_HTTP, 0, 0);
if (hSession)
{
HINTERNET hRequest = HttpOpenRequest(hSession, _T("POST"), _T("/TestService/Service.asmx?wsdl"), TEXT("HTTP/1.1"),NULL, (LPCTSTR*)AcceptTypes, dwFlags, 0);
if (hRequest)
{
TCHAR szSoapAction[256];
_tcscpy( szSoapAction, _T("Content-Type: text/xml;charset=utf-8\n") );
_tcscat( szSoapAction, _T("SOAPAction: \"") );
_tcscat( szSoapAction, _T("http://tempuri.org/HelloWorld") );
_tcscat( szSoapAction , _T("\"\0\r\n\r\n") );
TCHAR szSoap[512];
_tcscpy(pszSoap, _T("") );
_tcscat(pszSoap, _T("<soap:envelope xmlns:soap="\"http://schemas.xmlsoap.org/soap/envelope/\"" \="" xmlns:xsi="\"http://www.w3.org/2001/XMLSchema-instance\"" xmlns:xsd="\"http://www.w3.org/2001/XMLSchema\"">") );
_tcscat(pszSoap, _T("<soap:header>") );
_tcscat(pszSoap, _T("") );
_tcscat(pszSoap, _T("<soap:body>") );
_tcscat(pszSoap, _T("<helloworld \
="" xmlns="\"http://tempuri.org/\"">") ); //
_tcscat(pszSoap, _T("") );
_tcscat(pszSoap, _T("") );
_tcscat(pszSoap, _T("") );
BOOL bSent = HttpSendRequest(hRequest, szSoapAction, _tcslen(szSoapAction), szSoap, _tcslen(szSoap) );
if(bSent)
{
called HTTPQueryInfo.....
}
This HTTPQueryInfo returns bad request. But this code works fine on Win32 and give Bad Request on WinCE.
Please let me know how should i build soap packet for EVC so that it will call web service on Pocket PC?
|
|
|
|
|
Hi All,
I have developed a ActiveX control that is invoked in IE(Internet Explorer) using Java Script. Now when the control is executing something, and the user switches to some other window and then back to IE, IE does not repaint itself. The screen is not getting painted uniformaly and the control does not get displayed until and unless the processing for the task being executed is over.
Has someone ever encountered this problem? I want IE to show even when the processing is done within the ActiveX control.
Any help would be appreciated.
|
|
|
|
|
I am making a toolbar for a website. initially the toolbar is normal and when the yser login the toolbar changes and takes the setting for the logged in user as is in the case of Yahoo.
If the user does not work on the website application for 18 minutes i.e. if he takes no action he should be logged out and the toolbar should be in its initial state.
Now the problem for me is i am not able to track that no event has been fired and the session of 18 minutes has expired and because of which I am not able to change my toolbar as a aresult of which what happens is that even if the yser is logged out of the site after 18 minutes still my toolbar is having the users settings.
I am using WIN32 ATL and WTL.
Please help me what to do.
Thanks in Advance.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
how to retrieve no of columns in alistView control ?
Thanks
|
|
|
|
|