Click here to Skip to main content
15,393,377 members

Comments by H.Brydon (Top 200 by date)

H.Brydon 3-Jun-15 22:42pm View
I like your "golden apple" angle as well. :-)
H.Brydon 16-Feb-14 9:04am View
That is somewhat like asking "I found a tail section from a crashed UFO. Can you help me rebuild it."
H.Brydon 10-Feb-14 0:19am View
Not sure why you were downvoted; +5 from me to compensate.

This doesn't look like homework to me (and if it is, OP is not asking to do the work for him) so I don't see the reason for the downvote...
H.Brydon 10-Feb-14 0:10am View
Sergey, I am impressed with the effort you took to answer a trifling question.

+5 for the effort...
H.Brydon 10-Feb-14 0:08am View
What game are you playing exactly? You have done essentially nothing on the CodeProject website, except that you have asked 172 questions, 31 of them in the past week.

Every single one of the questions you have asked are easily answered by consulting with Google or doing some basic simple research with existing documentation.

You are clearly playing some sort of game here... just wondering what it is.
H.Brydon 1-Feb-14 23:38pm View
The cynic in me wants to suggest looking at the Fisher-Price website... sorry, I am not a Windows 8 fan...
H.Brydon 1-Feb-14 23:35pm View
I would recommend the slightly different:

fwrite(FileOut, sizeof(FileOut[0]), ArraySize, file2);
H.Brydon 1-Feb-14 19:29pm View
Note that OP flagged Win32 and C++.
H.Brydon 1-Feb-14 19:16pm View
OP submitted around 10 questions on the forum all at the same time. All were pretty basic. This was perhaps the most complicated question. I would not have replied as I did if it was the only question. My comments here reflect the bigger picture.

... although I think OP is being lazy and stand by that comment.

Good answer from you (+5 for that)...
H.Brydon 1-Feb-14 19:12pm View
This is really basic stuff. You need to do a little more effort on your part...

If you want MFC, look at how to use CFormView. There should be a bazillion examples out there.
H.Brydon 1-Feb-14 17:45pm View
Okay, or look at documentation on ATLTrace2() and TRACE() or OutputDebugString()... These all display info in the output window when you run your program in the IDE.
H.Brydon 1-Feb-14 17:43pm View
Write an API that looks at the address of the stack, and takes the difference from a call to the same API at program start...
H.Brydon 1-Feb-14 17:41pm View
Come on now, if you put this search into Google, you get a multitude of good to great hits on useful information.

You are being really lazy.

Your questions don't belong in this forum...
H.Brydon 1-Feb-14 17:38pm View
You seem to have several questions in the Q&A section that are likely answered by looking at the basic Microsoft documentation on how to do exactly what you want...

I learned how to create a Windows app tool bar in 1992 using the most basic compiler/IDE documentation available at the time.
H.Brydon 1-Feb-14 17:34pm View
The obvious answer is to write a short program that will dump out a trace message for each of the above messages... and change the locale on the machine. [without looking] I'm sure that Google might give some useful info too... (or try Bing)
H.Brydon 1-Feb-14 15:09pm View
This looks a lot like homework, which is not the purpose of this forum. I am surprised that you already got a couple of responses.
H.Brydon 31-Jan-14 23:00pm View
You didn't say what kind of problems you are having with it... more detail?
H.Brydon 29-Jan-14 8:17am View
Do some research on your own. Learn how to use Google. Don't ask other people to do your work for you. Write something, try a few things. Ask for explanations about things that are not clear. If something doesn't work, try several different approaches before asking here.

