Re: Embedded web server

2010-02-16 Thread jonat...@mugginsoft.com

On 16 Feb 2010, at 02:23, Jens Alfke wrote:
 
 I haven't used Twisted, but it's pretty powerful. On the downside, I believe 
 that means it's big. It might be a lot of code to ship with your app (unless 
 it's already in the OS?) and it might use more memory than you'd like. Of 
 course you should take actual measurements before trusting anything I say :)
 
 A similar but probably-smaller solution would be Ruby's Mongrel server. I 
 think it's included in the Ruby distribution in the OS.
 
I appreciate the size, complexity concerns.
Twisted may well be in the OS already: 
http://www.friday.com/bbum/2007/12/22/full-twisted-as-a-zip-for-leopard/

Off list I was informed of AFHTTPServer, part of 
http://code.google.com/p/amber-framework.
This code looks very well engineered and supports both RC + GC.
Something that lives in the bundle might offer fewer support/configuration 
issues if less outright HTTP-power.

Regards

Jonathan___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


ImageIO on iPhone

2010-02-16 Thread sebi
Hello,

I want to use ImageIO on the iPhone. However, the ApplicationServices framework 
does not show up in the list, when i do the Add - Existing Framework 
command. When i just add the line
#import ApplicationServices/ApplicationServices.h

I get some errors like 'CFXMLTreeRef' has not been declared (full list below). 
I added the CoreFoundation framework (where CFXMLTreeRef is defined), but no 
success. 
I want to use ImageIO from C++, that should be possible, shouldn't it?

Can someone help me?

Thanks and regards,
SebastianMecklenburg





/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/WebServicesCore.framework/Headers/WSMethodInvocation.h:759:
 error: 'CFXMLTreeRef' has not been declared

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/WebServicesCore.framework/Headers/WSMethodInvocation.h:759:
 error: 'CFXMLTreeRef' has not been declared

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/WebServicesCore.framework/Headers/WSProtocolHandler.h:486:
 error: 'CFXMLTreeRef' has not been declared

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/CoreServices.framework/Frameworks/WebServicesCore.framework/Headers/WSProtocolHandler.h:486:
 error: 'CFXMLTreeRef' has not been declared

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/QD.framework/Headers/Quickdraw.h:8142:
 error: 'CGDirectDisplayID' does not name a type

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65:
 error: 'CGCharCode' has not been declared

/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk/System/Library/Frameworks/ApplicationServices.framework/Frameworks/HIServices.framework/Headers/AXUIElement.h:65:
 error: 'CGKeyCode' has not been declared


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSData category

2010-02-16 Thread Torsten Curdt
I am really really irritated. Got an iPhone project. Got quite some
categories with additions to the standard APIs. All good.
Just the darn NSData refuses to accept the category ... and I have no
clue why. It's as simple as

 @interface NSData (NSDataAdditions)
 + (id) dataWithHexString:(NSString*)theHex;
 - (NSString*) hexString;
 @end

I've tried prefixing the methods, I've use a more exotic category name
than just NSDataAdditions. Whatever I am trying ... the class/object
does not have the selectors. Even something simple as

NSData *data = [NSData data]; //[NSData dataWithHexString:@aabbccdd];
NSLog(@@%, [data hexString]);

gives me

  -[NSConcreteData hexString]: unrecognized selector sent to instance ...

Why NSConcreteData? Does it create a different object under the hood
so my category is not applicable?
I've used NSData categories before and the worked just fine.

Is there a way in gdb to look at the categories/method lists easily?
Or should they selectors show up through class_copyMethodList?

Could really use some ideas here.

cheers
--
Torsten
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSData category

2010-02-16 Thread Paul Sanders
 Why NSConcreteData? Does it create a different object under 
 the hood

Yes, NSData is a class cluster (see Google).  NSString, NSArray 
and NSDictionary are too, and no doubt others.  But I don't see 
why you shouldn't put a category on NSConcreteData, other than 
the fact that the sand might shift under your feet in a future 
release of the OS.

Paul Sanders. 



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSData category

2010-02-16 Thread jonat...@mugginsoft.com
 I am really really irritated. Got an iPhone project. Got quite some
 categories with additions to the standard APIs. All good.
 Just the darn NSData refuses to accept the category ... and I have no
 clue why. It's as simple as
 
 @interface NSData (NSDataAdditions)
 + (id) dataWithHexString:(NSString*)theHex;
 - (NSString*) hexString;
 @end
 
Works fine on OS X 10.6.2.

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSData category

2010-02-16 Thread Torsten Curdt
Bah ... one really just has to write the email to the list to find the
fix himself. So here is what happened: I had added a new file to the
Xcode project and renamed it.

When checking with nm I found that the symbol for the category was
actually missing ...and fair enough - it was just missing from the
Compile Sources section. Feeling so stupid and so sad I wasted at
least an hour on this. *sigh*

Sorry for the noise folks.

cheers
--
Torsten
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Using a Private Framework in Mac application

2010-02-16 Thread Josh Tucker
Hey guys,


I'm creating an application that I'd like to interface with the iPhone using 
the MobileDevice.framework.

Would someone please point me in the right direction to be able to use the 
MobileDevice.framework in my application.

Thanks,

Joshua Lee Tucker

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Peer-Peer iPhone, desktop app?

