Re: Proper way to set up constants when building an iOS framework

2016-04-16 Thread Uli Kusterer
On 12 Apr 2016, at 19:30, Alex Zavatone wrote: > On Apr 12, 2016, at 12:43 PM, Charles Jenkins wrote: > >> I imagine you’re already doing this, but your message wasn’t clear, so >> forgive me if I sound patronizing. >> >> The constants should be declared extern in the header file, but not assig

Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs
I have a daemon process that needs to generate a series of sequenced files (named sequentially, such as "file_01944576_1.dat", "file_01944576_2.dat", etc.) in the same directory. Does Cocoa provide a way to do this? NSFileManager's -createFileAtPath:contents:attributes: method states: "If a fil

Re: Creating a series of sequenced files

2016-04-16 Thread Alex Zavatone
The easy route is to use the file manager to see if the filename exists, then use NSString to separate the file name from the file extension, then use a string method creating an NSArray from the file name with items separated by the underscore, then take the last item in the array as an NSUinte

Re: Creating a series of sequenced files

2016-04-16 Thread Quincey Morris
On Apr 16, 2016, at 14:36 , Carl Hoefs wrote: > > I have a daemon process that needs to generate a series of sequenced files > (named sequentially, such as "file_01944576_1.dat", "file_01944576_2.dat", > etc.) in the same directory. Does Cocoa provide a way to do this? Not that I know of. But

Re: Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs
> Not that I know of. But surely it’s only 2 lines of code, apart from error > checking and recovery? I'd love to see those 2 lines of code! :-) But I'm concerned mainly with efficiency, as determining the next number in the naming sequence potentially can be extremely inefficient - trying 100

Re: Creating a series of sequenced files

2016-04-16 Thread Quincey Morris
On Apr 16, 2016, at 14:36 , Carl Hoefs wrote: > > I have a daemon process that needs to generate a series of sequenced files Oh, sorry, I think I misunderstood the question. I thought you wanted to generate all the files at once. Alex’s interpretation sounds more plausible. If you’re looking t

Re: Creating a series of sequenced files

2016-04-16 Thread Quincey Morris
On Apr 16, 2016, at 15:10 , Carl Hoefs wrote: > > But I'm concerned mainly with efficiency, as determining the next number in > the naming sequence potentially can be extremely inefficient - trying 1000s > of times until the next available number every time a new file needs to be > written, an

Re: Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs
> On Apr 16, 2016, at 3:20 PM, Quincey Morris > wrote: > > On Apr 16, 2016, at 15:10 , Carl Hoefs > wrote: >> >> But I'm concerned mainly with efficiency, as determining the next number in >> the naming sequence potentially can be extremely inefficient

Re: Creating a series of sequenced files

2016-04-16 Thread Quincey Morris
On Apr 16, 2016, at 15:29 , Carl Hoefs wrote: > > I have potentially n different ongoing sequences, so it seems like this > approach could end up hitting the filesystem really hard One enumeration per candidate directory shouldn’t be inefficient. That’s the order of magnitude of what the Find

SASL on OS X

2016-04-16 Thread Daryle Walker
I found out that SASL, through the CMU Cyrus library, is on OS X. Is there a high-level API, like the Keychain, that wraps it? Or do I have to use the UNIX-level functions to use SASL in my Cocoa apps? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com __

Re: Creating a series of sequenced files

2016-04-16 Thread Jens Alfke
> On Apr 16, 2016, at 2:56 PM, Alex Zavatone wrote: > > The easy route is to use the file manager to see if the filename exists, then > […] keep doing that until it finds a file that hasn’t yet been created and > then write the file. This is generally considered a bad approach, because it’s s

Can a table insert be implemented with an exclusive "addition row"?

2016-04-16 Thread Daryle Walker
I haven’t done this; I’m just wondering if it’s possible. Imagine a NSTableView with an extra row at the bottom. (If there are no records, the extra row would be the table’s sole row.) One of the columns has a grey-out string of “Add new name…” or something similar. If the user confirms new

Asynchronous compatibility of NSDocument read/write methods

2016-04-16 Thread Daryle Walker
The NSDocument class has some core methods for you to override to read and write data from/to disk. Are those called from the main thread? If so, can you defer the actual work to an NSOperation or something? If you do so, what is your GUI supposed to do/show? Or will the window not be shown

Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?

2016-04-16 Thread Daryle Walker
If the given method is used to read in a pure ASCII file, will the encoding be set to ASCII? Or could the method return a superset encoding (like Latin-1, MacRoman, or UTF-8)? — Daryle Walker Mac, Internet, and Video Game Junkie darylew AT mac DOT com

Re: Does NSString's "- initWithContentsOfURL:usedEncoding:error:" use the tightest encoding possible?

2016-04-16 Thread Jens Alfke
> On Apr 16, 2016, at 7:35 PM, Daryle Walker wrote: > > If the given method is used to read in a pure ASCII file, will the encoding > be set to ASCII? Or could the method return a superset encoding (like > Latin-1, MacRoman, or UTF-8)? I don’t know; you could try it out, of course, but it so