Re: NSDateFormatter strangeness

2008-11-18 Thread Nathan Kinsinger

On Nov 17, 2008, at 6:23 PM, Greg Hoover wrote:


I am using NSDateFormatter.  The code snippet included shows this.

Greg
On Nov 17, 2008, at 3:38 PM, Kyle Sluder wrote:


I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

"There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa)."

So, don't log NSDate objects, send them through an NSDateFormatter  
instead.


--Kyle Sluder


The method -[NSDateFormatter dateFromString:] returns an NSDate, which  
is what NSLog sees, which results in the problem that Kyle refers to.


First you need to create an NSDate that NSDateFormatter can then  
format into a string, like so:


NSLog(@"%@ -> %@", dateString, [dateFormatter stringFromDate:[NSDate  
dateWithNaturalLanguageString:dateString]]);



Hope that helps,
--Nathan





___

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 [EMAIL PROTECTED]


Which framework to use CGImage?

2008-11-18 Thread Jean-Nicolas Jolivet
What framework has to be linked/imported to use CGImages? I tried  
 but when I try to load an image using:


CGImageSourceRef source =  
CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);


I get the following error:
: CGImageSourceCreateWithURL failed with error code -15.


I am already importing  because I'm using  
CIImag, however, now I need to use CGImage and for some reason I can't  
get it to work...



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread Stefan Werner
Aren't port numbers 0-1023 privileged under Unix and therefore only to  
applications running as root? If you're running your application as a  
regular user, it can't open a listening socket on port 123. It should  
still be perfectly able to send requests to port 123 on other hosts  
and receive answers to those requests.


-Stefan

On Nov 17, 2008, at 1:40 PM, Gerriet M. Denkmann wrote:



I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.
On TIger there was a firewall, where I could open port 123 in System  
Preferences.


How can I do this in Leopard?

Kind regards,

Gerriet.

___

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/stewreo%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Which framework to use CGImage?

2008-11-18 Thread Jean-Nicolas Jolivet

Well, apparently it's not a framework problem since I can use:

CGImageSourceRef source =  
CGImageSourceCreateWithData((CFDataRef)tempData, NULL);


without a problem...

Any other reasons why CGImageSourceCreateWithURL would yield an error  
code -15???



On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:

What framework has to be linked/imported to use CGImages? I tried  
 but when I try to load an image using:


CGImageSourceRef source =  
CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);


I get the following error:
: CGImageSourceCreateWithURL failed with error code -15.


I am already importing  because I'm using  
CIImag, however, now I need to use CGImage and for some reason I  
can't get it to work...



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: Which framework to use CGImage?

2008-11-18 Thread Roland King
one possible .. |kCFURLImproperArgumentsError is defined as -15. Is the 
imgUrl ok? Can you send a Null dictionary to that function or should you 
send an empty one? |


Jean-Nicolas Jolivet wrote:


Well, apparently it's not a framework problem since I can use:

CGImageSourceRef source =  
CGImageSourceCreateWithData((CFDataRef)tempData, NULL);


without a problem...

Any other reasons why CGImageSourceCreateWithURL would yield an error  
code -15???



On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:

What framework has to be linked/imported to use CGImages? I tried  
 but when I try to load an image using:


CGImageSourceRef source =  CGImageSourceCreateWithURL( 
(CFURLRef)imgUrl, NULL);


I get the following error:
: CGImageSourceCreateWithURL failed with error code -15.


I am already importing  because I'm using  
CIImag, however, now I need to use CGImage and for some reason I  
can't get it to work...



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca 



This email sent to [EMAIL PROTECTED]



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/rols%40rols.org

This email sent to [EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Re: Which framework to use CGImage?

2008-11-18 Thread Jean-Nicolas Jolivet

Wait you might be onto something...

I was using [NSURL URLWithString]
instead of [NSURL fileURLWithPath]



On 18-Nov-08, at 3:35 AM, Roland King wrote:

one possible .. |kCFURLImproperArgumentsError is defined as -15. Is  
the imgUrl ok? Can you send a Null dictionary to that function or  
should you send an empty one? |


Jean-Nicolas Jolivet wrote:


Well, apparently it's not a framework problem since I can use:

CGImageSourceRef source =   
CGImageSourceCreateWithData((CFDataRef)tempData, NULL);


without a problem...

Any other reasons why CGImageSourceCreateWithURL would yield an  
error  code -15???



On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:

What framework has to be linked/imported to use CGImages? I tried   
 but when I try to load an image using:


CGImageSourceRef source =   
CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);


I get the following error:
: CGImageSourceCreateWithURL failed with error code -15.


I am already importing  because I'm  
using  CIImag, however, now I need to use CGImage and for some  
reason I  can't get it to work...



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/rols%40rols.org

This email sent to [EMAIL PROTECTED]





Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: Which framework to use CGImage?

2008-11-18 Thread Jean-Nicolas Jolivet
Yup... that was the problem... the URL was indeed bad... Thanks for  
the tip!


While I'm on the subject... I'm using CGImage because I read it would  
actually parse more EXIF tags than using NSBitmatImageRep's  
valueForProperty:@"NSImageEXIFData"


Just tested it... my initial image has like 50+ EXIF tags (camera  
specific tags etc etc...)


My resulting images (one using NSBitmapImageRep, the other using  
CGImage) both have 22 tags... so basically there is no advantage in  
using one over the other??


And isn't there a more efficient way of reading EXIF data? Not even  
half of the tags are read 


Jean-Nicolas Jolivet


On 18-Nov-08, at 3:41 AM, Jean-Nicolas Jolivet wrote:


Wait you might be onto something...

I was using [NSURL URLWithString]
instead of [NSURL fileURLWithPath]



On 18-Nov-08, at 3:35 AM, Roland King wrote:

one possible .. |kCFURLImproperArgumentsError is defined as -15. Is  
the imgUrl ok? Can you send a Null dictionary to that function or  
should you send an empty one? |


Jean-Nicolas Jolivet wrote:


Well, apparently it's not a framework problem since I can use:

CGImageSourceRef source =   
CGImageSourceCreateWithData((CFDataRef)tempData, NULL);


without a problem...

Any other reasons why CGImageSourceCreateWithURL would yield an  
error  code -15???



On 18-Nov-08, at 3:18 AM, Jean-Nicolas Jolivet wrote:

What framework has to be linked/imported to use CGImages? I  
tried   but when I try to load an image using:


CGImageSourceRef source =   
CGImageSourceCreateWithURL( (CFURLRef)imgUrl, NULL);


I get the following error:
: CGImageSourceCreateWithURL failed with error code -15.


I am already importing  because I'm  
using  CIImag, however, now I need to use CGImage and for some  
reason I  can't get it to work...



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/rols%40rols.org

This email sent to [EMAIL PROTECTED]





Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


core-data crash on save.

2008-11-18 Thread John Clayton

Hi All,

I've got a core-data relationship crash problem that I'd like to  
share, see if anyone out there has an idea of what I'm doing wrong.   
This is related to my recent question of knowing when an object is  
deleted (subject: core data - delete of object).


The relationship in my graph is a to-many, from a Layer to an Effect  
(layers have many effects).  Obviously, both Layer and Effect are  
derived from NSManagedObject.


In my program I have a check-box that switches a particular effect on/ 
off, an opacity fade in this case.  Switching the effect off will  
delete the effect from the core-data graph in the following manner:
	A - remove the effect object from the list of effects on the layer  
(using core-data generated set accessor method)
	B - delete the effect instance (using the managed object context  
deleteObject: method)


switching it on (via the checkbox) adds a new Effect instance back  
into the graph.  My requirements are, among other things:
 1 - when a layer effect is deleted, reflect the change immediately  
in the UI

 2 - don't orphan data objects in the DB

requirement #1 here is the interesting one.  If I DO NOT perform Step  
A, then I fail requirement #1, because step (B), while working - is  
'lazy' in the sense that I'll only see the delete at save time.  if I  
DO NOT perform step B, then I end up orphaning the effect object (fail  
on #2), but I do fullfil requirement #1.  I'd like to have both -  
however, if I perform both Step A and Step B, I crash on save (with  
what appears to be a double delete - i.e. msg send to a dead object) :


#0  0x92a8d688 in objc_msgSend
#1  0x92c147c0 in NSKVOPendingNotificationCreate
#2	0x92cc9b78 in -[NSObject(NSKeyValueObservingPrivate)  
_willChangeValuesForKeys:]

#3  0x9269bafb in -[NSFaultHandler turnObject:intoFaultWithContext:]
#4	0x92667596 in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_processRecentlyForgottenObjects:]
#5	0x92666177 in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_processRecentChanges:]

#6  0x92664e70 in -[NSManagedObjectContext executeFetchRequest:error:]
#7  0x9556786c in -[_NSManagedProxy fetchObjectsWithFetchRequest:error:]
#8	0x95409d2f in -[NSArrayController(NSManagedController)  
_performFetchWithRequest:merge:error:]
#9	0x95566d97 in -[NSObjectController(NSManagedController)  
fetchWithRequest:merge:error:]

#10 0x95567d9d in -[_NSManagedProxy _storesDidChange:]
#11 0x92b941da in _nsnote_callback
#12 0x96fa4aba in __CFXNotificationPost
#13 0x96fa4d93 in _CFXNotificationPostNotification
#14	0x92b91440 in -[NSNotificationCenter  
postNotificationName:object:userInfo:]
#15	0x9265d9eb in -[NSPersistentStoreCoordinator(_NSInternalMethods)  
_postStoresChangedNotificationsForStores:changeKey:options:]
#16	0x92652b40 in -[NSPersistentStoreCoordinator  
addPersistentStoreWithType:configuration:URL:options:error:]
#17	0x9557e35b in -[NSPersistentDocument  
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error 
:]
#18	0x3cdb in -[AnnotateDocument  
configurePersistentStoreCoordinatorForURL:ofType:modelConfiguration:storeOptions:error 
:] at AnnotateDocument.m:143
#19	0x9557f31d in - 
[NSPersistentDocument(NSPersistentDocumentDeprecated)  
configurePersistentStoreCoordinatorForURL:ofType:error:]
#20	0x9557e8e7 in -[NSPersistentDocument  
writeToURL:ofType:forSaveOperation:originalContentsURL:error:]

< ... snip ... >

Are there core-data debugging macros, goodies, command line switches,  
env variables or some other magic I can use to help find the problem  
here?


Thanks
--
John Clayton
Skype: johncclayton




___

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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread Gerriet M. Denkmann


On 17 Nov 2008, at 22:41, Derek Chesterfield wrote:


There shouldn't be anything to open.
The Leopard application firewall should automatically allow packets  
that are responding to your query.


Could you suggest anything else to try?


Andrew Farmer wrote:
Do you have network time synchronization turned on already (in the  
Date and Time prefpane)? The built-in ntpd uses that port, so you'll  
need to either disable that or use another port.


ntpd is turned off. (I just checked again in System Preferences).



On 17 Nov 2008, at 12:40, Gerriet M. Denkmann wrote:


I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.
On TIger there was a firewall, where I could open port 123 in  
System Preferences.


How can I do this in Leopard?


___

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 [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-18 Thread Brian Stern


On Nov 18, 2008, at 2:12 AM, Jonathan Hess wrote:

Which parts do you feel are contrary? I'm guessing it's that outlets  
with no setters are retained.


Yes, that's the root of the whole issue.  The fact is that outlets  
without setters that are retained aren't released by the code that  
retained them.  The responsibility for releasing them is implicitly  
passed on to some other code.  I misunderstood this after reading that  
paragraph a number of times because it is simply contrary to my  
understanding of Cocoa memory management.  I think it is contrary to  
the Cocoa memory management rules that the code that retains these  
objects isn't releasing them.


Now that I know that, there are still problems.  The outlets can be  
released in more than one place.  As mmalc mentioned, the view  
controller's view may be unloaded in response to a memory warning.   
However, the view won't be unloaded if the view controller is the  
frontmost view controller.  There's no simple way for a view  
controller subclass to know if it's the frontmost view controller or  
therefore if its view will be unloaded.  There is no viewDidUnload  
callback that would be the right place to release the outlets in this  
case.  The code that mmalc showed is not correct because it doesn't  
take into account the fact that the frontmost view controller won't  
unload its view.


In effect it is the UIViewController base class that is retaining the  
outlets, or causing them to be retained, when the nib is loaded.  But  
it abdicates responsibility for them.  The UIViewController base class  
is also the class that is releasing its view without any notification  
to the derived class that it should also release the outlets.


I haven't decided how I'm going to fix all this.  Either I'll add  
assign properties so the outlets are not retained or I'll release them  
all in viewDidLoad.


Most nib-loading on iPhone OS is done by UIViewController and I  
suppose most of my complaints above are with the UIViewController  
implementation.  In my code I would hardly ever have a reason to want  
to retain an outlet.  Having outlets be retained by default gives my  
code no benefit, and causes some complications.


--
Brian Stern
[EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


NSShadow

2008-11-18 Thread M Pulis

Folks,

I have an NSControl, in IB i've set a shadow and a color (green). it  
has an IBOutlet and is "hooked" up to my controller. When my app is  
run, the checkbox has a lovely green shadow. Go baby go


During runtime I want to change the shadow color - but am failing to  
do so. So, to simplify the logic...


In awake from nib I see the control (mCheckbox) is not nil, so I try  
to set the shadow color to black :


IBOutlet NSControl *mCheckBox;

/* awakefromnib */
NSShadow *aShadow = [mCheckbox shadow];
[aShadow setShadowColor:[[NSColor blackColor] colorWithAlphaComponent: 
1.0]];

[mCheckbox setShadow:aShadow];

No change. No errors. Nothing nil.

Looks like it makes sense to me... but... it does not work, so, I'm  
missing something... somewhere... should be obvious just not to me.


Been searching docs  and sample code bits (have not found an example  
of changing a shadow on a control) - trying foolish things - stuck.  
This has to be simpler than the two hours spent getting this far.


Thanks!

Gary
___

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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread M Pulis
I seem to recall reading somewhere Apple recommending apps not using  
low port numbers to maintain compatibility.


You may want to consider using a different port - unless you are  
implementing a ntp.


At least test with a different (high range) port number. If it  
works... well, OSX could (finally) be keeping "123" for itself (or an  
ntp task) in the event that date & time _might_ be turned on at some  
time. Tiger may have allowed it, but not as a good idea.


You could try a port scan to see if something else is using 123.

Do you get an error opening 123?

Gary

On Nov 18, 2008, at 12:16 AM, Gerriet M. Denkmann wrote:



On 17 Nov 2008, at 22:41, Derek Chesterfield wrote:


There shouldn't be anything to open.
The Leopard application firewall should automatically allow  
packets that are responding to your query.


Could you suggest anything else to try?


Andrew Farmer wrote:
Do you have network time synchronization turned on already (in the  
Date and Time prefpane)? The built-in ntpd uses that port, so  
you'll need to either disable that or use another port.


ntpd is turned off. (I just checked again in System Preferences).



On 17 Nov 2008, at 12:40, Gerriet M. Denkmann wrote:


I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.
On TIger there was a firewall, where I could open port 123 in  
System Preferences.


How can I do this in Leopard?


___

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/toothpic%40fastq.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Graceful Shutdown on an Unsupported Earlier Mac OS Version

2008-11-18 Thread Oleg Krupnov
While it is not my intention to support previous versions of Mac OS,
I'd like my users be informed politely that the latest OS version is
required and the application shut down gracefully.

What is the recommended way to do this?

Basically it boils down to 2 questions:

1) How do I query the current OS version in Cocoa?

2) Will my code even have the opportunity to check the OS version, or
an error will occur on the stage of loading and reported by the OS
loader, before a single line of my code gets executed? I'm asking this
because this would be the case on Windows when the required statically
linked DLLs, are missing or have incorrect version.

