Building 64 bit apps in XCode?

2009-08-20 Thread Duncan Champney
How do you get XCode to generate 32/64 bit PPC/Intel 4-way universal  
apps?


(I need to know both under 10.5 and under 10.6, for an app targeted to  
>= 10.5)


There is an item in the project menu>edit project settings, under the  
build tab that SHOULD do this.


It is the second item in the list, "architectures".  If I choose 32/64  
bit universal, it SHOULD generate a 64 bit able application. However,  
it does not. If I run my app under 10.6, the 10.6 Activity Monitor app  
tells me which apps are 64 bit, and my app does NOT show up as 64 bit.


What am I missing?

I am not an expert on XCode's build settings, by any means. I use the  
GUI, and don't know much about setting build flags, compiler  
variables, etc. I need "moron instructions". I have looked in the  
documentation, and can't find anything helpful.


Can somebody take pity on me and walk me through this?

Thanks in advance,


Duncan Champney
WareTo LLC.
___

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

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

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

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


Re: Building 64 bit apps in XCode?

2009-08-20 Thread Nick Zitzmann


On Aug 20, 2009, at 5:12 PM, Duncan Champney wrote:

It is the second item in the list, "architectures".  If I choose  
32/64 bit universal, it SHOULD generate a 64 bit able application.  
However, it does not. If I run my app under 10.6, the 10.6 Activity  
Monitor app tells me which apps are 64 bit, and my app does NOT show  
up as 64 bit.


What am I missing?


We can't talk about 10.6 yet, but here's a non-NDA hint: Did you try  
changing your active architecture?


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: NSWindow and Spaces

2009-08-20 Thread Ken Thomases

On Aug 19, 2009, at 8:47 AM, MT wrote:

I've got a problem with my app, some of the windows do not behave  
correctly

with 'Spaces', I've narrowed it down to this...

If the window is backed by an NSDocument, it behaves correctly, i.e.  
if this
window is active within the application, when the user clicks on the  
dock

icon, the Space will be switched automatically.

If the window is *NOT* NSDocument based, the Space does not get  
switched

automatically.

I've tried the setCollectionBehaviour: method, but it's doesn't make  
any

difference. How can I make the window behave like NSDoc ones?


Is your window configured so that it can become main?  What about  
key?  You could experiment with those to see if they change the  
behavior of Spaces.


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: Building 64 bit apps in XCode?

2009-08-20 Thread Greg Parker

On Aug 20, 2009, at 4:12 PM, Duncan Champney wrote:
How do you get XCode to generate 32/64 bit PPC/Intel 4-way universal  
apps?


(I need to know both under 10.5 and under 10.6, for an app targeted  
to >= 10.5)


There is an item in the project menu>edit project settings, under  
the build tab that SHOULD do this.


It is the second item in the list, "architectures".  If I choose  
32/64 bit universal, it SHOULD generate a 64 bit able application.  
However, it does not. If I run my app under 10.6, the 10.6 Activity  
Monitor app tells me which apps are 64 bit, and my app does NOT show  
up as 64 bit.


By default, the Debug configuration builds the "active" architecture  
only, and the Release configuration builds them all. (Why? Faster  
build times.) I'd guess you're building Debug with the active  
architecture set to 32-bit.


You can use Build > Set Active Architecture to switch to 64-bit for  
Debug, or you can turn off Build Active Architecture Only in your  
project settings.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: How to create an interface without interface builder

2009-08-20 Thread vinai
Check:

http://lapcatsoftware.com/blog/?s=%22working+without+a+nib

for tips on getting around using NIBs and XIBs.

--- On Thu, 8/20/09, Jonathan Chacón  wrote:

> From: Jonathan Chacón 
> Subject: How to create an interface without interface builder
> To: "Apple Cocoa Develop" 
> Date: Thursday, August 20, 2009, 1:39 PM
> > Hello,
> > 
> > I'm a blind developer and I'm studing Cocoa and
> ObjetiveC.
> > All documentation I found uses interface builder to
> add controls to the window.
> > Does anybody know any sample or tutorial to create
> interfaces using objetiveC without interface bulder?
> > 
> > 
> > thanks and regards
> > Jonathan Chacón
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to
> the list.
> Contact the moderators at
> cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/for_usenet%40yahoo.com
> 
> This email sent to for_use...@yahoo.com
> 



___

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

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

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

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


Re: How to reference to objects laid in external xibs in Interface Builder?

2009-08-20 Thread DairyKnight
I think you didn't understand my question. I want to create a window, lay a
view in it, and the view objectis put in another xib file.



On Fri, Aug 21, 2009 at 5:38 AM, Sean Kline  wrote:

> Just select File->New File...->(IPhone OS)User Interface
> - S
>
> On Thu, Aug 20, 2009 at 6:06 AM, DairyKnight wrote:
>
>> I'm wondering if there's a way to make an xib like the one auto-generated
>> by
>> XCode for iPhone apps. In the main window, there's a
>> grayed area showing 'Loaded from .xib' and if you click on the link
>> inside the area, IB will open the corresponding xib file for you.
>>
>>
>> Anyone knows how? Thanks.
>>
>>
>> Regards,
>> DairyKnight
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/skline1967%40gmail.com
>>
>> This email sent to skline1...@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: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> OK, so this discussion is getting a little crazy :-)

Agreed.

> The -hash method is important for objects that are used as keys in
> associative collections.
> [snip]
> So, in practice, it's perfectly safe in 99.9% of cases to base your
> hash off your object's properties.  In the specific case when you're
> mutating objects that are keys in associative collections
> (NSDictionary and NSSet being the primary examples, along with their
> CoreFoundation counterparts) ...

Is there any way that you can tell that some higher-level technology you are 
using (CoreData?) is putting your objects into an NSSet?  That's presumably a 
hidden implementation detail which you can't assume one way or the other with 
any safety?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Scott Ribe
> Anyone have any code I can use to do this?

*(char*)0 = 0;

-- 
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: When do I need to override hash?

2009-08-20 Thread Seth Willits

On Aug 20, 2009, at 2:31 PM, Alastair Houghton wrote:

The -hash method is important for objects that are used as keys in  
associative collections.  So the worry about the hash value changing  
when an object's properties are altered is a bit of a red herring,  
because you *aren't supposed to change keys in associative  
collections*.  If you do that in just about *any* implementation,  
ObjC or otherwise, you'll get undefined behaviour.


So, in practice, it's perfectly safe in 99.9% of cases to base your  
hash off your object's properties.  In the specific case when you're  
mutating objects that are keys in associative collections  
(NSDictionary and NSSet being the primary examples, along with their  
CoreFoundation counterparts), if you change a property that affects  
*either* -isEqualTo: *or* -hash, you need to remove the object  
before mutating it and then add it back again afterwards.



The documentation, nor did many others' comments on this topic, make  
it clear that the mutability is only a problem for the *keys*. Others  
and the docs talk about (paraphrasing) "putting an object into a  
collection", not "using an object as a key in an associative  
collection."


Here are the docs:

"If a mutable object is added to a collection that uses hash values to  
determine the object’s position in the collection, the value returned  
by the hash method of the object must not change while the object is  
in the collection."



If I follow this sentence, it says that if I put a (mutable string)  
into a (dictionary), the value returned by the -hash method of (the  
string) must not change while it's in the collection. It does *not*  
say that the hash method of the *KEY* can't change, it says the hash  
value of the object stored in the collection. Now maybe this is worded  
really poorly, but I think this is where the confusion comes from. It  
seems to be in direct contradiction to what you're saying.



If it were only an issue for keys, then this is, like you said, no big  
deal. If my reading of the documentation is correct, then it's a much  
more prevalent problem, as others seem to be saying.



--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Ben Trumbull

The -hash method is important for objects that are used as keys in
associative collections.
[snip]
So, in practice, it's perfectly safe in 99.9% of cases to base your
hash off your object's properties.  In the specific case when you're
mutating objects that are keys in associative collections
(NSDictionary and NSSet being the primary examples, along with their
CoreFoundation counterparts) ...


Is there any way that you can tell that some higher-level technology  
you are using (CoreData?) is putting your objects into an NSSet?   
That's presumably a hidden implementation detail which you can't  
assume one way or the other with any safety?


Core Data plays by the same rules as everyone else regarding -hash, - 
isEqual and Cocoa collection classes.  Every pair of objects that  
return YES from -isEqual must return the same -hash result.


Core Data doesn't use random objects as keys in dictionaries or sets  
for this reason.  It's not that we don't trust you, but ...  to  
prevent misunderstandings, all NSManagedObject subclasses are  
forbidden from overriding -hash and -isEqual.  Since NSManagedObjects  
have very specific semantic meanings associated with -isEqual and  
[[self objectID] isEqual:] no good could come of it anyway.


If you need to know whether or not another object has put your object  
into an NSDictionary, you're probably doing something wrong.  Do you  
have a specific concern about Core Data using your objects ?


- Ben

___

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

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

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

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


Editable NSTextFieldCell with clickable button?

2009-08-20 Thread Seth Willits


Anyone have an editable text field cell with a clickable button? I'm  
thinking along the lines of a "go to" button next to the (editable)  
text, like the buttons in iTunes which take you to the album in the  
iTunes Store.


Trying to avoid reinventing the wheel :-)


Thanks,

--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> Core Data doesn't use random objects as keys in dictionaries or sets
> for this reason.  It's not that we don't trust you, but ...  to
> prevent misunderstandings, all NSManagedObject subclasses are
> forbidden from overriding -hash and -isEqual.

I have to admit, I didn't know this bit but I see it in the developer library 
along with a bunch of others.

> If you need to know whether or not another object has put your object
> into an NSDictionary, you're probably doing something wrong.  Do you
> have a specific concern about Core Data using your objects ?

No, I guess the point I was trying to make was that this discussion seemed to 
have touched on "if you put your objects into an NSSet then you'll need to be 
more careful about the implementation of -hash, etc".  I was trying to point 
out that just because my application code doesn't go anywhere near NSSet, its 
conceivable (to me) that Core Data (for example) might be storing dirty objects 
in an NSSet "behind your back". So you can't "not implement -hash, etc 
properly" and hope everything will work.

There may be any number of "external" technologies (Core Data was just an 
example) that may be using your objects in ways you aren't expecting, and 
there's no future-proof way you can cut corners.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Clark Cox
On Thu, Aug 20, 2009 at 9:09 PM, Jeff Laing wrote:
>> Core Data doesn't use random objects as keys in dictionaries or sets
>> for this reason.  It's not that we don't trust you, but ...  to
>> prevent misunderstandings, all NSManagedObject subclasses are
>> forbidden from overriding -hash and -isEqual.
>
> I have to admit, I didn't know this bit but I see it in the developer library 
> along with a bunch of others.
>
>> If you need to know whether or not another object has put your object
>> into an NSDictionary, you're probably doing something wrong.  Do you
>> have a specific concern about Core Data using your objects ?
>
> No, I guess the point I was trying to make was that this discussion seemed to 
> have touched on "if you put your objects into an NSSet then you'll need to be 
> more careful about the implementation of -hash, etc".  I was trying to point 
> out that just because my application code doesn't go anywhere near NSSet, its 
> conceivable (to me) that Core Data (for example) might be storing dirty 
> objects in an NSSet "behind your back". So you can't "not implement -hash, 
> etc properly" and hope everything will work.

The solution is simple:

If you implement -hash, you must implement -isEqual:
If you implement -isEqual:, you must implement -hash
If -isEqual: returns true for two given objects, those objects must
return the same value for -hash

If you don't implement either, NSObject's implementations are fine
also. i.e. NSObjects implementations are basically:

-(NSUInteger)hash { return (NSUInteger) self; }
-(BOOL)isEqual:(id)obj { return self == obj; }

-- 
Clark S. Cox III
clarkc...@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: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image

2009-08-20 Thread Adam R. Maxwell


On Aug 20, 2009, at 2:31 PM, Ben Lachman wrote:

This works pretty well, although I do seem to get a white area where  
there would have been a scroller on the right hand side.


Interesting; I hadn't noticed that because of the white border I use.   
Drawing the WebView itself seems to fix that problem.


The problem still is that you can't really grab an arbitrary rect of  
the rendered canvas which was my hope when accessing the  
documentView directly.


I tried messing around with the documentView and saw similar problems  
to what you described.  If you want an arbitrary rect, I'd guess you  
could create a bitmap at the full size of the view and draw it, then  
crop that bitmap.  Or maybe get the [documentView enclosingScrollView]  
and mess with that.





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: When do I need to override hash?

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 20:51, Seth Willits wrote:


On Aug 20, 2009, at 2:31 PM, Alastair Houghton wrote:

The -hash method is important for objects that are used as keys in  
associative collections.  So the worry about the hash value  
changing when an object's properties are altered is a bit of a red  
herring, because you *aren't supposed to change keys in associative  
collections*.  If you do that in just about *any* implementation,  
ObjC or otherwise, you'll get undefined behaviour.


So, in practice, it's perfectly safe in 99.9% of cases to base your  
hash off your object's properties.  In the specific case when  
you're mutating objects that are keys in associative collections  
(NSDictionary and NSSet being the primary examples, along with  
their CoreFoundation counterparts), if you change a property that  
affects *either* -isEqualTo: *or* -hash, you need to remove the  
object before mutating it and then add it back again afterwards.



The documentation, nor did many others' comments on this topic, make  
it clear that the mutability is only a problem for the *keys*.  
Others and the docs talk about (paraphrasing) "putting an object  
into a collection", not "using an object as a key in an associative  
collection."


