Re: Progress package

2018-11-27 Thread Pierre de Villemereuil
Hi,

> looks fine to me. but is there a reason why line 53 ends
> 
>  ... r_app_stdx(stream)) || rkward_stdx(stream)
> 
> instead of
> 
>  ... r_app_stdx(stream) || rkward_stdx(stream))
> 
> ?

There is none whatsoever, good catch! (Precisely the kind of safe-guard I was 
looking for! ^^)

Thank you,
Pierre.

> 
> 
> viele grüße :: m.eik
> 
> 
> -- 
>   dipl. psych. meik michalke
>   institut f"ur experimentelle psychologie
>   abt. f"ur diagnostik und differentielle psychologie
>   heinrich-heine-universit"at d-40204 d"usseldorf
> 




Re: Progress package

2018-11-27 Thread meik michalke
hi,

Am Dienstag, 27. November 2018, 16:28:42 CET schrieb Pierre de Villemereuil:
> If you have time to look at this PR regarding this issue with the "progress"
> package and tell me if you see anything wrong, I'd be grateful:
> https://github.com/r-lib/progress/pull/76

looks fine to me. but is there a reason why line 53 ends

 ... r_app_stdx(stream)) || rkward_stdx(stream)

instead of

 ... r_app_stdx(stream) || rkward_stdx(stream))

?


viele grüße :: m.eik


-- 
  dipl. psych. meik michalke
  institut f"ur experimentelle psychologie
  abt. f"ur diagnostik und differentielle psychologie
  heinrich-heine-universit"at d-40204 d"usseldorf

signature.asc
Description: This is a digitally signed message part.


Re: Progress package

2018-11-27 Thread Pierre de Villemereuil
Hi all,

If you have time to look at this PR regarding this issue with the "progress" 
package and tell me if you see anything wrong, I'd be grateful:
https://github.com/r-lib/progress/pull/76

Cheers,
Pierre.

Le Saturday, 3 November 2018, 17:48:43 CET Thomas Friedrichsmeier a écrit :
> Hi,
> 
> On Sat, 03 Nov 2018 13:04:44 +0100
> Pierre de Villemereuil  wrote:
> > The dev is asking whether there is a way to detect RKWard. Is there?
> 
> well, as far as I can see, the function in question is
> progress:::is_supported. That checks if the output stream isatty().
> (Not sure, whether this even works on Windows, but so what).
> 
> Perhaps a better check would be something like:
> 
>   (is_stdout(stream) || is_stderr(stream)) && interactive()
> 
> Untested, but might work without adding a special case for every single
> GUI out there.
> 
> (I suppose the main intention of the check is to avoid writing progress
> bars to a file. But in that case, R is either not interactive() -
> esp. when there is a shell-redirection - or a sink() is in place.
> progress:::is_stdout() seems to check for the latter, already).
> 
> Regards
> Thomas
> 




Re: Progress package

2018-11-03 Thread Pierre de Villemereuil
It seems to work indeed. I'll try to implement something for progress based on 
this... when I have the time! ;)

Cheers,
Pierre

Le samedi 3 novembre 2018, 13:43:18 CET meik michalke a écrit :
> Am Samstag, 3. November 2018, 13:04:44 CET schrieb Pierre de Villemereuil:
> > The dev is asking whether there is a way to detect RKWard. Is there?
> 
> how about this:
> 
>  "rkward" %in% (.packages())
> 
> RKWard loads its own R package which is also not available without RKWard, so 
> when an R package called "rkward" is currently loaded, you can assume the 
> session is running in RKWard.
> 
> > If so, I might be able to submit a PR to "progress". At least, I'll try...
> 
> +1
> 
> 
> viele grüße :: m.eik
> 
> 





Re: Progress package

2018-11-03 Thread meik michalke
Am Samstag, 3. November 2018, 13:04:44 CET schrieb Pierre de Villemereuil:
> The dev is asking whether there is a way to detect RKWard. Is there?

how about this:

 "rkward" %in% (.packages())

RKWard loads its own R package which is also not available without RKWard, so 
when an R package called "rkward" is currently loaded, you can assume the 
session is running in RKWard.

> If so, I might be able to submit a PR to "progress". At least, I'll try...

+1


viele grüße :: m.eik

-- 
  dipl. psych. meik michalke
  institut f"ur experimentelle psychologie
  abt. f"ur diagnostik und differentielle psychologie
  heinrich-heine-universit"at d-40204 d"usseldorf

signature.asc
Description: This is a digitally signed message part.


Re: Progress package