2010-02-16 Thread Eric E. Dolecki
I have found this URL:
http://developer.apple.com/iphone/library/technotes/tn2009/tn2152.html#SECPEERTOPEER

I have an app running on a Touch using the wifi router attached to my Mac
(Mac is supplying connectivity from it's ethernet connection). I would like
an OS X desktop app to be able to talk back and forth with the Touch
application. Is this plausible? Will the Wi-Tap application work (seeing
that I would need to rewrite it to work on the desktop)?

I'm almost looking for a super simple 2 project collection... just showing
the connection between the apps. I'm new to networking like this so reading
documentation to solve this matter is taking an awfully long time  since
things have to be set up correctly on both sides, I may have it correct on
one side and not the other and needlessly spin wheels trying different
approaches that keep the thing from working.

Does anyone have anything handy or know of a tutorial online, even a book
that covers this very thing?

Thanks for any insight,
Eric
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: ImageIO on iPhone

2010-02-16 Thread glenn andreas

On Feb 16, 2010, at 6:55 AM, sebi wrote:

 Hello,
 
 I want to use ImageIO on the iPhone. However, the ApplicationServices 
 framework does not show up in the list, when i do the Add - Existing 
 Framework command.

That's because ImageIO doesn't exist on the iPhone.

 When i just add the line
 #import ApplicationServices/ApplicationServices.h

There is no ApplicationServices framework on the iPhone.

 
 I get some errors like 'CFXMLTreeRef' has not been declared (full list 
 below). I added the CoreFoundation framework (where CFXMLTreeRef is defined), 
 but no success. 
 I want to use ImageIO from C++, that should be possible, shouldn't it?
 

Not on the iPhone - file an enhancement request...


Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Using a Private Framework in Mac application

2010-02-16 Thread Fritz Anderson
On 16 Feb 2010, at 7:49 AM, Josh Tucker wrote:

 Would someone please point me in the right direction to be able to use the 
 MobileDevice.framework in my application.

===
ramtops:~ fritza$ locate MobileDevice.framework | grep -v sdk
/System/Library/PrivateFrameworks/MobileDevice.framework
/System/Library/PrivateFrameworks/MobileDevice.framework/CodeResources
/System/Library/PrivateFrameworks/MobileDevice.framework/MobileDevice
...
===

Note the directory name PrivateFrameworks. This indicates the framework is 
private. It is not documented. It is subject to change (both API and behavior 
of existing API) in minor revisions of the operating system. It relies on the 
internal implementation of OS software that is likewise undocumented, private, 
and subject to change. It is not supported. For all I know, using it is in 
violation of the Mac OS X license. 

There may be reverse-engineered documentation somewhere out there, but 
non-Apple software relying on it is not fit for public release.

I advise against using it.

— F

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Peer-Peer iPhone, desktop app?

2010-02-16 Thread Jens Alfke

On Feb 16, 2010, at 5:55 AM, Eric E. Dolecki wrote:

 I have an app running on a Touch using the wifi router attached to my Mac
 (Mac is supplying connectivity from it's ethernet connection). I would like
 an OS X desktop app to be able to talk back and forth with the Touch
 application. Is this plausible?

Yup. Lots of apps do this.

 I'm almost looking for a super simple 2 project collection...

http://bitbucket.org/snej/chatty/wiki/Home is a very simple chat app for 
iPhone. It's based on a sample someone else wrote, and then I replaced all the 
networking code with a couple of calls to my MYNetwork library. There isn't a 
Mac equivalent project, bit it would be easy to take the model classes and 
write an AppKit-based UI.

The MYNetwork project itself contains a more rudimentary app that runs on both 
iPhone and Mac.

—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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Using a Private Framework in Mac application

2010-02-16 Thread Jens Alfke

On Feb 16, 2010, at 5:49 AM, Josh Tucker wrote:

 Would someone please point me in the right direction to be able to use the 
 MobileDevice.framework in my application.

Just locate the framework in the Finder and drag its icon into your project. 
You may need to edit the target build settings to add 
/System/Library/PrivateFrameworks/ to the framework search path.

Unlike on iPhone, you won't get in trouble with Apple for using a private OS X 
framework. But do keep in mind that:
• Private frameworks can change without warning even in minor OS updates, 
possibly breaking your app. (Weak-linking is advisable.)
• One common reason for Apple not to make an API public is that is isn't quite 
baked yet, i.e. may not work quite correctly or may have been tested only in 
the specific ways it's used by Apple software.
• You're not going to be able to ask for help here or any other Apple forum. 
Speaking of which, I hear a moderator coming...

—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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Peer-Peer iPhone, desktop app?

2010-02-16 Thread Eric E. Dolecki
Thank you - I will check into this. Much appreciated!

On Tue, Feb 16, 2010 at 11:25 AM, Jens Alfke j...@mooseyard.com wrote:


 On Feb 16, 2010, at 5:55 AM, Eric E. Dolecki wrote:

  I have an app running on a Touch using the wifi router attached to my Mac
  (Mac is supplying connectivity from it's ethernet connection). I would
 like
  an OS X desktop app to be able to talk back and forth with the Touch
  application. Is this plausible?

 Yup. Lots of apps do this.

  I'm almost looking for a super simple 2 project collection...

 http://bitbucket.org/snej/chatty/wiki/Home is a very simple chat app for
 iPhone. It's based on a sample someone else wrote, and then I replaced all
 the networking code with a couple of calls to my MYNetwork library. There
 isn't a Mac equivalent project, bit it would be easy to take the model
 classes and write an AppKit-based UI.

 The MYNetwork project itself contains a more rudimentary app that runs on
 both iPhone and Mac.

 —Jens




-- 
http://ericd.net
Interactive design and development
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSPredicate Binding Problem

2010-02-16 Thread Chris Tracewell
In a window displaying a widget object I am using an outlineview  
bound to an NSTreeController as master view. When I notice the OV  
selection change via outlineViewSelectionDidChange I filter a  
tableview bound to an NSArrayController in one of two ways like so...


Method 1 :: use setFilterPredicate on the NSArrayController and set to  
a new NSPredicate
Method 2 :: In IB bind the NSArrayController's Filter Predicate to a  
property called myPredicate and use KVC to set a new NSPredicate


Either of these methods work fine - the tableview's content filters  
fine. The problem I am having is that when I load a new widget, thus  
releasing the current widget view from the window, along with it's  
NSViewController, I get the error...


Cannot remove an observer _NSArrayControllerExtensions 0x12c8b30 for  
the key path...


I have googled and found this is typically to do with non KVO  
compliant models. I have checked and rechecked my models and made sure  
that all properties are compliant with KVO. While debugging I removed  
resetting the NSPredicate in outlineViewSelectionDidChange and instead  
just set it once in awakFromNib and the issue goes away. This brings  
me to the conclusion that somehow resetting the NSPredicate for the  
NSArrayController is not allowed.


How should I go about filtering my tableview? Should it be okay to  
reset the NSArrayController's filterPredicate... ie is there something  
else going on?


Thanks in advance for any suggestions.
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Question about zipping files

2010-02-16 Thread Sean McBride
On 2/15/10 4:50 PM, Gideon King said:

Thanks for the suggestion. Have not encountered Scripting Bridge before
and have very little experience or understanding of AppleScript and no
knowledge of Apple Events or what they do. I had a vague notion that
Apple Events were pretty much old technology from before OSX, but now I
see that it appears that it's the foundation of AppleScript. I guess I
should take time to look into these technologies sometime (I come from a
NextStep/OpenStep/WebObjects background)...

AppleEvents date from System 7, so yeah, they're pretty old.  But that
should not automatically disqualify them.  UNIX and NeXTStep are old too. :)

Is there any particular reason you say to stay away from NSTask?

I only meant that it's generally preferable to use an API when you can.
ex: don't copy files using NSTask and 'cp', because NSWorkspace can copy
files.

Scripting Bridge seems like an interesting option, but after having
generated the headers for Finder, I could not see a command there for
compressing files. I guess it's not scriptable.

The Finder is scriptable, but not every command can be scripted.  I
looked quickly with AppleScript Editor, and indeed Finder does not seem
to expose 'compress'.  Oh well.

I'd file a bug asking that NSWorkspaceCompressOperation be implemented.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Jerry Krinock
At times, I attach an attached window to a document window.  I would like this 
window to go away whenever the user clicks anything in the window, kind of like 
a tooltip.

So I subclassed the window, overrode -sendEvent:, invoke super and post a 
notification for which my window controller registers, and in the notification 
handler I examine the event type.  It works, but this seems quite heavy-handed 
to get something so simple.  Did I miss a more lightweight way to do this?

Thanks,

Jerry Krinock

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Paul Sanders
-[NSWindow mouseDown:]? (inherited from NSResponder).

Paul Sanders.

- Original Message - 
From: Jerry Krinock je...@ieee.org
To: Cocoa Developers cocoa-dev@lists.apple.com
Sent: Tuesday, February 16, 2010 5:48 PM
Subject: Perform additional action when window receives any 
mouse- or keyDown


At times, I attach an attached window to a document window.  I 
would like this window to go away whenever the user clicks 
anything in the window, kind of like a tooltip.

So I subclassed the window, overrode -sendEvent:, invoke super 
and post a notification for which my window controller 
registers, and in the notification handler I examine the event 
type.  It works, but this seems quite heavy-handed to get 
something so simple.  Did I miss a more lightweight way to do 
this?

Thanks,

Jerry Krinock



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Appropriate -setWantsLayer: timing

2010-02-16 Thread Keith Duncan
I'm wondering when writing a layer hosting view, when the most appropriate time 
is to set the layer and call -setWantsLayer:YES?

Calling it in -initWithFrame: is too early and the view fails to 'draw'.

Keith
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Preventing system sleep

2010-02-16 Thread Laurent Daudelin
I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Jerry Krinock

On 2010 Feb 16, at 10:58, Paul Sanders wrote:

 -[NSWindow mouseDown:]? (inherited from NSResponder).

Thanks, Paul.  I hadn't realized that inheritance.

Also, I'd need -rightMouseDown:, -keyDown:, -otherMouseDown:, ???

At least, no notification needed.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Neil Allain

On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:

 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can I 
 delay it?
 

You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Sean McBride
On 2/16/10 12:57 PM, Laurent Daudelin said:

I'm working on a an app that at some point might start transferring a
large file to a USB device. Apparently, if the system is set to go to
sleep, the transfer will fail.

You can temporarily disable sleep using IOPMAssertionCreateWithName() on
10.6 or IOPMAssertionCreate on 10.5.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the
doc says Currently unimplemented.

Don't you just love those?! :)

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Joe Ranieri

On 2/16/10 4:10 PM, Neil Allain wrote:


On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:


I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?



You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil


You should probably be using IOPMAssertionCreateWithName() instead if 
you can require 10.5+. This gives the system a lot more information 
about the intent of your code and the potential ability to show some 
nice UI to the user.


-- Joe Ranieri
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
Thanks, Joe, I'll have a look!




-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Feb 16, 2010, at 13:13, Joe Ranieri wrote:

 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can 
 I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you can 
 require 10.5+. This gives the system a lot more information about the intent 
 of your code and the potential ability to show some nice UI to the user.
 
 -- Joe Ranieri

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:13, Joe Ranieri wrote:

 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a large 
 file to a USB device. Apparently, if the system is set to go to sleep, the 
 transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc 
 says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how can 
 I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you can 
 require 10.5+. This gives the system a lot more information about the intent 
 of your code and the potential ability to show some nice UI to the user.

Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I 
guess I'll have to check IOPMAssertionCreate...

Thanks!

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Joe Ranieri

On 2/16/10 4:18 PM, Laurent Daudelin wrote:

On Feb 16, 2010, at 13:13, Joe Ranieri wrote:


On 2/16/10 4:10 PM, Neil Allain wrote:


On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:


I'm working on a an app that at some point might start transferring a large 
file to a USB device. Apparently, if the system is set to go to sleep, the 
transfer will fail.

I was thinking of using the NSWorkspace extendPowerOffBy: but then the doc says 
Currently unimplemented.

So, if my app get a notification that the system is going to sleep, how can I 
delay it?



You can call UpdateSystemActivity() periodically (such as on a timer) to 
prevent it from going to sleep.

Neil


You should probably be using IOPMAssertionCreateWithName() instead if you can 
require 10.5+. This gives the system a lot more information about the intent of 
your code and the potential ability to show some nice UI to the user.


Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I guess I'll 
have to check IOPMAssertionCreate...

Thanks!


Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID) 
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


Is the header wrong?

-- Joe Ranieri
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- orkeyDown

2010-02-16 Thread Paul Sanders
I guess so, yes.

Paul Sanders.

- Original Message - 
From: Jerry Krinock je...@ieee.org
To: Cocoa Developers cocoa-dev@lists.apple.com
Sent: Tuesday, February 16, 2010 9:05 PM
Subject: Re: Perform additional action when window receives any 
mouse- orkeyDown



On 2010 Feb 16, at 10:58, Paul Sanders wrote:

 -[NSWindow mouseDown:]? (inherited from NSResponder).

Thanks, Paul.  I hadn't realized that inheritance.

Also, I'd need -rightMouseDown:, -keyDown:, -otherMouseDown:, 
???

At least, no notification needed.




___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:19, Joe Ranieri wrote:

 On 2/16/10 4:18 PM, Laurent Daudelin wrote:
 On Feb 16, 2010, at 13:13, Joe Ranieri wrote:
 
 On 2/16/10 4:10 PM, Neil Allain wrote:
 
 On Feb 16, 2010, at 2:57 PM, Laurent Daudelin wrote:
 
 I'm working on a an app that at some point might start transferring a 
 large file to a USB device. Apparently, if the system is set to go to 
 sleep, the transfer will fail.
 
 I was thinking of using the NSWorkspace extendPowerOffBy: but then the 
 doc says Currently unimplemented.
 
 So, if my app get a notification that the system is going to sleep, how 
 can I delay it?
 
 
 You can call UpdateSystemActivity() periodically (such as on a timer) to 
 prevent it from going to sleep.
 
 Neil
 
 You should probably be using IOPMAssertionCreateWithName() instead if you 
 can require 10.5+. This gives the system a lot more information about the 
 intent of your code and the potential ability to show some nice UI to the 
 user.
 
 Oops! The doc says it was introduced in 10.6 and I need to support 10.5. I 
 guess I'll have to check IOPMAssertionCreate...
 
 Thanks!
 
 Curious. The header file says:
 IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID) 
 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
 Is the header wrong?
 
 -- Joe Ranieri