Yes. I believe Alastair misspoke.

What he said is actually 99.9% true, but establishes a different  
point. The keys in a dictionary (or other keyed collection, like a map  
table) need to be immutable objects, but that's unrelated to the hash.  
Mutability in the keys would be bad, hash or no hash.


Separately, keyed collections use isEqual: on the keys to determine  
equality, so they need the isEqual:/hash to follow the rules. (Because  
the rules imply they can short-circuit some potentially expensive  
isEqual: invocations by trying fast hash comparison first. Whether  
they do that is an implementation detail we don't know.)


Separately, keyed collections may (and presumably do) use *key* hash  
values to distribute object values in memory. (Presumably, the key  
hashes may also be used to distribute key values in memory. That's an  
implementation detail we don't know.)


Separately, collections use isEqual: on the object values to determine  
equality, when they care. (I doubt that NSDictionary cares about  
object value equality, but NSSet certainly does, as does NSArray, when  
asked to compare objects.)


Separately, collections may (and presumably sometimes do) use *object*  
hash values to distribute objects in memory. (Obviously, NSSet does,  
and for all we know NSDictionary does too, to distribute object values  
that stored under the same key hash value -- though it would be an  
implementation detail.)


So object values must also follow the isEqual:/hash rules.

So AFAIK your reading of the documentation is absolutely correct.  
Object values cannot be mutated while in a collection, unless their  
hash value doesn't depend on the mutated properties. Key values cannot  
be mutated while used in a collection, period.


[Actually, for all I know, key values *can* be mutated while used in a  
collection, provided the hash value doesn't change, but even if it  
technically feasible it sounds so un-useful I'd argue it's better just  
to assert that it's not allowed.]


As far as the rest of this thread is concerned, I'd suggest we pay  
attention to what Clark Cox has said and ignore everything else. Of  
all our posts here today, he's the only one who's been *both* correct  
*and* brief simultaneously. :)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> Separately, collections may (and presumably sometimes do) use *object*
> hash values to distribute objects in memory. (Obviously, NSSet does,
> and for all we know NSDictionary does too, to distribute object values
> that stored under the same key hash value -- though it would be an
> implementation detail.)

Without wanting to keep the thread going forever, can I just ask why we would 
presume this?

In fact, if I were implementing NSDictionary I'd assume the reverse, that I was 
not allowed to assume that an objects hash would not change.

Is there some documentation on this restriction on the types of objects that 
can be put into an NSDictionary?

I can see the NSSet dictates that objects must implement hash and isEqual: but 
NSDictionary only says that "internally a dictionary uses a hash table" - there 
are limits on the keys, which must conform to NSCopying,etc but I can't see 
anything about the values.

Surely using an NSSet as bucket storage, for all objects whose keys hash to the 
same value, would add additional restrictions to NSDictionary that should be 
documented?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Adam R. Maxwell


On Aug 20, 2009, at 9:44 PM, Quincey Morris wrote:

The keys in a dictionary (or other keyed collection, like a map  
table) need to be immutable objects, but that's unrelated to the  
hash. Mutability in the keys would be bad, hash or no hash.


What do you mean by immutable?  You can put a "mutable" object in a  
hashing collection as long as its -hash and -isEqual: do not depend on  
mutable state.  For instance, if you configure a CFDictionary to use  
pointer equality and hash for its keys, you can use an NSMutableString  
as a key.


[...]

Separately, collections use isEqual: on the object values to  
determine equality, when they care. (I doubt that NSDictionary cares  
about object value equality, but NSSet certainly does, as does  
NSArray, when asked to compare objects.)


Separately, collections may (and presumably sometimes do) use  
*object* hash values to distribute objects in memory. (Obviously,  
NSSet does, and for all we know NSDictionary does too, to distribute  
object values that stored under the same key hash value -- though it  
would be an implementation detail.)


I use NSMutableStrings as values (not keys) in NSDictionary and expect  
that to work, even though hash/isEqual: of those strings is certainly  
changing while in the collection.  CFDictionary at least doesn't  
include a hash function in its value callback, although it does  
require an equality function.  From my quick look at the source, the  
only place that equality callback is used is in testing CFEqual(dict1,  
dict2), CFDictionaryGetCountOfValue(), and CFDictionaryContainsValue().





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: When do I need to override hash?

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 22:05, Jeff Laing wrote:

Without wanting to keep the thread going forever, can I just ask why  
we would presume this?


In fact, if I were implementing NSDictionary I'd assume the reverse,  
that I was not allowed to assume that an objects hash would not  
change.


Is there some documentation on this restriction on the types of  
objects that can be put into an NSDictionary?


Seth explicitly quoted the documentation of this restriction in the  
post to which I replied:


(This is from the documentation for 'hash'.)

"If a mutable object is added to a collection that uses hash values  
to determine the object’s position in the collection, the value  
returned by the hash method of the object must not change while the  
object is in the collection."


It is absolutely possible that NSDictionary does not use hash values  
"to determine the object's position in the collection" and so would be  
exempt from the above restriction.


It's also possible (maybe even likely) that NSArray doesn't use hash  
values "to determine the object's position in the collection".


So, now that you mention it, I guess we don't know for sure which  
collections do and do not depend on hash values for this purpose.  
(It's certainly conceivable that both NSDictionary and NSArray do use  
object hash values to manage their internal storage, perhaps only for  
very large collections.) Sounds like something that ought to be  
documented explicitly somewhere.


In practice, it's not of general concern, because it doesn't seem  
generally useful to have objects that are safely collectable only in  
certain kinds of collections. For those specific cases where you had  
mutable objects with "unstable" hash values, you'd have to choose and  
bet on your interpretation of which collections it was safe to use.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Ben Trumbull


On Aug 20, 2009, at 9:09 PM, Jeff Laing wrote:


If you need to know whether or not another object has put your object
into an NSDictionary, you're probably doing something wrong.  Do you
have a specific concern about Core Data using your objects ?


No, I guess the point I was trying to make was that this discussion  
seemed to have touched on "if you put your objects into an NSSet  
then you'll need to be more careful about the implementation of - 
hash, etc".  I was trying to point out that just because my  
application code doesn't go anywhere near NSSet, its conceivable (to  
me) that Core Data (for example) might be storing dirty objects in  
an NSSet "behind your back". So you can't "not implement -hash, etc  
properly" and hope everything will work.


There may be any number of "external" technologies (Core Data was  
just an example) that may be using your objects in ways you aren't  
expecting, and there's no future-proof way you can cut corners.


There really isn't any point in cutting corners here.  If you need to  
do something unusual, you can use a CFDictionary with custom callbacks.


- Ben



___

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

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

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

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


Re: When do I need to override hash?

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 22:19, Adam R. Maxwell wrote:


On Aug 20, 2009, at 9:44 PM, Quincey Morris wrote:

The keys in a dictionary (or other keyed collection, like a map  
table) need to be immutable objects, but that's unrelated to the  
hash. Mutability in the keys would be bad, hash or no hash.


What do you mean by immutable?  You can put a "mutable" object in a  
hashing collection as long as its -hash and -isEqual: do not depend  
on mutable state. For instance, if you configure a CFDictionary to  
use pointer equality and hash for its keys, you can use an  
NSMutableString as a key.


First, I'm sorry, this time it was me who misspoke. Mutability of the  
key isn't the problem -- mutating the key is the problem.


Second, part of what I meant was kind of mundane -- if you mutate an  
object used as a key, you're likely to have trouble *finding* it again  
because ... the key changed. Obviously there are scenarios where you'd  
know what the mutated key was (e.g. you stored a pointer to the key  
somewhere, or it changed in a very controlled way), so it might be  
fine, but it sure sounds confusing.


Third, if you configure a CFDictionary to use pointer equality and  
hash for its keys, you're not really using a NSMutableString as a key,  
you're effectively using the object pointer as a key (which is itself  
an immutable entity) -- you've effectively abandoned the stringiness  
in regard to the keys.


Separately, collections use isEqual: on the object values to  
determine equality, when they care. (I doubt that NSDictionary  
cares about object value equality, but NSSet certainly does, as  
does NSArray, when asked to compare objects.)


Separately, collections may (and presumably sometimes do) use  
*object* hash values to distribute objects in memory. (Obviously,  
NSSet does, and for all we know NSDictionary does too, to  
distribute object values that stored under the same key hash value  
-- though it would be an implementation detail.)


I use NSMutableStrings as values (not keys) in NSDictionary and  
expect that to work, even though hash/isEqual: of those strings is  
certainly changing while in the collection.  CFDictionary at least  
doesn't include a hash function in its value callback, although it  
does require an equality function.  From my quick look at the  
source, the only place that equality callback is used is in testing  
CFEqual(dict1, dict2), CFDictionaryGetCountOfValue(), and  
CFDictionaryContainsValue().


I already got beaten up about this, and my answer is that it's not  
100% clear that it's always safe. It's not outside the bounds of  
possibility that a very large dictionary may use a different memory  
strategy that involves object hash values, though I agree it seems  
rather unlikely (and you've found further evidence against the idea).  
Seems like it ought to be documented, otherwise you're always going to  
be betting on your guess about the implementation.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Authorization Question (Possibly a simple POSIX question?)

2009-08-20 Thread Seth Willits


I'm looking at some code* in an app which uses a helper tool, in order  
to open and read the contents of a protected file. Normally the user  
does not have privileges to read this file, hence the authorization.  
Here's the process it goes through:



App:
AuthorizationCreate
AuthorizationCopyRights(my.right, PreAuthorize | ExtendRights)
AuthorizationMakeExternalForm
Create a pipe, fork, child does execle(path/to/tool)
Write the external form of the auth ref to the pipe the tool has open

Tool:
AuthorizationCreateFromExternalForm
AuthorizationCopyRights(my.right, ExtendRights)
descriptor = open(path/to/file, O_RDONLY)
Send the descriptor back to the app on the pipe
exit

App:
Gets the descriptor back from the tool
fdopen(descriptor)
... read from the file all it wants ...


I don't understand how the app allowed to use that file descriptor to  
read the file's contents. The tool is running as root, so it's obvious  
that it is able to open the file, but how can another process just  
start using that descriptor? Is it because it's the parent process? If  
so: I always thought that only worked the other way around - child  
processes could use *parent* process descriptors. If NOT, then what is  
it? The app only preauthorized some arbitrary right, it didn't  
actually get any privileges to open and read a protected file.




Thanks,

--
Seth Willits


* it's spaghetti and all over the place, so don't ask for 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: When do I need to override hash?

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 23:24, Adam R. Maxwell wrote:

It was not my intent to beat up on you, so I apologize if I came  
across that way!


Nah, I was just kidding -- and trying to distract your attention away  
from the fact that I didn't have a better answer.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Authorization Question (Possibly a simple POSIX question?)

2009-08-20 Thread Dave Keck
File descriptors can be passed between processes using the sendmsg() API.

If you have further questions about that, I'd suggest taking this
question to darwin-dev.

Here's some links:

http://devworld.apple.com/qa/qa2007/qa1541.html

http://topiks.org/mac-os-x/0321278542/ch09lev1sec11.html


http://books.google.com/books?id=K8vUkpOXhN4C&lpg=PA1149&ots=OJmfXVYvYy&dq=sendmsg%20descriptor%20passing%20%22os%20x%22&pg=PA1149#v=onepage&q=sendmsg%20descriptor%20passing%20%22os%20x%22&f=false
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


A simple DO situation - point me in the right direction!

2009-08-20 Thread Graham Cox
I need to implement a system where I can verify the number of running  
copies of my app on a local network against a site license. I thought  
DO might be a good way to implement this.


So what I'm thinking is the following. I'd appreciate it if someone  
with experience of DO could help me fill in a few details, like what  
objects and methods I might use. I have read the DO programming guide,  
but so far some of the concepts are not quite clear as I have little  
experience on network coding.


1. Each app has a server that vends an object that can supply info  
like the site license ID it is running under.


2. Each app sets up a client that can discover automatically all  
current servers above on the network.


3. The client asks each server for its site ID, and counts up those  
that match the current app's. If the count exceeds the license terms,  
the app quits. Actually this last step I'm probably pretty good with,  
it's the first two that I'm not so sure about.




So far:

For 1). I've read about vending an object, but I'm unclear whether  
[NSConnection defaultConnection] is adequate or whether I need to  
allocate NSSocketPorts or what. I'm also unsure what sort of string I  
should be using for names, and precisely what needs to be registered.  
Where are these names used, are they ever displayed to the user and  
how much effort do I need to put into ensuring they'd be unique on the  
network?


For 2). I can see how a single end-to-end remote object call works in  
general but in my case I have multiple servers all vending the same  
(or equivalent) object, and I need to interrogate them as a  
collection. I haven't come across anything so far in the docs that  
addresses this scenario. How do I get an enumeration of all  
appropriate servers?


Any sample code that is anything close to what I need would be  
gratefully received. It's also the case that once I know which classes  
I need to be looking at, the docs for those classes will probably give  
me much more to go on. I'm just lacking a roadmap that says which ones  
to look at and which ones are unsuitable.


Thanks for any help,

--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: devil of a time with an NSImageView

2009-08-20 Thread Jean-Daniel Dupas


Le 20 août 2009 à 01:13, I. Savant a écrit :


On Aug 19, 2009, at 6:49 PM, Jean-Daniel Dupas wrote:

You're probably calling setImage: before the nib is loaded (and so  
the outlet is connected).
You can force it to load by calling [aWindowController window]  
before trying to set the image.


 The standard practice is to start any nib-dependent startup stuff  
on -awakeFromNib ... forcing it to load seems dirty. :-)


 Does anybody know of the implications of this?



The -[NSWindowController loadWindow] methods says you can call - 
[NSWindowController window] to load the window, so I don't think it  
should be an issue..


Just a point, I think that in NSWindowController it may be better to  
initialize dependent stuff in -windowDidLoad, especially if you want  
to access the window object. I remember I encountered some issue using  
awakeFromNib some time ago  but don't remember exactly what it was.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


CFBundleVersion and CFBundleVersionShortString question

2009-08-20 Thread aaron smith
hey all,

I'm reading through some debugging stuff, and looking at this page
(http://developer.apple.com/technotes/tn2004/tn2123.html) about crash
reports.

This paragraph mentions them:

"CrashReporter gets the "Version" field from the process's executable.
If the process is a packaged application, the version is composed of
the CFBundleShortVersionString and CFBundleVersion properties from its
Info.plist file. If the process is single file application, the
version is derived from its 'vers' ID=1 resource."

In that example crash report, the version is "1.5 (244)". My question
is which one is which?

is CFBundleVersion = 1.5 or 244?
or is CFBundleVersionShortString = 1.5 or 244?

I would assume that 1.5 is CFBundleVersion. But I just would like to
double check.

My other question is, do they support anything other than numbers and
periods. For example, if the short string key is just some string
relating to version control, i'd like to be able to set it to a git
commit hash (the first ten chars).

Thanks much.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: CFBundleVersion and CFBundleVersionShortString question

2009-08-20 Thread aaron smith
whoops, I meant the "CFBundleShortVersionString" key.



On Thu, Aug 20, 2009 at 12:52 AM, aaron
smith wrote:
> hey all,
>
> I'm reading through some debugging stuff, and looking at this page
> (http://developer.apple.com/technotes/tn2004/tn2123.html) about crash
> reports.
>
> This paragraph mentions them:
>
> "CrashReporter gets the "Version" field from the process's executable.
> If the process is a packaged application, the version is composed of
> the CFBundleShortVersionString and CFBundleVersion properties from its
> Info.plist file. If the process is single file application, the
> version is derived from its 'vers' ID=1 resource."
>
> In that example crash report, the version is "1.5 (244)". My question
> is which one is which?
>
> is CFBundleVersion = 1.5 or 244?
> or is CFBundleVersionShortString = 1.5 or 244?
>
> I would assume that 1.5 is CFBundleVersion. But I just would like to
> double check.
>
> My other question is, do they support anything other than numbers and
> periods. For example, if the short string key is just some string
> relating to version control, i'd like to be able to set it to a git
> commit hash (the first ten chars).
>
> Thanks much.
>
___

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

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

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

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


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

2009-08-20 Thread Ruotger Skupin


Am 20.08.2009 um 04:38 schrieb M Pulis:


I got that, Bill, thank you.

The OP did not specify what particular sql store (we still do NOT  
know) nor if he is compiled Universal, has any helper programs, etc,  
he did however, describe symptoms I have seen with Rosetta. So I  
simply proposed checking that no PPC code was being engaged. Simple  
to do.




For the record: I compiled Universal (debug version: Intel-only) 32bit- 
only. No helper programs. So it's pretty save to say, I'm not using  
Rosetta.


Ruotger

___

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

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

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

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


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

2009-08-20 Thread Ruotger Skupin


Am 20.08.2009 um 11:34 schrieb Ruotger Skupin:



Am 19.08.2009 um 22:00 schrieb Ben Trumbull:

I debugged it with some Snow Leopard magic and found out, that  
firing

faults is very slow the first time after boot. When I use -[NSArray
filteredArrayUsingPredicate:] the fault firing is killing me.


What's the predicate you are using ?
I'm not using a predicate for the first fetch. (Ok, I have learned  
now, I should do so.)




You're almost certainly filtering in memory after fetching only a  
subset of the data needed to perform your in memory filtering  
(specifically, only the source entity and not its relationships).
Yes I do some on-the-fly filtering which depends on other objects.  
(Ok, lesson learned: Bad idea)


Since you didn't fetch the related objects, Core Data goes and  
retrieves them on demand.  However, mind reading is technically  
challenging, and Plan B, retrieving the related objects one at a  
time, is a rather inefficient I/O pattern. It would be vastly  
faster to filter the data in the database using a predicate on the  
fetch request.
So, would it be better to perform the on-the-fly filtering  
calculation every time the object changes and put flags in the root  
object? Then fetch with a predicate testing these flags? Probably.  
(model change! yay!)


If that's not possible, then you should use a fetch request  
predicate that approximates what you need, and filter those results  
more precisely in memory.
That's what I'm doing now because the most common use case is: I  
need almost everything. So the approximation is: I fetch everything  
and filter out some objects.


Like a bounding rect in views.  If you have already fetched the  
objects, but want to identity different subsets, you can use  
objectID fetch results to simply identify the matching objects  
without pulling back all the row data.

The subsets depend on the data of the objects. (Smart Folders)

Complex locale aware Unicode text queries can be slow.  If you find  
yourself spending time with such a query, you should consider some  
of the techniques shown in the DerivedProperty example available on  
ADC.
Isn't all text Unicode? I don't understand. This shouldn't be a  
special case. But I will have a look at the sample.


In my case I'd guess that at least half of the objects contain  
unicode strings (international names and addresses). What I want to  
say: write anything in German or French and you end up with Unicode.


Typically, apps that launch slowly once, and then run quickly  
afterwards are doing far too much I/O.  On successive launches, the  
kernel has cached most of the data, so instead of doing to-disk I// 
O the app is doing to-kernel-memory I/O.


As stated before I need almost all data anyway. Is there a way to  
bulk-load the whole database into mem in one go? That's not what sql  
is about, is it?


The most common problem in Core Data apps is when people allow  
faulting to lazily fetch data one row at a time, even when the app  
needs all the data immediately.  They should prefetch the related  
objects with the original fetch request by setting the prefetching  
keypaths.

Ok, will try to do that.

Another question: I'm using Garbage Collection. Should I look out  
for something special there? Keep managed objects on purpose?  
Letting them go as soon as possible?


Thanks for the insight
Ruotger



___

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

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

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

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


Re: Detect Keyboard Layout for CGKeyCodes

2009-08-20 Thread Harry Jordan

Hi Joe,
Sorry to misunderstand your intentions. I had an inkling I might be  
reading your question wrong. I'm intrigued now as to how you might do  
it. This low level c code makes my head spin, but if I read the docs  
correctly  it should be possible to decode the keyCodes to Unicode  
character tables from UCKeyboardLayout.


First get the current UCKeyboardLayout:

TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
CFDataRef uchr = (CFDataRef)TISGetInputSourceProperty(currentKeyboard,  
kTISPropertyUnicodeKeyLayoutData);
const UCKeyboardLayout *keyboardLayout = (const  
UCKeyboardLayout*)CFDataGetBytePtr(uchr);


Then use a combination of the "Unicode Utilities Reference", and the  
"Specification for 'uchr'" pages in the documentation to work out how  
to read the current layout as a series of structs which reference each  
other by telling you the pointer offset from *keyboardLayout.


I think the tree of structs that you'd need to follow looks something  
like this:
UCKeyboardLayout > array of UCKeyboardTypeHeader > array of  
UCKeyToCharTableIndex > array of UCKeyOutput


Although I couldn't find an explicit reference to this in the  
documentation, I think the position in the array of each UCKeyOutput  
is equivalent to it's keyCode. Then you need to read UCKeyOutput's  
bytes (14 and 15) to find out how to decode it's Unicode character.


Hope that's more what you were looking for. Sorry I can't seem to find  
a friendlier solution.

Harry


On 20 Awst 2009, at 03:02, Joe Turner wrote:


Hey,

This is not *exactly* what I would like to achieve. Basically, what  
I would like to do is the reverse: I would like to convert a string  
into a CGKeyCode. Like on a US keyboard, I would input the string  
"a" and get returned the CGKeyCode 0. This would be extremely  
straight-forward (just a matter of including Events.h from  
HIUtilites), except that all the constants only stand true for US  
keyboards. So, I would like to be able to convert based on the  
keyboard they have, so the right key gets a simulation of a click.


Or, maybe there's a better way to do this than CGEvents? I just need  
it to be universal–This app is a background app, so the keystroke  
needs to be able to be inserted anywhere.


Cheers,

Joe Turner
On Wednesday, August 19, 2009, at 07:30PM, "Harry Jordan" > wrote:

I've not used CGEvents much.. (Once upon a time, hopefully never
again) but if I remember rightly CGKeyCodes are equivalent to NSEvent
keyCodes*. If not you can easily convert between the two using: +
(NSEvent *)eventWithCGEvent:(CGEventRef)cgEvent.

Have a look at this: http://inquisitivecocoa.com/2009/04/05/key-code-translator/
for my version of what I think your trying to achieve. Be warned,
there are a few gaps in my implementation (like F numbers for
instance), but that shouldn't be that hard to add.

Harry Jordan
http://inquisitivesoftware.com/

On 19 Awst 2009, at 18:40, Joe Turner wrote:


Hey,

I've got an application that basically simulates a keyboard using
CGEvents with CGKeyCodes. However, because CGKeyCodes only map the
position of the key on a keyboard, and not the actual key, I've run
into some issues. Is there an easy way to detect the type of
keyboard they have, and convert a CGKeyCode from a standard US
keyboard to whatever keyboard they have?

Any help would be much appreciated! :)

Joe
___

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

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

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

This email sent to cocoaha...@googlemail.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


How to reference to objects laid in external xibs in Interface Builder?

2009-08-20 Thread DairyKnight
I'm wondering if there's a way to make an xib like the one auto-generated by
XCode for iPhone apps. In the main window, there's a
grayed area showing 'Loaded from .xib' and if you click on the link
inside the area, IB will open the corresponding xib file for you.


Anyone knows how? Thanks.


Regards,
DairyKnight
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTableView empty selection not working

2009-08-20 Thread Scott Anguish


On Aug 19, 2009, at 1:44 PM, PCWiz wrote:

This seems to be a bug with Snow Leopard, or Snow leopards developer  
tools. I took the same project, and then compiled and ran it on  
Leopard, the issue does not exist. I'm not sure why this is happening.




SnowLeopard is still under non-disclosure. You can't talk about it here.

Use the devforums.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


debug control not reaching init method

2009-08-20 Thread Nick Rogers

Hi,
This is my third app in Xcode3. Had to use Xcode3 becuase it has to be  
a 64-bit app.


In earlier two apps, the control reaches to the breakpoint on the  
first line of the init method of AppController class, while debugging.


But in this third one, it is not reaching the breakpoint, and the  
window appears.
TableView data source methods are being called (in AppController) as  
the table view shows data.


I have tried everything. Clean All Targets, checked all target  
memberships of all the classes.

Same is happening when I set the config to i386.
The mode set is "debug".

What I may be missing here?

Thanks,
Nick

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: debug control not reaching init method

2009-08-20 Thread Graham Cox


On 20/08/2009, at 9:08 PM, Nick Rogers wrote:


What I may be missing here?



So maybe init isn't actually being called. Objects constructed from a  
nib are usually inited using -initWithCoder:. Is AppController coming  
from a nib?


--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: debug control not reaching init method

2009-08-20 Thread Navneet Kumar

Hi,
AppController is not coming from an archive.
Dragged an NSObject to MainMenu.xib, set its class to AppController,  
made AppController the delegate of File's Owner.


Thanks,
Nick


On 20-Aug-09, at 4:47 PM, Graham Cox wrote:



On 20/08/2009, at 9:08 PM, Nick Rogers wrote:


What I may be missing here?



So maybe init isn't actually being called. Objects constructed from  
a nib are usually inited using -initWithCoder:. Is AppController  
coming from a nib?


--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: debug control not reaching init method

2009-08-20 Thread Graham Cox


On 20/08/2009, at 9:20 PM, Navneet Kumar wrote:


AppController is not coming from an archive.
Dragged an NSObject to MainMenu.xib, set its class to AppController,  
made AppController the delegate of File's Owner.



These two statements contradict one another.

If you dragged an object into the nib, then the object comes from the  
nib. Set a breakpoint on [AppController initWithCoder:]


--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: Core Data dog-slow when using first time after boot

2009-08-20 Thread I. Savant

On Aug 19, 2009, at 10:38 PM, M Pulis wrote:

My whole deal was about any PPC tasks in the OP's product's chain of  
execution, as  I.S. selectively missed then exaggerated the off  
topic point (#5 of 8) in his surgical excerpt of my detailed  
response to his questioning of my suggestion to the OP proving me  
wrong, perhaps for even suggesting PPC in the first place.   
Yeccch. :-P




  (sigh) You're being obnoxious.

  You accuse me of focusing on one thing, unrelated to the main  
point, just to prove you wrong. Ignoring the egotism of that, let's  
get to the meat (since this is a technical list, not digg.com).


  I asked for clarification since your original message only  
implicated Rosetta because of what you (and others) assumed to be a  
slow-performing library startup. It was your choice to continue citing  
sqlite since both posters might have this in common.


  You said, "A guess based on logic and deduction, my Dear Watson."  
Okay logic and deduction it is. If the code was built for PPC and run  
on PPC, Rosetta is not needed. If the code was built for Intel and run  
on Intel, Rosetta is not needed. Since you can't mix architectures  
(something someone who knows enough about Rosetta to imagine the need  
to warm it up on login could be reasonably expected to have  
encountered in the documentation), that leaves only compiling for PPC  
and running on Intel, or forcing the Universal Binary to run under  
Rosetta on Intel. Since the OP said in his second message, "I debugged  
it with some Snow Leopard magic...", that tells us that it's fairly  
unlikely he'd be purposefully compiling only for PPC or forcibly  
running the application under Rosetta to use the PPC code. Unlikely  
but not impossible, I'll grant you that. But extremely unlikely. A  
quick verification of one's build settings is all that's needed, sure,  
but that's not what I was asking. I was asking you to explain your  
reasoning out of curiosity (and a bit of confusion).


  Your "detailed response" (a third of which contained things like,  
"I'm bored" and repeated information) condenses down to about 5 or 6  
interrelated points to explain your reasoning. Points 4 and 6 read  
more like assertions and are based on a complete assumption. Really,  
the only point that needed addressing (considering the above) was  
point 5.


  My original question was just that - a question. A request for you  
to explain what appeared to me to be an interesting leap of logic.  
Nobody said or implied your suggestion was unwelcome (you pulled that  
one out of thin air). I asked you to elaborate and you became offended  
when your suggestion / elaboration was shown to be wrong. It's as  
simple as that.


  Can we please stop the crying and keep things on a technical level?

--
I.S.



___

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

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

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

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


Re: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 19, 2009, at 10:13 PM, Todd Heberlein wrote:


or
-viewDidLoad

on the iPhone (?).



  Sure. The OP mentioned NSImage and NSImageView (Mac), so I focused  
on that. You're right, though. There, too. :-)


--
I.S.




___

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

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

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

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


NSAlternateKeyMask is not working

2009-08-20 Thread Nikhil Khandelwal
HI All,

In my application I am setting shortcut key for a menu item as

[Menuitem setKeyEquivalentModifierMask:NSAlternateMask];
[Menuitem setKeyEquivalent:@"1"];

But it is not working with alt key though it is working fine if I press "Fn + 
option + 1" or "control + option + 1".

Is option key is not supposed to make as shortcut key alone ?

Thanks,
Nikhil

DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 3:41 AM, Jean-Daniel Dupas wrote:

The -[NSWindowController loadWindow] methods says you can call - 
[NSWindowController window] to load the window, so I don't think it  
should be an issue..


Just a point, I think that in NSWindowController it may be better to  
initialize dependent stuff in -windowDidLoad, especially if you want  
to access the window object. I remember I encountered some issue  
using awakeFromNib some time ago  but don't remember exactly what it  
was.


  Hmmm ... I'd love to hear the details of the problem if you  
remember it. "Conventional wisdom" says -awakeFromNib. I haven't had  
the time yet to re-read the relevant docs to examine this more  
closely. Maybe later today.


--
I.S.




___

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

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

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

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


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

2009-08-20 Thread M Pulis

ok

best,
gary

ToothPics Company
1.800.218.0531


On Aug 20, 2009, at 2:16 AM, Ruotger Skupin   
wrote:




Am 20.08.2009 um 04:38 schrieb M Pulis:


I got that, Bill, thank you.

The OP did not specify what particular sql store (we still do NOT  
know) nor if he is compiled Universal, has any helper programs,  
etc, he did however, describe symptoms I have seen with Rosetta. So  
I simply proposed checking that no PPC code was being engaged.  
Simple to do.




For the record: I compiled Universal (debug version: Intel-only)  
32bit-only. No helper programs. So it's pretty save to say, I'm not  
using Rosetta.


Ruotger

___

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

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

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

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


RE: A simple DO situation - point me in the right direction!

2009-08-20 Thread Kirk Kerekes

I need to implement a system where I can verify the number of running
copies of my app on a local network against a site license. I thought
DO might be a good way to implement this.


Consider using just Bonjour for this -- with careful implementation of  
the name and type service strings, you can probably get what you want  
with no DO at all.


The essence will be embedding a license code into the "type" field,  
then counting the number of eligible services based on that "type".  
The "name" field should be unique on the local subnet.


You can skip the resolution phase.

You would probably end up using Bonjour with DO anyway -- this just  
eliminates the DO part.


Don't forget to un-publish your app when it quits.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Overriding NSCollectionView's selection: a good idea?

2009-08-20 Thread Austin Grigg
Thank you for sharing that link with me -- that is what I've been  
looking for!  Hopefully that will now allow me to customize my  
collection views.


I believe binding the prototype view back to the NSCollectionViewItem  
will give you access to the controller.  As I pointed out, you should  
be able to do toggle selection by just setting up the button and  
outlets in IB as I described, but if you want additional  
functionality, you will probably have to do what is described in the  
link you sent.


Austin

On Aug 18, 2009, at 1:06 PM, Andrew McClain wrote:

Ah! So if I understand you correctly, binding my prototype view back  
to the NSCollectionViewItem gives me access to each replicated  
controller? I was missing that completely.


So, theoretically, I could subclass the NSCollectionViewItem, give  
it a reference to my AppController,  and then have the button send  
an action to it, where I'd finally have access to the  
representedObject property. Toggling is a fairly important property  
for this case, since 90% of the time the user will be selecting  
multiple objects.


FWIW, http://www.benedictcohen.co.uk/files/5b81e3c40cee2daf88ceffe6eb556a63-3.php 
 addresses your problem about bindings not being replicated.


Andrew

On Tue, Aug 18, 2009 at 6:20 AM, Austin Grigg  
 wrote:

Andrew,

I would recommend using the selection that is built into the  
NSCollectionView.  Just make sure that "Allows Multiple Selected" is  
checked in IB for your collection view and then the user can Shift- 
click or Command-click or highlight with their mouse to get multiple  
selection.


If the behavior you really want is to be able to click the button/ 
image and have it toggle the selection, you may have to create your  
own implementation of an NSCollectionView.  I was trying to do some  
similar things and when I tried to interact with the  
representedObject in my subclassed NSView I hit a brick wall.  The  
problem originates from the fact that the prototype view is created  
once, then copied for as many items as you have in your collection,  
but the bindings are not set up properly with each copy.


There is one other thing you could try, but it is not well  
documented so I don't know if it will be broken in future releases.   
I was able to bind the value of my disclosure button in my prototype  
view in IB to the NSCollectionViewItem and set the model key path to  
"selected".  When the button is clicked it toggles that item's  
selection.  You should be able to set a different image or highlight  
for each state of the button and that might do the trick for you.   
The documentation for NSCollectionViewItem just doesn't mention a  
selected property, it just has an isSelected and setSelected methods.


Hope that helps,
Austin


I've been reading docs and looking at IconCollection for the last  
week and I

still can't really figure this out.
Here's the behavior I want to model: pretend I'm making poker dice  
game (I'm
using this as an example to help me understand cocoa programming). I  
have a
visual representation of the dice, and I want to select a certain  
number of

them each round.

Right now I'm using NSCollectionView with a prototype view that has  
a text

field (for a representation of the dice) and a button (for toggling
selection). Eventually I'll just use an image representation, but  
I'm just

trying to get this to work now.

When the user clicks the button in a view, the corresponding die  
will be

added into a "diceinhand" array in my AppController.
I can't figure out how, though, to connect the button in a way that
allows the AppController to understand which die has been selected
-- that is, I can't find any way to pass the representedObject  
associated
with my replicated view to any controller (but perhaps I'm thinking  
about

that incorrectly).

1. Can I call a selector on the representedObject itself from the  
view?
Where would I set that up that programmatically (I'm assuming you  
can't do

that with IB)?

or

2. Is it better to abandon the "selection buttons" and use the  
selection
code of NSCollectionView? Does that mean the user needs to shift- 
click to
select multiple dice? Since all I'm doing is trying to is add the  
object to
another array in my AppController, couldn't I programmatically bind  
the
DiceInHand array in my AppController to the selectedObjects key of  
my array

controller or do I need another array controller to manage that?

I'm happy to read docs, it just seems that everything I've been  
reading

deals mostly with binding values in a prototype view.

Thank you,
Andrew
___

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

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

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

This email sent to awmccl...@gmail

NSMutableArray fill with unique values from NSArray

2009-08-20 Thread Devraj Mukherjee
Hi all,

I have NSMutableArray (fixed length) that I wish to fill with unique
values at each index from a source NSArray (fixed length, greater than
the length of the target mutable array).

Realise that I can do this by writing a loop and check to see if a
value has bee pre-filled, the last indexes take a while to fill (for
obvious reasons of randomisation).

Is there are better way of doing this?

-- 
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSMutableArray fill with unique values from NSArray

2009-08-20 Thread Graham Cox


On 20/08/2009, at 10:43 PM, Devraj Mukherjee wrote:


Is there are better way of doing this?



Use a NSMutableSet, which only accepts unique objects. You can turn it  
into an array later.


However you can probably do this just as easily with an array,  
avoiding the slowdown at the end, if you change your algorithm a bit.  
Isn't this pretty much the same as the "shuffle" question discussed  
last week?


--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: NSMutableArray fill with unique values from NSArray

2009-08-20 Thread Mike Abdullah


On 20 Aug 2009, at 13:43, Devraj Mukherjee wrote:


Hi all,

I have NSMutableArray (fixed length) that I wish to fill with unique
values at each index from a source NSArray (fixed length, greater than
the length of the target mutable array).


This sounds worrying. There is no such thing as a fixes length mutable  
array unless you specifically create your own subclass to behave like  
this. I think you're confusing what -initWithCapacity: and friends  
really do.




Realise that I can do this by writing a loop and check to see if a
value has bee pre-filled, the last indexes take a while to fill (for
obvious reasons of randomisation).

Is there are better way of doing this?


Does the ordering of the objects in the final array actually matter?  
If so, looping through each object and checking for -containsObject:  
is your best approach. If ordering is not important then you shouldn't  
be using an array anyway; instead use NSMutableSet which is designed  
for this sort of thing. Possibly if testing shows this to be a  
performance bottleneck you could use both NSMutableArray and  
NSMutableSet together, one to store the ordered objects, one to  
quickly check if an object is already present.


--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

Please do not post admin requests or moderator comments to the list.
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: A simple DO situation - point me in the right direction!

2009-08-20 Thread Graham Cox

That's a great idea - nice one ;-)

I've made some headway since my earlier post, by starting with Bonjour  
using NSNetService and NSNetServiceBrowser. I'm starting to form some  
slightly more intelligent (I hope) questions.


Port Number. Given my scenario wouldn't I need to use a fixed port  
number? If so, how do I choose one? Can I pick one more or less at  
random and hope for the best, or is there a way to get an unused one -  
but if I do that, how would all the other little micro-servers know to  
pick the same one?


Unique name. Since I don't think my service will ever be visible this  
isn't likely to be a big issue, but can I be sure that the host name  
is unique for example? I could always use a UUID I guess.


By unpublish I take it you mean calling -stop on the published  
NSNetService? Or is there more to it?


--Graham




On 20/08/2009, at 10:08 PM, Kirk Kerekes wrote:


I need to implement a system where I can verify the number of running
copies of my app on a local network against a site license. I thought
DO might be a good way to implement this.


Consider using just Bonjour for this -- with careful implementation  
of the name and type service strings, you can probably get what you  
want with no DO at all.


The essence will be embedding a license code into the "type" field,  
then counting the number of eligible services based on that "type".  
The "name" field should be unique on the local subnet.


You can skip the resolution phase.

You would probably end up using Bonjour with DO anyway -- this just  
eliminates the DO part.


Don't forget to un-publish your app when it quits.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread Jean-Daniel Dupas


Le 20 août 2009 à 13:55, I. Savant a écrit :


On Aug 20, 2009, at 3:41 AM, Jean-Daniel Dupas wrote:

The -[NSWindowController loadWindow] methods says you can call - 
[NSWindowController window] to load the window, so I don't think it  
should be an issue..


Just a point, I think that in NSWindowController it may be better  
to initialize dependent stuff in -windowDidLoad, especially if you  
want to access the window object. I remember I encountered some  
issue using awakeFromNib some time ago  but don't remember exactly  
what it was.


 Hmmm ... I'd love to hear the details of the problem if you  
remember it. "Conventional wisdom" says -awakeFromNib. I haven't had  
the time yet to re-read the relevant docs to examine this more  
closely. Maybe later today.


I managed to find a issue when you don't bind the window outlet and  
try to call [self window] in awakeFromNib.
Instead of returning nil, it try to load the nib again, falls in a  
infinite recursive loop and crash when the stack is full. That is the  
problem I encountered.
Unlike NSViewController which require a view, NSWindowController  does  
not enforce the window binding, and it even has a setWindow: method  
that you can use to attach a window to it (even if the doc says you  
should create a new window controller instead). I can't says if this  
problem hit me because I forget to bind the window, or if an OS update  
fixed this issue.


I didn't managed to reproduce it when the window outlet is bound  
though, so this should not be an issue. At least, not with the version  
of the OS I'm using.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 9:37 AM, Jean-Daniel Dupas wrote:

I managed to find a issue when you don't bind the window outlet and  
try to call [self window] in awakeFromNib.
Instead of returning nil, it try to load the nib again, falls in a  
infinite recursive loop and crash when the stack is full. That is  
the problem I encountered.



  Huh. Well sending a -window message to a controller with no window  
present shouldn't cause the behavior you described, so on its surface,  
it sure looks like an API bug, but ...


  From the NSNibWaking Protocol Reference:

"An awakeFromNib message is sent to each object loaded from the  
archive, but only if it can respond to the message, and only after all  
the objects in the archive have been loaded and initialized. When an  
object receives an awakeFromNib message, it is guaranteed to have all  
its outlet instance variables set."


  It also says:

"Important:  Because the order in which objects are instantiated from  
an archive is not guaranteed, your initialization methods should not  
send messages to other objects in the hierarchy."


  For the OP's question, it truly depends on from where -loadWindow  
is being called, but -awakeFromNib has the final where "is it done  
yet" is concerned.


  I'm not convinced yet that relying on -loadWindow is as good as  
keeping nib-loading-related startup code in -awakeFromNib.


--
I.S.




___

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

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

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

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


Re: Heartbeat thread is blocked? -- With Code and Movie

2009-08-20 Thread Sean McBride
On 8/19/09 5:05 PM, Seth Willits said:

>> I've been noticing this for a little while now. For some wacky
>> reason, the thread that tickles default buttons and progress
>> indicators to update is somehow no long working in my app. Default
>> buttons don't pulsate and the progress indicators don't spin. The
>> GUI is fully responsive otherwise, but these items don't animate
>> properly. Does anyone have any clue as to why that would happen?
>
>
>I've completely stripped this project down to the absolute bare bones
>and it shows this bug. Simply launch the app. You'll see that the
>default button in the window is NOT plusating like it should be, and
>if you click it, you'll see that the progress indicator does NOT spin
>like it should.
>
>One of the views in the hierarchy is set to have a CA layer (through
>setWantsLayer). If you turn that off, it works. If you move the button
>and progress indicator to different (certain) views, it works. (Other
>combinations don't work.)

When you turn layering on for a view, it turns it on for all subviews
also.  They recommend you try to minimise the number of views using
layering.  I've found that lots of view don't draw properly with
layering on, like NSPathControl and others.  IIRC it's in the AppKit
release notes.

--

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: devil of a time with an NSImageView

2009-08-20 Thread Jean-Daniel Dupas


Le 20 août 2009 à 16:21, I. Savant a écrit :


On Aug 20, 2009, at 9:37 AM, Jean-Daniel Dupas wrote:

I managed to find a issue when you don't bind the window outlet and  
try to call [self window] in awakeFromNib.
Instead of returning nil, it try to load the nib again, falls in a  
infinite recursive loop and crash when the stack is full. That is  
the problem I encountered.



 Huh. Well sending a -window message to a controller with no window  
present shouldn't cause the behavior you described, so on its  
surface, it sure looks like an API bug, but ...


 From the NSNibWaking Protocol Reference:

"An awakeFromNib message is sent to each object loaded from the  
archive, but only if it can respond to the message, and only after  
all the objects in the archive have been loaded and initialized.  
When an object receives an awakeFromNib message, it is guaranteed to  
have all its outlet instance variables set."


 It also says:

"Important:  Because the order in which objects are instantiated  
from an archive is not guaranteed, your initialization methods  
should not send messages to other objects in the hierarchy."


 For the OP's question, it truly depends on from where -loadWindow  
is being called, but -awakeFromNib has the final where "is it done  
yet" is concerned.


 I'm not convinced yet that relying on -loadWindow is as good as  
keeping nib-loading-related startup code in -awakeFromNib.


It's fine too.

From the NSWindowController subclass note (at bottom of the reference):

"windowDidLoad : Override to perform tasks after the window nib file  
is loaded."


And the -[NSWindowController window] and -[NSWindowController  
loadWindow] confirms that windowDidLoad is invoke only when the nib  
has finish loading.







___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 10:40 AM, Jean-Daniel Dupas wrote:


It's fine too.

From the NSWindowController subclass note (at bottom of the  
reference):


"windowDidLoad : Override to perform tasks after the window nib file  
is loaded."


And the -[NSWindowController window] and -[NSWindowController  
loadWindow] confirms that windowDidLoad is invoke only when the nib  
has finish loading.



  Ah hah. Okay, I'm getting there. :-) The remaining questions are  
"is one better than the other?" and "if so, which?"


--
I.S.




___

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

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

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

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


Re: alias link to libcrypto not working across different OS X versions

2009-08-20 Thread Adam R. Maxwell


On Aug 19, 2009, at 5:52 PM, Steve Mykytyn wrote:

The older machine does not have /usr/lib/libcrypto.0.9.x.dylib, it  
has /usr/lib/libcrypto.0.9.y.dylib, which is where the alias  
resolves, but somehow the app does not get it right.


Note that it's a symlink, not an alias...

I have everything set up correctly as far as SDK and dev target  
because I can detect a weak-linked Apple framework if it's there,  
it's just this bit with libcrypto that seems to be the issue.


It might be a bug in the SDK.  Something similar happened with  
libiconv, as described in this post:


http://www.cocoabuilder.com/archive/message/cocoa/2008/2/27/14

In that case, compiling the framework with the 10.4 SDK did solve the  
problem, in spite of what the message says.  Are any messages logged  
when your app crashes?




smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: FYI - new debug & profile libraries are out: Installer Refuses

2009-08-20 Thread Sean McBride
On 8/19/09 7:48 PM, Nick Zitzmann said:

>> Has anyone gotten this installer to work?
>
>I did, though I had to hack the package to work. The package requires
>9L30, but the currently shipping 10.5.8 update takes users to 9L31a. I
>have no idea what changed in this build (does anyone?), but once I
>hacked the text file that's inside the package bundle's contents
>folder, then it worked.

Worked fine for me, but I have 9L30 (and Software Update has nothing
more to offer).  I notice Google has 300 hits for 9L30 and only 300
for 9L31a3.  It might be a newer build for some very new hardware?

--

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


How do I make a header row have a gradient background in my NSOutlineView?

2009-08-20 Thread Joshua Garnham
I am using an NSOutlineView
in my App so i downloaded Apples Photo Search Sample App which uses an
NSOutlineView. While using it I noticed that it gives the root/header object
of the outline view a Gradient Background, so I looked through the code
but I couldn't see what did it. Would someone mind looking through the
code and then telling me what code gave the root object a background?
Here's the link to the Photo Search Download Page - 
http://developer.apple.com/Samplecode/PhotoSearch/index.html
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: -awakeFromNib vs. -windowDidLoad [Was: devil of a time with an NSImageView]

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 10:59 AM, Kyle Sluder wrote:

Use -awakeFromNib to do view setup (turning on layer backing,  
creating caches colors, etc.). Use -windowDidLoad (or - 
windowControllerDidLoadNib or whatever that NSDocument method is)  
for setting up inter-view relationships.


  Hmm ... so would you say to do otherwise is "doing it wrong" or  
"doing it sub-optimally"?


  I don't recall such guidelines in the documentation, so if I've  
missed it (or it's been added since I last studied the relevant docs),  
I would very much appreciate a reference. If not, I think this is a  
great topic of discussion (ie, a general architectural approach).


--
I.S.




___

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

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

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

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


Re: Model objects to NSUndoManager--am I doing it right?

2009-08-20 Thread Graham Cox


On 20/08/2009, at 5:17 AM, Paul Bruneau wrote:

In summary, it seemed like a Long Way to Go just to let my new  
Entrance objects know who their document is. In my future is the  
fact that Entrances will have FrameModules, which may contain a  
Door, which will contain an array of Cutouts and so I am looking at  
3-4 more generations of Model object types, each of which must a  
similar way to get to the Document's Undo Manager.


Is this the right way?



This can be awkward, it's true.

The most general way I've found to handle this is to give each object  
in a tree of objects a back pointer to its owner or container.  
Naturally this back pointer mustn't be retained or you'll get a retain  
cycle, but any time you add an object to another, the added object's  
back pointer is set. The top level object's back pointer points to the  
document, or top level controller which owns it, and so there is a  
path from any object to the root, which has an undo manager. Then it's  
a simple matter to give any object its own -undoManager method (which  
always merely invokes its owner's -undoManager method, and so on).


I'd also take issue with the code you posted. As an IBAction method,  
it should probably not be setting up the undo task. Instead it should  
just set the relevant property(s) of the object it's dealing with, and  
those property methods should do the necessary with the undo manager.  
The action method is a good place to set the action name though. This  
way if there are several steps involved in doing something, like  
setting a series of properties, all the steps get undone as needed. It  
also means that properties are inherently undoable, and code from  
anywhere can call them and be undoable. In your example, if code calls  
-removeObject: directly, it won't be undoable.


--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: contextual menu plugin example in cocoa

2009-08-20 Thread I. Savant

On Aug 19, 2009, at 7:26 PM, augusto callejas wrote:


since the finder under snow leopard is going to be pure cocoa,
i assume any contextual menu plugin written in carbon will not work?
if so, where would i find sample code like above, except using just
cocoa?


  Can't discuss that here. Try the Snow Leopard discussion forums  
found on the ADC (member) web site.


--
I.S.


___

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

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

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

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


Re: contextual menu plugin example in cocoa

2009-08-20 Thread Nick Zitzmann


On Aug 19, 2009, at 5:26 PM, augusto callejas wrote:


if so, where would i find sample code like above, except using just
cocoa?



There aren't any. You have to use Carbon for at least the entry point  
of a CM plugin. After that, you can call any Foundation method you  
want, or even AppKit methods after calling NSApplicationLoad() once  
(this is very important!).


And the people who could comment on Snow Leopard can't, because it is  
under NDA at this time.


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: Model objects to NSUndoManager--am I doing it right?

2009-08-20 Thread Graham Cox


On 21/08/2009, at 1:18 AM, Graham Cox wrote:



On 20/08/2009, at 5:17 AM, Paul Bruneau wrote:

In summary, it seemed like a Long Way to Go just to let my new  
Entrance objects know who their document is. In my future is the  
fact that Entrances will have FrameModules, which may contain a  
Door, which will contain an array of Cutouts and so I am looking at  
3-4 more generations of Model object types, each of which must a  
similar way to get to the Document's Undo Manager.


Is this the right way?



This can be awkward, it's true.

The most general way I've found to handle this is to give each  
object in a tree of objects a back pointer to its owner or  
container. Naturally this back pointer mustn't be retained or you'll  
get a retain cycle, but any time you add an object to another, the  
added object's back pointer is set. The top level object's back  
pointer points to the document, or top level controller which owns  
it, and so there is a path from any object to the root, which has an  
undo manager. Then it's a simple matter to give any object its own - 
undoManager method (which always merely invokes its owner's - 
undoManager method, and so on).


I'd also take issue with the code you posted. As an IBAction method,  
it should probably not be setting up the undo task. Instead it  
should just set the relevant property(s) of the object it's dealing  
with, and those property methods should do the necessary with the  
undo manager. The action method is a good place to set the action  
name though. This way if there are several steps involved in doing  
something, like setting a series of properties, all the steps get  
undone as needed. It also means that properties are inherently  
undoable, and code from anywhere can call them and be undoable. In  
your example, if code calls -removeObject: directly, it won't be  
undoable.



Oh, another thing I forgot to mention which could well be highly  
relevant to your situation, if you're using an NSArrayController as  
your top level "owner" object. You can leverage KVO to handle undo as  
well. To do this, you need to KV-observe any properties you want to  
undo. When you get the change notification, you need to prepare an  
invocation as usual, but it can be a generic one that records the  
target object, keypath and old value of the property, with a selector  
that is always the same. When the task is undone, the general selector  
is invoked and you can then use KVC to change the property of the  
target object back again. It's a nice generic way to handle it, with  
the downside that comes with the various pitfalls of KVO - i.e. making  
sure you stop observing stuff when you should.


Hillegasse explores this approach in his book BTW.

--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: devil of a time with an NSImageView

2009-08-20 Thread Kyle Sluder
On Aug 20, 2009, at 7:43 AM, "I. Savant"   
wrote:


The remaining questions are "is one better than the other?" and "if  
so, which?"


Use -awakeFromNib to do view setup (turning on layer backing, creating  
caches colors, etc.). Use -windowDidLoad (or - 
windowControllerDidLoadNib or whatever that NSDocument method is) for  
setting up inter-view relationships.


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


Model objects to NSUndoManager--am I doing it right?

2009-08-20 Thread Paul Bruneau

Hi all-

I'm just starting my first real document-based Cocoa app. My other app  
was non-document based and the undo system was quite different (plus I  
know I did some things wrong MVC-wise in that app).


The documentation I have read tells me that I should implement undo in  
the Setter methods of my model objects' properties. And I have done so  
for some of my objects (so far).


My question is, what is the best way to make all my model objects be  
able to find their document's undo manager?


Here is an early shot of part of my interface:

<>




To get the document to where these Entrances can see it, I had to  
subclass NSArrayController, add an IBOutlet for  
"myWindowController" (which in turn of course knows the document) and  
wire it to File's Owner in its NIB.


I have the New Entrance button bound to the add: method of my  
EntranceArrayController (which I overrode as below):


-(void)add:(id)sender;
{
SLEntrance * newSLEntrance = [[SLEntrance alloc] init];
newSLEntrance.myDocument = myWindowController.document; 
//I need to let this new entrance know its document

//now add this new entrance to the entrance array
[self addObject:newSLEntrance]; 

//generate invocation to tell the Undo system we have something to undo
	[[[myWindowController.document undoManager]  
prepareWithInvocationTarget:self] removeObject:newSLEntrance];
	[[myWindowController.document undoManager] setActionName:@"create new  
Entrance"];

}

In summary, it seemed like a Long Way to Go just to let my new  
Entrance objects know who their document is. In my future is the fact  
that Entrances will have FrameModules, which may contain a Door, which  
will contain an array of Cutouts and so I am looking at 3-4 more  
generations of Model object types, each of which must a similar way to  
get to the Document's Undo Manager.


Is this the right way?

Thank you___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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

contextual menu plugin example in cocoa

2009-08-20 Thread augusto callejas

hi-

i'm trying to find a cocoa example of a contextual menu plugin,
but searching the apple developer site only comes up with an
example based on carbon:

http://developer.apple.com/Samplecode/SampleCMPlugIn/index.html

since the finder under snow leopard is going to be pure cocoa,
i assume any contextual menu plugin written in carbon will not work?
if so, where would i find sample code like above, except using just
cocoa?

thanks,
augusto.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


NSWindow and Spaces

2009-08-20 Thread MT
Hi,

I've got a problem with my app, some of the windows do not behave correctly
with 'Spaces', I've narrowed it down to this...

If the window is backed by an NSDocument, it behaves correctly, i.e. if this
window is active within the application, when the user clicks on the dock
icon, the Space will be switched automatically.

If the window is *NOT* NSDocument based, the Space does not get switched
automatically.

I've tried the setCollectionBehaviour: method, but it's doesn't make any
difference. How can I make the window behave like NSDoc ones?

Thanks a lot!

MT
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: -awakeFromNib vs. -windowDidLoad [Was: devil of a time with an NSImageView]

2009-08-20 Thread Kyle Sluder
On Aug 20, 2009, at 8:05 AM, "I. Savant"   
wrote:


 Hmm ... so would you say to do otherwise is "doing it wrong" or  
"doing it sub-optimally"?


No, but if it winds up mattering, that's how it usually shakes out. So  
I tend to follow that pattern even before it begins to matter.


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


Execution of Replaced Method Jumps back to top -- How??

2009-08-20 Thread Jerry Krinock
[Re-sending this message with new details, and also because my thread  
was hijacked yesterday.]


In debugging my undo grouping issue, I've replaced NSUndoManager's - 
beginUndoGrouping and -endUndoGrouping with methods that log whenever  
they're invoked.


- (void)replacement_beginUndoGrouping {
   NSLog(@"WILL beginUndoGrouping for %@", self) ;// line 1
   NSInteger oldLevel = [self groupingLevel] ;
   NSInteger localSeqNum = gSeqNum ;
   [self replacement_beginUndoGrouping] ; // line 4
   NSLog(@" DID beginUndoGrouping level: %d->%d locSeqNum=%d",
 oldLevel, [self groupingLevel], localSeqNum) ;
   gSeqNum++ ;
}

(For those unfamiliar with Method Replacement [1], the above is NOT an  
infinite loop because [self replacement_beginUndoGrouping] invokes the  
ORIGINAL (Cocoa's) -beginUndoGrouping.)


Here's a snippet from Xcode's log while performing commands that  
invoke -beginUndoGrouping:


11:27:57.531 Test[804:10b] WILL beginUndoGrouping for 0x170441d0>
11:27:57.547 Test[804:10b] WILL beginUndoGrouping for 0x170441d0>
11:27:57.555 Test[804:10b]  DID beginUndoGrouping level: 0->1  
locSeqNum=5
11:27:57.556 Test[804:10b]  DID beginUndoGrouping level: 0->2  
locSeqNum=5


So, apparently this method is being invoked twice, but the second one  
starts before the first one is complete!  At first I thought that this  
was just Xcode's console doing some of the lazy logging like Leopard's  
Console.app which drives me nuts.  But the values of locSeqNum=5 and  
oldLevel=0 and the milliseconds say that these statements really ^are^  
executing out of sequence.  Single-stepping in the Debugger shows the  
same thing -- execution jumps from "line 4" back to "line 1".  And  
note that this is all in the main thread, 10b and, yes, the same  
instance, 0x170441d0.


This only happens about 20% the time.  Other times, statements execute  
as expected.
One obvious possibility is that Method Replacement misbehaves and does  
not invoke the replacement in this repeatable test case.  How can this  
happen?


Jerry

[1] http://developer.apple.com/SampleCode/MethodReplacement/index.html

Here's the entire implementation:

#import 

static NSInteger gSeqNum = 0 ;

@implementation NSUndoManager (Debug20090818)

+ (void)load {
   NSLog(@"%s is replacing methods", __PRETTY_FUNCTION__) ;
   Method originalMethod ;
   Method replacedMethod ;

   originalMethod = class_getInstanceMethod(self,  
@selector(beginUndoGrouping)) ;
   replacedMethod = class_getInstanceMethod(self,  
@selector(replacement_beginUndoGrouping)) ;

   method_exchangeImplementations(originalMethod, replacedMethod) ;

   originalMethod = class_getInstanceMethod(self,  
@selector(endUndoGrouping)) ;
   replacedMethod = class_getInstanceMethod(self,  
@selector(replacement_endUndoGrouping)) ;

   method_exchangeImplementations(originalMethod, replacedMethod) ;
}


- (void)replacement_beginUndoGrouping {
   NSLog(@"WILL beginUndoGrouping for %@", self) ;
   NSInteger oldLevel = [self groupingLevel] ;
   [self replacement_beginUndoGrouping] ;
   NSLog(@" DID beginUndoGrouping level: %d->%d", oldLevel, [self  
groupingLevel]) ;

}

- (void)replacement_endUndoGrouping {
   NSLog(@"WILL --endUndoGrouping for %@", self) ;
   NSInteger oldLevel = [self groupingLevel] ;
   [self replacement_endUndoGrouping] ;
   NSLog(@" DID --endUndoGrouping level: %d->%d", oldLevel, [self  
groupingLevel]) ;

}

@end
___

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

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

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

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


Re: How do I make a header row have a gradient background in my NSOutlineView?

2009-08-20 Thread Corbin Dunn


On Aug 20, 2009, at 7:55 AM, Joshua Garnham wrote:


I am using an NSOutlineView
in my App so i downloaded Apples Photo Search Sample App which uses an
NSOutlineView. While using it I noticed that it gives the root/ 
header object
of the outline view a Gradient Background, so I looked through the  
code

but I couldn't see what did it. Would someone mind looking through the
code and then telling me what code gave the root object a background?
Here's the link to the Photo Search Download Page - 
http://developer.apple.com/Samplecode/PhotoSearch/index.html
Thanks!


This:

- (BOOL)outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item {
return [item isKindOfClass:[SearchQuery class]];
}


But also the full width cell part is important:

- (NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item {

// The "nil" tableColumn is an indicator for the "full width" row
if (tableColumn == nil) {
if ([item isKindOfClass:[SearchQuery class]]) {
return iGroupRowCell;
} else if ([item isKindOfClass:[SearchItem class]] && [item  
metadataItem] == nil) {
// For failed items with no metdata, we also use the  
group row cell

return iGroupRowCell;
}
}
return nil;
}

corbin



___

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

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

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

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


template metaprogramming optimization in COCOA app

2009-08-20 Thread Luca Ciciriello

Hi list.
I've included in an Objective-C++ project some part of a my old  
application written in pure ANSI ISO/IEC 14882:2006 C++. For the  
portability sake was very important to me the compliance with this  
standard. In this ANSI C++ application I've used the template  
metaprogramming methodology in order to achieve some level of compile- 
time optimizations. My question is: These optimizations are still  
there when  this C++ code is insert in a Objective-C++ COCOA app?


Thanks in advance.

Luca.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: bound popup cell not letting me set it's value

2009-08-20 Thread Christopher Campbell Jensen

Bind the pop up cell's
"selectedValue" binding to a string representing the current name, or
bind its "selectedIndex" binding to a number that represents the index
of the current name.


This was the step I had missed, I hadn't bound any of the "selected"  
bindings.
I tried looking in the class documentation, but that doesn't mention  
anything about what properties need to be bound. I also looked in the  
cocoa bindings programming guide, but couldn't really see any  
reference to this either. What would have been the best place to look,  
or is it just common sense and I am lacking of it? :)


Chris
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: bound popup cell not letting me set it's value

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 09:04, Christopher Campbell Jensen wrote:

I tried looking in the class documentation, but that doesn't mention  
anything about what properties need to be bound. I also looked in  
the cocoa bindings programming guide, but couldn't really see any  
reference to this either. What would have been the best place to  
look, or is it just common sense and I am lacking of it? :)


The relevant document is:


http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/CocoaBindingsRef.html

For some reason, the other documents don't have a reference to this,  
so it's really hard to find if you don't already know it exists.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread aaron smith
Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?

I've been trying to just do some extra releases on an object, but no go.

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: iPhone: MPVolumeView not displaying

2009-08-20 Thread William Squires
What if you push the (physical) volume up/down button on the side of  
the device? Does it show up then?


On Aug 14, 2009, at 11:09 AM, Eric E. Dolecki wrote:

I just tried with just headphones... I can't get a volume slider at  
all.


Thanks,
E.

On Aug 14, 2009, at 11:37 AM, Luke the Hiesterman  
 wrote:


Have you tried just headphones without the dock? I'm just  
speculating here, but it seems possible that when it's using line  
out via the dock, volume goes away, along the same lines that  
there is no volume control on Apple TV - the assumption is that  
will be handled entirely by the connected sound system.


Luke

On Aug 14, 2009, at 8:34 AM, Eric E. Dolecki wrote:

For what it's worth, I don't see a volume slider in the Apple  
Music app on the device either... not sure where that's gone to.



On Fri, Aug 14, 2009 at 11:32 AM, Eric E. Dolecki  
 wrote:
I do have the headphones plugged in. Makes no difference. Also  
doesn't display when the thing is docked (ie. a SoundDock).



On Fri, Aug 14, 2009 at 11:30 AM, Luke the Hiesterman  
 wrote:
Do you have headphones plugged in? There is no speaker on the  
original iPod Touch, so there is no applicable volume unless  
headphones are plugged in.


Luke


On Aug 14, 2009, at 8:27 AM, Eric E. Dolecki wrote:

I am using this code in my viewDidLoad (I am targeting 3.1)

MPVolumeView *volumeView = [[[MPVolumeView alloc]
initWithFrame:volumeSlider.bounds] autorelease];

[volumeSlider addSubview:volumeView];

[volumeView sizeToFit];;


volumeSlider is a UIView set up in IB.


All I see is "No Volume Available" - I don't see a slider at all.  
What might

cause this? Running on a 1st gen touch.
___

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

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

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


This email sent to luket...@apple.com




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



--
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/wsquires% 
40satx.rr.com


This email sent to wsqui...@satx.rr.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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Nick Zitzmann


On Aug 20, 2009, at 11:04 AM, aaron smith wrote:


Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?



NSInteger thisLineOfCodeWillCrashTheAppOnAnIntelMac = 1/0;

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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Gideon King

Try this:

*(long*)0 = 0xDEADBEEF;



Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?

I've been trying to just do some extra releases on an object, but no  
go.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 07:21, I. Savant wrote:

 I'm not convinced yet that relying on -loadWindow is as good as  
keeping nib-loading-related startup code in -awakeFromNib.


a. I'm not sure how 'loadWindow' got into this discussion -- the  
documentation says not to call 'loadWindow' directly but to call  
'window' instead and let *it* call 'loadWindow'.


b. 'window' won't return (presumably because an underlying  
'loadNib...' doesn't return) until the NIB is completely loaded,  
including all the invocations of  'awakeFromNib' and the invocation of  
'windowDidLoad'. AFAIK it's perfectly safe to invoke 'window'  
immediately after creating the window controller, or even during the  
window controller's init method (I've done both without problems).


The only difference is timing -- invoking 'window' early causes the  
NIB to be loaded at window controller creation time, instead of at the  
time the window is shown.


c. A couple of weeks ago on this list, one of our Apple experts (Luke,  
maybe, but I can't remember for sure) said to use the more specialized  
method (such as 'windowDidLoad') *instead of* the generic  
'awakeFromNib', if the class has 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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Bryan Henry

[[NSArray array] objectAtIndex:0]; if you want an exception.

- Bryan

Sent from my iPhone

On Aug 20, 2009, at 1:04 PM, aaron smith > wrote:



Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?

I've been trying to just do some extra releases on an object, but no  
go.


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

This email sent to bryanhe...@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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread jonat...@mugginsoft.com

A Cocoa approach to crashing a Cocoa app:

	NSDecimalNumber *boom = (NSDecimalNumber *)[NSDecimalNumber  
numberWithInt:0];

[boom decimalNumberByAdding:nil];

On 20 Aug 2009, at 18:04, aaron smith wrote:


Hey All, I'm trying to do some testing with Smart Crash Reporter,
which integrates with Crash Reporter. So I'm trying to write some code
to force crash my app. But it won't crash. hahaha.

Anyone have any code I can use to do this?

I've been trying to just do some extra releases on an object, but no  
go.


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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Developer
http://www.mugginsoft.com





___

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

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

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

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


NSSortDescriptor in core-data document app

2009-08-20 Thread Martin Hewitson

Dear all,

I have a core-data document based app which uses an NSCollectionView  
to display entries of a single entity (Entry) in the data model. In   
MyDocument.m In this document class I have an ivar which holds a  
reference to the NSArrayController that is in the MyDocument nib. That  
array controller is set to the entity mode and holds the Entry  
entities; its managedObjectContext is bound to the File's Owner  
managaedObjectContext. So far this is all standard stuff and it works  
as it should. I can add and remove Entries, etc. The problem comes  
when I try to sort the contents of the array. In MyDocument.m I  
implemented windowControllerDidLoadNib: as follows:


- (void)windowControllerDidLoadNib:(NSWindowController  
*)windowController

{
[super windowControllerDidLoadNib:windowController];
// user interface preparation code

	NSSortDescriptor *entrySortDesc = [[[NSSortDescriptor alloc]  
initWithKey:@"title" ascending:YES] autorelease];

NSArray *entrySortDescArray = [NSArray arrayWithObject:entrySortDesc];
[entryArrayController setSortDescriptors:entrySortDescArray];   
}

Now I do the following in the running app:

1) add a single entry to the empty document, and my NSCollectionView  
shows a single row - fine

2) save the document to disk
3) quit and relaunch
4) load the saved document
5) my NSCollectionView now shows two entries, though the second is a  
kind of ghost of the first: I can't select it or anything, and if I  
add a new entry, the this 'ghost' is overwritten


Without the sort descriptors being set, I don't get the strange  
behaviour detailed in 5).