Don't ask here for someone to do your work for you. Don't ask for someone to debug your program. Don't say it is urgent, and don't ask to have any requests done quickly.
H.Brydon 28-Jan-14 15:26pm View
FYI - Requests of "please debug this for me" or "please write a program for me" will not get much traction in this forum...
H.Brydon 28-Jan-14 15:22pm View
Yes it is still part of VS2010. I use it. It comes with the VS2010 product but you have to select it as a feature to install during the installation process.
H.Brydon 27-Jan-14 10:20am View
Sorry, but this site is not for doing homework, "fix my program" or writing code for you. You need to try a little harder...
H.Brydon 27-Jan-14 8:11am View
That does not look like C or C++ to me...
H.Brydon 21-Jan-14 9:21am View
Ewwww for the chalkboard statement!
+5 for the great answer... :-)
H.Brydon 21-Jan-14 9:19am View
We don't do that kind of thing on this forum. Specifically, requests for "send me code", "fix this for me" and the like are not typically met with friendly responses.
H.Brydon 21-Jan-14 9:15am View
I think you meant compile time error but +5 anyhow...
H.Brydon 21-Jan-14 9:09am View
H.Brydon 20-Jan-14 22:25pm View
Ummm ... F5?
H.Brydon 20-Jan-14 22:24pm View
What you are describing here is a little different. Your code captures the OnNotify message in the view/dialog class, and holds a tooltip control there, relaying the event to the control when a hit is detected. OP wants to handle this in the control (without subclassing)...
H.Brydon 13-Jan-14 22:59pm View
If you hit a web server every few milliseconds, the service provider will shut you down. Torturing somebody else's machine like that is bad juju and the provider will notice this almost immediately.

Anything more than once a minute is in the range of denial of service attack.

I don't think you want that...
H.Brydon 13-Jan-14 22:55pm View
More correctly, it is not part of the project, so it won't get compiled or linked. The errors in question are linker errors...
H.Brydon 10-Jan-14 21:00pm View
"Please send code" is not a valid request for this forum and is likely to get you a lot of well-earned abuse.
H.Brydon 10-Jan-14 20:55pm View
...or in the same directory as the executable if the app is deployed or otherwise run outside the IDE.
H.Brydon 10-Jan-14 15:55pm View
I somewhat agree but using an enumeration would be better than use of an int.
H.Brydon 10-Jan-14 15:54pm View
I somewhat agree with the code suggestion but use of enumerations would be better than int...

I also agree with RM's comments about doing homework...
H.Brydon 30-Dec-13 1:45am View
Somewhat reminds me of someone wanting to ask a question but doesn't know the protocol. :-)

+5 for OG of course.
H.Brydon 30-Dec-13 1:41am View
+5 for "monster" aka "pattern" reference. :-)
H.Brydon 30-Dec-13 1:40am View
+5 for obscure Edgar Allen Poe reference. :-)
H.Brydon 30-Dec-13 1:21am View
My first guess would be
H.Brydon 29-Dec-13 11:26am View
You seem to be using JNI in a way that means you are calling java from C++. I don't have expertise in this area but it seems you need to link to the JNI libraries as well as VOCE. Google should be helpful for this...
H.Brydon 29-Dec-13 11:23am View
The debug assertion will (likely) tell you what line is failing. Look at that line in the code.
H.Brydon 29-Dec-13 11:21am View
... except that I hate seeing uninitialized values - anywhere. My preference would be to combine the two statements into one:

int result = SomeFunc();
H.Brydon 29-Dec-13 11:18am View
...or the place I used to work hired some new programmers. :-)
H.Brydon 28-Dec-13 13:34pm View
Additional one from me instead...
H.Brydon 28-Dec-13 13:32pm View
Your first sentence I think you meant "authentication and encryption" but +5 anyhow...
H.Brydon 28-Dec-13 13:26pm View
+5 for both of you for the effort (watch for it...)
H.Brydon 28-Dec-13 13:06pm View
You could hire a boiler room to do it like Google does:
H.Brydon 28-Dec-13 12:48pm View
You submitted this as a solution, but it is an extension of your problem statement. I think you want to edit your question to include this text and delete the non-solution "Solution".
H.Brydon 28-Dec-13 12:32pm View
You need to do a bit more debugging. Try printing out intermediate values and (for sure) identify which line generates the error.
H.Brydon 26-Dec-13 16:10pm View
Go hang out around a meat packing plant.
H.Brydon 26-Dec-13 16:06pm View
I'm not an expert in this area but my guess is that you should be using rootNode.SelectSingleNode() instead of bookResult.SelectSingleNode().

Having said that, your xml segment is not well formed, and it is not clear if the entire xml content will give you anything sensible.
H.Brydon 26-Dec-13 15:59pm View
Not sure why you were downvoted. Your solution is correct (except that DEBUG_NEW is misspelled). More details are provided in Solution #4.

One thing to watch out for is to make sure you match new/delete and new[]/delete[] as this can upset the leak detection report.

