Re: Collections can be simple Attributes in Core Data

2008-10-07 Thread Negm-Awad Amin


Am Di,30.09.2008 um 19:58 schrieb I. Savant:

On Mon, Sep 29, 2008 at 3:03 AM, Negm-Awad Amin <[EMAIL PROTECTED] 
> wrote:


But now I find there is an even more natural way, which is to just  
leave
them as a set or array, and store in an attribute of type  
Transformable.
The default transformer en/decodes the collection into/from an  
NSData, and

everything "just works".

I'm surprised that I've never seen this discussed or documented.   
Is this

going to get me into any trouble?


Yes, because you get redundant and inconsistent model.


 If I'm reading this right, Jerry has a simple attribute called "pet
names". Usually this is used as a personally-identifiable unit of
information. Sure, lots of people might have fluffy, but do you really
need to  have a "PetName" entity, checking to see if an instance with
"name" property equal to "Fluffy" exists, creating one if not? In this
case (where we just want to store a short list of very personal things
as an attribute), sure you can archive an array or a set, just like
any other archiveable object.

 Now if the application needs to track people and their pets, I'd
imagine you'd have a whole "Pet" entity with a "name" property, but
that doesn't sound like what Jerry is getting at ...

When I read this:
"[…]Person's pets,[…]"
I assumed, that he has a person entity. Pets are persons, too. So I  
wouldn't create a new pet entity, but using a reflexiv relation to  
person to model the pets.


However, if it i a simple list of names related to nothing, you can  
model this with an simple array (or set) without creating an entity  
and relationship. But anyway, this is dangerous, too: Let's have a  
person (an instance of a person entity)
 "Amin Negm" with the pets "Dieter Müller", "Peter Schmitz" and  
"Michaela Schneider"

and a person
"Jerry Krinock" with the pets "Jo Miller", "Peter Smith" and (the  
same) "Michaela Schneider".
Now imagine, that Michaela marries and her name changes to "Michaela  
Suhrbier" …


The basic problem is, that a pet's name references something (an  
"entity" in its original philosophical meaning) outside the model. And  
the "silent assumption", that one attribute refers something outside  
the model, can fail: The name of a person can change without changing  
the person. (Okay, when Michaele marries, maybe she changes her  
personality. But this has nothing to do with IT, ;-))


In contrast to this, sometimes there is no problem doing so: If there  
would be colour attribute, say the colour of the hair, it is correct  
to model simply a string like "brunette" and so on. Even if Michaela  
changes the colour of her hair, this would be a change of *her* hair.
We would have the problem mentioned above only, if the name of the  
colour would change, say that "black" is called "zusgaasee" in future,  
This won't happen … *pray*






 The 'correct' approach depends entirely on the model.

Of course …




--
I.S.

Cheers,

Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Collections can be simple Attributes in Core Data

2008-10-07 Thread Negm-Awad Amin


Am Do,02.10.2008 um 00:16 schrieb Jerry Krinock:



On 2008 Sep, 30, at 10:58, I. Savant wrote:


The 'correct' approach depends entirely on the model.


Yes, I appreciated Amin's thoughts but didn't have much to add.  An  
important step in modelling is to draw a potato around the part of  
the world that you're going to include.  You have to make a judgment  
of whether or not you include some detail based on how much effort  
it will take vs. the probability that it might be involved in some  
way that you have not yet imagined.
Yes, even modelling sounds like a pretty formal work, it is related to  
imaginations of what change could happen. (Sounds like the election of  
the u.s. president …?). More exactly: What are the changes, I have to  
include in my model?


Cheers,
Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread Negm-Awad Amin


Am Di,07.10.2008 um 04:56 schrieb James Walker:


[…]
How do you know the window isn't being deallocated? Examining  
retain counts is not going to tell you whether it is or not. The  
only way would be to subclass it and log the -dealloc method.


That's exactly what I did.  The dealloc method was not getting  
called before I added the workaround.  Well, the initial symptom  
was that I got an access violation because a custom view was asked  
to draw after the window had been closed and the window controller  
had been destroyed.  In the course of debugging that, I subclassed  
the window.
I'd suggest it would be more fruitful to chase down the actual bug  
rather than one that appears to be related but might be just a red  
herring.
If a view is being asked to draw but its window has gone away, then  
something's very, very off somewhere. Normally views are drawn by  
their windows, so how can such a situation arise? If you can answer  
that question you've probably found the problem. Is some other  
object retaining the view? Why? Are you drawing outside the usual  
update event cycle mechanism? Why?


When I said "the window has gone away", I spoke imprecisely.  I  
meant the window had been closed.  But, as I said, it had not been  
deallocated.

To clarify:
The window is closed (still allocated) and you get a draw request?


[…]


Cheers,
Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting NSTimer to work after an NSThread completes?

2008-10-07 Thread Alex Reynolds

When I press my interface button, it calls:

	[NSThread detachNewThreadSelector:@selector(initializeData)  
toTarget:self withObject:nil];


This calls:

- (void) initializeData
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

... initialize data ...

		[[NSNotificationCenter defaultCenter]  
postNotificationName:DataAreInitializedNotification object:self];

[pool release];
}

The notification 'DataAreInitializedNotification' instantiates and  
brings a new view to the foreground, immediately after the data are  
initialized.


The new view shows up fine. The problem is that if I instantiate an  
NSTimer in this new view, the NSTimer never fires my selector:


	[NSTimer scheduledTimerWithTimeInterval:2.0 target:self  
selector:@selector(doSomethingInteresting:) userInfo:nil repeats:NO]


However, if I skip the NSThread instantiation step, then my NSTimer  
starts working again.


I have also tried:

	[[NSRunLoop currentRunLoop] addTimer:myNSTimer  
forMode:NSDefaultRunLoopMode];


in my new view, but this does not work either.

What should I do to get an NSTimer to work after an NSThread completes?

Thanks,
Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting NSTimer to work after an NSThread completes?

2008-10-07 Thread Jason Coco


On Oct 7, 2008, at 04:06 , Alex Reynolds wrote:
However, if I skip the NSThread instantiation step, then my NSTimer  
starts working again.


I have also tried:

	[[NSRunLoop currentRunLoop] addTimer:myNSTimer  
forMode:NSDefaultRunLoopMode];


in my new view, but this does not work either.

What should I do to get an NSTimer to work after an NSThread  
completes?


Your notification is getting dispatched to the wrong thread. If you  
can target 10.5, do this:


[[NSRunLoop mainRunLoop] addTimer:myNSTimer  
forMode:NSDefaultRunLoopMode];


If you must target earlier versions of MacOS, there is a lot of  
documentation on re-dispatching
notifications back to a specific thread... although it's much more  
complicated than the above

and I don't have the links at the moment...

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

Re: comparing Strings.

2008-10-07 Thread Gerriet M. Denkmann


On 7 Oct 2008, at 09:20, cGraham Cox <[EMAIL PROTECTED]> wrote:


On 7 Oct 2008, at 4:22 pm, Sandro Noel wrote:


i'm having a problem comparing some type of strings, for example the
one giving me a problem right now.
is let's say in my database i have 4 version of the same string .

"sandro's computer"
"sandro's_computer"
"sandros computer"
"sandros_computer"

I would like them to compare as being equal,
is there a way I can mingle with the comparing routine
to ask it to ignore some characters in the comparison?



First strip out the characters to be ignored:

NSString* tempString = [myString stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"'_ "]];

returns "sandroscomputer" given any of the above.


Are you quite sure?
The Tiger documentation says: "Returns a new string made by removing  
from both ends of the receiver characters contained in a given  
character set."


If this is still true, then the internal apostrophs would not get  
removed.


But maybe I am misunderstanding the documentation.
DId not actually test this.

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: comparing Strings.

2008-10-07 Thread Negm-Awad Amin

A littlebit tricky  (probably ugly), but shorter:

NSArray* components = [source componentsSeperatedByCharactersInSet: 
[NSCharacterSet …]];

NSString* result = [components componentsJoinedByString:@""];

;-)


Cheers

Am Di,07.10.2008 um 11:55 schrieb Graham Cox:



On 7 Oct 2008, at 7:46 pm, Gerriet M. Denkmann wrote:



On 7 Oct 2008, at 09:20, cGraham Cox <[EMAIL PROTECTED]> wrote:


On 7 Oct 2008, at 4:22 pm, Sandro Noel wrote:

i'm having a problem comparing some type of strings, for example  
the

one giving me a problem right now.
is let's say in my database i have 4 version of the same string .

"sandro's computer"
"sandro's_computer"
"sandros computer"
"sandros_computer"

I would like them to compare as being equal,
is there a way I can mingle with the comparing routine
to ask it to ignore some characters in the comparison?



First strip out the characters to be ignored:

NSString* tempString = [myString stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"'_ "]];

returns "sandroscomputer" given any of the above.


Are you quite sure?
The Tiger documentation says: "Returns a new string made by  
removing from both ends of the receiver characters contained in a  
given character set."


If this is still true, then the internal apostrophs would not get  
removed.


But maybe I am misunderstanding the documentation.
DId not actually test this.


Whoops, I made a mistake.

I thought I'd seen a method for stripping characters in a set from a  
string, and searching for it jumped on the stringByTrimming...  
method. But as you correctly state, that's not right! However, I  
wasn't going entirely mad, as I had seen the method, courtesy of a  
handy NSString category by Alastair Houghton. I hope he won't mind  
my copying it in below.


Apologies for the misleading info.

G.



@implementation NSString (RemovalOfCharsInSet)


/* Remove all characters from the specified set */


- (NSString *)		stringByRemovingCharactersInSet:(NSCharacterSet*)  
charSet options:(unsigned) mask

{
NSRange range;
NSMutableString*newString = [NSMutableString string];
unsignedlen = [self length];

mask &= ~NSBackwardsSearch;
range = NSMakeRange (0, len);
while (range.length)
{
NSRange substringRange;
unsigned pos = range.location;

		range = [self rangeOfCharacterFromSet:charSet options:mask  
range:range];

if (range.location == NSNotFound)
range = NSMakeRange (len, 0);

substringRange = NSMakeRange (pos, range.location - pos);
[newString appendString:[self 
substringWithRange:substringRange]];

range.location += range.length;
range.length = len - range.location;
}

return newString;
}


- (NSString *)		stringByRemovingCharactersInSet:(NSCharacterSet*)  
charSet

{
return [self stringByRemovingCharactersInSet:charSet options:0];
}


- (NSString *)  stringByRemovingCharacter:(unichar) character
{
	NSCharacterSet *charSet = [NSCharacterSet  
characterSetWithRange:NSMakeRange (character, 1)];


return [self stringByRemovingCharactersInSet:charSet];
}

@end

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Bill Dudney

Hi Frank,

That and a whole lot more;

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html#/ 
/apple_ref/doc/uid/TP40001798


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch  
the object of an entity which the maximum of a certain property  
value, but without having to fetch all objects into memory?


Cheers

Frank


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Negm-Awad Amin


Am Di,07.10.2008 um 14:04 schrieb Frank Illenberger:


Hi Bill,

I tried using predicates for this but did not succeed.
What would a predicate look like which finds the object of an entity  
with the maximum value for a property?
In contrast to Bill I think, that this is not possible with  
predicates. Why?


You want to get the maximum value of an attribute. Obviously this task  
includes the knowledge of all values stored in that attribute. So if  
Core Data should do that, there are two approaches:


a) Reading all attributes and compare it. This is, what you didn't  
want to do.

b) Delegate this task to the SQL store.

The second one is the solution. But predicates filters the attributes.  
They do not really aggregate them, even there are some aggregates  
available. These aggregates filters the source entity by resolving a  
relationship, but not by aggregating a min or max value.

*If there is a solution using predicates, I'm highly interested in it.*

However, there is another solution, that should work:
When you have an entity you can fetch the instances of the entity. And  
you can sort them by using a sort descriptor. And you can set a fetch  
limit. So simply create a fetch request, set the sort descriptor's key  
to the attribute and the sort descriptor's order to descending. Set  
the fetch limit to 1. Executing this fetch will lead to the instance  
with the value for that attribute.


AFAIK this sort descriptors and limits are passed to the sql store. So  
the SQL engine will do that work. (Anyway the SQL engine of course has  
to read every value.)



Cheers


Frank

On Oct 7, 2008, at 1:08 PM, Bill Dudney wrote:


Hi Frank,

That and a whole lot more;

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html#/ 
/apple_ref/doc/uid/TP40001798


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch  
the object of an entity which the maximum of a certain property  
value, but without having to fetch all objects into memory?