Does anyone have any advice how I can start to debug this? I guess I'm  
doing something wrong - perhaps setting the descriptors on the  
entryArrayConrtroller too early...


Kind regards,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


IB connections with view swapping?

2009-08-20 Thread Oftenwrong Soong
Hi all,

My document-based app will use view swapping, allowing the user to navigate 
through multiple "screens" like a wizard of sorts. I am putting each view in a 
separate nib and using NSViewController. View swapping is working. Now I need 
to make connections between these views and my model.

The nib file's owner is the view controller, not MyDocument. Is it best to bind 
to my model via the view controller's representedObject?

Also I'll need a few Target/Actions. Should I subclass NSViewController, put 
the actions in the subclass, and then forward them to MyDocument? Or is there a 
nicer way?

Thanks,
Soong



  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 1:12 PM, Quincey Morris wrote:

a. I'm not sure how 'loadWindow' got into this discussion -- the  
documentation says not to call 'loadWindow' directly but to call  
'window' instead and let *it* call 'loadWindow'.


  You're right, my mistake. I was responding to Jean-Daniel's message  
("And the -[NSWindowController window] and -[NSWindowController  
loadWindow] confirms that windowDidLoad is invoke only when the nib  
has finish loading.") and got my own wires crossed.



b. 'window' won't return (presumably because an underlying  
'loadNib...' doesn't return) until the NIB is completely loaded,  
including all the invocations of  'awakeFromNib' and the invocation  
of 'windowDidLoad'. AFAIK it's perfectly safe to invoke 'window'  
immediately after creating the window controller, or even during the  
window controller's init method (I've done both without problems).


  Good point.


