Re: Crash in KVO when using -keyPathsForValuesAffecting

2009-06-21 Thread Quincey Morris

On Jun 20, 2009, at 14:15, Jean-Daniel Dupas wrote:

Thank you for the suggestion, but it does not solve the problem.  
Even trying w1.object = nil before unregistring the observer has no  
effect.


When I looked at your code a little harder, I realized my theory could  
not have been correct anyway. For a start, the MyObject was being  
leaked, so its dealloc would never be called.


On Jun 20, 2009, at 11:08, Jean-Daniel Dupas wrote:


 [w1 removeObserver:foo forKeyPath:@"name"];
 [w1 release];


Interestingly, changing this to:


 [w2 removeObserver:foo forKeyPath:@"name"];
 [w2 release];


works just fine, thought it ought to have exactly the same behavior as  
the original version. So here's a new theory ...


The observations you set up manually *both* cause a secondary/indirect  
observation, where 'foo' observes (in effect if not actually) the  
"name" property of the *same* MyObject. In effect, you have the same  
observer object observing the same property of the same target object  
twice. (That's something you can't do directly, AFAIK.)


When a secondary/indirect observation needs to be removed (either  
because a manual observation is removed, or -- as we discovered when  
you tried 'w1.object = nil' -- for a different reason) it looks like  
the wrong one can get removed. Or something like that.


Gratz. That's a very elegant bug. :)


___

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

Please do not post 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: Crash in KVO when using -keyPathsForValuesAffecting

2009-06-21 Thread Jean-Daniel Dupas


Le 21 juin 09 à 11:26, Quincey Morris a écrit :


On Jun 20, 2009, at 14:15, Jean-Daniel Dupas wrote:

Thank you for the suggestion, but it does not solve the problem.  
Even trying w1.object = nil before unregistring the observer has no  
effect.


When I looked at your code a little harder, I realized my theory  
could not have been correct anyway. For a start, the MyObject was  
being leaked, so its dealloc would never be called.


On Jun 20, 2009, at 11:08, Jean-Daniel Dupas wrote:


[w1 removeObserver:foo forKeyPath:@"name"];
[w1 release];


Interestingly, changing this to:


[w2 removeObserver:foo forKeyPath:@"name"];
[w2 release];


works just fine, thought it ought to have exactly the same behavior  
as the original version. So here's a new theory ...


The observations you set up manually *both* cause a secondary/ 
indirect observation, where 'foo' observes (in effect if not  
actually) the "name" property of the *same* MyObject. In effect, you  
have the same observer object observing the same property of the  
same target object twice. (That's something you can't do directly,  
AFAIK.)


When a secondary/indirect observation needs to be removed (either  
because a manual observation is removed, or -- as we discovered when  
you tried 'w1.object = nil' -- for a different reason) it looks like  
the wrong one can get removed. Or something like that.


Gratz. That's a very elegant bug. :)



Thank you for your time.
That's my conclusion too. I filled a report, and I'm trying to  
workaround this bug by observing the "subproperty" myself instead of  
using automatic dependency tracking.



___

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

Please do not post 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


Core Data "Uniqueing" not happening as expected

2009-06-21 Thread Jerry Krinock
My object graph in a Core Data document-based app shows the following  
relationship.


Foo <<--> Bar

I insert a single Bar and two Foos, then

[foo1 setBar:bar] ;
[foo2 setBar:bar] ;

Save the document. [1]
Fetch all Bars.

Expected result: An array containing one Bar.
Actual result: An array containing two Bars that have the same  
attributes, one related to foo1, the other related to foo2.


Am I reading the documentation incorrectly?  How can I make  
"uniqueing" happen?


Thanks,

Jerry Krinock


[1]  At the end, the following article in the Core Data Programming  
Guide implies that it may be necessary to "save" a document/moc in  
order for "uniqueing" to occur, but I'm not sure. http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFaultingUniquing.html#/ 
/apple_ref/doc/uid/TP30001202-185502-TPXREF148

___

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

Please do not post 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


renaming executable files

2009-06-21 Thread Angelo Chen
Hi,
I need to rename the executable file without renaming the project, how to do 
that? thanks


  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

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

Please do not post 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: renaming executable files

2009-06-21 Thread Filip van der Meeren
Just change the name of the targetname, or get Info on the proper  
target, and change the executable name in the properties tab.


Filip van der Meeren


On 21 Jun 2009, at 15:47, Angelo Chen wrote:


Hi,
I need to rename the executable file without renaming the project,  
how to do that? thanks



 Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.pro 
mo.yahoo.com/security/ 了解更多!

___

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

Please do not post 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/filip%40code2develop.com

This email sent to fi...@code2develop.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


Problem with NSValueTransformer, NSTableView and NSAttributedString

2009-06-21 Thread Donnie Lee
Hello,

I created NSTableView and bind table column with NSTextFieldCell with
custom NSValueTransformer subclass to NSArrayController. My value
transformer should return NSAttributedString transformed from
NSString. Everything works fine except that the table shows NSString
instead of NSAttributedString. It looks like: "My text{NSFont =
"LucidaGrande}". How to make the right behavior for my value
transformer?
Thanks in advance!
___

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

Please do not post 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: renaming executable files

2009-06-21 Thread Angelo Chen
thanks for the reply, i tried two approaches , all not working, still get the 
same name

--- 2009年6月21日 星期日,Filip van der Meeren  寫道﹕

寄件人: Filip van der Meeren 
主題: Re: renaming executable files
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2009年6月21日,星期日,下午9:51

Just change the name of the targetname, or get Info on the proper target, and 
change the executable name in the properties tab.

Filip van der Meeren


On 21 Jun 2009, at 15:47, Angelo Chen wrote:

> Hi,
> I need to rename the executable file without renaming the project, how to do 
> that? thanks
> 
> 
>      Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/filip%40code2develop.com
> 
> This email sent to fi...@code2develop.com




  Yahoo!香港提供網上安全攻略,教你如何防範黑客! 請前往 http://hk.promo.yahoo.com/security/ 了解更多!
___

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

Please do not post 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: renaming executable files

2009-06-21 Thread Filip van der Meeren

I guess I have misread your question...
You should see the folder "Products" in your groups & files...
Just change the name of your application/framework in your products  
folder.


Filip van der Meeren



On 21 Jun 2009, at 17:02, Angelo Chen wrote:

thanks for the reply, i tried two approaches , all not working,  
still get the same name


--- 2009年6月21日 星期日,Filip van der Meeren  
 寫道﹕


寄件人: Filip van der Meeren 
主題: Re: renaming executable files
收件人: "Angelo Chen" 
副本(CC): cocoa-dev@lists.apple.com
日期: 2009年6月21日,星期日,下午9:51

Just change the name of the targetname, or get Info on the proper  
target, and change the executable name in the properties tab.


Filip van der Meeren


On 21 Jun 2009, at 15:47, Angelo Chen wrote:

> Hi,
> I need to rename the executable file without renaming the project,  
how to do that? thanks

>
>
>  Yahoo!香港提供網上安全攻略,教你如何防範黑客!  
請前往 http://hk.promo.yahoo.com/security/ 了解更多!

> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post 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/filip%40code2develop.com
>
> This email sent to fi...@code2develop.com


Yahoo!香港提供網上安全攻略,教你如何防範黑客!了解 
更多


___

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

Please do not post 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


Possible to set tab stops in an NSTextView?

2009-06-21 Thread Ken Tozier

Hi

I'm working with an NSText view and want to display tab delimited  
strings in a table format. I don't need a full NSTable, just the  
ability to break up the text into columns using tab stops. Is there  
any built-in way to do this? Something like setTabStops?