+5 to help set the universe straight again.
H.Brydon 19-Dec-13 9:36am View
This isn't a solution. If you have details to add to your question, you should edit the question.
H.Brydon 19-Dec-13 9:27am View
You really aren't asking a coherent question. It is coming across like "my brother married a woman who has a daughter. What is her name?"
H.Brydon 18-Dec-13 15:40pm View
Null pointer is one of the easiest errors to identify. Run the program with the debugger and see the line number where it barfs.
H.Brydon 17-Dec-13 8:32am View
You should use the "Question or Comment" mechanism to make this response instead of providing a "Solution" that is not a solution. Pranay likely didn't see the non-solution "solution".

Your solution will also likely be downvoted; you probably want to delete this...
H.Brydon 17-Dec-13 8:28am View
Minor point but when you make the code recursive, I'd suggest "if(x<= 0)" instead of "if(x==0)"...
H.Brydon 17-Dec-13 8:21am View
A java null pointer exception is the same on any platform - you have an uninitialized pointer.
H.Brydon 17-Dec-13 8:20am View
You should remove your 2 "solutions" here or you will find that people will downvote your misuse of the mechanism. This info belongs either in the comment section or as an update to your question...
H.Brydon 17-Dec-13 8:14am View
If the two apps are always on the same machine, I'd suggest shared memory.
H.Brydon 17-Dec-13 8:00am View
Heh heh. New woman in my life.

See you in a few more weeks. :-)
H.Brydon 16-Dec-13 22:21pm View
This is clearly homework, which we don't do here. Your best choice is to consult your class notes. Google will also be more helpful than this forum.
H.Brydon 16-Dec-13 22:11pm View
[without checking] Google will probably tell you how to do this if you search for "open file append"
H.Brydon 16-Dec-13 22:01pm View
I think Google is going to be more helpful for this kind of question than anything you will see here...
H.Brydon 14-Dec-13 10:14am View
You need to make far more progress before asking that kind of question here. This site is for answering fairly specific programming questions, not how to program or "please write a program for me".
H.Brydon 14-Dec-13 0:27am View
Rather impressive question.

Before you fix it up, let me just say that brushing up on Google skills will probably get you what you want.
H.Brydon 14-Dec-13 0:21am View
Learning so fast does not help.

The only way to do this kind of thing is to use a multiplatform language such as java (ie. which has multiplatform UI features). C++ is not going to help you here.

You could write your non-UI code in C++ and interface it to java for the UI.

Oh yeah and +5 for Griff.
H.Brydon 12-Dec-13 9:20am View
I don't know if it was you that downvoted the solution (3 out of 5) but since the second bullet point in the list seems to have identified the problem exactly, a +5 would be a good thing to do. :-)

Thanks for your comments.
H.Brydon 23-Oct-13 8:05am View
The Wikipedia page at has a reasonable explanation of packet analyzers in general, and some good leads on free software and "how to" links.
H.Brydon 23-Sep-13 10:50am View
Gone to the dark side you have.
H.Brydon 23-Sep-13 10:49am View
I am out of ideas but it still goes back to file system protection on the share, on the host machine directory/directories and the file. Perhaps place a file on the remote machine with "everyone" write access, same again for its parent directory and work backwards from there.
H.Brydon 23-Sep-13 10:46am View
When I displayed the images, my browser went to la-la land, and I had to close it and restart. Not a good sign.

I don't changing a hosting site will change much.
H.Brydon 23-Sep-13 2:53am View
You should get to know Google, and it will reward you with lots of documentation and examples of your choosing.
H.Brydon 22-Sep-13 23:08pm View
Changed from providing advice to doing homework now?
H.Brydon 22-Sep-13 23:06pm View
Yeah, my thoughts exactly. +5
H.Brydon 22-Sep-13 22:44pm View
Security alert for readers - these links give some problems with the browser, might be malware.
H.Brydon 22-Sep-13 22:42pm View
This is not a "give me the code" site. If you have a programming question, we can probably help with that.