Cheers

Frank


___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Frank Illenberger

Hello Negm-Awad,

thanks for helping. The idea with the fetch limit and the descending  
order solves my problem as I am using a SQLite store.


Cheers

Frank

On Oct 7, 2008, at 2:59 PM, Negm-Awad Amin wrote:


In contrast to Bill I think, that this is not possible with  
predicates. Why?


You want to get the maximum value of an attribute. Obviously this  
task includes the knowledge of all values stored in that attribute.  
So if Core Data should do that, there are two approaches:


a) Reading all attributes and compare it. This is, what you didn't  
want to do.

b) Delegate this task to the SQL store.

The second one is the solution. But predicates filters the  
attributes. They do not really aggregate them, even there are some  
aggregates available. These aggregates filters the source entity by  
resolving a relationship, but not by aggregating a min or max value.
*If there is a solution using predicates, I'm highly interested in  
it.*


However, there is another solution, that should work:
When you have an entity you can fetch the instances of the entity.  
And you can sort them by using a sort descriptor. And you can set a  
fetch limit. So simply create a fetch request, set the sort  
descriptor's key to the attribute and the sort descriptor's order to  
descending. Set the fetch limit to 1. Executing this fetch will lead  
to the instance with the value for that attribute.


AFAIK this sort descriptors and limits are passed to the sql store.  
So the SQL engine will do that work. (Anyway the SQL engine of  
course has to read every value.)



-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch  
the object of an entity which the maximum of a certain property  
value, but without having to fetch all objects into memory?


Cheers

Frank

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Steve Steinitz

Hi Frank,

You wrote


Hi Bill,

I tried using predicates for this but did not succeed.
What would a predicate look like which finds the object of an 
entity  with the maximum value for a property?


I haven't done exactly what you want but if you have an object 
that has a to many relationship to all the entities over which 
you want to search, you can first do this


NSNumber * theMax =  [someObject valueForKeyPath: @"[EMAIL PROTECTED]"];

Then build a fetchRequest using theMax.

If you don't have such an object, I think you'll have to load at 
least faults for all your objects into memory and then do


 NSNumber * theMax =  [objects valueForKeyPath: 
@"@max.attributeYouWantMaxOf"];

Then do the fetchRequest.  I think I remember reading somewhere 
that @max doesn't cause faults to fire.


There is likely a better way but that might get you going 
without too much trouble...


Cheers,

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


Re: Problems with loose ViewController coupling and KVO to-many relationships

2008-10-07 Thread Benjamin Stiglitz

There's a design flaw here somewhere, but I can't quite figure out
what it is.  It's highlighted by trying to reorder widgets.  With KVC
to-many relationships, there's no atomic way of moving an object from
one position in an array to another : you remove the object, then
re-insert it at the new location.  But when the object is
(temporarily) removed from the array, the window controller gets an
observeValueForKeyPath saying it's been deleted, and so releases the
corresponding WidgetViewController, the view gets deallocated, and so
on.  I'll then get a second observeValueForKeyPath saying that an
object has been inserted, recreate the WidgetViewController, re-insert
the view, etc etc.


That’s not a design flaw, but rather just a shortcoming of the KVO  
change model. Note that NSMutableArray has no operation to move an  
object from one index to another, either.



This seems pretty wrong to me.  I can see a few workarounds (perhaps
storing the kvo notifications until the end of the current runloop so
I can add them together and figure out what was really a deletion and
what was just a reordering), but they all seem pretty ugly and
heavyweight.


The runloop batching is probably the best thing to do if you’re  
concerned about the cost of reordering views, or if you want to  
animate the change in some way. If you just need to atomically  
rearrange the view, you might be able to get by with a pool of  
recently-deallocated WidgetViews and WidgetViewControllers that you  
reuse when you get a new object insertion (avoiding the allocation  
overhead).


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


Re: comparing Strings.

2008-10-07 Thread Graham Cox


On 7 Oct 2008, at 7:46 pm, Gerriet M. Denkmann wrote:



On 7 Oct 2008, at 09:20, cGraham Cox <[EMAIL PROTECTED]> wrote:


On 7 Oct 2008, at 4:22 pm, Sandro Noel wrote:


i'm having a problem comparing some type of strings, for example the
one giving me a problem right now.
is let's say in my database i have 4 version of the same string .

"sandro's computer"
"sandro's_computer"
"sandros computer"
"sandros_computer"

I would like them to compare as being equal,
is there a way I can mingle with the comparing routine
to ask it to ignore some characters in the comparison?



First strip out the characters to be ignored:

NSString* tempString = [myString stringByTrimmingCharactersInSet:
[NSCharacterSet characterSetWithCharactersInString:@"'_ "]];

returns "sandroscomputer" given any of the above.


Are you quite sure?
The Tiger documentation says: "Returns a new string made by removing  
from both ends of the receiver characters contained in a given  
character set."


If this is still true, then the internal apostrophs would not get  
removed.


But maybe I am misunderstanding the documentation.
DId not actually test this.


Whoops, I made a mistake.

I thought I'd seen a method for stripping characters in a set from a  
string, and searching for it jumped on the stringByTrimming... method.  
But as you correctly state, that's not right! However, I wasn't going  
entirely mad, as I had seen the method, courtesy of a handy NSString  
category by Alastair Houghton. I hope he won't mind my copying it in  
below.


Apologies for the misleading info.

G.



@implementation NSString (RemovalOfCharsInSet)


/* Remove all characters from the specified set */


- (NSString *)		stringByRemovingCharactersInSet:(NSCharacterSet*)  
charSet options:(unsigned) mask

{
NSRange range;
NSMutableString*newString = [NSMutableString string];
unsignedlen = [self length];

mask &= ~NSBackwardsSearch;
range = NSMakeRange (0, len);
while (range.length)
{
NSRange substringRange;
unsigned pos = range.location;

		range = [self rangeOfCharacterFromSet:charSet options:mask  
range:range];

if (range.location == NSNotFound)
range = NSMakeRange (len, 0);

substringRange = NSMakeRange (pos, range.location - pos);
[newString appendString:[self 
substringWithRange:substringRange]];

range.location += range.length;
range.length = len - range.location;
}

return newString;
}


- (NSString *)		stringByRemovingCharactersInSet:(NSCharacterSet*)  
charSet

{
return [self stringByRemovingCharactersInSet:charSet options:0];
}


- (NSString *)  stringByRemovingCharacter:(unichar) character
{
	NSCharacterSet *charSet = [NSCharacterSet  
characterSetWithRange:NSMakeRange (character, 1)];


return [self stringByRemovingCharactersInSet:charSet];
}

@end

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IKImageView and delegate callback/notification of image changes

2008-10-07 Thread Benjamin Stiglitz
Has anyone come across a solution for knowing when the image has  
been edited?


You should be able to use KVO to be notified when the image property  
of the IKImageView changes.


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


NSNotificationQueue EXC_BAD_ACCESS problems

2008-10-07 Thread Karan, Cem (Civ, ARL/CISD)
I'm having a great deal of trouble getting my notification queue to work 
correctly.  It always causes a EXC_BAD_ACCESS 
whenever I post using NSPostASAP or NSPostWhenIdle, but it works when I post 
using NSPostNow.  Here are the relevant lines of code:

-(void) testMethod
{
NSNotification *tempNotification = [NSNotification 
notificationWithName:@"DummyName" object:self userInfo:nil];

[[NSNotificationQueue defaultQueue] enqueueNotification:tempNotification 
postingStyle:NSPostNow
coalesceMask:(NSNotificationCoalescingOnName | 
NSNotificationCoalescingOnSender) forModes:nil];
}

If I change NSPostNow to NSPostASAP, then it immediately crashes.  In the last 
crash, the stack looked like this:

#0  0x964e6688 in objc_msgSend
#1  0x931731da in _nsnote_callback
#2  0x90722aba in __CFXNotificationPost
#3  0x90722d93 in _CFXNotificationPostNotification
#4  0x931a071c in -[NSNotificationCenter postNotification:]
#5  0x931d3121 in postQueueNotifications
#6  0x9073f9c2 in __CFRunLoopDoObservers
#7  0x90740d1c in CFRunLoopRunSpecific
#8  0x90741cf8 in CFRunLoopRunInMode
#9  0x94902480 in RunCurrentEventLoopInMode
#10 0x949021d2 in ReceiveNextEventCommon
#11 0x9490210d in BlockUntilNextEventMatchingListInMode
#12 0x9580b3ed in _DPSNextEvent
#13 0x9580aca0 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:]
#14 0x95803cdb in -[NSApplication run]
#15 0x957d0f14 in NSApplicationMain
#16 0xa7fe in main at main.mm:13

The precise line I get the EXC_BAD_ACCESS is:

0x964e6688  <+0024>  mov0x20(%edx),%edi

and this seems to happen at the end of the runloop.  I tried removing the 
coalesceMask arguments, but no luck.  Note that NSPostNow causes all the code 
to work completely correctly, its just the other two modes that it doesn't 
work.  Anyone have any clue what is going on?

This is on a OS X 10.5.5 machine with MacFUSE 1.7 installed.  The code is being 
compiled using Xcode 3.1.1.

Thanks,
Cem Karan
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Wasted Space and Kernighan

2008-10-07 Thread Bill Mutch
First let me say that the views expressed by Michael Ash are almost  
identical to mine.
However, I have to take issue with the often quoted statement of  
Kernighan on debugging.



"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it." -- Brian W. Kernighan


Kernighan takes a general assertion on debugging and concludes that it  
can be applied to any specific example.
That is simply not valid whatever his meaning of 'hard' or 'cleverly  
as possible'.


Even a general conclusion is not valid unless by 'clever' he means  
intentionally obtuse.


I would consider clever coding to be using one's imagination to write  
code that accomplishes its purpose

in perhaps non obvious ways. It could even be easier to debug!

Code which I consider 'clever' that I wrote on an IBM mainframe in  
assembler was designed to make and did make debugging production  
programs considerably easier.


Bill
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: IKImageView and delegate callback/notification of image changes

2008-10-07 Thread Jim Turner
Hi Ben

Binding to my IKImageView's "image" property nets the following:

[ addObserver:
forKeyPath:@"image" options:0x7 context:0x1adc3c30] was sent to an
object that is not KVC-compliant for the "image" property.

Is "image" not the key to which I should be binding?

Jim

On Tue, Oct 7, 2008 at 9:19 AM, Benjamin Stiglitz <[EMAIL PROTECTED]> wrote:
>> Has anyone come across a solution for knowing when the image has been
>> edited?
>
> You should be able to use KVO to be notified when the image property of the
> IKImageView changes.
>
> -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/jturner.lists%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSNotificationQueue EXC_BAD_ACCESS problems

2008-10-07 Thread Julien Jalon
Try your code by enabling NSZombies (Add NSZombieEnabled=YES to the
environment before launching your tool/app).
This should show you what object is supposed to get messaged. I suspect some
object observes your notification but is deallocated.

-- 
Julien

On Tue, Oct 7, 2008 at 4:28 PM, Karan, Cem (Civ, ARL/CISD) <
[EMAIL PROTECTED]> wrote:

> I'm having a great deal of trouble getting my notification queue to work
> correctly.  It always causes a EXC_BAD_ACCESS
> whenever I post using NSPostASAP or NSPostWhenIdle, but it works when I
> post using NSPostNow.  Here are the relevant lines of code:
>
> -(void) testMethod
> {
>NSNotification *tempNotification = [NSNotification
> notificationWithName:@"DummyName" object:self userInfo:nil];
>
>[[NSNotificationQueue defaultQueue] enqueueNotification:tempNotification
> postingStyle:NSPostNow
>coalesceMask:(NSNotificationCoalescingOnName |
> NSNotificationCoalescingOnSender) forModes:nil];
> }
>
> If I change NSPostNow to NSPostASAP, then it immediately crashes.  In the
> last crash, the stack looked like this:
>
> #0  0x964e6688 in objc_msgSend
> #1  0x931731da in _nsnote_callback
> #2  0x90722aba in __CFXNotificationPost
> #3  0x90722d93 in _CFXNotificationPostNotification
> #4  0x931a071c in -[NSNotificationCenter postNotification:]
> #5  0x931d3121 in postQueueNotifications
> #6  0x9073f9c2 in __CFRunLoopDoObservers
> #7  0x90740d1c in CFRunLoopRunSpecific
> #8  0x90741cf8 in CFRunLoopRunInMode
> #9  0x94902480 in RunCurrentEventLoopInMode
> #10 0x949021d2 in ReceiveNextEventCommon
> #11 0x9490210d in BlockUntilNextEventMatchingListInMode
> #12 0x9580b3ed in _DPSNextEvent
> #13 0x9580aca0 in -[NSApplication
> nextEventMatchingMask:untilDate:inMode:dequeue:]
> #14 0x95803cdb in -[NSApplication run]
> #15 0x957d0f14 in NSApplicationMain
> #16 0xa7fe in main at main.mm:13
>
> The precise line I get the EXC_BAD_ACCESS is:
>
> 0x964e6688  <+0024>  mov0x20(%edx),%edi
>
> and this seems to happen at the end of the runloop.  I tried removing the
> coalesceMask arguments, but no luck.  Note that NSPostNow causes all the
> code to work completely correctly, its just the other two modes that it
> doesn't work.  Anyone have any clue what is going on?
>
> This is on a OS X 10.5.5 machine with MacFUSE 1.7 installed.  The code is
> being compiled using Xcode 3.1.1.
>
> Thanks,
> Cem Karan
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to [EMAIL PROTECTED]
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: apple remote

