Re: Power Nap/wakeup

2014-09-01 Thread Jens Alfke

> On Sep 1, 2014, at 4:46 PM, Jerry Krinock  wrote:
> 
> Register an observer of NSWorkspaceWillSleepNotification.

This will fire immediately _before_ the system sleeps, not _during_ sleep. (And 
if your handler doesn't return quickly enough, it'll prevent the OS from going 
to sleep.)

—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: Power Nap/wakeup

2014-09-01 Thread Jerry Krinock

> On 2014 Sep 01, at 14:39, Jim Geist  wrote:
> 
> Is there any way to set a timer to fire when the system is in full sleep

Register an observer of NSWorkspaceWillSleepNotification.

> or a public API to Power Nap?

I’ve never seen any.  App Nap, yes.  Power Nap, no.


___

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: [PSA] JavaScript for Automation

2014-09-01 Thread SevenBits
On Sep 1, 2014, at 4:07 PM, has  wrote:

> [I'm cross-posting this from the AppleScript Users mailing list - it's not a 
> Cocoa question, but quite a few developers are extremely interested in 
> alternatives to AppleScript for application automation so I believe it has 
> relevance. I don't wish to risk the Cocoa Dev list mom's wrath with a longer 
> discussion thread though, so please post any replies to ASU 
> , not here on CD.]
> 
> 
> Folks,
> 
> While there's still a couple months till Yosemite ships, it already looks as 
> if JavaScript for Automation is going to be one more priceless opportunity 
> down the drain. I've been testing it since DP2 and, like Leopard's Scripting 
> Bridge, it's a half-baked, half-broken mess whose authors do not understand 
> how AppleScript and application scripting actually work in the real world, 
> never eat their own dog food, and ignore any criticism they don't understand 
> or don't wish to hear.

Unfortunately, a sad occurrence in software projects.

> 
> As part of my feedback to the AS team, I hacked together first a prototype 
> JavaScript-AppleEvent Bridge and then a full JavaScript OSA component that 
> they could use as reference, although I've no idea if they even bothered to 
> look at it (I just got crickets). I've now uploaded a zip file containing the 
> JavaScriptOSA component, the JAB Demo tool for translating application 
> commands from AppleScript to JavaScript syntax, and the original Xcode 
> project files to the old appscript project page so everyone else can have a 
> look as well:
> 
> http://sourceforge.net/projects/appscript/files
> 
> Error reporting and documentation are incomplete, and there's bugs and other 
> issues not yet resolved, but the AE and OSA support almost all works so folks 
> already trying out JXA on Yosemite will find it useful for comparison. Folks 
> on Mavericks can also try it if they wish as it's 10.9-compatible too. I'll 
> try to finish it later if I've time, but as Apple have deprecated the whole 
> OSA foundation it'll never be suitable for production use; therefore it's JXA 
> or bust.
> 
> At this late stage I think the only solution is for users to demand Apple 
> reschedule JXA's initial release for 10.11, giving them time to [re]do it 
> right. Bear in mind that once 10.10 ships, JXA's design defects will be 
> effectively welded in for good. So it's up to all of you to decide if you're 
> willing to accept something that's crippled, broken, and thoroughly inferior 
> to AppleScript, and to make yourselves heard by those in charge if not.

Although I have this, and was quickly turned away because its complexity, to be 
honest I really have little need for a solution like this. There are so many 
issues in Cocoa and OS X that need Apple’s attention right now (like a newly 
installed app breaking file associations) I don’t think that it will be a 
priority anytime soon.

That’s not to say that I don’t think that Apple should delay it; I’m just 
saying that I have doubts that it will happen.

> 
> Regards,
> 
> has
> 
> 
> 
> ___
> 
> 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: Compositing grid over custom view

2014-09-01 Thread edward taffel
you may wish to investigate the quartz blend modes, e.g. kCGBlendModeDifference 
might work for you.


On Sep 1, 2014, at 3:53 PM, Luc Van Bogaert  wrote:

> Hello,
> 
> I'm trying to find a way to draw a grid (NSBezierPath 'lines') in a custom 
> nsview so that it is always visible, regardless of the underlying color.
> I'm using a transparency layer to draw the grid, and I have tried various 
> NSCompositeOperation settings without succes. Is this at all possible using 
> the standard cocoa drawing features, or will I need OpenGL or some other 
> graphics library?  
> 
> Thanks
> -- 
> Luc Van Bogaert
> 
> ___
> 
> 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/etaffel%40me.com
> 
> This email sent to etaf...@me.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

Power Nap/wakeup

2014-09-01 Thread Jim Geist
Hi all -

Is there any way to set a timer to fire when the system is in full sleep, or a 
public API to Power Nap? (Right now I only care about OS X, not iOS).

I suspect the answer to both questions is no. If that’s true, then my app 
doesn’t need to worry about it either :)

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

[PSA] JavaScript for Automation

2014-09-01 Thread has
[I'm cross-posting this from the AppleScript Users mailing list - it's 
not a Cocoa question, but quite a few developers are extremely 
interested in alternatives to AppleScript for application automation so 
I believe it has relevance. I don't wish to risk the Cocoa Dev list 
mom's wrath with a longer discussion thread though, so please post any 
replies to ASU 
, not here 
on CD.]



Folks,

While there's still a couple months till Yosemite ships, it already 
looks as if JavaScript for Automation is going to be one more priceless 
opportunity down the drain. I've been testing it since DP2 and, like 
Leopard's Scripting Bridge, it's a half-baked, half-broken mess whose 
authors do not understand how AppleScript and application scripting 
actually work in the real world, never eat their own dog food, and 
ignore any criticism they don't understand or don't wish to hear.


As part of my feedback to the AS team, I hacked together first a 
prototype JavaScript-AppleEvent Bridge and then a full JavaScript OSA 
component that they could use as reference, although I've no idea if 
they even bothered to look at it (I just got crickets). I've now 
uploaded a zip file containing the JavaScriptOSA component, the JAB Demo 
tool for translating application commands from AppleScript to JavaScript 
syntax, and the original Xcode project files to the old appscript 
project page so everyone else can have a look as well:


http://sourceforge.net/projects/appscript/files

Error reporting and documentation are incomplete, and there's bugs and 
other issues not yet resolved, but the AE and OSA support almost all 
works so folks already trying out JXA on Yosemite will find it useful 
for comparison. Folks on Mavericks can also try it if they wish as it's 
10.9-compatible too. I'll try to finish it later if I've time, but as 
Apple have deprecated the whole OSA foundation it'll never be suitable 
for production use; therefore it's JXA or bust.


At this late stage I think the only solution is for users to demand 
Apple reschedule JXA's initial release for 10.11, giving them time to 
[re]do it right. Bear in mind that once 10.10 ships, JXA's design 
defects will be effectively welded in for good. So it's up to all of you 
to decide if you're willing to accept something that's crippled, broken, 
and thoroughly inferior to AppleScript, and to make yourselves heard by 
those in charge if not.


Regards,

has



___

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

Compositing grid over custom view

2014-09-01 Thread Luc Van Bogaert
Hello,

I'm trying to find a way to draw a grid (NSBezierPath 'lines') in a custom 
nsview so that it is always visible, regardless of the underlying color.
I'm using a transparency layer to draw the grid, and I have tried various 
NSCompositeOperation settings without succes. Is this at all possible using the 
standard cocoa drawing features, or will I need OpenGL or some other graphics 
library?  

Thanks
-- 
Luc Van Bogaert



smime.p7s
Description: S/MIME cryptographic signature
___

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: My services in my own app

2014-09-01 Thread Georg Seifert
Just wanted to follow up on this. The bug is not fixed. It is still there in 
10.9. Any other news on it?

Georg

On 16 Jan 2012, at 22:27, Mark Munz  wrote:

> 
> You didn't indicate what version of Mac OS X you were running under.
> 
> If this is happening under Snow Leopard, then this is a known issue in
> Snow Leopard that Apple fixed in Lion.
> 
> The only work around I know is to put the service code in a separate
> (background) application that then calls back into your app to do
> whatever task you need it to do.
> 
> Mark
> 
>> Hi,
>> 
>> My app registers some services and they work just fine. Only if I invoke 
>> then from within the same application, the app hangs. I tried with other 
>> apps and they had the same problem.
>> 
>> I searched the web for it but could not find anything.
>> 
>> Is there anything I can do about it?
>> 
>> Thanks
>> Georg