I do not have any previous version of Mac OS at my disposal, so I
can't test what happens. I wish Mac OS X is smart enough to take care
of the problem without the need of any coding. I want to make sure.
___

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 [EMAIL PROTECTED]


RE: Crash in AppKit/CoreFoundation?

2008-11-18 Thread Etienne Guérard
The __CFXNotificationSendToServer symbol in the call stack means that you have 
an NSNotification somewhere in your code that cause some plist serialization. 
This is were I would look for trashed objects.
Some of your code function might not appear in a call stack for optimization 
reason.
Also try using malloc debug and/or NSZombieEnabled to help you prevent this 
kind of problem.

EG

-Original Message-

Thread 0 Crashed:
0   com.apple.CoreFoundation 0x907d2db8 __CFDictionaryGrow + 704
1   com.apple.CoreFoundation 0x907ee34c __CFBinaryPlistWriteToStream 
+ 208
2   com.apple.CoreFoundation 0x907f5b14 
__CFXNotificationSendToServer + 324
3   com.apple.CoreFoundation 0x9081d284 _CFXNotificationSetSuspended 
+ 248
4   com.apple.AppKit 0x937dc914 -[NSApplication sendEvent:] 
+ 1084
5   com.apple.AppKit 0x939e1980 _NXFinishActivation + 244
6   com.apple.AppKit 0x93833f90 -[NSWindow sendEvent:] + 3256
7   com.apple.AppKit 0x937dd524 -[NSApplication sendEvent:] 
+ 4172
8   com.apple.AppKit 0x937d4960 -[NSApplication run] + 508
9   com.apple.AppKit 0x938c5458 NSApplicationMain + 452
10  com.YSPf.StretchFix  0x2af8 _start + 760
11  com.YSPf.StretchFix  0x27fc start + 48


This message and any attachments (the "message") are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le "message") sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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 [EMAIL PROTECTED]


NSTextView's -setTextContainerInset: and rightmost ruler margin

2008-11-18 Thread Keith Blount
Hi,

Either there's a bug in the text system or I'm not doing something right. I'm 
using NSTextView's -setTextContainerInset: to set margins around my text area. 
However, this seems to cause a bug in the ruler whereby the tail indent ruler 
marker (the downward arrow on the right) gets drawn in the wrong place for 
large margins. This is easy to see:

1) Create a new project with just a text view in it.
2) On program start, call

[textView setTextContainerInset:NSMakeSize(100,100)];
[textView setRulerVisible:YES];

You can see how this looks here:

http://www.literatureandlatte.com/misc/TailIndentBug.jpg

It seems that the tail indent gets drawn 200 pixels in from the right rather 
than the 100 pixels that the container inset is set to. You can drag it over to 
the right again, so the area is still active, it just gets put in the wrong 
place to begin with.

So, before I submit a bug report on this, my question is: is there something 
else I need to do to ensure the ruler works properly when using a text 
container inset?

Thanks in advance and all the best,
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 [EMAIL PROTECTED]


RE: Graceful Shutdown on an Unsupported Earlier Mac OS Version

2008-11-18 Thread Etienne Guérard
See http://homepage.mac.com/chris_campbell/blog/SystemVersionCheck-1.1.html for 
a discussion and a solution to this problem.

EG

-Original Message-
While it is not my intention to support previous versions of Mac OS,
I'd like my users be informed politely that the latest OS version is
required and the application shut down gracefully.

What is the recommended way to do this?

Basically it boils down to 2 questions:

1) How do I query the current OS version in Cocoa?

2) Will my code even have the opportunity to check the OS version, or
an error will occur on the stage of loading and reported by the OS
loader, before a single line of my code gets executed? I'm asking this
because this would be the case on Windows when the required statically
linked DLLs, are missing or have incorrect version.

I do not have any previous version of Mac OS at my disposal, so I
can't test what happens. I wish Mac OS X is smart enough to take care
of the problem without the need of any coding. I want to make sure.

This message and any attachments (the "message") are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le "message") sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread Gerriet M. Denkmann


On 18 Nov 2008, at 15:27, Stefan Werner wrote:

Aren't port numbers 0-1023 privileged under Unix and therefore only  
to applications running as root? If you're running your application  
as a regular user, it can't open a listening socket on port 123. It  
should still be perfectly able to send requests to port 123 on other  
hosts and receive answers to those requests.


That is exactly what I am trying to do (and which worked perfectly on  
Tiger): send some message on port 123 (to some ntp server) and receive  
an answer.

On Leopard I send, but never get an answer.
It does not seem to be an endian issue (the running version was last  
tested on a Tiger iBook ppc) - both intel and ppc produce the same 48  
byte packages.


I really don't know what to try next.

Kind regards,

Gerriet.

___

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 [EMAIL PROTECTED]


Re: Crash in AppKit/CoreFoundation?

2008-11-18 Thread Mike Abdullah
A crash in _CFDictionaryGrow suggests to me that your app has used up  
all the memory available to it. Does anything in your user's console  
log indicate this? If you're doing batch operations on a background  
thread, are you sure it's managing its memory properly?


On 18 Nov 2008, at 03:30, Kevin Dixon wrote:

I recently released a universal binary to beta testers. My  
application does offline batch processing on audio files, using the  
Audio Units framework. In general, the process takes about 5 minutes  
per file, so I do this work in a separate thread. One of my users  
reported that the application crashed while about half way through  
the 15th file (of 24). He was able to resume his batch from that  
file, and complete it successfully.


I have not been able to make heads or tails of this crash dump  
(below). I was hoping someone could point me in the right direction.  
It appears that none of it is really my code. What is the start/ 
_start method? Some sort of auto-generated entry point? The  
application is in Objective-C++.
My tester has a PPC mac, and I an Intel (so this crash happened on  
PPC).


Thanks in advance!

-Kevin


Exception:  EXC_BREAKPOINT (0x0006)
Code[0]:0x0001
Code[1]:0x907d2db8


Thread 0 Crashed:
0   com.apple.CoreFoundation 0x907d2db8 __CFDictionaryGrow + 704
1   com.apple.CoreFoundation 0x907ee34c  
__CFBinaryPlistWriteToStream + 208
2   com.apple.CoreFoundation 0x907f5b14  
__CFXNotificationSendToServer + 324
3   com.apple.CoreFoundation 0x9081d284  
_CFXNotificationSetSuspended + 248
4   com.apple.AppKit 0x937dc914 -[NSApplication  
sendEvent:] + 1084

5   com.apple.AppKit 0x939e1980 _NXFinishActivation + 244
6   com.apple.AppKit 0x93833f90 -[NSWindow sendEvent:] +  
3256
7   com.apple.AppKit 0x937dd524 -[NSApplication  
sendEvent:] + 4172

8   com.apple.AppKit 0x937d4960 -[NSApplication run] + 508
9   com.apple.AppKit 0x938c5458 NSApplicationMain + 452
10  com.YSPf.StretchFix  0x2af8 _start + 760
11  com.YSPf.StretchFix  0x27fc start + 48

Thread 1:
0   libSystem.B.dylib0x9002c3c8  
semaphore_wait_signal_trap + 8

1   libSystem.B.dylib0x90030eac pthread_cond_wait + 480
2   com.apple.Foundation 0x92bfc284 -[NSConditionLock  
lockWhenCondition:] + 68
3   com.apple.AppKit 0x93875358 -[NSUIHeartBeat  
_heartBeatThread:] + 324
4   com.apple.Foundation 0x92bf5118 forkThreadForFunction +  
108

5   libSystem.B.dylib0x9002bd08 _pthread_body + 96
___

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/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread M Pulis

Stabbing in the dark here...

Has the "some message" format now changed with Leopard? Any unused  
fields that must now be zero? Any subtle changes to the protocol?


More things to try:

You can file a bug report with Apple.

As a last resort - buy an apple DTS  incident. $200 and you have  
Apple's ear.


Best of luck.

Gary

On Nov 18, 2008, at 2:49 AM, Gerriet M. Denkmann wrote:



On 18 Nov 2008, at 15:27, Stefan Werner wrote:

Aren't port numbers 0-1023 privileged under Unix and therefore  
only to applications running as root? If you're running your  
application as a regular user, it can't open a listening socket on  
port 123. It should still be perfectly able to send requests to  
port 123 on other hosts and receive answers to those requests.


That is exactly what I am trying to do (and which worked perfectly  
on Tiger): send some message on port 123 (to some ntp server) and  
receive an answer.

On Leopard I send, but never get an answer.
It does not seem to be an endian issue (the running version was  
last tested on a Tiger iBook ppc) - both intel and ppc produce the  
same 48 byte packages.


I really don't know what to try next.

Kind regards,

Gerriet.

___

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/toothpic%40fastq.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: core data - delete of object.

2008-11-18 Thread Ashley Clark
According to the documentation and to my quick test, the  
NSManagedObjectContextObjectsDidChangeNotification is sent during  
processPendingChanges. At the very least that happens at the end of  
every event loop automatically. Even if you've bypassed your event  
loop somehow you can still call processPendingChanges on your context  
yourself after your object deletion and have it do whatever extra  
processing you need.


ie.

NSManagedObjectContext *context = [theObject managedObjectContext];
[context deleteObject:theObject];
[context processPendingChanges];


Ashley


On Nov 18, 2008, at 12:54 AM, John Clayton wrote:

Thanks Jim, unfortunately all occur either at pre-save or save time,  
which is too late.


I'm basically looking to restore some state on an object at time of  
deletion, e.g.


if A is associated with B via a to-many relationship from A->B, then  
when one instance of B is deleted - we need to change a property on A.



On 17/11/2008, at 10:59 PM, Jim Correia wrote:


On Nov 17, 2008, at 4:51 PM, John Clayton wrote:

I'm using core-data and need to know when a particular core-data  
object (derived from NSManagedObject of course) is about to be  
deleted.   I'm deleting objects simply by using the managed object  
context's deleteObject method, like this:

[[theObject managedObjectContext] deleteObject:theObject];

Is there a way to be notified immediately of the delete?  I need  
to know immediately, not only when the context is saved.  Am I  
missing something painfully obvious here?


now, I could of course put a 'deleteThisObject' method onto the  
class I'm deleting, but isn't there a core-data way to handle this?


I've tried catching the  
NSManagedObjectContextObjectsDidChangeNotification notification -  
but that only fires on context saves, same with the  
willTurnIntoFault method as well as the dealloc - all these  
methods are only ever called when the context is being saved -  
which in my case is (a) unpredictable, (b) too late .


Is -validateForDelete: time too late? If not, that's an option.

You can also try

[context deleteObject: object];
[context processPendingChanges];

... handle notification ...

[context save: &error];


___

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 [EMAIL PROTECTED]


Take picture with iSight?

2008-11-18 Thread Tim Andersson

Hi there.

I'm looking for a way to take a picture with an iSight or any external  
camera in my Cocoa-application. I've been googling and searching the  
archives without success. I've also looked at the QTCaptureWidget and  
QTRecorder samplecode to see if there's anything I could use, but they  
only show how to record movies with the camera.
I understand that I have to use the QT-framework, but could somebody  
please give me some pointers in the right direction?


Kind regards,
Tim Andersson
___

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread Graham Cox

If you don't need to support pre-Leopard, check out IKPictureTaker

cheers, Graham




On 18 Nov 2008, at 11:25 pm, Tim Andersson wrote:


Hi there.

I'm looking for a way to take a picture with an iSight or any  
external camera in my Cocoa-application. I've been googling and  
searching the archives without success. I've also looked at the  
QTCaptureWidget and QTRecorder samplecode to see if there's anything  
I could use, but they only show how to record movies with the camera.
I understand that I have to use the QT-framework, but could somebody  
please give me some pointers in the right direction?


Kind regards,
Tim Andersson
___

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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread Tim Andersson


Sorry, forgot to say that I have looked at the IKPictureTaker and it  
isn't really what I'm looking for. I don't want the user to be able to  
choose a picture or anything like that, I just want to take a picture  
when the user clicks a button for example or when I call a method in  
my code. Is this possible?


I don't need to support pre-Leopard.

Cheers,
Tim

18 nov 2008 kl. 13.31 skrev Graham Cox:


If you don't need to support pre-Leopard, check out IKPictureTaker

cheers, Graham




On 18 Nov 2008, at 11:25 pm, Tim Andersson wrote:


Hi there.

I'm looking for a way to take a picture with an iSight or any  
external camera in my Cocoa-application. I've been googling and  
searching the archives without success. I've also looked at the  
QTCaptureWidget and QTRecorder samplecode to see if there's  
anything I could use, but they only show how to record movies with  
the camera.
I understand that I have to use the QT-framework, but could  
somebody please give me some pointers in the right direction?


Kind regards,
Tim Andersson
___

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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]




___

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 [EMAIL PROTECTED]


Re: core data - delete of object.

2008-11-18 Thread John Clayton
I guess processPendingChanges is only called if there is an  
undoManager? Correct?  I don't have one - I disabled it intentionally.


I've tried that notification, its only fired on save of the context.

Thanks
--
John Clayton
Skype: johncclayton




On 18/11/2008, at 1:22 PM, Ashley Clark wrote:

According to the documentation and to my quick test, the  
NSManagedObjectContextObjectsDidChangeNotification is sent during  
processPendingChanges. At the very least that happens at the end of  
every event loop automatically. Even if you've bypassed your event  
loop somehow you can still call processPendingChanges on your  
context yourself after your object deletion and have it do whatever  
extra processing you need.


ie.

NSManagedObjectContext *context = [theObject managedObjectContext];
[context deleteObject:theObject];
[context processPendingChanges];