2008-10-07 Thread Memo Akten

cool thanks...

On 6 Oct 2008, at 07:31, Simone Tellini wrote:



Il giorno 06/ott/08, alle ore 05:38, Memo Akten ha scritto:

Hi All, I was wondering how straightforward it is to write an app  
that responds to Apple Remote events. would I get them in - (void)  
sendEvent:(NSEvent*)event ?


I use Kahr's wrapper, too. I suggest you file a bug with Apple  
asking for an official Apple Remote API though. Let's hope they get  
enough requests to actually provide one.


--
Simone Tellini
http://tellini.info



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: [Disarmed] Re: NSNotificationQueue EXC_BAD_ACCESS problems

2008-10-07 Thread Karan, Cem (Civ, ARL/CISD)
That was it!  Thanks, I should have checked for that first.

Thanks,
Cem Karan

> -Original Message-
> From: Julien Jalon [mailto:[EMAIL PROTECTED] 
> Sent: Tuesday, October 07, 2008 10:39 AM
> To: Karan, Cem (Civ, ARL/CISD)
> Cc: cocoa-dev@lists.apple.com
> Subject: [Disarmed] Re: NSNotificationQueue EXC_BAD_ACCESS problems
> 
> Try your code by enabling NSZombies (Add NSZombieEnabled=YES 
> to the environment before launching your tool/app).
> 
> This should show you what object is supposed to get messaged. 
> I suspect some object observes your notification but is deallocated.
> 
> --
> Julien 
> 
> 
> On Tue, Oct 7, 2008 at 4:28 PM, Karan, Cem (Civ, ARL/CISD) 
> <[EMAIL PROTECTED]> wrote:
> 
> 
>   I'm having a great deal of trouble getting my 
> notification queue to work correctly.  It always causes a 
> EXC_BAD_ACCESS
>   whenever I post using NSPostASAP or NSPostWhenIdle, but 
> it works when I post using NSPostNow.  Here are the relevant 
> lines of code:
>   
>   -(void) testMethod
>   {
>  NSNotification *tempNotification = [NSNotification 
> notificationWithName:@"DummyName" object:self userInfo:nil];
>   
>  [[NSNotificationQueue defaultQueue] 
> enqueueNotification:tempNotification postingStyle:NSPostNow
>  coalesceMask:(NSNotificationCoalescingOnName | 
> NSNotificationCoalescingOnSender) forModes:nil];
>   }
>   
>   If I change NSPostNow to NSPostASAP, then it 
> immediately crashes.  In the last crash, the stack looked like this:
>   
>   #0  0x964e6688 in objc_msgSend
>   #1  0x931731da in _nsnote_callback
>   #2  0x90722aba in __CFXNotificationPost
>   #3  0x90722d93 in _CFXNotificationPostNotification
>   #4  0x931a071c in -[NSNotificationCenter postNotification:]
>   #5  0x931d3121 in postQueueNotifications
>   #6  0x9073f9c2 in __CFRunLoopDoObservers
>   #7  0x90740d1c in CFRunLoopRunSpecific
>   #8  0x90741cf8 in CFRunLoopRunInMode
>   #9  0x94902480 in RunCurrentEventLoopInMode
>   #10 0x949021d2 in ReceiveNextEventCommon
>   #11 0x9490210d in BlockUntilNextEventMatchingListInMode
>   #12 0x9580b3ed in _DPSNextEvent
>   #13 0x9580aca0 in -[NSApplication 
> nextEventMatchingMask:untilDate:inMode:dequeue:]
>   #14 0x95803cdb in -[NSApplication run]
>   #15 0x957d0f14 in NSApplicationMain
>   #16 0xa7fe in main at main.mm:13
>   
>   The precise line I get the EXC_BAD_ACCESS is:
>   
>   0x964e6688  <+0024>  mov0x20(%edx),%edi
>   
>   and this seems to happen at the end of the runloop.  I 
> tried removing the coalesceMask arguments, but no luck.  Note 
> that NSPostNow causes all the code to work completely 
> correctly, its just the other two modes that it doesn't work. 
>  Anyone have any clue what is going on?
>   
>   This is on a OS X 10.5.5 machine with MacFUSE 1.7 
> installed.  The code is being compiled using Xcode 
> MailScanner has detected a possible fraud attempt from 
> "3.1.1" claiming to be 3.1.1.  
>   
>   Thanks,
>   Cem Karan
>   
>   ___
>   
>   Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>   
>   Please do not post admin requests or moderator comments 
> to the list.
>   Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>   
>   Help/Unsubscribe/Update your Subscription:
>   
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>   
>   This email sent to [EMAIL PROTECTED]
>   
> 
> 
> 
___

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

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

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

This email sent to [EMAIL PROTECTED]

CoreData: Fetching object with maximum of property

2008-10-07 Thread Frank Illenberger

Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch the  
object of an entity which the maximum of a certain property value, but  
without having to fetch all objects into memory?


Cheers

Frank


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Frank Illenberger

Hi Bill,

I tried using predicates for this but did not succeed.
What would a predicate look like which finds the object of an entity  
with the maximum value for a property?


Frank

On Oct 7, 2008, at 1:08 PM, Bill Dudney wrote:


Hi Frank,

That and a whole lot more;

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html#/ 
/apple_ref/doc/uid/TP40001798


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch  
the object of an entity which the maximum of a certain property  
value, but without having to fetch all objects into memory?


Cheers

Frank


___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Downloading with NSData and NSFileManager

2008-10-07 Thread Mike Abdullah
If you want to literally just download a file, the simple option is to  
use NSURLDownload. It's fairly straightforward, an asynchronous.


On 6 Oct 2008, at 18:04, Mark Thomas wrote:


Hi All,
 I was looking at downloading some files, and started to look at
NSFileManager to create the file, and then saw I could use NSData to  
load
the data via a NSURL, so this look's pretty straight forward and  
very small

code for downloading files.

 So I'm wondering what is the downside of using this technique, as I  
guess

maybe these API block ?

Thanks any pointers,
Mark.


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting NSTimer to work after an NSThread completes?

2008-10-07 Thread Alex Reynolds

On Oct 7, 2008, at 1:42 AM, Jason Coco wrote:

[[NSRunLoop mainRunLoop] addTimer:myNSTimer  
forMode:NSDefaultRunLoopMode];


Thanks for the quick response. Unfortunately, this did not work. The  
'myNSTimer' never fires.


As a workaround, I tried to update the new view with:

 [NSThread detachNewThreadSelector:@selector(updateView)  
toTarget:self withObject:nil];


but this only works for one subview animation. After that, any  
subsequent detachNewThreadSelector: selector calls never happen.


-Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


[Meeting] Toronto Area Cocoa and WebObjects Developer Group - October 21

2008-10-07 Thread Karl Moskowski
The next meeting of tacow / Cocoaheads Toronto will be held on   
Tuesday, October 21 at 6:30 PM at Ryerson University. Note that this  
meeting is a week later than originally scheduled because of the  
federal election.


More info and directions are available at .

Thanks and see you there.


Karl Moskowski <[EMAIL PROTECTED]>
Voodoo Ergonomics Inc. 



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

defaultCenter's addObserver

2008-10-07 Thread John Love
From MyDocument's windowControllerDidLoadNib I call a method in  
MyController, which in turn calls:


[[NSNotificationCenter defaultCenter] addObserver:self  
selector:@selector(aSelector:) name:aName  
object:anotherControllerObject];


The docs state that this passed object is the object that is  
encapsulated [NSNotification object] in the NSNotification* passed to  
the selector.


This selector has a footprint =
   - (void) aSelector:(NSNotification*)sentNotification;

I pass another Controller, iboAnotherCtrl, as this object:

Later on I call within AnotherController:
   [[NSNotificationCenter defaultCenter] postNotificationName:aName  
object:self];


.. and everything works.


Now here's the sticky .. the docs state that if this encapsulated  
[NSNotification object] = nil, the observer is notified when *any*  
encapsulated object is sent to the selector.


So just for whatever, I pass object:nil to  
addObserver:selector:name:object:.  Then, within my selector I test  
for the type of passed encapsulated object and something(?) doesn't  
work.  My selector gets called for my first new MyDocument.  But when  
I open up a second new MyDocument, the Debugger complains about an  
invalid aSelector.  I don't understand what's going on, so I'm looking  
for help.


Again, everything works just great when I pass a non-nil object to  
defaultCenter's addObserver:selector:name:object:


Thanks in advance,

John Love


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Universal app fails on PPC.

2008-10-07 Thread Sean McBride
On 10/6/08 5:58 PM, Nick Zitzmann said:

>> I'm trying to test my universal app to make sure its really universal.
>> In finder I did "get info" then selected "run with rosetta". When I do
>> that the application traps. The console log says,
>>
>> Exited abnormally: Trace/BPT trap
>>
>> What does that mean? How can I determine why its not working? Is there
>> a way to run it in the debugger using rosetta?
>
>
>Does your app use GC? Rosetta will not launch GC-enabled PPC apps. The
>only way to test those apps is to run them on a real PPC Mac.

David,

The Finder allows you to toggle the "run with rosetta" checkbox in the
Get Info window?  I would file a bug on that, since it can't work with
GC apps.

You can add the following to your Info.plist:

LSRequiresNativeExecution


That should get rid of the checkbox.

--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Negm-Awad Amin


Am Di,07.10.2008 um 15:12 schrieb Frank Illenberger:


Hello Negm-Awad,

thanks for helping.

Nicht dafür!

The idea with the fetch limit and the descending order solves my  
problem as I am using a SQLite store.

Sonst hättest du auch nicht das Problem. ;-)

Liebe Grüße
Amin




Cheers

Frank

On Oct 7, 2008, at 2:59 PM, Negm-Awad Amin wrote:


In contrast to Bill I think, that this is not possible with  
predicates. Why?


You want to get the maximum value of an attribute. Obviously this  
task includes the knowledge of all values stored in that attribute.  
So if Core Data should do that, there are two approaches:


a) Reading all attributes and compare it. This is, what you didn't  
want to do.

b) Delegate this task to the SQL store.

The second one is the solution. But predicates filters the  
attributes. They do not really aggregate them, even there are some  
aggregates available. These aggregates filters the source entity by  
resolving a relationship, but not by aggregating a min or max value.
*If there is a solution using predicates, I'm highly interested in  
it.*


However, there is another solution, that should work:
When you have an entity you can fetch the instances of the entity.  
And you can sort them by using a sort descriptor. And you can set a  
fetch limit. So simply create a fetch request, set the sort  
descriptor's key to the attribute and the sort descriptor's order  
to descending. Set the fetch limit to 1. Executing this fetch will  
lead to the instance with the value for that attribute.


AFAIK this sort descriptors and limits are passed to the sql store.  
So the SQL engine will do that work. (Anyway the SQL engine of  
course has to read every value.)



-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to  
fetch the object of an entity which the maximum of a certain  
property value, but without having to fetch all objects into  
memory?


Cheers

Frank


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems with loose ViewController coupling and KVO to-many relationships

