John,

I apologize for suggesting to you to do extra work. As I said, I'll do some more testing. The thing that threw me off was that this is an addition to an existing API (NSProcessInfo) and hence I assumed it was all runtime ...

Regards,
Rob J. Goedman
goedman@icloud.com




On Nov 28, 2013, at 6:45 AM, John Fox <jfox@mcmaster.ca> wrote:

> Dear Rob and Peter,
> 
> Thanks for the latest clarifications.
> 
> I think that I'll modify the Rmcdr installation notes to suggest either using the Rcmdr from R in a terminal window or setting the NSAppSleepDisabled key permanently in a terminal window -- and hope that in the longer term the problem is solved generally for R.app.
> 
> Best,
> John
> 
> On Thu, 28 Nov 2013 06:35:12 -0800
> Robert J Goedman <goedman@icloud.com> wrote:
>> Hi, and Happy Thanksgiving for those that celebrate it!
>> 
>> If Peter is right (and I expect he is, but will experiment a bit more if the setting can be updated while R.app is running and take effect immediately), I would suggest for now folks just use 'defaults ...' from a terminal window if they encounter these issues.
>> 
>> Once we understand better what might be affected by allowing the sleep mode we can possibly refine that approach.
>> 
>> Regards,
>> Rob
>> 
>> 
>> Sent from Rob Goedman's iPad ...
>> 
>> 
>>> On Nov 28, 2013, at 6:21, peter dalgaard <pdalgd@gmail.com> wrote:
>>> 
>>> 
>>>> On 28 Nov 2013, at 14:38 , John Fox <jfox@mcmaster.ca> wrote:
>>>> 
>>>> Dear Peter,
>>>> 
>>>> On Thu, 28 Nov 2013 12:00:31 +0100
>>>> peter dalgaard <pdalgd@gmail.com> wrote:
>>>>> 
>>>>>> On 28 Nov 2013, at 01:46 , John Fox <jfox@mcmaster.ca> wrote:
>>>>>> 
>>>>>> Hi Rob,
>>>>>> 
>>>>>> I had some time today and so I started to implement this solution in the
>>>>>> Rcmdr. I first tested whether setting
>>>>>> 
>>>>>> system("defaults write org.R-project.R NSAppSleepDisabled -bool yes")
>>>>>> 
>>>>>> fixes the problem; I verified via 
>>>>>> 
>>>>>> system("defaults read org.R-project.R NSAppSleepDisabled")
>>>>>> 
>>>>>> that the key was in fact set properly. 
>>>>>> 
>>>>>> I'm afraid that even with NSAppSleepDisabled set, the Rcmdr still freezes
>>>>>> periodically. Whatever is going on is probably more complicated than
>>>>>> power-saving.
>>>>>> 
>>>>> 
>>>>> Hmm. The tkfaq issue seems to have gone away for me. You did remember to restart R.app after setting the key?
>>>>> 
>>>> 
>>>> I didn't "remember" to restart R.app because I didn't know that it was necessary to do so. In fact, the code that I wrote, but didn't commit, for the Rcmdr carefully resets the key to its previous state or deletes it if it didn't previously exist when the Commander is closed.
>>>> 
>>>> I think that you've almost surely identified my problem, but the solution also raises a question about what to do. I'm reluctant to have the Rcmdr make a permanent change to users' OS settings. I guess that I could detect whether the NSAppSleepDisabled key is set and pop up a dialog box if it isn't, offering to make the change, and suggesting that the user restart R.app. (BTW, is there an easy way to check whether R is running in R.app or a terminal?) Wouldn't it be better to handle this issue in R.app or even in tcltk, however?
>>> 
>>> I suspect that this particular option also affects people running simulations from R.app, so that the natural state really should be "disabled" and you need not have qualms about tampering with it. Presumably, we could do the disabling on install. If people have strong reasons to aggressively preserve battery power, they could just turn it back on. 
>>> 
>>> I think Rob put on his todo list to figure out whether/how you change the setting in an active process, which would open up other possibilities.
>>> 
>>> -pd 
>>> 
>>>> 
>>>> If restarting R.app after setting the NSAppSleepDisabled key doesn't work for me, I'll then pursue Rob's suggestions.
>>>> 
>>>> Thanks for this,
>>>> John
>>> -- 
>>> Peter Dalgaard, Professor
>>> Center for Statistics, Copenhagen Business School
>>> Solbjerg Plads 3, 2000 Frederiksberg, Denmark
>>> Phone: (+45)38153501
>>> Email: pd.mes@cbs.dk  Priv: PDalgd@gmail.com
>>> 
> 
> ------------------------------------------------
> John Fox
> McMaster University
> Hamilton, Ontario, Canada
> http://socserv.mcmaster.ca/jfox/


	[[alternative HTML version deleted]]