I looked in NSTextView, NSText, NSTextContainer and NSAttributedString  
but didn't see anything.


Thanks for any help


___

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

Please do not post 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 to set tab stops in an NSTextView?

2009-06-21 Thread Jim Correia
On Sun, Jun 21, 2009 at 11:44 AM, Ken Tozier  wrote:

>
> I'm working with an NSText view and want to display tab delimited strings
> in a table format. I don't need a full NSTable, just the ability to break up
> the text into columns using tab stops. Is there any built-in way to do this?
> Something like setTabStops?
>
> I looked in NSTextView, NSText, NSTextContainer and NSAttributedString but
> didn't see anything.


Tab stops are controlled via NSParagraphStyle.

- Jim
___

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

Please do not post 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: Cocoa and Computational Expense

2009-06-21 Thread WT

On Jun 21, 2009, at 1:36 AM, syntonica wrote:


Hello All--


Hi Kevin,

I don't have much to add to the responses that others have already  
given you for your other questions, but I'll address the question  
below because I haven't seen anyone yet say what I'm about to say.


Finally, on a side note and because this is my first OOP, just how  
big should a class get? Just as a rule of thumb.  I have 700 lines  
and 50 methods in my MyDocument class and it seems positively  
bloated to me.  Is this normal?  Or might I possibly have a bad  
design?  I only see a couple of lines that could be factored into  
their own method and nothing that could really me moved into its own  
class.


My golden rule is very simple, though it doesn't mean that it's easy  
to apply it: each class should have a small (as small as it is  
meaningful for the project at hand) set of very well defined  
responsibilities. If a class has too many responsibilities, or if its  
responsibilities are too broad or unfocused, that's typically a sign  
that you should break it down. There are exceptions, but they're rare  
and whenever I think I've run into one of them, I don't touch the  
keyboard for a day or two until I am convinced that the exception is  
valid.


Wagner
___

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

Please do not post 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 to set tab stops in an NSTextView?

2009-06-21 Thread Ashley Clark

On Jun 21, 2009, at 10:44 AM, Ken Tozier wrote:


Hi

I'm working with an NSText view and want to display tab delimited  
strings in a table format. I don't need a full NSTable, just the  
ability to break up the text into columns using tab stops. Is there  
any built-in way to do this? Something like setTabStops?


I looked in NSTextView, NSText, NSTextContainer and  
NSAttributedString but didn't see anything.


You need to create an NSMutableParagraphStyle, set you tab stops on it  
with setTabStops: and then add it as an attribute to your attributed  
string in your text view.


Code written in Mail, YMMV:

NSArray *tabStops = /* your array */

NSMutableParagraphStyle *style = [[NSParagraphStyle  
defaultParagraphStyle] mutableCopy];

[style setTabStops:tabStops];

[[textView textStorage] addAttribute:NSParagraphStyleAttributeName  
value:style range: /* effective range */ ];


/* if you're doing this in response to a user action you should also  
update the typing attributes */
NSMutableDictionary *typingAttributes = [[textView typingAttributes]  
mutableCopy];

[typingAttributes setObject:style forKey:NSParagraphStyleAttributeName];
[textView setTypingAttributes:typingAttributes];

[typingAttributes release];
[style release];



Ashley
___

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

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

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

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


Re: Core Data "Uniqueing" not happening as expected

2009-06-21 Thread Quincey Morris

On Jun 21, 2009, at 06:26, Jerry Krinock wrote:

My object graph in a Core Data document-based app shows the  
following relationship.


   Foo <<--> Bar

I insert a single Bar and two Foos, then

[foo1 setBar:bar] ;
[foo2 setBar:bar] ;

Save the document. [1]
Fetch all Bars.

Expected result: An array containing one Bar.
Actual result: An array containing two Bars that have the same  
attributes, one related to foo1, the other related to foo2.


Am I reading the documentation incorrectly?  How can I make  
"uniqueing" happen?


I think there are 2 flaws in your analysis.

First, you *seem* to be suggesting that uniquing is a process of  
winnowing away unwanted duplicate objects, but I'm pretty sure that  
Core Data doesn't create duplicate objects. Rather, it seems likely  
that it uses the object UID to find out if a needed object exists  
before ever creating it.


Second, "Fetch all Bars" isn't a scenario where spurious duplicate  
Bars could be created. "Fetch all Foos" -- maybe (if I'm wrong on the  
previous point).


IAC, it'd be worth trying "Fetch all Foos" to see whether you have 2  
or more Foos. Also, you could examine the UIDs of foo1, foo2 and bar  
before and after the save, as well as after the fetch. Unless you can  
see 2 different objects with the same UID, then it would seem that the  
unwanted Bar was actually created as a result of your code somewhere.



___

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

Please do not post 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 "Uniqueing" not happening as expected

2009-06-21 Thread Jerry Krinock


On 2009 Jun 21, at 09:55, Quincey Morris wrote:

First, you *seem* to be suggesting that uniquing is a process of  
winnowing away unwanted duplicate objects, but I'm pretty sure that  
Core Data doesn't create duplicate objects. Rather, it seems likely  
that it uses the object UID to find out if a needed object exists  
before ever creating it.


Oh, I agree with you on that.  I thought it was rather strange to read  
an "-ing" suffix on "uniqueing", as though it was something that could  
"happen".


Second, "Fetch all Bars" isn't a scenario where spurious duplicate  
Bars could be created.


It looks like you're correct.  I just tried to reproduce this in the  
Core Data Utility but found that it worked as expected -- setting the  
same Bar to two different Foos does not create an additional Bar [1].


Also, you could examine the UIDs of foo1, foo2 and bar before and  
after the save, as well as after the fetch. Unless you can see 2  
different objects with the same UID, then it would seem that the  
unwanted Bar was actually created as a result of your code somewhere.


Good idea.  If I don't reply back to this thread it means I found  
something stupid in my code.


Thanks, Quincey.

Jerry


[1]

#import 
#import 

// Note: This function returns a retained, not autoreleased, instance.
NSManagedObjectModel *getStaticManagedObjectModel() {
static NSManagedObjectModel *mom = nil;

if (mom != nil) {
return mom;
}

mom = [[NSManagedObjectModel alloc] init];

NSEntityDescription *fooEntity = [[NSEntityDescription alloc]  
init];

[fooEntity setName:@"Foo"];
[fooEntity setManagedObjectClassName:@"Foo"];
NSEntityDescription *barEntity = [[NSEntityDescription alloc]  
init];

[barEntity setName:@"Bar"];
[barEntity setManagedObjectClassName:@"Bar"];

// Create a to-one relationship
NSRelationshipDescription *fooToBar = [[NSRelationshipDescription  
alloc] init] ;

[fooToBar setMaxCount:1] ;
[fooToBar setName:@"bar"] ;

// Create a to-many relationship
NSRelationshipDescription *barToFoo = [[NSRelationshipDescription  
alloc] init] ;

[barToFoo setMaxCount:NSIntegerMax] ;
[barToFoo setName:@"foos"] ;

// Wire up the relationships
[fooToBar setDestinationEntity:barEntity] ;
[barToFoo setDestinationEntity:fooEntity] ;
[fooToBar setInverseRelationship:barToFoo] ;
[barToFoo setInverseRelationship:fooToBar] ;

// Set relationships in entities
[fooEntity setProperties:[NSArray arrayWithObject:fooToBar]] ;
[barEntity setProperties:[NSArray arrayWithObject:barToFoo]] ;
[fooToBar release] ;
[barToFoo release] ;

// Set entities in mom
[mom setEntities:[NSArray arrayWithObjects:
  fooEntity,
  barEntity,
  nil]];

[fooEntity release] ;
[barEntity release] ;

return mom;
}