c. A couple of weeks ago on this list, one of our Apple experts  
(Luke, maybe, but I can't remember for sure) said to use the more  
specialized method (such as 'windowDidLoad') *instead of* the  
generic 'awakeFromNib', if the class has it.


  I missed that thread. Do you happen to know some keywords from the  
subject?


--
I.S.



___

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

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

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

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


Re: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread Kyle Sluder
On Thu, Aug 20, 2009 at 10:04 AM, aaron
smith wrote:
> Anyone have any code I can use to do this?

abort()

--Kyle Sluder
___

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

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

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

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


Re: IB connections with view swapping?

2009-08-20 Thread Kyle Sluder
On Thu, Aug 20, 2009 at 10:39 AM, Oftenwrong
Soong wrote:
> The nib file's owner is the view controller, not MyDocument. Is it best to 
> bind to my model via the view controller's representedObject?

That's what it's for.

> Also I'll need a few Target/Actions. Should I subclass NSViewController, put 
> the actions in the subclass, and then forward them to MyDocument? Or is there 
> a nicer way?

Typically people patch the view controller into the responder chain.
Even with that—and even programs that don't swap views around at
all—sometimes your window or view controller will need to respond to
an action and then turn around and send out a different action to a
specific object.

--Kyle Sluder
___

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

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

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

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


Re: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread aaron smith
thanks, that worked perfect

On Thu, Aug 20, 2009 at 11:03 AM, Kyle Sluder wrote:
> On Thu, Aug 20, 2009 at 10:04 AM, aaron
> smith wrote:
>> Anyone have any code I can use to do this?
>
> abort()
>
> --Kyle Sluder
>
___

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

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

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

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


Re: iPhone: MPVolumeView not displaying

2009-08-20 Thread Eric E. Dolecki
I was able to get it to display, thanks.

On Thu, Aug 20, 2009 at 1:06 PM, William Squires wrote:

> What if you push the (physical) volume up/down button on the side of the
> device? Does it show up then?
>
>
> On Aug 14, 2009, at 11:09 AM, Eric E. Dolecki wrote:
>
>  I just tried with just headphones... I can't get a volume slider at all.
>>
>> Thanks,
>> E.
>>
>> On Aug 14, 2009, at 11:37 AM, Luke the Hiesterman 
>> wrote:
>>
>>  Have you tried just headphones without the dock? I'm just speculating
>>> here, but it seems possible that when it's using line out via the dock,
>>> volume goes away, along the same lines that there is no volume control on
>>> Apple TV - the assumption is that will be handled entirely by the connected
>>> sound system.
>>>
>>> Luke
>>>
>>> On Aug 14, 2009, at 8:34 AM, Eric E. Dolecki wrote:
>>>
>>>  For what it's worth, I don't see a volume slider in the Apple Music app
 on the device either... not sure where that's gone to.


 On Fri, Aug 14, 2009 at 11:32 AM, Eric E. Dolecki 
 wrote:
 I do have the headphones plugged in. Makes no difference. Also doesn't
 display when the thing is docked (ie. a SoundDock).


 On Fri, Aug 14, 2009 at 11:30 AM, Luke the Hiesterman <
 luket...@apple.com> wrote:
 Do you have headphones plugged in? There is no speaker on the original
 iPod Touch, so there is no applicable volume unless headphones are plugged
 in.

 Luke


 On Aug 14, 2009, at 8:27 AM, Eric E. Dolecki wrote:

 I am using this code in my viewDidLoad (I am targeting 3.1)

 MPVolumeView *volumeView = [[[MPVolumeView alloc]
 initWithFrame:volumeSlider.bounds] autorelease];

 [volumeSlider addSubview:volumeView];

 [volumeView sizeToFit];;


 volumeSlider is a UIView set up in IB.


 All I see is "No Volume Available" - I don't see a slider at all. What
 might
 cause this? Running on a 1st gen touch.
 ___

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

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

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

 This email sent to luket...@apple.com




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



 --
 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/wsquires%40satx.rr.com
>>
>> This email sent to wsqui...@satx.rr.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/edolecki%40gmail.com
>
> This email sent to edole...@gmail.com
>



-- 
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: devil of a time with an NSImageView

2009-08-20 Thread Quincey Morris

On Aug 20, 2009, at 11:02, I. Savant wrote:

 I missed that thread. Do you happen to know some keywords from the  
subject?


No, I've looked for it but I can't find it. It was one of a number of  
similar questions around that time, possibly about iPhone views, and  
the comment was an afterthought to some other response, with no  
additional details. All I can remember is that it sent me scurrying to  
change some window controller awakeFromNib's to windowDidLoad's.



___

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

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

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

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


Re: devil of a time with an NSImageView

2009-08-20 Thread I. Savant

On Aug 20, 2009, at 2:31 PM, Quincey Morris wrote:

All I can remember is that it sent me scurrying to change some  
window controller awakeFromNib's to windowDidLoad's.


  :-)

  It has me rethinking some things too, but I won't scurry just yet.

