CoreData / SQL hang on save

2009-08-25 Thread Greg Hoover
I've run into a hang in CoreData save.  I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well).  The hang occurs inside the  
NSSQLCore and seems to just loop endlessly.  The SQL output supports  
this.  Requests performed at launch succeed as expected, but the app  
quickly reaches a point where Optimistic locking failure exceptions  
are thrown with an endless sequence of ROLLBACKs followed by UPDATEs.   
All of the contexts are using the MergeByPropertyObjectTrump merge  
policy.


Any insight would be much appreciated.


CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0004s
CoreData: annotation: total fetch execution time: 0.0006s for 0 rows.
CoreData: annotation: to-many relationship fault "stopTransactions"  
for objectID 0x560060 > fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0003s
CoreData: annotation: total fetch execution time: 0.0006s for 0 rows.
CoreData: annotation: to-many relationship fault "stopTransactions"  
for objectID 0x558f30 > fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0012s
CoreData: annotation: total fetch execution time: 0.0015s for 0 rows.
CoreData: annotation: to-many relationship fault "stopTransactions"  
for objectID 0x562e80 > fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0073s
CoreData: annotation: total fetch execution time: 0.0096s for 0 rows.
CoreData: annotation: to-many relationship fault "stopTransactions"  
for objectID 0x562e90 > fulfilled from database.  Got 0 rows

CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: COMMIT
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, ZBID = ?, Z_OPT  
= ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: SELECT Z_PK,Z_OPT FROM ZSTOCK WHERE Z_PK IN (1,2,3,4,5)  
ORDER BY Z_PK

CoreData: annotation: sql execution time: 0.0011s
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZFORWARDPE,  
t0.ZLASTTIME, t0.ZMANUAL, t0.ZEPS, t0.ZANNUALEPS, t0.ZDAYRANGE,  
t0.ZTRANSACTIONERROR, t0.ZOPEN, t0.ZDIV, t0.ZNEWS, t0.ZPERCENT,  
t0.ZANNUALEPSDATE, t0.ZUPDATEREQUIRED, t0.ZMARKETCAP, t0.ZEXCHANGE,  
t0.ZDATE, t0.ZCURRENCY, t0.ZMUTUALFUND, t0.ZLABEL,  
t0.ZOPTIONEXPIRATION, t0.ZYEARRANGE, t0.ZCHARTS, t0.ZCURRENCYSET,  
t0.ZONEYEAR, t0.ZTRANSACTIONCACHE, t0.ZHIGH, t0.ZEXCHANGEID,  
t0.ZAVGVOL, t0.ZLABELCOLOR, t0.ZNEWSERRORS, t0.ZNAME, t0.ZCLOSE,  
t0.ZCUSTOMNAME, t0.ZDIVIDENDYIELD, t0.ZDIVDATE, t0.ZLASTDATE,  
t0.ZEXCHANGERATE, t0.ZENABLED, t0.ZASK, t0.ZQUARTERLYEPS, t0.ZBID,  
t0.ZISOPTION, t0.ZALARMSTATUS, t0.ZLOW, t0.ZQUOTEERRORS, t0.ZLAST,  
t0.ZSTRIKE, t0.ZALARMS, t0.ZVOLUME, t0.ZQUARTERLYEPSDATE, t0.ZCHART,  
t0.ZSERVICES, t0.ZCHANGE, t0.ZUNREADNEWS, t0.ZNOTES, t0.ZPE,  
t0.ZCLOSED, t0.ZPEG, t0.ZEXDIVDATE, t0.ZOPTIONTYPE, t0.ZCHARTERRORS  
FROM ZSTOCK t0 WHERE  t0.Z_PK = ?

CoreData: annotation: sql connection fetch time: 0.0008s
CoreData: annotation: total fetch execution time: 0.0013s for 1 rows.
CoreData: annotation: Optimistic locking failure for 0x51fc30 >.  Row was updated.
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZFORWARDPE,  
t0.ZLASTTIME, t0.ZMANUAL, t0.ZEPS, t0.ZANNUALEPS, t0.ZDAYRANGE,  
t0.ZTRANSACTIONERROR, t0.ZOPEN, t0.ZDIV, t0.ZNEWS, t0.ZPERCENT,  
t0.ZANNUALEPSDATE, t0.ZUPDATEREQUIRED, t0.ZMARKETCAP, t0.ZEXCHANGE,  
t0.ZDATE, t0.ZCURRENCY, t0.ZMUTUALFUND, t0.ZLABEL,  
t0.ZOPTIONEXPIRATION, t0.ZYEARRANGE, t0.ZCHARTS, t0.ZCURRENCYSET,  
t0.ZONEYEAR, t0.ZTRANSACTIONCACHE, t0.ZHIGH, t0.ZEXCHANGEID,  
t0.ZAVGVOL, t0.ZLABELCOLOR, t0.ZNEWSERRORS, t0.ZNAME, t0.ZCLOSE,  
t0.ZCUSTOMNAME, t0.ZDIVIDENDYIELD, t0.ZDIVDATE, t0.ZLASTDATE,  
t0.ZEXCHANGERATE, t0.ZENABLED, t0.ZASK, t0.ZQUARTERLYEPS, t0.ZBID,  
t0.ZISOPTION, t0.ZALARMSTATUS, t0.ZLOW, t0.ZQUOTEERRORS, t0.ZLAST,  
t0.ZSTRIKE, t0.ZALARMS, t0.ZVOLUME, t0.ZQUARTERLYEPSDATE, t0.ZCHART,  
t0.ZSERVICES, t0.ZCHANGE, t0.ZUNREADNEWS, t0.ZNOTES, t0.ZPE,  
t0.ZCLOSED, t0.ZPEG, t0.ZEXDIVDATE, t0.ZOPTIONTYPE, t0.ZCHARTERRORS  
FROM ZSTOCK t0 WHERE  t0.Z_PK = ?

CoreData: annotation: sql connection fetch time: 0.0093s
CoreData: annotation: total fetch execution time: 0.0100s for 1 rows.
CoreData: annotation: Optimistic locking failure for 0x562e80 >.  Row was updated.

CoreData: sql: ROLLBACK
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET ZEPS = 

[IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Brian Bruinewoud

All,

I have a simple view that contains a UITextField and a UIButton. The  
user will most often want to type text and ignore the button. Is there  
some way I can make the keyboard appear immediately that view is  
shown? I can't find anything in IB and reading about UITextField,  
UIView, UIWindow, UIResponder didn't enlighten me.


I've seen it done in apps, not sure how to do it.

Thanks,
Brian.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Georg C. Brückmann

On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton. The  
user will most often want to type text and ignore the button. Is  
there some way I can make the keyboard appear immediately that view  
is shown? I can't find anything in IB and reading about UITextField,  
UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
   [super viewDidLoad];
   [_myTextFieldOutlet becomeFirstResponder];
}

– Georg

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Brian Bruinewoud


On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
  [super viewDidLoad];
  [_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I noticed  
that its documentation said


	"Use the NSWindow makeFirstResponder: method, not this method, to  
make an object the first responder. Never invoke this method directly."


But There is no NSWindow on iPhone.

So far I've tried:

[ self.textField makeFirstResponder ];

[ self makeFirstResponder: textField ];

UIWindow *win = [((AppDelegate*)[[ UIApplication  
sharedApplication ] delegate ]) window ];

[ win makeFirstResponder: self. textField ]

They all complain about the object "may not respond to '- 
makeFirstResponder'"


Brian.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What's the purpose of the "fax" received action?

2009-08-25 Thread Graham Cox


On 24/08/2009, at 5:57 PM, Behrang Saeedzadeh wrote:


Hi all,

What's the purpose of the "fax" received action in NSTableView and  
is it

documented somewhere at all? Did a quick search
and couldn't find its documentation.



Not sure where you're using this as it's not in my headers for  
NSTableView. In fact the only place that mentions it at all is NSView:


/* Printing action method (Note fax: is obsolete) */
- (void)print:(id)sender;


So I think there's your answer...

Does anyone fax these days? Seems so 1980s.

--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Andy Lee

On Aug 25, 2009, at 8:28 AM, Brian Bruinewoud wrote:

On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
 [super viewDidLoad];
 [_myTextFieldOutlet becomeFirstResponder];
}

Actually, that's not correct, but while I was checking that I  
noticed that its documentation said


	"Use the NSWindow makeFirstResponder: method, not this method, to  
