|
Still learning how to code wrote: My Arduino code expects time quantities to be received as localtime (i.e. adjusted for DST) You should change that to UTC if possible. When your Arduino uses a different time zone than your Windows system, the results would be wrong again.
|
|
|
|
|
Reviewing some old projects I met a function like this:
bool func()
{
bool var = false;
if(...)
return var = false;
else
return var = true;
}
Actually what the function returns? I think true , because assigning can't be false .
VII. 36. When you surround an army, leave an outlet free. Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: Actually what the function returns? I think true , because assigning can't be false .
There is an easy way to know !
- make a program that will execute that code.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Any assignment is also an expression which has the value of the assigned value.
if(...)
return var = false; else
return var = true;
Some programmers make use of this fact like this:
int x;
while ((x = SomeFunction()) > 0)
{
}
Whether or not this is good style is up to personal preference..
If the brain were so simple we could understand it, we would be so simple we couldn't. — Lyall Watson
|
|
|
|
|
RomTibi wrote: I think true , because assigning can't be false . True (regardless).
"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
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
|
|
|
|
|
|
RomTibi wrote: because assigning can't be false . Of course it can. This is easy to test by writing a few lines of code.
|
|
|
|
|
Adam works in the in networking security cell. He wants to generate secret keys
following a pattern. The pattern consists of the characters X and Y.
where X means increasing and Y means decreasing. Help him devise an
algorithm to generate the secret key which is the minimum number encoded
following that pattern. Digits from 1-9 and digits can’t repeat.
Sample Input: Sample Output:
X 12
YXYX 21435
YYXYYXXY 321654798
|
|
|
|
|
Sorry, we do not do your homework.
|
|
|
|
|
We don't do your HomeWork.
Advice try to solve the problem by habd, see how you build the solution.
try to device a program that will follow the same processus.
It is not so difficult.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
i know nothing about vector in c. if anyone could provide me link of it n also if someone could give me brief intro i will be obliged
|
|
|
|
|
|
There is no vector in C !
Just arrays.
Advice read C documentation.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
hi all,
i draw a image when i preview it its display ok but when i print with multiple page.
on first page its drawimage correctly but after first page it return generic error.
i really dont understand what happen here.
i m using this to draw image.
Graphics graphics(pDC->GetSafeHdc());
Image myPNG(path);
if(myPNG.GetLastStatus()!=Ok)
{
return FALSE;
}
Gdiplus::Status stat;
stat = graphics.DrawImage(&myPNG, (INT)image_rect.left, (INT)image_rect.top, 300, 300);
return TRUE;
thanks in advance.
|
|
|
|
|
Where in your application is this code being called? Is it inside your OnDraw function, or somewhere else?
|
|
|
|
|
i m used it in
OnPrint(CDC* pDC, CPrintInfo* pInfo) function,
i really dont understand when i preview this image is visible
when i print these page ,on first page its print after first page return Generic Error on drawimage function.
|
|
|
|
|
The only thing you can do is to step through it in the debugger to try and isolate what is happening.
|
|
|
|
|
is there any role of PageUnit or PageScale,
i u using
graphics.SetPageUnit(UnitPixel);
coz when i debug i dint recongze the problem,
in preview the image is display and when i print the error comes.
function is same for both.
modified 26-Mar-16 2:53am.
|
|
|
|
|
Sorry, but as I said, the only way to track this sort of error is by using your debugger. There is nothing that anyone here can do to assist, as there is no useful information provided.
|
|
|
|
|
Sadly, that Generic Error is the ONLY error provided by GDI+, so debugging them can be a nightmare. Good luck.
What do you get when you cross a joke with a rhetorical question?
The metaphorical solid rear-end expulsions have impacted the metaphorical motorized bladed rotating air movement mechanism.
Do questions with multiple question marks annoy you???
|
|
|
|
|
Hi
I am waiting for a child process to complete initialization so that I can get its window
handle
After I do CreateProcess
I use the PROCESS_INFORMATION pi parameter of The CreateProcess to WaitForInputIdle(pi.hProcess,INFINITE);
The Child process goes about its business intitializing in InitInstance returns TRUE
It has a message map
After the return TRUE from InitInstance, the parent breaks from WaitForInputIdle with a
Access Exception
Thanks
|
|
|
|
|
What you have detailed is correct and the recommended way to do it
So you therefore have a coding error which can be
(i) The launched process does not have a graphical interface ... must not be a console app which has no queue
(ii) The createprocess startup structure is invalid
If the launched process is yours you can go around the whole problem by using an Interprocess communication method.
If the launched process isn't yours check your code with notepad or something simple which that technique works with.
In vino veritas
|
|
|
|
|
Thanks so much
I see all of the info of the startup structure can be ignored can I memset
The entire structure to NULLs
|
|
|
|
|
The .cb field is the only mandatory field which must be set to sizeof(STARTUPINFO);
You can memset it and then set the .cb field but it's just as easy to zero the variable creation
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);
your suggestion is fine as well
STARTUPINFO startupInfo;
memset(startupinfo, 0, sizeof(startupinfo));
startupInfo.cb = sizeof(startupInfo);
In vino veritas
|
|
|
|
|
Checking my code seems I have already done that
Thanks
|
|
|
|