Re: Setting a frame on a CALayer increments its retain count!?

2009-12-14 Thread Kyle Sluder
On Mon, Dec 14, 2009 at 10:39 PM, Tino Rachui
 wrote:
> Why does setting a frame on the layer increments its retain count?
> What am I missing?

Stop caring about retain count.  Follow the memory management rules
and be done with it.

--Kyle Sluder
___

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

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

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

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


Setting a frame on a CALayer increments its retain count!?

2009-12-14 Thread Tino Rachui
This puzzles me a bit:
...
NSUInteger rc;
CALayer *layer = [CALayer layer];
rc = [layer retainCount];
// rc == 1 as expected

layer.frame = CGRectMake(...);
rc = [layer retainCount];
// now rc == 2, it's not clear to me why
...

Why does setting a frame on the layer increments its retain count?
What am I missing?

TIA,
Tino
___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Greg Guerin

gMail.com wrote:

Thanks, in the meantime I realized that I had to change imagePtr  
from int

into an NSInteger. Now it works. Do you think it is ok?



The standardized size_t typedef would be a better choice than  
NSInteger.  The latter is signed.



Handle   imagesH = NewHandleClear(totImages * oneImageSize);


This appears to be pointless and a leak.  The variable isn't used in  
the posted code.


  -- GG

___

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

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

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

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Ken Thomases
On Dec 14, 2009, at 9:59 PM, PCWiz wrote:

> What if I used NSInvocationOperation like this:
> 
> NSInvocationOperation *myOperation = [[NSInvocationOperation alloc] 
> initWithTarget:self
>selector:@selector(doResourceHungryTask) object:nil];
> [operationQueue addOperation:myOperation];
> 
> "doResourceHungryTask" would be a method in my delegate class. Would I still 
> need to lock/unlock (I'm modifying the class's properties from itself, not 
> another class)? I'm not sure on the exact workings of NSInvocationOperation, 
> I just found out about it.

You still need to design and implement -doResourceHungryTask and everything it 
calls very, very carefully.

It doesn't matter that you're modifying the class's properties rather than 
another's.  It's not about crossing class boundaries.  It's about things 
happening simultaneously on different threads.  The threads can modify shared 
data structures in ways which don't maintain their internal consistency, 
resulting in corrupted data and, if you're lucky, crashes.

Multi-threaded programming is hard.  Apple introduced NSOperation/Queue as one 
way to help programmers be safer, but it's not magical.  It helps provide 
safety only when you use it in the way I described in my earlier email.  
Basically, it encourages designs where the data used for an operation is 
encapsulated within an independent object (of a custom subclass of NSOperation) 
and is not shared by any other thread.

If you don't take Apple's encouragement and just use NSOperation to perform 
"un-encapsulated" threading, it doesn't make things any easier than traditional 
multi-threaded programming.  That's what NSInvocationOperation does, really.  
It doesn't make the selector it invokes any more thread-safe.  The only 
advantage NSInvocationOperation has over 
-performSelectorInBackground:withObject: is that NSOperationQueue manages the 
number of threads in use.

Regards,
Ken

___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Andrew Farmer
On 14 Dec 2009, at 11:06, gMail.com wrote:
> Handle   imagesH = NewHandleClear(totImages * oneImageSize);

Wait, Handle? NewHandleClear? Your use of these functions suggests that you may 
be working from a dangerously old textbook. There's really no reason to use 
them in new code.___

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

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

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

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Ah I understand, that makes sense. Thanks.

On 2009-12-14, at 9:09 PM, Nick Zitzmann wrote:

> 
> On Dec 14, 2009, at 9:07 PM, PCWiz wrote:
> 
>> So to make it clear, I invoke the method as an NSInvocationOperation then in 
>> the method I do this whenever I need to access the mutable dictionary:
>> 
>> - (void)doResourceHungryTask {
>>  ...
>>  @synchronized (myDictionary) {
>>  [myDictionary setObject:anObject forKey:@"testKey"];
>>  }
>> }
>> 
>> Is that correct?
> 
> You must lock and unlock the dictionary **every** time you read from or write 
> to it, not just that one time. Otherwise one thread could access it at the 
> same time as another thread is writing to it, and that would not be good.
> 
> 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 arch...@mail-archive.com


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann

On Dec 14, 2009, at 9:07 PM, PCWiz wrote:

> So to make it clear, I invoke the method as an NSInvocationOperation then in 
> the method I do this whenever I need to access the mutable dictionary:
> 
> - (void)doResourceHungryTask {
>   ...
>   @synchronized (myDictionary) {
>   [myDictionary setObject:anObject forKey:@"testKey"];
>   }
> }
> 
> Is that correct?

You must lock and unlock the dictionary **every** time you read from or write 
to it, not just that one time. Otherwise one thread could access it at the same 
time as another thread is writing to it, and that would not be good.

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Ok, I think I understand this after reading this document:

http://developer.apple.com/mac/articles/cocoa/managingconcurrency.html

So to make it clear, I invoke the method as an NSInvocationOperation then in 
the method I do this whenever I need to access the mutable dictionary:

- (void)doResourceHungryTask {
...
@synchronized (myDictionary) {
[myDictionary setObject:anObject forKey:@"testKey"];
}
}

Is that correct?
On 2009-12-14, at 9:03 PM, Nick Zitzmann wrote:

> 
> On Dec 14, 2009, at 8:59 PM, PCWiz wrote:
> 
>> "doResourceHungryTask" would be a method in my delegate class. Would I still 
>> need to lock/unlock (I'm modifying the class's properties from itself, not 
>> another class)? I'm not sure on the exact workings of NSInvocationOperation, 
>> I just found out about it.
> 
> Yes, because any operation you enqueue is going to run in a background 
> thread, and NSMutableDictionary is not thread-safe.
> 
> 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 arch...@mail-archive.com


[moderator] Re: Don't Report Documentation Bugs to Apple Bug Reporter

2009-12-14 Thread Scott Anguish
Putting my “Moderator/Dev Publications Engineer/Writer hat on”

I’ve asked Jerry off-list for the radar number to follow up on the developer 
documentation issue.  If it isn’t a technical issue, it could be redirected 
there I suppose, but that’s the only reason I can think of.

I’ve asked my manager for clarification.

In the interim, use the feedback button if you don’t want to use 
bugreporter.apple.com

I will respond to this thread when I have clear information.


On Dec 14, 2009, at 9:22 PM, Jerry Krinock wrote:

> Some time ago we had a discussion as to whether documentation bugs should be 
> reported to the "Did this document help you?" link at the bottom, or by 
> filing a Bug Report.  The conclusion at the time was that, although both were 
> acceptable, the formal Bug Report was better.
> 
> Apparently, no more.  Yesterday I reported three bugs.  For the one that 
> involved documentation, I received a polite letter of rejection, saying that 
> I should send documentation bugs to devprogr...@apple.com -- which is a now a 
> THIRD way.
> 
> Well, I think I'll use the "Did this document help you?" link from now on.  
> If anyone believes this advice is incorrect, please explain.
> 

___

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

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

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

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann

On Dec 14, 2009, at 8:59 PM, PCWiz wrote:

> "doResourceHungryTask" would be a method in my delegate class. Would I still 
> need to lock/unlock (I'm modifying the class's properties from itself, not 
> another class)? I'm not sure on the exact workings of NSInvocationOperation, 
> I just found out about it.

Yes, because any operation you enqueue is going to run in a background thread, 
and NSMutableDictionary is not thread-safe.

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
What if I used NSInvocationOperation like this:

NSInvocationOperation *myOperation = [[NSInvocationOperation alloc] 
initWithTarget:self
selector:@selector(doResourceHungryTask) object:nil];
[operationQueue addOperation:myOperation];

"doResourceHungryTask" would be a method in my delegate class. Would I still 
need to lock/unlock (I'm modifying the class's properties from itself, not 
another class)? I'm not sure on the exact workings of NSInvocationOperation, I 
just found out about it.


On 2009-12-14, at 6:02 PM, Nick Zitzmann wrote:

> 
> On Dec 14, 2009, at 5:54 PM, PCWiz wrote:
> 
>> Its being loaded into an NSOperationQueue, and I'm using methods like 
>> setObject:forKey: on the dictionary, not replacing the whole thing.
> 
> Then you need to lock and unlock everything that reads from or writes to the 
> dictionary. Properties are no substitute for locking/unlocking the object, 
> because atomic properties will protect the instance variable, but they won't 
> protect the contents of the instance variable. @synchronized is the easy way 
> of doing this, but depending on your needs, you might need NS(Recursive)Lock 
> instead.
> 
> 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 arch...@mail-archive.com


pls explain rotated iPhone coordinates to me

2009-12-14 Thread Matt Neuburg
I am not grasping how coordinates work in a rotated iPhone app, and I'm
hoping someone will explain them.

My goal is a scroll view consisting of two equal "pages" side by side with
the iPhone sideways (landscape). I have accomplished this, but I don't
understand how I did it; I used pure trial and error, and what works makes
no sense to me. Here's what I did.