For what you want, Google will likely grant you more than 3 wishes.
H.Brydon 22-Sep-13 2:38am View
What are you specifying for parameters 2, 3 and 6?
What operating system for your local machine and the remote machine?
Are there any firewall issues between your machine and the remote machine?
H.Brydon 21-Sep-13 10:31am View
That kind of question is what Google is for.
H.Brydon 21-Sep-13 10:28am View
Sorry but this forum is not for writing code or doing homework for you. You need to research this and do it yourself.
H.Brydon 20-Sep-13 0:11am View
+5 to compensate for whomever downvoted...
H.Brydon 20-Sep-13 0:08am View
Your question is not clear and your code is nonsense. You are not doing any totalling (ie. accumulation) and most code optimizers would just throw all your code away and return to the caller.
H.Brydon 19-Sep-13 17:51pm View
I think you want to send the resize event notification from the parent window to the splitter window. (I don't have the coding details in front of me so I send you this as a comment not a solution)
H.Brydon 19-Sep-13 17:43pm View
+5 for the effort
H.Brydon 18-Sep-13 23:15pm View
My mother went to a restaurant last Thursday and ordered a tuna salad sandwich, hold the mayo. When she bit a mouthful of said sandwich, one of her friends walked by.

What was her name?
H.Brydon 18-Sep-13 17:37pm View
I <3 your C. :-)
H.Brydon 18-Sep-13 17:31pm View
Why are you answering a question from 2011?
H.Brydon 18-Sep-13 1:33am View
This forum is not for doing your homework.
H.Brydon 18-Sep-13 1:14am View
Perhaps show the definition for the VlcControl class.

[going offline for about 12 hours shortly...]
H.Brydon 18-Sep-13 0:40am View
Hmmm ... warnings bad juju.
H.Brydon 18-Sep-13 0:39am View
Okay, +5 for the effort!
H.Brydon 18-Sep-13 0:37am View
It seems to be complaining about vlc.dotnet.forms. Where did you initialize vlc.dotnet and likewise vlc.dotnet.forms? You need to show what VlcControl consists of.
H.Brydon 17-Sep-13 23:29pm View
+5 - Exactly. The same page I searched for and was going to put in my own solution.
H.Brydon 17-Sep-13 23:26pm View
Answering a question from 2011?
H.Brydon 17-Sep-13 0:13am View
Thanks. I haven't heard that title for a while but I suppose it fits. :-)
H.Brydon 17-Sep-13 0:11am View
I was trying to say that console output can't (easily) be saved to an external file.
H.Brydon 16-Sep-13 23:15pm View
This is pretty basic knowledge. If you can't figure that out, you need somebody local that can teach you with some hands-on training.

Google can come up with coding examples. For fopen_s() for example, Google gives
H.Brydon 16-Sep-13 23:01pm View
+5 good answer. :-)
H.Brydon 15-Sep-13 19:34pm View
Whew! +5
H.Brydon 15-Sep-13 19:24pm View
Agreed. Some of the laundry items I can identify:
- #include/#import rules we just kicked around here...
- lack of module support (like Pascal or better)
- lack of concurrent memory model
- poor support for concurrency (C++11 is on the way but hasn't arrived at the station yet)
- precompiled headers (defined, and how they are used)
- lack of "negative declaration" identifiers (if there is a virtual, there should be a non-virtual)
- overloaded identifiers (static means several things depending on where it is used)
- there should be 'interface', 'default', 'inherit', 'disabled' and others (such as in C++/CLI)
- 2 types of whitespace

There are more...
H.Brydon 15-Sep-13 17:29pm View
The SO page just seems to say to use angle brackets for system headers without saying why. At my company we had a build system that (I think correctly) required all includes to use angle bracket syntax.

Suppose you (stupidly) added a file called "windows.h" to your local directory and used quote syntax. That would break a lot of things. Other more subtle examples could be determined with the same principle...
H.Brydon 15-Sep-13 16:51pm View
No, (at least for the Microsoft compiler) - use of the quoted version uses an arguably defective search path depending on essentially cached info (which can have bizarre header dependencies that are impossible to debug). Use of the angle bracket version, the search path is unambiguous.

Check out Microsoft's rules at

I don't know if this is Microsoft specific or not, so I don't know the rules for other compilers.
H.Brydon 15-Sep-13 16:36pm View
Thanks very much.
H.Brydon 15-Sep-13 16:05pm View
Thanks - that info is actually solution-worthy by itself.
H.Brydon 14-Sep-13 21:30pm View
That's not really a workaround - that is the right way to do it.
H.Brydon 14-Sep-13 21:21pm View
Thanks Sergey (I think?). I think we belong to the same religious brotherhood.
H.Brydon 14-Sep-13 21:14pm View
+5 - not sure why you were downvoted; your answer looked reasonable to me...
H.Brydon 14-Sep-13 21:11pm View
I agree - that would work out to about one question asked per 10 CP members. Yup, that's about right. :-)
H.Brydon 14-Sep-13 21:10pm View
+5 although I'd say 10 years.
H.Brydon 14-Sep-13 21:07pm View
+5 for your perfect English. Oh yeah the answer looks good too. :-)
H.Brydon 14-Sep-13 20:55pm View
You said "why" - did you perhaps mean "how"?