// Note: This function returns a retained, not autoreleased, instance.
NSManagedObjectContext *getStaticManagedObjectContext() {

static NSManagedObjectContext *moc = nil;

if (moc != nil) {
return moc;
}

moc = [[NSManagedObjectContext alloc] init];

NSPersistentStoreCoordinator *coordinator =
[[NSPersistentStoreCoordinator alloc]
 initWithManagedObjectModel: getStaticManagedObjectModel()];
[moc setPersistentStoreCoordinator: coordinator];
[coordinator release] ;

NSError *error;
NSPersistentStore *newStore ;
newStore = [coordinator  
addPersistentStoreWithType:NSInMemoryStoreType

 configuration:nil
   URL:nil
   options:nil
 error:&error];

if (newStore == nil) {
NSLog(@"Store Configuration Failure\n%@",
  ([error localizedDescription] != nil) ?
  [error localizedDescription] : @"Unknown Error");
}
return moc;
}


int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

// Create Core Data stack
NSManagedObjectModel *mom = getStaticManagedObjectModel() ;
NSManagedObjectContext *moc = getStaticManagedObjectContext() ;

// Create two Foos and one Bar
NSManagedObject* foo1 = [NSEntityDescription  
insertNewObjectForEntityForName:@"Foo"
   
inManagedObjectContext:moc] ;
NSManagedObject* foo2 = [NSEntityDescription  
insertNewObjectForEntityForName:@"Foo"
   
inManagedObjectContext:moc] ;
NSManagedObject* bar = [NSEntityDescription  
insertNewObjectForEntityForName:@"Bar"
  
inManagedObjectContext:moc] ;


// Set the single bar to be the Bar of each Foo
[foo1 setValue:bar
   forKey:@"bar"] ;
