Re: Defer opening documents until app is fully inited

2014-09-20 Thread Jerry Krinock



On 2014 Sep 19, at 09:12, Mills, Steve  wrote:

> Our app init (called from applicationWillFinishLaunching) needs to put up 
> some modal dialogs.

I’m surprised that works.  I think I was in a similar situation about 4 years 
ago.

http://www.cocoabuilder.com/archive/cocoa/293279-very-simple-demo-modal-dialog-causes-later-modal-session-to-crash.html?q=applicationWillFinishLaunching+Krinock#293279

Or if Bertrand’s site ever goes away,

http://lists.apple.com/archives/Cocoa-dev/2010/Sep/msg00448.html

> When one of these modals is dismissed, NSApplication proceeds to call 
> application:openFiles:, but we haven't returned from 
> applicationWillFinishLaunching yet, so we're not ready. I'm sure others have 
> needed to work around this. What's the best way?

To summarize, what worked for me is to

• Create my dialogs or whatever in an doEarlyChores method.
• Override -application:openFile: to invoke the doEarlyChores method and return 
NO.
• Also invoke the doEarlyChores method early in -applicationDidFinishLaunching.
• Put a lockout in doEarlyChores so it will only do its chores once.


On 2014 Sep 19, at 10:42, Mills, Steve  wrote:

> And we're too late in the cycle now to make such a radical change.

Life is hard, Steve.  That reminds of what a wise manager told our team at 
times of crisis: “There’s never enough time to do it right [the first time], 
but there will be always enough time to do it over [when the product fails in 
the field].” :))


___

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

return string that is the difference between two other strings

2014-09-20 Thread 2551
I've searched high and low (or roundabouts in circles) for a built in method 
that will return the difference between two strings as a string. 

I hacked up this solution below, but it feels cludgy and isn't very robust 
(punctuation will mess it up a little); worse, I can't help feeling I must be 
reinventing the wheel. Finding the string that is the difference between two 
other strings must be a basic need. How do you guys do this? 



-(NSString *)getDifference: (NSString *)aString and:(NSString *)anotherString {
int i = aString.length;
int j = anotherString.length;
NSString *result, *longest, *shortest;

if (i == j) {
result = @"";
return result;
}

if (i > j) {
longest = aString;
shortest = anotherString;
} else {
longest = anotherString;
shortest = aString;
}

NSArray *fa = [longest componentsSeparatedByString: @" " ];
NSArray *sa = [shortest componentsSeparatedByString: @" "];
NSMutableArray *remainder = [NSMutableArray arrayWithArray:fa];
[remainder removeObjectsInArray:sa];
result = [remainder componentsJoinedByString:@" "];
return result;

}



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread SevenBits
On Sep 20, 2014, at 1:01 PM, 2551 <2551p...@gmail.com> wrote:

> I've searched high and low (or roundabouts in circles) for a built in method 
> that will return the difference between two strings as a string. 
> 
> I hacked up this solution below, but it feels cludgy and isn't very robust 
> (punctuation will mess it up a little); worse, I can't help feeling I must be 
> reinventing the wheel. Finding the string that is the difference between two 
> other strings must be a basic need. How do you guys do this? 

Define what you mean the “difference between two strings”.

> 
> 
> 
> -(NSString *)getDifference: (NSString *)aString and:(NSString *)anotherString 
> {
>int i = aString.length;
>int j = anotherString.length;
>NSString *result, *longest, *shortest;
> 
>if (i == j) {
>result = @"";
>return result;
>}
> 
>if (i > j) {
>longest = aString;
>shortest = anotherString;
>} else {
>longest = anotherString;
>shortest = aString;
>}
> 
>NSArray *fa = [longest componentsSeparatedByString: @" " ];
>NSArray *sa = [shortest componentsSeparatedByString: @" "];
>NSMutableArray *remainder = [NSMutableArray arrayWithArray:fa];
>[remainder removeObjectsInArray:sa];
>result = [remainder componentsJoinedByString:@" "];
>return result;
> 
> }
> 
> ___
> 
> 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/sevenbitstech%40gmail.com
> 
> This email sent to sevenbitst...@gmail.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
Really? OK.
On 21 Sep 2014, at 00:05, SevenBits  wrote:

> On Sep 20, 2014, at 1:01 PM, 2551 <2551p...@gmail.com> wrote:
> 
>> I've searched high and low (or roundabouts in circles) for a built in method 
>> that will return the difference between two strings as a string. 
>> 
>> I hacked up this solution below, but it feels cludgy and isn't very robust 
>> (punctuation will mess it up a little); worse, I can't help feeling I must 
>> be reinventing the wheel. Finding the string that is the difference between 
>> two other strings must be a basic need. How do you guys do this? 
> 
> Define what you mean the “difference between two strings”.

 
For example:

   NSString *mary = @"mary had a little lamb, a little lamb she had";
NSString *scary = @"mary had a little lamb, a little naughty fella of a 
lamb she had for sure";
NSString *isDifferent = [self getDifference:mary and: scary];
NSLog(@"%@", isDifferent);

The method I posted below produces the difference that I want ("naughty fella 
of a for sure"). But I want to know if there's a more orthodox and robust 
solution. 




> 
>> 
>> 
>> 
>> -(NSString *)getDifference: (NSString *)aString and:(NSString 
>> *)anotherString {
>>   int i = aString.length;
>>   int j = anotherString.length;
>>   NSString *result, *longest, *shortest;
>> 
>>   if (i == j) {
>>   result = @"";
>>   return result;
>>   }
>> 
>>   if (i > j) {
>>   longest = aString;
>>   shortest = anotherString;
>>   } else {
>>   longest = anotherString;
>>   shortest = aString;
>>   }
>> 
>>   NSArray *fa = [longest componentsSeparatedByString: @" " ];
>>   NSArray *sa = [shortest componentsSeparatedByString: @" "];
>>   NSMutableArray *remainder = [NSMutableArray arrayWithArray:fa];
>>   [remainder removeObjectsInArray:sa];
>>   result = [remainder componentsJoinedByString:@" "];
>>   return result;
>> 
>> }
>> 
>> ___
>> 
>> 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/sevenbitstech%40gmail.com
>> 
>> This email sent to sevenbitst...@gmail.com
> 



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread Keary Suska
On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:

> For example:
> 
>   NSString *mary = @"mary had a little lamb, a little lamb she had";
>NSString *scary = @"mary had a little lamb, a little naughty fella of a 
> lamb she had for sure";
>NSString *isDifferent = [self getDifference:mary and: scary];
>NSLog(@"%@", isDifferent);
> 
> The method I posted below produces the difference that I want ("naughty fella 
> of a for sure"). But I want to know if there's a more orthodox and robust 
> solution. 
>>> 

I would use an NSOrderedSet and NSCharacterSet for robustness, e.g.:

NSMutableCharacterSet *separatorSet = [NSMutableCharacterSet 
punctuationCharacterSet];
[separatorSet formUnionWithCharacterSet:[NSCharacterSet 
whitespaceAndNewlineCharacterSet]];
NSMutableOrderedSet *maryWords = [NSMutableOrderedSet orderedSetWithArray:[mary 
componentsSeparatedByCharactersInSet:separatorSet]];
NSMutableOrderedSet *scaryWords = [NSMutableOrderedSet 
orderedSetWithArray:[scary componentsSeparatedByCharactersInSet:separatorSet]];
BOOL maryLonger = [maryWords count] > [scaryWords count];
[(maryLonger ? maryWords : scaryWords) minusOrderedSet:(maryLonger ? scaryWords 
: maryWords)];
NSLog(@"%@", (maryLonger ? maryWords : scaryWords));

Though this wouldn't account for order or duplicates, but neither would your 
implementation.

>> 
>>> -(NSString *)getDifference: (NSString *)aString and:(NSString 
>>> *)anotherString {
>>>  int i = aString.length;
>>>  int j = anotherString.length;
>>>  NSString *result, *longest, *shortest;
>>> 
>>>  if (i == j) {
>>>  result = @"";
>>>  return result;
>>>  }
>>> 
>>>  if (i > j) {
>>>  longest = aString;
>>>  shortest = anotherString;
>>>  } else {
>>>  longest = anotherString;
>>>  shortest = aString;
>>>  }
>>> 
>>>  NSArray *fa = [longest componentsSeparatedByString: @" " ];
>>>  NSArray *sa = [shortest componentsSeparatedByString: @" "];
>>>  NSMutableArray *remainder = [NSMutableArray arrayWithArray:fa];
>>>  [remainder removeObjectsInArray:sa];
>>>  result = [remainder componentsJoinedByString:@" "];
>>>  return result;
>>> 
>>> }


Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"


___

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: return string that is the difference between two other strings

2014-09-20 Thread Scott Ribe
On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:

> For example:
> 
>   NSString *mary = @"mary had a little lamb, a little lamb she had";
>NSString *scary = @"mary had a little lamb, a little naughty fella of a 
> lamb she had for sure";
>NSString *isDifferent = [self getDifference:mary and: scary];
>NSLog(@"%@", isDifferent);
> 
> The method I posted below produces the difference that I want ("naughty fella 
> of a for sure"). But I want to know if there's a more orthodox and robust 
> solution. 

That's not even remotely close to a definition of what you mean. What about:

@"mary had a little lamb, a little naughty lamb she had"

vs

@"mary had a little lamb, a little fella of a lamb she had for sure"

?

Or:

@"mary had a little lamb, a naughty little lamb she had"

vs

@"mary had a big lamb, a little fella of a lamb she had for sure"

There is no simple definition of "the difference between two strings", and I 
don't think it's a basic need at all.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice





___

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: return string that is the difference between two other strings

2014-09-20 Thread Jens Alfke

> On Sep 20, 2014, at 10:43 AM, Scott Ribe  wrote:
> 
> There is no simple definition of "the difference between two strings", and I 
> don't think it's a basic need at all.

Usually when programmers talk about "differences" they're referring to 
something like what a 'diff' tool produces, which is basically a description 
showing the insertions/deletions that have to be made to the first string to 
produce the second. This is a very useful type of algorithm that's used a lot 
in version-control systems, especially because you can later apply the diff 
output to the first string and reconstruct the second.

Diff algorithms are fairly complex, though, and the details depend a lot on 
what the granularity of the insertions/deletions is — the usual diff tools 
consider lines of text as units, but there are "binary delta" algorithms whose 
units are individual bytes and that will operate on arbitrary data.

I'm still not clear what exactly the OP is asking for. It looks like maybe just 
a set of the words that are in the second string but not in the first? Keary's 
solution works well for that.

—Jens
___

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: return string that is the difference between two other strings

2014-09-20 Thread SevenBits
On Sep 20, 2014, at 1:43 PM, Scott Ribe  wrote:

> On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:
> 
>> For example:
>> 
>>  NSString *mary = @"mary had a little lamb, a little lamb she had";
>>   NSString *scary = @"mary had a little lamb, a little naughty fella of a 
>> lamb she had for sure";
>>   NSString *isDifferent = [self getDifference:mary and: scary];
>>   NSLog(@"%@", isDifferent);
>> 
>> The method I posted below produces the difference that I want ("naughty 
>> fella of a for sure"). But I want to know if there's a more orthodox and 
>> robust solution. 
> 
> That's not even remotely close to a definition of what you mean. What about:
> 
> @"mary had a little lamb, a little naughty lamb she had"
> 
> vs
> 
> @"mary had a little lamb, a little fella of a lamb she had for sure"
> 
> ?
> 
> Or:
> 
> @"mary had a little lamb, a naughty little lamb she had"
> 
> vs
> 
> @"mary had a big lamb, a little fella of a lamb she had for sure"
> 
> There is no simple definition of "the difference between two strings", and I 
> don't think it's a basic need at all.

Exactly. While it may seem that it’s a simple question, we actually have no 
idea what you mean unless you tell us. 

> 
> -- 
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> 
> ___
> 
> 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/sevenbitstech%40gmail.com
> 
> This email sent to sevenbitst...@gmail.com



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
Definition:

On 21 Sep 2014, at 00:53, Jens Alfke  wrote:

> a set of the words that are in the second string but not in the first

That's close. Any words that are in one string but not in the other. Yup, that 
is what I'm after. 

I'll pass if people start asking me what I mean by a 'word', though I'm well 
aware that that is a genuine question at certain levels and across different 
localisations. Take it that for the purpose of the inquiry I mean any 
combination of letters in the standard English alphabet that is space 
delimited. Punctuation and diacriticals can be ignored for my current purposes.


signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread Kyle Sluder
On Sep 20, 2014, at 11:54 AM, 2551 <2551p...@gmail.com> wrote:
> 
> I'll pass if people start asking me what I mean by a 'word', though I'm well 
> aware that that is a genuine question at certain levels and across different 
> localisations. Take it that for the purpose of the inquiry I mean any 
> combination of letters in the standard English alphabet that is space 
> delimited. Punctuation and diacriticals can be ignored for my current 
> purposes.

Well luckily for you, there is a general-purpose word splitter in Core 
Foundation that works for many non-Latin languages as well: CFStringTokenizer.

--Kyle Sluder
___

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: return string that is the difference between two other strings

2014-09-20 Thread Gerd Knops
NSLinguisticTagger might be worth a look.

And if you don't care about word counts, NSMutableSet -minusSet: or 
-intersectSet: could be of help as well.

Gerd

> On Sep 20, 2014, at 1:54 PM, 2551 <2551p...@gmail.com> wrote:
> 
> Definition:
> 
> On 21 Sep 2014, at 00:53, Jens Alfke  wrote:
> 
>> a set of the words that are in the second string but not in the first
> 
> That's close. Any words that are in one string but not in the other. Yup, 
> that is what I'm after. 
> 
> I'll pass if people start asking me what I mean by a 'word', though I'm well 
> aware that that is a genuine question at certain levels and across different 
> localisations. Take it that for the purpose of the inquiry I mean any 
> combination of letters in the standard English alphabet that is space 
> delimited. Punctuation and diacriticals can be ignored for my current 
> purposes.
> ___
> 
> 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/gerti-cocoadev%40bitart.com
> 
> This email sent to gerti-cocoa...@bitart.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: MapKit location authorization

2014-09-20 Thread Roland King

> On 20 Sep 2014, at 12:08 pm, Gerriet M. Denkmann  wrote:
> 
> 
> On 20 Sep 2014, at 01:30, Rick Mann  wrote:
> 
>> 
>> On Sep 19, 2014, at 11:06 , John Tsombakos  wrote:
>> 
>>> You also need to add items to your Info.plist file:
>>> 
>>> NSLocationAlwaysUsageDescription
>>> 
>>> and/or
>>> 
>>> NSLocationWhenInUseUsageDescription
>> 
>> And to clarify, these are keys for a string value. That string value gets 
>> displayed as detail text in the authorization dialog. I just ran into all 
>> this myself yesterday, and it was not at all clear that this had to be done. 
>> I don't know why MKMapView can't handle all this on its own.
> 
> Very good advice! This was the magic thing I was missing.
> 
> I'm sure this is clearly documented somewhere (maybe at the local planning 
> department in Alpha Centauri).


Nope - it's documented on CLLocationManager in under the relevant methods, sort 
of exactly where you'd expect it to be really, assuming you found the iOS docs 
which is easier today than it was yesterday as they appear to show in Xcode now 
when you ask for them instead of requiring a web search .. here's one relevant 
part from requestAlwaysAuthorization

"..this method runs asynchronously and prompts the user to grant permission to 
the app to use location services. The user prompt contains the text from the 
NSLocationAlwaysUsageDescription key in your app’s Info.plist file, and the 
presence of that key is required when calling this method. "

"For more information about the NSLocationAlwaysUsageDescription key, see 
Information Property List Key Reference 
."

This stuff used to be optional, you could provide a helpful message saying why 
you wanted to use location data, but of course nobody did, so it was made 
mandatory in iOS8 as part of the whole transparency about what apps are doing 
drive. I guess there are lots of reasons why it can't just throw an exception 
telling the developer to add the key, but I wish mandatory things like this 
would do that instead of silently swallowing the calls, or return a suitable 
error code. 

___

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

Question on OS X app submission

2014-09-20 Thread Jim Geist
Hi all -

I’ve submitted iOS apps before, working on my first desktop app. My app runs as 
a status area icon, so I have a helper launcher app that takes care of 
launching at login.

Do I need to do anything special with the bundle ID of the helper app with 
regards to the submission portal? Or is it enough to just have the binary be at 
the proper place in the bundle, and to submit with the bundle ID of the main 
app?

Thanks!!



___

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: Question on OS X app submission

2014-09-20 Thread Graham Cox

On 21 Sep 2014, at 10:12 am, Jim Geist  wrote:

>  My app runs as a status area icon, so I have a helper launcher app that 
> takes care of launching at login


I'm not sure if things have changed, but this type of app isn't permitted on 
the App Store.

--Graham
___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
On 21 Sep 2014, at 02:56, Ludovic Nicolle  wrote:

> Once we (and maybe yourself? :p ) know what you truly want

OK, I should have presented the problem, rather than a solution that needed 
improving. If you have two text files written out at different times, how do 
you guys determine the difference between their contents to produce a third 
file stating the changes? (You can assume they are plain text and contain 
nothing other than the traditional ASCII 128 character set). That's all I'm 
trying to achieve. 

For my use case, order can be ingored, but case sensitive differences and 
repeats must be counted as unique instances. 

Thus, if 

String A =  @"Happy Birthday to You Happy Birthday to You Happy Birthday Dear 
Mary";
//Happy = 3, Birthday = 3, to = 2, You  = 2, Dear = 1, Mary = 1
 
String B = @"Happy Birthday Dear Mary and you too Scary";
//Happy = 1, Birthday = 1, Dear = 1; Mary = 1, and = 1, you = 1, too = 1, Scary 
= 1

The result should be the subtraction of the word counts, returning:

result = @"Happy Birthday to You Happy Birthday to You and you too Scary; 
//Happy = 2, Birthday = 2, to =2, You = 2, and = 1, you =1, too =1, Scary = 1
 
Just to sum up, the suggestions I've had so far are to look at

CFStringTokenizer (Thanks, Kyle)
NSLinguisticTagger (Thanks, Gerd)

and

NSMutableSet -minusSet: or -intersectSet (Gerd, again). 

I did look at -minusSet before setting out to reinvent the wheel (rather 
squarely) using a convoluted implementation of NSArray's removeObject. but I 
overlooked -intersectSet. I'll look again.


Thanks for the help so far.

Best



signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: Question on OS X app submission

2014-09-20 Thread Jim Geist
From the app store guidelines, 2.26. My app does allow the user to set this in 
the preferences pane. Or is it the status area aspect you think will get me 
rejected?

I guess all I can do is submit it and see what happens.

Apps that are set to auto-launch or to have other code automatically run at 
startup or login without user consent will be rejected



> On Sep 20, 2014, at 7:34 PM, Graham Cox  wrote:
> 
> 
> On 21 Sep 2014, at 10:12 am, Jim Geist  wrote:
> 
>> My app runs as a status area icon, so I have a helper launcher app that 
>> takes care of launching at login
> 
> 
> I'm not sure if things have changed, but this type of app isn't permitted on 
> the App Store.
> 
> --Graham

___

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: return string that is the difference between two other strings

2014-09-20 Thread Jens Alfke

> On Sep 20, 2014, at 7:54 PM, 2551 <2551p...@gmail.com> wrote:
> 
> OK, I should have presented the problem, rather than a solution that needed 
> improving. If you have two text files written out at different times, how do 
> you guys determine the difference between their contents to produce a third 
> file stating the changes?

See what I wrote earlier about diff algorithms. (To see them in action, use the 
'diff' command in your favorite version control tool, like git or svn.) 
However, these tend to be either line- or byte-oriented; I'm not sure what 
there is that operates on word boundaries.

The thing you're looking for doesn't seem very useful, to be honest. If I want 
to know the difference between two versions of something, I don't think I'd 
find a randomly-ordered pile of words useful. What I'd want is something that 
shows the combined text with the deleted words crossed out and the new words 
highlighted. That's basically a diff. The implementation is completely 
different from what you're doing, because order matters; it has to scan both 
arrays of words in parallel and notice the changes (and beyond that, I don't 
know any further details. I'm sure it's covered in textbooks.)

—Jens
___

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: Question on OS X app submission

2014-09-20 Thread Jens Alfke

> On Sep 20, 2014, at 8:53 PM, Jim Geist  wrote:
> 
> Or is it the status area aspect you think will get me rejected?

What's the "status area" — the menu bar? Any app can show an icon/menu in the 
menu bar using NSStatusItem. Fantastical is a good example, and it's in the App 
Store.

—Jens
___

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: Question on OS X app submission

2014-09-20 Thread Jim Geist
Yes, and that’s what I thought.

Any idea on my original question, though? If I have a helper app embedded in my 
bundle, with a bundle ID of its own, does the app store need to know about that 
bundle ID, or just the main one?

Thanks!!

> On Sep 20, 2014, at 9:02 PM, Jens Alfke  wrote:
> 
> 
>> On Sep 20, 2014, at 8:53 PM, Jim Geist > > wrote:
>> 
>> Or is it the status area aspect you think will get me rejected?
> 
> What's the "status area" — the menu bar? Any app can show an icon/menu in the 
> menu bar using NSStatusItem. Fantastical is a good example, and it's in the 
> App Store.
> 
> —Jens

___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
On 21 Sep 2014, at 10:58, Jens Alfke  wrote:

> What I'd want is something that shows the combined text with the deleted 
> words crossed out and the new words highlighted.

Thanks, Jens. You've hit the nail on the head. That's exactly what I want to 
achieve. I said order didn't matter because I figured that was a problem to 
sort out once I'd got the differences. 

As I've been saying all along, this is such a common operation, I'd have 
thought there must be a common cocoa method or API for doing it. So the 
question is, can anyone tell me what that is?




signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread Kyle Sluder
On Sep 20, 2014, at 9:08 PM, 2551 <2551p...@gmail.com> wrote:
> 
> As I've been saying all along, this is such a common operation, I'd have 
> thought there must be a common cocoa method or API for doing it. So the 
> question is, can anyone tell me what that is?

No, it is nowhere near a common operation to perform on strings. It’s common 
for *programmers* to perform on their source code.

--Kyle Sluder

___

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: return string that is the difference between two other strings

2014-09-20 Thread Diederik Meijer | Ten Horses
I do a lot of text data mining and need similar functions a lot. I would start 
on a word by word level, to have whatever it returns be more meaningfull

Verstuurd vanaf mijn iPhone

> Op 20 sep. 2014 om 19:43 heeft Scott Ribe  het 
> volgende geschreven:
> 
>> On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:
>> 
>> For example:
>> 
>>  NSString *mary = @"mary had a little lamb, a little lamb she had";
>>   NSString *scary = @"mary had a little lamb, a little naughty fella of a 
>> lamb she had for sure";
>>   NSString *isDifferent = [self getDifference:mary and: scary];
>>   NSLog(@"%@", isDifferent);
>> 
>> The method I posted below produces the difference that I want ("naughty 
>> fella of a for sure"). But I want to know if there's a more orthodox and 
>> robust solution.
> 
> That's not even remotely close to a definition of what you mean. What about:
> 
> @"mary had a little lamb, a little naughty lamb she had"
> 
> vs
> 
> @"mary had a little lamb, a little fella of a lamb she had for sure"
> 
> ?
> 
> Or:
> 
> @"mary had a little lamb, a naughty little lamb she had"
> 
> vs
> 
> @"mary had a big lamb, a little fella of a lamb she had for sure"
> 
> There is no simple definition of "the difference between two strings", and I 
> don't think it's a basic need at all.
> 
> -- 
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> 
> ___
> 
> 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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.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: return string that is the difference between two other strings

2014-09-20 Thread Diederik Meijer | Ten Horses
Meaning I would compare words and their index in an array of words created from 
the two strings. The first mismatch is easily found, but the tricky part is 
finding the last one. Here a context driven comparison may help. Instead of 
comparing word N in both strings, you compare words N and N-1, taking into 
consideration the number of extra words found in previous iterations. I have 
not tested this specific case, but can tell you context driven may help. All 
depends on whether you need the actual difference returned. If not, life is 
easy :-)

Verstuurd vanaf mijn iPhone

> Op 21 sep. 2014 om 08:24 heeft Diederik Meijer | Ten Horses 
>  het volgende geschreven:
> 
> I do a lot of text data mining and need similar functions a lot. I would 
> start on a word by word level, to have whatever it returns be more meaningfull
> 
> Verstuurd vanaf mijn iPhone
> 
>>> Op 20 sep. 2014 om 19:43 heeft Scott Ribe  het 
>>> volgende geschreven:
>>> 
>>> On Sep 20, 2014, at 11:13 AM, 2551 <2551p...@gmail.com> wrote:
>>> 
>>> For example:
>>> 
>>> NSString *mary = @"mary had a little lamb, a little lamb she had";
>>>  NSString *scary = @"mary had a little lamb, a little naughty fella of a 
>>> lamb she had for sure";
>>>  NSString *isDifferent = [self getDifference:mary and: scary];
>>>  NSLog(@"%@", isDifferent);
>>> 
>>> The method I posted below produces the difference that I want ("naughty 
>>> fella of a for sure"). But I want to know if there's a more orthodox and 
>>> robust solution.
>> 
>> That's not even remotely close to a definition of what you mean. What about:
>> 
>> @"mary had a little lamb, a little naughty lamb she had"
>> 
>> vs
>> 
>> @"mary had a little lamb, a little fella of a lamb she had for sure"
>> 
>> ?
>> 
>> Or:
>> 
>> @"mary had a little lamb, a naughty little lamb she had"
>> 
>> vs
>> 
>> @"mary had a big lamb, a little fella of a lamb she had for sure"
>> 
>> There is no simple definition of "the difference between two strings", and I 
>> don't think it's a basic need at all.
>> 
>> -- 
>> Scott Ribe
>> scott_r...@elevated-dev.com
>> http://www.elevated-dev.com/
>> (303) 722-0567 voice
>> 
>> 
>> 
>> 
>> 
>> ___
>> 
>> 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/diederik%40tenhorses.com
>> 
>> This email sent to diede...@tenhorses.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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.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: return string that is the difference between two other strings

2014-09-20 Thread 2551

On 21 Sep 2014, at 13:38, Diederik Meijer | Ten Horses  
wrote:

> Meaning I would compare words and their index in an array of words created 
> from the two strings. 

Thanks, Diederik. That's exactly the approach I took by using NSMutableArray's 
-removeObject. 


signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
On 21 Sep 2014, at 13:03, Kyle Sluder  wrote:

> 
> No, it is nowhere near a common operation to perform on strings.


I stand corrected on that front, then (apparently...). Doesn't change the fact 
that I need to know how to do it, unless someone is willing to  point me in the 
direction of a better way, for which I'd be most grateful.

> It’s common for *programmers* to perform on their source code.
> 

I've no idea what this means. Is it a cryptic answer to the problem, or a dig 
at my level of experience? 


signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread Allan Odgaard

On 21 Sep 2014, at 6:08, 2551 wrote:

As I've been saying all along, this is such a common operation, I'd 
have thought there must be a common cocoa method or API for doing it. 
So the question is, can anyone tell me what that is?


The general problem you’re dealing with is that of finding the longest 
common subsequence. This is a difficult problem so it is often solved 
with heuristics. Wikipedia: 
http://en.wikipedia.org/wiki/Longest_common_subsequence_problem


One solution is the UNIX diff command  which, as 
Jens previously mentioned, works on lines and is commonly used by 
version control systems and programmers. You can call out to this 
command from Cocoa (e.g. via NSTask).


You can read about the implementation here 
http://www.xmailserver.org/diff2.pdf


An attempt of improving the quality of this command (for source code 
diff’ing) exists: http://alfedenzo.livejournal.com/170301.html


If you need a C API then have a look at 
https://code.google.com/p/google-diff-match-patch/

___

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: return string that is the difference between two other strings

2014-09-20 Thread 2551
On 21 Sep 2014, at 13:45, Allan Odgaard  wrote:
> One solution is the UNIX diff command  which, as Jens 
> previously mentioned, works on lines and is commonly used by version control 
> systems and programmers. You can call out to this command from Cocoa (e.g. 
> via NSTask).
> 


Thanks, Allan, for putting the 2 and 2 together for me. I didn't occur to me 
call diff from NSTask.

An excellent idea I'll play with later today. Thanks again.





signature.asc
Description: Message signed with OpenPGP using GPGMail
___

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: return string that is the difference between two other strings

2014-09-20 Thread Diederik Meijer | Ten Horses
Note that there are two differences, I would want to know: where string A says 
"this", string B says "that." So you have both "this" and 'that" for a 
difference. A lot of times, pre-optimizing your strings helps, meaning you 
first take out punctuation (mostly comma's) and remember where to put them back 
in. Also splitting may sometimes need NSRegularExpression instead of 
ComponentsSeparatedByString to be better. In general pre-optimizing is a 
necessity. In my experience, customizing a workplan between pre-optimizing and 
comparison/search based on the actual content gives the best results. It's more 
time-consuming though...

Verstuurd vanaf mijn iPhone

> Op 21 sep. 2014 om 08:42 heeft 2551 <2551p...@gmail.com> het volgende 
> geschreven:
> 
> 
>> On 21 Sep 2014, at 13:38, Diederik Meijer | Ten Horses 
>>  wrote:
>> 
>> Meaning I would compare words and their index in an array of words created 
>> from the two strings.
> 
> Thanks, Diederik. That's exactly the approach I took by using 
> NSMutableArray's -removeObject. 
> ___
> 
> 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/diederik%40tenhorses.com
> 
> This email sent to diede...@tenhorses.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