If you couldn't use the main method in java, it would always have to be started from another language API or some other entry point convention.
H.Brydon 14-Sep-13 20:53pm View
You said SMTP but I think you probably meant POP3 or IMAP (and correspondingly different RFCs).
H.Brydon 14-Sep-13 20:44pm View
Your best bet is to invoke the great search god Google:
H.Brydon 14-Sep-13 20:41pm View
+5 (although you are doing all the work for OP who should have done this himself.)
H.Brydon 14-Sep-13 20:39pm View
I count 15. :-)
H.Brydon 14-Sep-13 0:50am View
I think your command line in the .bat file should perhaps be

start /d "C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE\VCExpress.exe" readxmlresou.exe /debugexe

and your command line in java should be

r.exec(new String("C:\\users\\abdehalim\\desktop\\abs.bat"), null, new File("C:\\users\\abdelhalim\\desktop\\"));

Oh yeah, and you want to adjust the .bat file until it does the right thing when you execute it with a double click from Explorer. It should not expect parameters. Once you get that working, then go to the java IDE and get that part going...
H.Brydon 13-Sep-13 12:19pm View
I'm not sure what you are looking at. The coding examples don't include attachment examples but every library listed at this Google page supports attachments (MIME or otherwise).
H.Brydon 12-Sep-13 23:26pm View
I don't have VS2010 Express edition (I have the full version). The help for devenv shows the following:

d:\vs2010\VC>devenv /?

Microsoft (R) Visual Studio Version 10.0.40219.1.
Copyright (C) Microsoft Corp. All rights reserved.

devenv [solutionfile | projectfile | anyfile.ext] [switches]

The first argument for devenv is usually a solution file or project file.
You can also use any other file as the first argument if you want to have the
file open automatically in an editor. When you enter a project file, the IDE
looks for an .sln file with the same base name as the project file in the
parent directory for the project file. If no such .sln file exists, then the
IDE looks for a single .sln file that references the project. If no such single
.sln file exists, then the IDE creates an unsaved solution with a default .sln
file name that has the same base name as the project file.

Command line builds:
devenv solutionfile.sln /build [ solutionconfig ] [ /project projectnameorfile [ /projectconfig name ] ]
Available command line switches:
Product-specific switches:

/debugexe Open the specified executable to be debugged. The
remainder of the command line is passed to this
executable as its arguments.
/useenv Use PATH, INCLUDE, LIBPATH, and LIB environment variables
instead of IDE paths for VC++ builds.

To attach the debugger from the command line, use:
VsJITDebugger.exe -p <pid>


... so you need to specify /debugexe if you want the program to be started when vcexpress.exe starts (assuming it has the same command line switches).

Also, for VCExpress.exe to run correctly it needs to have the proper environment initialized. If this is not the case for a plain command prompt on your computer, you need to use a different strategy. I would suggest building a batch file "abc.bat" that initializes the environment, and runs the programs you have described above. This means putting "abc.bat" in your r.exec() call instead of VCExpres.exe. This also means that you can do a little more debugging by calling your batch file from the command line to see if it works correctly.

H.Brydon 11-Sep-13 22:40pm View
Yeah, you are out of time and want someone else to do your homework for you.

If you graduate, I wouldn't hire you. Sorry...
H.Brydon 11-Sep-13 22:39pm View
How do you know it does not execute? I haven't used this activation method but I suspect that it starts a program without providing either a UI or an output console. Is it reasonable that the program starts and runs but does not create any detectable output? Perhaps put a MessageBox() call in the startup sequence of your app...

