MISPRINT:<br><br>In the last part when says:<br><br>"The announcement can also know <br><br>
algorithm<br><br>
self doA.<br>
self announce: (WorkAnnoucement finished: #doA)."<br><br>shouldn't go!<br><br>Cheers,<br>Martin<br><br><br><div class="gmail_quote">On Thu, Mar 31, 2011 at 6:53 PM, Martin Dias <span dir="ltr"><<a href="mailto:tinchodias@gmail.com">tinchodias@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;"><br><div class="gmail_quote"><div><div></div><div class="h5">On Thu, Mar 31, 2011 at 5:47 PM, Yoshiki Ohshima <span dir="ltr"><<a href="mailto:yoshiki@vpri.org" target="_blank">yoshiki@vpri.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
I don't understand the problem. Let us say we start from the<br>
example in the method:<br>
<br>
--------------------<br>
<div>'Now here''s some Real Progress'<br>
displayProgressAt: Sensor cursorPoint<br>
from: 0 to: 10<br>
during: [:bar |<br>
1 to: 10 do: [:x | bar value: x.<br>
(Delay forMilliseconds: 500) wait]].<br>
</div>--------------------<br>
<br>
and your "algorithm" here would be:<br>
<br>
1 to: 10 do: [:x | "do something here"<br>
(Delay forMilliseconds: 500) wait].<br>
<br>
It is already reasonably decoupled to me, but I take that you want to<br>
keep the "algorithm" really prestine and don't want to have "bar<br>
value: x" call in there, and completely get rid of anything from "do<br>
something here". Is this the case?<br>
<br>
There still have to have some way to tell how much percent of work<br>
done from the "algorithm" to the progress notification mechanism. In<br>
the possible meta approach (which would not be that hard at all), I'd<br>
make an instance variable for the object that represents your<br>
algorithm state, and the algorithm assigns a value to the instance<br>
variable, and the progress bar displayer that is running in a separate<br>
thread looks at the variable periodically and update the screen.<br>
<br>
However, in this senario, you would have to have an assignment to<br>
that variable at "do something here":<br>
<br>
-----------------<br>
1 to: 10 do: [:x | progress := x.<br>
(Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
But is "progress := x" any better than "bar value: x"?<br>
<br>
Somebody suggested announcements. So your algorithm would look like:<br>
<br>
-----------------<br>
1 to: 10 do: [:x | self announce: (ProgressAnnouncement value: x).<br>
(Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
And a stepping morph surely does not work. If something was started<br>
from a do-it in workspace, next time the morph gets #step message is<br>
after the do-it is completed.<br>
<br>
The "bar" block could be stored in an instance variable of the<br>
algorithm object, and your algorithm may do:<br>
<br>
-----------------<br>
1 to: 10 do: [:x | bar ifNotNil: [bar value: x].<br>
(Delay forMilliseconds: 500) wait].<br>
-----------------<br>
<br>
This may be just as good as it gets without complicating anything<br>
else.<br>
<br>
Note that your algorithm may not be a loop. It is totally legitimate<br>
to write:<br>
<br>
algorithm<br>
self doA.<br>
bar value: 0.33.<br>
self doB.<br>
bar value: 0.66.<br>
self doC.<br>
<br></blockquote></div></div><div><br>What you sent makes me think... <br><br>I am not convinced of this other solution, but with announcements could be:<br><br>algorithm<br>
self doA.<br>
self announce: (WorkAnnoucement finished: #doA).<br>
self doB.<br>
self announce: (WorkAnnoucement finished: #doB).<br>
self doC.<br>
self announce: (WorkAnnoucement finished: #doC).<br>
<br>and the specific observer subscribed to this algorithm knows what percentage corresponds to each selector. And you could easily plug an observer that logs to Transcript.<br><br>The announcement can also know <br><br>
algorithm<br><br>
self doA.<br>
self announce: (WorkAnnoucement finished: #doA).<br>
<br> </div><div><div></div><div class="h5"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
where doA, doB, doC are long running computation. So, really generic<br>
way to view the progress of something from outside without the<br>
knowledge of where to look at and how to interpret these values are<br>
not going to fly.<br>
<br>
-- Yoshiki<br>
<br>
At Thu, 31 Mar 2011 17:10:58 -0300,<br>
<div><div></div><div>Martin Dias wrote:<br>
><br>
> Hello<br>
><br>
> On Wed, Mar 30, 2011 at 4:24 AM, Denis Kudriashov <<a href="mailto:dionisiydk@gmail.com" target="_blank">dionisiydk@gmail.com</a>> wrote:<br>
><br>
> Hello<br>
><br>
> I have idea about "meta approach" for implementation of progress tracking of arbitrary method execution.<br>
><br>
> Progress tracking (progress bar stuff) is really ortogonal functionallity for method execution. And it would be cool<br>
> if we have framework for describing tracking of method execution stuff (like it progress).<br>
> This framework should run block of code in background and periodically analize state of this background process<br>
> stack. And show this state for user. And so this framework allow track execution of arbitrary code.<br>
> Analizing state can search running loops in stack for example and show user status of loop counters.<br>
><br>
> I think it is not very hard to implement. But maybe this approach can't be implemented when code jitted<br>
><br>
> I like the "meta approach"... but it doesn't look easy to implement for me!<br>
> Have you seen something like that implemented? or some paper written?<br>
> <br>
><br>
> 2011/3/30 Martin Dias <<a href="mailto:tinchodias@gmail.com" target="_blank">tinchodias@gmail.com</a>><br>
><br>
> Hello<br>
><br>
> I have a couple of algorithms and I want to show the progress while they run. I played with the progress bar and<br>
> it's okay for my needs.<br>
><br>
> The progress bar should be pluggable and decoupled of the algorithms.<br>
><br>
> I am writing to you to ask about good designs for my problem. I hope I haven't expressed the problem in a too<br>
> abstract way.<br>
><br>
> The design I have in mind is a kind of observer pattern: the serialization algorithm publishes information about<br>
> the run; a specific listener implements the progress bar for that serialization algorithm, interpreting the<br>
> information published.<br>
><br>
> Thanks,<br>
> Martin<br>
><br>
><br>
</div></div>> [2 <text/plain; us-ascii (7bit)>]<br>
><br>
<br>
</blockquote></div></div></div><br>
</blockquote></div><br>