I'll give it a shot and see. Should find out pretty quickly...

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Sean McBride
On 2/16/10 4:19 PM, Joe Ranieri said:

Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
 CFStringRef  AssertionType,
 IOPMAssertionLevel   AssertionLevel,
 CFStringRef  AssertionName,
 IOPMAssertionID  *AssertionID)
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

It actually is available on 10.5 (at runtime).  But it's not in the 10.5
SDK.  So depends on what kind of 10.5 support you need.  If you need to
compile on 10.5, then you can't use it; if you only need to deploy on
10.5, then you can use it.

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Jens Alfke



On Feb 16, 2010, at 13:19, Joe Ranieri wrote:

Oops! The doc says it was introduced in 10.6 and I need to support  
10.5. I guess I'll have to check IOPMAssertionCreate...


Curious. The header file says:
IOReturn IOPMAssertionCreateWithName(
  CFStringRef  AssertionType,
  IOPMAssertionLevel   AssertionLevel,
  CFStringRef  AssertionName,
  IOPMAssertionID  *AssertionID)  
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;


Is the header wrong?


It could be a function that existed as private API in 10.5, was made  
public in 10.6, and retroactively made public for 10.5. This means you  
can call the function on 10.5 but it only exists in the headers in the  
10.6+ SDK (even if you're building for 10.5)


If you still need to build with the 10.5 SDK, you can copy the  
declaration from the newer SDK and paste it into your own code.


—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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Preventing system sleep

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 13:27, Sean McBride wrote:

 On 2/16/10 4:19 PM, Joe Ranieri said:
 
 Curious. The header file says:
 IOReturn IOPMAssertionCreateWithName(
CFStringRef  AssertionType,
IOPMAssertionLevel   AssertionLevel,
CFStringRef  AssertionName,
IOPMAssertionID  *AssertionID)
 AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;
 
 It actually is available on 10.5 (at runtime).  But it's not in the 10.5
 SDK.  So depends on what kind of 10.5 support you need.  If you need to
 compile on 10.5, then you can't use it; if you only need to deploy on
 10.5, then you can use it.

I should be fine, then. I'm developing on 10.6 but need to support 10.5. Thanks 
for the clarification.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Appropriate -setWantsLayer: timing

2010-02-16 Thread David Duncan
On Feb 16, 2010, at 12:52 PM, Keith Duncan wrote:

 I'm wondering when writing a layer hosting view, when the most appropriate 
 time is to set the layer and call -setWantsLayer:YES?
 
 Calling it in -initWithFrame: is too early and the view fails to 'draw'.


If you are creating the view programmatically, -initWithFrame: should be fine. 
If your loading from a nib, then -awakeFromNib is the appropriate place.
--
David Duncan
Apple DTS Animation and Printing

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Kyle Sluder
On Tue, Feb 16, 2010 at 9:48 AM, Jerry Krinock je...@ieee.org wrote:
 So I subclassed the window, overrode -sendEvent:, invoke super and post a 
 notification for which my window controller registers, and in the 
 notification handler I examine the event type.  It works, but this seems 
 quite heavy-handed to get something so simple.  Did I miss a more lightweight 
 way to do this?

Actually that seems like precisely the right thing to do. In fact, I
would go so far as to post the notification in all circumstances
unless it is specifically the kind of event your attached window
should process.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Paul Sanders
Yes, I think I go along with that.  It lets you handle all the 
events you choose to handle in one place.

Paul Sanders.

- Original Message - 
From: Kyle Sluder kyle.slu...@gmail.com
To: Jerry Krinock je...@ieee.org
Cc: Cocoa Developers cocoa-dev@lists.apple.com
Sent: Tuesday, February 16, 2010 9:56 PM
Subject: Re: Perform additional action when window receives any 
mouse- or keyDown


On Tue, Feb 16, 2010 at 9:48 AM, Jerry Krinock je...@ieee.org 
wrote:
 So I subclassed the window, overrode -sendEvent:, invoke super 
 and post a notification for which my window controller 
 registers, and in the notification handler I examine the event 
 type. It works, but this seems quite heavy-handed to get 
 something so simple. Did I miss a more lightweight way to do 
 this?

Actually that seems like precisely the right thing to do. In 
fact, I
would go so far as to post the notification in all circumstances
unless it is specifically the kind of event your attached window
should process.

--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:
http://lists.apple.com/mailman/options/cocoa-dev/p.sanders%40alpinesoft.co.uk

This email sent to p.sand...@alpinesoft.co.uk 



___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Validation error after setting the value of a boolean attribute

2010-02-16 Thread Lynn Barton
Why does my Core Data app give me a validation error message, when quitting the 
app, if the following code is used? I am importing some legacy data to set 5 
string attributes of an object, but using this code to set the one BOOL 
attribute. In my model, myBooleanAttribute has a default value of NO, and the 
legacy data does not include this attribute, so I can avoid the validation 
error by omitting the following code, but I would like to know why it causes 
errors.

[myNewObject setMyBooleanAttribute: 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Validation error after setting the value of a boolean attribute

2010-02-16 Thread Steven Degutis
Boolean attributes in Core Data are not actually of type BOOL but rather
NSNumber. Thus, your NO value is interpreted as nil (since nil == 0 == NO)
and you're setting your attribute to nil. If the attribute is required, then
nil is not a valid value, and you will get a validation error. Next time, if
you look at the header of your file, it tells you what types you should use
as arguments to methods, and what types to expect as return values.

Steven Degutis
Software Engineer
Big Nerd Ranch, Inc.
http://www.bignerdranch.com/

On Tue, Feb 16, 2010 at 5:35 PM, Lynn Barton lynnbar...@mac.com wrote:

 Why does my Core Data app give me a validation error message, when quitting
 the app, if the following code is used? I am importing some legacy data to
 set 5 string attributes of an object, but using this code to set the one
 BOOL attribute. In my model, myBooleanAttribute has a default value of NO,
 and the legacy data does not include this attribute, so I can avoid the
 validation error by omitting the following code, but I would like to know
 why it causes errors.

 [myNewObject setMyBooleanAttribute: 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:
 http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com

 This email sent to steven.degu...@gmail.com




-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Perform additional action when window receives any mouse- or keyDown

2010-02-16 Thread Murat Konar
Uh, if I understand what the op wants to do correctly, overriding - 
[NSWindow mouseDown:] isn't going to do it.


If the user clicks inside a view that overrides -mouseDown: (and  
friends -rightMouseDown: and -otherMouseDown:), there's no guarantee  
that your window's override will get called.


Overriding sendEvent seems like the best plan.

_murat

On Feb 16, 2010, at 1:05 PM, Jerry Krinock wrote:



On 2010 Feb 16, at 10:58, Paul Sanders wrote:


-[NSWindow mouseDown:]? (inherited from NSResponder).


Thanks, Paul.  I hadn't realized that inheritance.

Also, I'd need -rightMouseDown:, -keyDown:, -otherMouseDown:, ???

At least, no notification needed.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Validation error after setting the value of a boolean attribute

2010-02-16 Thread Lynn Barton

On Feb 16, 2010, at 2:38 PM, Steven Degutis wrote:

 Boolean attributes in Core Data are not actually of type BOOL but rather 
 NSNumber. Thus, your NO value is interpreted as nil (since nil == 0 == NO) 
 and you're setting your attribute to nil. If the attribute is required, then 
 nil is not a valid value, and you will get a validation error. Next time, if 
 you look at the header of your file, it tells you what types you should use 
 as arguments to methods, and what types to expect as return values.

Thanks. Silly me, I thought that when the docs said that a BOOL was YES or NO 
then those were the values to use. I did some research on Key-Value coding and 
then was able to get the code to work by modifying it to the following:

NSNumber *myBoolNumber = [NSNumber numberWithBool:NO];
[myNewObject setMyBooleanAttribute: myBoolNumber];
 
 Steven Degutis
 Software Engineer
 Big Nerd Ranch, Inc.
 http://www.bignerdranch.com/
 
 On Tue, Feb 16, 2010 at 5:35 PM, Lynn Barton lynnbar...@mac.com wrote:
 Why does my Core Data app give me a validation error message, when quitting 
 the app, if the following code is used? I am importing some legacy data to 
 set 5 string attributes of an object, but using this code to set the one BOOL 
 attribute. In my model, myBooleanAttribute has a default value of NO, and the 
 legacy data does not include this attribute, so I can avoid the validation 
 error by omitting the following code, but I would like to know why it causes 
 errors.
 
 [myNewObject setMyBooleanAttribute: 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:
 http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com
 
 This email sent to steven.degu...@gmail.com
 
 
 
 -- 
 Steven Degutis
 http://www.thoughtfultree.com/
 http://www.degutis.org/

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Refresh com.apple.symbolichotkeys.plist

2010-02-16 Thread DeNigris Sean
 Is there any way to cause the system to re-read 
 com.apple.symbolichotkeys.plist.plist in Cocoa (or anywhere else)?  I want to 
 programmatically change a shortcut (which is no problem), but I want it to 
 take effect immediately.  System Preferences obviously signals the system to 
 do this - does anyone know how it does that?
I did some more poking around and zeroed in on the following in the system log  
snippet:

 com.apple.launchd[1]: System: Looking up service com.apple.metadata.mds
 com.apple.launchd[1] (com.apple.launchd.peruser.501[160]): Mach service 
 lookup: com.apple.metadata.mds
 com.apple.launchd[1]: Dispatching kevent...
 com.apple.launchd[1]: KEVENT[0]: udata = 0x10002b210 data = 0x30 ident = 5 
 filter = EVFILT_READ flags = EV_ADD|EV_RECEIPT fflags = 0x0
 distnoted[16]: received_message_from System Preferences [A0] post 
 SpotlightPrefCumulativePrefChangeNotification (null) 

Based on my very limited understanding, it seems the Mach service is the key, 
but I don't know how to simulate what System Preferences is doing.

Sean DeNigris

p.s. is there a better/additional list to ask about this?

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSDrawNinePartImage not working ?

2010-02-16 Thread PCWiz
You shouldn't be doing any drawing in awakeFromNib. See this example code:

http://developer.apple.com/mac/library/samplecode/RoundTransparentWindow/index.html

It demonstrates how to create and display a custom window using an NSWindow 
subclass.

On 2010-02-14, at 10:36 PM, Sandro Noël wrote:

 Ok I know I must be missing something dumb.
 i'm trying to draw borders for the window,
 
 - (void) awakeFromNib{
 
 [window setStyleMask:NSBorderlessWindowMask];
 [window setOpaque:YES];
 
 NSDrawNinePartImage([[window contentView]frame], 
   nil, 
   nil, 
   nil, 
   
 [NSImage imageNamed:@right3.png], 
   nil, 
   
 [NSImage imageNamed:@left3.png], 
   
 [NSImage imageNamed:@right4.png], 
   
 [NSImage imageNamed:@left5.png], 
   
 [NSImage imageNamed:@left4.png], 

 NSCompositeClear, 
   1.0, 
   NO);
 
 
 but i get an error on runtime.
 Error: CGContextGetStyle: invalid context 0x0
 It does not make sense to draw an image when [NSGraphicsContext 
 currentContext] is nil.  This is a programming error. 
 Break on _NSWarnForDrawingImageWithNoCurrentContext to debug.  This will be 
 logged only once.  This may break in the future.
 CGContextClipToRect: invalid context 0x0
 Error: CGContextSetAlpha: invalid context 0x0
 Error: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0
 Error: CGContextDrawTiledImage: invalid context 0x0
 Error: CGContextClipToRect: invalid context 0x0
 Error: CGContextSetAlpha: invalid context 0x0
 Error: CGContextGetUserSpaceToDeviceSpaceTransform: invalid context 0x0
 Error: CGContextDrawTiledImage: invalid context 0x0
 
 I looked in the docsa little but did not find any indication that i had to 
 provide a Graphics context.
 
 any pointers ?
 
 
 Sandro.
 
 
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/pcwiz.support%40gmail.com
 
 This email sent to pcwiz.supp...@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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Puppeting/Automating one application from another?

2010-02-16 Thread James Trankelson
Hi,

I'm trying to figure out the general feasibility of the following task.

Imagine I have two separate applications, running side by side. Is it
possible to take all of the mouse/keyboard inputs that are going into
one of these applications, and send them to the other in a way that
would allow me to 'control' the other app from the events generated in
the first? I took a few steps to begin creating an infrastructure to
support this, but then became concerned that I'd soon have issues with
focusing, like if pressing buttons in the 'puppeted' application would
take away the focus in the application sending the events.

Does anyone know if something like this is possible? If so, does
anyone know of any applications that do this, or have any pointers
that could help me with this?

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Puppeting/Automating one application from another?

2010-02-16 Thread Laurent Daudelin
On Feb 16, 2010, at 18:31, James Trankelson wrote:

 Hi,
 
 I'm trying to figure out the general feasibility of the following task.
 
 Imagine I have two separate applications, running side by side. Is it
 possible to take all of the mouse/keyboard inputs that are going into
 one of these applications, and send them to the other in a way that
 would allow me to 'control' the other app from the events generated in
 the first? I took a few steps to begin creating an infrastructure to
 support this, but then became concerned that I'd soon have issues with
 focusing, like if pressing buttons in the 'puppeted' application would
 take away the focus in the application sending the events.
 
 Does anyone know if something like this is possible? If so, does
 anyone know of any applications that do this, or have any pointers
 that could help me with this?

Remote Desktop and VNC already to that, so it's certainly possible.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: 
http://laurentdaudelin.shutterbugstorefront.com/g/galleries___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Puppeting/Automating one application from another?

2010-02-16 Thread James Trankelson
I don't feel like that's the same thing. In the case of Remote Desktop
and VNC, the mouse and keyboard events are certainly being redirected
to another desktop, but only one application has the focus.


On Tue, Feb 16, 2010 at 8:15 PM, Laurent Daudelin
laurent.daude...@gmail.com wrote:
 On Feb 16, 2010, at 18:31, James Trankelson wrote:

 Hi,

 I'm trying to figure out the general feasibility of the following task.

 Imagine I have two separate applications, running side by side. Is it
 possible to take all of the mouse/keyboard inputs that are going into
 one of these applications, and send them to the other in a way that
 would allow me to 'control' the other app from the events generated in
 the first? I took a few steps to begin creating an infrastructure to
 support this, but then became concerned that I'd soon have issues with
 focusing, like if pressing buttons in the 'puppeted' application would
 take away the focus in the application sending the events.

 Does anyone know if something like this is possible? If so, does
 anyone know of any applications that do this, or have any pointers
 that could help me with this?

 Remote Desktop and VNC already to that, so it's certainly possible.

 -Laurent.
 --
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin                                 
 http://nemesys.dyndns.org
 Logiciels Nemesys Software                                              
 laurent.daude...@gmail.com
 Photo Gallery Store: 
 http://laurentdaudelin.shutterbugstorefront.com/g/galleries
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Bindings: NSArrayController gets a new but equal array, pushes back to model

2010-02-16 Thread Jerry Krinock
This is a resolution of my message posted 2010 Jan 02, subject:
   Bindings/Core Data: Undesired Discovery of a Mythical Deep Observer

I'm posting this because, after rewriting the whole thing and giving it some 
more thought, I believe I have an explanation, which archive-searchers might 
find interesting.  Summary: If an NSArrayController with 'contentArray' bound 
to a data model receives from the data model a new array which is equal to but 
a different pointer value than the array it currently has, it will push the new 
array back through the setter of the data model.

I'm working on a Core Data project.  Some to-many properties are displayed in 
tables, and these objects in turn have their own attributes which are displayed 
in the columns, bound to array controllers' -arrangedObjects.xxx, etc.  Pretty 
standard stuff...

DEPARTMENT's EMPLOYEES
 NameRank   Salary
---     --
Fat Cat   3  200

except that I have subclassed NSManagedObject and added 'index' attributes so 
that I can treat the sets as arrays, providing methods, for example 
-(NSArray*)employeesOrdered, -(Employee*)newEmployeeAtIndex:, etc.  All this 
works OK, except in a few of my columns I notice that, taking the above 
example, if user edits the table to change, say, the 'rank' of Fat Cat, after 
sending setRank:, the *Department* gets a -setEmployeesOrdered: message, with 
an NSArray argument which is a different pointer value but otherwise equal to 
the existing employeesOrdered array; it contains the same single object with 
the same pointer value.

This does no harm to the data model of course; the only reason I noticed it is 
because in some cases it overwrites and thus screws up my undo action names 
which are driven by custom setters.

In real life, -setEmployeesOrdered: is actually -setExternalizersOrdered and is 
#9 in the call stack below.  To fix the problem, in this setter I simply first 
check for array equality and return if no change.  Looking at the calls lower 
down, it appears to be fulfilling the binding on the array controller which 
causes this unnecessary message.  Of course, I do have an array controller with 
contentArray bound to 'externalizersOrdered'.  Also, it makes sense that there 
would be different pointer values of externalizersOrdered floating around since 
the getter computes it from the underlying set.  See code at the end.

I've decided that, apparently what's happening is that when when the array 
controller notices that a bound (by a table column) to attribute is changed, it 
asks the data model for -externalizersOrdered, sees that it gets a different 
array, but does not bother to check and see that the new array, although a 
different pointer value, is equal to the old array.  Probably it only keeps a 
reference.  And then due to some quirk in bindings it says, Oh, I better push 
this new array to the data model's setter (even though it just got it from the 
data model).

If anyone has read this far and has a better explanation, let us know.

#0  0x00122961 in -[Bkmslf 
setUndoActionNameForAction:object:objectKey:updatedKey:count:] at Bkmslf.m:2928
#1  0x0001fd71 in -[Bookshig 
mikeAshObserveValueForKeyPath:ofObject:change:userInfo:] at Bookshig.m:1789
#2  0x000ff452 in -[MAKVObservation 
observeValueForKeyPath:ofObject:change:context:] at MAKVONotificationCenter.m:98
#3  0x002d6208 in NSKeyValueNotifyObserver
#4  0x002d5ca7 in NSKeyValueDidChange
#5  0x002ba6d0 in -[NSObject(NSKeyValueObserverNotification) 
didChangeValueForKey:]
#6  0x01baa375 in -[NSManagedObject didChangeValueForKey:]
#7  0x0006e3fb in -[Ixternalizer setIndex:] at Ixternalizer.m:351
#8  0x000b6d93 in -[SSYManagedObject setWithIndexesArray:forSetKey:] at 
SSYManagedObject.m:231
#9  0x0001d7f5 in -[Bookshig setExternalizersOrdered:] at Bookshig.m:1233
#10 0x002dec99 in _NSSetObjectValueAndNotify
#11 0x01ba726a in -[NSManagedObject setValue:forKey:]
#12 0x002eead3 in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#13 0x002eeaaf in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#14 0x002eeaaf in -[NSObject(NSKeyValueCoding) setValue:forKeyPath:]
#15 0x0078f0d6 in -[NSBinder 
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
#16 0x0078eeb0 in -[NSBinder setValue:forBinding:error:]
#17 0x00b14745 in -[NSObjectDetailBinder 
setMasterObjectRelationship:refreshDetailContent:]
#18 0x00b1461d in -[NSObjectDetailBinder noteContentValueHasChanged]
#19 0x008f27ac in -[NSArrayController _setMultipleValue:forKeyPath:atIndex:]
#20 0x0078f211 in -[NSBinder 
_setValue:forKeyPath:ofObject:mode:validateImmediately:raisesForNotApplicableKeys:error:]
#21 0x00903832 in -[NSBinder setValue:forBinding:atIndex:error:]
#22 0x0078ed3d in -[_NSValueBinderPlugin 
applyObjectValue:forBinding:operation:needToRunAlert:error:]
#23 0x00ca9a4d in -[NSValueBinder 