Ashley


On Nov 18, 2008, at 12:54 AM, John Clayton wrote:

Thanks Jim, unfortunately all occur either at pre-save or save  
time, which is too late.


I'm basically looking to restore some state on an object at time of  
deletion, e.g.


if A is associated with B via a to-many relationship from A->B,  
then when one instance of B is deleted - we need to change a  
property on A.



On 17/11/2008, at 10:59 PM, Jim Correia wrote:


On Nov 17, 2008, at 4:51 PM, John Clayton wrote:

I'm using core-data and need to know when a particular core-data  
object (derived from NSManagedObject of course) is about to be  
deleted.   I'm deleting objects simply by using the managed  
object context's deleteObject method, like this:

[[theObject managedObjectContext] deleteObject:theObject];

Is there a way to be notified immediately of the delete?  I need  
to know immediately, not only when the context is saved.  Am I  
missing something painfully obvious here?


now, I could of course put a 'deleteThisObject' method onto the  
class I'm deleting, but isn't there a core-data way to handle this?


I've tried catching the  
NSManagedObjectContextObjectsDidChangeNotification notification -  
but that only fires on context saves, same with the  
willTurnIntoFault method as well as the dealloc - all these  
methods are only ever called when the context is being saved -  
which in my case is (a) unpredictable, (b) too late .


Is -validateForDelete: time too late? If not, that's an option.

You can also try

[context deleteObject: object];
[context processPendingChanges];

... handle notification ...

[context save: &error];



___

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread M Pulis

You've looked at QTKit.h with its QTCapture classes?

Gary



On Nov 18, 2008, at 5:38 AM, Tim Andersson wrote:



Sorry, forgot to say that I have looked at the IKPictureTaker and  
it isn't really what I'm looking for. I don't want the user to be  
able to choose a picture or anything like that, I just want to take  
a picture when the user clicks a button for example or when I call  
a method in my code. Is this possible?


I don't need to support pre-Leopard.

Cheers,
Tim

18 nov 2008 kl. 13.31 skrev Graham Cox:


If you don't need to support pre-Leopard, check out IKPictureTaker

cheers, Graham




On 18 Nov 2008, at 11:25 pm, Tim Andersson wrote:


Hi there.

I'm looking for a way to take a picture with an iSight or any  
external camera in my Cocoa-application. I've been googling and  
searching the archives without success. I've also looked at the  
QTCaptureWidget and QTRecorder samplecode to see if there's  
anything I could use, but they only show how to record movies  
with the camera.
I understand that I have to use the QT-framework, but could  
somebody please give me some pointers in the right direction?


Kind regards,
Tim Andersson
___

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/graham.cox% 
40bigpond.com


This email sent to [EMAIL PROTECTED]




___

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/toothpic%40fastq.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread Graham Cox


On 18 Nov 2008, at 11:38 pm, Tim Andersson wrote:



Sorry, forgot to say that I have looked at the IKPictureTaker and it  
isn't really what I'm looking for. I don't want the user to be able  
to choose a picture or anything like that, I just want to take a  
picture when the user clicks a button for example or when I call a  
method in my code. Is this possible?


I don't need to support pre-Leopard.



A cursory scan of the docs suggests to me that a good place to start  
looking would be QTCaptureDecompressedVideoOutput. This sends a  
CVBufferRef to the delegate during capture, and there are methods  
associated with that class to get basic information such as base  
address, row bytes, height and so on, which would allow you to wrap  
that buffer in a NSBitMapImageRep and from there to an NSImage and so  
on


So, that's probably what I'd be initially pursuing if it were me, but  
take that with a pinch of salt as I might be way off.


hth,

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread Tim Andersson
Yay, thanks to you I found a tutorial showing me how to do what Graham  
mentioned. :) I didn't know how to look inside QTKit.h, so I googled  
"QTKit.h" and I found the tutorial -> http://developer.apple.com/documentation/QuickTime/Conceptual/QTKitCaptureProgrammingGuide/Introduction/chapter_1_section_1.html


Thanks for your help guys :)

Cheers,
Tim

18 nov 2008 kl. 14.05 skrev M Pulis:


You've looked at QTKit.h with its QTCapture classes?

Gary



On Nov 18, 2008, at 5:38 AM, Tim Andersson wrote:



Sorry, forgot to say that I have looked at the IKPictureTaker and  
it isn't really what I'm looking for. I don't want the user to be  
able to choose a picture or anything like that, I just want to take  
a picture when the user clicks a button for example or when I call  
a method in my code. Is this possible?


I don't need to support pre-Leopard.

Cheers,
Tim

18 nov 2008 kl. 13.31 skrev Graham Cox:


If you don't need to support pre-Leopard, check out IKPictureTaker

cheers, Graham




On 18 Nov 2008, at 11:25 pm, Tim Andersson wrote:


Hi there.

I'm looking for a way to take a picture with an iSight or any  
external camera in my Cocoa-application. I've been googling and  
searching the archives without success. I've also looked at the  
QTCaptureWidget and QTRecorder samplecode to see if there's  
anything I could use, but they only show how to record movies  
with the camera.
I understand that I have to use the QT-framework, but could  
somebody please give me some pointers in the right direction?


Kind regards,
Tim Andersson
___

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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]




___

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/toothpic%40fastq.com

This email sent to [EMAIL PROTECTED]




___

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 [EMAIL PROTECTED]


Re: Take picture with iSight?

2008-11-18 Thread M Pulis

I use the delegate:

-(CIImage *) view:(QTCaptureView *)view willDisplayImage : (CIImage *) 
image


to grab a frame and bypass the basics. I found it straightforward to  
transform and filter the frame as needed.


Found the technique in Apple sample code - forget which one now...  
core image, core filters and nstransforms, qt .. all blurring a bit.


Gary



On Nov 18, 2008, at 6:14 AM, Graham Cox wrote:



On 18 Nov 2008, at 11:38 pm, Tim Andersson wrote:



Sorry, forgot to say that I have looked at the IKPictureTaker and  
it isn't really what I'm looking for. I don't want the user to be  
able to choose a picture or anything like that, I just want to  
take a picture when the user clicks a button for example or when I  
call a method in my code. Is this possible?


I don't need to support pre-Leopard.



A cursory scan of the docs suggests to me that a good place to  
start looking would be QTCaptureDecompressedVideoOutput. This sends  
a CVBufferRef to the delegate during capture, and there are methods  
associated with that class to get basic information such as base  
address, row bytes, height and so on, which would allow you to wrap  
that buffer in a NSBitMapImageRep and from there to an NSImage and  
so on


So, that's probably what I'd be initially pursuing if it were me,  
but take that with a pinch of salt as I might be way off.


hth,

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/toothpic%40fastq.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-18 Thread Erik Buck
If you write correct accessors for all outlets, then the retain/release memory 
management is entirely handled in one method.  the -set retains the new value 
and releases the old value.
 
Any confusion regarding memory management for IB outlets seems to stem from 
failure to write the accessors and reliance on syntactic sugar.  Just remember 
that 
 
@property (nonatomic, retain) IBOutlet UILabel *label;
 
results in synthesis of the appropriate accessor methods.  It does nothing more 
than save you some typing and document your intention.  The -set method that 
results from the above property declaration retains the new value and releases 
the old value.  The memory management is therefore all handled in one place 
just the way it should be and the way you want.
 
So what's the problem again ?
___

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 [EMAIL PROTECTED]


Re: Regex

2008-11-18 Thread Dave DeLong

To get it to compile you need to do two things:
1.  Add the "Other Linker Flag" "-licucore" to your project build  
settings
2.  Import the RKL header into whatever files you'll use it in  
(alternatively, you can import it into your .pch file so that it will  
get included into everything automatically)


HTH,

Dave

On 17 Nov, 2008, at 10:33 PM, Mr. Gecko wrote:

I never was able to compile RegexKitLite for some reason, and when I  
use the framework it says warning: 'NSString' may not respond to '- 
arrayByMatchingObjectsWithRegex:' and when I run the code it gives  
me this in the debug
*** -[NSCFString arrayByMatchingObjectsWithRegex:]: unrecognized  
selector sent to instance 0x872c00

Any help?

Thanks,
Mr. Gecko

___

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 [EMAIL PROTECTED]


Re: Opening Ports in Leopard

2008-11-18 Thread Michael Ash
On Tue, Nov 18, 2008 at 4:49 AM, Gerriet M. Denkmann
<[EMAIL PROTECTED]> wrote:
>
> On 18 Nov 2008, at 15:27, Stefan Werner wrote:
>
>> Aren't port numbers 0-1023 privileged under Unix and therefore only to
>> applications running as root? If you're running your application as a
>> regular user, it can't open a listening socket on port 123. It should still
>> be perfectly able to send requests to port 123 on other hosts and receive
>> answers to those requests.
>
> That is exactly what I am trying to do (and which worked perfectly on
> Tiger): send some message on port 123 (to some ntp server) and receive an
> answer.
> On Leopard I send, but never get an answer.
> It does not seem to be an endian issue (the running version was last tested
> on a Tiger iBook ppc) - both intel and ppc produce the same 48 byte
> packages.
>
> I really don't know what to try next.

Use Wireshark or another sniffer of your choice to find out what's
actually happening on the network.

You have too many variables right now. Did it get sent? Did a reply
get sent? Did your computer block the reply, or the sending, or did
the remote computer not like it, or...? Wireshark will tell you what
is actually happening so you don't have to guess, and then at that
point hopefully the solution will come more easily.

Mike
___

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 [EMAIL PROTECTED]


Re: Graceful Shutdown on an Unsupported Earlier Mac OS Version

2008-11-18 Thread Nick Zitzmann


On Nov 18, 2008, at 2:37 AM, Oleg Krupnov wrote:


1) How do I query the current OS version in Cocoa?


Gestalt(). See Gestalt.h for details.


2) Will my code even have the opportunity to check the OS version, or
an error will occur on the stage of loading and reported by the OS
loader, before a single line of my code gets executed?



Just use the LSMinimumSystemVersion Info plist key to set the minimum  
OS version; then you won't have to do any work. The only problem with  
this approach is it won't work in Cheetah and Puma, and won't work  
correctly in Panther, but few people use the former two OS versions  
anymore, and the latter is no longer a big deal.


Nick Zitzmann