make an object the first responder. Never invoke this method  
directly."


You're reading the Cocoa docs, not the iPhone docs.  There's no  
NSWindow on the iPhone.


The *iPhone* doc for becomeFirstResponder says:

"You may call this method to make a responder object such as a view  
the first responder. However, you should only call it on that view if  
it is part of a view hierarchy. If the view’s window property holds a  
UIWindow object, it has been installed in a view hierarchy; if it  
returns nil, the view is detached from any hierarchy."


--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 arch...@mail-archive.com


Re: What's the purpose of the "fax" received action?

2009-08-25 Thread Andy Lee


On Aug 25, 2009, at 8:29 AM, Graham Cox wrote:



On 24/08/2009, at 5:57 PM, Behrang Saeedzadeh wrote:


Hi all,

What's the purpose of the "fax" received action in NSTableView and  
is it

documented somewhere at all? Did a quick search
and couldn't find its documentation.



Not sure where you're using this as it's not in my headers for  
NSTableView.


I'm guessing Behrang saw it in IB.  If I Control-drag from a button to  
any view I see fax: among the possible received actions.


I think once upon a time "Fax" was a button on the print dialog.  At  
least that was true on the NeXT.  Now, instead, "Fax PDF..." is an  
option under the "PDF" button.  I suspect this is an accidental  
leftover in IB -- probably worth a bug report.  From a quick  
experiment, fax: seems to be a no-op, not even generating a log message.


--Andy



In fact the only place that mentions it at all is NSView:

/* Printing action method (Note fax: is obsolete) */
- (void)print:(id)sender;


So I think there's your answer...

Does anyone fax these days? Seems so 1980s.

--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/aglee%40mac.com

This email sent to ag...@mac.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Georg C. Brückmann

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Andy Lee


On Aug 25, 2009, at 9:02 AM, Andy Lee wrote:


On Aug 25, 2009, at 8:28 AM, Brian Bruinewoud wrote:

On 25/08/2009, at 20:42 , Georg C. Brückmann wrote:


On 25.08.2009, at 12:30, Brian Bruinewoud wrote:

I have a simple view that contains a UITextField and a UIButton.  
The user will most often want to type text and ignore the button.  
Is there some way I can make the keyboard appear immediately that  
view is shown? I can't find anything in IB and reading about  
UITextField, UIView, UIWindow, UIResponder didn't enlighten me.


-[UIResponder becomeFirstResponder], e. g.:

- (void)viewDidLoad {
[super viewDidLoad];
[_myTextFieldOutlet becomeFirstResponder];
}


Actually, that's not correct,


You seem to be right about this part -- becomeFirstResponder doesn't  
bring up the keyboard for me, or I'm doing something wrong.


--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 arch...@mail-archive.com


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Luke the Hiesterman


On Aug 25, 2009, at 6:33 AM, Andy Lee wrote:

You seem to be right about this part -- becomeFirstResponder doesn't  
bring up the keyboard for me, or I'm doing something wrong.


Are you sure the text field isn't nil when you're calling this? Maybe  
it's loaded from a nib and you forgot to wire up the outlet?


Luke
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Andy Lee


On Aug 25, 2009, at 9:34 AM, Luke the Hiesterman wrote:



On Aug 25, 2009, at 6:33 AM, Andy Lee wrote:

You seem to be right about this part -- becomeFirstResponder  
doesn't bring up the keyboard for me, or I'm doing something wrong.


Are you sure the text field isn't nil when you're calling this?  
Maybe it's loaded from a nib and you forgot to wire up the outlet?


First thing I checked. :)

A quick look on StackOverflow suggests the code should go into  
viewDidAppear:animated:.  Itching to try this but I have to run to  
work...


--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 arch...@mail-archive.com


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread Luke the Hiesterman

Obvious question is, then, where are you calling it?

Luke

On Aug 25, 2009, at 6:37 AM, Andy Lee wrote:



On Aug 25, 2009, at 9:34 AM, Luke the Hiesterman wrote:



On Aug 25, 2009, at 6:33 AM, Andy Lee wrote:

You seem to be right about this part -- becomeFirstResponder  
doesn't bring up the keyboard for me, or I'm doing something wrong.


Are you sure the text field isn't nil when you're calling this?  
Maybe it's loaded from a nib and you forgot to wire up the outlet?


First thing I checked. :)

A quick look on StackOverflow suggests the code should go into  
viewDidAppear:animated:.  Itching to try this but I have to run to  
work...


--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 arch...@mail-archive.com


NSImage with multiple representation sizes

2009-08-25 Thread Benjamin Rister

The core question:
Is it still the best practice to have conceptually same images of  
different sizes in different files, e.g. Foo9x9.tiff, Foo32x32.tiff?   
icns isn't an option because they aren't all the standard icns sizes,  
and several places in the docs seem to discourage lumping them  
together (e.g. with tiffutil) anyway.



The details:

We have several images that are displayed at different sizes at  
various places in an application.  Our artist has generated several  
bitmaps for these different scales.  Modeling on the concept of  
an .icns file, my inclination would be to try and lump them all  
together in one multi-representation file and let NSImage figure out  
what the best representation is to draw from at any given point.  This  
not only is convenient for the various usages around the app, but also  
for resolution independence (...maybe...see below).


However, man tiffutil says:
-cat allows combining multiple TIFF files into one. ... If the real  
sizes (pixel size
 divided by dpi) of the images being combined are not the same,  
a warning
 will be generated. This makes sure that NSImage can  
successfully choose

 the right size image out of the generated TIFF file.


And Cocoa Drawing Guide: Images, "How an Image Representation Is  
Chosen" gives rules about color space, dpi, and bit depth, but there's  
no rule about choosing representations based on size.  (But there's  
icns, right?  How is that supposed to work, then?)


I'm also concerned for resolution independence that the system might  
not choose the 32x32px rep to fill a 16x16pt space at a 2x scale  
factor, because everything I've seen in the resolution independence  
docs only talks about representations with different dpi.  It would be  
rather inelegant to have to have multiple representations with the  
same pixels and just different metadata.


So between the resolution independence concern, and the docs seemingly  
discouraging having different sized images in one file, this raises  
the core question above.  What's the best way to arrange this for both  
drawing the image at different sizes in different places and  
resolution independence?


Best,
Benjamin Rister
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: need help about the touch event

2009-08-25 Thread Randall Meadows

On Aug 24, 2009, at 4:42 PM, Gill Bates wrote:


Hi All,

currently we have three kinds of touch event:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesBegan"); }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesMoved"); }
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesEnded"); }
what if I want to detect the time once user pressed at a specific  
icon.
In particular, I want to implement some feature like iphone on the  
homescreen, when the user pressed an icon for 2 seconds, the system  
would show something.

So anyone has an idea for this?


In the -touchesBegan, set a timer for 2 seconds; in the timer  
callback, do whatever it is you want to do (jiggle icons, for  
example).  However, if you get a -touchesEnded (or -touchesMoved, as  
appropriate for your use case) *before* the timer fires, invalidate  
the timer and carry on as if nothing happened.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data dog-slow when using first time after boot

2009-08-25 Thread Ruotger Skupin


Am 24.08.2009 um 23:13 schrieb Ben Trumbull:


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent  
to instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use  
future-break objc_exception_throw


#0  0x97503f26 in objc_exception_throw ()
#1  0x944279db in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#2  0x94383026 in ___forwarding___ ()
#3  0x94382bf2 in __forwarding_prep_0___ ()
#4  0x97b3acae in -[NSSQLCore  
_prefetchRelationshipKey:sourceEntityDescription:sourceObjectIDs:prefetchRelationshipKeys:inContext 
:] ()
#5  0x97b3ab87 in -[NSSQLCore  
_prefetchWithFetchRequest:withObjectIDs:inContext:] ()
#6  0x97b3d159 in -[NSSQLCore  
_prefetchRelationshipKey:sourceEntityDescription:sourceObjectIDs:prefetchRelationshipKeys:inContext 
:] ()
#7  0x97b3ab87 in -[NSSQLCore  
_prefetchWithFetchRequest:withObjectIDs:inContext:] ()