The scroll view occupies the entire window (except for the status bar, of
course). It has a view controller implemented so as to permit the
autorotation, and the plist tells us to start up in landscape mode. And we
do. So far so good.

Now I populate the scroll view. I want its content to be double-wide, but I
have to widen its *height* (svc is the scroll view's controller):

CGRect f = svc.view.frame;
CGSize sz = CGSizeMake(f.size.height * 2.0, f.size.width); // swap!
((UIScrollView*)svc.view).contentSize = sz;

Now I place the first page content:

CardController* cc =
 [[CardController alloc] initWithCard: [data objectAtIndex: 0]];
svc.view.frame = f; // don't swap!!
[svc.view addSubview:cc.view];

Now I place the second page content:

f.origin.x += f.size.height; // ??? height and width are swapped...
 // but x and y are not swapped?
CardController* cc2 =
 [[CardController alloc] initWithCard: [data objectAtIndex: 1]];
cc2.view.frame = f;
[svc.view addSubview: cc2.view];

This works great. But why? What on earth is going on here? Thanks - m.

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



___

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

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

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

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Ken Thomases
On Dec 14, 2009, at 6:54 PM, PCWiz wrote:

> On 2009-12-14, at 5:51 PM, Nick Zitzmann wrote:
> 
>> On Dec 14, 2009, at 5:19 PM, PCWiz wrote:
>> 
>>> I need to modify an NSMutableDictionary in my delegate class from within an 
>>> NSOperation subclass. What's the best way to do this? I could just use the 
>>> property setter method, but is this even acceptable?
>> 
>> More details, please. Is your operation enqueued or invoked directly? And 
>> are you seeking to replace the entire dictionary or just its contents?
> 
> Its being loaded into an NSOperationQueue, and I'm using methods like 
> setObject:forKey: on the dictionary, not replacing the whole thing.

I recommend against doing it this way.  Have your operation object message the 
object which owns the dictionary, not the dictionary itself.

Ideally, an operation would receive all of the data it needs to do its work 
before it is started.  That data would be isolated to the operation; it would 
_not_ be a reference to data shared by other objects.  Then, the operation 
would do all of its work.  When the operation completes its work, it may have a 
result.  It should pass that result to another object just before it finishes 
(or it may simply store its result in one of its own properties to be queried 
by its owner).  It is often convenient for the result to be something as simple 
as an array or dictionary, but it may be some other custom class of object.  It 
is also sometimes convenient for the operation to send its result message on 
the main thread using -performSelectorOnMainThread:... if the result will be 
used to update the GUI.

Regards,
Ken

___

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

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

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

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


Don't Report Documentation Bugs to Apple Bug Reporter

2009-12-14 Thread Jerry Krinock
Some time ago we had a discussion as to whether documentation bugs should be 
reported to the "Did this document help you?" link at the bottom, or by filing 
a Bug Report.  The conclusion at the time was that, although both were 
acceptable, the formal Bug Report was better.

Apparently, no more.  Yesterday I reported three bugs.  For the one that 
involved documentation, I received a polite letter of rejection, saying that I 
should send documentation bugs to devprogr...@apple.com -- which is a now a 
THIRD way.

Well, I think I'll use the "Did this document help you?" link from now on.  If 
anyone believes this advice is incorrect, please explain.

___

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

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

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

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann

On Dec 14, 2009, at 5:54 PM, PCWiz wrote:

> Its being loaded into an NSOperationQueue, and I'm using methods like 
> setObject:forKey: on the dictionary, not replacing the whole thing.

Then you need to lock and unlock everything that reads from or writes to the 
dictionary. Properties are no substitute for locking/unlocking the object, 
because atomic properties will protect the instance variable, but they won't 
protect the contents of the instance variable. @synchronized is the easy way of 
doing this, but depending on your needs, you might need NS(Recursive)Lock 
instead.

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


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
Its being loaded into an NSOperationQueue, and I'm using methods like 
setObject:forKey: on the dictionary, not replacing the whole thing.

Thanks
On 2009-12-14, at 5:51 PM, Nick Zitzmann wrote:

> 
> On Dec 14, 2009, at 5:19 PM, PCWiz wrote:
> 
>> I need to modify an NSMutableDictionary in my delegate class from within an 
>> NSOperation subclass. What's the best way to do this? I could just use the 
>> property setter method, but is this even acceptable?
> 
> More details, please. Is your operation enqueued or invoked directly? And are 
> you seeking to replace the entire dictionary or just its contents?
> 
> 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 arch...@mail-archive.com


Re: Modifying outside properties from NSOperation subclass

2009-12-14 Thread Nick Zitzmann

On Dec 14, 2009, at 5:19 PM, PCWiz wrote:

> I need to modify an NSMutableDictionary in my delegate class from within an 
> NSOperation subclass. What's the best way to do this? I could just use the 
> property setter method, but is this even acceptable?

More details, please. Is your operation enqueued or invoked directly? And are 
you seeking to replace the entire dictionary or just its contents?

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


NSSpellChecker language guessing doesn't work

2009-12-14 Thread Chris Idou



I'm trying to use guessesForWordRange:inString:language:inSpellDocumentWithTag: 
and have it use automatic language guessing, but it doesn't seem to work.

At first I was just passing a word, and despite it being in Russian letters, I 
figured it didn't have enough context to guess. So I passed in a large document 
with the range of the word I want checked. But this didn't work either.

So then I thought, maybe this API isn't one that guesses. So I tried calling 
checkSpellingOfString:startingAt:language:wrap:inSpellDocumentWithTag:wordCount:
 immediately prior with a unique tag the same as what I pass to 
guessesForWordRange:inString:language:inSpellDocumentWithTag. But this didn't 
help at all either.

How can I force the spell checking to guess languages?



  
__
See what's on at the movies in your area. Find out now: 
http://au.movies.yahoo.com/session-times/
___

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

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

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

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


Modifying outside properties from NSOperation subclass

2009-12-14 Thread PCWiz
I need to modify an NSMutableDictionary in my delegate class from within an 
NSOperation subclass. What's the best way to do this? I could just use the 
property setter method, but is this even acceptable?

Thanks___

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

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

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

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


Re: Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread Mike Abdullah

On 14 Dec 2009, at 23:01, David Hirsch wrote:

> (After drafting the first version of this email, I found a sort-of solution, 
> but I do not understand why it works.  I thought that simple properties 
> (e.g., object.foo) essentially just called the foo:/setFoo: methods, 
> particularly if you used @property (assign).  That is apparently not the 
> case.  See the code for a working and non-working version.  Note that I do 
> not have custom setters/getters; I've synthesized them.)
> 
> I have a Configuration object that has an NSMutableArray of instances (i.e., 
> the class name is "Instance" - this is not the computer science definition of 
> "instance").  Each Instance has a course, room, instructor (which are, 
> respectively, Course *, Room *, Instructor *).  In the newNearbyConfiguration 
> method of Configuration, I need to make a slightly modified copy of the 
> Configuration object.  To do this, I choose an Instance from the array, 
> modify it (for example, by changing the room to a different Room *).  Oddly, 
> however, when I make this change, the array suddenly gets a new copy of the 
> original Instance.  The new copy has a new memory address.  I would have 
> expected that I can modify the contents of an object in an NSMutableArray 
> without needing to replace the original.
> The Instance * should still point to the same memory, right?
> Also, I put a breakpoint in Instance copyWithZone, but that was apparently 
> not called.
> Can anybody shed light on this?  Here is some relevant code:
> 
> (From Instance.h:)
> @interface Instance : NSObject {
>   Course *course; // shallow copy
>   WeekPattern *   pattern;// shallow copy
>   Instructor *instructor; // Shallow copy
>   Timing *timing; // Deep copy
>   Room *  room;   // Shallow copy
>   NSUInteger  quarter; // Simple copy 0=fall, 1=winter, 
> 2=spring
> }
> 
> @property (assign) Course *   course; // weak reference
> @property (assign) WeekPattern *  pattern;// weak reference
> @property (assign) Instructor *   instructor; // weak 
> reference
> @property (assign) Timing *   timing; // strong reference - I own this
> @property (assign) Room * room;   // weak reference
> @property (assign) NSUInteger quarter;
> 
> 
> (From Configuration.h:)
> @interface Configuration : NSObject  {
>   NSMutableArray *instances;  // array of Instances
>   ClassSchedulerDoc *myDoc;   // weak reference
> }
> @property (retain) NSMutableArray *instances;
> @property (assign) ClassSchedulerDoc *myDoc;
> 
> (From Configuration.m, highly edited for brevity)
> - (Configuration *) newNearbyConfiguration {
>   // make a new configuration like the current one but with one small 
> change
>   Configuration *newConfig = [self copy];

Great, assuming you've implemented -copyWithZone: properly, you've made a copy 
of the configuration.
>   
>   short randInstance = rand() % [self.instances count];
>   Instance *instanceToAlter = [self.instances objectAtIndex:randInstance];
>   Room *newRoom;
>   do {
>   newRoom = [[instanceToAlter course] randomLowCostRoom];
>   } while (newRoom == [instanceToAlter room]);
>   [instanceToAlter setRoom: newRoom]; // this works
> //instanceToAlter.room = newRoom; // this displays the problem described 
> above
> 
>   return newConfig;
And as expected, you're returning the new configuration. But, since creating 
it, you've not modified it in any way. I suggest looking at all the calls to 
self within this method and checking whether you actually meant to send them to 
newConfig.
> }
> 
> - (NSString *)description {
>   NSMutableString *desc = [NSMutableString stringWithCapacity:200];
>   
>   for (Instance *thisInstance in instances) {
>   [desc appendString:[thisInstance briefDescription]];
>   }
>   return desc;
> }
> 
> Also, I do know that I could easily have just made Configuration inherit from 
> NSMutableArray.  That would appear to be irrelevant to my question.
> 
> Thanks,
> Dave
> 
> 
> Dave Hirsch
> Associate Professor
> Department of Geology
> Western Washington University
> persistent email: dhir...@mac.com
> http://www.davehirsch.com
> voice: (360) 389-3583
> aim: dhir...@mac.com
> vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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 cocoa...@mikeabdullah.net

Re: Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread David Hirsch

Sorry - found the primary problem.  Should have been this line:
	Instance *instanceToAlter = [newConfig.instances  
objectAtIndex:randInstance];


instead of:
	Instance *instanceToAlter = [self.instances  
objectAtIndex:randInstance];


However, I'm still mystified by the manifestation of the error.
-Dave


On Dec 14, 2009, at 3:01 PM, David Hirsch wrote:

(After drafting the first version of this email, I found a sort-of  
solution, but I do not understand why it works.  I thought that  
simple properties (e.g., object.foo) essentially just called the  
foo:/setFoo: methods, particularly if you used @property (assign).   
That is apparently not the case.  See the code for a working and non- 
working version.  Note that I do not have custom setters/getters;  
I've synthesized them.)


I have a Configuration object that has an NSMutableArray of  
instances (i.e., the class name is "Instance" - this is not the  
computer science definition of "instance").  Each Instance has a  
course, room, instructor (which are, respectively, Course *, Room *,  
Instructor *).  In the newNearbyConfiguration method of  
Configuration, I need to make a slightly modified copy of the  
Configuration object.  To do this, I choose an Instance from the  
array, modify it (for example, by changing the room to a different  
Room *).  Oddly, however, when I make this change, the array  
suddenly gets a new copy of the original Instance.  The new copy has  
a new memory address.  I would have expected that I can modify the  
contents of an object in an NSMutableArray without needing to  
replace the original.

The Instance * should still point to the same memory, right?
Also, I put a breakpoint in Instance copyWithZone, but that was  
apparently not called.

Can anybody shed light on this?  Here is some relevant code:

(From Instance.h:)
@interface Instance : NSObject {
Course *course; // shallow copy
WeekPattern *   pattern;// shallow copy
Instructor *instructor; // Shallow copy
Timing *timing; // Deep copy
Room *  room;   // Shallow copy
NSUInteger  quarter; // Simple copy 0=fall, 1=winter, 
2=spring
}

@property (assign) Course * course; // weak reference
@property (assign) WeekPattern *pattern;// weak reference
@property (assign) Instructor * instructor; // weak reference
@property (assign) Timing * timing; // strong reference - I own this
@property (assign) Room *   room;   // weak reference
@property (assign) NSUInteger   quarter;


(From Configuration.h:)
@interface Configuration : NSObject  {
NSMutableArray *instances;  // array of Instances
ClassSchedulerDoc *myDoc;   // weak reference
}
@property (retain) NSMutableArray *instances;
@property (assign) ClassSchedulerDoc *myDoc;

(From Configuration.m, highly edited for brevity)
- (Configuration *) newNearbyConfiguration {
	// make a new configuration like the current one but with one small  
change

Configuration *newConfig = [self copy];

short randInstance = rand() % [self.instances count];
	Instance *instanceToAlter = [self.instances  
objectAtIndex:randInstance];

Room *newRoom;
do {
newRoom = [[instanceToAlter course] randomLowCostRoom];
} while (newRoom == [instanceToAlter room]);
[instanceToAlter setRoom: newRoom]; // this works
//	instanceToAlter.room = newRoom;	// this displays the problem  
described above


return newConfig;
}

- (NSString *)description {
NSMutableString *desc = [NSMutableString stringWithCapacity:200];

for (Instance *thisInstance in instances) {
[desc appendString:[thisInstance briefDescription]];
}
return desc;
}

Also, I do know that I could easily have just made Configuration  
inherit from NSMutableArray.  That would appear to be irrelevant to  
my question.


Thanks,
Dave


Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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

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

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

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




Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhi

Problem with properties and setters; also:Surprising behavior of NSMutableArray - makes spontaneous copy

2009-12-14 Thread David Hirsch
(After drafting the first version of this email, I found a sort-of  
solution, but I do not understand why it works.  I thought that simple  
properties (e.g., object.foo) essentially just called the foo:/setFoo:  
methods, particularly if you used @property (assign).  That is  
apparently not the case.  See the code for a working and non-working  
version.  Note that I do not have custom setters/getters; I've  
synthesized them.)


I have a Configuration object that has an NSMutableArray of instances  
(i.e., the class name is "Instance" - this is not the computer science  
definition of "instance").  Each Instance has a course, room,  
instructor (which are, respectively, Course *, Room *, Instructor *).   
In the newNearbyConfiguration method of Configuration, I need to make  
a slightly modified copy of the Configuration object.  To do this, I  
choose an Instance from the array, modify it (for example, by changing  
the room to a different Room *).  Oddly, however, when I make this  
change, the array suddenly gets a new copy of the original Instance.   
The new copy has a new memory address.  I would have expected that I  
can modify the contents of an object in an NSMutableArray without  
needing to replace the original.

The Instance * should still point to the same memory, right?
Also, I put a breakpoint in Instance copyWithZone, but that was  
apparently not called.

Can anybody shed light on this?  Here is some relevant code:

(From Instance.h:)
@interface Instance : NSObject {
Course *course; // shallow copy
WeekPattern *   pattern;// shallow copy
Instructor *instructor; // Shallow copy
Timing *timing; // Deep copy
Room *  room;   // Shallow copy
NSUInteger  quarter; // Simple copy 0=fall, 1=winter, 
2=spring
}

@property (assign) Course * course; // weak reference
@property (assign) WeekPattern *pattern;// weak reference
@property (assign) Instructor * instructor; // weak reference
@property (assign) Timing * timing; // strong reference - I own this
@property (assign) Room *   room;   // weak reference
@property (assign) NSUInteger   quarter;


(From Configuration.h:)
@interface Configuration : NSObject  {
NSMutableArray *instances;  // array of Instances
ClassSchedulerDoc *myDoc;   // weak reference
}
@property (retain) NSMutableArray *instances;
@property (assign) ClassSchedulerDoc *myDoc;

(From Configuration.m, highly edited for brevity)
- (Configuration *) newNearbyConfiguration {
	// make a new configuration like the current one but with one small  
change

Configuration *newConfig = [self copy];

short randInstance = rand() % [self.instances count];
	Instance *instanceToAlter = [self.instances  
objectAtIndex:randInstance];

Room *newRoom;
do {
newRoom = [[instanceToAlter course] randomLowCostRoom];
} while (newRoom == [instanceToAlter room]);
[instanceToAlter setRoom: newRoom]; // this works
//	instanceToAlter.room = newRoom;	// this displays the problem  
described above


return newConfig;
}

- (NSString *)description {
NSMutableString *desc = [NSMutableString stringWithCapacity:200];

for (Instance *thisInstance in instances) {
[desc appendString:[thisInstance briefDescription]];
}
return desc;
}

Also, I do know that I could easily have just made Configuration  
inherit from NSMutableArray.  That would appear to be irrelevant to my  
question.


Thanks,
Dave


Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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

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

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

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


Re: Smooth Scrolling for NSScrollView

2009-12-14 Thread Jeff Johnson

On Dec 14, 2009, at 3:04 PM, Scott Ribe wrote:

Smooth scrolling is an abomination anyway, by way of Microsoft, a  
feature

that looked cool to some developer but has awful usability.

With line-by-line scrolling you can actually read the top or bottom  
lines as
they go by, and determine your place in the document as it scrolls.  
With
smooth scrolling, the text is a blur, and you must frequently stop  
scrolling

in order to read a line and get re-oriented in the document.


I think you're missing the primary use case for smooth scrolling. If  
you scroll line-by-line, it may perhaps be superior to have smooth  
scrolling off, though I won't even grant that point automatically (I  
don't find the text a 'blur'). In any case, for page-by-page  
scrolling, I find smooth scrolling to be vastly superior. Without  
smooth scrolling, the window just jumps immediately to a different  
part of the document, and I find that disorienting. If you read a  
document page-by-page, it's an abomination without smooth scrolling,  
in my opinion.


-Jeff

___

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

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

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

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


Re: NSString and Regular Expressions

2009-12-14 Thread Dave DeLong
RegexKit is the best (read: simplest) way to get regular expression support 
into your Cocoa apps.  http://regexkit.sourceforge.net  It's also possible to 
use NSPredicate for simple matching.

You can find a couple of other options listed on this page:  
http://cocoaheads.byu.edu/resources/regex

Cheers,

Dave

On Dec 14, 2009, at 3:34 PM, Phil Hystad wrote:

> I was sort of suspecting that regular expression matches would be supported 
> by NSString yet I find no message interface for supporting regular 
> expressions.  So, is the only capability for handling regular expressions in 
> Objective-C the Posix Regex library?


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

NSString and Regular Expressions

2009-12-14 Thread Phil Hystad
I was sort of suspecting that regular expression matches would be supported by 
NSString yet I find no message interface for supporting regular expressions.  
So, is the only capability for handling regular expressions in Objective-C the 
Posix Regex library?

phil
phys...@mac.com

___

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

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

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

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


Re: NSTextView Bad Behavior

2009-12-14 Thread Gordon Apple
Thanks.  Those are relatively new.  I had forgotten about them.  I think
that did solve a few problems.  However, I found that it doesn't set the
container or frame length. Unfortunately, that API is private, so I had to
find another way.

I'm flipping text both H and/or V, scaling, and slow scrolling.  It still
has a few issues, but mostly works.


On 12/14/09 12:55 PM, "Douglas Davidson"  wrote:

> 
> On Dec 14, 2009, at 10:50 AM, Gordon Apple wrote:
> 
>> Any ideas on how to force a full layout and then prevent NSTextView
>> from
>> further mucking with it?
> 
> One of NSLayoutManager's -ensureLayout... methods would be a good bet
> here.
> 
> Douglas Davidson
> 



___

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

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

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

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


Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jerry Krinock
Sorry ... I had cloned from an sdef file that I had lying around.  In its app 
suite was an override of the 'open' AppleScript command which was not 
applicable to the current app.___

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

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

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

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


Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jerry Krinock
Thank you for the thoughts, guys.

Sean, I just verified that Apple's DepartmentAndEmployees responds OK.

But today, after making some other changes, my app is behaving differently.  
With AEDebugReceives=1, I see that it receives the SSys/odoc Apple Event with 
the file url in the data.  What's supposed to happen next is that my document 
controller should get an openDocumentWithContentsOfURL:display:error:.  But it 
doesn't.  So course no doc gets opened.

So now it's an AppleScriptability issue.  I can't figure this out I'll discuss 
on applescript-implement...@lists.apple.com.

___

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

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

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

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


Re: Smooth Scrolling for NSScrollView

2009-12-14 Thread Scott Ribe
Smooth scrolling is an abomination anyway, by way of Microsoft, a feature
that looked cool to some developer but has awful usability.

With line-by-line scrolling you can actually read the top or bottom lines as
they go by, and determine your place in the document as it scrolls. With
smooth scrolling, the text is a blur, and you must frequently stop scrolling
in order to read a line and get re-oriented in the document.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

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


Re: double free error

2009-12-14 Thread Eric E. Dolecki
Many thanks and very good to know.


On Mon, Dec 14, 2009 at 3:55 PM, Henry McGilton (Boulevardier) <
appledevelo...@trilithon.com> wrote:

>
> On Dec 14, 2009, at 12:45 PM, Eric E. Dolecki wrote:
>
> I was receiving malloc double free errors when a view removed itself, so
> all
> of the releases I was doing in the view I commented out, the view killing
> itself after it animates from visual view:
>
> - (void) killMe:(NSString *)animationID finished:(NSNumber *)finished
> context:(void *)context {
>
> [self.view removeFromSuperview];
>
> }
>
>
>
> removeFromSuperview
>
> Unlinks the receiver from its superview and its window, and removes it from
> the responder chain.
>
> - (void)removeFromSuperview
> Discussion
>
> If the receiver’s superview is not nil, this method releases the receiver.
> ===
>
> If you plan to reuse the view, be sure to retain it before calling this
> method and be sure to release it as appropriate when you are done with it or
> after adding it to another view hierarchy.
>
> ===
>
> I no longer receive the malloc double free errors. I was creating NSStrings
> and NSDateFormatters (init type stuff), all of which I previously was
> releasing myself. Does it sound reasonable that the removeFromSuperview was
> cleaning all that up already and thus the releases caused the errors? I am
> trying to still get my head around memory management.
>
>
> Cheers,
> . . . . . . . .Henry
>
>
>
>


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

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

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

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

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


Re: double free error

2009-12-14 Thread Henry McGilton (Boulevardier)

On Dec 14, 2009, at 12:45 PM, Eric E. Dolecki wrote:

> I was receiving malloc double free errors when a view removed itself, so all
> of the releases I was doing in the view I commented out, the view killing
> itself after it animates from visual view:
> 
> - (void) killMe:(NSString *)animationID finished:(NSNumber *)finished
> context:(void *)context {
> 
> [self.view removeFromSuperview];
> 
> }


removeFromSuperview
Unlinks the receiver from its superview and its window, and removes it from the 
responder chain.

- (void)removeFromSuperview

Discussion
If the receiver’s superview is not nil, this method releases the receiver.

===
If you plan to reuse the view, be sure to retain it before calling this method 
and be sure to release it as appropriate when you are done with it or after 
adding it to another view hierarchy.

===


> I no longer receive the malloc double free errors. I was creating NSStrings
> and NSDateFormatters (init type stuff), all of which I previously was
> releasing myself. Does it sound reasonable that the removeFromSuperview was
> cleaning all that up already and thus the releases caused the errors? I am
> trying to still get my head around memory management.

Cheers,
. . . . . . . .Henry



___

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

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

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

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


Re: Wierd Crash Report

2009-12-14 Thread David Blanton
Thanks to all ...  I was unaware of the "Open With Rosetta" option in  
Get Info.


I just had the user uncheck it and my code is running fine.

So, how did it get checked in the first place  ... hmm mystery as the  
user says she did not do it


She did have a dealer tech rep out a few days ago, I wonder ?

Thanks again, happy user now !

db

On Dec 14, 2009, at 1:14 PM, Mike Abdullah wrote:



On 14 Dec 2009, at 19:40, David Blanton wrote:




I ask this here as I have seen questions on Crash Reports.

This is is Universal Binary ... why is there any PPC involved as it  
is running on Intel


This is an iMac


Code type says it all. "PPC (Translated)". i.e. the user has forced  
your app to launch under Rosetta.


Can anyone shed some light for me ?  Or tell me where to go with  
this type of issue ..


Thanks

db



Process: Convert it [817]
Path:/Applications/Convert it.app/Contents/MacOS/ 
Convert it

Identifier:  com.BriTonLeap.convertitmac
Version: 1.42b (7309)
Code Type:   PPC (Translated)
Parent Process:  launchd [74]

Date/Time:   2009-12-14 14:07:30.817 -0500
OS Version:  Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  D7DD7915-6444-4E83-A599-82BC6AD583BD

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0

Thread 0 Crashed:
0   translate 	0xb8152b34 spin_lock_wrapper +  
91256
1   translate 	0xb8171633  
CallPPCFunctionAtAddressInt + 96207

2   translate   0xb80bdb8b 0xb800 + 777099
3   translate   0xb80b7007 0xb800 + 749575
4   translate   0xb80d49c0 0xb800 + 870848
5   translate 	0xb813d75f spin_lock_wrapper +  
4259

6   translate   0xb8011b64 0xb800 + 72548

Thread 1:
0   ??? 0x800bc286 0 + 2148254342
1   ??? 0x800c3a7c 0 + 2148285052
2   translate 	0xb818b6ea  
CallPPCFunctionAtAddressInt + 202886

3   ??? 0x800ed155 0 + 2148454741
4   ??? 0x800ed012 0 + 2148454418

Thread 0 crashed with X86 Thread State (32-bit):
eax: 0x  ebx: 0xb81715c2  ecx: 0x  edx: 0x0006
edi: 0x0331  esi: 0x  ebp: 0xb7fff978  esp: 0xb7fff958
ss: 0x001f  efl: 0x0246  eip: 0xb8152b34   cs: 0x0017
ds: 0x001f   es: 0x001f   fs: 0x   gs: 0x0037
cr2: 0x81272acc

Binary Images:
0xb800 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/ 
translate


Translated Code Information:
NO CRASH REPORT
___

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

Please do not post admin requests or moderator comments to the list.
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 cocoa...@mikeabdullah.net







___

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

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

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

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


double free error

2009-12-14 Thread Eric E. Dolecki
I was receiving malloc double free errors when a view removed itself, so all
of the releases I was doing in the view I commented out, the view killing
itself after it animates from visual view:

- (void) killMe:(NSString *)animationID finished:(NSNumber *)finished
context:(void *)context {

[self.view removeFromSuperview];

}

I no longer receive the malloc double free errors. I was creating NSStrings
and NSDateFormatters (init type stuff), all of which I previously was
releasing myself. Does it sound reasonable that the removeFromSuperview was
cleaning all that up already and thus the releases caused the errors? I am
trying to still get my head around memory management.

Thanks,
Eric
___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer

On Dec 14, 2009, at 12:16 PM, Matthew Lindfield Seager wrote:

> That  belongs to the preceding LSTypeIsPackage key.

Yea, I was still sleeping when I responded to that last post.  ;)  Turned out 
that resource CFBundleDisplayName/CFBundleDocumentTypes should not have even 
been in the plist file for this app in the first.  It some how inadvertently 
was appended.  Lesson learned.  
errr.___

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

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

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

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


Re: Wierd Crash Report

2009-12-14 Thread Nick Zitzmann

On Dec 14, 2009, at 1:21 PM, Rippit the Ogg Frog wrote:

> It can happen that there are Rosetta bugs that don't occur on native PowerPC 
> hardware.  While that shouldn't ever be the case, we all know that 
> programmers are only human.

Well, for starters, the garbage collector doesn't work under Rosetta, and 
Rosetta will crash if you try to start up a GC-enabled app in its environment. 
So if you make a GC-enabled app, you also must set the info.plist key that 
requires native execution, or something like this could happen on application 
startup.

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


Re: Wierd Crash Report

2009-12-14 Thread Rippit the Ogg Frog

From your crash log:


Code Type:   PPC (Translated)


"Translated" - does that mean it's running under Rosetta on Intel?

It can happen that there are Rosetta bugs that don't occur on native 
PowerPC hardware.  While that shouldn't ever be the case, we all know 
that programmers are only human.


David Blanton wrote:



I ask this here as I have seen questions on Crash Reports.

This is is Universal Binary ... why is there any PPC involved as it is 
running on Intel




Process: Convert it [817]
Path:/Applications/Convert it.app/Contents/MacOS/Convert it
Identifier:  com.BriTonLeap.convertitmac
Version: 1.42b (7309)
Code Type:   PPC (Translated)
Parent Process:  launchd [74]


Mike Crawford
rip...@oggfrog.com
http://www.oggfrog.com/

___

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

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

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

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


Re: Wierd Crash Report

2009-12-14 Thread Mike Abdullah

On 14 Dec 2009, at 19:40, David Blanton wrote:

> 
> 
> I ask this here as I have seen questions on Crash Reports.
> 
> This is is Universal Binary ... why is there any PPC involved as it is 
> running on Intel
> 
> This is an iMac

Code type says it all. "PPC (Translated)". i.e. the user has forced your app to 
launch under Rosetta.
> 
> Can anyone shed some light for me ?  Or tell me where to go with this type of 
> issue ..
> 
> Thanks
> 
> db
> 
> 
> 
> Process: Convert it [817]
> Path:/Applications/Convert it.app/Contents/MacOS/Convert it
> Identifier:  com.BriTonLeap.convertitmac
> Version: 1.42b (7309)
> Code Type:   PPC (Translated)
> Parent Process:  launchd [74]
> 
> Date/Time:   2009-12-14 14:07:30.817 -0500
> OS Version:  Mac OS X 10.5.8 (9L31a)
> Report Version:  6
> Anonymous UUID:  D7DD7915-6444-4E83-A599-82BC6AD583BD
> 
> Exception Type:  EXC_CRASH (SIGABRT)
> Exception Codes: 0x, 0x
> Crashed Thread:  0
> 
> Thread 0 Crashed:
> 0   translate 0xb8152b34 spin_lock_wrapper + 91256
> 1   translate 0xb8171633 CallPPCFunctionAtAddressInt 
> + 96207
> 2   translate 0xb80bdb8b 0xb800 + 777099
> 3   translate 0xb80b7007 0xb800 + 749575
> 4   translate 0xb80d49c0 0xb800 + 870848
> 5   translate 0xb813d75f spin_lock_wrapper + 4259
> 6   translate 0xb8011b64 0xb800 + 72548
> 
> Thread 1:
> 0   ???   0x800bc286 0 + 2148254342
> 1   ???   0x800c3a7c 0 + 2148285052
> 2   translate 0xb818b6ea CallPPCFunctionAtAddressInt 
> + 202886
> 3   ???   0x800ed155 0 + 2148454741
> 4   ???   0x800ed012 0 + 2148454418
> 
> Thread 0 crashed with X86 Thread State (32-bit):
> eax: 0x  ebx: 0xb81715c2  ecx: 0x  edx: 0x0006
> edi: 0x0331  esi: 0x  ebp: 0xb7fff978  esp: 0xb7fff958
>  ss: 0x001f  efl: 0x0246  eip: 0xb8152b34   cs: 0x0017
>  ds: 0x001f   es: 0x001f   fs: 0x   gs: 0x0037
> cr2: 0x81272acc
> 
> Binary Images:
> 0xb800 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/translate
> 
> Translated Code Information:
> NO CRASH REPORT
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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 cocoa...@mikeabdullah.net

___

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

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

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

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


Re: Wierd Crash Report

2009-12-14 Thread Jonathan del Strother
That looks an awful lot like it's running via rosetta.  Perhaps the
user has done Get Info on your app and ticked the 'Open using Rosetta'
box?


2009/12/14 David Blanton :
>
>
> I ask this here as I have seen questions on Crash Reports.
>
> This is is Universal Binary ... why is there any PPC involved as it is
> running on Intel
>
> This is an iMac
>
> Can anyone shed some light for me ?  Or tell me where to go with this type
> of issue ..
>
> Thanks
>
> db
>
>
>
> Process:         Convert it [817]
> Path:            /Applications/Convert it.app/Contents/MacOS/Convert it
> Identifier:      com.BriTonLeap.convertitmac
> Version:         1.42b (7309)
> Code Type:       PPC (Translated)
> Parent Process:  launchd [74]
>
> Date/Time:       2009-12-14 14:07:30.817 -0500
> OS Version:      Mac OS X 10.5.8 (9L31a)
> Report Version:  6
> Anonymous UUID:  D7DD7915-6444-4E83-A599-82BC6AD583BD
>
> Exception Type:  EXC_CRASH (SIGABRT)
> Exception Codes: 0x, 0x
> Crashed Thread:  0
>
> Thread 0 Crashed:
> 0   translate                           0xb8152b34 spin_lock_wrapper + 91256
> 1   translate                           0xb8171633
> CallPPCFunctionAtAddressInt + 96207
> 2   translate                           0xb80bdb8b 0xb800 + 777099
> 3   translate                           0xb80b7007 0xb800 + 749575
> 4   translate                           0xb80d49c0 0xb800 + 870848
> 5   translate                           0xb813d75f spin_lock_wrapper + 4259
> 6   translate                           0xb8011b64 0xb800 + 72548
>
> Thread 1:
> 0   ???                                 0x800bc286 0 + 2148254342
> 1   ???                                 0x800c3a7c 0 + 2148285052
> 2   translate                           0xb818b6ea
> CallPPCFunctionAtAddressInt + 202886
> 3   ???                                 0x800ed155 0 + 2148454741
> 4   ???                                 0x800ed012 0 + 2148454418
>
> Thread 0 crashed with X86 Thread State (32-bit):
>  eax: 0x  ebx: 0xb81715c2  ecx: 0x  edx: 0x0006
>  edi: 0x0331  esi: 0x  ebp: 0xb7fff978  esp: 0xb7fff958
>  ss: 0x001f  efl: 0x0246  eip: 0xb8152b34   cs: 0x0017
>  ds: 0x001f   es: 0x001f   fs: 0x   gs: 0x0037
>  cr2: 0x81272acc
>
> Binary Images:
> 0xb800 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/translate
>
> Translated Code Information:
> NO CRASH REPORT
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/maillist%40steelskies.com
>
> This email sent to maill...@steelskies.com
>
___

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

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

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

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


Wierd Crash Report

2009-12-14 Thread David Blanton



I ask this here as I have seen questions on Crash Reports.

This is is Universal Binary ... why is there any PPC involved as it is  
running on Intel


This is an iMac

Can anyone shed some light for me ?  Or tell me where to go with this  
type of issue ..


Thanks

db



Process: Convert it [817]
Path:/Applications/Convert it.app/Contents/MacOS/Convert it
Identifier:  com.BriTonLeap.convertitmac
Version: 1.42b (7309)
Code Type:   PPC (Translated)
Parent Process:  launchd [74]

Date/Time:   2009-12-14 14:07:30.817 -0500
OS Version:  Mac OS X 10.5.8 (9L31a)
Report Version:  6
Anonymous UUID:  D7DD7915-6444-4E83-A599-82BC6AD583BD

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x, 0x
Crashed Thread:  0

Thread 0 Crashed:
0   translate   0xb8152b34 spin_lock_wrapper + 91256
1   translate 	0xb8171633  
CallPPCFunctionAtAddressInt + 96207

2   translate   0xb80bdb8b 0xb800 + 777099
3   translate   0xb80b7007 0xb800 + 749575
4   translate   0xb80d49c0 0xb800 + 870848
5   translate   0xb813d75f spin_lock_wrapper + 4259
6   translate   0xb8011b64 0xb800 + 72548

Thread 1:
0   ??? 0x800bc286 0 + 2148254342
1   ??? 0x800c3a7c 0 + 2148285052
2   translate 	0xb818b6ea  
CallPPCFunctionAtAddressInt + 202886

3   ??? 0x800ed155 0 + 2148454741
4   ??? 0x800ed012 0 + 2148454418

Thread 0 crashed with X86 Thread State (32-bit):
 eax: 0x  ebx: 0xb81715c2  ecx: 0x  edx: 0x0006
 edi: 0x0331  esi: 0x  ebp: 0xb7fff978  esp: 0xb7fff958
  ss: 0x001f  efl: 0x0246  eip: 0xb8152b34   cs: 0x0017
  ds: 0x001f   es: 0x001f   fs: 0x   gs: 0x0037
 cr2: 0x81272acc

Binary Images:
0xb800 - 0xb81d7fe7  translate ??? (???) /usr/libexec/oah/translate

Translated Code Information:
NO CRASH REPORT
___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Scott Ribe
> Thanks, in the meantime I realized that I had to change imagePtr from int
> into an NSInteger. Now it works. Do you think it is ok?

Well you found the crash, and the code now looks like it is "ok" in terms of
allocating the right amount of memory. But it's still a confusing mess that
is difficult to follow. Why all the casting back and forth between integers
& pointers??? If you need to store an array of pointers, just do so; don't
cast them to integers and then back again.

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Matthew Lindfield Seager
Not directly related to your problem but just for your info...

On Tuesday, December 15, 2009, Joe The Programmer
 wrote:
>Regardless, there seems to be an erroneous  in there.

That  belongs to the preceding LSTypeIsPackage key.
___

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

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

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

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


Re: NSMutableAttributedString & Links color

2009-12-14 Thread PCWiz
Thanks, looks like what I need :-)

On 2009-12-14, at 11:42 AM, Ross Carter wrote:

> On Dec 13, 2009, at 8:55 PM, PCWiz wrote:
> 
>> Hi,
>> 
>> I am, for lack of a better word, "enabling" links in my 
>> NSMutableAttributedString by applying the NSLinkAttributeName attribute to 
>> them, and I'm changing their color from the default blue to a different 
>> color using NSForegroundColorAttributeName. This all works fine. The only 
>> issue: When you actually *click* on the link, it goes back to that default 
>> blue with underline style.
>> 
>> Is there any way to change this?
> 
> NSTextView -setLinkTextAttributes:
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/pcwiz.support%40gmail.com
> 
> This email sent to pcwiz.supp...@gmail.com

___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread gMail.com
Thanks, in the meantime I realized that I had to change imagePtr from int
into an NSInteger. Now it works. Do you think it is ok?

#define  kDepth 32
NSInteger  oneImageSize = width * height * (kDepth >> 3);
Handle   imagesH = NewHandleClear(totImages * oneImageSize);
NSInteger  *imagePtr = malloc(totImages * sizeof(NSInteger));
NSInteger  baseH = *(NSInteger*)(imageBaseH);

for(i = 0; i < totImages ; i++){
imagePtr[i] = (baseH + (i * oneImageSize));
imageData = [imagesArray objectAtIndex:i];
[self LoadImageData:imageData pointer:(void*)imagePtr[i] h:height];
}

> Da: Mike Abdullah 
> Data: Mon, 14 Dec 2009 18:41:58 +
> A: "gMail.com" 
> Cc: 
> Oggetto: Re: memcpy with 64 bit
> 
> Have you read the 64 bit transition guide?
> http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Cocoa64B
> itGuide/Introduction/Introduction.html
> Your question (use of int) suggests not.
> 
> On 14 Dec 2009, at 18:27, gMail.com wrote:
> 
>> Hi,
>> if I compile this code against "32-bits Universal", it works.
>> If I compile this code against "64-bit Intel", it doesn't work.
>> I get a bad access error just on memcpy. What do I miss? I use:
>> 
>>Base SDK 10.6
>>i386 ppc ppc64 ppc7400 ppc970 x86_64
>>GCC 4.2 or 4.0
>>Target Mac OS X 10.6
>>Active Architecture x86_64
>> 
>> - (void)LoadImageData:(NSData*)imageData
>>   pointer:(void*)handle
>>   h:(GLuint)imageHeight
>> {
>>NSBitmapImageRep*bitmap = [[NSBitmapImageRep alloc]
>>initWithData:imageData];
>>int bytesPRow = [bitmap bytesPerRow];
>>unsigned char*theImageData = [bitmap bitmapData];
>>int rowNum;
>> 
>>for(rowNum = 0; rowNum < imageHeight; rowNum++){
>>memcpy(handle + (rowNum * bytesPRow),
>> theImageData + (rowNum * bytesPRow), bytesPRow);
>>}
>> 
>>[bitmap release];
>> }
>> 
>> 
>> Best Regards
>> -- 
>> Leonardo
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> 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 cocoa...@mikeabdullah.net
> 


___

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

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

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

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


Re: NSTextView Bad Behavior

2009-12-14 Thread Douglas Davidson


On Dec 14, 2009, at 10:50 AM, Gordon Apple wrote:

Any ideas on how to force a full layout and then prevent NSTextView  
from

further mucking with it?


One of NSLayoutManager's -ensureLayout... methods would be a good bet  
here.


Douglas Davidson

___

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

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

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

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


NSTextView Bad Behavior

2009-12-14 Thread Gordon Apple
Apparently, I'm not the only one who has experienced this.  NSTextView (or
NSLayoutManager) is lazy.  It does stuff in the background that is driving
me nuts.  I need to do a full layout, not just what's visible, so I can get
a reliably accurate measure of the total physical text layout length.  I've
tried the usual suspects such as scrollRangeToVisible and the
docs-recommended glyphRangeForTextContainer, all to no avail, in an attempt
to get an immediate full layout.  I've even put in timer delays before
measuring it.  Unfortunately, NSTextView comes back into play sometime later
and does a re-layout, often increasing the text frame height by as much as
50%, totally screwing up what I am doing. Manually scrolling to the end and
back will trigger another (correct) layout.  However, because I'm often
(programmatically) replacing the displayed text, I need to accomplish this
programmatically before asking for the text frame height.