[foo2 setValue:bar

Re: Core Data "Uniqueing" not happening as expected

2009-06-21 Thread Jerry Krinock


On 2009 Jun 21, at 09:55, Quincey Morris wrote:


Unless you can see 2 different objects with the same UID ...


More precisely, you mean "the same -objectID".

Yup.  To our surprise, my fetch request is returning two objects with  
the same objectID, or from a Core Data perspective, I suppose you'd  
call it two copies of the same managed object.


Here's the fetching code from the NSPersistentDocument subclass in my  
actual project:


NSFetchRequest* fetchRequest = [[NSFetchRequest alloc] init] ;
[fetchRequest setEntity:[NSEntityDescription  
entityForName:@"Browfile_entity"
inManagedObjectContext:[self  
managedObjectContext]]] ;

NSError* error_ = nil ;
NSArray* mocBrowfiles = [[self managedObjectContext]  
executeFetchRequest:fetchRequest

error:&error_] ;

[fetchRequest release] ;
if (error_) {
// Handle error
... this does not execute ...
}
NSLog(
  @"46985: uniqueIDs of fetched objects:\n%@",
  [mocBrowfiles valueForKey:@"stringID"]
  ) ;

NSLog(@"47115: pointers to fetched objects:\n") ;
for (Browfile* browfile in mocBrowfiles) {
NSLog(@"%p", browfile) ;
}


Here's my -[NSManagedObject stringID] method:

- (NSString*)stringID {
NSManagedObjectID* objectID = [self objectID] ;
NSString* string = [[objectID URIRepresentation] absoluteString] ;
NSString* suffix = [objectID isTemporaryID] ? @"temp" : @"perm" ;
return [NSString stringWithFormat:
@"%...@[%@]",
string,
suffix] ;
}


Here's the console output:

2009-06-21 13:04:00.993 TestApp[77117:10b] 46985: uniqueIDs of fetched  
objects:

(
"x-coredata://101E2F60-412A-41EE-9DEF-59797757C29C/ 
Browfile_entity/p1[perm]",
"x-coredata://101E2F60-412A-41EE-9DEF-59797757C29C/ 
Browfile_entity/p2[perm]"

)
2009-06-21 13:04:00.995 TestApp[77117:10b] 47115: pointers to fetched  
objects:

2009-06-21 13:04:00.999 TestApp[77117:10b] 0x16e0c9b0
2009-06-21 13:04:01.006 TestApp[77117:10b] 0x16e43f20

I believe that I inserted one Browfile object into the store.  But  
even if I screwed up somewhere and actually inserted two, why does  
this fetch request return two objects with exactly the same permanent  
objectID?  Has anyone ever seen that?


It's not the fact that I'm using an SQLite store.  I tried my little  
utility project with an SQLite store, and saving it, and it works  
correctly.  It still only returns one Bar (aka Browfile).



___

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

Please do not post 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 "Uniqueing" not happening as expected

2009-06-21 Thread Jerry Krinock

Whoops -- ignore previous post.

I'm so accustomed to looking at UUID strings that I didn't notice the / 
p1 and /p2 on the ends of the object ID strings.


___

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

Please do not post 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: NSDate scope

2009-06-21 Thread Ken Thomases

On Jun 20, 2009, at 6:52 PM, John Baldwin wrote:


I declared a (NSDate *) in my .h file.

NSDate *originalDate;


The above is unclear.  You mean you declared an instance variable in  
some class with type NSDate*?



Then in my init method, I initialized it to the current date. I  
tried various methods, all with the same result:


originalDate = [NSDate date];
originalDate = [NSDate dateWithTimeIntervalSinceNow:0];
originalDate = [[NSDate alloc] init];
originalDate = [[NSDate date] retain];

(I probably tried others, too.)


Flailing about like this means you're not taking the time to  
understand what you're doing (or trying to do).  You need to (re-)read  
the Memory Management Guide and perhaps some of the other basic  
conceptual documentation.


The first two of your examples have the same serious bug.  You're not  
arranging to be sure the object will live as long as you need it to.


I'd be surprised if all of those approaches really did produce the  
same result.  Are you sure you implemented the initializer that's  
actually being used?  Maybe your initializer is never called, leaving  
the originalDate pointer as nil -- all fields of an object are zeroed  
out when the object is allocated.


Try putting in an NSLog statement to show the date object that you've  
obtained.



Then, in a method that was called by an NSTimer object, I tried to  
use that date as a reference point. But the debugger showed the  
variable as "out of scope."


This message from the debugger may be benign or insignificant.  It  
doesn't necessarily mean there's any real problem.  Are you debugging  
a build that's been optimized or lacks debugging symbols?




NSDate *currentDate = [NSDate date];
NSTimeInterval secs = [currentDate timeIntervalSinceDate  
originalDate];


The variable would be out of scope, and the program would crash upon  
referencing it.


If the variable were really out of scope, the compiler would have  
refused to compile your program and you wouldn't get as far as trying  
to run it (or encountering a crash).


The crash is most likely due to a problem with your memory management,  
as mentioned above.  The object pointed to by originalDate was  
probably allowed to be deallocated (because you didn't exert your own  
control over its lifetime), leaving the pointer pointing to garbage.   
First, make sure you're following the memory management guidelines.   
If the problem persists, you can enable NSZombie to help track down  
the problem, possibly along with the ObjectAlloc instrument.


In any case, if you ask the list to help you diagnose a crash, you  
need to supply the details of the crash.  What's the actual signal or  
exception encountered (e.g. EXC_BAD_ACCESS)?  What's the backtrace?   
Also, it can't hurt to put in another NSLog statement here showing the  
current value of originalDate.


Regards,
Ken

___

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

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

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

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


Re: Just implementing -isEqual:, never invoked, causes crash

2009-06-21 Thread Ken Thomases

On Jun 20, 2009, at 7:26 PM, Jerry Krinock wrote:

Oh, I also figured out how to enter a command in the gdb console --  
You have to hit the 'enter' key instead of 'return' after entering a  
command.  I've never used 'enter' in a console-type-thing.  I  
suppose this may be to allow multi-line commands.


This shouldn't be necessary.  Are you using the default key bindings  
of Xcode, or did you customize what the Return key is assigned to do?


Regards,
Ken

___

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

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

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

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


Core Data capabilities questions

2009-06-21 Thread Rick Mann
My iPhone app is running into memory issues. I have some objects that  
I load via Core Data all at once at startup, because I need at least  
some of the attributes for all of them almost all the time.


Is it possible (or does Core Data automatically do this) for  
attributes that aren't accessed to not actually load? For example, my  
entities have a "description" attributes that is rarely accessed. Will  
Core Data defer loading the data for that attribute until it's  
actually requested?


Thanks!

--
Rick

___

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

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

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

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


Re: Weird dyld loader crash

2009-06-21 Thread Ken Thomases

On Jun 20, 2009, at 10:44 PM, Andrew Farmer wrote:


On 20 Jun 2009, at 20:27, Erg Consultant wrote:
I suddenly started getting a weird loader crash when launching my  
app. Has anyone seen any errors similar to this one:


Exception Type:  EXC_BAD_ACCESS (SIGBUS)
Exception Codes: KERN_PROTECTION_FAILURE at 0x
Crashed Thread:  0

Thread 0 Crashed:
0   ???   00 0 + 0
1   X 0x00010c89 0x1000 + 64649
2   X 0x00011970 0x1000 + 67952
3   X 0x0004ef07 0x1000 + 319239
4   X 0x0004efb9 0x1000 + 319417


This error is in your code. It has nothing to do with dyld, save  
that it occurred in code that was called at initialization time.


Did you recently implement a +load method for one of your classes?   
Have you added C++ or Objective-C++ code that includes a static object  
with a custom constructor?  Have you used __attribute__(constructor)?


In any case, try running an unstripped debug build of your program.   
The crash will probably show you where in your code the problem is  
happening.


Regards,
Ken

___

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

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

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

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


Re: Core Data capabilities questions

2009-06-21 Thread Kyle Sluder
On Sun, Jun 21, 2009 at 1:48 PM, Rick Mann wrote:
> Is it possible (or does Core Data automatically do this) for attributes that
> aren't accessed to not actually load? For example, my entities have a
> "description" attributes that is rarely accessed. Will Core Data defer
> loading the data for that attribute until it's actually requested?

No.  The behavior you're describing is known as "faulting."  Core Data
only faults objects, not attributes.  Factor out your description
attribute into a separate entity and configure a 1:1 relationship
between it and whatever entity it came from.

--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: Core Data capabilities questions

2009-06-21 Thread Rick Mann


On Jun 21, 2009, at 14:04:42, Kyle Sluder wrote:

On Sun, Jun 21, 2009 at 1:48 PM, Rick Mann  
wrote:
Is it possible (or does Core Data automatically do this) for  
attributes that

aren't accessed to not actually load? For example, my entities have a
"description" attributes that is rarely accessed. Will Core Data  
defer

loading the data for that attribute until it's actually requested?


No.  The behavior you're describing is known as "faulting."  Core Data
only faults objects, not attributes.  Factor out your description
attribute into a separate entity and configure a 1:1 relationship
between it and whatever entity it came from.


Yeah, I figured I could do this, just didn't want to :-)

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: NSDate scope

2009-06-21 Thread Kyle Sluder
On Sat, Jun 20, 2009 at 4:52 PM, John Baldwin wrote:
> I declared a (NSDate *) in my .h file.

Where?  Inside an @implementation, or as a global variable?  If it's a
global variable, you are aware that for every translation unit that
imports your header, you will wind up with a different variable?

> Then in my init method, I initialized it to the current date. I tried
> various methods, all with the same result:

You're mixing owning methods (alloc, retain) with non-owning methods
(+date).  This indicates that you do not understand Cocoa memory
management.

> Then, in a method that was called by an NSTimer object, I tried to use that
> date as a reference point. But the debugger showed the variable as "out of
> scope."

Where is this method defined?  What object was it being invoked on?

Sounds like you need to do a bit of reading.  If you go through the
conceptual docs and still have trouble understanding, post your code
here and we can help you out a bit.

--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: Core Data capabilities questions

2009-06-21 Thread Kyle Sluder
On Sun, Jun 21, 2009 at 2:06 PM, Rick Mann wrote:
> Yeah, I figured I could do this, just didn't want to :-)

This is an important point to be made about Core Data, and one that
often trips up people new to the framework: Core Data is NOT an RDBMS.
 It's not intended to be used like one; for example, you don't have
the luxury of performing inner joins and selecting attribute subsets,
yielding only the results you want.  Core Data is an in-process object
persistence framework, and as a result your program often needs to be
more respectful of the framework's memory and processing requirements.
 Often this means breaking up your wonderfully-normalized managed
object model.

If what you really want is an RDBMS—which is often the case—then you
can use the SQLite framework.  Core Data is an excellent persistence
framework, but it needs to be treated as such.

--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: Core Data "Uniqueing" not happening as expected

2009-06-21 Thread mmalc Crawford


On Jun 21, 2009, at 1:23 PM, Jerry Krinock wrote:

   "x-coredata://101E2F60-412A-41EE-9DEF-59797757C29C/Browfile_entity/p1[perm] 
",
   "x-coredata://101E2F60-412A-41EE-9DEF-59797757C29C/Browfile_entity/p2[perm] 
"

)
2009-06-21 13:04:00.995 TestApp[77117:10b] 47115: pointers to  
fetched objects:

2009-06-21 13:04:00.999 TestApp[77117:10b] 0x16e0c9b0
2009-06-21 13:04:01.006 TestApp[77117:10b] 0x16e43f20

I believe that I inserted one Browfile object into the store.  But  
even if I screwed up somewhere and actually inserted two, why does  
this fetch request return two objects with exactly the same  
permanent objectID?


The object IDs are not the same ("p1" != "p2").

mmalc


___

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

Please do not post 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 capabilities questions

2009-06-21 Thread mmalc Crawford


On Jun 21, 2009, at 2:04 PM, Kyle Sluder wrote:

Is it possible (or does Core Data automatically do this) for  
attributes that

aren't accessed to not actually load? For example, my entities have a
"description" attributes that is rarely accessed. Will Core Data  
defer

loading the data for that attribute until it's actually requested?


No.  The behavior you're describing is known as "faulting."  Core Data
only faults objects, not attributes.

This is not the case with iPhone OS -- see NSFetchRequest's  
setPropertiesToFetch:





You can specify a subset of properties to fetch in the initial  
request.  If you request others at a later stage, the remainder of the  
object's data will be faulted in.


mmalc

___

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

Please do not post 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 capabilities questions

2009-06-21 Thread Kyle Sluder
On Sun, Jun 21, 2009 at 2:22 PM, mmalc Crawford wrote:>
> This is not the case with iPhone OS -- see NSFetchRequest's
> setPropertiesToFetch:

Well hot damn!  That's what I get for sticking to the desktop I guess.

--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: Cocoa and Computational Expense

2009-06-21 Thread syntonica