#8  0x97b2c106 in newFetchedRowsForFetchPlan_MT ()
#9  0x97b164e7 in -[NSSQLCore newRowsForFetchPlan:] ()
#10 0x97b15d75 in -[NSSQLCore objectsForFetchRequest:inContext:] ()
#11 0x97b15991 in -[NSSQLCore executeRequest:withContext:] ()
#12 0x97b14ae1 in -[NSPersistentStoreCoordinator(_NSInternalMethods)  
executeRequest:withContext:] ()
#13 0x97b11fff in -[NSManagedObjectContext executeFetchRequest:error:]  
()
#14 0x00010b6e in +[GPPayPalTransaction  
transactionsWithPredicate:sortDescriptors:returnObjectsAsFaults:relationshipKeyPathsForPrefetching:inManagedObjectContext:error 
:] (self=0x10ebd4, _cmd=0x6a180, inPredicate=0x0,  
inSortDescriptors=0x10adb80, inAsFaults=0 '\000',  
inPrefetchKeyPaths=0x10ff990, inContext=0x10ad7e0,  
outError=0xbfffe73c) at /Users/roddi/Development/GaragePay/ 
GPPayPalTransaction.m:100


(this is 10A432)




For the record: I do use one-way relationships



That should be okay as long as you're not pretending to use a no  
inverse to-many relationship as a de facto many to many  
relationship.  No inverse relationships can only behave as if the  
inverse were to-one.  Specifically, each row in the destination  
entity may only be associated with a single row in the source entity  
if the relationship on the source entity does not have an inverse.   
(e.g. you only get join tables in fully modeled bi-directional  
relationships)
Do I understand that correctly? No two (or more) Accounts or  
Transactions should "point" to the same Amount (see simplified  
schema). Unless there's a bug somewhere that's not the case.


|-|
| Transaction |
|-| ||
|net  | --> | Amount | <<-- (one other entity)
|gross| --> ||
|fee  | --> |value   | <<-
|account  | <<- |currency||
|...  |||||
|-||  |
   |  |
 --   |
| |
|||   |
|| Account|   |
|||   |
||balances| --
 --> |transactions|
 |... |
 ||

So basically I use Amount only as a container for a currency  
descriptor and a value. I would have to model 7 inverse relationships  
on that entity to make all relationships two-way.





Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if you've  
run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original post,  
but since I use Smart Folders predicates can look a lot different  
(i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)


AdditionalInfo has a one-to-one two-way relationship with Transaction  
(not depicted above).


Hope that helps
Ruotger

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


How to keep the last tree item of NSOutlineView in the most bottom of a Sidebar?

2009-08-25 Thread Vadim Shpakovski

Hi,

I'd like to have the same behavior of special items as it's done in  
the Things application.


I mean Logbook and Trash items on the picture placed under this link: 
http://tinyurl.com/lhctza

Please advise any way to implement the same functionality in the  
sidebar tree.


I feel that special ‘spacer’ item should be used together with  
outlineView:heightOfRowByItem: method.


However, I can't find how to calculate the total height of all visible  
items (incl. space between groups).


Thanks,
Vadim___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


How is "Open Recent >" identified and populated?

2009-08-25 Thread Jerry Krinock
Today I wanted to add a menu item with a submenu similar to "Open  
Recent".  For example, Xcode has:


   ...
   Open Recent File ->
   Open Recent Document ->
   ...

For convenience, I copy/paste/duplicated the "Open Recent" menu item,  
connected everything, wrote my code, but then found that my new menu  
item was populated with recent documents and a "Clear Menu" item.  In  
other words, my code was ignored and instead it became another "Open  
Recent" item.


I solved the problem by dragging a new menu item out of the Interface  
Builder library and starting over from scratch, because I could not  
figure out how Cocoa identifies the "Open Recent" menu item!


As far as I can see, the "Open Recent" menu item and its submenu are  
not special in any way -- no tags, no targets, no actions, no  
connections, no bindings, no special subclass.  The "Clear Menu" item  
of the submenu does have a connection to First Responder's - 
clearRecentDocuments:, but removing that in my duplicate didn't change  
the behavior.


Is there some magic under the covers?  How does Cocoa know which menu  
item is "Open Recent"?


Sincerely,

Jerry Krinock

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Jason Foreman


On Aug 24, 2009, at 7:44 PM, Kyle Sluder wrote:

On Mon, Aug 24, 2009 at 5:39 PM, Jack Carbaugh  
wrote:
My question is how do i change the contextual menu when the user  
right

clicks.


Override -menuForEvent:.



Another way is to implement the - 
tableView:willDisplayCell:forTableColumn:row: delegate method and  
assign the cell's menu there.



Jason





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 arch...@mail-archive.com

Re: How is "Open Recent >" identified and populated?

2009-08-25 Thread I. Savant

On Aug 25, 2009, at 11:33 AM, Jerry Krinock wrote:

Is there some magic under the covers?  How does Cocoa know which  
menu item is "Open Recent"?


  What about its title? :-)

  It's possible it looks for it by name (and also possible it only  
cares about the first one it finds). In what order was your copied  
one? First or second?


--
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 arch...@mail-archive.com


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Corbin Dunn


On Aug 25, 2009, at 8:35 AM, Jason Foreman wrote:



On Aug 24, 2009, at 7:44 PM, Kyle Sluder wrote:

On Mon, Aug 24, 2009 at 5:39 PM, Jack Carbaugh  
wrote:
My question is how do i change the contextual menu when the user  
right

clicks.


Override -menuForEvent:.



Another way is to implement the - 
tableView:willDisplayCell:forTableColumn:row: delegate method and  
assign the cell's menu there.




Or, populate the menu dynamically.

The DragNDropOutlineView demo app (on your system) and the 10.5 AppKit  
release notes cover this.


corbin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: applicationWillTerminate: issue

2009-08-25 Thread Jason Foreman


On Aug 24, 2009, at 10:26 PM, Michael de Haan wrote:


-applicationWillTerminate: doesn't magically get called.
NSApplication posts this notification to the default notification
center.  NSApplication also automatically signs its delegate up for
this notification.



Kyle, from the "Cocoa Fundamentals Guide":   "Although you can  
dynamically change the delegate, only one object can be a delegate  
at a time. Thus if you want multiple objects to be informed of a  
particular program event at the same time, you cannot use delegation."


So, if I understand you and the documentation correctly , even  
though I had implemented the delegate of NSApplication in **both**  
of my classes, **only** one of those classes will respond to  
"applicationWillTerminate:" at a time. If this is indeed correct,  
then I need to rethink the design of my application, and you have  
already suggested how to do this.




True, only one object can be the application delegate at any one  
time.  However, multiple objects can be subscribed to application  
notifications, and the notification will be sent to all subscribed  
objects when it is posted.


You should read up on NSNotificationCenter, and on the notifications  
that NSApplication posts, specifically  
NSApplicationWillTerminateNotification in your case.  Your second  
object should not set itself as the application delegate, but rather  
should subscribe to this notification and handle it accordingly.



Jason




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 arch...@mail-archive.com

Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Kyle Sluder
On Tue, Aug 25, 2009 at 8:35 AM, Jason Foreman wrote:
> Another way is to implement the
> -tableView:willDisplayCell:forTableColumn:row: delegate method and assign
> the cell's menu there.

Table views reuse their cells.  You can't do a per-row menu by setting
the cell menu, because there's only one cell for a column.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Kyle Sluder
On Tue, Aug 25, 2009 at 8:41 AM, Corbin Dunn wrote:
> Or, populate the menu dynamically.

This is probably the best idea.  No subclassing of NSTableView required.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: applicationWillTerminate: issue

2009-08-25 Thread Michael de Haan


On Aug 25, 2009, at 8:46 AM, Jason Foreman wrote:



On Aug 24, 2009, at 10:26 PM, Michael de Haan wrote:


-applicationWillTerminate: doesn't magically get called.
NSApplication posts this notification to the default notification
center.  NSApplication also automatically signs its delegate up for
this notification.



Kyle, from the "Cocoa Fundamentals Guide":   "Although you can  
dynamically change the delegate, only one object can be a delegate  
at a time. Thus if you want multiple objects to be informed of a  
particular program event at the same time, you cannot use  
delegation."


So, if I understand you and the documentation correctly , even  
though I had implemented the delegate of NSApplication in **both**  
of my classes, **only** one of those classes will respond to  
"applicationWillTerminate:" at a time. If this is indeed correct,  
then I need to rethink the design of my application, and you have  
already suggested how to do this.




True, only one object can be the application delegate at any one  
time.  However, multiple objects can be subscribed to application  
notifications, and the notification will be sent to all subscribed  
objects when it is posted.