Any ideas on how to force a full layout and then prevent NSTextView from
further mucking with it?


___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Quincey Morris
On Dec 14, 2009, at 10:27, gMail.com wrote:

> if I compile this code against "32-bits Universal", it works.
> If I compile this code against "64-bit Intel", it doesn't work.
> I get a bad access error just on memcpy. What do I miss? I use:
> 
>Base SDK 10.6
>i386 ppc ppc64 ppc7400 ppc970 x86_64
>GCC 4.2 or 4.0
>Target Mac OS X 10.6
>Active Architecture x86_64
> 
> - (void)LoadImageData:(NSData*)imageData
>   pointer:(void*)handle
>   h:(GLuint)imageHeight
> {
>NSBitmapImageRep*bitmap = [[NSBitmapImageRep alloc]
>initWithData:imageData];
>int bytesPRow = [bitmap bytesPerRow];
>unsigned char*theImageData = [bitmap bitmapData];
>int rowNum;
> 
>for(rowNum = 0; rowNum < imageHeight; rowNum++){
>memcpy(handle + (rowNum * bytesPRow),
> theImageData + (rowNum * bytesPRow), bytesPRow);
>}
> 
>[bitmap release];
> }

This isn't a Cocoa question. You have a bug your code (most likely), and you 
need to debug it.