If that isn't helpful, I don't have any further expertise with this way of activating; I haven't used this method.
H.Brydon 11-Sep-13 14:19pm View
Posting homework answers here is a bad idea. It only encourages lazy and/or dishonest students to abuse this forum.
H.Brydon 10-Sep-13 23:59pm View
I've used this technique and it works fine (+5). This requires setting the address manually, and it disappears at the end of the debug session. To make this more persistent, establish a reference or non-void pointer at the memory address in question (programmatically or manually) and set a watch point on the variable.
H.Brydon 10-Sep-13 23:25pm View
Messages can be deceiving but the computer does not lie. If it says that it can't find a file, then that is the case.
H.Brydon 10-Sep-13 12:30pm View
+5. I didn't try it but it looks good.
H.Brydon 10-Sep-13 12:30pm View
+5 back... I didn't realize you posted a solution just before mine. :-)
H.Brydon 10-Sep-13 12:27pm View
Sadly, yes. I just can't tear myself away from the keyboard. :-(
H.Brydon 9-Sep-13 20:38pm View
+5 for your endurance. :-)
H.Brydon 9-Sep-13 1:50am View
I agree, I like your code better, although there are still some other issues. The values ee and Pee should be class variables (not static) and the cleanup stuff should really be in destructors instead of being reused.

What we have ended up with here is a C program written using some C++ features.
H.Brydon 9-Sep-13 1:45am View
Thank you Sergey. Agreed, I think that there are probably other issues to address, too.
H.Brydon 9-Sep-13 0:00am View
If you ask Google, you will get several hits. Have a look at
Beware of some of the 'lessons' that teach some rather advanced features such as IDE extensions, interacting with MS Office and other such complicated things. Stick to the basic concepts. There is a wealth of sample code that you can use and/or study to develop your skills. and MSDN are quite helpful.
H.Brydon 8-Sep-13 23:54pm View
No, I didn't laugh. I was too busy stepping out of the way in case of a bucket split or an overflow of some kind.
H.Brydon 8-Sep-13 17:24pm View

Your url seems to be truncated. Perhaps you meant (?)

Another link that might be better is

H.Brydon 8-Sep-13 14:50pm View
This won't work if the nodes are a non-contiguous list. For different reasons, it also won't work if the nodes are a contiguous list.

If the node pointers are truly pointers, you will end up with a botched list in both cases.
H.Brydon 7-Sep-13 17:46pm View
The choices you have are:
- scan the entire list each time you delete a node and update all index values
- scan to the node to be deleted, and (as you say) abandon the in-node index value

The choice is up to you. If you don't use the index value any more, it should probably be removed from the node struct definition or somebody else will come along and try to use it and it will find out the hard way that it has incorrect info. [This is where big bugs come from.]
H.Brydon 7-Sep-13 11:48am View
Oh great poobah
Named 'nv3'
You get a +5
And more respect from me.

Apologies to the Vogons. :-)
H.Brydon 6-Sep-13 17:46pm View
Be careful about mixing debug and nodebug dlls within an image. The official answer from Microsoft is that you can't do it. In fact you can do it in some cases but it is unsupported. Notably, memory management is different between the 2 build types, and if you create an object with new() in the debug world and delete it with delete() in nodebug (or vice versa), you will trash your heap.

Bad juju.
H.Brydon 6-Sep-13 17:39pm View
My +5 also for providing codeless algorithm. Wise craftsman you are.
H.Brydon 6-Sep-13 17:19pm View
Still still almost almost :-) :-)
It is not dependent on compiler or platform. This is defined in the C standard, and brought forward to C++ and beyond. It is common for all compliant compilers and platforms.