JasonI will re-read those, but your insight has clarified  
something that was confusing. Much appreciated.








___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Corbin Dunn


On Aug 25, 2009, at 8:58 AM, Kyle Sluder wrote:

On Tue, Aug 25, 2009 at 8:35 AM, Jason Foreman  
wrote:

Another way is to implement the
-tableView:willDisplayCell:forTableColumn:row: delegate method and  
assign

the cell's menu there.


Table views reuse their cells.  You can't do a per-row menu by setting
the cell menu, because there's only one cell for a column.


That is true; table views reuse cells.

However, it will work (and it is a recommended way to solve this  
problem), since the tableView will first acquire a  
"preparedCellAtColumn:row:", which calls tableView:willDisplayCell:.  
So, any menu you have set there will correctly is used. This technique  
is also shown in the DragNDropOutlineView demo app on 10.5.



- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: 
(NSCell *)cell forTableColumn:(NSTableColumn *)tableColumn item:(id) 
item {

SimpleNodeData *nodeData = [item representedObject];
...
} else if ([[tableColumn identifier]  
isEqualToString:COLUMNID_IS_EXPANDABLE]) {

[cell setEnabled:nodeData.container];
// On Mac OS 10.5 and later, in willDisplayCell: we can  
dynamically set the contextual menu (right click menu) for a  
particular cell. If nothing is set, then the contextual menu for the  
NSOutlineView itself will be used. We will set a different menu for  
the "Expandable?" column, and leave the default one for everything else.

[cell setMenu:expandableColumnMenu];
}
// For all the other columns, we don't do anything.
}

corbin


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Kyle Sluder
On Tue, Aug 25, 2009 at 9:11 AM, Corbin Dunn wrote:
> However, it will work (and it is a recommended way to solve this problem),
> since the tableView will first acquire a "preparedCellAtColumn:row:", which
> calls tableView:willDisplayCell:. So, any menu you have set there will
> correctly is used. This technique is also shown in the DragNDropOutlineView
> demo app on 10.5.

Ah.  Is this documented anywhere?  (Looks like NSTableView.h makes an
oblique reference to this in its headerdoc for
-performClickOnCellAtColumn:row:).  I'd hate to rely on implementation
details.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-25 Thread Corbin Dunn


On Aug 25, 2009, at 9:30 AM, Kyle Sluder wrote:


On Tue, Aug 25, 2009 at 9:11 AM, Corbin Dunn wrote:
However, it will work (and it is a recommended way to solve this  
problem),
since the tableView will first acquire a  
"preparedCellAtColumn:row:", which
calls tableView:willDisplayCell:. So, any menu you have set there  
will
correctly is used. This technique is also shown in the  
DragNDropOutlineView

demo app on 10.5.


Ah.  Is this documented anywhere?


Yes -- the AppKit release notes should be considered part of our  
official documentation.


http://developer.apple.com/releasenotes/Cocoa/AppKit.html


(Looks like NSTableView.h makes an
oblique reference to this in its headerdoc for
-performClickOnCellAtColumn:row:).  I'd hate to rely on implementation
details.



The header comments are also correct and can be relied upon.

corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Stop automatic editing of NSTextField

2009-08-25 Thread bryscomat
Hey all. Quick question: How do I prevent a window from initially  
making an NSTextField the firstResponder? I do not want any controls  
to automatically begin editing.

Thanks.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What's the purpose of the "fax" received action?

2009-08-25 Thread Andrew Merenbach


On Aug 24, 2009, at 12:57 AM, Behrang Saeedzadeh wrote:


Hi all,

What's the purpose of the "fax" received action in NSTableView and  
is it

documented somewhere at all? Did a quick search
and couldn't find its documentation.

Best regards,
Behrang Saeedzadeh


I asked essentially this question a while back--Erik Buck answered at

.

To quote the main portion:


In the NeXTstep 2.0 or 3.0 time frame, NeXT added AppKit framework
support for faxing.  Anything that could be printed could be faxed.
The cool part was that all existing AppKit based applications
automatically got fax support via the print panel without even being
recompiled.



Cheers,
Andrew

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Stop automatic editing of NSTextField

2009-08-25 Thread bryscomat

Nevermind. It's the [NSWindow setInitialFirstResponder:] method.
Duh.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: applicationWillTerminate: issue

2009-08-25 Thread Michael de Haan


On Aug 24, 2009, at 6:02 PM, Graham Cox wrote:



On 25/08/2009, at 10:33 AM, Michael de Haan wrote:


So, 2 quick questions.

1) Is what I am seeing expected behavior or am I doing something  
wrong.


2) Although not strictly speaking a cocoa question, would better  
design be to collect all "values/properties" to be saved in one  
location, thus avoiding the problem I am having?



I'd suggest you should decentralise your preferences handling, or at  
least, use NSUserDefaults, which centralises them for you. In the  
bad old days, the classic model was to load all your prefs at start  
up and save them all at quit, but really it's easier just to get/set  
each preference at its point of use. You can do that easily using  
[NSUserDefaults standardUserDefaults]. Then this problem simply goes  
away as well as keeping your code nice and compartmentalized and  
even reusable despite having persistent state.


But if for some reason you have to get notified of a terminate, the - 
applicationWillTerminate: is sent to the application's delegate, so  
if you have one that implements the method it will be called.  
Otherwise you have to specifically subscribe to the notification  
using the NotificationCenter.


--Graham





G'day Graham,
Thanks for your input. I redesigned the app based on yours and others  
input. Your and Kyle's design makes much more senseie no need for  
2 "-applicationWillTerminate:" methods. What I did not fully  
appreciate,  despite reading the notes, (more than once :-)  )  was  
**how** delegation works vs Notification, which these last answers  
have clarified. All part of learning, I guess.

As always, much appreciated.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Normalize an NSAttributedString

2009-08-25 Thread Ross Carter
NSString has methods for normalizing the content using Normalization  
Forms D, KD, C, and KC. NSAttributedString does not.


Is there any way to normalize an NSAttributedString?

I need to archive an NSAttributedString by extracting its string,  
attributes, and the attribute ranges. This is easy enough to do. The  
problem is in re-creating the attributed string from the archived  
values. The new attributed string might be created with a different  
mapping than the original, which would make the range values inaccurate.


I'd love to do this:

Archiving:
1. Normalize the source attributed string.
2. Archive its string content and its attribute information.

Unarchiving:
3. Create a new string from the archived data and normalize it.
4. Created a new attributed string from that string and the archived  
attributes.


But I don't know how to do step 1.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Dave DeLong
What's wrong with just archiving it and unarchiving it?   
NSAttributedString conforms to the NSCoding protocol, so you shouldn't  
need to do any custom archiving yourself.  Just use an NSKeyed(Un) 
Archiver.


Dave

On Aug 25, 2009, at 11:02 AM, Ross Carter wrote:

NSString has methods for normalizing the content using Normalization  
Forms D, KD, C, and KC. NSAttributedString does not.


Is there any way to normalize an NSAttributedString?

I need to archive an NSAttributedString by extracting its string,  
attributes, and the attribute ranges. This is easy enough to do. The  
problem is in re-creating the attributed string from the archived  
values. The new attributed string might be created with a different  
mapping than the original, which would make the range values  
inaccurate.


I'd love to do this:

Archiving:
1. Normalize the source attributed string.
2. Archive its string content and its attribute information.

Unarchiving:
3. Create a new string from the archived data and normalize it.
4. Created a new attributed string from that string and the archived  
attributes.


But I don't know how to do step 1.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Stop automatic editing of NSTextField

2009-08-25 Thread Jean-Daniel Dupas

Note that it can also be defined in Interface Builder.

Le 25 août 2009 à 18:50, bryscomat a écrit :


Nevermind. It's the [NSWindow setInitialFirstResponder:] method.
Duh.
___

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/devlists%40shadowlab.org

This email sent to devli...@shadowlab.org



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Ross Carter

I need to archive it as xml.

On Aug 25, 2009, at 1:06 PM, Dave DeLong wrote:

What's wrong with just archiving it and unarchiving it?   
NSAttributedString conforms to the NSCoding protocol, so you  
shouldn't need to do any custom archiving yourself.  Just use an  
NSKeyed(Un)Archiver.


Dave

On Aug 25, 2009, at 11:02 AM, Ross Carter wrote:

NSString has methods for normalizing the content using  
Normalization Forms D, KD, C, and KC. NSAttributedString does not.