FWIW, I'd point out that you're exposing yourself to horrible problems with 
this code, since it lacks even the most fundamental sanity checks. What if the 
memory block pointed to by 'handle' is less than imageHeight*bytesPRow bytes? 
What if 'imageHeight' is greater than the number of rows in the image? You're 
not even going to check those things??


___

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

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

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

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


Re: NSMutableAttributedString & Links color

2009-12-14 Thread Ross Carter
On Dec 13, 2009, at 8:55 PM, PCWiz wrote:

> Hi,
> 
> I am, for lack of a better word, "enabling" links in my 
> NSMutableAttributedString by applying the NSLinkAttributeName attribute to 
> them, and I'm changing their color from the default blue to a different color 
> using NSForegroundColorAttributeName. This all works fine. The only issue: 
> When you actually *click* on the link, it goes back to that default blue with 
> underline style.
> 
> Is there any way to change this?

NSTextView -setLinkTextAttributes:
___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Mike Abdullah
Have you read the 64 bit transition guide? 
http://developer.apple.com/mac/library/DOCUMENTATION/Cocoa/Conceptual/Cocoa64BitGuide/Introduction/Introduction.html
Your question (use of int) suggests not.

On 14 Dec 2009, at 18:27, gMail.com wrote:

> Hi,
> if I compile this code against "32-bits Universal", it works.
> If I compile this code against "64-bit Intel", it doesn't work.
> I get a bad access error just on memcpy. What do I miss? I use:
> 
>Base SDK 10.6
>i386 ppc ppc64 ppc7400 ppc970 x86_64
>GCC 4.2 or 4.0
>Target Mac OS X 10.6
>Active Architecture x86_64
> 
> - (void)LoadImageData:(NSData*)imageData
>   pointer:(void*)handle
>   h:(GLuint)imageHeight
> {
>NSBitmapImageRep*bitmap = [[NSBitmapImageRep alloc]
>initWithData:imageData];
>int bytesPRow = [bitmap bytesPerRow];
>unsigned char*theImageData = [bitmap bitmapData];
>int rowNum;
> 
>for(rowNum = 0; rowNum < imageHeight; rowNum++){
>memcpy(handle + (rowNum * bytesPRow),
> theImageData + (rowNum * bytesPRow), bytesPRow);
>}
> 
>[bitmap release];
> }
> 
> 
> Best Regards
> -- 
> Leonardo
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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 cocoa...@mikeabdullah.net