There is no difference (to generated code or internal representation between values on each of the following lines:
0. 0.0 0.000 00.0000
0.f 0.0f 0.0F 0.000f 00.000F
The first line represents a double zero, and the second line, each represents a float zero.
H.Brydon 6-Sep-13 17:07pm View
Ack - that is exactly correct. I need a vacation. :-)
H.Brydon 6-Sep-13 17:05pm View
Exactly. Too short I might add. :-(
H.Brydon 6-Sep-13 16:35pm View
That's a very good one. Prepare to be quoted. :-)
H.Brydon 6-Sep-13 16:29pm View
Yo another +5 for nv3.
H.Brydon 30-Aug-13 0:52am View
This sounds like a restatement of solution #2...
H.Brydon 30-Aug-13 0:15am View
This solution is not correct. If you delete anything "at or before" a forward iterator, the iterator becomes invalid. Making a second copy does not help you. It is invalid as well.
H.Brydon 30-Aug-13 0:12am View
I agree, solution #1 and #2 are both correct, but #2 addresses the immediate problem better.
H.Brydon 30-Aug-13 0:11am View
No, it works because reverse iterators start from the end of the list, and if you delete the last element, it is at the end of the list, and the reverse iterator is still valid.

If you delete the first element with a (forward) iterator, all the remaining items in the iterator's context juggle down and the iterator becomes invalid.
H.Brydon 29-Aug-13 11:41am View
Interesting... Most of the questions I see like this are people who mix up ansi and unicode and get Chinese when they are expecting text. :-)
H.Brydon 26-Aug-13 23:00pm View
I'll give you another +5. :-)
H.Brydon 25-Aug-13 22:29pm View
[The only answer I give a +5, for the text "never call virtual functions from constructors..."]. IMHO a constructor should never call them, and any articles about doing it are really academic. My recommendation is to not call anything in the same class hierarchy except a private non-virtual method or (C++11) a delegating constructor.
H.Brydon 25-Aug-13 22:16pm View
+5 for the answer, but in defense of OP, the answer to this question is not easily findable unless you know the answer already.
H.Brydon 25-Aug-13 21:53pm View
It is considered bad form to do lazy student's homework for them on this forum.
H.Brydon 25-Aug-13 21:51pm View
Me too. Please post your code.
H.Brydon 25-Aug-13 21:49pm View
Interesting answer but why are you answering a 3 year old question?
H.Brydon 21-Aug-13 23:08pm View
+5 (real) for the answer
+5 (virtual) for the BG reference. :-)
H.Brydon 21-Aug-13 23:00pm View
The industry answer is controversial. I like your answer the best. +5
H.Brydon 21-Aug-13 22:57pm View
I read your answer and gave it a +5 (obscure reference to your other comment). :-)
H.Brydon 21-Aug-13 22:45pm View
Your answer is so good that I figured out what the question was by reading the answer. Is this Jeopardy?

H.Brydon 20-Aug-13 23:18pm View
Snowden, but yeah. +5
H.Brydon 20-Aug-13 13:18pm View
Well too bad; I +5d you about 5 times today (so far). See if you can reach integer overflow... You have good advice; don't give up on it.
H.Brydon 20-Aug-13 11:52am View
I'll pass on the +5 :-)

(mine is probably more points for you...)
H.Brydon 19-Aug-13 12:50pm View
Right, and if it needs to be accessed in multiple .cpp files then declare it in a common .h file and use 'extern' in the .h file...
H.Brydon 19-Aug-13 12:40pm View
Not a good idea to do homework for people here, especially for really basic questions. By doing this, you are inspiring other lazy students to bombard this forum with silly questions that they should be doing themselves.
H.Brydon 19-Aug-13 12:27pm View
I think we are going way out on a limb here. OP's question was about aborting threads and getting threads to exit gracefully (see original question title and question text). My position is that threads should always exit gracefully whenever possible and not aborted externally (ie. external to the thread). We have strayed a long way from that original question. You said that you disagreed with me but most of what you said here agrees with my original text in solution #2.

I think we beat this issue to death. OP should be able to write his code.
H.Brydon 19-Aug-13 10:57am View
Likewise you seem to be disagreeing with me but you are saying the same thing that I did. A thread should not be killed externally but should be signalled to die and then wait for it to notice the request, handle it and die of its own accord.

External thread termination is bad juju.
H.Brydon 19-Aug-13 10:47am View
You said that you disagree, but you pretty much said what I said. My major point is to not use TerminateThread() from an external thread/process, but to somehow tell the thread to die and let it handle its own hospice details.
H.Brydon 18-Aug-13 23:25pm View
You're on fire today. I would have +5'd that. :-)
H.Brydon 18-Aug-13 23:24pm View
Exactly, float and double should not be used for any representation of currency (including stock prices).

H.Brydon 18-Aug-13 23:11pm View
Posting an elementary question with no code and saying it is urgent is a recipe for getting no respect, no help and/or no response. I'm feeling nice today and am going out of my way by being helpful and redundant here.
H.Brydon 18-Aug-13 23:02pm View
Probably the easiest +5 you've ever received... :-)
H.Brydon 18-Aug-13 22:51pm View
To expand on your thought ... Compilers are usually either written in a hardware specific language such as assembler for the target machine, or (after a brief minimal bootstrap process) in the same programming language as that being compiled. For example, the first FORTRAN compiler was written in FORTRAN. I wrote a C++ compiler in C++. et cetera... I would not expect a C++ compiler to be written in VB.NET or C#.
H.Brydon 18-Aug-13 22:39pm View
Roses are red
Violets are blue
Your answer gets
a +5 for you
H.Brydon 16-Aug-13 2:16am View
Wrong forum for that. We don't write code or produce samples. You need to ask Google for ideas.
H.Brydon 15-Aug-13 16:56pm View
You beat me to it. That's pretty close to the answer I was going to give.