Is there any way to normalize an NSAttributedString?

I need to archive an NSAttributedString by extracting its string,  
attributes, and the attribute ranges. This is easy enough to do.  
The problem is in re-creating the attributed string from the  
archived values. The new attributed string might be created with a  
different mapping than the original, which would make the range  
values inaccurate.


I'd love to do this:

Archiving:
1. Normalize the source attributed string.
2. Archive its string content and its attribute information.

Unarchiving:
3. Create a new string from the archived data and normalize it.
4. Created a new attributed string from that string and the  
archived attributes.


But I don't know how to do step 1.

___

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/rosscarterdev 
%40me.com


This email sent to rosscarter...@me.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSTreeController setSelectionIndexPath depends on sort order

2009-08-25 Thread Konrad Windszus
I have a NSTreeController which is connected to a NSOutlineView. I  
wish to have links to specific entries in the NSTreeController. With  
these links I want to select those items. I therefore use the  
NSIndexPath. Unfortunately the NSIndexPath becomes invalid if the sort  
order is changed by the user.
How can I have links to items in NSTreeController (which I can then  
select with the help of the link), which are independent of the sort  
order?

Thanks for any help
Konrad
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


kTISPropertyUnicodeKeyLayoutData Returns NULL

2009-08-25 Thread Joe Turner

Hey,

So, to translate from a string to a keycode, I've been using the  
UCKeyboardLayout. But, on some keyboard layouts (only Japanese so  
far), I get a NULL pointer for the layout, and then the app crashes.


Here's the code:
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard,  
kTISPropertyUnicodeKeyLayoutData);

keyboardLayout = (const UCKeyboardLayout*)CFDataGetBytePtr(uchr);

The third line is where it will crash, I assume because I am passing  
NULL into the CFDataGetBytePtr().


In reading the documentation, it seems that the value of property  
"kTISPropertyUnicodeKeyLayoutData" only returns NULL if there is no  
layout data, or if the data is KCHR. So, do these users somehow have  
KCHR keyboard layouts? If so, it seems apple has depricated any  
methods that could be used to get the data and then keycodes from a  
KCHR resource. So, is there any way around this?


Cheers,

Joe
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Synchronizing NSWindow updates with threads

2009-08-25 Thread McLaughlin, Michael P.
I have an NSOperation app (simulation) executing one timestep at a time.
The threads are working fairly well but the running output is supposed to be
drawn as a color-coded map every 10 timesteps.

It seems that a window update is a low priority task because my threads are
running and continually sending new data back to the main thread but the
window is not updating (being redrawn) at the proper times (if at all).
viewsNeedDisplay(), etc. does not suffice.

Could someone tell me the proper way to

1) force an immediate (synchronous) window redraw, or
2) set the redraw priority high enough so that it takes precedence over my
threads, or
3) some other better solution?

Thanks.

-- 
Mike McLaughlin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Binding exception on Tiger

2009-08-25 Thread James Walker
When my app ran on Tiger, there was an NSInvalidArgumentException with 
the reason:


"-observeValueForKeyPath:ofObject:change:context: only defined for 
abstract class.  Define -[NSCFString 
observeValueForKeyPath:ofObject:change:context:]!"


That seemed to happen when I had 2 enabled bindings on the same 
checkbox.  Is that a known limitation?

--
  James W. Walker, Innoventive Software LLC
  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Alastair Houghton

On 25 Aug 2009, at 18:02, Ross Carter wrote:


I'd love to do this:

Archiving:
1. Normalize the source attributed string.
2. Archive its string content and its attribute information.

Unarchiving:
3. Create a new string from the archived data and normalize it.
4. Created a new attributed string from that string and the archived  
attributes.


Hi Ross,

I see the problem :-)

What you *could* do is iterate over the ranges in the attributed  
string, retrieve the substring associated with each range, normalise  
*that* string, then store the attributes and the length of the  
normalised string.


Then to recreate your attributed string, you read (string, attributes)  
pairs from your storage, re-normalise your string if you like, and  
then append the string to your new attributed string with the  
specified attributes.


Note that there is an issue with this approach, which is that  
attribute runs that start in the middle of a grapheme cluster might  
result in odd behaviour wrt normalisation.  However, it generally  
doesn't make sense to have such an attribute run (it's the equivalent  
of asking for e.g. a bold "o" with an italic umlaut, which makes no  
sense), it's just something that you might want to be aware of.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Synchronizing NSWindow updates with threads

2009-08-25 Thread Alastair Houghton

On 25 Aug 2009, at 19:50, McLaughlin, Michael P. wrote:

I have an NSOperation app (simulation) executing one timestep at a  
time.
The threads are working fairly well but the running output is  
supposed to be

drawn as a color-coded map every 10 timesteps.


How fast is this in Hertz?  If you're trying to update the window at  
more than 60Hz, your updates will be throttled automatically by the  
window server, which can make it look as if your app isn't updating  
the display as often as you expect.


It seems that a window update is a low priority task because my  
threads are
running and continually sending new data back to the main thread but  
the
window is not updating (being redrawn) at the proper times (if at  
all).

viewsNeedDisplay(), etc. does not suffice.


It's very rare that -setNeedsDisplay: is insufficient (honestly).   
Usually when it is, you're trying to do something the wrong way.   
Before exploring other options, I think you should check that:


1. Your main thread is running the event loop (i.e. you aren't using  
it to do something else as well that is taking time away from  
redrawing).


2. Your drawing code is efficient.

3. You aren't trying to redraw more than 60 times per second.

4. Whatever mechanism you are using to synchronise your data structure  
isn't getting in the way of updates.


If you *really* need to force a view to display right now, you can  
send it the -display message, and if you're *really, really* stuck  
there's also NSGraphicsContext's -flushGraphics (or the CGContext  
equivalent), but if the problem is one of the above then you may very  
well find that neither of these help very much.  Certainly both - 
display and -flushGraphics are usually the wrong solution.


You might find the following link useful:




If you're using OpenGL to redraw (which you might consider if you want  
really high performance), you might also find this useful:




Kind regards,

Alastair.

--
http://alastairs-place.net



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: [IPhone 3.0] How do I make a UITextField the first responder?

2009-08-25 Thread David Duncan

On Aug 25, 2009, at 6:37 AM, Andy Lee wrote:


First thing I checked. :)

A quick look on StackOverflow suggests the code should go into  
viewDidAppear:animated:.  Itching to try this but I have to run to  
work...



-viewDidLoad only means that the view controller's view was loaded, it  
does not mean that it is in a view hierarchy yet.

-viewDidAppear: or -viewWillAppear: make more sense here.
--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: What's the purpose of the "fax" received action?

2009-08-25 Thread Behrang Saeedzadeh
Thanks everybody. And yes I saw it in IB.
Best,
Behrang Saeedzadeh
---
http://my.opera.com/behrangsa
http://twitter.com/behrangsa


On Wed, Aug 26, 2009 at 2:48 AM, Andrew Merenbach wrote:

>
> On Aug 24, 2009, at 12:57 AM, Behrang Saeedzadeh wrote:
>
>  Hi all,
>>
>> What's the purpose of the "fax" received action in NSTableView and is it
>> documented somewhere at all? Did a quick search
>> and couldn't find its documentation.
>>
>> Best regards,
>> Behrang Saeedzadeh
>>
>
> I asked essentially this question a while back--Erik Buck answered at
>
> .
>
> To quote the main portion:
>
>  In the NeXTstep 2.0 or 3.0 time frame, NeXT added AppKit framework
>> support for faxing.  Anything that could be printed could be faxed.
>> The cool part was that all existing AppKit based applications
>> automatically got fax support via the print panel without even being
>> recompiled.
>>
>
>
> Cheers,
>Andrew
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Selection highlight in NSTextFieldCell

2009-08-25 Thread bryscomat
How do I change the selection highlight color for an NSTextFieldCell  
being edited? I'm using a transparent window and would like to change  
the highlight to a light gray instead of the default light blue,

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CoreData / SQL hang on save

2009-08-25 Thread Melissa J. Turner


On Aug 25, 2009, at 02:19, Greg Hoover wrote:

I've run into a hang in CoreData save.  I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well).  The hang occurs inside the  
NSSQLCore and seems to just loop endlessly.  The SQL output supports  
this.  Requests performed at launch succeed as expected, but the app  
quickly reaches a point where Optimistic locking failure exceptions  
are thrown with an endless sequence of ROLLBACKs followed by  
UPDATEs.  All of the contexts are using the  
MergeByPropertyObjectTrump merge policy.


