From: Tom Serface on
Hi Simon,

Did you get an answer that works for you? I want to make sure your problem
got solved.

I wouldn't stress too much about the comments made. Written text in
newsgroups and emails is easily misinterpreted. Believe me, everyone likes
short, but to the point, questions since that makes it easy to answer. I
think Joe saw your first without taking the time to read the second or the
replies you'd gotten before he checked in. Sometimes newsgroups are hard to
follow so ...

Anyway... is it working for you now?

Tom

"Simon" <bad(a)example.com> wrote in message
news:uMS4flE6KHA.5676(a)TK2MSFTNGP04.phx.gbl...
> On 2010/04/30 08:26 AM, Joseph M. Newcomer wrote:
>> You described something you thought you wanted, to solve an undefined
>> problem.
>
> No, I asked 2 fairly straight forward questions, read my OP again.
> is it possible to pause a timer and is there a way to know how many ms
> remain.
>
>> ...state what problem you were trying to solve, so we could not offer
>> suggestions about what
>> might actually do the job, because we didn't know what you were trying to
>> accomplish.
>
> No, _you_ could not offer suggestions.
> Others did, and they very good suggestions, thanks.
>
>>
>> Actually, my own take on this is that if you have to keep checking as you
>> describe, you
>> need to redesign the application so this is not even a problem that needs
>> to be solved.
>> You are tyring to retrofit something into an existing app that it was not
>> designed to
>> handle, and you are probably approaching the problem incorrectly.
>
> No, this is the wrong assumption.
>
> I could write a book about the application and _then_ ask my question(s).
>
> Or I could try to be as short and to the point as possible in order to get
> some help/insight/tips.
>
> Even the one example I gave had to be short and to the point.
> Any programmer would understand that.
>
> This is not an architecture design meeting room, this is a NG.
>
> Regards,
>
> Simon
>
>
From: Simon on
On 2010/04/30 02:48 PM, Tom Serface wrote:
> Hi Simon,
>
> Did you get an answer that works for you? I want to make sure your
> problem got solved.
>

Hi,

Thanks for the reply, in the end I just added a flag that does something
like.

// -----------------------------
OnTimer( ... )
{
if( busy )
{
timer_is_complete = true;
}
else
{
DoSomething();
}
}

....

DoingSomStuff()
{
// do the stuff

if( true == timer_is_comlete )
{
DoSomething();
}
}

// --------------------------------

But I am not 100% happy with it. I would prefer to pause the timer. That
way, when you resume the timer the normal chain of events will happen.

I could write my own timer class using a thread but this would add a lot
over testing overhead to the current app.
I will almost certainly create a branch with a bunch of tests before
going live with it.

Thanks again

Simon
From: Tom Serface on
You could simulate a pause by just keeping track of the timer tick downs
(seconds) in your own variable and decrement it every time the timer is
called. Then to pause, you would essentially stop the timer, but keep the
variable (a member of your class). Then to start you would use the amount
of time not ticked off (using the variable) to set the timer again.

When the timer finishes you could you stop and start it again using the full
amount of time again as part of the timer handler.

You could also have a flag, like your busy flag, that just ignores the
timer firing when it happens and returns immediately without doing anything.
This would simulate doing a pause (at least in the functionality of it).

Tom

"Simon" <bad(a)example.com> wrote in message
news:eUH0kcG6KHA.4508(a)TK2MSFTNGP06.phx.gbl...
> On 2010/04/30 02:48 PM, Tom Serface wrote:
>> Hi Simon,
>>
>> Did you get an answer that works for you? I want to make sure your
>> problem got solved.
>>
>
> Hi,
>
> Thanks for the reply, in the end I just added a flag that does something
> like.
>
> // -----------------------------
> OnTimer( ... )
> {
> if( busy )
> {
> timer_is_complete = true;
> }
> else
> {
> DoSomething();
> }
> }
>
> ...
>
> DoingSomStuff()
> {
> // do the stuff
>
> if( true == timer_is_comlete )
> {
> DoSomething();
> }
> }
>
> // --------------------------------
>
> But I am not 100% happy with it. I would prefer to pause the timer. That
> way, when you resume the timer the normal chain of events will happen.
>
> I could write my own timer class using a thread but this would add a lot
> over testing overhead to the current app.
> I will almost certainly create a branch with a bunch of tests before going
> live with it.
>
> Thanks again
>
> Simon

From: Joseph M. Newcomer on

See be;pw///
On Fri, 30 Apr 2010 11:41:53 +0200, Simon <bad(a)example.com> wrote:

>On 2010/04/30 08:26 AM, Joseph M. Newcomer wrote:
>> You described something you thought you wanted, to solve an undefined problem.
>
>No, I asked 2 fairly straight forward questions, read my OP again.
>is it possible to pause a timer and is there a way to know how many ms
>remain.
****
ANd the answers were negative, which meant I couldn't really tell you what might work.
>
>> ...state what problem you were trying to solve, so we could not offer suggestions about what
>> might actually do the job, because we didn't know what you were trying to accomplish.
>
>No, _you_ could not offer suggestions.
>Others did, and they very good suggestions, thanks.
****
They were better at guessing than I was. I get tired of trying to outguess what the
question actually should have been, so I don't answer if I don't have specification of the
problem.
****
>
>>
>> Actually, my own take on this is that if you have to keep checking as you describe, you
>> need to redesign the application so this is not even a problem that needs to be solved.
>> You are tyring to retrofit something into an existing app that it was not designed to
>> handle, and you are probably approaching the problem incorrectly.
>
>No, this is the wrong assumption.
****
Then I am very suspect of the design. You have to deal with race conditions, which is
what is going to happen if between the check and the timer event something cmes in. The
last few instances of this kind of code I saw managed to delay the transaction request
unduly because the code was of the form "if no request is present, restart the timer for
the specified interval" and the request came in just after the test, so there was a long
delay. In these cases, the delays were several hundred milliseconds, enough for the
remoted embedded system to timeout and re-transmit its request.
****
>
>I could write a book about the application and _then_ ask my question(s).
>
>Or I could try to be as short and to the point as possible in order to
>get some help/insight/tips.
***
But when the answers are "it is not possible" then we are left to guess about how the
problem might be solved, and not knowing what the problem is means the guesses might be
incorrect.
****
>
>Even the one example I gave had to be short and to the point.
>Any programmer would understand that.
>
>This is not an architecture design meeting room, this is a NG.
****
And there's a difference? Architecture is all that there is; choose the wrong
architecture, and you end up needing capabilities that do not exist or make mistakes about
what capabilities exist and let them drive the architecture (e.g., the Olcott Saga), and
you end up with complex solutions to simple problems. Most of the disasters I've fixed
in the last decade were architecture design problems caused by either having to retrofit a
new idea to an old app (and getting it completely wrong) or expecting some capability to
exist in the OS, designing as if it was there, discovering it was not there, and building
some amazingly clumsy solution to the problem. Each of those was GREAT for me because I
could bill for WEEKS of my time while I rewrote the code to actually be viable, but it was
expensive for the client to have to have the architecture reworked to accomodate the
changes they actually wanted. Since I had to guess what the problem might be, I guessed
wrong., but I don't like to guess at all. The correct question would have been

"I need to know how much time has elapsed since I set a timer, because <problem
description here>" and the answers are much easier to give.
joe

>
>Regards,
>
>Simon
>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
From: Joseph M. Newcomer on
I download NG posts, answer them over a period of many hours, and then download some more.
Sometimes, there have been several answers since the original post or the most recent
download. THere are people who think I have an "instantaneous view" of all posts by the
time I make mine, but my collection might be six hours old, and I can only answer based on
what I see, not what might have happened in the interim.
joe

On Fri, 30 Apr 2010 07:48:03 -0500, "Tom Serface" <tom(a)camaswood.com> wrote:

>Hi Simon,
>
>Did you get an answer that works for you? I want to make sure your problem
>got solved.
>
>I wouldn't stress too much about the comments made. Written text in
>newsgroups and emails is easily misinterpreted. Believe me, everyone likes
>short, but to the point, questions since that makes it easy to answer. I
>think Joe saw your first without taking the time to read the second or the
>replies you'd gotten before he checked in. Sometimes newsgroups are hard to
>follow so ...
>
>Anyway... is it working for you now?
>
>Tom
>
>"Simon" <bad(a)example.com> wrote in message
>news:uMS4flE6KHA.5676(a)TK2MSFTNGP04.phx.gbl...
>> On 2010/04/30 08:26 AM, Joseph M. Newcomer wrote:
>>> You described something you thought you wanted, to solve an undefined
>>> problem.
>>
>> No, I asked 2 fairly straight forward questions, read my OP again.
>> is it possible to pause a timer and is there a way to know how many ms
>> remain.
>>
>>> ...state what problem you were trying to solve, so we could not offer
>>> suggestions about what
>>> might actually do the job, because we didn't know what you were trying to
>>> accomplish.
>>
>> No, _you_ could not offer suggestions.
>> Others did, and they very good suggestions, thanks.
>>
>>>
>>> Actually, my own take on this is that if you have to keep checking as you
>>> describe, you
>>> need to redesign the application so this is not even a problem that needs
>>> to be solved.
>>> You are tyring to retrofit something into an existing app that it was not
>>> designed to
>>> handle, and you are probably approaching the problem incorrectly.
>>
>> No, this is the wrong assumption.
>>
>> I could write a book about the application and _then_ ask my question(s).
>>
>> Or I could try to be as short and to the point as possible in order to get
>> some help/insight/tips.
>>
>> Even the one example I gave had to be short and to the point.
>> Any programmer would understand that.
>>
>> This is not an architecture design meeting room, this is a NG.
>>
>> Regards,
>>
>> Simon
>>
>>
Joseph M. Newcomer [MVP]
email: newcomer(a)flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4 5 6 7 8
Prev: _in s and _out s ?
Next: MSI Serial Number Validation