___

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

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

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

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


Re: memcpy with 64 bit

2009-12-14 Thread Hank Heijink (Mailinglists)
On Dec 14, 2009, at 1:27 PM, gMail.com wrote:

> Hi,
> if I compile this code against "32-bits Universal", it works.
> If I compile this code against "64-bit Intel", it doesn't work.
> I get a bad access error just on memcpy. What do I miss? I use:
> 
>Base SDK 10.6
>i386 ppc ppc64 ppc7400 ppc970 x86_64
>GCC 4.2 or 4.0
>Target Mac OS X 10.6
>Active Architecture x86_64
> 
> - (void)LoadImageData:(NSData*)imageData
>   pointer:(void*)handle
>   h:(GLuint)imageHeight
> {
>NSBitmapImageRep*bitmap = [[NSBitmapImageRep alloc]
>initWithData:imageData];
>int bytesPRow = [bitmap bytesPerRow];
>unsigned char*theImageData = [bitmap bitmapData];
>int rowNum;
> 
>for(rowNum = 0; rowNum < imageHeight; rowNum++){
>memcpy(handle + (rowNum * bytesPRow),
> theImageData + (rowNum * bytesPRow), bytesPRow);
>}
> 
>[bitmap release];
> }

How did you allocate handle? Any chance you're allocating enough memory for 
32-bit values, but not for 64-bit ones?