Any insight would be much appreciated.




There is a known issue on 10.5.* that results in Core Data entering an  
infinite loop during save if the database has been corrupted such that  
the optimistic locking column is set to NULL.


A way to tell would be to run sqlite3 on the database and execute the  
following SQL statement:


select Z_PK, Z_OPT from ZSTOCK where Z_PK IN (1, 4);

I'm guessing you'll get back something that looks like:

1|
4|

Which means that something has stuffed unexpected NULLs into your  
database.


The issue has been fixed in 10.6, but the only real workaround on  
10.5.* is to manually repair the database by setting the value of the  
Z_OPT column to be non-null (1 is always a good option).


Cheers,
+Melissa



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CoreData / SQL hang on save

2009-08-25 Thread Greg Hoover

Hi Melissa,

Thanks for you response.

The problem actually just started showing up in 10.6 (wasn't a problem  
in 10.4 or 10.5). :-/


The hang stopped for a few launches and reverted to its previous  
output: "binding not implemented for SQLType 7".  But then it happened  
again...  The SQL file does not have null values for any Z_OPT fields.



CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?

CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
safe save
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?

CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
safe save

Thanks,
Greg

On Aug 25, 2009, at 1:16 PM, Melissa J. Turner wrote:



On Aug 25, 2009, at 02:19, Greg Hoover wrote:

I've run into a hang in CoreData save.  I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well).  The hang occurs inside the  
NSSQLCore and seems to just loop endlessly.  The SQL output  
supports this.  Requests performed at launch succeed as expected,  
but the app quickly reaches a point where Optimistic locking  
failure exceptions are thrown with an endless sequence of ROLLBACKs  
followed by UPDATEs.  All of the contexts are using the  
MergeByPropertyObjectTrump merge policy.


Any insight would be much appreciated.




There is a known issue on 10.5.* that results in Core Data entering  
an infinite loop during save if the database has been corrupted such  
that the optimistic locking column is set to NULL.


A way to tell would be to run sqlite3 on the database and execute  
the following SQL statement:


select Z_PK, Z_OPT from ZSTOCK where Z_PK IN (1, 4);

I'm guessing you'll get back something that looks like:

1|
4|

Which means that something has stuffed unexpected NULLs into your  
database.


The issue has been fixed in 10.6, but the only real workaround on  
10.5.* is to manually repair the database by setting the value of  
the Z_OPT column to be non-null (1 is always a good option).


Cheers,
+Melissa





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Beware: trivially reproducible NSPersistentDocument crash when saving

2009-08-25 Thread Sean McBride
Hi all,

A warning to NSPersistentDocument users

Let's say you have an NSPersistentDocument-based app-- you do some work
and you save successfully.  Now let's say the app has a bug where its UI
allows the user to set a value outside the allowable range of one of
your NSManagedObjects.  When you try to save, the OS will give a message like:

"The document "Untitled" could not be saved as "Untitled". attribute is
too large."

The user is confused and panics.  He tries to "Save As" under a
different name instead.  Similar error message.  He messes around in the
UI but cannot make the document 'conform'.  He then tries "Save" again.
Poof, it crashes!

Exception Type:  EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x5b14c4a3
Crashed Thread:  0

Thread 0 Crashed:
0   libobjc.A.dylib 0x9240e688 objc_msgSend + 24
1   com.apple.AppKit0x96ba8070 -[NSDocument
_willPresentSavingError:forOperation:url:] + 88
2   com.apple.AppKit0x96a759f2 -[NSDocument
_saveToURL:ofType:forSaveOperation:de
legate:didSaveSelector:contextInfo:] + 611
3   com.apple.AppKit0x96a75787 -[NSDocument
saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] + 860
4   com.apple.AppKit0x96aab8a1 -[NSDocument
_saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 810
5   com.apple.AppKit0x96aab56f -[NSDocument
saveDocumentWithDelegate:didSaveSelector:contextInfo:] + 366
6   com.apple.AppKit0x96aab3f8 -[NSDocument saveDocument:] 
+ 58

This repros with a trivial test app in both 10.5.8 and, um, newer.




So be sure to fix all your validation errors, because the frameworks are
not forgiving! :(

--

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


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Beware: trivially reproducible NSPersistentDocument crash when saving

2009-08-25 Thread Kyle Sluder
On Tue, Aug 25, 2009 at 2:37 PM, Sean McBride wrote:
> Let's say you have an NSPersistentDocument-based app-- you do some work
> and you save successfully.  Now let's say the app has a bug where its UI
> allows the user to set a value outside the allowable range of one of
> your NSManagedObjects.  When you try to save, the OS will give a message like:

Do you mean when you try to stuff a 16-bit variable into an 8-bit
integer field?  Or does it happen even when the value is representable
but just outside the allowable range?

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Beware: trivially reproducible NSPersistentDocument crash when saving

2009-08-25 Thread Sean McBride
On 8/25/09 2:44 PM, Kyle Sluder said:

>> Let's say you have an NSPersistentDocument-based app-- you do some work
>> and you save successfully.  Now let's say the app has a bug where its UI
>> allows the user to set a value outside the allowable range of one of
>> your NSManagedObjects.  When you try to save, the OS will give a
>message like:
>
>Do you mean when you try to stuff a 16-bit variable into an 8-bit
>integer field?  Or does it happen even when the value is representable
>but just outside the allowable range?

Let's say you have an attribute that is an int32, but you set its 'min
value' to 0.  Then you bind this to an NSSlider that goes from -100 to
100.  Then you slide the slider to the -100 value.  At save time, the OS
complains that -100 is 'too small'.  That's all fine, the problem comes
later when you try 'save a's then 'save' again.  Then it crashes instead
of displaying the error.

--

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


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: CoreData / SQL hang on save

2009-08-25 Thread Melissa J. Turner

Could you try running with -com.apple.CoreData.SQLDebug 3?

I'm curious as to what's trying to bind that's causing this:


binding not implemented for this SQLType 7


Cheers,
+Melissa


On Aug 25, 2009, at 14:12, Greg Hoover wrote:


Hi Melissa,

Thanks for you response.

The problem actually just started showing up in 10.6 (wasn't a  
problem in 10.4 or 10.5). :-/


The hang stopped for a few launches and reverted to its previous  
output: "binding not implemented for SQLType 7".  But then it  
happened again...  The SQL file does not have null values for any  
Z_OPT fields.



CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?   
WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK  
= ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?   
WHERE Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
safe save
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?   
WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK  
= ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?   
WHERE Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
safe save

Thanks,
Greg

On Aug 25, 2009, at 1:16 PM, Melissa J. Turner wrote:



On Aug 25, 2009, at 02:19, Greg Hoover wrote:

I've run into a hang in CoreData save.  I'm the single  
coordinator, multiple object contexts threading model and a SQL  
store (though it seems to happen with XML as well).  The hang  
occurs inside the NSSQLCore and seems to just loop endlessly.  The  
SQL output supports this.  Requests performed at launch succeed as  
expected, but the app quickly reaches a point where Optimistic  
locking failure exceptions are thrown with an endless sequence of  
ROLLBACKs followed by UPDATEs.  All of the contexts are using the  
MergeByPropertyObjectTrump merge policy.


Any insight would be much appreciated.




There is a known issue on 10.5.* that results in Core Data entering  
an infinite loop during save if the database has been corrupted  
such that the optimistic locking column is set to NULL.


A way to tell would be to run sqlite3 on the database and execute  
the following SQL statement:


select Z_PK, Z_OPT from ZSTOCK where Z_PK IN (1, 4);

I'm guessing you'll get back something that looks like:

1|
4|

Which means that something has stuffed unexpected NULLs into your  
database.


The issue has been fixed in 10.6, but the only real workaround on  
10.5.* is to manually repair the database by setting the value of  
the Z_OPT column to be non-null (1 is always a good option).


Cheers,
+Melissa







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Core Data dog-slow when using first time after boot

2009-08-25 Thread Ben Trumbull


On Aug 25, 2009, at 7:19 AM, Ruotger Skupin wrote:



Am 24.08.2009 um 23:13 schrieb Ben Trumbull:


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent  
to instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use  
future-break objc_exception_throw





Thanks.  What is the actual set of keypaths you set in the fetch  
request ?  setRelationshipKeyPathsForPrefetching expects all the  
keypaths to terminate in a relationship object, not the attribute off  
that related object.



(this is 10A432)




For the record: I do use one-way relationships



That should be okay as long as you're not pretending to use a no  
inverse to-many relationship as a de facto many to many  
relationship.  No inverse relationships can only behave as if the  
inverse were to-one.  Specifically, each row in the destination  
entity may only be associated with a single row in the source  
entity if the relationship on the source entity does not have an  
inverse.  (e.g. you only get join tables in fully modeled bi- 
directional relationships)
Do I understand that correctly? No two (or more) Accounts or  
Transactions should "point" to the same Amount (see simplified  
schema). Unless there's a bug somewhere that's not the case.


Correct.  For each separate modeled no inverse relationship, the  
destination row (Amount) can only be pointed to by one source row.




|-|
| Transaction |
|-| ||
|net  | --> | Amount | <<-- (one other entity)
|gross| --> ||
|fee  | --> |value   | <<-
|account  | <<- |currency||
|...  |||||
|-||  |
   |  |
 --   |
| |
|||   |
|| Account|   |
|||   |
||balances| --
 --> |transactions|
 |... |
 ||

So basically I use Amount only as a container for a currency  
descriptor and a value. I would have to model 7 inverse  
relationships on that entity to make all relationships two-way.


Hmm.  I'd recommend consider whether or not it makes sense to de- 
normalize Amount into Transaction instead of making it a separate  
entity.  I assume the net/gross/fee are all going to be in the same  
currency, yes ?  Amount is very fine grained, and not (apparently)  
offering very much value for the abstraction cost.






Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if  
you've run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original post,  
but since I use Smart Folders predicates can look a lot different  
(i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)





You'll want to prefetch additionalInfo and account.

- Ben



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How is "Open Recent >" identified and populated?

2009-08-25 Thread Jerry Krinock


On 2009 Aug 25, at 08:38, I. Savant wrote:


On Aug 25, 2009, at 11:33 AM, Jerry Krinock wrote:

Is there some magic under the covers?  How does Cocoa know which  
menu item is "Open Recent"?


 What about its title? :-)


No, that can't be, because a title has to be localized.  Actually,  
instead of using separate nibs, I use one nib and localize  
programatically.  The title of my "Open Recent" menu item is  
"openRecent" in Interface Builder, then it gets changed during - 
applicationDidFinishLaunching to "Open Recent".  But if I used  
separate nibs like most people do, it could be in a different language.


It's possible it looks for it by name (and also possible it only  
cares about the first one it finds). In what order was your copied  
one? First or second?