___

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 [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-18 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 8:23 PM, Greg Hoover <[EMAIL PROTECTED]> wrote:
> I am using NSDateFormatter.  The code snippet included shows this.

No, you're not.  Your third argument to NSLog is an NSDate object.
NSLog will call -description on it to get a textual representation.

--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 [EMAIL PROTECTED]


Re: NSTextView's -setTextContainerInset: and rightmost ruler margin

2008-11-18 Thread Ross Carter


On Nov 18, 2008, at 5:05 AM, Keith Blount wrote:

Either there's a bug in the text system or I'm not doing something  
right. I'm using NSTextView's -setTextContainerInset: to set margins  
around my text area. However, this seems to cause a bug in the ruler  
whereby the tail indent ruler marker (the downward arrow on the  
right) gets drawn in the wrong place for large margins. This is easy  
to see:


I wonder if this is what the documentation refers to when it says, "It  
is possible to set the text container and view sizes and resizing  
behavior so that the inset cannot be maintained exactly, although the  
text system tries to maintain the inset wherever possible."


Would it perhaps be better to set the text container size and origin  
directly?

___

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 [EMAIL PROTECTED]


Re: Fetch value from field editor during editing?

2008-11-18 Thread Russ
Yeah, I had one of these. Problem was, I needed two. I had the one set up using 
Target/Action instead of delegate. With the two  separate flavors, much 
cheerier now. Thanks.



- Original Message 
From: Wayne Packard <[EMAIL PROTECTED]>
To: Russ <[EMAIL PROTECTED]>
Cc: cocoa-dev@lists.apple.com
Sent: Tuesday, November 18, 2008 1:48:09 AM
Subject: Re: Fetch value from field editor during editing?

There is a way. It works great. We (and by we, I mean the documentation) call 
it controlTextDidChange:.

Create a method like this:

- (void)controlTextDidChange:(NSNotification *)aNotification
{
NSTextField* field = [aNotification object];

NSLog([field stringValue]);

if ([[field stringValue] caseInsensitiveCompare:@"aircraft carrier"] == 
NSOrderedSame)
{
[field setStringValue:@"rowboat"];
}
}

Set the class containing this method as the delegate of the NSTextField. Run 
the app and type something in the field. Notice that each character will be 
logged as it is typed.  Type aircraft carrier. Notice that the field now 
contains rowboat.

wp


On Nov 17, 2008, at 7:17 PM, Russ wrote:

> Nice try, but that definitely doesn't affect typing. According to the docs, 
> it affects mouse tracking.
> 
> NSTextField: why use the rowboat you need, when you can use an aircraft 
> carrier instead.
> 
> Still no way to find the text editor value while it is editing, or receive 
> notifications as the value changes.
> 
> 
> - Original Message 
> Sent: Monday, November 17, 2008 10:52:46 AM
> Subject: Re: Fetch value from field editor during editing?
> 
> On Mon, Nov 17, 2008 at 10:41 AM, Russ wrote:
>> 
>> Any ideas on why the field editor doesn't report the value as it is being 
>> edited?
> 
>  NSTextField is a subclass of NSControl. NSControl provides the
> -isContinuous / -setContinuous: methods. Try reading up on those ...
> 
> --
> I.S.
> 
> 
> 
> 
> ___
> 
> 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/wpackard%40mac.com
> 
> This email sent to [EMAIL PROTECTED]


  
___

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 [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-18 Thread Greg Hoover

Ok, I buy that, but then what's the problem here:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @"dd/MM/"];
NSString *str = @"3/10/2008"; 
	NSLog(@"[EMAIL PROTECTED]@\r%@", str, [formatter dateFromString: str], [formatter  
stringFromDate: [formatter dateFromString: str]]);

[formatter release];

This code uses the formatter both directions but prints out the  
following:


3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to  
date.  Is there an issue with creating static NSDateFormatters?  Its  
curious because some of the date formatters in my app work as  
expected, others do not.


Greg

On Nov 18, 2008, at 12:06 AM, Nathan Kinsinger wrote:


On Nov 17, 2008, at 6:23 PM, Greg Hoover wrote:


I am using NSDateFormatter.  The code snippet included shows this.

Greg
On Nov 17, 2008, at 3:38 PM, Kyle Sluder wrote:


I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

"There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa)."

So, don't log NSDate objects, send them through an NSDateFormatter  
instead.


--Kyle Sluder


The method -[NSDateFormatter dateFromString:] returns an NSDate,  
which is what NSLog sees, which results in the problem that Kyle  
refers to.


First you need to create an NSDate that NSDateFormatter can then  
format into a string, like so:


NSLog(@"%@ -> %@", dateString, [dateFormatter stringFromDate:[NSDate  
dateWithNaturalLanguageString:dateString]]);



Hope that helps,
--Nathan







___

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 [EMAIL PROTECTED]


Re: CMGetImageSpace() replacement?

2008-11-18 Thread David Duncan

On Nov 17, 2008, at 4:28 PM, Randall Meadows wrote:

The code I'm working on uses CMGetImageSpace(), which is deprecated  
in 10.5, but the docs don't suggest anything to use in its stead.



From the looks of the docs, it seems that the replacement is to use  
ImageIO and Core Graphics to load the image and query its color space.

--
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 [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-18 Thread Simon Wolf

On 18 Nov 2008, at 17:06, Greg Hoover wrote:


Ok, I buy that, but then what's the problem here:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @"dd/MM/"];
NSString *str = @"3/10/2008"; 
	NSLog(@"[EMAIL PROTECTED]@\r%@", str, [formatter dateFromString: str],  
[formatter stringFromDate: [formatter dateFromString: str]]);

[formatter release];

This code uses the formatter both directions but prints out the  
following:


3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to  
date.  Is there an issue with creating static NSDateFormatters?  Its  
curious because some of the date formatters in my app work as  
expected, others do not.


Set your date format string to "dd/MM/"

[formatter setDateFormat: @"dd/MM/"];

Simon Wolf

Cocoa Blog: http://www.ottersoftware.com/developer//developer/
Twitter: http://www.twitter.com/sgaw
___

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 [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-18 Thread Greg Hoover

Wow!  That totally fixed it. Thank you.  Wow do I feel dumb!

Greg

On Nov 18, 2008, at 9:28 AM, Simon Wolf wrote:


On 18 Nov 2008, at 17:06, Greg Hoover wrote:


Ok, I buy that, but then what's the problem here:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @"dd/MM/"];
NSString *str = @"3/10/2008"; 
	NSLog(@"[EMAIL PROTECTED]@\r%@", str, [formatter dateFromString: str],  
[formatter stringFromDate: [formatter dateFromString: str]]);

[formatter release];

This code uses the formatter both directions but prints out the  
following:


3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to  
date.  Is there an issue with creating static NSDateFormatters?   
Its curious because some of the date formatters in my app work as  
expected, others do not.


Set your date format string to "dd/MM/"

[formatter setDateFormat: @"dd/MM/"];

Simon Wolf

Cocoa Blog: http://www.ottersoftware.com/developer//developer/
Twitter: http://www.twitter.com/sgaw


___

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 [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-18 Thread Brian Stern


On Nov 18, 2008, at 9:15 AM, Erik Buck wrote:

If you write correct accessors for all outlets, then the retain/ 
release memory management is entirely handled in one method.  the - 
set retains the new value and releases the old value.


Any confusion regarding memory management for IB outlets seems to  
stem from failure to write the accessors and reliance on syntactic  
sugar.  Just remember that


@property (nonatomic, retain) IBOutlet UILabel *label;

results in synthesis of the appropriate accessor methods.  It does  
nothing more than save you some typing and document your intention.   
The -set method that results from the above property declaration  
retains the new value and releases the old value.  The memory  
management is therefore all handled in one place just the way it  
should be and the way you want.


So what's the problem again ?


OK Erik, I'll bite.  What you describe above is correct as far as it  
goes.  However, when you say all the memory management is handled in  
one place, of course it's two.  The object has to be released.  The  
normal place to release objects is in their owner's dealloc method,  
and this also applies to outlets.


However, UIViewController has the ability to unload its view outlet in  
response to a memory warning.  Any subclass should also release its  
outlets in response to the memory warning, if the base class releases  
its view, but not otherwise.  So now there are three places to manage  
the memory of these outlets. The problem is that the base class  
doesn't always release its view in response to a memory warning and as  
far as I can tell the subclass has no clean way of telling if the view  
will be released or has been released.  That's the problem.


--
Brian Stern
[EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Re: Regex

2008-11-18 Thread Mr. Gecko

Here is what I am trying now.

NSString *recived = [[NSString alloc] initWithData:receivedData  
encoding:NSUTF8StringEncoding];
RKRegex *regex = [RKRegex regexWithRegexString:@"/]*href=(\"??) 
([^\" >]*?)\\1[^>]*>.*<\\/a>/siU" options:RKCompileNoOptions];

RKEnumerator *recivedE = [recived matchEnumeratorWithRegex:regex];
while([recivedE nextRanges] != NULL) {
NSRange matchRange = [recivedE currentRange];
NSString *link = [recived substringWithRange:matchRange];
NSLog(@"%@", link);
}

It doesn't work. I get this in the debug terminal.
CFPropertyListCreateFromXMLData(): Old-style plist parser: missing  
semicolon in dictionary.

0xffe48 [RKRegex regexWithRegexString:options:]: (formatString is NULL)

I don't know what can be happening or why they don't have example code.

Thanks for any help,
Mr. Gecko

On Nov 17, 2008, at 11:33 PM, Mr. Gecko wrote:

I never was able to compile RegexKitLite for some reason, and when I  
use the framework it says warning: 'NSString' may not respond to '- 
arrayByMatchingObjectsWithRegex:' and when I run the code it gives  
me this in the debug
*** -[NSCFString arrayByMatchingObjectsWithRegex:]: unrecognized  
selector sent to instance 0x872c00

Any help?

Thanks,
Mr. Gecko

On Nov 17, 2008, at 10:09 PM, [EMAIL PROTECTED] wrote:




gives



Which lists lots of information.

I've used RegexKitLite which works well on Mac OS X.  RegexKit  
appears to have forked in to two variants:


The original RegexKit which does not seem to be getting further  
development (since the start of 2008) which uses PCRE 7.6


And the newer RegexKitLite which appears to be getting the bulk of  
development now, which uses the ICU library which is shipped with  
Mac OS X (but not public on iPhone).


Enjoy,
  Peter.




___

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 [EMAIL PROTECTED]


Re: core-data crash on save.

2008-11-18 Thread Quincey Morris

On Nov 18, 2008, at 00:27, John Clayton wrote:

In my program I have a check-box that switches a particular effect  
on/off, an opacity fade in this case.  Switching the effect off will  
delete the effect from the core-data graph in the following manner:
	A - remove the effect object from the list of effects on the layer  
(using core-data generated set accessor method)
	B - delete the effect instance (using the managed object context  
deleteObject: method)


switching it on (via the checkbox) adds a new Effect instance back  
into the graph.  My requirements are, among other things:
1 - when a layer effect is deleted, reflect the change immediately  
in the UI

2 - don't orphan data objects in the DB

requirement #1 here is the interesting one.  If I DO NOT perform  
Step A, then I fail requirement #1, because step (B), while working  
- is 'lazy' in the sense that I'll only see the delete at save  
time.  if I DO NOT perform step B, then I end up orphaning the  
effect object (fail on #2), but I do fullfil requirement #1. I'd  
like to have both - however, if I perform both Step A and Step B, I  
crash on save (with what appears to be a double delete - i.e. msg  
send to a dead object) :


You're not including some key information in this description. You  
have a to-many relationship Layer->Effect. Is there an inverse  
relationship Effect->Layer? If so, what is its delete rule?


If you have an inverse relationship, and the Effect->Layer delete rule  
is Nullify, then it's not necessary to do part A -- it happens  
automatically, and #1 happens as result, assuming that the UI is  
properly watching for KVO notifications for the Layer's "effects"  
property.


I suspect, though, that you actually have a memory management problem.  
If you do A first, then it could well be that the Effect object is  
immediately deallocated, unless you retain it before removing it from  
the relationship. (It was retained before the removal because it was  
in the NSSet representing the relationship, but possibly nowhere else.  
Managed object contexts don't routinely retain their objects unless  
you tell them to.) If you then do B next, you no longer have a valid  
object to pass to deleteObject.


This might not be precisely what's happening, and of course it won't  
happen like this if you're using garbage collection, but memory  
management deserves some investigation, I think.





___

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 [EMAIL PROTECTED]


about IMKMouseHandling Protocol in IMKit

2008-11-18 Thread BirdSong

Hi folks,I am writing a chinese IME for mac with IMK framework now. I use 
my?input controller which inherited from IMKInputController and draw 
the?candidates window myself (so I don't use the default candidates window).My 
question is: I want to know the current client mouse events(such as?the window 
becomes active or inactive, or the window's position?changed, etc), so I 
implemented all the methods in IMKMouseHandling?protocol within my input 
controller (also set?InputmethodServerDelegateClass to my input controller in 
info.plist),?but nothing happened. Seems my methods are not be called.Does 
anyone have experience about it? I feel really puzzled...Thanks in advance.
_
超炫人气榜给您所有偶像的最新资讯和排名,快来支持自己的偶像!
http://cnweb.search.live.com/xrank/results.aspx?q=%e5%91%a8%e6%9d%b0%e4%bc%a6&FORM=MSNH
___

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 [EMAIL PROTECTED]


Core Data Fetch in Different Context

2008-11-18 Thread Des Cullen

Hi,

   I am trying to prevent duplicates being created in a core data app  
and am using a fetch to search for duplicates but excluding the  
managedObject itself.  I am using the following predicate;


NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(descript  
= %@) AND (self != %@)", *ioValue, [self objectID]];


This works fine if I use the same context that I loaded the data with  
but if I use a new context associated with the same model and  
persistent store it does not. It always returns the originating object  
as well.  The self filter does not seem to work in a new context.  I  
am using a different context since mainly as a look-up context to  
avoid polluting the main context with look-up data.


What am I missing?

Regards


Des Cullen.
___

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 [EMAIL PROTECTED]


Code-sign & Services HotKey Modifications

2008-11-18 Thread Xavier Snark

Greetings,

I am new to cocoa, the list and I apologize if I am posting something 
previously beaten or that is not appropriate (please let me know!).


I have a pure cocoa application that relies on Services as its primary 
method of invocation. Of course it can be opened normally, but that 
decreases its usability by design.
I had already started down the path to allowing the user to change the 
Services hotkey since I can't predict which applications they will be 
using and what key-combinations will be taken. They need a way to 
customize the key-combination to their environment once they start using 
it.
Since Apple wants all of us to sign our code moving forward in Leopard it 
is not clear to me how I can have both signed code and let the user change 
the hotkey combination after the application is signed and shipped since 
the hotkey is stored in Info.plist (or did that change and I haven't seen 
that documentation?). I will have to sign the code if I want to access the 
keychain. I would want access to the Keychain since I want to change the 
Info.plist and it is planned to live in /Applications.


Can any one point me in the right direction for this?

X
--
___

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 [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-18 Thread Greg Titus

Brian,

The way to handle this is to _not_ respond to memory warnings in  
subclasses (at least not for the purposes of view outlet handling -  
there may be other non-view memory you want to free up in response to  
a memory warning). Instead, implement -setView: in your  
UIViewController subclass, and release outlets when the argument is  
nil. For example:


- (void)setView:(UIView *)aView;
{
if (!aView) {
self.anOutlet = nil;
self.anotherOutlet = nil;
self.thirdOutlet = nil;
}
[super setView:aView];
}

This will correctly clean up all of your outlets whenever the  
UIViewController unloads its view, and not otherwise.


Hope this helps,
- Greg

On Nov 18, 2008, at 10:01 AM, Brian Stern wrote:


OK Erik, I'll bite.  What you describe above is correct as far as it  
goes.  However, when you say all the memory management is handled in  
one place, of course it's two.  The object has to be released.  The  
normal place to release objects is in their owner's dealloc method,  
and this also applies to outlets.


However, UIViewController has the ability to unload its view outlet  
in response to a memory warning.  Any subclass should also release  
its outlets in response to the memory warning, if the base class  
releases its view, but not otherwise.  So now there are three places  
to manage the memory of these outlets. The problem is that the base  
class doesn't always release its view in response to a memory  
warning and as far as I can tell the subclass has no clean way of  
telling if the view will be released or has been released.  That's  
the problem.


--
Brian Stern
[EMAIL PROTECTED]



___

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/greg%40omnigroup.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


How to get notification of rerun application

2008-11-18 Thread Macarov Anatoli
How to get notification of  rerun application that is namely being
started from the icon? Because the program is automatically started
upon OS login.




  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.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 [EMAIL PROTECTED]


Re: Code-sign & Services HotKey Modifications

2008-11-18 Thread Randall Meadows

On Nov 18, 2008, at 7:44 AM, Xavier Snark wrote:

I have a pure cocoa application that relies on Services as its  
primary method of invocation. Of course it can be opened normally,  
but that decreases its usability by design.
I had already started down the path to allowing the user to change  
the Services hotkey since I can't predict which applications they  
will be using and what key-combinations will be taken. They need a  
way to customize the key-combination to their environment once they  
start using it.
Since Apple wants all of us to sign our code moving forward in  
Leopard it is not clear to me how I can have both signed code and  
let the user change the hotkey combination after the application is  
signed and shipped since the hotkey is stored in Info.plist (or did  
that change and I haven't seen that documentation?). I will have to  
sign the code if I want to access the keychain. I would want access  
to the Keychain since I want to change the Info.plist and it is  
planned to live in /Applications.


I would think you'd want to store the user's preference using  
NSUserDefaults, not rewriting your bundle at run-time.

___

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 [EMAIL PROTECTED]


Re: release and reference counting query

2008-11-18 Thread Marc Stibane

-- sorry, repost (went to the wrong list yesterday)


Am 07.11.2008 um 13:17 schrieb Roland King:

On Nov 7, 2008, at 7:59 PM, Calum Robertson wrote:
Below is a snippet of code from the "Creating an iPhone  
Application" document from the iPhone DevCenter.

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
  // Set up the view controller
  UIViewController *aViewController = [[UIViewController alloc]
 initWithNibName:@"MoveMeView" bundle:[NSBundle  
mainBundle]];

  self.viewController = aViewController;
  [aViewController release];
  ...
}
In this case whatever self is has declared viewController as a  
readwrite/retain property, so self.viewController = aViewController  
is the same as [ self setViewController:aViewController ] and  
perhaps you're happier with that syntax and realizing that the  
implementation of setViewController would retain the object and the  
dealloc() will eventually release it.


Lets forget for a moment that the dealloc never get's called at all on  
the iPhone - when you press the home button the app just quits and  
iPhoneOS throws away all alloc'ed memory at once instead of letting  
the app do it one by one which would last longer with the same result  
- but anyway, what's the reason for defining a local variable  
aViewController to receive the UIViewController pointer, then copying  
that to the instance variable with a setter method which increases the  
retain count, then decrease the retain count again - instead of just  
using the instance variable?



  viewController = [[UIViewController alloc]
 initWithNibName:@"MoveMeView" bundle:[NSBundle  
mainBundle]];


since "viewController" is a member of the class, you don't need the  
"self.".


So why the local var?
3 lines of code instead of 1...
Isn't a main goal of Cocoa to write *less* code?

--

In a world without walls and fences,
   who needs windows and gates?




___

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 [EMAIL PROTECTED]


Re: Regex

2008-11-18 Thread Mr. Gecko

so I tried that and it worked but it doesn't seem to do what I need.
I am needing to do the same thing as preg_match_all in php so I can  
find all links and have it in an NSArray to go through and add to a  
database. Any ideas on how I can do that?


On Nov 18, 2008, at 11:59 AM, [EMAIL PROTECTED] wrote:


To get it to compile you need to do two things:
1.  Add the "Other Linker Flag" "-licucore" to your project build  
settings
2.  Import the RKL header into whatever files you'll use it in  
(alternatively, you can import it into your .pch file so that it  
will get included into everything automatically)


HTH,

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

This email sent to [EMAIL PROTECTED]


Re: Code-sign & Services HotKey Modifications

2008-11-18 Thread I. Savant
On Tue, Nov 18, 2008 at 9:44 AM, Xavier Snark <[EMAIL PROTECTED]> wrote:
> Can any one point me in the right direction for this?

  You should *not* be storing user-modifiable data inside the
app/plug-in bundle. Non-administrative users do not have permission to
change this. You should make use of the user defaults system (see
NSUserDefaults), which keeps the preferences in the right place -
~/Library/Preferences or /Library/Preferences, depending on the
desired scope of the settings.

--
I.S.
___

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 [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-18 Thread Brian Stern

Thanks Greg,

That does work and has no bad side effects.  I can leave in the retain  
properties and release the outlets in the view controller's dealloc  
method.


Thanks,

Brian


On Nov 18, 2008, at 1:19 PM, Greg Titus wrote:


Brian,

The way to handle this is to _not_ respond to memory warnings in  
subclasses (at least not for the purposes of view outlet handling -  
there may be other non-view memory you want to free up in response  
to a memory warning). Instead, implement -setView: in your  
UIViewController subclass, and release outlets when the argument is  
nil. For example:


- (void)setView:(UIView *)aView;
{
if (!aView) {
self.anOutlet = nil;
self.anotherOutlet = nil;
self.thirdOutlet = nil;
}
[super setView:aView];
}

This will correctly clean up all of your outlets whenever the  
UIViewController unloads its view, and not otherwise.


Hope this helps,
- Greg

On Nov 18, 2008, at 10:01 AM, Brian Stern wrote:


OK Erik, I'll bite.  What you describe above is correct as far as  
it goes.  However, when you say all the memory management is  
handled in one place, of course it's two.  The object has to be  
released.  The normal place to release objects is in their owner's  
dealloc method, and this also applies to outlets.


However, UIViewController has the ability to unload its view outlet  
in response to a memory warning.  Any subclass should also release  
its outlets in response to the memory warning, if the base class  
releases its view, but not otherwise.  So now there are three  
places to manage the memory of these outlets. The problem is that  
the base class doesn't always release its view in response to a  
memory warning and as far as I can tell the subclass has no clean  
way of telling if the view will be released or has been released.   
That's the problem.


--
Brian Stern
[EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Regex

2008-11-18 Thread Dave DeLong
I should've clarified that those two things are to get the  
RegexKitLite additions working.  When I needed the enumeration, I just  
followed the steps on the docs page to "Creating a Match Enumerator".   
It basically has you copy and paste some stuff into new files, since  
the RKL didn't include it by default.  That has worked for me.


Alternatively, you could use the RKL addition to NSString to create an  
NSArray using "componentsSeparatedByRegex", and then enumerate over  
the array (you'd even get fast enumeration if you're using Leopard).   
That might give you a different approach to parsing out links.


Dave

On Nov 18, 2008, at 11:35 AM, Mr. Gecko wrote:


so I tried that and it worked but it doesn't seem to do what I need.
I am needing to do the same thing as preg_match_all in php so I can  
find all links and have it in an NSArray to go through and add to a  
database. Any ideas on how I can do that?


On Nov 18, 2008, at 11:59 AM, [EMAIL PROTECTED] wrote:


To get it to compile you need to do two things:
1.  Add the "Other Linker Flag" "-licucore" to your project build  
settings
2.  Import the RKL header into whatever files you'll use it in  
(alternatively, you can import it into your .pch file so that it  
will get included into everything automatically)


HTH,

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

This email sent to [EMAIL PROTECTED]


Re: release and reference counting query

2008-11-18 Thread Marc Stibane


Am 17.11.2008 um 19:34 schrieb j o a r:


On Nov 17, 2008, at 10:02 AM, Marc Stibane wrote:

So why the local var?
3 lines of code instead of 1...
Isn't a main goal of Cocoa to write *less* code?
The main goal for most programmers is not to write less code, it's  
to write maintainable code [*]. It just so happens that a smaller  
body of code often also is easier to maintain. That said, writing  
less code is also an often used obfuscation technique -> You need to  
find the right balance.


An argument that I've often heard in favor of the use of temporary  
local variables is that it makes it easier to inspect them in the  
debugger,


sure - but only if you are concatenating functions or methods, passing  
the result of one as argument to another.
In this case the result is just stored in an ivar, which can be  
inspected like a local var.



and I think that's a pretty good point (although it doesn't really  
apply in this case).


Right (both statements!).


Also keep in mind that in Cocoa we strongly advocate the consistent  
use of accessor methods for instance variables.


Fine - but for the first initialization from inside the class? This  
seems like being religious in spite of drawbacks...




If you don't like a particular piece of sample code,


Don't get me wrong - I am a long time Carbon programmer, and use Cocoa  
since a few months.
I just wanted to know why it is better to write bloated code - maybe I  
am just overlooking something because of my lacking background  
knowledge of Cocoa.




I'd suggest that you file a bug report / enhancement request here:



If nobody can tell me a compelling reason why this code is good I'll  
do that.



[*] It has to be functional too, of course, but that kind of goes  
without saying...


--

In a world without walls and fences,
   who needs windows and gates?




___

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 [EMAIL PROTECTED]


Re: release and reference counting query

2008-11-18 Thread Andy Lee

On Nov 18, 2008, at 1:33 PM, Marc Stibane wrote:

Am 07.11.2008 um 13:17 schrieb Roland King:

On Nov 7, 2008, at 7:59 PM, Calum Robertson wrote:
Below is a snippet of code from the "Creating an iPhone  
Application" document from the iPhone DevCenter.

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
 // Set up the view controller
 UIViewController *aViewController = [[UIViewController alloc]
initWithNibName:@"MoveMeView" bundle:[NSBundle  
mainBundle]];

 self.viewController = aViewController;
 [aViewController release];
 ...
}

[...]
what's the reason for defining a local variable aViewController to  
receive the UIViewController pointer, then copying that to the  
instance variable with a setter method which increases the retain  
count, then decrease the retain count again - instead of just using  
the instance variable?


The above is not an init method and should not assume that it is  
performing the first assignment to an ivar.  For all you know, a value  
may have been assigned to the ivar by the init method, or by some code  
that executed between the init method and this method.  The safer  
thing to do is use the accessor method to release any such value if  
necessary.


Even if this were occurring in an init method, if the ivar happened to  
be an inherited one, it would make sense to use an accessor to set it  
in case the inherited init method assigned a value to the ivar that  
needs to be released.


--Andy

___

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 [EMAIL PROTECTED]


Re: Regex

2008-11-18 Thread [EMAIL PROTECTED]

NSPredicate can handle ICU standard regex matches.
More info in the NSPredicate docs.
The following snippet validates a UUID.

/*

 is UUID

 see http://www.stiefels.net/2007/01/24/regular-expressions-for-nsstring/

 */
- (BOOL)isUUID
{
	NSString *regex = @"^(([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA-F]) 
{4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12})$";


// supported non standard regex format is at 
http://www.icu-project.org/userguide/regexp.html
	NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF  
MATCHES %@", regex];

return [regextest evaluateWithObject:self];
}

Jonathan Mitchell

Central Conscious Unit
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 [EMAIL PROTECTED]


OpenGL + NSTextView/NSTextContainer?

2008-11-18 Thread Karan, Cem (Civ, ARL/CISD)
I've recently been (mentally) exploring some potential user interfaces, and 
thought up one that I'd like to implement if it is possible.  The problem is 
that I don't know much about OpenGL, or NSTextView/NSTextContainer, so I need 
to bounce my questions off of people with knowledge/experience.

For the first thing I want to do, I want to be able to float lines/arrows 
'above' the text in a text view.  The idea is that I can have related items all 
be linked together by a floating starfish-like set of arrows.  The reason for 
the levels is that more local things can be at a lower level, and more global 
things at a higher level.  A concrete use of this would be for something like 
use-def chains in a program; the more local the use-defs are, the lower level 
the arrows are.  As you scroll the text, you get an immediate feel for how 
wide-ranging variables are from how high above the text they float.

For the next thing, I want to be able to deform the text view in the z 
dimension.  Basically, I want to be looking 'down' onto stairsteps of text.  A 
concrete use of this would be to show the depth of the statements in various 
blocks, like the following:

int main (void) // At highest level
{   
if (foo)// One level lower
printf("foo");  // One level lower
}   // At highest level

Now, before everyone gives me alternatives that are doable within what 
NSTextView does right now, please understand that the above are examples ONLY; 
there are other possible uses of this kind of technique, and I'd like a chance 
to explore them, not find alternatives that also work.  I really want to know 
if I can do exactly what I've described above.

So, can I do it, or is it impossible?

Thanks,
Cem Karan
___

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 [EMAIL PROTECTED]

Re: How to get notification of rerun application

2008-11-18 Thread Kyle Sluder
On Tue, Nov 18, 2008 at 7:59 AM, Macarov Anatoli
<[EMAIL PROTECTED]> wrote:
> How to get notification of  rerun application that is namely being
> started from the icon? Because the program is automatically started
> upon OS login.

The OS will not launch an application when it's already open.  Instead
it will be sent a reopen Apple Event.

Or are you trying to detect when an app has been automatically
launched at login, closed, and then relaunched manually?

--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 [EMAIL PROTECTED]


Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris

On Nov 18, 2008, at 1:00 pm, 11(November)/18/08, Douglas Davidson wrote:

On Nov 17, 2008, at 3:50 PM, Rua Haszard Morris wrote:
I have found that NSSuperscriptAttributeName,  
NSUnderlineStyleAttributeName, and NSObliquenessAttributeName  
(those are the attributes that I have tested) render differently  
when Cocoa Text is used to draw the string.  The attributes appear  
to be intrepreted inverted, in that 1 for superscript produces  
subscript, positive obliqueness is a leftward tilt, etc. In normal  
controls the attributes render as expected.

Make sure that you are drawing in a flipped context.
I was ensuring that I am _not_ drawing in a flipped context... (!)  
now, as you suggest I tried flipping the custom view (override  
isFlipped) that the attributed string is drawn in, and note that it  
works correctly!


So an improved workaround is to tweak the positioning logic (to  
account for the flipped context) instead of tweaking (hacking) the  
actual attributes.


I'm still not clear on why this should be the case. Thanks for the  
vastly better workaround though..


thanks
Rua HM.

___

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 [EMAIL PROTECTED]


Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Douglas Davidson


On Nov 18, 2008, at 11:53 AM, Rua Haszard Morris wrote:

I was ensuring that I am _not_ drawing in a flipped context... (!)  
now, as you suggest I tried flipping the custom view (override  
isFlipped) that the attributed string is drawn in, and note that it  
works correctly!


So an improved workaround is to tweak the positioning logic (to  
account for the flipped context) instead of tweaking (hacking) the  
actual attributes.


I'm still not clear on why this should be the case. Thanks for the  
vastly better workaround though..


The text system generally prefers a flipped context, because text  
generally runs from top to bottom rather than the reverse.  You didn't  
post code, so I'm not sure exactly what you're doing, but this is a  
good general rule.


Douglas Davidson

___

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 [EMAIL PROTECTED]


SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
To follow up.. below I have pasted the code that draws the text (for  
my test app, as opposed to the more complex ways of reproducing the  
bug elsewhere in my code). (the full test app is attached to the radar  
bug)


I have been consulting the Text System Overview documentation, which I  
don't believe mentions this fact.

http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.html

I can understand that drawing text top to bottom makes sense, but I am  
surprised that the coordinate system of the destination context has  
such far-reaching side effects.


Thanks for all the info,
Rua HM.

- (void)drawRect:(NSRect)rect {
CGContextRef context = (CGContextRef)[[NSGraphicsContext  
currentContext]graphicsPort];


CGContextSaveGState(context);

NSTextStorage* textStorage = [[NSTextStorage alloc]  
initWithAttributedString:attribString];


NSLayoutManager *layoutManager;
layoutManager = [[NSLayoutManager alloc] init];
[textStorage addLayoutManager:layoutManager];

NSTextContainer *container = [[NSTextContainer alloc]  
initWithContainerSize:NSMakeSize(, )];

[layoutManager addTextContainer:container];

NSRange glyphRange = [layoutManager  
glyphRangeForTextContainer:container];
[layoutManager drawGlyphsForGlyphRange:glyphRange  
atPoint:NSMakePoint(10, 10)];


[container release];
[layoutManager release];
[textStorage release];

CGContextRestoreGState(context);
}


On Nov 19, 2008, at 9:09 am, 11(November)/19/08, Douglas Davidson wrote:



On Nov 18, 2008, at 11:53 AM, Rua Haszard Morris wrote:

I was ensuring that I am _not_ drawing in a flipped context... (!)  
now, as you suggest I tried flipping the custom view (override  
isFlipped) that the attributed string is drawn in, and note that it  
works correctly!


So an improved workaround is to tweak the positioning logic (to  
account for the flipped context) instead of tweaking (hacking) the  
actual attributes.


I'm still not clear on why this should be the case. Thanks for the  
vastly better workaround though..


The text system generally prefers a flipped context, because text  
generally runs from top to bottom rather than the reverse.  You  
didn't post code, so I'm not sure exactly what you're doing, but  
this is a good general rule.


Douglas Davidson



___

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 [EMAIL PROTECTED]


Re: Cocoa-dev Digest, Vol 5, Issue 1970

2008-11-18 Thread Mr. Gecko
I've finally found it out. I decided to use NSXML instead of Regex and  
it works perfectly.


NSXMLNode *recived = [[[NSXMLDocument alloc] initWithData:receivedData  
options:NSXMLDocumentTidyHTML error:NULL] rootElement];

NSArray *recivedA = [recived nodesForXPath:@"//a" error:nil];
int i;
for (i=0; i<[recivedA count]; i++) {
NSXMLElement *link = [recivedA objectAtIndex:i];
NSLog(@"%@", [[link attributeForName:@"href"] stringValue]);
}

Thanks,
Mr. Gecko

On Nov 18, 2008, at 2:02 PM, [EMAIL PROTECTED] wrote:


NSPredicate can handle ICU standard regex matches.
More info in the NSPredicate docs.
The following snippet validates a UUID.

/*

is UUID

see http://www.stiefels.net/2007/01/24/regular-expressions-for-nsstring/

*/
- (BOOL)isUUID
{
	NSString *regex = @"^(([0-9a-fA-F]){8}-([0-9a-fA-F]){4}-([0-9a-fA- 
F]){4}-([0-9a-fA-F]){4}-([0-9a-fA-F]){12})$";


// supported non standard regex format is at 
http://www.icu-project.org/userguide/regexp.html
	NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF  
MATCHES %@", regex];

return [regextest evaluateWithObject:self];
}

Jonathan Mitchell


___

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 [EMAIL PROTECTED]


Re: OpenGL + NSTextView/NSTextContainer?

2008-11-18 Thread Erik Buck
Open GL has no built-in capability for drawing text.  Open GL provides lower 
level primitives like lines and curves and meshes.  Open GL also provides 
texture compositing.
 
There are some free and some open text drawing/font solutions for Open GL.  You 
can use the GLUT library up to a point.
 
On Mac OS X, the traditional way to mix Open GL and Cocoa text is by rentering 
the text into a texture and then using Open GL to composite the texture.
 
The sample I think you want is 
http://developer.apple.com/samplecode/CocoaGL/index.html
 
See other samples at 
http://developer.apple.com/samplecode/GraphicsImaging/idxOpenGL-date.html
 
For modern Mac OS X, you might do what you want with "layer backed views" to 
use a Cocoa text view as an Open GL texture.  See also CATextLayer 
http://developer.apple.com/samplecode/CALayerEssentials/index.html
 
 
___

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 [EMAIL PROTECTED]


Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Douglas Davidson


On Nov 18, 2008, at 12:18 PM, Rua Haszard Morris wrote:

To follow up.. below I have pasted the code that draws the text (for  
my test app, as opposed to the more complex ways of reproducing the  
bug elsewhere in my code). (the full test app is attached to the  
radar bug)


I have been consulting the Text System Overview documentation, which  
I don't believe mentions this fact.

http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.html

I can understand that drawing text top to bottom makes sense, but I  
am surprised that the coordinate system of the destination context  
has such far-reaching side effects.


You're looking at the Text Systems Overview, which is very general  
conceptual documentation, the sort you would consult to decide which  
class to use.  What you want is the Text Layout Programming Guide for  
Cocoa, which gives more detailed direction as to how to use these  
classes.  The first section, http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Concepts/LayoutManager.html 
 under the heading "Glyph Drawing" says, "The text system expects  
view coordinates to be flipped, like those of NSTextView."  If you are  
going to be drawing using the layout manager directly, this is a hard- 
and-fast rule.


Douglas Davidson

___

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 [EMAIL PROTECTED]


Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris

Thanks for the link, you are right, I had not seen that document!

On Nov 19, 2008, at 9:33 am, 11(November)/19/08, Douglas Davidson wrote:



On Nov 18, 2008, at 12:18 PM, Rua Haszard Morris wrote:

To follow up.. below I have pasted the code that draws the text  
(for my test app, as opposed to the more complex ways of  
reproducing the bug elsewhere in my code). (the full test app is  
attached to the radar bug)


I have been consulting the Text System Overview documentation,  
which I don't believe mentions this fact.

http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.html

I can understand that drawing text top to bottom makes sense, but I  
am surprised that the coordinate system of the destination context  
has such far-reaching side effects.


You're looking at the Text Systems Overview, which is very general  
conceptual documentation, the sort you would consult to decide which  
class to use.  What you want is the Text Layout Programming Guide  
for Cocoa, which gives more detailed direction as to how to use  
these classes.  The first section, http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Concepts/LayoutManager.html 
 under the heading "Glyph Drawing" says, "The text system expects  
view coordinates to be flipped, like those of NSTextView."  If you  
are going to be drawing using the layout manager directly, this is a  
hard-and-fast rule.


Douglas Davidson



___

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 [EMAIL PROTECTED]


window flash

2008-11-18 Thread Alexander Cohen

Hi,

I have a window controller that i'm creating dynamically in the  
applicationDidFinishLaunching: app delegate notification. In this  
window controllers windowDidLoad:, i'm adding subviews to it's content  
view. When i create it then call showWindow: on it, the window shows  
up on screen without any subviews in then it seems to update with all  
the subviews in it, this causes a sort of visible flash. Has anyone  
seen this and does anyone have any idea why this might be happening?


thx

AC
___

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 [EMAIL PROTECTED]


window flash

2008-11-18 Thread Alexander Cohen

Hi,

I have a window controller that i'm creating dynamically in the  
applicationDidFinishLaunching: app delegate notification. In this  
window controllers windowDidLoad:, i'm adding subviews to it's content  
view. When i create it then call showWindow: on it, the window shows  
up on screen without any subviews in then it seems to update with all  
the subviews in it, this causes a sort of visible flash. Has anyone  
seen this and does anyone have any idea why this might be happening?


thx

AC
___

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 [EMAIL PROTECTED]


Potentially dumb question

2008-11-18 Thread Robert Mullen
My application is not document based but does create certain files as  
a byproduct and needs to be the default application for these file  
types as well. If they are clicked or dragged to the dock icon of my  
application I need to be able to display the contained information in  
a special display mode of my application. Can all this be done in an  
NSApplication since this is more of a utility feature of my  
application and its core behavior is as a true NSApplication? If so,  
can someone point me in the direction of documents that show how to  
retrieve the document that triggered startup of my application?


TIA.
___

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 [EMAIL PROTECTED]


Re: core data - delete of object.

2008-11-18 Thread Ashley Clark
That's true, processPendingChanges is used by the context to implement  
undo functionality but there's no reason why you can't call it  
yourself after your delete since you've disabled the context's undo  
functionality.



Here's an example where events is an NSArrayController:


- (IBAction)deleteEvent:(id)sender {
NSManagedObjectContext *context = [self managedObjectContext];

if ([events selectedObjects] && [[events selectedObjects]  
count]) {
[context deleteObject:[[events selectedObjects]  
objectAtIndex:0]];

[context processPendingChanges];
}
}



Or add a category to NSManagedObjectContext:


- (void)AC_deleteObjectAndProcessPendingChanges:(id)object {
[self deleteObject:object];
[self processPendingChanges];
}



Why disable the undo functionality at the context level though? If  
you're providing your own undo support elsewhere there's nothing that  
I know of that says you have to use the context's undoManager  
elsewhere. If you have sections of code that you don't want to be  
undoable you can still call disableUndoRegistration and  
enableUndoRegistration on the context's undoManager itself too (as  
long as you don't want any objectsDidChange notifications during that  
block).


Ashley


On Nov 18, 2008, at 6:44 AM, John Clayton wrote:

I guess processPendingChanges is only called if there is an  
undoManager? Correct?  I don't have one - I disabled it intentionally.


I've tried that notification, its only fired on save of the context.

On 18/11/2008, at 1:22 PM, Ashley Clark wrote:

According to the documentation and to my quick test, the  
NSManagedObjectContextObjectsDidChangeNotification is sent during  
processPendingChanges. At the very least that happens at the end of  
every event loop automatically. Even if you've bypassed your event  
loop somehow you can still call processPendingChanges on your  
context yourself after your object deletion and have it do whatever  
extra processing you need.


ie.

NSManagedObjectContext *context = [theObject managedObjectContext];
[context deleteObject:theObject];
[context processPendingChanges];


Ashley


On Nov 18, 2008, at 12:54 AM, John Clayton wrote:

Thanks Jim, unfortunately all occur either at pre-save or save  
time, which is too late.


I'm basically looking to restore some state on an object at time  
of deletion, e.g.


if A is associated with B via a to-many relationship from A->B,  
then when one instance of B is deleted - we need to change a  
property on A.



On 17/11/2008, at 10:59 PM, Jim Correia wrote:


On Nov 17, 2008, at 4:51 PM, John Clayton wrote:

I'm using core-data and need to know when a particular core-data  
object (derived from NSManagedObject of course) is about to be  
deleted.   I'm deleting objects simply by using the managed  
object context's deleteObject method, like this:

[[theObject managedObjectContext] deleteObject:theObject];

Is there a way to be notified immediately of the delete?  I need  
to know immediately, not only when the context is saved.  Am I  
missing something painfully obvious here?


now, I could of course put a 'deleteThisObject' method onto the  
class I'm deleting, but isn't there a core-data way to handle  
this?


I've tried catching the  
NSManagedObjectContextObjectsDidChangeNotification notification  
- but that only fires on context saves, same with the  
willTurnIntoFault method as well as the dealloc - all these  
methods are only ever called when the context is being saved -  
which in my case is (a) unpredictable, (b) too late .


Is -validateForDelete: time too late? If not, that's an option.

You can also try

[context deleteObject: object];
[context processPendingChanges];

... handle notification ...

[context save: &error];






___

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 [EMAIL PROTECTED]


Re: Potentially dumb question

2008-11-18 Thread I. Savant
On Tue, Nov 18, 2008 at 4:32 PM, Robert Mullen <[EMAIL PROTECTED]> wrote:
> My application is not document based but does create certain files as a
> byproduct and needs to be the default application for these file types as
> well. If they are clicked or dragged to the dock icon of my application I
> need to be able to display the contained information in a special display
> mode of my application.

  Sounds perfectly normal so far.

> Can all this be done in an NSApplication since this
> is more of a utility feature of my application and its core behavior is as a
> true NSApplication?

  Yes.

> If so, can someone point me in the direction of
> documents that show how to retrieve the document that triggered startup of
> my application?

  Look at the NSApplication API reference and search for "Opening
Files". To inform the application of the types of files it can open,
you specify this in the application's info.plist:

http://developer.apple.com/documentation/Cocoa/Conceptual/Documents/Concepts/DocTypePList.html

--
I.S.
___

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 [EMAIL PROTECTED]


Re: core-data crash on save.

2008-11-18 Thread John Clayton

Hi there, comments embedded below...

On 18/11/2008, at 7:06 PM, Quincey Morris wrote:


On Nov 18, 2008, at 00:27, John Clayton wrote:

In my program I have a check-box that switches a particular effect  
on/off, an opacity fade in this case.  Switching the effect off  
will delete the effect from the core-data graph in the following  
manner:
	A - remove the effect object from the list of effects on the layer  
(using core-data generated set accessor method)
	B - delete the effect instance (using the managed object context  
deleteObject: method)


switching it on (via the checkbox) adds a new Effect instance back  
into the graph.  My requirements are, among other things:
1 - when a layer effect is deleted, reflect the change immediately  
in the UI

2 - don't orphan data objects in the DB

requirement #1 here is the interesting one.  If I DO NOT perform  
Step A, then I fail requirement #1, because step (B), while working  
- is 'lazy' in the sense that I'll only see the delete at save  
time.  if I DO NOT perform step B, then I end up orphaning the  
effect object (fail on #2), but I do fullfil requirement #1. I'd  
like to have both - however, if I perform both Step A and Step B, I  
crash on save (with what appears to be a double delete - i.e. msg  
send to a dead object) :


You're not including some key information in this description. You  
have a to-many relationship Layer->Effect. Is there an inverse  
relationship Effect->Layer? If so, what is its delete rule?


If you have an inverse relationship, and the Effect->Layer delete  
rule is Nullify, then it's not necessary to do part A -- it happens  
automatically, and #1 happens as result, assuming that the UI is  
properly watching for KVO notifications for the Layer's "effects"  
property.




The delete rule is Nullify.  You are right of course, there should be  
no need to perform Step A if the rules are working OK.  But that's  
exactly what I'm saying - when I delete the object, nothing actually  
happens on the KVO notifications, zero.  That is, until I call  
processPendingChanges on the context.


I suspect, though, that you actually have a memory management  
problem. If you do A first, then it could well be that the Effect  
object is immediately deallocated, unless you retain it before  
removing it from the relationship. (It was retained before the  
removal because it was in the NSSet representing the relationship,  
but possibly nowhere else. Managed object contexts don't routinely  
retain their objects unless you tell them to.) If you then do B  
next, you no longer have a valid object to pass to deleteObject.


This might not be precisely what's happening, and of course it won't  
happen like this if you're using garbage collection, but memory  
management deserves some investigation, I think.






So, with the extra two bits of knowledge, namely:

- I have a Nullify relationship from Effect to the Layers 'effects'  
set/relationship

- it works if I call processPendingChanges

does it still 'reek' to you of something being broken?

I'm a bit lost as to why I must call processPendingChanges to have my  
object deleted immediately.  It really does feel like I've screwed  
*something*, *somewhere*.  I thought the objects that I delete would  
really be deleted at the end of the event loop?



___

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 [EMAIL PROTECTED]


Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Rua Haszard Morris
What are the different options for flipping the coordinates of the  
destination view? I've tried doing it by scaling and translating the  
CGContext, but this results in problems with underlining or the  
character orientation (depending on whether i flip the view back  
before or after drawing the text).


At the moment the only method which results in correct text is to have  
a custom view and override isFlipped - is this the only recommended  
method?


I ask because I have to use these strings within custom views (which  
may for example have rotated contexts), as well as in standard  
controls, and simpler custom views purely for drawing these attributed  
strings. If the only method to have the attributes (particularly  
underline) interpreted correctly is to perform the drawing in a  
isFlipped NSView subclass, then I need to rejig things so the complex  
custom views embed an NSView rather than draw the attributed string  
manually.


thanks
Rua HM.

On Nov 19, 2008, at 9:40 am, 11(November)/19/08, Rua Haszard Morris  
wrote:



Thanks for the link, you are right, I had not seen that document!

On Nov 19, 2008, at 9:33 am, 11(November)/19/08, Douglas Davidson  
wrote:




On Nov 18, 2008, at 12:18 PM, Rua Haszard Morris wrote:

To follow up.. below I have pasted the code that draws the text  
(for my test app, as opposed to the more complex ways of  
reproducing the bug elsewhere in my code). (the full test app is  
attached to the radar bug)


I have been consulting the Text System Overview documentation,  
which I don't believe mentions this fact.

http://developer.apple.com/documentation/Cocoa/Conceptual/TextArchitecture/TextArchitecture.html

I can understand that drawing text top to bottom makes sense, but  
I am surprised that the coordinate system of the destination  
context has such far-reaching side effects.


You're looking at the Text Systems Overview, which is very general  
conceptual documentation, the sort you would consult to decide  
which class to use.  What you want is the Text Layout Programming  
Guide for Cocoa, which gives more detailed direction as to how to  
use these classes.  The first section, http://developer.apple.com/documentation/Cocoa/Conceptual/TextLayout/Concepts/LayoutManager.html 
 under the heading "Glyph Drawing" says, "The text system expects  
view coordinates to be flipped, like those of NSTextView."  If you  
are going to be drawing using the layout manager directly, this is  
a hard-and-fast rule.


Douglas Davidson



___

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/r.haszardmorris%40adinstruments.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: core-data crash on save.

2008-11-18 Thread Ashley Clark

On Nov 18, 2008, at 3:53 PM, John Clayton wrote:




So, with the extra two bits of knowledge, namely:

- I have a Nullify relationship from Effect to the Layers 'effects'  
set/relationship

- it works if I call processPendingChanges

does it still 'reek' to you of something being broken?

I'm a bit lost as to why I must call processPendingChanges to have  
my object deleted immediately.  It really does feel like I've  
screwed *something*, *somewhere*.  I thought the objects that I  
delete would really be deleted at the end of the event loop?


You have to call processPendingChanges because you've disabled the  
context's undo support. As a consequence of that, the context will now  
only call processPendingChanges just before save (like it always did)  
but it will not call it at the end of the event loop since it doesn't  
need to generate undo operations.


If you really want undo support disabled on the context you have to be  
responsible for calling processPendingChanges manually when you need  
to make other parts of your program aware of the changes.



Ashley

___

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 [EMAIL PROTECTED]


Can 2 nib share a same custom class instance?

2008-11-18 Thread Jean-Nicolas Jolivet
This is a bit hard to explain but I'll try to keep it simple and  
clear The short version would be:
"Can two nib files share an instance of a custom class instead of both  
creating their separate instance"...


The long version:

I have a custom window controller (let's call it  
CustomWindowController) to manage a custom window... this is contained  
in a separate nib file (i.e. not in my MainMenu.nib)


In that window's nib file, the File Owner is set to that  
CustomWindowController class so that my class can communicate with my  
window...


Now let's say I have an action in my CustomWindowController (for  
clarity's sake let's call it  performActionClicked: )


I connected my window's button to it's FileOwner's  
performActionClicked  action... good, everything is working well...


Now here comes the tricky part: I want a menu item from the app's main  
menu (located in MainMenu.nib) to ALSO be able to perform this action  
(the same performActionClicked:  thats located in my  
CustomWindowController)


My first idea was to add an "Object" to my MainMenu.nib and set its  
class to CustomWindowController, that way I can access its actions...  
but the problem is that both nib files create their own instance of  
CustomWindowController (I know this because I put an NSLog(@"Im  
awake!"); in my CustomWindowController's awakeFromNib... and, as I  
expected, the message appears twice in the console...


Is there a way that both nib files can "share" the same instance of my  
CustomWindowController???



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: Can 2 nib share a same custom class instance?

2008-11-18 Thread Kyle Sluder
On Tue, Nov 18, 2008 at 5:43 PM, Jean-Nicolas Jolivet
<[EMAIL PROTECTED]> wrote:
> I have a custom window controller (let's call it CustomWindowController) to
> manage a custom window... this is contained in a separate nib file (i.e. not
> in my MainMenu.nib)

Typically this isn't what you want to do.  You'll usually create the
window controller from code (external to any nib) and use it as the
owner of a nib that contains the window you want it to control.

> In that window's nib file, the File Owner is set to that
> CustomWindowController class so that my class can communicate with my
> window...

Good.

> Now here comes the tricky part: I want a menu item from the app's main menu
> (located in MainMenu.nib) to ALSO be able to perform this action (the same
> performActionClicked:  thats located in my CustomWindowController)

Use the responder chain.

> Is there a way that both nib files can "share" the same instance of my
> CustomWindowController???

If you can reach it from File's Owner, you can do what you want, but
as I said above this is a typical use of the responder chain.  Though
depending on your situation an NSWindowController subclass might not
be the appropriate place for it; it might be an NSDocument subclass or
your NSApplication's delegate.

--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 [EMAIL PROTECTED]


Re: Can 2 nib share a same custom class instance?

2008-11-18 Thread Jean-Nicolas Jolivet

Thanks for the reply...

I guess I had what you could call a "brainfreeze" moment...

My CustomWindowController is created programatically from my  
AppController... therefore, when the App Controller's action is  
triggered by the menu item, I just call the approriate Custom  
Controler's action


I got a bit mixed up because my windows/controllers are set up in a  
weird way (I'm using a third party class so I had no other options)...


Anyway, I got it working now!

Thanks!

On 18-Nov-08, at 6:22 PM, Kyle Sluder wrote:


On Tue, Nov 18, 2008 at 5:43 PM, Jean-Nicolas Jolivet
<[EMAIL PROTECTED]> wrote:
I have a custom window controller (let's call it  
CustomWindowController) to
manage a custom window... this is contained in a separate nib file  
(i.e. not

in my MainMenu.nib)


Typically this isn't what you want to do.  You'll usually create the
window controller from code (external to any nib) and use it as the
owner of a nib that contains the window you want it to control.


In that window's nib file, the File Owner is set to that
CustomWindowController class so that my class can communicate with my
window...


Good.

Now here comes the tricky part: I want a menu item from the app's  
main menu
(located in MainMenu.nib) to ALSO be able to perform this action  
(the same
performActionClicked:  thats located in my  
CustomWindowController)


Use the responder chain.

Is there a way that both nib files can "share" the same instance of  
my

CustomWindowController???


If you can reach it from File's Owner, you can do what you want, but
as I said above this is a typical use of the responder chain.  Though
depending on your situation an NSWindowController subclass might not
be the appropriate place for it; it might be an NSDocument subclass or
your NSApplication's delegate.

--Kyle Sluder


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


NSNumberFormatter & Currency Symbol

2008-11-18 Thread Brad Gibbs
Is it possible to have a text field with a currency symbol that  
appears automatically?  For instance, if the user types 400, $400.00  
appears in the text field.  I've been using IB's formatter with 10.4+  
and I don't see any options that would allow for this.  As it stands,  
if the formatter is configured for currency, the text field won't  
allow an entry that doesn't start with  a $.


Thanks as always,

Brad
___

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 [EMAIL PROTECTED]


Sharing model object implementations between Cocoa & iPhone

2008-11-18 Thread Rick Mann
Hi. I'm wondering if I can have a collection of model objects in my  
app, which has both a desktop version and an iPhone version, and share  
most of that implementation. On the desktop, I'd like for them to be  
Core Data entities, and on the iPhone, they'd just be stored in the  
sqlite database I'm using now. (This would all be easier if Core Data  
existed on the iPhone.)


Ideally, the sqlite files would be trasnferrable between the two. Is  
it possible to have the same schema in both?


Any suggestions would be much appreciated. Thanks!

--
Rick

___

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 [EMAIL PROTECTED]


Re: window flash

2008-11-18 Thread Michael Ash
On Tue, Nov 18, 2008 at 4:15 PM, Alexander Cohen <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have a window controller that i'm creating dynamically in the
> applicationDidFinishLaunching: app delegate notification. In this window
> controllers windowDidLoad:, i'm adding subviews to it's content view. When i
> create it then call showWindow: on it, the window shows up on screen without
> any subviews in then it seems to update with all the subviews in it, this
> causes a sort of visible flash. Has anyone seen this and does anyone have
> any idea why this might be happening?

Uncheck the "Visible at Launch" checkbox in IB. With that box checked,
the window gets displayed right when the nib loads, before your
windowDidLoad method (no colon, note, it does not take a parameter) is
invoked. You then add subviews to it after it's already visible,
leading to a flash. And then of course your window controller tells
the window to become visible, but this does nothing because it already
is.

If you uncheck that box, the window will be invisible when first
loaded from the nib. This will allow you to do whatever setup you need
and then the showWindow: method will make it visible "manually"
afterwards.

Mike
___

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 [EMAIL PROTECTED]


Re: NSArrayController and table column bindings retain/dealloc woes

2008-11-18 Thread Ken Thomases

On Nov 17, 2008, at 6:00 AM, Keith Blount wrote:

Which leads me to the big difference in my project... The File's  
Owner in my nib file is not an NSDocument or an NSWindowController,  
but my own custom view controller (my app runs on Tiger and Leopard  
so I can't use Leopard's new NSViewController - instead I rolled my  
own back on Tiger). My custom view controller just holds onto the  
top level nib objects and then releases them in -dealloc, as follows:


[...]

I am thinking that maybe NSDocument and NSWindowController do a bit  
more than this and possibly somehow unbind everything so that these  
retain problems are avoided. Is that the case?


Yes, NSWindowController has that special logic.  Search for  
NSWindowController in the AppKit release notes (both current and  
older).  There's also a mention of this special feature of  
NSWindowController in the NSViewController overview (by way of saying  
that NSViewController has the same special feature), if I recall  
correctly.



And if so, does anybody know how?


Only Apple.  The implementation doesn't seem simple and it's  
definitely not public.


I'd be very grateful if anyone can give me some advice on how to go  
about resolving these issues...


This issue just came up on the list in the last month or so.  You  
could search the archives for a solution used by others.  My  
recommendation was to base your custom view controller on  
NSWindowController, even if you don't connect its "window" outlet or  
otherwise use it to control a window per se.  And then, of course, let  
the NSWindowController machinery load the nib, too.


Cheers,
Ken

___

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 [EMAIL PROTECTED]


NSKVODeallocateBreak?

2008-11-18 Thread John Zorko


Hello, all ...

My app is hitting this breakpoint, and I don't know what it means (and  
there is no stack frame in the call stack that lives in my source, so  
while I can make a good guess about where it's happening, i'm not 100%  
sure).  What n00b mistake causes this breakpoint to be hit?


Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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 [EMAIL PROTECTED]


Re: core-data crash on save.

2008-11-18 Thread Quincey Morris

On Nov 18, 2008, at 13:53, John Clayton wrote:


So, with the extra two bits of knowledge, namely:

- I have a Nullify relationship from Effect to the Layers 'effects'  
set/relationship

- it works if I call processPendingChanges

does it still 'reek' to you of something being broken?

I'm a bit lost as to why I must call processPendingChanges to have  
my object deleted immediately.  It really does feel like I've  
screwed *something*, *somewhere*.  I thought the objects that I  
delete would really be deleted at the end of the event loop?


If you'll excuse a short rant ...

I think there's a semantic issue here, about what "deletion" means in  
Core Data. AFAIK, it's not referring to the lifetime of the object in  
your (in-memory) object graph, but the lifetime of the Core Data  
entity instance in your persistent store. If I am correct, deleting an  
object is "really" just an instruction to omit the object from the  
persistent store the next time it's saved.


In those terms, it's not entirely surprising that the effect of  
"deleteObject" might be deferred from the moment you call it to some  
later time (processPendingChanges, or save, or whatever). The actual  
object doesn't get deleted by "deleteObject", only its persistence in  
the store. The object gets *deallocated* when there are no references  
to it (regardless of whether it's deleted in the store or not).


I would have expected the delete rule to be applied at "deleteObject"  
time, but it seems not completely illogical to do it later. (Part of  
the reason for processPendingChanges is, I believe, to avoid tracking  
a lot of redundant individual changes in the undo manager, and that's  
a Good Thing.)


It might be worthwhile filing a bug on this, saying that the delete  
rule ought to be applied at a predictable time, or that the  
documentation should be updated to make it clear *when* it's done.


In practical terms, I'm suggesting you continue with your A/B  
methodology:


[effect retain];
effect.layer = nil; // let Core Data do the work for the inverse
[moc deleteObject: effect];
[effect release];

I don't think this reeks of something broken, it just reflects a piece  
of complexity in Core Data's semantics: there really are 2 things you  
need to do -- one piece of object graph management and one piece of  
persistent store management.


If it still crashes, then I would investigate the issue as a memory  
management problem first.



___

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 [EMAIL PROTECTED]


Re: NSKVODeallocateBreak?

2008-11-18 Thread Kyle Sluder
On Tue, Nov 18, 2008 at 6:41 PM, John Zorko <[EMAIL PROTECTED]> wrote:
> My app is hitting this breakpoint, and I don't know what it means (and there
> is no stack frame in the call stack that lives in my source, so while I can
> make a good guess about where it's happening, i'm not 100% sure).  What n00b
> mistake causes this breakpoint to be hit?

An educated guess based on the name of the symbol: an object is being
observed and is deallocated before all of its observers have been
removed.

--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 [EMAIL PROTECTED]


Re: NSKVODeallocateBreak?

2008-11-18 Thread Nick Zitzmann


On Nov 18, 2008, at 4:41 PM, John Zorko wrote:

My app is hitting this breakpoint, and I don't know what it means  
(and there is no stack frame in the call stack that lives in my  
source, so while I can make a good guess about where it's happening,  
i'm not 100% sure).  What n00b mistake causes this breakpoint to be  
hit?



If you added any KV observers, did you remember to remove them in - 
dealloc or earlier?


Nick Zitzmann




___

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 [EMAIL PROTECTED]


Re: window flash

2008-11-18 Thread Alexander Cohen

You are absolutely right. thank you.

AC

On Nov 18, 2008, at 6:33 PM, Michael Ash wrote:

On Tue, Nov 18, 2008 at 4:15 PM, Alexander Cohen <[EMAIL PROTECTED] 
> wrote:

Hi,

I have a window controller that i'm creating dynamically in the
applicationDidFinishLaunching: app delegate notification. In this  
window
controllers windowDidLoad:, i'm adding subviews to it's content  
view. When i
create it then call showWindow: on it, the window shows up on  
screen without
any subviews in then it seems to update with all the subviews in  
it, this
causes a sort of visible flash. Has anyone seen this and does  
anyone have

any idea why this might be happening?


Uncheck the "Visible at Launch" checkbox in IB. With that box checked,
the window gets displayed right when the nib loads, before your
windowDidLoad method (no colon, note, it does not take a parameter) is
invoked. You then add subviews to it after it's already visible,
leading to a flash. And then of course your window controller tells
the window to become visible, but this does nothing because it already
is.

If you uncheck that box, the window will be invisible when first
loaded from the nib. This will allow you to do whatever setup you need
and then the showWindow: method will make it visible "manually"
afterwards.

Mike
___

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/alex%40toomuchspace.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: SOLVED Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-18 Thread Douglas Davidson


On Nov 18, 2008, at 1:57 PM, Rua Haszard Morris wrote:

What are the different options for flipping the coordinates of the  
destination view? I've tried doing it by scaling and translating the  
CGContext, but this results in problems with underlining or the  
character orientation (depending on whether i flip the view back  
before or after drawing the text).


At the moment the only method which results in correct text is to  
have a custom view and override isFlipped - is this the only  
recommended method?


I ask because I have to use these strings within custom views (which  
may for example have rotated contexts), as well as in standard  
controls, and simpler custom views purely for drawing these  
attributed strings. If the only method to have the attributes  
(particularly underline) interpreted correctly is to perform the  
drawing in a isFlipped NSView subclass, then I need to rejig things  
so the complex custom views embed an NSView rather than draw the  
attributed string manually.


The other alternative would be to use the NSStringDrawing APIs instead  
of using NSLayoutManager directly.


Douglas Davidson

___

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 [EMAIL PROTECTED]


Re: Can you @synthesize simple arrays?

2008-11-18 Thread Ken Thomases

On Nov 17, 2008, at 11:15 AM, Michael Ash wrote:


I'd recommend either using an NSArray even though you don't want to,
or writing accessors with indexes that you'd call like this:

[self setMyString:@"foo" atIndex:3];
[self myIntegerAtIndex:4];


Actually, this is a perfect example of where the KVC indexed accessors  
for to-many properties are appropriate.


http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/AccessorConventions.html#/ 
/apple_ref/doc/uid/20002174-178830-BAJEDEFB



Also, search for the word "weapons" on these pages:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/WhatAreBindings.html#/ 
/apple_ref/doc/uid/20002372-181136


http://homepage.mac.com/mmalc/CocoaExamples/controllers.html


It's a shame, though, that Objective-C 2.0 declared properties don't  
support this convention.



Cheers,
Ken

___

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 [EMAIL PROTECTED]


Re: How to determine if the system is started up from firewire disk

2008-11-18 Thread Ryota Tsukiashi
Hi Ken,
Hi Chris,

I just want to let you know that I could specify if the start up disk
is connected through firewire bus. Thank you for your information!

Sincerely,

Ryota

2008/9/10 Ryota Tsukiashi <[EMAIL PROTECTED]>:
> Hi Chris,
>
> Thank you. I will try FSMegaInfo as well.
>
> Ryota
>
> 2008/9/10 Ken Thomases <[EMAIL PROTECTED]>:
>> On Sep 9, 2008, at 10:23 PM, Chris Suter wrote:
>>
>>> On Wed, Sep 10, 2008 at 10:10 AM, Ryota Tsukiashi
>>> <[EMAIL PROTECTED]>wrote:
>>>
 I am writing a cocoa application for our firweire device. I need to
 know if the system is started up from firewire disk. For PowerPC with
 Mac OSX 10.4/10.5, I have used information from "nvram boot-device".
 For IntelMac with 10.4/10.5, I have used "nvram efi-boot-device". I am
 not sure if it is a proper way, but it has been working OK.
>>>
>>>
>>> No, it's not the right way. That will only tell you what the start up disk
>>> is set to which isn't necessarily what you started from (for example, you
>>> could have booted by holding down the Option key).
>>>
>>> One way to do this is to use fsstat on "/" to get the BSD information and
>>> then use IOKit (IOServiceGetMatchingService) to find the device that
>>> refers
>>> to and then you might have to go up the hierarchy until you hit the level
>>> you want.
>>>
>>> There might be easier ways to do this; that's just the one I first thought
>>> of.
>>
>> The Disk Arbitration framework may be easier to use than IOKit.
>>
>> You might look at the FSMegaInfo sample code for inspiration regarding other
>> techniques:
>>
>> http://developer.apple.com/samplecode/FSMegaInfo/index.html
>>
>> Cheers,
>> Ken
>>
>>
>
___

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 [EMAIL PROTECTED]


Re: release and reference counting query

2008-11-18 Thread Peter N Lewis

At 19:33 +0100 18/11/08, Marc Stibane wrote:
what's the reason for defining a local variable aViewController to 
receive the UIViewController pointer, then copying that to the 
instance variable with a setter method which increases the retain 
count, then decrease the retain count again - instead of just using 
the instance variable?



  viewController = [[UIViewController alloc]
 initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]];


since "viewController" is a member of the class, you don't need the "self.".



viewController = xxx simply assigns the ivar.

self.viewController = xxx is actually syntactic sugar for

[self setViewController:xxx]

which means bindings and observing stuff might be happening, as well 
as releasing old versions.


I would actually write:

self.viewController = [[[UIViewController alloc]
  initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]] autorelease];

The up side of this is:

* less code than the original
* setter is classed
* memory retention is left to the setter
* any old value of viewController is released as necessary
* autorelease is a good safe paradigm

The downside compared to the original:

* slightly less efficient because of the autorelease call

The downside compared to the ivar assignment version:

* Somewhat less efficient because of the autorelease and the setter method call

However, in this case it is a view allocation, which will be far more 
expensive that the autorelease or the setter, and presumably very 
infrequently executed, so the advantages in safe, clean, clear, 
simple, short code easily outweigh the efficiency issues.


IMO of course.  The original method will work equally well and si 
more efficient - the only downside is the extra lines of code.  The 
ivar setting method is much more risky - changes far away from this 
code could introduce bugs.


Enjoy,
   Peter.


--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro  Macros for your Mac
   
___

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 [EMAIL PROTECTED]


Using Cocoa with Spaces?

2008-11-18 Thread Bill Janssen
Is there an Objective-C interface to Spaces?  I've got a NSStatusItem
that pops up an NSWindow when you click on it.  I'd like that window to
come up in the current Space, not the Space it was in when it was
started, or the space it was in the last time it popped up that
NSWindow.  Is there some interface to control that?

Bill
___

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 [EMAIL PROTECTED]


Window title bar accessory view

2008-11-18 Thread Houdah - ML Pierre Bernard

Hi!

I would like to replicate the accessory views found in the top right  
of window title bars. Examples include Coda, iCal, Safari,...


How can I add subviews to the window's title bar?

Pierre
___

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 [EMAIL PROTECTED]


Re: Using Cocoa with Spaces?

2008-11-18 Thread Ken Thomases

On Nov 18, 2008, at 7:43 PM, Bill Janssen wrote:


Is there an Objective-C interface to Spaces?  I've got a NSStatusItem
that pops up an NSWindow when you click on it.  I'd like that window  
to

come up in the current Space, not the Space it was in when it was
started, or the space it was in the last time it popped up that
NSWindow.  Is there some interface to control that?


-[NSWindow setCollectionBehavior:]

Cheers,
Ken

___

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 [EMAIL PROTECTED]


Re: Window title bar accessory view

2008-11-18 Thread Andrew Merenbach

On Nov 18, 2008, at 6:26 PM, Houdah - ML Pierre Bernard wrote:


Hi!

I would like to replicate the accessory views found in the top right  
of window title bars. Examples include Coda, iCal, Safari,...


How can I add subviews to the window's title bar?

Pierre


Greetings, Pierre,

I think that what you're referring to is the toolbar (class  
NSToolbar), as I don't see anything besides that at the top of my iCal  
or Safari windows.  (On Leopard, the Unified Title/Toolbar setting in  
Interface Builder, or through code, makes the title bar, which is  
actually separate, look connected to the toolbar.)


If you can afford to target Leopard-only and are willing to put up  
with a slightly buggy interface, you can use Interface Builder to set  
up the toolbar in the window itself and store it in the nib or xib  
that way.  Otherwise, if for whatever reason that won't work for you*,  
you may wish to use a toolbar delegate to handle the configuration of  
the toolbar.  The docs have much more info, as well as "dos" and  
"dont's" of toolbars (for instance: anything in a toolbar, last I  
checked, should have a menu item equivalent; thus if you have a Reset  
button or a Send button or whatnot in your toolbar, there should be a  
Reset or Send menu item, accessible from the menu bar).  Hope this  
helps!


* Selectable toolbar items are one example of why the Interface  
Builder approach may no work for you -- such items are not currently  
configurable in IB.  (They're the sort of item used in the iTunes  
preferences window, where they act like push-buttons of which only one  
can be selected at a time.)


Cheers,
Andrew



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

This email sent to [EMAIL PROTECTED]

Re: Window title bar accessory view

2008-11-18 Thread Kyle Sluder
On Tue, Nov 18, 2008 at 9:26 PM, Houdah - ML Pierre Bernard
<[EMAIL PROTECTED]> wrote:
> I would like to replicate the accessory views found in the top right of
> window title bars. Examples include Coda, iCal, Safari,...

Are you talking about things like the little lock icon in HTTPS Safari
windows?  If so, use -[NSWindow standardWindowButton:] to get an
NSButton instance, and then use -[NSView superview] to get at the
window frame view.  Then use -[NSView addSubview:] to add your custom
view and position it accordingly.

--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 [EMAIL PROTECTED]


Re: release and reference counting query

2008-11-18 Thread Andy Lee

On Nov 18, 2008, at 8:24 PM, Peter N Lewis wrote:

I would actually write:

self.viewController = [[[UIViewController alloc]
 initWithNibName:@"MoveMeView" bundle:[NSBundle mainBundle]]  
autorelease];


I like this best too.  I like combining the autorelease with the alloc/ 
init because you don't have to worry about forgetting to do the  
release later.  And this addresses the brevity issue that Marc asked  
about.


The ivar setting method is much more risky - changes far away from  
this code could introduce bugs.


Exactly.  Although conceptually we are initializing the ivar, this is  
not happening in an init method and it's better not to assume the ivar  
is null.


--Andy

___

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 [EMAIL PROTECTED]


NSArrayController - Remove all objects?

2008-11-18 Thread Jean-Nicolas Jolivet
I'm working on a custom NSArrayController (basically just a subclass  
that allows drag and drop for a table view)...


So far it's working well however, when new files are dropped on my  
table view, I need to remove all the current files... right now the  
dropped files are only added to the list (i.e. added to my Array  
Controller)...


Looking at NSArrayController's doc, I see methods for adding/selecting/ 
removing objects, but no method that removes all objects... I can't  
even find how to get the amount of objects in my array...


Is there any way to remove all files from an array controlled by an  
arraycontroller? Or at least a way to access the  array from within my  
custom ArrayController's code?? I tried [self setArrangedObjects:] but  
the method doesn't exist



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: NSArrayController - Remove all objects?

2008-11-18 Thread Jean-Nicolas Jolivet

I was able to get it done using:

[self removeObjectsAtArrangedObjectIndexes:[NSIndexSet  
indexSetWithIndexesInRange:NSMakeRange(0, [[self arrangedObjects]  
count])]];


can't believe there isn't a better way to do it??


On 18-Nov-08, at 10:23 PM, Jean-Nicolas Jolivet wrote:

I'm working on a custom NSArrayController (basically just a subclass  
that allows drag and drop for a table view)...


So far it's working well however, when new files are dropped on my  
table view, I need to remove all the current files... right now the  
dropped files are only added to the list (i.e. added to my Array  
Controller)...


Looking at NSArrayController's doc, I see methods for adding/ 
selecting/removing objects, but no method that removes all  
objects... I can't even find how to get the amount of objects in my  
array...


Is there any way to remove all files from an array controlled by an  
arraycontroller? Or at least a way to access the  array from within  
my custom ArrayController's code?? I tried [self  
setArrangedObjects:] but the method doesn't exist



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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 [EMAIL PROTECTED]


Re: NSArrayController - Remove all objects?

2008-11-18 Thread DKJ
The superclass NSObjectController has a "remove" method that might do  
what you want.


dkj


On 18-Nov-08, at 19:31 , Jean-Nicolas Jolivet wrote:


I was able to get it done using:

[self removeObjectsAtArrangedObjectIndexes:[NSIndexSet  
indexSetWithIndexesInRange:NSMakeRange(0, [[self arrangedObjects]  
count])]];


can't believe there isn't a better way to do it??


On 18-Nov-08, at 10:23 PM, Jean-Nicolas Jolivet wrote:

I'm working on a custom NSArrayController (basically just a  
subclass that allows drag and drop for a table view)...


So far it's working well however, when new files are dropped on my  
table view, I need to remove all the current files... right now the  
dropped files are only added to the list (i.e. added to my Array  
Controller)...


Looking at NSArrayController's doc, I see methods for adding/ 
selecting/removing objects, but no method that removes all  
objects... I can't even find how to get the amount of objects in my  
array...


Is there any way to remove all files from an array controlled by an  
arraycontroller? Or at least a way to access the  array from within  
my custom ArrayController's code?? I tried [self  
setArrangedObjects:] but the method doesn't exist



Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/silvertab%40videotron.ca

This email sent to [EMAIL PROTECTED]


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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/hatzicware%40shaw.ca

This email sent to [EMAIL PROTECTED]


=
Hatzic Intellectual Software
Victoria BC, 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 [EMAIL PROTECTED]


Binding a CoreData string value to an NSTextView

2008-11-18 Thread John Joyce
Has anyone had any success Binding a CoreData string value to an  
NSTextView?
Everything I try seems to be flumoxed by the NSAttributedString of the  
NSTextStorage backing store.
The lame thing is this: in code, it is easy to [aTextView setString: 
(NSString*)aString] or [aTextView string]
So what's a reliable way to do the same thing but use a coredata  
string attribute as the source and destination here?

Ideally with bindings to keep everything super clean.
If need be, I can of course build some intermediary object.
I'm not interested in attributes, but the intermediary idea may make  
this more practical anyway. Then the ivars of the intermediary could  
be bound to various attributes, if 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 [EMAIL PROTECTED]


Re: Question about interface builder

2008-11-18 Thread Steve Nicholson

On Nov 17, 2008, at 1:59 PM, Kyle Sluder wrote:


Why does everyone new to the platform want to immediately discard IB?
It is the correct (yes, "correct", not "preferred", not "easiest", but
*correct*) way to implement your interface.


I think a quote from Aaron Hillegass is appropriate here:

"Experienced Cocoa programmers put a lot of the smarts of their  
application in the NIB file. As a result, their project has a lot less  
code. Programmers who have spent a few years working in Visual Studio  
get freaked out. They ask me stuff like, 'Can I write Cocoa apps  
without using Interface Builder? I like to see the code. Maybe I can  
just explicitly create my windows and the views that go on it?'
It is difficult to explain how the NIB file (and a few other scary  
ideas) create leverage. It is that leverage that enables one guy in  
his basement to compete with a team of engineers at Microsoft or  
Adobe. It is like I showed a chain saw to a early American colonist,  
and he said, 'Can I cut down the tree without starting the engine? I  
don't like the noise. Maybe I can just bang it against the tree?'"

___

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 [EMAIL PROTECTED]


  1   2   >