Hank

___

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

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

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

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


Re: water effect on iPhone with touch methods

2009-12-14 Thread David Duncan
On Dec 11, 2009, at 6:45 PM, Chunk 1978 wrote:

> i haven't yet started to study OpenGL, but i just came across a java
> sample online that creates a water effect, and the sample code was
> surprisingly quite small.
> 
> here is the java example:  http://www.neilwallis.com/java/water.html
> 
> essentially, i'd like to replicate this, or something similar, using a
> UIImage and touch methods.  how difficult will this be?


You probably can't do this in realtime with a UIImageView on current devices 
(unless your image was very small). You would probably need to use OpenGL ES.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Jean-Daniel Dupas

Le 14 déc. 2009 à 19:13, Sean McBride a écrit :

> On 12/12/09 11:12 PM, Jerry Krinock said:
> 
>> Working on a Core Data document-based app.  Executing the following
>> AppleScript:
>> 
>> tell application "MyApp"
>>  open POSIX file "/path/to/SomeDocument"
>> end tell
>> 
>> results in program receiving signal EXC_BAD_ACCESS here
> 
> This works in my NSPersistentDocument-based app.  Like you, I have no
> particular AppleScript support.  Have you tried with a fresh app built
> from stationary?

Which OS version ?  
On 10.5 there was a bug that cause this kind of crash if the sdef file 
specified in the Info.plist does not exists.
I didn't try on last 10.5 releases but look like it is fixed on 10.6.