My copy was second, and both the original and the copy got the "Open  
Recent" treatment.


Can anyone explain the mystery, or is it indeed "magic" under the  
covers?

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Martin Wierschin
NSString has methods for normalizing the content using  
Normalization Forms D, KD, C, and KC. NSAttributedString does not.


Is there any way to normalize an NSAttributedString?


I haven't tried it, but this should work:

NSAttributedString* original = whatever;
	NSMutableAttributedString* normalized = [[original mutableCopy]  
autorelease];

CFMutableStringRef str = (CFMutableStringRef)[original mutableString];
CFStringNormalize(str, kCFStringNormalizationFormD);

This works because -[NSMutableAttributedString mutableString] is a  
proxy that automatically fixes up the attribute runs held by its owner.


~Martin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Ross Carter

I haven't tried it, but this should work:

NSAttributedString* original = whatever;
	NSMutableAttributedString* normalized = [[original mutableCopy]  
autorelease];
	CFMutableStringRef str = (CFMutableStringRef)[original  
mutableString];

CFStringNormalize(str, kCFStringNormalizationFormD);

This works because -[NSMutableAttributedString mutableString] is a  
proxy that automatically fixes up the attribute runs held by its  
owner.


~Martin



Brilliant! Works just like you said. Thanks, Martin.
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How is "Open Recent >" identified and populated?

2009-08-25 Thread Jeff Johnson

On Aug 25, 2009, at 6:23 PM, Jerry Krinock wrote:


On 2009 Aug 25, at 08:38, I. Savant wrote:


On Aug 25, 2009, at 11:33 AM, Jerry Krinock wrote:

Is there some magic under the covers?  How does Cocoa know which  
menu item is "Open Recent"?


What about its title? :-)


No, that can't be, because a title has to be localized.  Actually,  
instead of using separate nibs, I use one nib and localize  
programatically.  The title of my "Open Recent" menu item is  
"openRecent" in Interface Builder, then it gets changed during - 
applicationDidFinishLaunching to "Open Recent".  But if I used  
separate nibs like most people do, it could be in a different  
language.


It's possible it looks for it by name (and also possible it only  
cares about the first one it finds). In what order was your copied  
one? First or second?


My copy was second, and both the original and the copy got the "Open  
Recent" treatment.


Can anyone explain the mystery, or is it indeed "magic" under the  
covers?


Hi Jerry.

I discuss the magic a bit in a blog post:

http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/

-Jeff

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How is "Open Recent >" identified and populated?

2009-08-25 Thread Kyle Sluder
On Tue, Aug 25, 2009 at 4:23 PM, Jerry Krinock wrote:
> Can anyone explain the mystery, or is it indeed "magic" under the covers?

It might look for a menu item that's wired to -openDocument:.

Or it might be one of those special private NSMenuItem subclasses that
I've seen floating around in the standard nibs.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Normalize an NSAttributedString

2009-08-25 Thread Martin Wierschin
Note that there is an issue with this approach, which is that  
attribute runs that start in the middle of a grapheme cluster might  
result in odd behaviour wrt normalisation.  However, it generally  
doesn't make sense to have such an attribute run (it's the  
equivalent of asking for e.g. a bold "o" with an italic umlaut,  
which makes no sense), it's just something that you might want to  
be aware of.


Sometimes it's desirable to have such attribute runs. One example is  
to highlight combining marks using a different foreground color than  
that of the base character.


~Martin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to keep the last tree item of NSOutlineView in the most bottom of a Sidebar?

2009-08-25 Thread Graham Cox


On 26/08/2009, at 1:02 AM, Vadim Shpakovski wrote:

I'd like to have the same behavior of special items as it's done in  
the Things application.


I mean Logbook and Trash items on the picture placed under this  
link: http://tinyurl.com/lhctza


Please advise any way to implement the same functionality in the  
sidebar tree.


I feel that special ‘spacer’ item should be used together with  
outlineView:heightOfRowByItem: method.


However, I can't find how to calculate the total height of all  
visible items (incl. space between groups).



This might be being done simply by inserting a separate view below the  
outline view. That's how I'd do it.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


NSScanner is stripping leading spaces?

2009-08-25 Thread Timothy Reaves
 I have a character set; I've tried both
NSCharacterSet *newlineSet = [NSCharacterSet
characterSetWithCharactersInString:@"\n"];
and
NSCharacterSet *newlineSet = [NSCharacterSet newlineCharacterSet];

 I use this to read lines from a file, like so:
while ([scanner scanUpToCharactersFromSet:newlineSet
intoString:¤tRecord]) {}

 I then read out substrings from currentRecord like so:
someNumber = [NSNumber numberWithInt:[[currentRecord
substringWithRange:NSMakeRange(0, 6)] intValue]];
someOtherNumber = [[currentRecord substringWithRange:NSMakeRange(14, 2)]
intValue];

 The file looks like:
"   455| | | 3| 1|  \n118222| |P| 2| 1|  "

 The issue is, someNumber always is the correct number, but
someOtherNumber is not;  it is always zero.  If I use an NSString, I
see that it is being set to two spaces (the last two spaces in the
record).  For the second record, both are correct.  So it appears
that the first three spaces in the first record are being ignored. 
This is confirmed by printing the length of each record; the first
record is three shorter.

 Does anyone have any idea why this is going on?  The trailing spaces
are being counted correctly.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


QuickTime Animation Rendering

2009-08-25 Thread Christopher J Kemsley

Hi all,

I have a project where I will be drawing nothing more than simple  
circles with lines connecting them. At some point, I will be animating  
these lines and circles to move them to another position.


I would like to:

(1) Display these, animated, on the screen; and

(2) Render the animation to a QuickTime file.