--
I.S.


___

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

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

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

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


How to disable the table view when search bar is active

2009-08-20 Thread Ronnie B
Hi list.
I have a table view with the search bar in it.  Search bar is working fine.
 I would like to have the view disabled while entering text in the search
field.

I have tried this w/o any success:

//delegate
- (void)searchBarTextDidBeginEditing:(UISearchBar *)bar {

  self.tableView.scrollEnabled = NO;
}


Thanks,
Ron.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: -awakeFromNib vs. -windowDidLoad [Was: devil of a time with an NSImageView]

2009-08-20 Thread Andy Lee

On Aug 20, 2009, at 11:05 AM, I. Savant wrote:

On Aug 20, 2009, at 10:59 AM, Kyle Sluder wrote:

Use -awakeFromNib to do view setup (turning on layer backing,  
creating caches colors, etc.). Use -windowDidLoad (or - 
windowControllerDidLoadNib or whatever that NSDocument method is)  
for setting up inter-view relationships.


 Hmm ... so would you say to do otherwise is "doing it wrong" or  
"doing it sub-optimally"?


I'm relatively new to NSWindowController, but I think one benefit is  
avoiding multiple calls to awakeFromNib on the same object when you  
have objects in a nib which might themselves load nibs.


--Andy



___

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

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

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

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


Re: devil of a time with an NSImageView

2009-08-20 Thread Jean-Daniel Dupas


Le 20 août 2009 à 20:02, I. Savant a écrit :


On Aug 20, 2009, at 1:12 PM, Quincey Morris wrote:

a. I'm not sure how 'loadWindow' got into this discussion -- the  
documentation says not to call 'loadWindow' directly but to call  
'window' instead and let *it* call 'loadWindow'.


 You're right, my mistake. I was responding to Jean-Daniel's message  
("And the -[NSWindowController window] and -[NSWindowController  
loadWindow] confirms that windowDidLoad is invoke only when the nib  
has finish loading.") and got my own wires crossed.



b. 'window' won't return (presumably because an underlying  
'loadNib...' doesn't return) until the NIB is completely loaded,  
including all the invocations of  'awakeFromNib' and the invocation  
of 'windowDidLoad'. AFAIK it's perfectly safe to invoke 'window'  
immediately after creating the window controller, or even during  
the window controller's init method (I've done both without  
problems).


 Good point.


c. A couple of weeks ago on this list, one of our Apple experts  
(Luke, maybe, but I can't remember for sure) said to use the more  
specialized method (such as 'windowDidLoad') *instead of* the  
generic 'awakeFromNib', if the class has it.


 I missed that thread. Do you happen to know some keywords from the  
subject?


While I was looking for this thread, I found this old answer from an  
other Cocoa expert (Chris Hanson):


http://lists.apple.com/archives/cocoa-dev/2003/Jul/msg00260.html

I'm quoting the conclusion:

“I prefer to use -awakeFromNib only to finish configuring controls  
themselves, while I prefer to populate them in -windowDidLoad (or its  
NSDocument equivalent). Why? Because they're conceptually two  
different thing. The first is essentially to make up for a lack of  
Interface Builder palettes to finish configuring your view objects --  
for instance, being able to set an NSTableView's double-click action,  
or configuring a data cell for a table column -- while the second  
involves gluing your model objects to your view objects."



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Seth Willits

From the docs:

If a mutable object is added to a collection that uses hash values  
to determine the object’s position in the collection, the value  
returned by thehash method of the object must not change while the  
object is in the collection. Therefore, either the hash method must  
not rely on any of the object’s internal state information or you  
must make sure the object’s internal state information does not  
change while the object is in the collection.



That's pretty hard to deal with.

Returning 0 is certainly simpler :p


--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSSortDescriptor in core-data document app

2009-08-20 Thread Martin Hewitson

Hi bryscomat,

Thanks for the swift reply.

I would implement a method in the File Owner of MyDocument.nib, call  
it "titleSortDescriptors" or something of the like.
Then, in the nib file, I would bind the array controllers sort  
descriptor to "File Owner.titleSortDescriptors".




On your suggestion, I tried that. It has the same effect as before. If  
my saved document has two entries in it, the NSCollectionView shows  
four entries after loading, but the second pair are kind of dummies,  
which disappear as soon as I add another entry.


Also, with Core Data, what may be happening is that when you  
programatically add an item, say on startup of the program, Core  
Data will load the saved Entity from disk and also add the new one,  
which may lead to duplicates. Check to make sure that's not happening.




I don't add any entries programmatically - only when the user clicks  
the 'add' button.


Still puzzled over this one.

Martin


On Aug 20, 2009, at 12:29 PM, Martin Hewitson wrote:


Dear all,

I have a core-data document based app which uses an  
NSCollectionView to display entries of a single entity (Entry) in  
the data model. In  MyDocument.m In this document class I have an  
ivar which holds a reference to the NSArrayController that is in  
the MyDocument nib. That array controller is set to the entity mode  
and holds the Entry entities; its managedObjectContext is bound to  
the File's Owner managaedObjectContext. So far this is all standard  
stuff and it works as it should. I can add and remove Entries, etc.  
The problem comes when I try to sort the contents of the array. In  
MyDocument.m I implemented windowControllerDidLoadNib: as follows:


- (void)windowControllerDidLoadNib:(NSWindowController  
*)windowController

{
[super windowControllerDidLoadNib:windowController];
// user interface preparation code

	NSSortDescriptor *entrySortDesc = [[[NSSortDescriptor alloc]  
initWithKey:@"title" ascending:YES] autorelease];
	NSArray *entrySortDescArray = [NSArray  
arrayWithObject:entrySortDesc];

[entryArrayController setSortDescriptors:entrySortDescArray];   
}

Now I do the following in the running app:

1) add a single entry to the empty document, and my  
NSCollectionView shows a single row - fine