2008-10-07 Thread Jonathan del Strother
On Tue, Sep 30, 2008 at 8:19 PM, Jonathan del Strother
<[EMAIL PROTECTED]> wrote:
> Heya
> I'm struggling a bit with NSViewControllers.  My app displays a list
> of widgets.  I have a Widget model, a WidgetView view (an NSView
> subclass), and a WidgetViewController (an NSViewController subclass).
> All of those have a one-to-one mapping - for any given
> WidgetViewController, it has a representedObject pointing to the
> Widget, and a view pointing to the WidgetView.  The user can
> add/remove/reorder the widgets at any time.
>
> So, there's an array of Widgets, which the window controller observes,
> and whenever that array changes, it creates/deletes
> WidgetViewControllers (and inserts WidgetView subviews) to match.  So
> far so good.
>
> (In fact, if I give the Widget model a strong relationship to the
> WidgetViewController (ie the Widget retains its view controller), it
> works perfectly.  Unfortunately, that totally ignores the nice fluffy
> ideal of MVC separation.)
>
> There's a design flaw here somewhere, but I can't quite figure out
> what it is.  It's highlighted by trying to reorder widgets.  With KVC
> to-many relationships, there's no atomic way of moving an object from
> one position in an array to another : you remove the object, then
> re-insert it at the new location.  But when the object is
> (temporarily) removed from the array, the window controller gets an
> observeValueForKeyPath saying it's been deleted, and so releases the
> corresponding WidgetViewController, the view gets deallocated, and so
> on.  I'll then get a second observeValueForKeyPath saying that an
> object has been inserted, recreate the WidgetViewController, re-insert
> the view, etc etc.
>
> This seems pretty wrong to me.  I can see a few workarounds (perhaps
> storing the kvo notifications until the end of the current runloop so
> I can add them together and figure out what was really a deletion and
> what was just a reordering), but they all seem pretty ugly and
> heavyweight.
>
> How is this usually handled?  How do you managed your view controller
> lifetimes w.r.t. the model lifetime?
>
> Thanks for reading this far, any suggestions would be greatly appreciated
> -Jonathan
>


No takers, then?  Anything I could clarify?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting NSTimer to work after an NSThread completes?

2008-10-07 Thread Michael Ash
On Tue, Oct 7, 2008 at 4:42 AM, Jason Coco <[EMAIL PROTECTED]> wrote:
> Your notification is getting dispatched to the wrong thread. If you can
> target 10.5, do this:
>
> [[NSRunLoop mainRunLoop] addTimer:myNSTimer forMode:NSDefaultRunLoopMode];

Please *don't* do this. NSRunLoop is not thread safe, and so cannot be
used from any thread other than the one it's in charge of. Either use
CFRunLoop instead (CFRunLoop is thread safe, CFRunLoopTimer is
toll-free bridged to NSTimer) or use performSelectorOnMainThread: to
get some code running on the main thread, then add the timer from
there.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: defaultCenter's addObserver

2008-10-07 Thread j o a r


On Oct 7, 2008, at 8:26 AM, John Love wrote:

So just for whatever, I pass object:nil to  
addObserver:selector:name:object:. Then, within my selector I test  
for the type of passed encapsulated object and something(?) doesn't  
work. My selector gets called for my first new MyDocument. But when  
I open up a second new MyDocument, the Debugger complains about an  
invalid aSelector. I don't understand what's going on, so I'm  
looking for help.



Please provide the exact error from the debugger. My guess would be  
that you have some sort of memory management error, or that you didn't  
provide the correct selector (Note that a ":" at the end of a method  
name is significant, and needs to be included in the selector).


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


cross development, missing methods

2008-10-07 Thread Robert Nikander

Hi,

In short, my question is: when cross developing for multiple OS  
versions, how do people deal with Objective-C methods that exist in  
only some of the versions?  Do you have multiple targets compiling  
against different SDKs?


Details...

I'm on 10.5 with Xcode 3.1 and I tried to create a project that will  
run on 10.3-10.5.  I followed the instructions in the "Cross  
Development Programming Guide" and used the 10.5 SDK while setting the  
"Mac OS X Deployment Target" build setting to 10.3.  When I run the  
binary on 10.4, I get errors like this:


-[ABMultiValue valueForIdentifier:]: selector not recognized [self =  
0x15d525c0]


After getting the runtime error, I checked the docs and discovered  
that this method showed up in 10.5.


I was hoping I could get the compiler to warn me about these things.   
Is there a compiler flag that helps?  Or should I forget about the  
"Deployment Target" build setting and create multiple targets or  
projects that use different SDKs?


thanks,
Rob
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Universal app fails on PPC.

2008-10-07 Thread Mark Allan

At 8:08 pm -0400 06/10/2008, David Melgar wrote:
Given that I don't have access to a ppc machine, sounds like I can't 
test if it works.


Given that it's obviously a leopard only application, I'm not sure 
if I should claim support for ppc and have a user complain if it 
doesn't work, or drop the claim of ppc support and make it intel 
only.


As a (quad core) G5 user who will not be cross-grading to Intel any 
time soon, please don't deliberately remove PPC support just because 
you haven't been able to test it...unless of course not being able to 
test it may result in some hideous data loss should a PPC user find a 
bug!


You have a few options.
1) As Clark already said, you could buy a cheap second hand PPC machine.
2) Ask other people to test the app before you release it
3) Make use of the ADC compatibility labs to test it for yourself

Mark

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: cross development, missing methods

2008-10-07 Thread Nick Zitzmann


On Oct 7, 2008, at 10:19 AM, Robert Nikander wrote:

I was hoping I could get the compiler to warn me about these  
things.  Is there a compiler flag that helps?  Or should I forget  
about the "Deployment Target" build setting and create multiple  
targets or projects that use different SDKs?



This is a problem that can be solved by using an older SDK. If you  
want to use methods added to future versions of Mac OS X, then use - 
respondsToSelector: and the -performSelector: methods.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Appropriate use of bindings?

2008-10-07 Thread Karan, Cem (Civ, ARL/CISD)
I'm having a slight dilemma in deciding which I should use, notifications or 
bindings.  Here is the background: 

I have a bunch of C++ code that uses something akin to delegates; you derive 
from a base class, pass that into an instance of a server class, and the server 
class calls the delegate at appropriate times.  I wanted to cleanly encapsulate 
all of this in Objective-C, so that the rest of my code can be pure 
Objective-C, so wrote wrappers for each base class.  Now, I pass the internally 
wrapped C++ instance to the server, while the rest of my code will hook up to 
Objective-C wrapper.

My dilemma is how to do this hookup; I can use either notifications or 
bindings, but I can't decide which is better in this situation.  Bindings seem 
to be simpler to use, but reading about them suggests that you are expected to 
use the MVC design pattern, and I'm not doing MVC here. Notifications are used 
anywhere you want, but require more (and more careful) work to get right.  So, 
are bindings considered general purpose, or should they really be reserved for 
MVC situations (even though they can work anywhere)?

Thanks,
Cem Karan
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: IKImageView and delegate callback/notification of image

2008-10-07 Thread Dave Jewell

On Tue, 7 Oct 2008 at 09:38:01, Jim Turner said:

Binding to my IKImageView's "image" property nets the following:

[ addObserver:
forKeyPath:@"image" options:0x7 context:0x1adc3c30] was sent to an
object that is not KVC-compliant for the "image" property.

Is "image" not the key to which I should be binding?



Hi Jim.  I've also been fooling around with IKImageView and -- if  
nothing else -- I have at least figured out what the delegate does and  
what delegate methods get called under what circumstances.


If this is of any interest, let me know.
Dave


___

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

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

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

This email sent to [EMAIL PROTECTED]


Parsing integers from strings

2008-10-07 Thread Cyrus Najmabadi
I've been unsuccessful finding the right class in cocoa to help me parse
integers inside NSStrings.
I'm looking for something similar to java's Long.parseInt(string, radix).
 i.e. something that can understand a stream of numbers along with a
specified radix (which may be 8, 10 or 16 in my use cases).

What is available to help out here?

Thanks!

   -- Cyrus
___

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

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

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

This email sent to [EMAIL PROTECTED]


Issue with modal window

2008-10-07 Thread Nickolay Knyazev
I have an issue with modal window, which is annoying me for last few days.

I have an IBAction, in which my application starts execution of an
asynchronous operation. This operation executes on a background thread and
has callbacks which are invoked on that thread as well. In a callback I have
to update my progress-bar, so I just invoke performSelectorOnMainThread: (as
far as I know Cocoa UI is not thread safe). In the very last callback (which
is also invoked via performSelectorOnMainThread) I need to notify user about
successfull (or not) completion of that asynchronous operation via an
NSAlert (and it must be modal). I call the NSRunAlertPanel function. And
here is the problem - the window appears as it should be, but this window is
extremely unstable, i.e. when I move the mouse cursor over this window, it
disappears immediately! Pressing any key on the keyboard leads to the same
result. Also, instead of performSelectorOnMainThread, I have tried messaging
main thread with NSPort - same result.

Does anyone know what I am doing wrong?
Any help will be appreciated.

Thanks,
Nickolay Knyazev
___

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

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

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

This email sent to [EMAIL PROTECTED]


Manipulate the NSTextview, several questions...

2008-10-07 Thread Cloud Strife
Hi everyone. I am using the NSTextview to perform some functions of my
application. I want to implement:
1. The NSTextiview has several lines of output, when the user click(or
double-click) one line of the text, I want to the NSTextview to highlight
the line which the user clicked with some light color, i.e. the light blue,
the light green and so on. Then how to?
2. Following the question 1,  I also want to know which line the user select
and hence to get the content of the line. How to?

In order to describe my purpose clearly, assuming we have a nstextview with
content as following:

Line1: Content of Line1;
Line2: Content of LIne2;

When the user click the line 1, the line 1 is highlighted by light-blue
mark.
And I can use some piece of code to know the user has selected line 1, and
retrieve the content of line 1:
"Line1: Content of Line1;"
as a nsstring object.

Can anyone tell me how to accomplish these tasks? Thank you very much for
any help.
Have a good day
-- 
Best regards.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Appropriate use of bindings?

2008-10-07 Thread Shawn Erickson
On Tue, Oct 7, 2008 at 9:31 AM, Karan, Cem (Civ, ARL/CISD)
<[EMAIL PROTECTED]> wrote:

> My dilemma is how to do this hookup; I can use either notifications or 
> bindings, but I can't decide which is better in this situation.  Bindings 
> seem to be simpler to use, but reading about them suggests that you are 
> expected to use the MVC design pattern, and I'm not doing MVC here. 
> Notifications are used anywhere you want, but require more (and more careful) 
> work to get right.  So, are bindings considered general purpose, or should 
> they really be reserved for MVC situations (even though they can work 
> anywhere)?

This is hard to answer in the abstract but in an attempt to color your
thinking...

KVO is about making _properties_ of an object observable. For example
did the name of person object change or the current mode of a I/O
connection object change. It gives you the ability to observe at the
granularity of a property of an object (including a hierarchy of
object using key-paths).

Additionally once you support KVO then you can leverage the controller
layer (bindings) to wire up UI, etc. directly to properties of your
objects (including a hierarchy of object using key-paths).

Notifications are a generic decoupled notification system that allows
observers to listen for specific notifications (by name) possibly from
specific objects, etc. These typically are more about something
happening and less about a property of an object changing (however the
later can be considered a special case of the former).

You get "better" granularity for "free" with KVO but with a cost of
having one funnel point
(observeValueForKeyPath:ofObject:change:context:) into the observer
unless you decide to use KVB (bindings) to bind a property of the
observed object to a property of observing object. Also support for
key paths and dependent keys can be a win depending on what you need.

You get "better" arbitrary notification ability using notifications
and the ability to coalesce, etc. if you utilize your own notification
queues. Also you get to specify the entry point (selector) into your
observer when can result in cleaner code.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread Randall Meadows

On Oct 6, 2008, at 11:08 PM, Cyrus Najmabadi wrote:

I've been unsuccessful finding the right class in cocoa to help me  
parse

integers inside NSStrings.
I'm looking for something similar to java's Long.parseInt(string,  
radix).

i.e. something that can understand a stream of numbers along with a
specified radix (which may be 8, 10 or 16 in my use cases).

What is available to help out here?


I think you'd want NSScanner.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Appropriate use of bindings?

