Re: Persistent User Defaults

2018-04-30 Thread 2551phil
Agreed. Only one thing that I didn’t see mentioned yet is that when using 
defaults delete the targeted app should not be running.

> On 30 Apr 2018, at 21:43, Jeremy Hughes <moon.rab...@virginmedia.com> wrote:
> 
> Killing cfprefsd seems unnecessarily drastic. Why not use:
> 
> defaults delete 
> 
> as Gary Wade mentioned earlier?
> 
>  is a reverse-dns string such as “com.company.appname”
> 
> —
> 
>> On 30 Apr 2018, at 15:31, Alex Zavatone <z...@mac.com> wrote:
>> 
>> Is it worth it (or wise) to zero out preferences and write them prior to 
>> performing a kill?
>> 
>>> On Apr 30, 2018, at 4:52 AM, Nathan Day <nathan_...@mac.com> wrote:
>>> 
>>> Thats not completely correct modifying the preferences file directly or 
>>> deleting it can take a while for the user defaults process to pick up the 
>>> change, but you can force the user defaults process to pick up the changes 
>>> with
>>> 
>>> killall cfprefsd
>>> 
>>> it can be a little bit complicated sometimes and the process can write out 
>>> changes before you kill it, so sometime you have to kill make you change 
>>> and then kill again.
>>> 
>>> 
>>> 
>>>> On 25 Apr 2018, at 3:42 am, Richard Charles <rcharles...@gmail.com> wrote:
>>>> 
>>>> On macOS an applications user defaults are stored in a preference plist 
>>>> file located in ~/Library/Preferences.
>>>> 
>>>> If this file is deleted, user preferences for the application still 
>>>> persist until the machine is rebooted. In other words if you want to start 
>>>> with a clean set of user preferences not only must you delete the 
>>>> preference plist file but you must also restart the machine.
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>> 
>>> This email sent to z...@mac.com
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/moon.rabbit%40virginmedia.com
>> 
>> This email sent to moon.rab...@virginmedia.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/2551phil%40gmail.com
> 
> This email sent to 2551p...@gmail.com

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


last, getutxent & friends

2017-01-21 Thread 2551phil
Apologies in advance as this is only indirectly a Cocoa question (in that I’m 
trying to incorporate this data into my Cocoa app). Suggestions for a more 
suitable home for this question are welcome.

My app needs to display the login and logout times of all users on the mac (for 
macos 10.10 onwards). I’ve been playing with last and getutxent(), but I’m 
finding them very unreliable. last appears to roll over a new wtmp file quite 
at random, and often just as soon as I call it (via NSTask), giving me no info 
at all.

getutxent() doesn’t seem to record the last logout time of the current user at 
all. When I log out of my current session and call getutxent() after logging in 
again, I don’t get the last logout time (I also tried lastlogx, but that just 
kept returning NULL).

Here’s what I’m using for getutxent():

struct utmpx *bp;
time_t time;
setutxent_wtmp(0); 
while ((bp = getutxent()) != NULL)
{
time = (time_t) bp->ut_tv.tv_sec;

switch (bp->ut_type)
{

case USER_PROCESS:
NSLog(@“\nUSER_PROCESS (login): %s\t%s\t%d\t%hd\t%s\t%s\t%s\t\n", bp->ut_user, 
bp->ut_id, bp->ut_pid, bp->ut_type, ctime(), bp->ut_host, bp->ut_line);
 

break;

case DEAD_PROCESS:
NSLog(@“\nDEAD_PROCESS (logout): 
%s\t%s\t%d\t%hd\t%s\t%s\t%s\t\n", bp-
>ut_user, bp->ut_id, bp->ut_pid, bp->ut_type, ctime(), 
bp->ut_host, bp->ut_line);

break;

  case LOGIN_PROCESS:
NSLog(@“\nLOGIN_PROCESS (?):  
%s\t%s\t%d\t%hd\t%s\t%s\t%s\t\n", bp->ut_user, 
bp->ut_id, bp->ut_pid, bp->ut_type, ctime(), 
bp->ut_host, bp->ut_line);

break;

default:
   break;

}
}

endutxent();


Does anyone know of a reliable way to get users' last logout times?


TIA


Phil


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Purge all remnants of an old incarnation of my app

2017-01-19 Thread 2551phil
Normally, I just do 

defaults delete  

on the command line and that takes care of it. Issuing 

defaults domains

will give you a (comma-separated) print out of all the defaults domains on your 
mac.



Best


Phil


> On 20 Jan 2017, at 03:49, Daryle Walker  wrote:
> 
> I posted this on the Xcode list, but one of the respondents suggested adding 
> it here too….
> 
>> On Jan 15, 2017, at 8:11 PM, Daryle Walker  wrote:
>> 
>> I threw away an app I made in Xcode 7, including clearing its Git space and 
>> replacing it with an empty branch. I created a new app with Xcode 8. 
>> However, I used the same bundle ID for the two apps. When I first ran the 
>> new app, I saw preference mismatch errors. I realized that, since I used the 
>> same ID for both apps, the new app was looking at the old app’s data. I 
>> deleted the preference file and the Xcode derived data folder. But even now, 
>> the new app’s open-recent list has a file I opened in the old app.
>> 
>> I’m asking: where are all the locations used by both Xcode and the system 
>> that automatically leave bundle-ID-marked files after compiling and running?
> 
> — 
> Daryle Walker
> Mac, Internet, and Video Game Junkie
> darylew AT mac DOT com 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/sqwarqdev%40icloud.com
> 
> This email sent to sqwarq...@icloud.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Swift: Draw a circle with tic marks at it's edge?

2017-01-18 Thread 2551phil

> On 19 Jan 2017, at 03:34, Eric E. Dolecki  wrote:
> 
> I tried
> UIBezierPaths and my code only produced a black background

“There’s an app for that” - have a look at PaintCode. 

https://www.paintcodeapp.com



Best


Phil
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Documentation Workflow

2016-12-02 Thread 2551phil

> On 2 Dec 2016, at 23:25, Richard Charles  wrote:
> 
> Somebody needs to start an online repository of older Apple developer 
> documentation in pdf format.

I did do exactly that for the legacy AppleScript stuff[1] when it started 
disappearing, but it’d be a bit of a mammoth task to do the same for the whole 
of the Cocoa APIs. The best alternative I found once Apple removed the PDFs was 
to use Dash[2]. 

[1]. https://applescriptlibrary.wordpress.com
[2]. https://kapeli.com/dash



Best


Phil
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com