H.Brydon 15-Aug-13 1:48am View
Good info, +5... I will likely use it myself.
H.Brydon 14-Aug-13 22:29pm View
Yup. +5
H.Brydon 14-Aug-13 22:27pm View
+5 for answering the OP question with his own code.
+5 for the Klingon reference and bombastic style. :-)
0 for the robustness of the answer (see Ian Davidson comment)

Average: +5 :-P :-)
H.Brydon 13-Aug-13 18:12pm View
+5 for the answer. I owe you +5 for the effort. :-)
H.Brydon 13-Aug-13 18:08pm View
... probably the easiest +5 you'll get today. :-)
H.Brydon 13-Aug-13 18:07pm View
+5 for being correct, yet refined.

More to come I'm sure...
H.Brydon 13-Aug-13 18:07pm View
+5 for being correct, yet bombastic.
H.Brydon 13-Aug-13 18:01pm View
No, that is not a realistic way to do that.
H.Brydon 13-Aug-13 17:58pm View
I'm not suggesting that this is an answer but where you have '&#xA;' I think it needs to be '&#x0A;'.
H.Brydon 13-Aug-13 17:39pm View
Ha ha - I owe you a +5 for that pseudo-answer. Watch for it... :-)
H.Brydon 13-Aug-13 17:37pm View
Good question (with perhaps confusing details per the comments and solution text).

+5 to offset whomever downvoted you.
H.Brydon 13-Aug-13 11:11am View
Compare the following 2 sets of statements:

if(list == 1);
{ ... }

if(list == 1)
{ ... }

Why do you have a semicolon at the end of the if() statement?
H.Brydon 12-Aug-13 17:59pm View
I assume that you use a domain (as stated). Start with a sample machine that has not seen activity from 'dragon' before, and login to the domain for the first time on that system with your 'dragon' username. Do any other setup you need to do, then logout. From an administrative username, search in the registry for references to 'dragon', and identify all of the fields associated with the username addition. Look to see where the directory/directories and file(s) were created when you logged in. Write an installer to duplicate this (don't forget about ownership and access).

Robert is your father's brother.
H.Brydon 11-Aug-13 22:09pm View
That still won't compile.

Also not a good idea to do homework (or really basic programming) for people. This encourages cheating and/or dumb questions from lazy students/programmers.
H.Brydon 11-Aug-13 17:10pm View
Zowee, another +5 for an extraordinary effort!
H.Brydon 10-Aug-13 18:17pm View
You could update your answer and change the totalage declaration to be

int totalage = 0;

That won't fix everything (per pasztorpisti) but at least the sum will be calculated correctly.
H.Brydon 10-Aug-13 18:14pm View
What goes around comes around. Keep watching. :-)
H.Brydon 10-Aug-13 18:09pm View
+5. Ears burning?
H.Brydon 10-Aug-13 18:06pm View
Great analysis; I owe you another +5 - watch for it (I gave you several others in the last day or two). I also share your affinity for OO and disdain for iostreams.
H.Brydon 10-Aug-13 18:03pm View
You didn't initialize the totalage variable (major point of solution #2). Or move averageage declaration to the bottom where it is used. In fact you could make a minor change to the code so it is not needed.

[I also agree with pasztorpisti about disdain for iostreams...]

Thanks for your +5.
H.Brydon 10-Aug-13 17:07pm View
Ha ha - :-)
If I make a long post, I usually add a "tl;dr" line or two at the bottom.
H.Brydon 10-Aug-13 16:34pm View
Whew! (yet another) +5 from me. This one mostly for the effort.
You should add a "tl;dr" version too...
H.Brydon 9-Aug-13 20:52pm View
Yeah me too, I missed it as well. +5
H.Brydon 9-Aug-13 11:02am View
Yet another +5. I think I've given you about 500 points this week. :-)
H.Brydon 9-Aug-13 10:59am View
Nice links. +5
H.Brydon 9-Aug-13 10:54am View
Perfect answer, +5
H.Brydon 8-Aug-13 23:11pm View
... and don't use the "Rebuild" option. Click "Clean" and then "Build". Sometimes "Rebuild" does the wrong thing.
H.Brydon 7-Aug-13 11:01am View
+5, I didn't know that. Good stuff...