Thanks All for your replies.  I think I have seen the error of my ways 
regarding the size of my class.  Since I had two classes that were so 
hopelessly intertwined, I put them together into one and now I see that I could 
indeed have done it instead with two or maybe three.  The paradigm shift from 
all data available at all times with all the globals you can eat to private 
data has been a difficult one to make for me.

Regarding my final program, I tried to use Shark, but I believe I need a little 
more experience and to take a look under the hood before it starts making sense 
to me.  So, I tried the same informal test with Text Edit and got similar 
results, about 25% of my processor was used (where my program used 30%.)  Text 
Wrangler used about 50%.  This leads me to three conclusions:

0.  My code doesn't totally stink.
1.  The Field Editor is very expensive to use.
2.  1GHz of G4 just doesn't go as far as it used to.

However, the learning experience has been a positive one and I really enjoy 
working with Cocoa, even if the majority of Apple's documentation leaves me 
scratching my head.  I usually need to see concrete examples to understand how 
the code works.

I doubt I will go back and fix my program to split the classes up.  This is 
like Mark VII on this program, the previous six dismantled and 
reincorporated--I kept coding myself into a corner where only a global would 
save me and I am just happy the accursed thing works.  So, I will know that 
much more about what I am doing with my next project. I think it will be with 
graphics.  OpenGL looks interesting. :)

Once again, thanks to all who took the time to read and reply.




  
___

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

Please do not post 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


iPhone: Landscape support for tab bar?

2009-06-21 Thread Rick Genter
I'm just starting to design/develop my first iPhone app and have been  
reviewing the iPhone human interface guidelines. Is it true that tab  
bars do not support landscape mode?

--
Rick Genter
rick.gen...@gmail.com





___

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

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

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

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


Re: Possible to set tab stops in an NSTextView?

2009-06-21 Thread Ken Tozier

Thanks Ashley

I tried your snippet, but am getting the following error:

2009-06-21 18:32:34.912 QuarkXPress[4956:10b] *** -[NSCFNumber  
location]: unrecognized selector sent to instance 0x300bc300
2009-06-21 18:32:34.914 QuarkXPress[4956:10b] 0x23c60e70>: Exception *** -[NSCFNumber location]: unrecognized  
selector sent to instance 0x300bc300 raised during typesetting layout  
manager 

1 containers, text backing has 3006 characters
selected character range {3006, 0} affinity: downstream  
granularity: character

marked character range {3006, 0}
Currently holding 3006 glyphs.
Glyph tree contents:  3006 characters, 3006 glyphs, 1 nodes, 32  
node bytes, 4096 storage bytes, 4128 total bytes, 1.37 bytes per  
character, 1.37 bytes per glyph
Layout tree contents:  3006 characters, 3006 glyphs, 0 laid  
glyphs, 0 laid line fragments, 1 nodes, 32 node bytes, 0 storage  
bytes, 32 total bytes, 0.01 bytes per character, 0.01 bytes per glyph,  
0.00 laid glyphs per laid line fragment, 0.00 bytes per laid line  
fragment

, glyph range {0 25}. Ignoring...

Here's how I interpreted your code

NSArray *tabStops   = [[[NSArray alloc] initWithObjects:
[NSNumber numberWithInt: 70],
[NSNumber numberWithInt: 400],
[NSNumber numberWithInt: 460],
nil]
autorelease];

style   = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

[style setTabStops: tabStops];

NSMutableAttributedString		*missingAds		= [[[NSMutableAttributedString  
alloc] init] autorelease];


/* add some text to missingAds here */

[missingAds addAttribute: NSParagraphStyleAttributeName
value: style
range: NSMakeRange(0, [missingAds length])];

[[resultsView textStorage] setAttributedString: missingAds];

If i comment out the "addAttribute" line, I don't get the error, Can't  
seem to get this to work. Where am I messing up?


Thanks again.



On Jun 21, 2009, at 12:53 PM, Ashley Clark wrote:

You need to create an NSMutableParagraphStyle, set you tab stops on  
it with setTabStops: and then add it as an attribute to your  
attributed string in your text view.


Code written in Mail, YMMV:

NSArray *tabStops = /* your array */

NSMutableParagraphStyle *style = [[NSParagraphStyle  
defaultParagraphStyle] mutableCopy];

[style setTabStops:tabStops];

[[textView textStorage] addAttribute:NSParagraphStyleAttributeName  
value:style range: /* effective range */ ];


/* if you're doing this in response to a user action you should also  
update the typing attributes */
NSMutableDictionary *typingAttributes = [[textView typingAttributes]  
mutableCopy];
[typingAttributes setObject:style  
forKey:NSParagraphStyleAttributeName];

[textView setTypingAttributes:typingAttributes];

[typingAttributes release];
[style release];



Ashley


___

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

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

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

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


Re: Possible to set tab stops in an NSTextView?

2009-06-21 Thread Andrew Farmer

On 21 Jun 2009, at 15:44, Ken Tozier wrote:

Here's how I interpreted your code

NSArray *tabStops   = [[[NSArray alloc] initWithObjects:
[NSNumber numberWithInt: 70],
[NSNumber numberWithInt: 400],
[NSNumber numberWithInt: 460],
nil]
autorelease];

style   = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

[style setTabStops: tabStops];


setTabStops takes an array of NSTextTab objects, not an array of  
integers.

___

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

Please do not post 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


Missing functionality in copy/paste of NSAttributedStrings? or of NSData?

2009-06-21 Thread James Stein
I use a few non-standard attributes in NSAttributedStrings.
("Standard" attributes are listed in the "Attributed Strings
Programming Guide.")

My first stumbling block is that such a string (or substring) in an
NSTextView, when copied and pasted, will "lose" its non-standard
attributes. (As an aside, the non-standard attributes will survive
encoding and decoding, and are preserved by the 'copy:withZone'
method.) It appears to me that the Cocoa methods for converting
attributed strings to-and-from NSData objects assume the used of
"standard" attributes; and it further appears to me that these
conversions neglect to copy non-standard attributes.

I use a subclass of NSTextView, and am willing to override the
copy/paste/cut methods that it inherits from NSText; and am willing
to employ an additional pasteboard type.  Here is my quandary:

It appears that the only objects that can be written to an NSPasteboard are
these:
NSData(setData: forType)
NSString  (setString:forType:)
NSFileWrapper (writeFileWrapper:)
file content  (writeFileContents:)

OK, so it seems the first method is the only appropriate method, so
I need to create an NSData object from my NSAttributedString.
But how?

I must be missing something, but what?
___

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

Please do not post 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 to set tab stops in an NSTextView?

2009-06-21 Thread Ken Tozier

Thanks Andrew. That worked.


On Jun 21, 2009, at 7:04 PM, Andrew Farmer wrote:


On 21 Jun 2009, at 15:44, Ken Tozier wrote:

Here's how I interpreted your code

NSArray *tabStops   = [[[NSArray alloc] initWithObjects:
[NSNumber numberWithInt: 70],
[NSNumber numberWithInt: 400],
[NSNumber numberWithInt: 460],
nil]
autorelease];

style   = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];

[style setTabStops: tabStops];


setTabStops takes an array of NSTextTab objects, not an array of  
integers.


___

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

Please do not post 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: Landscape support for tab bar?

2009-06-21 Thread WT

On Jun 21, 2009, at 9:51 PM, Rick Genter wrote:

I'm just starting to design/develop my first iPhone app and have  
been reviewing the iPhone human interface guidelines. Is it true  
that tab bars do not support landscape mode?


I would imagine that the documentation would give you the answer to  
that. Then, again, it might not. :)