2008-10-07 Thread Shawn Erickson
On Tue, Oct 7, 2008 at 10:44 AM, Shawn Erickson <[EMAIL PROTECTED]> wrote:
> On Tue, Oct 7, 2008 at 9:31 AM, Karan, Cem (Civ, ARL/CISD)
> <[EMAIL PROTECTED]> wrote:
>
>> My dilemma is how to do this hookup; I can use either notifications or 
>> bindings, but I can't decide which is better in this situation.  Bindings 
>> seem to be simpler to use, but reading about them suggests that you are 
>> expected to use the MVC design pattern, and I'm not doing MVC here. 
>> Notifications are used anywhere you want, but require more (and more 
>> careful) work to get right.  So, are bindings considered general purpose, or 
>> should they really be reserved for MVC situations (even though they can work 
>> anywhere)?
>
> This is hard to answer in the abstract but in an attempt to color your
> thinking...

I should note that using neither KVO or notification is also an
option... You could have your "bridging" objects support the concept
of a delegate or delegates (in this case think listener). Then objects
that want "notifications" from one of your bridge objects add
themselves as a delegate of that object. It would then implement the
informal protocol methods (delegate methods) that it cares about so it
will be messaged when the bridge detects things have changed (but only
for the subset of things they happen to care about).

This is a more direct coupling which can be good or bad depending on
what you are doing...

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread Jean-Daniel Dupas


Le 7 oct. 08 à 07:08, Cyrus Najmabadi a écrit :

I've been unsuccessful finding the right class in cocoa to help me  
parse

integers inside NSStrings.
I'm looking for something similar to java's Long.parseInt(string,  
radix).

i.e. something that can understand a stream of numbers along with a
specified radix (which may be 8, 10 or 16 in my use cases).

What is available to help out here?

Thanks!

  -- Cyrus


For base 10, -[NSString integerValue] will do the trick, for other  
bases, you can either use NSScanner, or just fall back to libc function:


strtol([myString UTF8String], NULL, 16);

I don't remember if -UTF8String may returns NULL. If this is the case,  
you should test the value before passing it to strtol.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread James Walker

Negm-Awad Amin wrote:


Am Di,07.10.2008 um 04:56 schrieb James Walker:


[…]
How do you know the window isn't being deallocated? Examining 
retain counts is not going to tell you whether it is or not. The 
only way would be to subclass it and log the -dealloc method.


That's exactly what I did.  The dealloc method was not getting 
called before I added the workaround.  Well, the initial symptom was 
that I got an access violation because a custom view was asked to 
draw after the window had been closed and the window controller had 
been destroyed.  In the course of debugging that, I subclassed the 
window.
I'd suggest it would be more fruitful to chase down the actual bug 
rather than one that appears to be related but might be just a red 
herring.
If a view is being asked to draw but its window has gone away, then 
something's very, very off somewhere. Normally views are drawn by 
their windows, so how can such a situation arise? If you can answer 
that question you've probably found the problem. Is some other object 
retaining the view? Why? Are you drawing outside the usual update 
event cycle mechanism? Why?


When I said "the window has gone away", I spoke imprecisely.  I meant 
the window had been closed.  But, as I said, it had not been deallocated.

To clarify:
The window is closed (still allocated) and you get a draw request?


More precisely, the window's delegate had received the windowWillClose: 
notification and later there is a draw request.


I think the important thing is that the window was not getting 
deallocated.  After more experimentation, this seems to be another 
symptom of the same basic problem as in my previous NSWindowController 
thread, which is that a Carbon app using WaitNextEvent still needs to 
set up and release its own autorelease pools each time through the event 
loop.  When I do that, the problem goes away.  And unlike my previous 
workarounds, this doesn't make me feel like I'm doing voodoo.


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


Re: Appropriate use of bindings?

2008-10-07 Thread Citizen
The following article discusses five different approaches to the  
Observer Pattern in Cocoa, it may be of some use:

http://cocoawithlove.com/2008/06/five-approaches-to-listening-observing.html

- Dave

On 7 Oct 2008, at 17:31, Karan, Cem (Civ, ARL/CISD) wrote:

I'm having a slight dilemma in deciding which I should use,  
notifications or bindings.  Here is the background:


I have a bunch of C++ code that uses something akin to delegates;  
you derive from a base class, pass that into an instance of a server  
class, and the server class calls the delegate at appropriate  
times.  I wanted to cleanly encapsulate all of this in Objective-C,  
so that the rest of my code can be pure Objective-C, so wrote  
wrappers for each base class.  Now, I pass the internally wrapped C+ 
+ instance to the server, while the rest of my code will hook up to  
Objective-C wrapper.


My dilemma is how to do this hookup; I can use either notifications  
or bindings, but I can't decide which is better in this situation.   
Bindings seem to be simpler to use, but reading about them suggests  
that you are expected to use the MVC design pattern, and I'm not  
doing MVC here. Notifications are used anywhere you want, but  
require more (and more careful) work to get right.  So, are bindings  
considered general purpose, or should they really be reserved for  
MVC situations (even though they can work anywhere)?