2018-11-03 Thread Pierre de Villemereuil
The dev is asking whether there is a way to detect RKWard. Is there?

If so, I might be able to submit a PR to "progress". At least, I'll try...

Cheers,
Pierre.

Le samedi 3 novembre 2018, 09:49:38 CET Pierre de Villemereuil a écrit :
> Yes, Thomas you are right. I see it correctly when using force = TRUE.
> 
> I've submitted a bug report there:
> https://github.com/r-lib/progress/issues/74
> 
> I'm going to mention this.
> 
> Cheers,
> Pierre.
> 
> 
> Le samedi 3 novembre 2018, 09:07:39 CET Thomas Friedrichsmeier a écrit :
> > Hi,
> > 
> > On Fri, 02 Nov 2018 23:42:40 +0100
> > meik michalke  wrote:
> > > without looking at any of the code of the package, the precise list
> > > of applications where the package will run to me reads like it needed
> > > special implementation to reach that goal. so it probably checks its
> > > environment to decide which implementation to use, and doesn't find
> > > one for RKWard.
> > 
> > well, the really annoying thing is that it does _not_ need any special
> > implementation. Use it with force=TRUE, and it works just fine in
> > RKWard. But without force, it simply gives up without even trying.
> > 
> > Regards
> > Thomas
> 
> 
> 





Re: Progress package

2018-11-03 Thread Pierre de Villemereuil
Yes, Thomas you are right. I see it correctly when using force = TRUE.

I've submitted a bug report there:
https://github.com/r-lib/progress/issues/74

I'm going to mention this.

Cheers,
Pierre.


Le samedi 3 novembre 2018, 09:07:39 CET Thomas Friedrichsmeier a écrit :
> Hi,
> 
> On Fri, 02 Nov 2018 23:42:40 +0100
> meik michalke  wrote:
> > without looking at any of the code of the package, the precise list
> > of applications where the package will run to me reads like it needed
> > special implementation to reach that goal. so it probably checks its
> > environment to decide which implementation to use, and doesn't find
> > one for RKWard.
> 
> well, the really annoying thing is that it does _not_ need any special
> implementation. Use it with force=TRUE, and it works just fine in
> RKWard. But without force, it simply gives up without even trying.
> 
> Regards
> Thomas





Re: Progress package

2018-11-03 Thread Thomas Friedrichsmeier
Hi,

On Fri, 02 Nov 2018 23:42:40 +0100
meik michalke  wrote:
> without looking at any of the code of the package, the precise list
> of applications where the package will run to me reads like it needed
> special implementation to reach that goal. so it probably checks its
> environment to decide which implementation to use, and doesn't find
> one for RKWard.

well, the really annoying thing is that it does _not_ need any special
implementation. Use it with force=TRUE, and it works just fine in
RKWard. But without force, it simply gives up without even trying.

Regards
Thomas


pgpotgAEYciRI.pgp
Description: OpenPGP digital signature


Re: Progress package

2018-11-02 Thread Thomas Friedrichsmeier
Hi,

On Fri, 02 Nov 2018 21:26:57 +0100
Pierre de Villemereuil  wrote:
> Is there any reason why the "progress" package doesn't display
> progress bars in RKWard?

I have not quite figured out the details, but essentially: It doesn't
want to display the bar, because it thinks it's not supported, for
some reason.

> Anything I need to do to make RKWard work nicely with "progress"?
> Would be sad that a GUI cannot display a progress bar where the CLI
> can! ;)

Try
  pb <- progress_bar$new(total = 100, force=TRUE)
  # ...
  f ()

This may be something to raise with the maintainers of progress.
Although, again, I have not fully understood the details of _why_ the
package believes it cannot display a progress bar in RKWard, yet.

Regards
Thomas


pgpnXOax3gTDl.pgp
Description: OpenPGP digital signature


Progress package

2018-11-02 Thread Pierre de Villemereuil
Hi,

Is there any reason why the "progress" package doesn't display progress bars in 
RKWard?

E.g. this code:

library(progress)

pb <- progress_bar$new(total = 100)
f <- function() {
pb$tick(0)
Sys.sleep(3)
for (i in 1:100) {
pb$tick()
Sys.sleep(1 / 100)
}
}
f()

should display a progress bar (which then disappears in R console), but 
doesn't. I've also tried for (my initial) slower code and still nothing appear 
while the progress bar is there for the ~40 minutes of computation in R console.

Anything I need to do to make RKWard work nicely with "progress"? Would be sad 
that a GUI cannot display a progress bar where the CLI can! ;)

Cheers,
Pierre.