So I created a little test project based on the default tab-bar  
project that you get from XCode. I created a custom subclass of  
UITabBarController that overrides - 
shouldAutorotateToInterfaceOrientation: so that it always return YES.  
I then opened MainWindow.xib and set the class of the tab-bar  
controller to my CustomTabBarController class.


Build and run, then rotate the device left or right (you can do that  
in the simulator too). The result? It works. So, the answer is that  
tab-bars DO support landscape mode, at least in 3.0.


Wagner
___

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

Please do not post 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: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?

2009-06-21 Thread Graham Cox


On 22/06/2009, at 9:27 AM, James Stein wrote:


I need to create an NSData object from my NSAttributedString.
But how?



NSData* myStringData = [NSKeyedArchiver  
archivedDataWithRootObject:myString];



--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: Cocoa and Computational Expense

2009-06-21 Thread Graham Cox


On 22/06/2009, at 8:08 AM, syntonica wrote:

The paradigm shift from all data available at all times with all the  
globals you can eat to private data has been a difficult one to make  
for me.


I think most people who move to object-oriented programming from a  
classical programming background find this to some extent. But the  
benefits are enormous, once you let go of the "all you can eat" model.  
Much less fat, for one thing ;-)



1.  The Field Editor is very expensive to use.
2.  1GHz of G4 just doesn't go as far as it used to.



The problem isn't so much the text editing itself, rather all the  
graphical rendering that it needs to perform. Back in the 16K day,  
characters appeared on a screen more or less because the hardware  
performed that task, pulling characters from a character ROM in  
response to the direct ascii value in a text buffer. The text editing  
task much far simpler since a character and its glyph were effectively  
synonymous and the editor could simply hand off to the text buffer to  
get the characters displayed.


Now of course, we have a far, far more complex situation, with  
unicode, multi-lingual text, bi-directonal text, totally random-access  
editing (not just a line editor), live spell-checking, fractional  
positioning, arbitrary attributes, glyphs are an abstraction from the  
characters encoded, glyphs are stored as bezier paths and need to be  
rasterized to the screen, anti-aliased with a variety of stylistic  
effects... the list goes on. The text experience is far richer, but  
the cost is a lot more processing power needed. The fact that you're  
seeing it performed using only 25% of 1GHz isn't bad!


--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


Any Cocoa Developers on this list in Tallinn, Estonia?

2009-06-21 Thread Kok-Yong Tan
There's a potential client there I'd like to refer to you.  Please  
reply to me off-list.


Thanks.

Tan
--
Reality Artisans, Inc.   #   Network  
Wrangling and Delousing
P.O. Box 565, Gracie Station  #   Apple Certified Help  
Desk Specialist
New York, NY 10028-0019   #   Apple Consultants Network  
member

   #   Apple Developer Connection member
(212) 369-4876 (Voice)   #   My PGP public key can be  
found at 




___

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

Please do not post 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: Missing functionality in copy/paste of NSAttributedStrings? or of NSData?