___

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: NSTextAlignment Enum?

2014-09-01 Thread Dave
Hi,

The method that returns the NSTextAlignment is interpreting other data to come 
up with the best alignment, if there is no “Best Alignment” it needs to signal 
this back to the caller.

I’ve solved the problem by returning a BOOL to say if the NSTextAlignment is 
valid or not and passing the actual NSTextAlignment value as &myTextAlignment, 
e.g.

if ([self getBestAlignmentWithParam1:p1 andParam2:p2 andParam3:p3 
returnTextAlignment: &myTextAlignment] == NO)
{
// do something else
}

Cheers
Dave


On 1 Sep 2014, at 18:30, Mills, Steve  wrote:

> On Sep 1, 2014, at 11:44, "Keary Suska"  wrote:
>> 
>> One future-proof approach that occurred to me is to declare your own enum:
>> 
>> typedef NS_ENUM(NSInteger, MYTextAlignment) {
>>   MYInvalidTextAlignment= -1,
>>   MYLeftTextAlignment= NSLeftTextAlignment,
>>   MYRightTextAlignment= NSRightTextAlignment,
>>   MYCenterTextAlignment= NSCenterTextAlignment,
>>   MYJustifiedTextAlignment= NSJustifiedTextAlignment,
>>   MYNaturalTextAlignment= NSNaturalTextAlignment
>> };
> 
> I was thinking of that too, but it doesn't future-proof it if Apple adds more 
> enums, especially if new ones are out of the max signed int range.
> 
> Steve via iPad
> ___
> 
> 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/dave%40looktowindward.com
> 
> This email sent to d...@looktowindward.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: NSTextAlignment Enum?

2014-09-01 Thread Mills, Steve
On Sep 1, 2014, at 11:44, "Keary Suska"  wrote:
> 
> One future-proof approach that occurred to me is to declare your own enum:
> 
> typedef NS_ENUM(NSInteger, MYTextAlignment) {
>MYInvalidTextAlignment= -1,
>MYLeftTextAlignment= NSLeftTextAlignment,
>MYRightTextAlignment= NSRightTextAlignment,
>MYCenterTextAlignment= NSCenterTextAlignment,
>MYJustifiedTextAlignment= NSJustifiedTextAlignment,
>MYNaturalTextAlignment= NSNaturalTextAlignment
> };

I was thinking of that too, but it doesn't future-proof it if Apple adds more 
enums, especially if new ones are out of the max signed int range.

Steve via iPad
___

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: NSTextAlignment Enum?

2014-09-01 Thread Keary Suska

On Sep 1, 2014, at 9:28 AM, Keary Suska  wrote:

> On Sep 1, 2014, at 4:51 AM, Dave  wrote:
> 
>> I have a method that takes a String and depending on it’s value needs to 
>> return an NSTextAlignment type. However, if the string is invalid, then I 
>> want to indicate that an error so I pass back -1. This is fine expect I get 
>> warnings on this code:
>> 
>> if (myTextAllignment != -1)
>>  theFieldOutlet.textAlignment = myTextAllignment;
>> 
>> Warning:
>> 
>> Comparison of constant -1 with expression of type 'NSTextAlignment' (aka 
>> 'enum NSTextAlignment') is always true
>> 
>> What is the best way to fix this?
> 
> NSTextAlignment in declared in NSText.h, as you will see by looking at the 
> constants section of the doc. It is an NSUInteger, so obviously trying to 
> push -1 is an issue. If you don't want to return a proper NSTextAlignment 
> value in some instances, than the property should not be declared as an 
> NSTextAlignment type, because clearly it is not. You can change the type to 
> NSInteger, but that may not be future-proof. The truly best approach, IMHO, 
> is to catch the error at the point it occurs, rather than relying on a 
> fragile, interpreted value. E.g. having a method:
>   - (BOOL)parseTextAlignment:(NSTextAlignment *)alignPtr
> is a smarter way to go (IMHO).

One future-proof approach that occurred to me is to declare your own enum:

typedef NS_ENUM(NSInteger, MYTextAlignment) {
MYInvalidTextAlignment  = -1,
MYLeftTextAlignment = NSLeftTextAlignment,
MYRightTextAlignment= NSRightTextAlignment,
MYCenterTextAlignment   = NSCenterTextAlignment,
MYJustifiedTextAlignment= NSJustifiedTextAlignment,
MYNaturalTextAlignment  = NSNaturalTextAlignment
};

Although  still think it is better to trap errors early and on-time, whenever 
possible.

HTH,

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: NSTextAlignment Enum?

2014-09-01 Thread Keary Suska
On Sep 1, 2014, at 4:51 AM, Dave  wrote:

> I have a method that takes a String and depending on it’s value needs to 
> return an NSTextAlignment type. However, if the string is invalid, then I 
> want to indicate that an error so I pass back -1. This is fine expect I get 
> warnings on this code:
> 
> if (myTextAllignment != -1)
>   theFieldOutlet.textAlignment = myTextAllignment;
> 
> Warning:
> 
> Comparison of constant -1 with expression of type 'NSTextAlignment' (aka 
> 'enum NSTextAlignment') is always true
> 
> What is the best way to fix this?

NSTextAlignment in declared in NSText.h, as you will see by looking at the 
constants section of the doc. It is an NSUInteger, so obviously trying to push 
-1 is an issue. If you don't want to return a proper NSTextAlignment value in 
some instances, than the property should not be declared as an NSTextAlignment 
type, because clearly it is not. You can change the type to NSInteger, but that 
may not be future-proof. The truly best approach, IMHO, is to catch the error 
at the point it occurs, rather than relying on a fragile, interpreted value. 
E.g. having a method:
- (BOOL)parseTextAlignment:(NSTextAlignment *)alignPtr
is a smarter way to go (IMHO).

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: NSTextAlignment Enum?

2014-09-01 Thread Mills, Steve
On Sep 1, 2014, at 5:51, "Dave"  wrote:
> 
> I have a method that takes a String and depending on it’s value needs to 
> return an NSTextAlignment type. However, if the string is invalid, then I 
> want to indicate that an error so I pass back -1. This is fine expect I get 
> warnings on this code:
> 
> if (myTextAllignment != -1)
>theFieldOutlet.textAlignment = myTextAllignment;
> 
> Warning:
> 
> Comparison of constant -1 with expression of type 'NSTextAlignment' (aka 
> 'enum NSTextAlignment') is always true
> 
> What is the best way to fix this?

Just cast it to the type you need.

If(myTextAlignment != (NSTextAlignment)-1)

Steve via iPad
___

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: How to Validate CoreData attribute value for uniqueness

2014-09-01 Thread Willeke
Some ideas, I don't know if it works:

in your validation method, change
   NSArray *allSpecies = [self.managedObjectContext 
executeFetchRequest:allSpeciesIDsFetchRequest error:nil];
   NSArray *allCatalogIDs = [allSpecies valueForKeyPath:@"catalogID"];
   if ([allCatalogIDs containsObject:*ioValue]) {
to something like
   [allSpeciesIDsFetchRequest setPredicate:[NSPredicate 
predicateWithFormat:@"catalogID == %@", *ioValue]];
   NSArray *species = [self.managedObjectContext 
executeFetchRequest:allSpeciesIDsFetchRequest error:nil];
   if ([species count] > 1 ||
  [species count] == 1 && [species objectAtIndex:0] != self) {


NSTextField can have a delegate which can implement
- (BOOL)control:(NSControl *)control isValidObject:(id)object


Willeke
___

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

NSTextAlignment Enum?

2014-09-01 Thread Dave
Hi,

I have a method that takes a String and depending on it’s value needs to return 
an NSTextAlignment type. However, if the string is invalid, then I want to 
indicate that an error so I pass back -1. This is fine expect I get warnings on 
this code:

if (myTextAllignment != -1)
theFieldOutlet.textAlignment = myTextAllignment;

Warning:

Comparison of constant -1 with expression of type 'NSTextAlignment' (aka 'enum 
NSTextAlignment') is always true

What is the best way to fix this?

Thanks in advance
Dave


___

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