Re: Puppeting/Automating one application from another?

2010-02-16 Thread Henry McGilton (Boulevardier)

On Feb 16, 2010, at 6:31 PM, James Trankelson wrote:

 Hi,
 
 I'm trying to figure out the general feasibility of the following task.
 
 Imagine I have two separate applications, running side by side. Is it
 possible to take all of the mouse/keyboard inputs that are going into
 one of these applications, and send them to the other in a way that
 would allow me to 'control' the other app from the events generated in
 the first? I took a few steps to begin creating an infrastructure to
 support this, but then became concerned that I'd soon have issues with
 focusing, like if pressing buttons in the 'puppeted' application would
 take away the focus in the application sending the events.
 
 Does anyone know if something like this is possible? If so, does
 anyone know of any applications that do this, or have any pointers
 that could help me with this?

The first thought off the top of my head was NSDistributedNotificationCenter.

Should be possible to flange up a mini-application to test the idea . . .

Cheers,
. . . . . . . .Henry

=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Dynamically populate a popup menu

2010-02-16 Thread Peter N Lewis
Is there any way to dynamically populate a popup menu on the fly (as it is 
exposed)?

For example, a popup menu that displayed the harddisk hierarchy would need this 
sort of thing - you wouldn't want the entire thing populated as soon as you 
click the popup menu, it would take forever and the user would never see most 
of it.

Can it be done by subclassing NSMenuItem etc?

The only alternative I can see would be some sort of custom control based on 
NSBrowser, but that would be a lot uglier for this sort of selection.

Thanks,
   Peter.

-- 
 Keyboard Maestro 4.0.2 now released!  Brand new interface!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Dynamically populate a popup menu

2010-02-16 Thread Graham Cox

On 17/02/2010, at 6:49 PM, Peter N Lewis wrote:

 Is there any way to dynamically populate a popup menu on the fly (as it is 
 exposed)?

Look into the NSMenuDelegate protocol. It has methods to do what you want.



--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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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