2009-06-21 Thread Michael Ash
On Sun, Jun 21, 2009 at 7:27 PM, James Stein wrote:
> I use a few non-standard attributes in NSAttributedStrings.
> ("Standard" attributes are listed in the "Attributed Strings
> Programming Guide.")
>
> My first stumbling block is that such a string (or substring) in an
> NSTextView, when copied and pasted, will "lose" its non-standard
> attributes. (As an aside, the non-standard attributes will survive
> encoding and decoding, and are preserved by the 'copy:withZone'
> method.) It appears to me that the Cocoa methods for converting
> attributed strings to-and-from NSData objects assume the used of
> "standard" attributes; and it further appears to me that these
> conversions neglect to copy non-standard attributes.

While your question about how to accomplish this has been answered, I
just wanted to address the more philosophical question about why this
happens. Copy/paste is intended to work between applications, and as
such generally uses universally readable formats. Sometimes an
application will use a custom in-app format for special data that
doesn't apply to the outside world, but by necessity this means coming
up with your own format to represent that special data. This is
essentially what you're doing. Although you're using a standard class
to hold them, your custom attributes make this a custom format. Just
think of what would happen if the system encoded your custom
attributes along with everything else: the unarchiver would try to
decode those objects in the target application which doesn't contain
those classes, and would fail. It's much better to grab what the
system does know about than to fail in this manner.

Mike
___

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

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

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

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


Re: Show the dock icon's context menu:

2009-06-21 Thread Andrew Farmer

On 19 Jun 2009, at 16:37, Ian was here wrote:
I think the best way to show an application dock icon's context menu  
from within the application itself is to write an AppleScript that  
can find the desired application's dock icon, then ask it to show  
its context menu.


And how would you propose to do that? AppleScript isn't magic (sadly).  
It can't do anything that you can't do from code already.

___

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

Please do not post 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 capabilities questions

2009-06-21 Thread Rick Mann


On Jun 21, 2009, at 14:22:00, mmalc Crawford wrote:



On Jun 21, 2009, at 2:04 PM, Kyle Sluder wrote:

Is it possible (or does Core Data automatically do this) for  
attributes that
aren't accessed to not actually load? For example, my entities  
have a
"description" attributes that is rarely accessed. Will Core Data  
defer

loading the data for that attribute until it's actually requested?


No.  The behavior you're describing is known as "faulting."  Core  
Data

only faults objects, not attributes.

This is not the case with iPhone OS -- see NSFetchRequest's  
setPropertiesToFetch:





You can specify a subset of properties to fetch in the initial  
request.  If you request others at a later stage, the remainder of  
the object's data will be faulted in.


That is exactly what I'm looking for, 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


Core Data Fetching Limitations?

2009-06-21 Thread Ulai Beekam

Draw up the following model on a piece of paper:
We have three entities: Department, Employee, and EmployeeCar. Each of them has 
the 'name' attribute.
Department has the to-many 'employees' relationship to Employee. Its inverse 
is, naturally, the to-one 'department' relationship in Employee.
Employee has a to-one 'employeeCar' relationship to EmployeeCar. Its inverse is 
the to-many 'employees' relationship  in EmployeeCar. This reflects the reality 
that a single car can be assigned to more than one employee, but a given 
employee does only have one car assigned to him.

NOW HERE IS THE QUESTION: How can I make Core Data:  fetch all departments 
that have an employee whose name starts with 'Jo' and whose assigned car has 
the name of 'Volvo' 

Can Core Data even make such fetches? Can it be done without ALL,ANY? I ask 
because I might want to combine many such conditions, making it impossible to 
do with the SQLite storage option. Maybe I can just simply forget the SQLite 
storage for this? What are the alternatives? Am I doomed to work with the other 
slower storages?
And note that I do indeed have to have it inside a single predicate because I 
have an NSArrayController of Department objects, and after having made the 
correct predicate (for which I need your help) I plan to set the array 
controller's fetch predicate to that predicate.
_
Show them the way! Add maps and directions to your party invites. 
http://www.microsoft.com/windows/windowslive/products/events.aspx___

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

Please do not post 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 capabilities questions

2009-06-21 Thread Rick Mann



Is there also a way to tell Core Data to release objects it has  
currently allocated?


___

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

Please do not post 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


Core Data Fetching Limitations?

2009-06-21 Thread Ulai Beekam

(Sorry, the previous post was not sent with plaintext)

Please draw up the following model on a piece of paper:

We have three entities: Department, Employee, and EmployeeCar. Each of them has 
the 'name' attribute.

Department has the to-many 'employees' relationship to Employee. Its inverse 
is, naturally, the to-one 'department' relationship in Employee.

Employee has a to-one 'employeeCar' relationship to EmployeeCar. Its inverse is 
the to-many 'employees' relationship  in EmployeeCar. This reflects the reality 
that a single car can be assigned to more than one employee, but a given 
employee does only have one car assigned to him.


NOW HERE IS THE QUESTION: How can I make Core Data:  fetch all departments 
that have an employee whose name starts with 'Jo' and whose assigned car has 
the name of 'Volvo' 



Can Core Data even make such fetches? Can it be done without ALL,ANY? I ask 
because I might want to combine many such conditions, making it impossible to 
do with the SQLite storage option. Maybe I can just simply forget the SQLite 
storage for this? What are the alternatives? Am I doomed to work with the other 
slower storages?

And note that I do indeed have to have it inside a single predicate because I 
have an NSArrayController of Department objects, and after having made the 
correct predicate (for which I need your help) I plan to set the array 
controller's fetch predicate to that predicate.

Thanks, U.
_
Invite your mail contacts to join your friends list with Windows Live Spaces. 
It's easy!
http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mkt=en-us___

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

Please do not post 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 capabilities questions

2009-06-21 Thread mmalc Crawford


On Jun 21, 2009, at 5:56 PM, Rick Mann wrote:

Is there also a way to tell Core Data to release objects it has  
currently allocated?



"A managed object's lifetime is by default determined by the run loop— 
autoreleased managed objects will be deallocated when the run loop's  
autorelease pool is released.
The exception to this rule is that a managed object context maintains  
a strong reference to (in a managed memory environment it retains) any  
changed (inserted, deleted, and updated) objects until the pending  
transaction is committed (with a save:) or discarded (with a reset or  
rollback)."





mmalc

___

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

Please do not post 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: Show the dock icon's context menu:

2009-06-21 Thread Uli Kusterer

Am 22.06.2009 um 02:46 schrieb Andrew Farmer:
And how would you propose to do that? AppleScript isn't magic  
(sadly). It can't do anything that you can't do from code already.



Look at the docs. AppleScript supports "GUI scripting", which is a  
layer above the accessibility APIs and some other related things that  
lets you determine dimensions of onscreen items, simulate clicks in  
them etc.


So, you *can* do all of that in code, but in this case putting up with  
AS's broken syntax is probably a better option than trying to do the  
right thing yourself.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

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

Please do not post 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 fill rectangle under vertical scroller?

2009-06-21 Thread Uli Kusterer

Am 19.06.2009 um 04:23 schrieb Sumin Kim:

the area under the vertical scroller and right to horizontal
scroller still remains white. I tried to set different origin and  
frame size
for the view that is supposed to be drawn the area, but the results  
have not

changed.



 Where in the window is your table view? If it covers the lower right  
corner and your window is resizable, the white could be coming from  
the window's grow box view, not from your scroll view or table view.  
There seems to be some extra interaction where a table view leaves  
room for the grow box under a vertical scroller (if no horizontal  
scroller is there), and sets it to opaque as well.


Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





___

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

Please do not post 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 capabilities questions

2009-06-21 Thread Kyle Sluder
On Sun, Jun 21, 2009 at 5:56 PM, Rick Mann wrote:
> Is there also a way to tell Core Data to release objects it has currently
> allocated?

After you've read the documentation mmalc pointed you at, also take a
look at the section "Turning Objects into Faults" in the Faulting and
Uniquing section of the Core Data Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFaultingUniquing.html#//apple_ref/doc/uid/TP30001202-185436-TPXREF147

Also read "Reducing Memory Overhead":
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html#//apple_ref/doc/uid/TP40003468-SW4

But don't worry about this until you've demonstrated a memory problem
in your app.  You're more likely to hit this on the phone than on the
desktop, to be sure, but it's still not worth the effort optimizing
memory usage that doesn't threaten to pose a problem.

--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: Core Data capabilities questions

2009-06-21 Thread Rick Mann


On Jun 21, 2009, at 18:36:55, Kyle Sluder wrote:

On Sun, Jun 21, 2009 at 5:56 PM, Rick Mann  
wrote:
Is there also a way to tell Core Data to release objects it has  
currently

allocated?


After you've read the documentation mmalc pointed you at, also take a
look at the section "Turning Objects into Faults" in the Faulting and
Uniquing section of the Core Data Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdFaultingUniquing.html#/ 
/apple_ref/doc/uid/TP30001202-185436-TPXREF147


Also read "Reducing Memory Overhead":
http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html#/ 
/apple_ref/doc/uid/TP40003468-SW4


But don't worry about this until you've demonstrated a memory problem
in your app.  You're more likely to hit this on the phone than on the
desktop, to be sure, but it's still not worth the effort optimizing
memory usage that doesn't threaten to pose a problem.


Thanks for the pointers. My "didReceiveMemoryWarning" methods are  
being called, so I'm researching various methods to reduce the need to  
keep stuff in memory.


--
Rick

___

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

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

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

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


Re: Core Data "Uniqueing" not happening as expected

2009-06-21 Thread Jerry Krinock
Well, the explanation of where these two Bars came from turned out to  
be quite interesting, so I thought I'd report it.


It turns out that I wasn't inserting any Bars at all into that moc.   
But when I did this:


  [foo1 setBar:bar] ;
  [foo2 setBar:bar] ;

the Foos and the bar were in different managed object contexts that  
had different stores -- Yikes -- I was setting cross-store  
relationships.  Apparently, the Core Data runtime responds to this  
attempt cordially, by "doing what I mean".  It copies attributes and  
inserts a new one into the same managed object context as the other  
object in the relation.


Whew, I thought I was almost ready to ship, working on the last few  
minor bugs, this one being a duplicate item showing occasionally in a  
popup menu.  I think I would have preferred a resounding crash, well  
maybe a nice warning, instead of the "do what I mean".  But I suppose  
that if Apple changed it now they might break alot of working apps out  
there which contain this programming error.


___

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

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

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

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


Re: Core Data "Uniqueing" not happening as expected

2009-06-21 Thread Quincey Morris

On Jun 21, 2009, at 19:02, Jerry Krinock wrote:

It turns out that I wasn't inserting any Bars at all into that moc.   
But when I did this:


 [foo1 setBar:bar] ;
 [foo2 setBar:bar] ;

the Foos and the bar were in different managed object contexts that  
had different stores -- Yikes -- I was setting cross-store  
relationships.  Apparently, the Core Data runtime responds to this  
attempt cordially, by "doing what I mean".  It copies attributes and  
inserts a new one into the same managed object context as the other  
object in the relation.


This sent me searching the documentation for something that talks  
about cross-context (not cross-store) relationships, but haven't yet  
found anything definitive. There's an implication that different  
contexts may contain different realizations of the same "store- 
object" (mediated by UID, under the presumption of the same persistent  
store), and half an implication that cross-context relationships might  
be resolved at save time (under the same presumption about the  
persistent store).


That suggests that if there are cross-context, cross-store  
relationships between objects which are each realized only in a single  
context/store, cross-context resolution might well realize the  
"missing" object realizations first, each in the correct (because  
only) store for its context, thus eliminating the cross-store  
references before they can be detected.


If that's so, I would call it a bug, not "doing what I mean". So, to  
summarize:


(1) What are the conditions (if any) for a cross-context relationship  
to be valid?


(2) What invalid cross-context relationships are failing to be  
detected by Core Data?