-- Jean-Daniel




___

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

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

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

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


memcpy with 64 bit

2009-12-14 Thread gMail.com
Hi,
if I compile this code against "32-bits Universal", it works.
If I compile this code against "64-bit Intel", it doesn't work.
I get a bad access error just on memcpy. What do I miss? I use:

Base SDK 10.6
i386 ppc ppc64 ppc7400 ppc970 x86_64
GCC 4.2 or 4.0
Target Mac OS X 10.6
Active Architecture x86_64

- (void)LoadImageData:(NSData*)imageData
   pointer:(void*)handle
   h:(GLuint)imageHeight
{
NSBitmapImageRep*bitmap = [[NSBitmapImageRep alloc]
initWithData:imageData];
int bytesPRow = [bitmap bytesPerRow];
unsigned char*theImageData = [bitmap bitmapData];
int rowNum;

for(rowNum = 0; rowNum < imageHeight; rowNum++){
memcpy(handle + (rowNum * bytesPRow),
 theImageData + (rowNum * bytesPRow), bytesPRow);
}

[bitmap release];
}


Best Regards
-- 
Leonardo


___

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

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

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

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


Re: Crash when 'open POSIX file /..' from AppleScript

2009-12-14 Thread Sean McBride
On 12/12/09 11:12 PM, Jerry Krinock said:

>Working on a Core Data document-based app.  Executing the following
>AppleScript:
>
>tell application "MyApp"
>   open POSIX file "/path/to/SomeDocument"
>end tell
>
>results in program receiving signal EXC_BAD_ACCESS here

This works in my NSPersistentDocument-based app.  Like you, I have no
particular AppleScript support.  Have you tried with a fresh app built
from stationary?

--

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


___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
And indeed, your plist is broken. CFBundleDisplayName should be a string not
an array. It seems that what is "CFBundleDisplayName" should be
"CFBundleDocumentTypes".

-- 
Julien

On Mon, Dec 14, 2009 at 3:29 PM, Joe The Programmer <
joetheappleprogram...@gmail.com> wrote:

>
> On Dec 14, 2009, at 4:28 AM, Julien Jalon wrote:
>
> > It's not necessarily a memory management problem. As this happens very
> early in the application launch, when Launch Services uses your Info.plist
> to register the application, your problem might also be that an entry
> supposed to be a string is in fact an array.
>
> Yes, that's why I was thinking resource.  As far as I can remember, I
> didn't touch the plist file going from Xcode 2.5 to 3.2.1.  However, I
> noticed a new key, CFBundleDisplayName, in my 3.2.1 info.plist file.  I'm
> not too familiar with the make up of a plist file.  Did the format of the
> info.plist change between versions?   Regardless, there seems to be an
> erroneous  in there.  Perhaps something got mangled along the way
> from 2.5 to 3.2.1?  I need to bone up on info.plist.  Thanks.
>
>CFBundleDisplayName
>
>
>CFBundleTypeExtensions
>
>tsk
>TSK
>
>CFBundleTypeIconFile
>tsk.icns
>CFBundleTypeMIMETypes
>
>application/tsk
>
>CFBundleTypeName
>TSK Document
>CFBundleTypeOSTypes
>
>tsk 
>TSK 
>
>CFBundleTypeRole
>Viewer
>LSTypeIsPackage
>
>NSPersistentStoreTypeKey
>JSON
>
>
>
>
___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joar Wingfors

On 13 dec 2009, at 23.06, Joar Wingfors wrote:

>> Two occurrences of the following massage are appearing in the console:
>> -[NSCFArray _getCString:maxLength:encoding:]: unrecognized selector sent to 
>> instance 0x4016e0
> 
> That's almost certainly an indication of a memory management error in your 
> application. If you're not using Garbage Collection in your app, I'd suggest 
> that you troubleshoot this using zombies. Search for "NSZombieEnabled" to 
> find help on how you employ their assistance.


I forgot to mention that Instruments now provide a way for you to catch errors 
using zombies. This would be the easiest way to catch the problem, and to 
figure out where the object came from (since Instruments can show where the 
zombie was allocated).

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


Re: Problem with mouse events in a custom NSControl subclass

2009-12-14 Thread Stephen Blinkhorn

On 11 Dec 2009, at 17:57, Stephen Blinkhorn wrote:

I'm writing the Cocoa GUI for an audio unit plugin and I've run into  
a problem.  In one host app I'm not receiving mouse events in my  
custom sliders/buttons etc.  My drop down menus work fine but they  
are subclasses of NSPopUpMenu and NSPopUpMenuCell.  The sliders are  
just NSControl subclasses.  If I click on a text field then the  
containing window gets the focus and all my controls work as  
expected.  I think the host should be setting the containing  
window's focus but it isn't and other plugins work ok in that host.


instead of doing this:

-(BOOL)acceptsFirstMouse {
return YES;
}

try doing this:

-(BOOL)acceptsFirstMouse:(NSEvent*)event {
[[event window] makeKeyAndOrderFront:nil];
return YES;
}

Thanks,
Stephen

___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer

On Dec 14, 2009, at 4:28 AM, Julien Jalon wrote:

> It's not necessarily a memory management problem. As this happens very early 
> in the application launch, when Launch Services uses your Info.plist to 
> register the application, your problem might also be that an entry supposed 
> to be a string is in fact an array.

Yes, that's why I was thinking resource.  As far as I can remember, I didn't 
touch the plist file going from Xcode 2.5 to 3.2.1.  However, I noticed a new 
key, CFBundleDisplayName, in my 3.2.1 info.plist file.  I'm not too familiar 
with the make up of a plist file.  Did the format of the info.plist change 
between versions?   Regardless, there seems to be an erroneous  in 
there.  Perhaps something got mangled along the way from 2.5 to 3.2.1?  I need 
to bone up on info.plist.  Thanks.
 
