|
Call me Mr Doofas-Frapbrain, but I thought DoEvents released the thread and was more like thread.notify() .
|
|
|
|
|
Threading, I know little about so I maybe wrong but I was under the impression it emptied the messaging cue (so it looked like it freed up the multitasking, but not quite always). thread.notify() I haven't seen before so I will have a look! Thanks, I was of the view that my message was too long (I needed to vent over this) I'm more amazed that someone read it and didn't complain to the hamsters!!
|
|
|
|
|
It does - DoEvents empties the message queue and dispatches messages, and almost every .NET application uses it, but it's "hidden": ShowDialog calls it to allow the dialog to be modal and the "parent" form to continue to update. It's there, but it can cause some horrible, horrible problems if it isn't used carefully - so the "blank ban" on using it is the same as for goto - it should have "until you know what you are doing, a couple of years experience should do it". I haven't used DoEvents for twenty years...
Thread.Sleep is different: it takes the current thread and stops it doing anything until the time is up. So if you call that on the UI thread...the interface stops updating, and the user thinks your app has crashed. So generally it's a poor idea. But...if you are doing something on a non-UI thread then it is a good idea, and more efficient than a timer. Did you know that the SerialPort.DataRecieved event is never executed on the UI thread? So any code that is handling this data can safely call Thread.Sleep without any problems if it has to "wait" for an external device to "catch up" and be ready for new commands. It's a PITA, yes - but sometimes we have to work with awkward hardware...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
notify() may well be a java thing.
|
|
|
|
|
Yes, it is!
|
|
|
|
|
DoEvents() is a cheap trick from VB6 (as I recall) to keep the whole program from freezing and dying (just in case you created a deadlock somewhere)
Edit:
I worked on a project where it was liberally spread throughout the code in place where you really wouldn't think context switching was necessary, but if they were removed, it broke.
|
|
|
|
|
External physical devices are often really badly written from the point of view of automating them.
|
|
|
|
|
I went through the same thing. Measurement instrumentation, synched using threading by Sleep().
I have actually never found any real use to the Sleep function.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
|
You uninstalled Windows 8...It's obvious!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
|
|
|
|
|
Your huge list of pending Windows Updates finally got installed?
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
You deleted your porn history?
|
|
|
|
|
I thought we should be keeping that at safe and sound place where space shouldn't be an issue !
Not on C drive which is reserved for OS as it needs frequent updates/reinstallations !
Thanks,
Milind
|
|
|
|
|
You got a 100gb drive and installed something else that was 6 gb?
There are no secrets to success. It is the result of preparation, hard work, and learning from failure. Colin Powell
|
|
|
|
|
The volume shadow service decided to get rid of some old crap?
Have a look at vssadmin from the command prompt.
(Not sure whether that's something it'll do on its own...every once in a while, before I back up my VMs, I have vssadmin delete shadow copies, then followed by shrinking my dynamically expanding disks--very often, I'll find that an 80GB VHD drops down in size to 40GB)
|
|
|
|
|
An old topic, but in the Q&As I've seen a lot of questions about cross-thread failures in UIs. It gets asked time and time again and yet is so very basic. There must be a million and one things on the internet about it, so why can't people just Google around a bit rather than charge in and demand an answer? Or even more radical, buy a book and learn a bit about the subject?
Whilst the intentions of Q&As are admirable, I think by answering questions such as this we are just aiding the demise of experienced developers who know their field. Seriously, why should we bother to help people who make no effort themselves? Oh yes, reputation points.
Regards,
Rob Philpott.
|
|
|
|
|
Yeah, I've been feeling the same way about the future of software development for, oh, the last 6+ years or so. Having been on CP since 2003, I just watched the quality and knowledge level of the questions plummet over that time.
It used to be you could get a lot of questions that made you think and write small test projects to verify what was being seen, what the behavior of something was and test possible solutions before posting them. I've got a ton of little apps like that laying around.
Now, it's all rubber stamp answers to the same basic questions over and over again. Nobody knows anything about how to teach themselves anymore. They all think it's faster (and hence better) to ask someone to "guide them" through a problem. They miss that they are not the ones thinking the problem through and hence are not learning anything about how to debug their own code.
Hell, they're not even learning new technologies and techniques. They're just copying and pasting 5 to 7 year old code, hoping for the best.
|
|
|
|
|
I think its because we are Developers: a lot of them are Code Monkeys. Or possibly just monkeys.
Don't expect this to get better: The UK government wants to "teach programming" to all kids[^] - imagine what that is going to do to the quality level of questions!
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
Improve them probably [sarcasm]
Regards,
Rob Philpott.
|
|
|
|
|
Strangely enough I was tempted to add that to my post...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
A 14 year old who's been taught some basic stuff in school would be in a much better position to ask sensible questions that most of what we see in Q&A these days.
|
|
|
|
|
Probably because most questions are currently posted by a 14 year old who didn't listen while he was taught some basic stuff in school...
Those who fail to learn history are doomed to repeat it. --- George Santayana (December 16, 1863 – September 26, 1952)
Those who fail to clear history are doomed to explain it. --- OriginalGriff (February 24, 1959 – ∞)
|
|
|
|
|
The thing that's lacking, apparent in these "questions", is a complete lack of critical thinking skills.
I think that's what is going to be the difference between what we see now and what the UK is going to turn out.
Sadly, I don't see the same thing happening in the US because there's no short-term money in it for US companies and politicians, not to mention what the religious fanatics want to do to our education system.
I really do weep when I read crap like this[^]. I see the US education system becoming a dump if this continues.
|
|
|
|
|
You are in a good position to make observations being very active on the Q&A. One can certainly learn a lot about world trends by observing what is going on there.
We probably come from a generation that was used to wringing everything out of limited resources while we taught ourselves technologies. The internet has changed that. If only you could ask programming questions on Facebook - that would get rid of a lot of the spam.
The proliferation of quite trivial questions is accompanied by some pretty poor answers and in some cases it seems to be turning into the blind leading the blind.
Peter Wasser
"The whole problem with the world is that fools and fanatics are always so certain of themselves, and wiser people so full of doubts." - Bertrand Russell
|
|
|
|
|
pwasser wrote: The proliferation of quite trivial questions is accompanied by some pretty poor
answers and in some cases it seems to be turning into the blind leading the
blind.
Yes, I see that too. Just because the ignorant see that they can reply doesn't mean that they should.
Now, I know that I am probably going to get replies like "that's how conversationa and group learning work!". Yeah, when was the last time you saw one of those "blind leading the blind" posts turn into a good discussion?? It doesn't happen very often.
What does happen more often is that bad questions get bad (or worse!) answers then the search engines find them and because "Google said it it must be true" crap code ends up in production applications.
|
|
|
|