Seems to me both might be worth filing a bug report -- the first  
against the documentation, and the second (using what could be a very  
simple example you're now in a position to construct) against the  
functionality.



___

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

Please do not post 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 fill rectangle under vertical scroller?

2009-06-21 Thread Graham Cox


On 21/06/2009, at 9:18 AM, Sumin Kim wrote:


Hi, Graham,

I think I finally got what you said. I referred your linked sample,  
and implemented my source as follows.(I enclose my source for anyone  
who has same problem with many thanks to this list.) I also needed  
to add some code to drawRect to draw my custom view correctly.


If you find any problem from my source, please let me know.




Well, this isn't what I meant.

You've created a view that fills your entire scrollview, just to draw  
some background colour in the corner. What I meant was to create a  
small view that is just the size of that small corner and use the - 
tile method to position it in the corner where you want it. This is  
what the sample code I pointed to is doing, albeit positioning a  
placard view in a different place.


Also, you are drawing the other's view's "content" in your scroll  
view. Instead, that view should be drawing its own content. This means  
you have to subclass NSView to make the corner view and implement its - 
drawRect method to draw whatever it is you want it to do.


None of these things are difficult. I'm afraid your solution is  
incorrect.


--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


Approaches for this Matching Problem?

2009-06-21 Thread Steve Cronin

Folks;

I would like to solicit feedback on the best approach to solve this  
problem:  "phrase contains any word in set {a,b,c...}"


I have a user supplied phrase (usually 3-5 words; max of 10 words) ->  
thePhrase

The user may provide any random phrase...

I also have a user managed array of words (somewhere around 250 words)  
-> theTags

Currently these are stored as records in a Core Data entity.
This set of tags is fairly stable but is nonetheless managed by the user

I want the fastest means of determining if thePhrase contains ANY  
member of theTags.
Position and frequency are not important.  If ANY Tag is found the  
'evaluation' can stop immediately.


method signature proposal  - (BOOL) containsAnyTag:(NSString *)  
thePhrase;
[NOTE: I may run this evalution several times in succession on  
different phrases so, for now, the set of Tags is already setup as an  
instance variable]


I am open to considering all options.  Speed is THE top priority.
Code complexity is a far distant second.

Seems like a job for regex but I'm a total newbie there and since I  
don't care about actual location nor frequency maybe it is NOT a job  
for regex..


Seems like there could be many ways to proceed but I hoping somebody  
might share some experience or insight.


Thank-You,
Steve
___

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

Please do not post 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: Approaches for this Matching Problem?

2009-06-21 Thread Jerry Krinock
Given the numbers in your post, "3-5", "250" and "several", I'd say  
you should just split the phrase into words, write an outer loop  
for(words in phraseWords), an inner loop for(tag in tags), and inside  
it all compare using -isEqualToString, breaking when found.  "Just do  
it."


You won't even know that this happened unless you log the  
millseconds.  I'd bet that the amount of time you spend writing this  
code is going to exceed the the CPU minutes consumed by 10,000 users  
doing 100 searches per day over the 5-year life your app.


Only thing that might require a little digging -- I believe that there  
is probably a "correct" way to split a phrase into a set or array of  
words which will work for non-Western languages.  -[NSString  
componentsJoinedByString:@" "] would be a cheesy solution.


___

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

Please do not post 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: Show the dock icon's context menu:

2009-06-21 Thread Michael Ash
On Sun, Jun 21, 2009 at 9:19 PM, Uli
Kusterer wrote:
> Am 22.06.2009 um 02:46 schrieb Andrew Farmer:
>>
>> And how would you propose to do that? AppleScript isn't magic (sadly). It
>> can't do anything that you can't do from code already.
>
> Look at the docs. AppleScript supports "GUI scripting", which is a layer
> above the accessibility APIs and some other related things that lets you
> determine dimensions of onscreen items, simulate clicks in them etc.
>
> So, you *can* do all of that in code, but in this case putting up with AS's
> broken syntax is probably a better option than trying to do the right thing
> yourself.

The thing is, AS GUI Scripting is never "the right thing". It's a
kludge and a hack pretty much by definition.

You can accomplish the same stuff by using the Accessibility API
directly. It will boil down to "figure out where the thing is, and
fake a mouse click there". This will work in a pinch but it's not
something you'd ever want to ship.

(Actually, popping up an app's Dock menu programmatically is probably
not something you'd ever want to ship no matter how you do it. If the
user wants that menu, he can click on the icon himself.)

Mike
___

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

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

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

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


Re: How to fill rectangle under vertical scroller?

2009-06-21 Thread Quincey Morris

On Jun 21, 2009, at 20:39, Graham Cox wrote:

What I meant was to create a small view that is just the size of  
that small corner and use the -tile method to position it in the  
corner where you want it. This is what the sample code I pointed to  
is doing, albeit positioning a placard view in a different place.


FWIW, the small "gotcha" in the sample code you linked to (AFAICT,  
since I never tried it) is that it places the "placard" in the area  
normally occupied by a scroll bar. The corner rect that the OP wants  
to draw is slightly different, in that the NSScrollView deliberately  
draws white in that corner, unless it's set to not draw a background  
at all. That means the linked-to code may not be quite complete -- it  
may also be necessary to ensure that the custom corner view draws  
above and/or after the scroll view, or else it may get painted over.


I think that's what went wrong when the OP tried to follow this code  
pattern originally, although I don't think it's been confirmed. (Maybe  
the OP's recent silence means that it's all working now.)


I did learn something marginally interesting from looking at the  
NSScrollView behavior in IB. If you set the background color to  
something other than white, it draws the clip view background in the  
specified color, but still draws the corner in white. I'm hopeful that  
piece of information may come in useful one of these years. :)



___

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

Please do not post 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: Approaches for this Matching Problem?

2009-06-21 Thread Ken Thomases

On Jun 21, 2009, at 11:02 PM, Jerry Krinock wrote:

Given the numbers in your post, "3-5", "250" and "several", I'd say  
you should just split the phrase into words, write an outer loop  
for(words in phraseWords), an inner loop for(tag in tags), and  
inside it all compare using -isEqualToString, breaking when found.   
"Just do it."


I would suggest making an NSSet from the tags, and using - 
containsObject: rather than the inner loop.  Not necessarily for  
speed, although it would probably be faster, but just because it's  
easier and simpler.  Since the tags set isn't changing frequently, you  
can keep the set around persistently, updating it on the infrequent  
occasions that it's necessary.  So, you don't need to build and tear  
down the set for each phrase matching operation.



Only thing that might require a little digging -- I believe that  
there is probably a "correct" way to split a phrase into a set or  
array of words which will work for non-Western languages.  - 
[NSString componentsJoinedByString:@" "] would be a cheesy solution.


The other problem is doing the string matching in a sensible way.  You  
probably don't want the usual test for equality which is a literal  
match.  It's sensitive to case and to differences in precomposed/ 
decomposed characters, etc.


To do that with NSSet would require you to wrap your strings in a  
custom class which overrides -isEqual: and -hash:.  That runs counter  
to the simplicity arguing for NSSet.  It may end up, after all, that  
just enumerating the strings and using -compare:options: would be  
simpler.


Regards,
Ken

___

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

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

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

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


Amount of Arguments per Method

2009-06-21 Thread Chunk 1978
clearly simplicity is important, but i'd like to know if there is a
limit for the amount of arguments which a method can handle?

also, just for fun, what's the longest method name you've seen?
___

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

Please do not post 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


Customize the NSMenu appearances

2009-06-21 Thread 慧 松本
Does anybody know how to customize the NSMenu appearances, for  
example, its transparency, background color or foreground color.


I want to customize the menu appearances popped up in the HUD panel.

Satoshi



___

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

Please do not post 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