CFBundleDisplayName


CFBundleTypeExtensions

tsk
TSK

CFBundleTypeIconFile
tsk.icns
CFBundleTypeMIMETypes

application/tsk

CFBundleTypeName
TSK Document
CFBundleTypeOSTypes

tsk 
TSK 

CFBundleTypeRole
Viewer
LSTypeIsPackage

NSPersistentStoreTypeKey
JSON



___

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

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

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

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


Re: Core Data Save As Binary Error

2009-12-14 Thread Richard Somers

On Dec 14, 2009, at 5:48 AM, Kiran Kumar S wrote:


Have you changed the storetype  to binary in info.plist file


The info.plist file (used for development) currently has four document  
types, default, binary, sqlite, and xml. I started with the apple  
template which has the three document types (binary, sqlite, and xml)  
and then added a fourth.


--Richard

___

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

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

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

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


Re: Core Data Save As Binary Error

2009-12-14 Thread Kiran Kumar S


Have you changed the storetype  to binary in info.plist file


Regards
SKiran


On 14-Dec-09, at 6:11 PM, Richard Somers wrote:


I have a Core Data document based application.

Saving the file as XML or SQLite works fine.

Saving as binary results in an error: *** -[NSKeyedArchiver  
encodeValueOfObjCType:at:]: this archiver cannot encode structs.


The struct in question is a transformable attribute using a custom  
value transformer.


- (id)transformedValue:(id)value
{
 return [NSArchiver archivedDataWithRootObject:value];
}

No where in my code do I call NSKeyedArchiver.

Why does the core data framework work fine saving as XML or SQLite  
but not binary?


--Richard

___

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

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

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

This email sent to kirankuma...@prithvisolutions.com



___

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

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

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

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


Re: Sorted Table Column

2009-12-14 Thread Gerriet M. Denkmann

On 14 Dec 2009, at 18:09, Graham Cox wrote:

> 
> On 14/12/2009, at 10:00 PM, Graham Cox wrote:
> 
>> 
>> On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote:
>> 
>>> I have an NSTableView with just one column, filled by some 
>>> NSArrayController.
>>> 
>>> Initially the items are not in any recognizable order.
>>> When I click on the NSTableHeaderView a triangle appears and now the items 
>>> are nicely sorted.
>>> 
>>> Is it possible (either in InterfaceBuilder or programmatically) to make the 
>>> NSTableColumn start with this sorted behaviour?
>> 
>> 
>> In your -awakeFromNib method, pass the sortDescriptors from the table view 
>> to the array controller.
> 
> 
> I think I got that wrong - this is what I do (for example) in most of my 
> table views to establish an initial sorting. With NSArrayController, I'm not 
> sure if you need to explicitly pass the sortDescriptors also to that or 
> whether it gets them anyway through bindings.
> 
>   NSTableColumn* col = [mMetaTableView tableColumnWithIdentifier:@"key"];
>   [mMetaTableView setSortDescriptors:[NSArray arrayWithObject:[col 
> sortDescriptorPrototype]]];

I added your code into windowControllerDidLoadNib: and it works perfectly.
Thank you very much!
I would never come up with this idea on my own.

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


Core Data Save As Binary Error

2009-12-14 Thread Richard Somers

I have a Core Data document based application.

Saving the file as XML or SQLite works fine.

Saving as binary results in an error: *** -[NSKeyedArchiver  
encodeValueOfObjCType:at:]: this archiver cannot encode structs.


The struct in question is a transformable attribute using a custom  
value transformer.


 - (id)transformedValue:(id)value
 {
  return [NSArchiver archivedDataWithRootObject:value];
 }

No where in my code do I call NSKeyedArchiver.

Why does the core data framework work fine saving as XML or SQLite but  
not binary?


--Richard

___

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

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

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

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


Diacritics in Thai

2009-12-14 Thread Gerriet M. Denkmann

When I use rangeOfString: options with  NSDiacriticInsensitiveSearch not only 
the tone marks are ignored, but also some vowels.

Same problem with NSPredicate  "someKey =[d]  someValue".

It is true that in unicode-speak both the tone marks and the ignored vowels are 
categorized as Nonspacing_Mark.

So: is this a bug (eventually to be fixed) or a feature, which all users of the 
Thai language have to find some workaround themselves?


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


Practicality of memory debugging idea?

2009-12-14 Thread Graham Cox
Hi all, just throwing this one out there, see if it's worth anything.

I'm having a problem tracking down a very elusive memory management bug. It's a 
simple over-release, somewhere, but extremely rarely. The problem is that the 
only reports I've had of it so far are field reports indicating a crash on 
-release sent to a freed object from the cyclic autorelease pool drain. That 
means all trace of what the object was or where it came from has gone.

I'm wondering if there's any way I can do something like checking in -dealloc 
if my object is sitting in an autorelease pool anywhere, and if so flag that as 
a over-release-bug-yet-to-come. If feasible, I'm also wondering whether it 
would be worth suggesting this to Apple as a useful debugging flag that could 
be built-in at a low level like zombies are.

Thoughts?

--Graham


___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
It's not necessarily a memory management problem. As this happens very early
in the application launch, when Launch Services uses your Info.plist to
register the application, your problem might also be that an entry supposed
to be a string is in fact an array.

On Mon, Dec 14, 2009 at 9:09 AM, Joe The Programmer <
joetheappleprogram...@gmail.com> wrote:

> On Dec 14, 2009, at 12:52 AM, Kyle Sluder wrote:
>
> > Turning on GC is not the solution to your problem.  Fixing your memory
> > management bugs is the solution.
>
> On Dec 14, 2009, at 12:54 AM, Joar Wingfors wrote:
>
> > For a trivial app it might be. For anything else, it would not be. GC and
> RC are fundamentally different memory management models, and converting an
> existing code base is never easy. You should not attempt it before you
> understand how GC and RC differs, before you've read up on how GC is
> supported in ObjC & Cocoa, etc.
>
> Understood.  I'll have a good read.  Thanks.
>
> Could this memory management issue have existed even when this project was
> being built with Xcode 2.5 and the 10.4 SDK, or is it something that was
> introduced to build with Xcode
> 3.2.1?___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to jja...@gmail.com
>
___

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

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

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

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


Re: Sorted Table Column

2009-12-14 Thread Graham Cox

On 14/12/2009, at 10:00 PM, Graham Cox wrote:

> 
> On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote:
> 
>> I have an NSTableView with just one column, filled by some NSArrayController.
>> 
>> Initially the items are not in any recognizable order.
>> When I click on the NSTableHeaderView a triangle appears and now the items 
>> are nicely sorted.
>> 
>> Is it possible (either in InterfaceBuilder or programmatically) to make the 
>> NSTableColumn start with this sorted behaviour?
> 
> 
> In your -awakeFromNib method, pass the sortDescriptors from the table view to 
> the array controller.


I think I got that wrong - this is what I do (for example) in most of my table 
views to establish an initial sorting. With NSArrayController, I'm not sure if 
you need to explicitly pass the sortDescriptors also to that or whether it gets 
them anyway through bindings.

NSTableColumn* col = [mMetaTableView tableColumnWithIdentifier:@"key"];
[mMetaTableView setSortDescriptors:[NSArray arrayWithObject:[col 
sortDescriptorPrototype]]];

--Graham


___

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

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

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

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


Re: Sorted Table Column

2009-12-14 Thread Graham Cox

On 14/12/2009, at 9:56 PM, Gerriet M. Denkmann wrote:

> I have an NSTableView with just one column, filled by some NSArrayController.
> 
> Initially the items are not in any recognizable order.
> When I click on the NSTableHeaderView a triangle appears and now the items 
> are nicely sorted.
> 
> Is it possible (either in InterfaceBuilder or programmatically) to make the 
> NSTableColumn start with this sorted behaviour?


In your -awakeFromNib method, pass the sortDescriptors from the table view to 
the array controller.

--Graham


___

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

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

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

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


Sorted Table Column

2009-12-14 Thread Gerriet M. Denkmann
I have an NSTableView with just one column, filled by some NSArrayController.

Initially the items are not in any recognizable order.
When I click on the NSTableHeaderView a triangle appears and now the items are 
nicely sorted.

Is it possible (either in InterfaceBuilder or programmatically) to make the 
NSTableColumn start with this sorted behaviour?

10.6.2

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Joe The Programmer
On Dec 14, 2009, at 12:52 AM, Kyle Sluder wrote:

> Turning on GC is not the solution to your problem.  Fixing your memory
> management bugs is the solution.

On Dec 14, 2009, at 12:54 AM, Joar Wingfors wrote:

> For a trivial app it might be. For anything else, it would not be. GC and RC 
> are fundamentally different memory management models, and converting an 
> existing code base is never easy. You should not attempt it before you 
> understand how GC and RC differs, before you've read up on how GC is 
> supported in ObjC & Cocoa, etc.

Understood.  I'll have a good read.  Thanks.

Could this memory management issue have existed even when this project was 
being built with Xcode 2.5 and the 10.4 SDK, or is it something that was 
introduced to build with Xcode 
3.2.1?___

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

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

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

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