As far as the lines themselves go, a multi-layered CALayer (using  
CALayer's -addSublayer method) would work perfectly for viewing on the  
screen... but I don't know how to export this to QT.



So, I have two questions:

(1)  Is there a way for me to create the animations with CoreAnimation  
Layers (CALayer and sublayers) and simply tell some object to write to  
file? If so, how?


(2)  What is another method to create the animation easily? I would  
prefer that the same code be used to both display on screen and render  
to file; but it would also be acceptable to write to file then play  
the file on screen.


Note that I am going more for simplicity of code rather than speed  
performance, as the on-screen viewing will ONLY be for 'previewing'  
the output. All "publications" of the animations will be in the form  
of a QuickTime video.



-Christopher Kemsley
Sent from my Beautiful 17" MacBook Pro
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSScanner is stripping leading spaces?

2009-08-25 Thread Graham Cox


On 26/08/2009, at 11:00 AM, Timothy Reaves wrote:

Does anyone have any idea why this is going on?  The trailing  
spaces

are being counted correctly.



[scanner setCharactersToBeSkipped:nil];

By default the scanner skips spaces - sounds like you don't want it to  
do that.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Selection highlight in NSTextFieldCell

2009-08-25 Thread Graham Cox


On 26/08/2009, at 6:23 AM, bryscomat wrote:

How do I change the selection highlight color for an NSTextFieldCell  
being edited? I'm using a transparent window and would like to  
change the highlight to a light gray instead of the default light  
blue,



I'd suggest you don't. The colour is set by the user in their System  
Preferences. Encountering a different colour leads to confusion  
because sometimes unusual colours have specific meanings. In your case  
it doesn't, so let the user's preference prevail.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Selection highlight in NSTextFieldCell

2009-08-25 Thread Kyle Sluder

On Aug 25, 2009, at 6:28 PM, Graham Cox  wrote:

I'd suggest you don't. The colour is set by the user in their System  
Preferences. Encountering a different colour leads to confusion  
because sometimes unusual colours have specific meanings. In your  
case it doesn't, so let the user's preference prevail.


Except the user might not expect their color to be used on a black  
background…


--Kyle Sluder___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Drawing text into a UiView

2009-08-25 Thread Henry McGilton (Boulevardier)


On Aug 23, 2009, at 10:57 PM, J J wrote:

I'm trying to write an app that will page through text .. I'm trying  
to grab the text, find out how much with fit on a page, write the  
text to a view (page), then perhaps paginate the pages around it  
onto other views to be ready as needed.
Anyone have any ideas on how this would work ?  I'm having a hard  
time finding examples of writing text to a view directlyI'd love to  
do it via UIWebView, but not sure how I would know how big one page  
would be



Why would a UITextView not do the job?  UITextView is already a  
sub-class of UIScrollView,

so all the scrolling behaviour is done for you.

If you really need to 'roll your own', study the NSString UIKit  
Additions Reference API in UIKit.
That describes methods for fitting text into specified rectangles with  
specified fonts

and specified line-breaking modes . . .

Cheers,
. . . . . . . .Henry




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Possible reasons why "no help is available"?

2009-08-25 Thread Matt Neuburg
On Fri, 21 Aug 2009 18:19:32 -0500, Brant Sears  said:
>Hi. I'm trying to get a Help Book to open for my application.

This problem is nearly always caused by DNFD (Did Not Follow Directions).
Apple has provided the directions. Follow them! Follow them very, very
exactly.

I've made a tutorial movie laying stress on the key points:

http://www.apeth.com/writersua/implementAppleHelp.mov

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How is "Open Recent >" identified and populated?

2009-08-25 Thread Jerry Krinock


On 2009 Aug 25, at 16:43, Jeff Johnson wrote:


http://lapcatsoftware.com/blog/2007/07/10/working-without-a-nib-part-5-open-recent-menu/


So, maybe Interface Builder sends  
_setMenuName:@"NSRecentDocumentsMenu" to the submenu of its "Open  
Recent" menu item.


Good work figuring it out, Jeff.  I suppose that the NeXT engineers  
cooked up this kludge at the end of a long night at the end of a long  
day at the end of a long week.  Or maybe their vacuum-tube-based  
hardware was limited to 16 outlets per object and adding one for the  
"recents" menu would have been 17 :))



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Why I have to load nib file?

2009-08-25 Thread Agha Khan

HI:
Reading iPhone Developer's Cookbook I realized we do not need a nib  
file.

The author was developing all applications without nib files.
It worked fine with OS 2.2.
Toady I complied his first program  and got this error message.
2009-08-25 21:32:56.428 HelloWorld[2770:20b] Failed to load  
NSMainNibFile //MainWindow.


But why? We shouldn't get this message. How can we get rid of this  
message.


int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil,  
@"SomeAppDelegate");

[pool release];
return retVal;
}

Best regards
Agha

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Why I have to load nib file?

2009-08-25 Thread Roland King
Do you ever try reading any documentation before you post your random 
questions to the list?


go read this

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#//apple_ref/c/func/UIApplicationMain

and that

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#//apple_ref/doc/uid/TP40007072-CH7

Agha Khan wrote:

HI:
Reading iPhone Developer's Cookbook I realized we do not need a nib  file.
The author was developing all applications without nib files.
It worked fine with OS 2.2.
Toady I complied his first program  and got this error message.
2009-08-25 21:32:56.428 HelloWorld[2770:20b] Failed to load  
NSMainNibFile //MainWindow.


But why? We shouldn't get this message. How can we get rid of this  
message.


int main(int argc, char *argv[]) {

NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
int retVal = UIApplicationMain(argc, argv, nil,  @"SomeAppDelegate");
[pool release];
return retVal;
}

Best regards
Agha

___

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 r...@rols.org

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Why I have to load nib file?

2009-08-25 Thread Kyle Sluder

On Aug 25, 2009, at 9:41 PM, Agha Khan  wrote:


HI:
Reading iPhone Developer's Cookbook I realized we do not need a nib  
file.


You should use nib files unless it doesn't make sense to do so. For  
OpenGL apps in particular, nibs can just be a nuisance. But IB is the  
Cocoa way. If you decide to go nibless, bebe prepared for a bunch of  
"why don't you just do it in the nib?"


2009-08-25 21:32:56.428 HelloWorld[2770:20b] Failed to load  
NSMainNibFile //MainWindow.


But why? We shouldn't get this message. How can we get rid of this  
message.


Check your Info.plist. Specifically the NSMainNibFile key. You know,  
the one you should have Googled for before bothering the list.


Always do your own research before taking up the other list  
subscribers' time.




--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Selection highlight in NSTextFieldCell

2009-08-25 Thread bryscomat
I appreciate the responses, and I think Kyle nailed it. It just  
doesn't work on a black background. I wasn't looking to change the  
user's preferences, just the way the selection was handled in this  
particular part of the app. I dug a little further, and it looks like  
you're right Graham. The color comes directly from user preferences.


So if there's no way to do that, on to my next question. Is there a  
way to change the color the highlighted portion of text, i.e. the text  
is normally white, but the highlighted portion of the text will be  
black. I've overridden the drawing portion of the text field cell, but  
all I can seem to do is change the color of all text in the cell, not  
just the specific highlighted portion.


I would really prefer to change the highlight, but if anyone can shed  
light on the second option, that would be great. I have spent several  
hours on this issue and it's time to move on to something else.


Regards,
Bryan

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Why I have to load nib file?

2009-08-25 Thread Agha Khan

Dear Roland King:
I admit I am new to iPhone and did read that book. which I mentioned.
In future I will try not to ask before googling.
Best regards
Agha

On Aug 25, 2009, at 9:51 PM, Roland King wrote:

Do you ever try reading any documentation before you post your  
random questions to the list?


go read this

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIKitFunctionReference/Reference/reference.html#/ 
/apple_ref/c/func/UIApplicationMain


and that

http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationEnvironment/ApplicationEnvironment.html#/ 
/apple_ref/doc/uid/TP40007072-CH7


Agha Khan wrote:

HI:
Reading iPhone Developer's Cookbook I realized we do not need a  
nib  file.

The author was developing all applications without nib files.
It worked fine with OS 2.2.
Toady I complied his first program  and got this error message.
2009-08-25 21:32:56.428 HelloWorld[2770:20b] Failed to load   
NSMainNibFile //MainWindow.
But why? We shouldn't get this message. How can we get rid of this   
message.

int main(int argc, char *argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
   int retVal = UIApplicationMain(argc, argv, nil,   
@"SomeAppDelegate");

   [pool release];
   return retVal;
}
Best regards
Agha
___
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 r...@rols.org


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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