2) save the document to disk
3) quit and relaunch
4) load the saved document
5) my NSCollectionView now shows two entries, though the second is  
a kind of ghost of the first: I can't select it or anything, and if  
I add a new entry, the this 'ghost' is overwritten


Without the sort descriptors being set, I don't get the strange  
behaviour detailed in 5).


Does anyone have any advice how I can start to debug this? I guess  
I'm doing something wrong - perhaps setting the descriptors on the  
entryArrayConrtroller too early...


Kind regards,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
  Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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


This email sent to brysco...@gmail.com





Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Accessing method from another class

2009-08-20 Thread PCWiz
This is going to seem like a complete newbie question, but I can't get  
this to work. I have a class with a method called "resetTextAndBar:"  
which just basically resets some text and a progress bar to match up  
with new data inserted into the table view:


- (void)resetTextAndBar:(id)sender {
[self updateText];
[bar setNeedsDisplay:YES];
}

 I need to call this method from a separate class.

I've tried using #import and forward class (@class), and using NSLog I  
determined that the method IS being called, but the 2 methods  
(updateText: and setNeedsDisplay:) arent being called


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: devil of a time with an NSImageView

2009-08-20 Thread Jonathan Hess
c. A couple of weeks ago on this list, one of our Apple experts  
(Luke, maybe, but I can't remember for sure) said to use the more  
specialized method (such as 'windowDidLoad') *instead of* the  
generic 'awakeFromNib', if the class has it.


I missed that thread. Do you happen to know some keywords from the  
subject?


While I was looking for this thread, I found this old answer from an  
other Cocoa expert (Chris Hanson):


http://lists.apple.com/archives/cocoa-dev/2003/Jul/msg00260.html

I'm quoting the conclusion:

“I prefer to use -awakeFromNib only to finish configuring controls  
themselves, while I prefer to populate them in -windowDidLoad (or  
its NSDocument equivalent). Why? Because they're conceptually two  
different thing. The first is essentially to make up for a lack of  
Interface Builder palettes to finish configuring your view objects  
-- for instance, being able to set an NSTableView's double-click  
action, or configuring a data cell for a table column -- while the  
second involves gluing your model objects to your view objects."


Another reason to prefer a method like viewDidLoad, or windowDidLoad  
to awakeFromNib is that awakeFromNib can potentially be called twice  
on the same object. For example, if you have a window controller, and  
that window controller loads its main NIB file, it will get an  
awakeFromNib message. If that window controller later manually loads a  
second nib file, to present a sheet for example, it will have  
awakeFromNib sent to it a second time since it's the file's owner of  
the NIB file. This second awakeFromNib invocation usually comes as a  
surprise.


I recommend using awakeFromNib to do things like configure an object  
that awakes from a nib, but doesn't care which particular NIB it is.  
For example, if I had a MyView, and I represented it in nib files with  
a "Custom View", and I want them all to start out with their enabled  
boolean set to YES, I would implement awakeFromNib on MyView to set  
the property to YES. Now, if one of my specific windows controllers  
had a NIB with an instance of MyView in it, and it wanted that  
instance to be initially disabled, I would configure that in the  
window controller's windowDidLoad method.


Jon Hess

___

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

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

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

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


Re: NSSortDescriptor in core-data document app

2009-08-20 Thread Martin Hewitson
Got it working. The problem was that I had "Auto Rearrange Content"  
selected on the Entries array controller. I don't really understand  
why this caused the problems I saw, but unchecking it makes the  
problem go away.


Thanks for pointing me in this direction!

Martin

On Aug 20, 2009, at 9:12 PM, Martin Hewitson wrote:


Hi bryscomat,

Thanks for the swift reply.

I would implement a method in the File Owner of MyDocument.nib,  
call it "titleSortDescriptors" or something of the like.
Then, in the nib file, I would bind the array controllers sort  
descriptor to "File Owner.titleSortDescriptors".




On your suggestion, I tried that. It has the same effect as before.  
If my saved document has two entries in it, the NSCollectionView  
shows four entries after loading, but the second pair are kind of  
dummies, which disappear as soon as I add another entry.


Also, with Core Data, what may be happening is that when you  
programatically add an item, say on startup of the program, Core  
Data will load the saved Entity from disk and also add the new one,  
which may lead to duplicates. Check to make sure that's not  
happening.




I don't add any entries programmatically - only when the user clicks  
the 'add' button.


Still puzzled over this one.

Martin


On Aug 20, 2009, at 12:29 PM, Martin Hewitson wrote:


Dear all,

I have a core-data document based app which uses an  
NSCollectionView to display entries of a single entity (Entry) in  
the data model. In  MyDocument.m In this document class I have an  
ivar which holds a reference to the NSArrayController that is in  
the MyDocument nib. That array controller is set to the entity  
mode and holds the Entry entities; its managedObjectContext is  
bound to the File's Owner managaedObjectContext. So far this is  
all standard stuff and it works as it should. I can add and remove  
Entries, etc. The problem comes when I try to sort the contents of  
the array. In MyDocument.m I implemented  
windowControllerDidLoadNib: as follows:


- (void)windowControllerDidLoadNib:(NSWindowController  
*)windowController

{
[super windowControllerDidLoadNib:windowController];
// user interface preparation code

	NSSortDescriptor *entrySortDesc = [[[NSSortDescriptor alloc]  
initWithKey:@"title" ascending:YES] autorelease];
	NSArray *entrySortDescArray = [NSArray  
arrayWithObject:entrySortDesc];

[entryArrayController setSortDescriptors:entrySortDescArray];   
}

Now I do the following in the running app:

1) add a single entry to the empty document, and my  
NSCollectionView shows a single row - fine

2) save the document to disk
3) quit and relaunch
4) load the saved document
5) my NSCollectionView now shows two entries, though the second is  
a kind of ghost of the first: I can't select it or anything, and  
if I add a new entry, the this 'ghost' is overwritten


Without the sort descriptors being set, I don't get the strange  
behaviour detailed in 5).


Does anyone have any advice how I can start to debug this? I guess  
I'm doing something wrong - perhaps setting the descriptors on the  
entryArrayConrtroller too early...


Kind regards,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
 Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

This email sent to brysco...@gmail.com





Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
   Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de

This email sent to martin.hewit...@aei.mpg.de



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-586

Re: When do I need to override hash?

2009-08-20 Thread David Duncan

On Aug 20, 2009, at 12:00 PM, Seth Willits wrote:


Returning 0 is certainly simpler :p



It is, but you can generally do better than just returning 0, usually  
by just extracting some bits from 'self', ala


-(NSUInteger)hash
{
uintptr_t hash = (uintptr_t)self;
return (hash >> 4);
}

This satisfies the condition of hash (two equal objects will have the  
same hash code) without relying on object state (since a particular  
object's location in memory will never change). You can probably do  
even better than this, but as with hash codes in general there is a  
certain amount of experimentation required.

--
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: Heartbeat thread is blocked? -- With Code and Movie

2009-08-20 Thread Seth Willits

On Aug 20, 2009, at 7:34 AM, Sean McBride wrote:


When you turn layering on for a view, it turns it on for all subviews
also.  They recommend you try to minimise the number of views using
layering.  I've found that lots of view don't draw properly with
layering on, like NSPathControl and others.  IIRC it's in the AppKit
release notes.



Right, but the issue is somehow CA blocks the heartbeat thread which  
affects *any* animated control *anywhere* in the app. It's not limited  
to layer-backed views.



--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Force crash a cocoa app for Crash Reporter testing

2009-08-20 Thread jonat...@mugginsoft.com


On 20 Aug 2009, at 19:03, Kyle Sluder wrote:


On Thu, Aug 20, 2009 at 10:04 AM, aaron
smith wrote:

Anyone have any code I can use to do this?


abort()

which calls

raise(SIGABRT); // SIGFPE and SIGSEGV also may be tried

abort() is defined to optionally flush streams and delete temporary  
files.




--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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Developer
http://www.mugginsoft.com





___

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

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

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

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


Re: Accessing method from another class

2009-08-20 Thread Steve Christensen
If your logging code is displaying a message on entry to  
resetTextAndBar:, but nothing after that, it sounds like you're  
taking an exception. In your code snippet below, you're calling [self  
updateText], but in the last sentence of your problem description,  
you mention a method called updateText: (with trailing colon). Which  
is it?


You might check any warnings you're receiving during compilation  
because, at least for me, if I accidentally reference a method that's  
not part of the specified class, I get a "class foo may not respond  
to method bar" sort of warning.


steve


On Aug 20, 2009, at 12:18 PM, PCWiz wrote:

This is going to seem like a complete newbie question, but I can't  
get this to work. I have a class with a method called  
"resetTextAndBar:" which just basically resets some text and a  
progress bar to match up with new data inserted into the table view:


- (void)resetTextAndBar:(id)sender {
[self updateText];
[bar setNeedsDisplay:YES];
}

 I need to call this method from a separate class.

I've tried using #import and forward class (@class), and using  
NSLog I determined that the method IS being called, but the 2  
methods (updateText: and setNeedsDisplay:) arent being called


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: When do I need to override hash?

2009-08-20 Thread Clark Cox
On Thu, Aug 20, 2009 at 12:33 PM, David Duncan wrote:
> On Aug 20, 2009, at 12:00 PM, Seth Willits wrote:
>
>> Returning 0 is certainly simpler :p
>
>
> It is, but you can generally do better than just returning 0, usually by
> just extracting some bits from 'self', ala
>
> -(NSUInteger)hash
> {
>        uintptr_t hash = (uintptr_t)self;
>        return (hash >> 4);
> }
>
> This satisfies the condition of hash (two equal objects will have the same
> hash code)

No it doesn't. Writing the hash method like that basically prevents
you from having an isEqual that does anything other than a pointer
comparison.

-- 
Clark S. Cox III
clarkc...@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: Core Data dog-slow when using first time after boot

2009-08-20 Thread Ben Trumbull


On Aug 20, 2009, at 2:34 AM, Ruotger Skupin wrote:



Am 19.08.2009 um 22:00 schrieb Ben Trumbull:

I debugged it with some Snow Leopard magic and found out, that  
firing

faults is very slow the first time after boot. When I use -[NSArray
filteredArrayUsingPredicate:] the fault firing is killing me.


What's the predicate you are using ?
I'm not using a predicate for the first fetch. (Ok, I have learned  
now, I should do so.)


Okay, but what was the predicate you were passing to  
filteredArrayUsingPredicate: ?


You're almost certainly filtering in memory after fetching only a  
subset of the data needed to perform your in memory filtering  
(specifically, only the source entity and not its relationships).
Yes I do some on-the-fly filtering which depends on other objects.  
(Ok, lesson learned: Bad idea)


Dynamic filtering isn't necessarily bad.  The goal is always to  
perform the least amount of I/O and consume the least amount of  
memory.  This produces the best  performance.


Since you didn't fetch the related objects, Core Data goes and  
retrieves them on demand.  However, mind reading is technically  
challenging, and Plan B, retrieving the related objects one at a  
time, is a rather inefficient I/O pattern. It would be vastly  
faster to filter the data in the database using a predicate on the  
fetch request.
So, would it be better to perform the on-the-fly filtering  
calculation every time the object changes and put flags in the root  
object? Then fetch with a predicate testing these flags? Probably.  
(model change! yay!)


Uhm, I think we're getting way ahead of ourselves.  That's probably  
serious overkill for the problem you're currently facing.


If that's not possible, then you should use a fetch request  
predicate that approximates what you need, and filter those results  
more precisely in memory.
That's what I'm doing now because the most common use case is: I  
need almost everything. So the approximation is: I fetch everything  
and filter out some objects.


Well, we can provide better suggestions with the actual filtering  
predicate you're using.  But the primary point here is that you're NOT  
fetching everything.  You're only fetching the objects on one side of  
a relationship, but filtering based on information across a  
relationship.


Like a bounding rect in views.  If you have already fetched the  
objects, but want to identity different subsets, you can use  
objectID fetch results to simply identify the matching objects  
without pulling back all the row data.

The subsets depend on the data of the objects. (Smart Folders)

Complex locale aware Unicode text queries can be slow.  If you find  
yourself spending time with such a query, you should consider some  
of the techniques shown in the DerivedProperty example available on  
ADC.
Isn't all text Unicode? I don't understand. This shouldn't be a  
special case. But I will have a look at the sample.


You can HAVE as much Unicode text as you want.  That's just bytes.   
But performing regex or CONTAINS searches on Unicode text is very  
expensive.


In my case I'd guess that at least half of the objects contain  
unicode strings (international names and addresses). What I want to  
say: write anything in German or French and you end up with Unicode.


Typically, apps that launch slowly once, and then run quickly  
afterwards are doing far too much I/O.  On successive launches, the  
kernel has cached most of the data, so instead of doing to-disk I// 
O the app is doing to-kernel-memory I/O.


As stated before I need almost all data anyway. Is there a way to  
bulk-load the whole database into mem in one go? That's not what sql  
is about, is it?


setRelationshipKeyPathsForPrefetching

The most common problem in Core Data apps is when people allow  
faulting to lazily fetch data one row at a time, even when the app  
needs all the data immediately.  They should prefetch the related  
objects with the original fetch request by setting the prefetching  
keypaths.

Ok, will try to do that.

Another question: I'm using Garbage Collection. Should I look out  
for something special there? Keep managed objects on purpose?  
Letting them go as soon as possible?



One thing at a time.  Add the appropriate prefetching to your fetch  
request and then reprofile the app.


- Ben


___

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

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

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

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


  1   2   >