--
David Kennedy (http://www.zenopolis.com)



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread Shawn Erickson
On Tue, Oct 7, 2008 at 11:05 AM, James Walker <[EMAIL PROTECTED]> wrote:

> I think the important thing is that the window was not getting deallocated.
>  After more experimentation, this seems to be another symptom of the same
> basic problem as in my previous NSWindowController thread, which is that a
> Carbon app using WaitNextEvent still needs to set up and release its own
> autorelease pools each time through the event loop.  When I do that, the
> problem goes away.  And unlike my previous workarounds, this doesn't make me
> feel like I'm doing voodoo.

Have you looked at the console log or run log if running from Xcode
for messages like the following?

*** _NSAutoreleaseNoPool(): Object  of class
 autoreleased with no pool in place - just leaking

Of course you may not be seeing those if you have a top level
auto-release pool setup, say in your main entry point, that simply
exists for the life of the application. If you do have such a top
level auto-release pool that exists for the life of the application
consider knocking it out (at least temporarily) to help you detect
code pathways that are using Cocoa API yet they are not correctly
managing an auto-release pool.

Note the event loop in a NSApplication based application with do such
management for you, at least on the main thread (aka which is running
the even loop, aka main runloop).

(of course I do wonder why you are still using Carbon event
management, it really is time to be switching off of that)

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Appropriate use of bindings?

2008-10-07 Thread Karan, Cem (Civ, ARL/CISD)
> --
> 
> Message: 16
> Date: Tue, 7 Oct 2008 19:19:27 +0100
> From: Citizen <[EMAIL PROTECTED]>
> Subject: Re: Appropriate use of bindings?
> To: Cocoa List 
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
> 
> The following article discusses five different approaches to the  
> Observer Pattern in Cocoa, it may be of some use:
> http://cocoawithlove.com/2008/06/five-approaches-to-listening-
> observing.html

Thanks... it still doesn't solve my problem as I have bits that can fit
into each of the categories, and all from the same object... I guess
I'll just go with notifications, they've got enough flexibility that I
can change things around however I need, should I need to.

Thanks,
Cem Karan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread James Walker

Shawn Erickson wrote:

On Tue, Oct 7, 2008 at 11:05 AM, James Walker <[EMAIL PROTECTED]> wrote:


I think the important thing is that the window was not getting deallocated.
 After more experimentation, this seems to be another symptom of the same
basic problem as in my previous NSWindowController thread, which is that a
Carbon app using WaitNextEvent still needs to set up and release its own
autorelease pools each time through the event loop.  When I do that, the
problem goes away.  And unlike my previous workarounds, this doesn't make me
feel like I'm doing voodoo.


Have you looked at the console log or run log if running from Xcode
for messages like the following?

*** _NSAutoreleaseNoPool(): Object  of class
 autoreleased with no pool in place - just leaking


No, there is no such message.


Of course you may not be seeing those if you have a top level
auto-release pool setup, say in your main entry point, that simply
exists for the life of the application. If you do have such a top
level auto-release pool that exists for the life of the application
consider knocking it out (at least temporarily) to help you detect
code pathways that are using Cocoa API yet they are not correctly
managing an auto-release pool.


No, I don't have such a top-level autorelease pool, and I don't know why 
anyone would.



Note the event loop in a NSApplication based application with do such
management for you, at least on the main thread (aka which is running
the even loop, aka main runloop).


I know.


(of course I do wonder why you are still using Carbon event
management, it really is time to be switching off of that)


Because I still have a bunch of PowerPlant windows, and changing the 
event management seemed riskier than not doing so.


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


Next Key View doesn't "go to" pushbutton

2008-10-07 Thread John Velman

I've got a number of text boxes to be filled in by the user.  Tab order
works fine using next key view in IB.  After filing the last box, I'd like
the user to be able to tab to a "commit" button, but next key view doesn't
go there, even though the IB heads up boxes and inspector panes show that
it does.

Ideally, tabbing to the Commit button would bring it into focus, light its
focus ring, and the allow the user to press "enter" (or "return" :-). to
commit the data.  Then the next key view would recycle to the first in the
sequence of text fields.  

Seems that this should be possible to set up in IB, but  dogon if I'm
seein' a way to do it (been watching too much campaign TV lately).

Related question:  How can I (again in IB) set it so the return key follows
the next key view sequence as well as tab key does?

Neither Hillgass nor Anderson seem to cover these (I admit I read
impatiently and rely on the index a lot), and the Apple documentation (and
various archives) are so extensive I haven't been able to hit exactly the
key words to get to the answers.

Best,

John Velman
___

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

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

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

This email sent to [EMAIL PROTECTED]


File's owner as target of button-action

2008-10-07 Thread Andreas Eriksson
I have a nib-file with the File's Owner class set to my own subclass of
NSViewController. The nib-file also contains a custom view with a button whose
target and action is set to a method in File's Owner.

The trouble is that I get EXC_BAD_ACCESS when I click the button and it tries
to call my action method.

I guess I have misunderstood something here. Is there something special about
File's Owner that prevents this from working?

Regards,

Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread Cyrus Najmabadi
Unfortunately, NSScanner seems insufficient.
It doesn't seem able to handle 64bit hexadecimal numbers.  Also, i don't see
any facility for octal numbers.

 -- Cyrus

On Tue, Oct 7, 2008 at 1:50 PM, Randall Meadows <[EMAIL PROTECTED]>wrote:

> On Oct 6, 2008, at 11:08 PM, Cyrus Najmabadi wrote:
>
>  I've been unsuccessful finding the right class in cocoa to help me parse
>> integers inside NSStrings.
>> I'm looking for something similar to java's Long.parseInt(string, radix).
>> i.e. something that can understand a stream of numbers along with a
>> specified radix (which may be 8, 10 or 16 in my use cases).
>>
>> What is available to help out here?
>>
>
> I think you'd want NSScanner.
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread Shawn Erickson
On Tue, Oct 7, 2008 at 11:42 AM, James Walker <[EMAIL PROTECTED]> wrote:
> Shawn Erickson wrote:
>>
>> On Tue, Oct 7, 2008 at 11:05 AM, James Walker <[EMAIL PROTECTED]>
>> wrote:
>>
>>> I think the important thing is that the window was not getting
>>> deallocated.
>>>  After more experimentation, this seems to be another symptom of the same
>>> basic problem as in my previous NSWindowController thread, which is that
>>> a
>>> Carbon app using WaitNextEvent still needs to set up and release its own
>>> autorelease pools each time through the event loop.  When I do that, the
>>> problem goes away.  And unlike my previous workarounds, this doesn't make
>>> me
>>> feel like I'm doing voodoo.
>>
>> Have you looked at the console log or run log if running from Xcode
>> for messages like the following?
>>
>> *** _NSAutoreleaseNoPool(): Object  of class
>>  autoreleased with no pool in place - just leaking
>
> No, there is no such message.
>
>> Of course you may not be seeing those if you have a top level
>> auto-release pool setup, say in your main entry point, that simply
>> exists for the life of the application. If you do have such a top
>> level auto-release pool that exists for the life of the application
>> consider knocking it out (at least temporarily) to help you detect
>> code pathways that are using Cocoa API yet they are not correctly
>> managing an auto-release pool.
>
> No, I don't have such a top-level autorelease pool, and I don't know why
> anyone would.

Based on what you are describing it sure sounds like some long lived
auto-release pool exists that is collecting objects to release yet
isn't being draining in a timely fashion.

>> (of course I do wonder why you are still using Carbon event
>> management, it really is time to be switching off of that)
>
> Because I still have a bunch of PowerPlant windows, and changing the event
> management seemed riskier than not doing so.

Not knowing your target market or time line for your this project...
but the future is fairly quickly approaching and that future has
limited support for Carbon based UI (at least in one branch of the
world). You may want to pay the price sooner rather then later.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting the values from the selected row of a table?

2008-10-07 Thread John Velman
I need to get the value of the primary key (shown in the table) of the
selected row of my table, no matter how the table is sorted interactively.

I'm able to get the selected row index, but this seems to give the
"geographic" index of the selected row in the table, as sorted.

So far, I've solved my problem by ensuring that the table source is sorted
by it's primary key, and blocking sorting in the table itself.  This is not
too bad  for my application (in it's current state, at least),  but
eventually I'd like to be able to sort the table interactively and map the
selection back to the original data.

I'm using IB and key value binding, and registering a notification to get
the fact of selection did change.


Thanks,

John Velman
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread Nick Zitzmann


On Oct 7, 2008, at 12:49 PM, Cyrus Najmabadi wrote:


Unfortunately, NSScanner seems insufficient.
It doesn't seem able to handle 64bit hexadecimal numbers.  Also, i  
don't see

any facility for octal numbers.



For 64-bit hex numbers, as well as octal numbers, you can use  
strtoll(). See its man page for details.


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: File's owner as target of button-action

2008-10-07 Thread I. Savant

On Oct 7, 2008, at 2:34 PM, Andreas Eriksson wrote:

I guess I have misunderstood something here. Is there something  
special about

File's Owner that prevents this from working?


  There's not enough information here to answer your question. You  
should post:


1 - How you instantiate your custom NSViewController class and load  
the nib.

2 - The code listing for the method in question.
3 - Where, exactly, the EXC_BAD_ACCESS is encountered.

--
I.S.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Next Key View doesn't "go to" pushbutton

2008-10-07 Thread Jeff Johnson

John,

In System Preferences, Keyboard & Mouse, Keyboard Shortcuts, is Full  
keyboard access set to All controls?


-Jeff


On Oct 7, 2008, at 1:47 PM, John Velman wrote:

I've got a number of text boxes to be filled in by the user.  Tab  
order
works fine using next key view in IB.  After filing the last box,  
I'd like
the user to be able to tab to a "commit" button, but next key view  
doesn't
go there, even though the IB heads up boxes and inspector panes  
show that

it does.

Ideally, tabbing to the Commit button would bring it into focus,  
light its
focus ring, and the allow the user to press "enter" (or  
"return" :-). to
commit the data.  Then the next key view would recycle to the first  
in the

sequence of text fields.

Seems that this should be possible to set up in IB, but  dogon if I'm
seein' a way to do it (been watching too much campaign TV lately).

Related question:  How can I (again in IB) set it so the return key  
follows

the next key view sequence as well as tab key does?

Neither Hillgass nor Anderson seem to cover these (I admit I read
impatiently and rely on the index a lot), and the Apple  
documentation (and
various archives) are so extensive I haven't been able to hit  
exactly the

key words to get to the answers.

Best,

John Velman



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: File's owner as target of button-action

2008-10-07 Thread Andreas Eriksson
>> I guess I have misunderstood something here. Is there something special
>> about
>> File's Owner that prevents this from working?
>
>  There's not enough information here to answer your question. You should
> post:
>
> 1 - How you instantiate your custom NSViewController class and load the nib.
> 2 - The code listing for the method in question.
> 3 - Where, exactly, the EXC_BAD_ACCESS is encountered.

My bad. I had managed to release the NSViewController (File's Owner). Thanks!

Regards

Andreas
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting the values from the selected row of a table?

2008-10-07 Thread I. Savant

On Oct 7, 2008, at 2:55 PM, John Velman wrote:


I'm able to get the selected row index, but this seems to give the
"geographic" index of the selected row in the table, as sorted.


  Why don't you get the selected object from your array controller  
directly, then ask it for the value of its primary key attribute?


  Otherwise, if you want (or for some reason need) to look it up by  
its selected row, you're most likely asking your array controller for  
its array, right? Ask it for its -arrangedObjects, *then* determine  
the index of that object.


  Overall, though, it sounds like you're not quite getting Bindings  
(particularly the controller layer's role in Bindings) and could  
probably benefit from another perusal of the documentation (or a few  
well-chosen questions here).


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSWindowController retain counts, chapter 2

2008-10-07 Thread James Walker

Shawn Erickson wrote:


Based on what you are describing it sure sounds like some long lived
auto-release pool exists that is collecting objects to release yet
isn't being draining in a timely fashion.



Maybe so, but if so it's created by the OS, not me.  I've done a global 
search of my code for NSAutoreleasePool.




(of course I do wonder why you are still using Carbon event
management, it really is time to be switching off of that)

Because I still have a bunch of PowerPlant windows, and changing the event
management seemed riskier than not doing so.


Not knowing your target market or time line for your this project...
but the future is fairly quickly approaching and that future has
limited support for Carbon based UI (at least in one branch of the
world). You may want to pay the price sooner rather then later.



All I can say is, right now I can't spend months doing work with little 
discernible benefit to the user.


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


Re: Next Key View doesn't "go to" pushbutton

2008-10-07 Thread Randy Bradley
You could override the controlTextDidEndEditing method:


- (void)controlTextDidEndEditing:(NSNotification *)aNotification{
...
if([[[aNotification userInfo] valueForKey:@"NSTextMovement"] intValue]
 == NSReturnTextMovement) {
//  invoke whatever button pressed code.
}
}

This can be advantageous if you allow empty fields.  The user can use the
enter key while the cursor is in any field instead of tabbing all the way to
the button.

You can also check for "NSTabTextMovement" or "NSBacktabTextMovement" if you
want to do any processing between fields.



On 10/07/08 2:02 PM, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:

> Next Key View doesn't "go to" pushbutton


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread mmalc crawford


On Oct 7, 2008, at 11:49 AM, Cyrus Najmabadi wrote:


Unfortunately, NSScanner seems insufficient.
It doesn't seem able to handle 64bit hexadecimal numbers.


From NSScanner.h, on Mac OS X v10.5 and later:
- (BOOL)scanHexLongLong:(unsigned long long *)result;
- (BOOL)scanHexFloat:(float *)result;		// Corresponding to %a or %A  
formatting. Requires "0x" or "0X" prefix.
- (BOOL)scanHexDouble:(double *)result;		// Corresponding to %a or %A  
formatting. Requires "0x" or "0X" prefix.


(On this occasion, please don't file a bug about the omission of these  
methods from the documentation...)


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


Re: Parsing integers from strings

2008-10-07 Thread Cyrus Najmabadi
"(On this occasion, please don't file a bug about the omission of these
methods from the documentation...)"
Why not?  (or is it something that you're already doing.  if so, thanks!)

 -- Cyrus

On Tue, Oct 7, 2008 at 3:49 PM, mmalc crawford <[EMAIL PROTECTED]> wrote:

>
> On Oct 7, 2008, at 11:49 AM, Cyrus Najmabadi wrote:
>
>  Unfortunately, NSScanner seems insufficient.
>> It doesn't seem able to handle 64bit hexadecimal numbers.
>>
>>  From NSScanner.h, on Mac OS X v10.5 and later:
> - (BOOL)scanHexLongLong:(unsigned long long *)result;
> - (BOOL)scanHexFloat:(float *)result;   // Corresponding to %a or
> %A formatting. Requires "0x" or "0X" prefix.
> - (BOOL)scanHexDouble:(double *)result; // Corresponding to %a or
> %A formatting. Requires "0x" or "0X" prefix.
>
> (On this occasion, please don't file a bug about the omission of these
> methods from the documentation...)
>
> 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 [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread mmalc crawford


On Oct 7, 2008, at 12:59 PM, Cyrus Najmabadi wrote:

Why not?  (or is it something that you're already doing.  if so,  
thanks!)



Already done.

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


Re: Next Key View doesn't "go to" pushbutton

2008-10-07 Thread John Velman
On Tue, Oct 07, 2008 at 02:09:05PM -0500, Jeff Johnson wrote:
> John,
>
> In System Preferences, Keyboard & Mouse, Keyboard Shortcuts, is Full 
> keyboard access set to All controls?
>
> -Jeff


Blush.   Fixing the  Next key view sequence was simple.  I'm not only new to
Cocoa, new to Mac as well.  (And very happy with both, as well as the
helpful people on this list.)

Thanks,

John V.


>
>
> On Oct 7, 2008, at 1:47 PM, John Velman wrote:
>
>> I've got a number of text boxes to be filled in by the user.  Tab order
>> works fine using next key view in IB.  After filing the last box, I'd like
>> the user to be able to tab to a "commit" button, but next key view doesn't
>> go there, even though the IB heads up boxes and inspector panes show that
>> it does.
>>
>> Ideally, tabbing to the Commit button would bring it into focus, light its
>> focus ring, and the allow the user to press "enter" (or "return" :-). to
>> commit the data.  Then the next key view would recycle to the first in the
>> sequence of text fields.
>>
>> Seems that this should be possible to set up in IB, but  dogon if I'm
>> seein' a way to do it (been watching too much campaign TV lately).
>>
>> Related question:  How can I (again in IB) set it so the return key 
>> follows
>> the next key view sequence as well as tab key does?
>>
>> Neither Hillgass nor Anderson seem to cover these (I admit I read
>> impatiently and rely on the index a lot), and the Apple documentation (and
>> various archives) are so extensive I haven't been able to hit exactly the
>> key words to get to the answers.
>>
>> Best,
>>
>> John Velman
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Parsing integers from strings

2008-10-07 Thread Cyrus Najmabadi
Thanks much!
   -- Cyrus

On Tue, Oct 7, 2008 at 4:07 PM, mmalc crawford <[EMAIL PROTECTED]> wrote:

>
> On Oct 7, 2008, at 12:59 PM, Cyrus Najmabadi wrote:
>
>  Why not?  (or is it something that you're already doing.  if so, thanks!)
>>
>>  Already done.
>
> 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 [EMAIL PROTECTED]


Re: Getting the values from the selected row of a table?

2008-10-07 Thread John Velman
Well, you're undoubtedly right that I'm "not quite getting bindings" yet,
but I'm a lot closer than I was.  I'll ponder what you've suggested and see
whether I "get it" or can come up with some better questions!

Thanks,

John V.

On Tue, Oct 07, 2008 at 03:10:27PM -0400, I. Savant wrote:
> On Oct 7, 2008, at 2:55 PM, John Velman wrote:
>
>> I'm able to get the selected row index, but this seems to give the
>> "geographic" index of the selected row in the table, as sorted.
>
>   Why don't you get the selected object from your array controller 
> directly, then ask it for the value of its primary key attribute?
>
>   Otherwise, if you want (or for some reason need) to look it up by its 
> selected row, you're most likely asking your array controller for its 
> array, right? Ask it for its -arrangedObjects, *then* determine the index 
> of that object.
>
>   Overall, though, it sounds like you're not quite getting Bindings 
> (particularly the controller layer's role in Bindings) and could probably 
> benefit from another perusal of the documentation (or a few well-chosen 
> questions here).
>
> --
> I.S.
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Cocoaheads Lake Forest (92630) meeting 10/8/2008 at 7 pm on "Parallel Processing with a Core Data Store"

2008-10-07 Thread Scott Ellsworth
Hello, all,

CocoaHeads Lake Forest will be meeting on the second Wednesday in
October, 10/8, from 7 to 9 PM.  We will meet in our usual location at
the Orange County Public Library (El Toro) community room, 24672
Raymond Way, Lake Forest, CA 92630.  The A/C has been fixed, and there
is much rejoicing.

James Gregurich will be speaking on parallel processing with a Core Data store.

This will cover some of the basics of Core Data, such as setting up a
simple schema and displaying it in a table view, as well as how to
load data in multiple threads.

Bring your comments, your books, and your bugs, and we will leap right in.

As always, details can be found on the cocoaheads web site at
www.cocoaheads.org.

Thanks go to O'Reilly Media for providing us one of their books as a door prize.

Note: if you receive this directly from me, and no longer wish to,
please reply offlist, and I will pull you from future mailings.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Trouble with NSSplitView

2008-10-07 Thread Andre Masse

Hi,

I have set up in IB a window with 3 split views. The main split view  
(with a vertical divider) contains 2 splits (horizontal divider):


**
* *  3   *
*  1  
* *  *
* *  *
***  4   *
* *  *
*  2  *  *
**

I'm using an NSViewController subclass (with an associated nib) for  
each of the views. In the - windowDidLoad: method of my  
NSWindowController subclass, I set dividers positions and add each  
view, resizing it according to the size available in each pane. I'm  
testing this interface so all views contain dummy controls:


1- has only buttons
2- has only a Date picker in calendar form
3- has a multiline text view (with scroller) and 2 buttons.
4- has a NSTableView


At launch, everything is good and I've no problem changing the  
splitter's position between pane 1 and 2 or with the vertical divider.  
Now, if I change the splitter's position between pane 3 and 4 all the  
way up or down and back, the header of the NSTableView and the top of  
the text view, become hidden (under the divider). I've tried many  
combinations of resize/lock for these views in IB, played various  
constants with -setAutoresizingMask:. No luck. Either I'm missing the  
good one, or I'm in the wrong track. This is driving me nuts, any  
advice on getting the good combination?


Thanks,

Andre Masse

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: defaultCenter's addObserver

2008-10-07 Thread j o a r


On Oct 7, 2008, at 12:03 PM, John Love wrote:

2008-10-07 14:36:14.149 Calculate Medical[265:10b] *** -[NSCFSet  
calcStatusChanged:]: unrecognized selector sent to instance 0xe41f250



John,

This type of error message indicates that your notification observer  
has been deallocated. This would probably be because you forgot that  
you have to remove notification observers before they are deallocated.  
In many cases you would put your unsubscribe statement in your dealloc  
method.


It could also indicate any other type of memory management error.  
NSZobieEnabled is the general facility for troubleshooting that type  
of problem, but in this case you could probably do with simple code  
inspection.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Wasted Space and Kernighan

2008-10-07 Thread Colin Barrett
On Tue, Oct 7, 2008 at 7:30 AM, Bill Mutch <[EMAIL PROTECTED]> wrote:
> Even a general conclusion is not valid unless by 'clever' he means
> intentionally obtuse.

I'm willing to give bwk the benefit of the doubt. I assumed he was
giving a warning against cleverness for cleverness's sake, which is
quite a bit different than just coming up with an intelligent
solution.

-Colin
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Manipulate the NSTextview, several questions...

2008-10-07 Thread Graham Cox


On 7 Oct 2008, at 6:50 pm, Cloud Strife wrote:


Hi everyone. I am using the NSTextview to perform some functions of my
application. I want to implement:
1. The NSTextiview has several lines of output, when the user click(or
double-click) one line of the text, I want to the NSTextview to  
highlight
the line which the user clicked with some light color, i.e. the  
light blue,

the light green and so on. Then how to?
2. Following the question 1,  I also want to know which line the  
user select

and hence to get the content of the line. How to?

In order to describe my purpose clearly, assuming we have a  
nstextview with

content as following:

Line1: Content of Line1;
Line2: Content of LIne2;


OK, first problem - define "line". Since NSTextView will word-wrap  
text into as many lines as necessary there may not be a distinct line  
that you can select like that.


If you can define a line to mean "the characters between CRs and/or  
start and end of the text" then NSTextView might be made to play.


When the user click the line 1, the line 1 is highlighted by light- 
blue

mark.
And I can use some piece of code to know the user has selected line  
1, and

retrieve the content of line 1:
"Line1: Content of Line1;"
as a nsstring object.

Can anyone tell me how to accomplish these tasks? Thank you very  
much for

any help.
Have a good day



You might be better off trying to accomplish this using NSTableView.  
Store each line in an array and use a table view to display each one.  
Then selecting a single distinct line is straightforward as you  
already have each one stored separately. Unless you're talking about  
pages and pages of text, a table view will be efficient enough for this.


hth,


Graham

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting the values from the selected row of a table?

2008-10-07 Thread Graham Cox


On 8 Oct 2008, at 5:55 am, John Velman wrote:


I'm able to get the selected row index, but this seems to give the
"geographic" index of the selected row in the table, as sorted.



Because a table is a view, the selection is purely "geographic", since  
the table's job is to map an item of data to a location on screen.


So far, I've solved my problem by ensuring that the table source is  
sorted
by it's primary key, and blocking sorting in the table itself.  This  
is not

too bad  for my application (in it's current state, at least),  but
eventually I'd like to be able to sort the table interactively and  
map the

selection back to the original data.


When the table is sorted, its delegate is notified to actually perform  
the sort of the data. Just make a note of which item(s) are selected,  
perform the sort, then update the selection to the new positions of  
the existing selected items.


Remember that the table view itself is not part of your data model. It  
shows exactly what you want it to show - if its concept of "selection"  
is not appropriate for your data model, then maintain the selection in  
the data model and drive the table view to match.


hth,


Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


How can I access full source of a WebView

2008-10-07 Thread Ömer Kardaş

Hi

I am trying to send the contents of a webwiew with email. I have found  
several ways to do that, but there are minor problems.


//  get the attributes string of the webview
	id res = (id  )[[[myWebView mainFrame] frameView]  
documentView];

NSAttributedString *p = [res attributedString];
NSPasteboard *pb = [NSPasteboard pasteboardWithName:@"PBtoMail"];

//	init a private pastebord for data transfer, this time use  
webarchive for transfer
	[pb declareTypes:[NSArray arrayWithObject:NSRTFDPboardType]  
owner:self];


//	convert the attributed string to rtfd and place it on the private  
pasteboard

NSRange range;
range.location = 0;
range.length = [p length];
	[pb setData:(NSData *)[p RTFDFromRange:range documentAttributes:nil  
forType:NSRTFDPboardType];


//  open mail window using the rtfd data using services...
NSPerformService(@"Mail/Send Selection", pb);

This works, but quality is no so good. So I tried a different approach

//	init a private pastebord for data transfer, this time use  
webarchive for transfer

NSPasteboard *pb = [NSPasteboard pasteboardWithName:@"PBtoMail"];
	[pb declareTypes:[NSArray arrayWithObject:WebArchivePboardType]  
owner:self];


//  get the webarchive and place it on pboard
	[pb setData:[[[myWebView mainFrameDocument] webArchive] data]  
forType:WebArchivePboardType];


NSPerformService(@"Mail/Send Selection", pb);

This works better. However external CSS code is not copied, which  
makes the page look different. When I select all and copy from the  
webview manualy and then paste it on a new mail window it works fine,  
the external CSS is copied as well. Is there any way I get the full  
source (including the external CSS) so that I can place it on the  
pasteboard?


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


Re: How can I access full source of a WebView

2008-10-07 Thread Rob Keniger


On 08/10/2008, at 8:45 AM, Ömer Kardaş wrote:

This works better. However external CSS code is not copied, which  
makes the page look different. When I select all and copy from the  
webview manualy and then paste it on a new mail window it works  
fine, the external CSS is copied as well. Is there any way I get the  
full source (including the external CSS) so that I can place it on  
the pasteboard?



In order to get the source of a WebView you'd do something like this:

DOMHTMLElement* el=(DOMHTMLElement*)[self  
mainFrameDocument].documentElement;

NSString* source=el.outerHTML;

However, external CSS files are not part of the source of the page so  
no method of obtaining just the source code will do this for you.
I suspect what is happening when you copy and paste into Mail is that  
the WebView is placing a web archive on the clipboard, which contains  
all the images and other linked resources.


You can get a web archive like this:

[[[webView mainFrame] dataSource] webArchive];

When copying to the clipboard you can specify the type as  
WebArchivePboardType.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with NSSplitView

2008-10-07 Thread Dave Fernandes
I had the same problem. The fix was to recreate the view in IB. Seems  
to be a bug in IB, but I never tried to repeat the problem once it  
was fixed.


Dave

On Oct 7, 2008, at 5:41 PM, Andre Masse wrote:


Hi,

I have set up in IB a window with 3 split views. The main split  
view (with a vertical divider) contains 2 splits (horizontal divider):


**
* *  3   *
*  1  
* *  *
* *  *
***  4   *
* *  *
*  2  *  *
**

I'm using an NSViewController subclass (with an associated nib) for  
each of the views. In the - windowDidLoad: method of my  
NSWindowController subclass, I set dividers positions and add each  
view, resizing it according to the size available in each pane. I'm  
testing this interface so all views contain dummy controls:


1- has only buttons
2- has only a Date picker in calendar form
3- has a multiline text view (with scroller) and 2 buttons.
4- has a NSTableView


At launch, everything is good and I've no problem changing the  
splitter's position between pane 1 and 2 or with the vertical  
divider. Now, if I change the splitter's position between pane 3  
and 4 all the way up or down and back, the header of the  
NSTableView and the top of the text view, become hidden (under the  
divider). I've tried many combinations of resize/lock for these  
views in IB, played various constants with -setAutoresizingMask:.  
No luck. Either I'm missing the good one, or I'm in the wrong  
track. This is driving me nuts, any advice on getting the good  
combination?


Thanks,

Andre Masse

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes% 
40utoronto.ca


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How can I access full source of a WebView

2008-10-07 Thread Ömer Kardaş

Thanks Rob,

I tried your way (DOMHTMLElement* el...) and it gave me the source.  
Unfortunatly it gives only source and does not include external files.


I already tried your second approach.
[pb setData:[[[myWebView mainFrameDocument] webArchive] data]  
forType:WebArchivePboardType];


I just found something intereting. I was wrong to think that the  
external CSS is not copied in this way. I saved the Pasteboard as  
webarchive, opened it from Safari, and looked at the source. CSS was  
not there. On the contrary, webarchive produced by manual copy had the  
CSS code. But then, I opened the webarhives as TEXT (using  
subethaedit). The CSS code was PRESENT in BOTH of the WebArchive  
files. Somehow Safari can not see the one produced by the above code.


Any other suggestions?

On Oct 8, 2008, at 2:13 AM, Rob Keniger wrote:



On 08/10/2008, at 8:45 AM, Ömer Kardaş wrote:

This works better. However external CSS code is not copied, which  
makes the page look different. When I select all and copy from the  
webview manualy and then paste it on a new mail window it works  
fine, the external CSS is copied as well. Is there any way I get  
the full source (including the external CSS) so that I can place it  
on the pasteboard?



In order to get the source of a WebView you'd do something like this:

DOMHTMLElement* el=(DOMHTMLElement*)[self  
mainFrameDocument].documentElement;

NSString* source=el.outerHTML;

However, external CSS files are not part of the source of the page  
so no method of obtaining just the source code will do this for you.
I suspect what is happening when you copy and paste into Mail is  
that the WebView is placing a web archive on the clipboard, which  
contains all the images and other linked resources.


You can get a web archive like this:

[[[webView mainFrame] dataSource] webArchive];

When copying to the clipboard you can specify the type as  
WebArchivePboardType.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with NSSplitView

2008-10-07 Thread Andre Masse
Tried your suggestion and it worked... almost. I now have trouble with  
the buttons under the text view. If I bring the divider all the way  
up, I need to bring the divider farther than it was to display the  
buttons. For example, if the divider was at 200 pixels from the top  
before "closing" it, I need to bring it down at 400 for the buttons to  
show up. I have no idea what's going on here... I'm surely doing  
something bad cause this kind of interface is pretty common on the  
Mac...


Thanks for your suggestion though, it solved a good part of my problem,

Andre Masse


On Oct 7, 2008, at 19:44, Dave Fernandes wrote:

I had the same problem. The fix was to recreate the view in IB.  
Seems to be a bug in IB, but I never tried to repeat the problem  
once it was fixed.


Dave


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with NSSplitView

2008-10-07 Thread Dave Fernandes
Is the part of the view with the buttons inside an NSScrollView? It  
should be scrollable if you are going to resize it with the  
splitview. If it is not scrollable, then you will have the problem  
you describe.


Dave

On Oct 7, 2008, at 8:59 PM, Andre Masse wrote:

Tried your suggestion and it worked... almost. I now have trouble  
with the buttons under the text view. If I bring the divider all  
the way up, I need to bring the divider farther than it was to  
display the buttons. For example, if the divider was at 200 pixels  
from the top before "closing" it, I need to bring it down at 400  
for the buttons to show up. I have no idea what's going on here...  
I'm surely doing something bad cause this kind of interface is  
pretty common on the Mac...


Thanks for your suggestion though, it solved a good part of my  
problem,


Andre Masse


On Oct 7, 2008, at 19:44, Dave Fernandes wrote:

I had the same problem. The fix was to recreate the view in IB.  
Seems to be a bug in IB, but I never tried to repeat the problem  
once it was fixed.


Dave


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes% 
40utoronto.ca


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with NSSplitView

2008-10-07 Thread Jonathan Hess

On Oct 7, 2008, at 4:44 PM, Dave Fernandes wrote:

I had the same problem. The fix was to recreate the view in IB.  
Seems to be a bug in IB, but I never tried to repeat the problem  
once it was fixed.


This isn't a problem with IB, it also isn't unique to split views.

The problem has to do with how the autoresizing rules used by NSView  
are applied. They're applied as scaled deltas from previous values,  
and when you fully collapse a split view, you have a view size that  
goes to zero, and all of the scaling then clamps to zero (zero times  
anything is zero).


To deal with this, this you should use the NSSplitView delegate  
methods to prevent the view from getting smaller than some minimum  
size. The typical behavior is to have the split view resizing towards  
the minimum, when it gets to that minimum it stops resizing even as  
the user continues to drag the mouse. Once the user drags the mouse  
all of the way, the view completely collapses. Behind the scenes,  
NSSplitView doesn't make the subview any smaller than the minimum  
size, but that isn't evident to the user.


You can see this behavior in Mail. Open a Mail window, and then drag  
the split bar that splits the messages table and the message  
composition view. When the split bar gets to about 100 points from the  
bottom of the window it stops moving. If you keep dragging, the  
splitter eventual jumps the remaining distance.


Jon Hess




Dave

On Oct 7, 2008, at 5:41 PM, Andre Masse wrote:


Hi,

I have set up in IB a window with 3 split views. The main split  
view (with a vertical divider) contains 2 splits (horizontal  
divider):


**
* *  3   *
*  1  
* *  *
* *  *
***  4   *
* *  *
*  2  *  *
**

I'm using an NSViewController subclass (with an associated nib) for  
each of the views. In the - windowDidLoad: method of my  
NSWindowController subclass, I set dividers positions and add each  
view, resizing it according to the size available in each pane. I'm  
testing this interface so all views contain dummy controls:


1- has only buttons
2- has only a Date picker in calendar form
3- has a multiline text view (with scroller) and 2 buttons.
4- has a NSTableView


At launch, everything is good and I've no problem changing the  
splitter's position between pane 1 and 2 or with the vertical  
divider. Now, if I change the splitter's position between pane 3  
and 4 all the way up or down and back, the header of the  
NSTableView and the top of the text view, become hidden (under the  
divider). I've tried many combinations of resize/lock for these  
views in IB, played various constants with -setAutoresizingMask:.  
No luck. Either I'm missing the good one, or I'm in the wrong  
track. This is driving me nuts, any advice on getting the good  
combination?


Thanks,

Andre Masse

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dave.fernandes%40utoronto.ca

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with NSSplitView

2008-10-07 Thread Andre Masse
Thanks a lot for the explanation Jon. This makes it clear now. Thanks  
also to Dave. It was good to know I wasn't the only one struggling  
with this.


Andre Masse


On Oct 7, 2008, at 22:43, Jonathan Hess wrote:


On Oct 7, 2008, at 4:44 PM, Dave Fernandes wrote:

I had the same problem. The fix was to recreate the view in IB.  
Seems to be a bug in IB, but I never tried to repeat the problem  
once it was fixed.


This isn't a problem with IB, it also isn't unique to split views.

The problem has to do with how the autoresizing rules used by NSView  
are applied. They're applied as scaled deltas from previous values,  
and when you fully collapse a split view, you have a view size that  
goes to zero, and all of the scaling then clamps to zero (zero times  
anything is zero).


To deal with this, this you should use the NSSplitView delegate  
methods to prevent the view from getting smaller than some minimum  
size. The typical behavior is to have the split view resizing  
towards the minimum, when it gets to that minimum it stops resizing  
even as the user continues to drag the mouse. Once the user drags  
the mouse all of the way, the view completely collapses. Behind the  
scenes, NSSplitView doesn't make the subview any smaller than the  
minimum size, but that isn't evident to the user.


You can see this behavior in Mail. Open a Mail window, and then drag  
the split bar that splits the messages table and the message  
composition view. When the split bar gets to about 100 points from  
the bottom of the window it stops moving. If you keep dragging, the  
splitter eventual jumps the remaining distance.


Jon Hess


___

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

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

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

This email sent to [EMAIL PROTECTED]


Bottombar appearance

2008-10-07 Thread HAMILTON, Steven
Hi folks,
The Apple HIG describes bottombars but gives graphical examples that I can't 
achieve. They are using mainly iCalc as an example.

http://developer.apple.com/documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGWindows/chapter_18_section_4.html#//apple_ref/doc/uid/2961-SW6

In iCalc, and iChat and probably many other Apple products the bottom bar and 
the toolbar has a black indentation line between the bar and the main content 
view giving a bas relief appearance to the main content. I've got a standard 
window, textured as per instructions with a Splitview in it (outlineView on 
left, tableView on right) but I can't get the same appearance. How is this done?

On a related point, why do Apple insist on demanding we implement interface 
elements that don't appear to be out-of-the-box or aren't adequately described 
how to be achieved?

Steven Hamilton | Solutions Designer | BT Infrastructure | Business Technology 
| Suncorp | Tel: 07 3135 4684
[EMAIL PROTECTED] | Level 27, Brisbane Square, 266 George Street, Brisbane




This e-mail is sent by Suncorp-Metway Limited ABN 66 010 831 722 or one of its 
related entities "Suncorp".
Suncorp may be contacted at Level 18, 36 Wickham Terrace, Brisbane or on 13 11 
55 or at suncorp.com.au.
The content of this e-mail is the view of the sender or stated author and does 
not necessarily reflect the view of Suncorp. The content, including 
attachments, is a confidential communication between Suncorp and the intended 
recipient. If you are not the intended recipient, any use, interference with, 
disclosure or copying of this e-mail, including attachments, is unauthorised 
and expressly prohibited. If you have received this e-mail in error please 
contact the sender immediately and delete the e-mail and any attachments from 
your system.
If this e-mail constitutes a commercial message of a type that you no longer 
wish to receive please reply to this e-mail by typing Unsubscribe in the 
subject line.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreData: Fetching object with maximum of property

2008-10-07 Thread Bill Dudney

Hi Frank,

Sorry for not getting back sooner;

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/Articles/pBNF.html#/ 
/apple_ref/doc/uid/TP40001796-217785


documents the BNF which is very cryptic but tells you everything that  
can be in the expression.


So something like this for the predicate;

@"loanToValueRatio = max(loanToValueRatio)"

should work but its been a while since I've messed with it. I did have  
somethign very similar to this working in a project I did last year.


I'm running off fallible memory here but I believe that the CD SQLite  
stuff will convert this to the proper SQL.


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 6:04 AM, Frank Illenberger wrote:


Hi Bill,

I tried using predicates for this but did not succeed.
What would a predicate look like which finds the object of an entity  
with the maximum value for a property?


Frank

On Oct 7, 2008, at 1:08 PM, Bill Dudney wrote:


Hi Frank,

That and a whole lot more;

http://developer.apple.com/documentation/Cocoa/Conceptual/Predicates/predicates.html#/ 
/apple_ref/doc/uid/TP40001798


Good luck!

-bd-
http://bill.dudney.net/roller/objc

On Oct 7, 2008, at 3:49 AM, Frank Illenberger wrote:


Hi everybody,

does anybody know if CoreData under Leopard offers a way to fetch  
the object of an entity which the maximum of a certain property  
value, but without having to fetch all objects into memory?


Cheers

Frank


___

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

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

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

This email sent to [EMAIL PROTECTED]






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bottombar appearance

2008-10-07 Thread Rob Keniger


On 08/10/2008, at 1:18 PM, HAMILTON, Steven wrote:

In iCalc, and iChat and probably many other Apple products the  
bottom bar and the toolbar has a black indentation line between the  
bar and the main content view giving a bas relief appearance to the  
main content. I've got a standard window, textured as per  
instructions with a Splitview in it (outlineView on left, tableView  
on right) but I can't get the same appearance. How is this done?



I think the HIG is wrong here. At WWDC we were told not to make the  
window textured, use a normal window and call this NSWindow method:


-setContentBorderThickness:forEdge:

To get something like iCal you'd use:

[window setContentBorderThickness: 32.0 forEdge: NSMinYEdge];

I think you might need to call this method in the -initWithFrame:  
method of an NSWindow subclass.


--
Rob Keniger



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Wasted Space and Kernighan

2008-10-07 Thread Brian Stern






"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are, by
definition, not smart enough to debug it." -- Brian W. Kernighan




Personally I find debugging to be half as hard as writing the code in  
the first place.


Also, debugging my own clever code is rarely a problem.  Debugging  
someone else's clever code is another story.


Where do bindings fall in all this?  It's often like debugging someone  
else's clever code.


--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: comparing Strings.

2008-10-07 Thread Sandro Noel

Ok that's simple :) I Like it :)

thanks you all !!

On 7-Oct-08, at 6:32 AM, Negm-Awad Amin wrote:

NSArray* components = [source componentsSeperatedByCharactersInSet: 
[NSCharacterSet …]];

NSString* result = [components componentsJoinedByString:@""];


___

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

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

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

This email sent to [EMAIL PROTECTED]


Getting pointer to NSWindowController

2008-10-07 Thread Nirias
I am very new to cocoa and am trying to understand key value coding.  I have
a document app wherein the NSDocument creates the NSWindowController which
loads a NIB that contains a NSView inside an NSWindow.  The NSWindow
contains the NSView and also a couple of NSTextFields bound to numerical
properties owned by the NSWindowController.  I then display current mouse
coordinates by using the following code in the NSView's mouse move handler:

extern NSWindowController *wc;

NSPoint loc = [event locationInWindow];

loc.x -= [self frame].origin.x;

loc.y -= [self frame].origin.y;

 [wc setValue:[NSNumber numberWithDouble:(double) loc.y] forKey:@"ypos"
];

[wc setValue:[NSNumber numberWithDouble:(double) loc.x] forKey:@"xpos"];


This works just fine when wc is a global pointer to the NSWindowController,
which I added out of desperation.  But the following code, which I tried
first, doesnt work for getting wc:


NSWindow *w = [self window];

NSWindowController *wc = [w windowController];


produces NULL for wc



It seems I must be doing something wrong since the NSWindow class have a
property for NSWIndowController isnt documented to  always return NULL.  And
it is hard to believe that the architects of cocoa intended to require that
every bit of shared data be defined as global.


Any chance my overall approach is wrong?  If so, what would be a more
conventional approach for having events processed by a view result in
updates to a control owned by the same window that owns the view?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Getting pointer to NSWindowController

2008-10-07 Thread Graham Cox


On 8 Oct 2008, at 4:00 pm, Nirias wrote:

It seems I must be doing something wrong since the NSWindow class  
have a
property for NSWIndowController isnt documented to  always return  
NULL.  And
it is hard to believe that the architects of cocoa intended to  
require that

every bit of shared data be defined as global.



Your approach looks basically right to me.

If [window windowController] is returning nil it may suggest that you  
haven't hooked everything together properly in IB. Have you connected  
the 'window' outlet of the controller to the window object? Forgetting  
to do that is common and very often things almost work anyway, so it  
might not leap out as an obvious problem.






hth, Graham
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data: Copying and pasting chained entities

2008-10-07 Thread Renaud Céroce

Hi ben,

On Mon, 6 Oct 2008 19:41:46 -0700, Ben Trumbull <[EMAIL PROTECTED]> wrote:

> There are a few examples floating around.  
> 
Could you point me at those articles ? I was not able to find them.


> Typically, relationships are stored externally as either references  
> (NSManagedObjectID in URI form) or copies (e.g. all their  
> attributes).  Just how far you copy the object graph is up to you.
> 

I've just written a few classes to copy the graph. The solution I came with
is similar to the one exposed in the Persistent Document tutorial: Make up
a dictionary that associates the attributes names with their values. For
the relationships: associate their name with a dictionary representing the
associated object, and so on. Finally, the dictionaries are turned into an
NSData using NSArchiver.
However, my solution has an issue: it works when objects are organised in a
tree structure, but it will loop indefinitely if a relationship makes a
managed object point at itself. Whereas NSArchiver has a mechanism to avoid
that.
It's okay for my needs anyway.


> Some apps don't copy the graph at all, and just put a reference (URI)  
> on the pasteboard and when it's pasted back, look up the object.
> 

Yes, it is a simple solution, but I guess it can rarely be used. If you
Copy an object, modify the object, then Paste, the pasted object will be
like the modified object, not like the original one.


I thought about an other solution: do you think we could create an other
NSManagedObjectContext and copy the graph to it ? It did not seem like one
can create a NSManagedObjectContext easily, so I did not investigate
further; but do you think it is feasible ?


Thank you a lot for you answer anyway !


Renaud Pradenc
--
ceroce.com
___

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

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

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

This email sent to [EMAIL PROTECTED]