Re: Core data fetch returns no objects

2008-09-18 Thread Tomaž Kragelj
Thanks for pointing this out. I use fetch request to get the data, so  
I thought this should work. Digging even further I realized my  
predicate relies on a transient attribute. So I had to rearrange the  
model and now the fetching works.


Interestingly - array controllers (seem to?) work correctly with  
transient relationships accross stores without using fetch request. Is  
this a potential problem?


Thanks, Tom
___

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

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

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

This email sent to [EMAIL PROTECTED]


Document context

2008-09-18 Thread Apparao Mulpuri
Hi,

I am little confused with the method + (id)elementWithName:(NSString
*)name in NSXMLNode. Is this method will create a new node with in the
current document context or outside of any document context?.

In the Xcode documentation, apple didn't mention about the document context.

- Apparao Mulpuri.
___

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

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

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

This email sent to [EMAIL PROTECTED]


NsPredicateEditor

2008-09-18 Thread Sandro Noel

Greetings.

I would like to use NSPredicateEditor to build a filtering string to  
filter out items from an array.
but i cant seem to find a tutorial on the matter, and the cocoa  
documentation gets me lost, there is not enough information in there
for me to really grasp what i should do to make it work, it must be  
one of those " it's so simple it's complicated to understand"


would someone be so kind to explain how i can achieve this.

in the interface builder i have a NSPredicateEditor
I edited the templates that are in place in the designer,
I created an outlet for it in my controller and connected them together.
but when I run the application the editor is empty.

then once he predicate is running i want to compare every tiems in my  
array with it, and delete from the array the items that do not match.


thank you so much.

Sandro.
___

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

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

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

This email sent to [EMAIL PROTECTED]


How make a cocoa lib wich create a window ?

2008-09-18 Thread rouanet brice
Hi,

I work on a projetc where the executable haven't GUI but I can launch somme
gui window with plugins.

test <- no gui application
 -plugin
   -triangle <- this plugin display a triangle in a cocoa window
   -rectangle <- this plugin display a rectangle in a cocoa window

All plugins works in standolone applications, but when I launch test, I cant
see the window.

Regards.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: fullscreen quicktime across multiple monitors

2008-09-18 Thread Michael Ash
On Wed, Sep 17, 2008 at 3:03 PM, Memo Akten <[EMAIL PROTECTED]> wrote:
> Hi All, I'd like to create a little app the runs a quicktime movie (prores)
> fullscreen across multiple monitors. I think I can figure out the QTKit
> stuff, but couldn't find upto date documentation on going fullscreen. I've
> found some code snippets to do it, but they are all pre-leopard and I have a
> feeling that its a bit more straightforward on leopard (i'm hoping). Can
> anyone point me in the right direction? (or has this already been done?) Its
> for personal use and not distribution so min specs 10.5.5 etc. is fine.

"Fullscreen" just means that you cover the entire screen with your
window. In this case, covering all screens. There's no need for a
special API (although special APIs are available), just make a
standard NSWindow, set its frame to cover all the screens, make sure
that it contains what you want, and you're good.

For more specific guidance, NSScreen can be used to find out where all
the screens are, NSBorderlessWindowMask will give you a window with no
title bar or other distracting decorations, and
NSApplicationDidChangeScreenParametersNotification will tell you if
the configuration of the screens changed so you can re-position your
window.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: fullscreen quicktime across multiple monitors

2008-09-18 Thread John C. Randolph


On Sep 17, 2008, at 12:03 PM, Memo Akten wrote:

Hi All, I'd like to create a little app the runs a quicktime movie  
(prores) fullscreen across multiple monitors. I think I can figure  
out the QTKit stuff, but couldn't find upto date documentation on  
going fullscreen. I've found some code snippets to do it, but they  
are all pre-leopard and I have a feeling that its a bit more  
straightforward on leopard (i'm hoping). Can anyone point me in the  
right direction? (or has this already been done?) Its for personal  
use and not distribution so min specs 10.5.5 etc. is fine.


Leopard introduced a new API for this.  See NSView's  
enterFullScreenMode:withOptions: method.


-jcr
___

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

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

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

This email sent to [EMAIL PROTECTED]


Core data in private framework.

2008-09-18 Thread Scott Andrew
I have a question. We are designing a private frame work to wrap our  
data handling. The framework is using Core Data with an SQL back end.  
However we get errors when loading data if the model file is not  
included in the application and is just in the framework. I looked  
through the docs and couldn't find any help. Are there any tricks to  
having the data model file (.mom) exist in the private framework and  
not in the application's resources? We would like the data class to be  
used across applications by just including the framework.


Scott Andrew
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Listening for changes in a table

2008-09-18 Thread Chris Idou
--- On Thu, 9/18/08, Ken Thomases <[EMAIL PROTECTED]> wrote:

> Two possibilities:
> 
> * If you used a custom class rather than a dictionary, then
> there  
> would be a setter of your own design called when the
> property is set  
> due to a change in the checkbox.  

Yes I could do that, but given that I'm storing the result in the user 
preferences, and the user preferences can store dictionaries but not objects, I 
was hoping to stay with dictionaries.

Maybe I should try inheriting from NSMutableDictionary or something.

> * Your controller can use KVO to observe the property to
> which the  
> checkbox is bound.  Then it will receive change
> notifications when the  
> property is changed.

Would that mean observing every single dictionary in the array and adding and 
removing observers as the array expands and contracts? Sounds fiddly.

--- On Thu, 9/18/08, I. Savant <[EMAIL PROTECTED]> wrote:

>Why does everybody forget about / ignore
> ?

I'm a bit vague on how a DataSource and an ArrayController work together. Do 
you choose one or the other? In any case, it sounds like a fairly fiddly option 
too.





  
___

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

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

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

This email sent to [EMAIL PROTECTED]


PrefPane initialFirstResponder and nextKeyView

2008-09-18 Thread Jonathan Hohle
I've built a preference pane for System Preferences, but when its  
loaded it appears that initialFirstReponder as well as nextKeyView for  
each view is ignored.


I've set the window's initialFirstResponder to the first view I'd like  
to navigate to with the keyboard, however, another view is selected  
first. This works during simulation, but not once the preference pane  
has been loaded.


Is there some other way of specifying keyboard navigation order in a  
nib (xib) that will be loaded into System Preferences?


Jon
<><
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 8:54 PM, Jim Correia wrote:

Since mutable framework provided objects can (and do) change hash  
values as they are mutated, I agree with your tenuous classification  
of the situation. In the general case, storing mutable objects in  
hash-table like collections outside of a well controlled and tightly  
scoped scenario.


Left the last phrase out of that sentence...

...is probably best avoided.

- Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Listening for changes in a table

2008-09-18 Thread I. Savant
Yes I can put an action on the ButtonCell, but this doesn't tell me  
which record in the array  the  clicked cell relates to.


  Why does everybody forget about / ignore ?

http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSTableDataSource_Protocol/Reference/Reference.html

  Bindings works fine with , so mix the two. As  
the table's data source, you can receive  
tableView:setObjectValue:forTableColumn:row: and use 'row' to ask the  
array controller for the object at the arranged index, let the array  
controller handle setting the value based on a view's action and do  
anything else you please in response.


  Of course this doesn't help you to respond to a change in the  
checkbox's state prompted by a change in your model ([someObject  
setFoo:YES]) but I assume you mean to respond to the user's actions.


--
I.S.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Listening for changes in a table

2008-09-18 Thread Ken Thomases

On Sep 18, 2008, at 7:43 PM, Chris Idou wrote:

Well I do have the checkbox bound to the controller. It is bound to  
one of the attributes in the array of mutable dictionaries contained  
within my NSArrayController.


But I don't see how this lets me get control to do something when  
someone clicks the checkbox.


Two possibilities:

* If you used a custom class rather than a dictionary, then there  
would be a setter of your own design called when the property is set  
due to a change in the checkbox.  You could put code into that setter  
to do... whatever.


* Your controller can use KVO to observe the property to which the  
checkbox is bound.  Then it will receive change notifications when the  
property is changed.



Yes I can put an action on the ButtonCell, but this doesn't tell me  
which record in the array  the  clicked cell relates to.


If you use bindings to set the target of the cell, and you use a  
custom class with an action method rather than a dictionary, you could  
have the cell deliver an action directly to the model object.


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


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 8:36 PM, Shawn Erickson wrote:


On Sep 18, 2008, at 4:39 PM, Jim Correia wrote:

Additional care must be taken if you are implementing a mutable  
object and intend to store it in a collection: the object's -hash  
cannot change while it is in the collection (so effectively, the  
object's hash cannot be derived from any mutable properties of the  
object.)


This isn't a requirement of isEqual: or hash and in fact doing such  
a thing cannot break the requirement I stated and the obvious one I  
didn't state... that an object that shouldn't be considered equal to  
another needs to return false for [objectA isEqual:objectB]  and  
hashes may or may not be that same value.


The implied bit of text at the end of my parenthetical comment is "if  
you expect to store the value in a hashtable, mutate, and later  
retrieve it."


Expecting a set of mutable objects or a dictionary with mutable keys  
to work correctly (note NSDictionary copies keys for this very  
reason) under such situations in tenuous. It can be made to work if  
you own the code for the mutable objects being used and want to add  
such an assurance to your object's contract with out breaking the  
expectation of isEqual:.


I wasn't thinking of the dictionary (key) case, but for the value case  
in other hash-table like objects like NSSet.


Since mutable framework provided objects can (and do) change hash  
values as they are mutated, I agree with your tenuous classification  
of the situation. In the general case, storing mutable objects in hash- 
table like collections outside of a well controlled and tightly scoped  
scenario.


Jim


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Shawn Erickson


On Sep 18, 2008, at 5:33 PM, Ken Thomases wrote:

Another counterexample is an object which doesn't provide value  
semantics.  That is, its -isEqual: only tests identify (pointer  
comparison) and whose hash is purely based on the object pointer.


..or say a "person" object which is considered equal if two person  
objects have the same email address while all other attributes of the  
object  (say phone number, first name, last name, etc.) are not a  
factor when considering equality. In this case you can safely mutate  
all properties of said person object except for email address if that  
object is being used in a collection (or data structure) that depends  
on hash or isEqual: for its storage and look up.


-Shawn

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Listening for changes in a table

2008-09-18 Thread Chris Idou
Well I do have the checkbox bound to the controller. It is bound to one of the 
attributes in the array of mutable dictionaries contained within my 
NSArrayController.

But I don't see how this lets me get control to do something when someone 
clicks the checkbox.

Yes I can put an action on the ButtonCell, but this doesn't tell me which 
record in the array  the  clicked cell relates to.


--- On Wed, 9/17/08, Kyle Sluder <[EMAIL PROTECTED]> wrote:

> From: Kyle Sluder <[EMAIL PROTECTED]>
> Subject: Re: Listening for changes in a table
> To: [EMAIL PROTECTED]
> Cc: cocoa-dev@lists.apple.com
> Date: Wednesday, September 17, 2008, 11:54 PM
> On Wed, Sep 17, 2008 at 8:46 PM, Chris Idou
> <[EMAIL PROTECTED]> wrote:
> > I've got a NSTableView controlled by an
> NSArrayController, which uses an array of
> NSMutableDictionaries as its controlled objects. One of the
> columns is a checkbox. These dictionaries are ultimately
> stored in the user's preferences. How would I get
> immediate notification if a user changed one of the
> checkboxes? I would need to know which record (dictionary)
> the checkbox referred to.
> 
> You would probably want to bind the checkbox to a property
> on the
> model object, or use the standard target/action mechanism
> on the
> NSButtonCell belonging to the table column.
> 
> In other words, your question doesn't really make
> sense.  You seem to
> be going at it backwards; you shouldn't be concerned at
> all about the
> table view, this is either something for the model or the
> controller
> to be taking care of.
> 
> --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 [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Shawn Erickson


On Sep 18, 2008, at 4:39 PM, Jim Correia wrote:


On Sep 18, 2008, at 7:32 PM, Shawn Erickson wrote:

On Thu, Sep 18, 2008 at 4:19 PM, Keith Duncan <[EMAIL PROTECTED]>  
wrote:
if two objects compare equal, then they must have the same hash  
[...]
[you] have to implement a corresponding -hash that maintains this  
invariant

rule.


Is there an example somewhere of what one should do to implement - 
hash to
reflect -isEqual:, I haven't done so in one of my classes and it  
works fine.
Would you just combine the -hash of the objects used to determine - 
isEqual:

in a logical manner, say XOR?


The only requirement is that if [objectA isEqual:objectB] returns  
true

then [objectA hash] == [objectB hash] must be true as well.


Additional care must be taken if you are implementing a mutable  
object and intend to store it in a collection: the object's -hash  
cannot change while it is in the collection (so effectively, the  
object's hash cannot be derived from any mutable properties of the  
object.)


This isn't a requirement of isEqual: or hash and in fact doing such a  
thing cannot break the requirement I stated and the obvious one I  
didn't state... that an object that shouldn't be considered equal to  
another needs to return false for [objectA isEqual:objectB]  and  
hashes may or may not be that same value.


Expecting a set of mutable objects or a dictionary with mutable keys  
to work correctly (note NSDictionary copies keys for this very reason)  
under such situations in tenuous. It can be made to work if you own  
the code for the mutable objects being used and want to add such an  
assurance to your object's contract with out breaking the expectation  
of isEqual:.


-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Ken Thomases

On Sep 18, 2008, at 7:12 PM, Keith Duncan wrote:

if [objectA isEqual:objectB] returns true then [objectA hash] ==  
[objectB hash] must be true



the object's hash cannot be derived from any mutable properties of  
the object


So, with both those points in mine how exactly does one implement it.


I think that for all practical purposes, the answer is that you just  
aren't allowed to mutate objects that are in collections.  The  
documentation for -hash gives the example that "a mutable dictionary  
can be put in a hash table but you must not change it while it is in  
there".


One counterexample is internal storage that isn't integral to the  
object's value.  For example, an object may cache a value in some  
internal storage while it's in a collection, but that cached value  
can't participate in either -isEqual: or -hash.  That is, the cached  
value is incidental and doesn't change the object's externally visible  
value.


Another counterexample is an object which doesn't provide value  
semantics.  That is, its -isEqual: only tests identify (pointer  
comparison) and whose hash is purely based on the object pointer.   
Like the default NSObject implementation.  Such an object never  
compares equal to any other object.  It may also be safely mutated  
within a collection.  (However, such an object would be a poor  
candidate for a dictionary key, for example.  Dictionary keys are  
copied, and since the copy can never equal the original, you'd never  
be able to look up the value using the original key.  It'd be fine in  
a set, though.)


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


Re: Utility/Floating window with titlebar on left side

2008-09-18 Thread Nick Beadman

Kyle,

Thanks for the reply.


On Sep 18, 2008, at 12:08 am, Kyle Sluder wrote:

On Wed, Sep 17, 2008 at 3:04 PM, Nick Beadman <[EMAIL PROTECTED]>  
wrote:


The issue I am having is that I want my NSPanel to have the title  
bar on the (left) side. In Carbon there is an WindowAttribute  
(kWindowSideTitlebarAttribute) which makes this trivial but I can't  
find anything equivalent in Cocoa.


Hrm.  Unless your window looks like the Formula bar in Excel,  
perhaps this isn't the best idea.  But whatever, we'll roll with  
it.  In any case, file an enhancement request at http://bugreport.apple.com 
 and see if Apple gives word on this feature.


Will do, just thought I would ask to see if was a common request with  
a well established solution. In my (limited) experience, Apple doesn't  
really communicate too much on feature request (not saying they take  
no notice, just they don't communicate much, if at all).


As for it not being the best idea, I think that is more of a value  
judgement but the reason I am pursuing it is because screens are wider  
than they are tall so putting the title bar on the side uses (much)  
less screen real estate. In fact I would like to see many more  
vertical controls (e.g. NSSegmentedControl) but this is also probably  
another feature request.


Searching found an item on cocodev  which suggests that this isn't possible and suggests subclassing  
NSWindow using NSBorderlessWindowMask which directed me to the  
"RoundTransparentWindow" sample. Of course, the issue with this is  
that the entire title bar, all of the close/minimize/maximize  
buttons and resize box have to be custom controls which is not an  
insignificant amount of work.


Psst... +[NSWindow standardWindowButton:].  :)


What an interesting class method! Makes me think Cocoa has at least  
thought about this, maybe I should go whole hog and ask for a "theme  
manager" so the graphics for building standard controls are easily  
available :-).


More searching suggested that the controls in the window created by  
Carbon and initWithWindowRef: would have to be Carbon controls even  
though it would be much easier in this case that they be Cocoa. The  
solution in Leopard appears to be HICocoaView but that isn't an  
option for me as the application has to run on Tiger (10.4) too.


You should be creating your controls in the nib.  Though this does  
present an interesting question of whether it's possible to provide  
the desired mask using a Carbon nib.



I am creating my controls in a nib. HICocoaView allows you to embed an  
entire NSView hierarchy and when I was experimenting I simple moved  
all of my views that were embedded in a NSPanel and moved them to an  
NSView and then embedded (using code) that into the HICocoaView after  
getting it from a nib.


Interface Builder  does have "Side Title" checkbox in the Appearance  
section of the window attributes inspector when working on Carbon  
window. IB2 is slightly more intelligent in that it knows it should  
only be enabled for certain window types (e.g. utility windows).


I would still be interested in sample code showing a sub-class of  
NSWindow or NSPanel

Nick

--
Nick Beadman
[EMAIL PROTECTED]
(sent from my mailing list account, [EMAIL PROTECTED])

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Keith Duncan
if [objectA isEqual:objectB] returns true then [objectA hash] ==  
[objectB hash] must be true



the object's hash cannot be derived from any mutable properties of  
the object


So, with both those points in mine how exactly does one implement it.  
They would imply the following -


id objectA = [objectB copy];
objectA.someProperty = aValue; // aValue != objectB.someProperty

[object.A isEqual:objectB] => false
[objectA hash] == [objectB hash] => true

This makes no sense to me; though I can see the logic -isEqual: =>  
hash equality (noting the arrow direction), what does one base the - 
hash on for it to be identical for -isEqual: objects yet immutable  
itself. How does, say an array do it?


The following code which doesn't seem to conform the guidelines:

>> array = ["one", "two", "three"].to_ns.mutableCopy
>> array.oc_hash
=> 2
>> array.addObject "three".to_ns
>> array.oc_hash
=> 3

I must be missing something truly fundamental here.

Keith Duncan
[EMAIL PROTECTED], 33software.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 7:32 PM, Shawn Erickson wrote:

On Thu, Sep 18, 2008 at 4:19 PM, Keith Duncan <[EMAIL PROTECTED]>  
wrote:
if two objects compare equal, then they must have the same hash  
[...]
[you] have to implement a corresponding -hash that maintains this  
invariant

rule.


Is there an example somewhere of what one should do to implement - 
hash to
reflect -isEqual:, I haven't done so in one of my classes and it  
works fine.
Would you just combine the -hash of the objects used to determine - 
isEqual:

in a logical manner, say XOR?


The only requirement is that if [objectA isEqual:objectB] returns true
then [objectA hash] == [objectB hash] must be true as well.


Additional care must be taken if you are implementing a mutable object  
and intend to store it in a collection: the object's -hash cannot  
change while it is in the collection (so effectively, the object's  
hash cannot be derived from any mutable properties of the object.)


Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Shawn Erickson
On Thu, Sep 18, 2008 at 4:19 PM, Keith Duncan <[EMAIL PROTECTED]> wrote:
>> if two objects compare equal, then they must have the same hash [...]
>> [you] have to implement a corresponding -hash that maintains this invariant
>> rule.
>
> Is there an example somewhere of what one should do to implement -hash to
> reflect -isEqual:, I haven't done so in one of my classes and it works fine.
> Would you just combine the -hash of the objects used to determine -isEqual:
> in a logical manner, say XOR?

The only requirement is that if [objectA isEqual:objectB] returns true
then [objectA hash] == [objectB hash] must be true as well.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing an NSImage in a CALayer

2008-09-18 Thread David Duncan

On Sep 18, 2008, at 3:33 PM, Brad Gibbs wrote:


The PNG is in the main bundle -- in my Resources folder.


You can do this to get a CGImageRef directly. (written in Mail, no  
error checking).


CFURLRef imageURL = CFBundleCopyResourceURL(CFBundleGetMainBundle(),  
(CFStringRef)@"myImage.png", NULL, NULL);
CGImageSourceRef imageSource = CGImageSourceCreateWithURL(imageURL,  
NULL);

CFRelease(imageURL);
CGImageRef image = CGImageSourceCreateImageAtIndex(imageSource, 0,  
NULL);

CFRelease(imageSource);

Then you can assign 'image' to your layer's contents.

On Sep 18, 2008, at 3:18 PM, Matt Long wrote:


Use this code:

- (CGImageRef)nsImageToCGImageRef:(NSImage*)image;
{
   NSData * imageData = [image TIFFRepresentation];
   CGImageRef imageRef;
   if(imageData)
   {
   CGImageSourceRef imageSource =
 CGImageSourceCreateWithData(
   (CFDataRef)imageData,  NULL);

   imageRef = CGImageSourceCreateImageAtIndex(
  imageSource, 0, NULL);
   }
   return imageRef;
}



While this code is popular, I wouldn't recommend it as a general  
conversion. Creating a TIFF representation in order to generate a  
CGImageRef is going to be considerably more costly than a more direct  
alternative. Instead I would recommend creating a CGBitmapContext,  
drawing the NSImage to it and then extracting a CGImageRef from the  
bitmap context. Something like this (again, written in Mail, no error  
checking).


CGColorSpaceRef genericRGB =  
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB);
CGContextRef context = CGBitmapContextCreate(NULL, desiredWidth,  
desiredHeight, 8, 0, genericRGB, kCGImageAlphaPremultipliedFirst);
NSGraphicsContext *nsGraphicsContext = [NSGraphicsContext  
graphicsContextWithGraphicsPort:context flipped:NO];

[NSGraphicsContext saveGraphicsState];
[myNSImage drawAtPoint:NSZeroPoint fromRect:NSZeroRect  
op:NSCompositeCopy fraction:1.0];

[NSGraphicsContext setCurrentContext:nsGraphicsContext];
CGImageRef image = CGBitmapContextCreateImage(context);
CFRelease(context);

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


Re: alloc]init] VS new]

2008-09-18 Thread Sandro Noel

Woua cool ...
Thank you Nick!

my assumption was incorrect.


Sandro

On 18-Sep-08, at 5:04 PM, Nick Zitzmann wrote:



On Sep 18, 2008, at 2:50 PM, Sandro Noel wrote:


couls someone point me to the doc ?



>


Nick Zitzmann




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Keith Duncan
if two objects compare equal, then they must have the same hash  
[...] [you] have to implement a corresponding -hash that maintains  
this invariant rule.


Is there an example somewhere of what one should do to implement -hash  
to reflect -isEqual:, I haven't done so in one of my classes and it  
works fine. Would you just combine the -hash of the objects used to  
determine -isEqual: in a logical manner, say XOR?


Keith Duncan
[EMAIL PROTECTED], 33software.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 6:23 PM, Rick Mann wrote:

I thought isEqualTo was a method on NSObject, but I realize now it's  
part of the NSComparisonMethods Protocol.


The whole thing strikes me as a bit messy.


Also note which header that category lives in - NSScriptWhoseTests.h.  
That provides valuable information - this has something to do with  
Cocoa Scripting and may not be for general use.


Even with Cocoa's remarkably consistent and good naming conventions,  
it is not generally possible to encode everything you might need to  
know about a method in its name. Fortunately, we also have API and  
conceptual doc.


Anyone who was around during the "description forthcoming" days of Mac  
OS X developer documentation can attest that the situation today is  
much, much better than in days past.


Failure to make effective use of the documentation is only going to  
put you at a disadvantage.


Jim

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing an NSImage in a CALayer

2008-09-18 Thread Brad Gibbs


On Sep 18, 2008, at 3:18 PM, Matt Long wrote:


You've got some fundamental issues here.


That doesn't surprise me...


This call in particular:

imageLayer drawLayer:imageLayer inContext:ctx];

It doesn't make sense.

-drawLayer:inContext is a delegate method. You are overriding  
drawing functionality for the layer in question. Instead you would  
set the layer's delegate to your app delegate (or whatever  
controller you're using) and then implement drawLayer:inContext in  
your controller.


e.g.

[imageLayer setDelegate:self]

then implement

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
   if( layer == imageLayer )
   {
   [layer setContents:imageRef];
   }
}

There are other deeper problems here, so maybe I'll just answer how  
to get a CGImageRef...


Use this code:

- (CGImageRef)nsImageToCGImageRef:(NSImage*)image;
{
   NSData * imageData = [image TIFFRepresentation];
   CGImageRef imageRef;
   if(imageData)
   {
   CGImageSourceRef imageSource =
 CGImageSourceCreateWithData(
   (CFDataRef)imageData,  NULL);

   imageRef = CGImageSourceCreateImageAtIndex(
  imageSource, 0, NULL);
   }
   return imageRef;
}

you then call [imageLayer setContents:imageRef] where imageRef is  
the CGImageRef object returned.



It looks like you're making things more difficult than they need to  
be. Maybe clarify a little what you are doing. What does this mean:  
"The goal is to create a method that allows me to pass an NSImage as  
an argument to create a layer-hosting view."?


I'm trying to create two classes that generate views that will be used  
as buttons.  One class generates a button view with a title, the other  
generates a view with an image.  I'm using CA to animate a CIBloom  
filter that pulses once when the button is pressed.  There will be  
several of each of these buttons in my UI, the only difference between  
them will be the titles or images on them.  So, I'm trying to  
encapsulate the button-making behavior into a single class that I can  
pass a title or image to in order to create a new instance of a  
button, which will be displayed and controlled from the appropriate  
view controller or window controller.  I have the title button maker  
working, but I'm stumbling with the image button maker, as you've  
noticed.





Best regards,

-Matt




On Sep 18, 2008, at 3:54 PM, Brad Gibbs wrote:


Hi,

I'm trying to draw an NSImage (a PNG) in a CALayer.  The goal is to  
create a method that allows me to pass an NSImage as an argument to  
create a layer-hosting view.  I have:



-(id)drawButton: (NSView *)button withImage:(NSImage *)anImage {
...
// image layer
imageLayer=[CALayer layer];
[imageLayer drawLayer:imageLayer inContext:ctx];


___

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

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

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

This email sent to [EMAIL PROTECTED]


Games for iPhone

2008-09-18 Thread D.K. Johnston
I've written a couple of cute little memory games. If anyone is  
interested in creating an iPhone interface for them, please contact me  
off-list.


dkj
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing an NSImage in a CALayer

2008-09-18 Thread Brad Gibbs

The PNG is in the main bundle -- in my Resources folder.


On Sep 18, 2008, at 3:16 PM, David Duncan wrote:


On Sep 18, 2008, at 2:54 PM, Brad Gibbs wrote:

I'm trying to draw an NSImage (a PNG) in a CALayer.  The goal is to  
create a method that allows me to pass an NSImage as an argument to  
create a layer-hosting view.  I have:


Where is this PNG originating? The answer may mean a simpler (and  
potentially faster) method can be used...



[imageLayer drawLayer:imageLayer inContext:ctx];


You don't call this function yourself. You set the delegate on the  
CALayer and you implement this method. When the CALayer needs image  
content it will be called automatically with the correct parameters.  
This is usually as a result of a -display message being sent to the  
layer (which is typically arranged for by sending -setNeedsDisplay).

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


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Rick Mann


On Sep 18, 2008, at 15:15:11, Charles Srstka wrote:

According to the documentation, isEqualToString: is faster when you  
know both objects are strings. I'm not sure what isEqualTo: is for,  
though.



Thanks to all for the answers.

I thought isEqualTo was a method on NSObject, but I realize now it's  
part of the NSComparisonMethods Protocol.


The whole thing strikes me as a bit messy.

--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Ken Thomases

On Sep 18, 2008, at 5:15 PM, Charles Srstka wrote:


On Sep 18, 2008, at 4:59 PM, Dave DeLong wrote:

IIRC, isEqual: compares memory addresses, whereas isEqualTo:  
compares hashes of the objects being compared.  I also believe that  
isEqual: is the preferred method.


The documentation says that isEqual: checks the hashes, so that  
isn't it.


No, it doesn't.  It says that if two objects compare equal, then they  
must have the same hash.  This is a not for overriders of -isEqual: to  
make sure they know that they have to implement a corresponding -hash  
that maintains this invariant rule.


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


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Ken Thomases

On Sep 18, 2008, at 4:59 PM, Dave DeLong wrote:


On Sep 18, 2008, at 3:57 PM, Rick Mann wrote:

I see that NSObject (and its protocol) define -isEqual: and - 
isEqualTo:. What's the difference? Why does something like  
NSArray's -indexOfObject: use -isEqual: and not -isEqualTo:? So  
that someone can redefine these for an existing class? Why does - 
isEqualTo: even exist?




IIRC, isEqual: compares memory addresses, whereas isEqualTo:  
compares hashes of the objects being compared.  I also believe that  
isEqual: is the preferred method.


Nope.  isEqual: asks the object to compare itself to another.  The  
default implementation just uses identity (pointer comparison), but  
many subclasses use value comparison or whatever is appropriate.


isEqualTo: is used for scripting support.  By default, it's equivalent  
to isEqual:, but a class can override it to perform different  
scripting-specific comparison.


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


Re: Drawing an NSImage in a CALayer

2008-09-18 Thread Matt Long

You've got some fundamental issues here. This call in particular:

imageLayer drawLayer:imageLayer inContext:ctx];

It doesn't make sense.

-drawLayer:inContext is a delegate method. You are overriding drawing  
functionality for the layer in question. Instead you would set the  
layer's delegate to your app delegate (or whatever controller you're  
using) and then implement drawLayer:inContext in your controller.


e.g.

[imageLayer setDelegate:self]

then implement

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
if( layer == imageLayer )
{
[layer setContents:imageRef];
}
}

There are other deeper problems here, so maybe I'll just answer how to  
get a CGImageRef...


Use this code:

- (CGImageRef)nsImageToCGImageRef:(NSImage*)image;
{
NSData * imageData = [image TIFFRepresentation];
CGImageRef imageRef;
if(imageData)
{
CGImageSourceRef imageSource =
  CGImageSourceCreateWithData(
(CFDataRef)imageData,  NULL);

imageRef = CGImageSourceCreateImageAtIndex(
   imageSource, 0, NULL);
}
return imageRef;
}

you then call [imageLayer setContents:imageRef] where imageRef is the  
CGImageRef object returned.


It looks like you're making things more difficult than they need to  
be. Maybe clarify a little what you are doing. What does this mean:  
"The goal is to create a method that allows me to pass an NSImage as  
an argument to create a layer-hosting view."?


Best regards,

-Matt




On Sep 18, 2008, at 3:54 PM, Brad Gibbs wrote:


Hi,

I'm trying to draw an NSImage (a PNG) in a CALayer.  The goal is to  
create a method that allows me to pass an NSImage as an argument to  
create a layer-hosting view.  I have:



-(id)drawButton: (NSView *)button withImage:(NSImage *)anImage {
...
// image layer
imageLayer=[CALayer layer];
[imageLayer drawLayer:imageLayer inContext:ctx];

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Drawing an NSImage in a CALayer

2008-09-18 Thread David Duncan

On Sep 18, 2008, at 2:54 PM, Brad Gibbs wrote:

I'm trying to draw an NSImage (a PNG) in a CALayer.  The goal is to  
create a method that allows me to pass an NSImage as an argument to  
create a layer-hosting view.  I have:


Where is this PNG originating? The answer may mean a simpler (and  
potentially faster) method can be used...



[imageLayer drawLayer:imageLayer inContext:ctx];


You don't call this function yourself. You set the delegate on the  
CALayer and you implement this method. When the CALayer needs image  
content it will be called automatically with the correct parameters.  
This is usually as a result of a -display message being sent to the  
layer (which is typically arranged for by sending -setNeedsDisplay).

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


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Charles Srstka

On Sep 18, 2008, at 4:59 PM, Dave DeLong wrote:

IIRC, isEqual: compares memory addresses, whereas isEqualTo:  
compares hashes of the objects being compared.  I also believe that  
isEqual: is the preferred method.


The documentation says that isEqual: checks the hashes, so that isn't  
it. Also:


#import 

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

NSString *hello1 = @"Hello World";
NSString *hello2 = [@"Hello " stringByAppendingString:@"World"];

NSLog(@"address of hello1: 0x%x address of hello2: 0x%x isEqual:  
%u isEqualTo: %u isEqualToString: %u",
  hello1, hello2, [hello1 isEqual:hello2], [hello1  
isEqualTo:hello2], [hello1 isEqualToString:hello2]);


[pool drain];
return 0;
}

[Session started at 2008-09-18 17:13:53 -0500.]
2008-09-18 17:13:53.809 isequaltest[2082:10b] address of hello1:  
0x2030 address of hello2: 0x1063f0 isEqual: 1 isEqualTo: 1  
isEqualToString: 1


The Debugger has exited with status 0.

According to the documentation, isEqualToString: is faster when you  
know both objects are strings. I'm not sure what isEqualTo: is for,  
though.


Charles
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Seth Willits

On Sep 18, 2008, at 2:59 PM, Dave DeLong wrote:

IIRC, isEqual: compares memory addresses, whereas isEqualTo:  
compares hashes of the objects being compared.  I also believe that  
isEqual: is the preferred method.



isEqual: does not compare addresses. That's what == is for. Two  
distinct arrays with the same elements are "equal". You use isEqual:  
to test for that.


isEqualTo: is purely a synonym.


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


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 5:59 PM, Dave DeLong wrote:

IIRC, isEqual: compares memory addresses, whereas isEqualTo:  
compares hashes of the objects being compared.  I also believe that  
isEqual: is the preferred method.


I don't intend to necessarily single Dave out here, but I can't see  
how posting an IIRC answer to the list is in anybody's interest,  
especially when it is so easy to check the documentation.


Having a non-authoritative and/or incorrect answer has the potential  
for clouding the issue for years to come because it will live on in  
the list archives.


Pointer comparison is not, in general, how -isEqual: works. Please  
read the documentation.



On Sep 18, 2008, at 3:57 PM, Rick Mann wrote:




I see that NSObject (and its protocol) define -isEqual: and - 
isEqualTo:. What's the difference? Why does something like NSArray's  
-indexOfObject: use -isEqual: and not -isEqualTo:? So that someone  
can redefine these for an existing class? Why does -isEqualTo: even  
exist?


-isEqualTo is part of the Cocoa Scripting whose clause evaluation  
tests. It is implemented by sending -isEqual: to the receiver, or - 
scriptingIsEqualTo: as appropriate. See the documentation for details.


By having a different comparison hook for scripting whose tests, one  
could potentially have different scripting equality rules if necessary.


- Jim





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Dave DeLong
IIRC, isEqual: compares memory addresses, whereas isEqualTo: compares  
hashes of the objects being compared.  I also believe that isEqual: is  
the preferred method.


Cheers,

Dave

On Sep 18, 2008, at 3:57 PM, Rick Mann wrote:

I see that NSObject (and its protocol) define -isEqual: and - 
isEqualTo:. What's the difference? Why does something like NSArray's  
-indexOfObject: use -isEqual: and not -isEqualTo:? So that someone  
can redefine these for an existing class? Why does -isEqualTo: even  
exist?


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Differences between -isEqual: and -isEqualTo:?

2008-09-18 Thread Rick Mann
I see that NSObject (and its protocol) define -isEqual: and - 
isEqualTo:. What's the difference? Why does something like NSArray's - 
indexOfObject: use -isEqual: and not -isEqualTo:? So that someone can  
redefine these for an existing class? Why does -isEqualTo: even exist?


--
Rick

___

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

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

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

This email sent to [EMAIL PROTECTED]


Drawing an NSImage in a CALayer

2008-09-18 Thread Brad Gibbs

Hi,

I'm trying to draw an NSImage (a PNG) in a CALayer.  The goal is to  
create a method that allows me to pass an NSImage as an argument to  
create a layer-hosting view.  I have:



-(id)drawButton: (NSView *)button withImage:(NSImage *)anImage {
...
// image layer
imageLayer=[CALayer layer];
[imageLayer drawLayer:imageLayer inContext:ctx];
imageLayer.masksToBounds=YES;
[imageLayer addConstraint:[CAConstraint
   
constraintWithAttribute:kCAConstraintMaxY
   
relativeTo:@"superlayer"
   
attribute:kCAConstraintMaxY
   offset:-(height/2)]];
[imageLayer addConstraint:[CAConstraint
   
constraintWithAttribute:kCAConstraintMidX
   
relativeTo:@"superlayer"
   
attribute:kCAConstraintMidX]];

[titleLayer addSublayer:imageLayer];
[titleLayer layoutIfNeeded];
...

And I found this snippet in the Core Animation Cookbook:

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx
{
NSGraphicsContext *nsGraphicsContext;
	nsGraphicsContext = [NSGraphicsContext  
graphicsContextWithGraphicsPort:ctx


   flipped:NO];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:nsGraphicsContext];

// ...Draw content using NS APIs...
NSRect aRect=NSMakeRect(10.0,10.0,30.0,30.0);
NSBezierPath *thePath=[NSBezierPath bezierPathWithRect:aRect];
[[NSColor redColor] set];
[thePath fill];

[NSGraphicsContext restoreGraphicsState];
}


But I don't know how to get the current CGContextRef for the second  
parameter.



Thanks in advance.

Brad
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: alloc]init] VS new]

2008-09-18 Thread Jim Correia

On Sep 18, 2008, at 4:50 PM, Sandro Noel wrote:

what i'm thinking is that the "new" message creates "alloc-init- 
autorelease" object,

but that's just a beginer's assumptions.


That's incorrect.


couls someone point me to the doc ?


Google with: site:apple.com NSObject +new

Or search the API doc in Xcode.




Jim
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: alloc]init] VS new]

2008-09-18 Thread Nick Zitzmann


On Sep 18, 2008, at 2:50 PM, Sandro Noel wrote:


couls someone point me to the doc ?



>


Nick Zitzmann


___

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

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

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

This email sent to [EMAIL PROTECTED]


alloc]init] VS new]

2008-09-18 Thread Sandro Noel

Greetings.

I'm looking thru the examples for NSOperation <-- my god thread made  
easy, what a dream come true.


I noticed the [Object new] message instead of [[Object alloc]init]

i've been looking for the diference, and couls not yet find it in the  
documentation.

could someone explain ?

what i'm thinking is that the "new" message creates "alloc-init- 
autorelease" object,

but that's just a beginer's assumptions.

couls someone point me to the doc ?

thank you all !!
Sandro.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get AirPort Connection Status

2008-09-18 Thread Bob Clark

I found this page to be helpful:

http://developer.apple.com/qa/qa2001/qa1133.html

It's about the currently-logged in user, but the MyNotificationProc  
callback is called for a lot of changes, including IIRC the network  
connection transitions.


In the callback function you can do something like this:

NSArray* arr = (NSArray*)changedKeys;
NSLog(@"changed keys %@", [arr description]);

to sort of figure out what kinds of information you're getting.

--Bob


--
Bob Clark
Lead Software Development Engineer
RealPlayer Mac/Unix
RealNetworks, Inc.


On Sep 17, 2008, at 9:50 PM, Rashmi Vyshnavi wrote:


I want to know when my computer connects/disconnects to WiFi/AirPort
network.
Is there a way to get the status of connection to a WiFi network. I  
tried
using System Configuration API,but I could not get the status. Here  
is the

snippet
--
static void MyNetworkConnectionCallBack(SCNetworkConnectionRef
connection,SCNetworkConnectionStatus stat,void *info)
{
printf("Call back called \n");
SCNetworkConnectionStatus status =  
SCNetworkConnectionGetStatus(connection);

switch(status) {
case kSCNetworkConnectionInvalid:
printf("Connection invalid\n");
break;
case kSCNetworkConnectionDisconnected:
printf("Connection disconnected\n");
break;
case kSCNetworkConnectionConnecting:
printf("Connection connecting\n");
break;
case kSCNetworkConnectionConnected:
printf("Connection connected\n");
break;
case kSCNetworkConnectionDisconnecting:
printf("Connection disconnecting\n");
break;
}

}

int main (int argc, const char * argv[]) {
CFDictionaryRef userOptions;
bool scResult;
SCNetworkConnectionContext scncctx = {0, NULL, NULL, NULL, NULL};

CFStringRef currentServiceId;

scResult = SCNetworkConnectionCopyUserPreferences(NULL,  
¤tServiceId,

&userOptions);


SCNetworkConnectionRef connection = nil;
connection = SCNetworkConnectionCreateWithServiceID (NULL,
currentServiceId,
MyNetworkConnectionCallBack, &scncctx );
SCNetworkConnectionStatus status =
SCNetworkConnectionGetStatus(connection);
if(status == kSCNetworkConnectionConnected)
printf("connected \n");
else
 printf("current status :%d\n", status);

SCNetworkConnectionScheduleWithRunLoop 
(connection,CFRunLoopGetCurrent(),kCFRunLoopDefaultMode);




CFRunLoopRun();

return 0;
}
--
Am able to get connection status if I connect to a modem, but it  
fails when

connected
to a WiFi/AirPort network.

Thanks,
Rashmi
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: determining system idle time in leopard

2008-09-18 Thread Bill Cheeseman
on 2008-09-18 7:03 AM, Memo Akten at [EMAIL PROTECTED] wrote:

> In my app I'd like to check for system idle time, and perform an
> action after a set amount of time. I've found this code to check for
> system idle time
> http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354
> 
> is this still the best way to do it on leopard?

Look at the Quartz Event Services Reference document and the
CGEventSourceSecondsSinceLastEventType function. Pass kCGAnyInputEventType
in the eventType parameter to get the seconds since the last event of any
type. For most purposes, the source parameter value should be an event
source created using kCGEventSourceStateCombinedSessionState. I believe this
is available and documented for Tiger and Leopard.

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Finding other apps' paths - deterministically!

2008-09-18 Thread Ken Thomases

On Sep 18, 2008, at 1:47 PM, Jerry Krinock wrote:


The methods for finding applications,

  -[NSWorkspace fullPathForApplication:]
  -[NSWorkspace absolutePathForAppBundleWithIdentifier:]
  AppleScript's  'path to application'

all return only ONE result.  If there is more than installation of  
the application, which often happens out here in real life, the  
above methods will often pick different installations, and even if  
you run the same methods several minutes apart I sometimes get  
different answers.


Is there any way to make these methods behave deterministically?  If  
not, what's a better way?  Do I have to do a Spotlight search?  I  
know that unix 'find' would be way too slow.


The above methods all depend on Launch Services.  I've seen the same  
non-deterministic behavior that you have.


One solution, which is a complete hack, involves tagging the  
application with a claim to handle a certain custom URL scheme.  Then  
you can use LSCopyApplicationURLsForURL with a fake URL of that  
scheme.  That's the only Launch Services API that I'm aware of that  
actually returns a list of applications (rather than, for example, a  
list of application bundle IDs which doesn't address your problem).   
This, of course, only works if the application is one you're  
developing rather than a third-party app.


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


Re: determining system idle time in leopard

2008-09-18 Thread Matt Neuburg
On Thu, 18 Sep 2008 12:03:42 +0100, Memo Akten <[EMAIL PROTECTED]> said:
>In my app I'd like to check for system idle time, and perform an
>action after a set amount of time. I've found this code to check for
>system idle time
>http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354
>
>is this still the best way to do it on leopard?
>

Is this the sort of thing you're after?

http://ryanhomer.com/blog/2007/05/31/detecting-when-your-cocoa-application-i
s-idle/

m.

-- 
matt neuburg, phd = [EMAIL PROTECTED], 
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: 
AppleScript: the Definitive Guide - Second Edition!




___

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

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

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

This email sent to [EMAIL PROTECTED]


WebView and authentication dialog

2008-09-18 Thread Manoj Patwardhan
I am showing a WebView in a regular window. When I try to load a site  
that will prompt for authentication, the web view slides out a sheet  
in its containing window, asking for user name and password. After  
entering the correct name and password, the web view does not continue  
loading any more. The loading simply doesn't proceed further. If I  
check the box to add the user name and password to my keychain and  
then repeat this, the page loads fine because it doesn't display the  
authentication dialog any more.


Any ideas?

Thanks!!
Manoj Patwardhan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSScroller will be visible even it is below other view in 10.4

2008-09-18 Thread Andrew Merenbach

On Sep 18, 2008, at 3:53 AM, [EMAIL PROTECTED] wrote:


Hi all,
 I found a tricky thing in Tiger: In Nib file, I have a NSScrollView  
in
the window, and I put an NSImageView all above it, for I don't want  
to see
the scrollView. But when window shows, I can see the scroller! In  
Leopard,

the imageview covers the scroller. Did I miss something?
 Thanks in advance!


Hi!  I'm not sure that I understand you correctly, but if I do: All  
versions of Mac OS X before Leopard do *not* enforce clipping among  
sibling subviews.  Unless you're using Leopard, therefore, it is not  
at all supported to place an image view *on top of* a scroll view.  Is  
this what you meant?


If you need to have the image view on top of the scroll view in Tiger,  
and there are no other options, I might suggest a borderless window  
that contains the image view, and configure it such that it will move  
along with the main window.


Cheers,
Andrew


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: QCView and NSGarbageCollector

2008-09-18 Thread Peter Schmidt

Am 17.09.2008 um 22:46 schrieb Bill Bumgarner:

Every example included with the developer tools should work under  
GC.   If it does not, then it is a bug and, please, do file it.


Ok, I've filed a bug.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Finding other apps' paths - deterministically!

2008-09-18 Thread Jerry Krinock

The methods for finding applications,

   -[NSWorkspace fullPathForApplication:]
   -[NSWorkspace absolutePathForAppBundleWithIdentifier:]
   AppleScript's  'path to application'

all return only ONE result.  If there is more than installation of the  
application, which often happens out here in real life, the above  
methods will often pick different installations, and even if you run  
the same methods several minutes apart I sometimes get different  
answers.


Is there any way to make these methods behave deterministically?  If  
not, what's a better way?  Do I have to do a Spotlight search?  I know  
that unix 'find' would be way too slow.


Thanks,

Jerry Krinock
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSScroller will be visible even it is below other view in 10.4

2008-09-18 Thread qi . liu
Hi all,
  I found a tricky thing in Tiger: In Nib file, I have a NSScrollView in 
the window, and I put an NSImageView all above it, for I don't want to see 
the scrollView. But when window shows, I can see the scroller! In Leopard, 
the imageview covers the scroller. Did I miss something? 
  Thanks in advance!

=
Qi Liu
--Stay Hungry. Stay Foolish.
--You've got to find what you love.
=
___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderator] List Guidelines

2008-09-18 Thread CocoaDev Admins

iPhone SDK
--

Until an announcement is made otherwise, developers should be aware  
that the iPhone SDK is still under non-disclosure (section 5.3 of the  
iPhone Development Agreement). It can't be discussed here, or anywhere  
publicly. This includes other mailing lists, forums, services like  
Twitter, and blogs. Violating the NDA will result in WWDR being  
notified of the breach. Further action is at their (and legal's)  
discretion.


The iPhone SDK situation is somewhat different than a Mac OS X release  
in that a Mac OS X release includes a copy of the developer tools with  
the distribution. The iPhone OS 2.0 release on devices and as an  
upgrade does _not_ include the development tools. As a result, the SDK  
is not automatically considered public because the release has occurred.


Section 5.3 of the iPhone Development Agreement remains in force at  
this time, and will remain so until iPhone Developer Program members  
are specifically and personally notified by an authorized  
representative of Apple.



Xcode 3.1
-

iPhone SDK requires Xcode 3.1 so it contains it (because it won't work  
without it).


Xcode 3.1 is available indepently of the iPhone Developer Program and  
its nondisclosure agreement, so it's available as a download  
separately from the iPhone SDK,.


Whichever you choose, the Xcode build and installation is identical.  
But you still can't discuss the iPhone SDK.


Questions about Xcode and Interface Builder are best addressed to the [EMAIL PROTECTED] 
 mailing list.



SnowLeopard NDA
===

The SnowLeopard seed is under non-disclosure and can not be discussed  
here.




Discussing Private API
==

The discussion of Private API is also not appropriate for this list.  
Using private API is strongly discouraged as it can (and often does)  
change in future software revisions. If you feel some private API  
should be made public contact WWDR directly or file a bug using  
bugreporter.apple.com. Please do not advocate for those changes here,  
it isn't effective.



Please stay on-topic


There are currently more than 5000 subscribers to this list and  
several hundred messages posted per day. In order to keep the list  
useful please stay on topic and stick to technical discussion.


Cocoa-dev should not be the first place you turn when you encounter a  
problem. First you should:


 - Search the documentation in Xcode
   - Remember to select the appropriate doc set and, if applicable,  
turn on full text searching

 - Search the list archives at apple.com or cocoabuilder.com
   - Many questions have been asked repeatedly and good answers have  
already been provided. Check the archives _every time_.

 - Search Google
   - There are many Cocoa developers who blog about their  
experiences. This is a very useful resource.

 - Ensure that this is actually Cocoa related.
   - Basic C questions are not appropriate for this list.

If someone posts a message that is off-topic, please do not reply to  
the list.  You should contact the sender directly or alert a  
moderator.  If a moderator flags a thread (typically with [Moderator]  
in the subject line), do not continue to post to that thread. Do feel  
free to contact the list admins at [EMAIL PROTECTED]  
with any issues.


If you post a message that is blatantly off-topic, you are liable to  
be moderated.


While Apple engineers often subscribe to the list and answer  
questions, they do so on a volunteer basis. This is not an official  
support channel, and you should not expect an Apple engineer to  
provide the answer. Instead contact <[EMAIL PROTECTED]> for technical  
issues.


To file bugs use bugreporter at http://bugreporter.apple.com




Other mailing lists
===

 Other Apple mailing lists that may be relevant are listed at:

in particular see:
Xcode-users: 

The Omni Group hosts a general Mac OS X developer list:


There is a Yahoo Group for discussion of business-related issues at:




List etiquette
==

When you post a message, bear in mind that you are asking several  
thousand people to listen to what you're saying. Please ensure that  
you abide by the list rules:


 
 
 In particular: please "Edit included messages in replies to
 minimize the amount of text."  There is no need, for example,
 to include the list footer in your reply.


 Before posting a question, please check the list archives (see  
"Online resources" below) and try searching Google. Many questions  
have been asked before and have already been answered.


 When you ask a question, whenever possible please:

1. Describe what your high-leve

[Moderator] Re: iPhone SDK

2008-09-18 Thread Scott Anguish

iPhone SDK
--

Until an announcement is made otherwise, developers should be aware  
that the iPhone SDK is still under non-disclosure (section 5.3 of the  
iPhone Development Agreement). It can't be discussed here, or anywhere  
publicly. This includes other mailing lists, forums, services like  
Twitter, and blogs. Violating the NDA will result in WWDR being  
notified of the breach. Further action is at their (and legal's)  
discretion.


The iPhone SDK situation is somewhat different than a Mac OS X release  
in that a Mac OS X release includes a copy of the developer tools with  
the distribution. The iPhone OS 2.0 release on devices and as an  
upgrade does _not_ include the development tools. As a result, the SDK  
is not automatically considered public because the release has occurred.


Section 5.3 of the iPhone Development Agreement remains in force at  
this time, and will remain so until iPhone Developer Program members  
are specifically and personally notified by an authorized  
representative of Apple.


On 18-Sep-08, at 6:51 AM, Waqar Azeem wrote:

In last March I downloaded the iPhone SDK 2.09 GB in size. And now  
today I

downloaded the latest version of this SDK i.e.
iphone_sdk_for_iphone_os_2.1__final but this time the file size is  
1.38 GB.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Modal dialog without NSApplication

2008-09-18 Thread brodhage

Hi,

thank you very much again for your quick answer, Jean-Daniel.

> In theorie, you can safely call NSApplicationLoad()

I allready do.

> ... create you own auto release pool

I allready do. And then I call this function (within subclass of  
NSWindowController):


- (void)showModalDialog
{
NSApplication *_app;
NSWindow *_window;

[self showWindow:nil];
_app = [NSApplication sharedApplication];
_window = [self window];
[_app runModalForWindow:_window];
}

The modal dialog (displayed this way) blocks everything - it is not  
possible to close the modal dialog, hit any button or something else.


For me it seems that the NSApplication:: runModalForWindow blocks all.
So what I am searching for is to display the modal dialog without  
NSApplication.


Any ideas?

Cheers
Ness
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Stefan Werner


On Sep 18, 2008, at 7:53 AM, Kiel Gillard wrote:


Howdy,

I think the following syntax is the right idea:

extern "C" { extern void MyFunction(void *args);
}


I'm not sure about the duplicate 'extern'. Here's what I use in my code:

extern "C" void MyFunction(void *args);

or you can also do

extern "C" {
#include "MyCHeader.h"
}

for entire header files.

Also, you can use 'nm -o libSomething.dylib' do inspect the function  
signatures a certain lib exports.


-Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Modal dialog without NSApplication

2008-09-18 Thread Jean-Daniel Dupas


Le 18 sept. 08 à 16:15, brodhage a écrit :


Hi,

thank you very much for your quick answer, Jean-Daniel.

> If you want a complexe dialog...

Yes. So I guess CFUserNotification does not help.

> I don't understand why using NSApp for this kind of works will  
have an impact on the remaining of you application though.


Just because a lot of my code handles common task - and it is not  
guaranteed that there is a NSApplication at all.


For example let's take a plugin for a carbon application - here  
there is no NSApplication.




In theorie, you can safely call NSApplicationLoad() to instanciate an  
NSApplication before you use it, even in a Carbon App plugin (and then  
create you own auto release pool).
In practice, there is some issues when running a modal Cocoa windows  
in a Carbon App (I remember some carbon-dev messages about it).

But it's worth the try.

And: using NSApplication would mean to bind the code only to  
applications and to name all files ".mm" instead of ".cpp" - not  
usable if you want to build that under Win.


You don't have to name all files .mm, only the one that uses Cocoa  
(tthe one that is already Mac OS X specific). And both Visual Studio  
and Xcode provide some options to force the type of the file (to tell  
VS to compile .mm as .cpp or to tell Xcode to compile some cpp file as  
mm).



___

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

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

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

This email sent to [EMAIL PROTECTED]


Poking an NSRunLoop with an NSMachPort

2008-09-18 Thread Dave Dribin

Hello,

I'm trying to figure out how to get a blocking call to -[NSRunLoop  
runMode:beforeDate:] to return.  It seems the best way to do this is  
to use a "real" (non-timer) input source to poke the run loop, as  
mentioned by Chris Kane in this post:


  

To implement this, I've created a class that adds an NSMachPort to the  
run loop and then sends it a message to poke the run loop.  I based  
this class on code from the "Configuring a Port-Based Input Source"  
section of the Threaded Programming Guide [1].  Since I haven't used  
NSPorts much, I want to make sure what I'm doing looks proper.  A  
snippet of code is included.


It all appears to work, but can NSPortMessage's receivePort be set to  
nil?  The docs aren't clear on this, but I don't care about a getting  
replies.  I guess I could create a dummy receive port.  Does  
everything else look sane?  Or perhaps there's a better/easier way to  
accomplish what I want?


-Dave

[1]: 


static const uint32_t kPokeMessage = 100;

@implementation DDRunLoopPoker

- (id)initWithRunLoop:(NSRunLoop *)runLoop;
{
self = [super init];
if (self == nil)
return nil;

_runLoop = [runLoop retain];
_pokerPort = [[NSMachPort port] retain];
[_runLoop addPort:_pokerPort forMode:NSDefaultRunLoopMode];
[_runLoop addPort:_pokerPort forMode:NSModalPanelRunLoopMode];

_pokeMessage = [[NSPortMessage alloc] initWithSendPort:_pokerPort
   receivePort:nil
components:nil];
[_pokeMessage setMsgid:kPokeMessage];

return self;
}

- (void)pokeRunLoop;
{
[_pokeMessage sendBeforeDate:[NSDate date]];
}

@end

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get AirPort Connection Status

2008-09-18 Thread Michael Ash
On Thu, Sep 18, 2008 at 12:50 AM, Rashmi Vyshnavi
<[EMAIL PROTECTED]> wrote:
> I want to know when my computer connects/disconnects to WiFi/AirPort
> network.
> Is there a way to get the status of connection to a WiFi network. I tried
> using System Configuration API,but I could not get the status. Here is the
> snippet

I am not greatly familiar with them, but it looks like you could use
the SC Reachability API to get notified of when a host becomes
reachable or unreachable. If wifi is your only internet connection
then any remote host will become unreachable when you disconnect, and
reachable when you connect.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core Data in a framework ?

2008-09-18 Thread dreamcat7

Thank you Chris,
Very reassuring to know that its possible, and there was nowhere else  
to find this information.
Its not in ADC so I have submitted a request today for Apple to write  
documentation on how to do this.



On 18 Sep 2008, at 02:10, Chris Hanson wrote:


On Sep 17, 2008, at 2:24 PM, dreamcat7 wrote:


If use Core Data, then can my class be part of a framework ?


Yes.  You can use Core Data in pretty much any situation where you  
would use Foundation.


Core Data is not restricted to applications that the user interacts  
with.  For one example, if you have a Core Data-based document  
format, you will need to use Core Data from both your Spotlight  
importer and Quick Look generator, not just from your application,  
to access its underlying structure.


In a situation like I've described, you could even choose to  
encapsulate the basic Core Data-based document format support in a  
framework.  You could embed this framework in your application  
wrapper and link to it from your application, your Spotlight  
importer, and your Quick Look generator; doing so is easily possible  
on Leopard using the @rpath mechanism.


So don't let the fact that you may not be directly building an end- 
user app dissuade you from using Core Data.  Anywhere you need to  
deal with a graph of model objects, Core Data will be useful.


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


Re: How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Kiel Gillard
Howdy,

I think the following syntax is the right idea:

extern "C" { extern void MyFunction(void *args);
}

However, because it is insanely late, I may be wrong. If you have a look at
the headers for Apple's frameworks (eg: one of the Core Foundation headers)
you'll see how you should do it.

Hope this helps,

Kiel
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Binding to an NSArrayController however binding is 1-way only.

2008-09-18 Thread dreamcat7


On 18 Sep 2008, at 11:44, Ken Thomases wrote:


1) If you for some reason find that using bindings with NSTableView  
is too restrictive, you might want to think about falling back to  
the pre-bindings way of populating a table view: the data source.

Yes, noted.

2)... If you implement the to-many indexed accessors, you can make a  
to-many property that works however you like under the hood   in  
the comments at the declaration of -mutableArrayValueForKey: in  
NSKeyValueCoding.h.  (Sadly, the documentation for that method  
doesn't seem to be correct/complete.)


Thank you Ken for pointing this out. I have now found this in thread  
the Archives. Was discussed here:


 http://www.cocoabuilder.com/archive/message/cocoa/2008/6/28/211487

3) You seem to be building a model which is based on an  
NSArrayController.  (I.e. you tried to make your dates and emails  
properties by binding through the controller's arrangedObjects  
property.)  This gets things backwards.  Your model should not have  
any dependencies on your controller(s).


In a typical hierarchy and with those terminology which you were using:

Model (item) -> Model (array) -> Mediating controller (and possibly  
other mediating controller) --> Co-ordinting controller -> application.


I dont dispute the above is the correct way to build a Cocoa  
application.


It's possible that I misunderstood.  Perhaps dates and emails are  
properties of your coordinating controller which you intend to be a  
synthesis of values from your model.  That's OK.  However, if you do  
that, then you still shouldn't base it on an NSArrayController.  It  
should be based directly on your model plus some controller-level  
logic.  Then, an NSArrayController could be built which presents  
that synthetic property to your view layer.


Well yes the presence of the arraycontroller is there for the  
tableview and to provide sorting on the array data.
Its simply very convenient because of the good selection and sorting  
features provided by NSArrayContoller.


 if either i did not need sorting, or was using the DataSource method  
you suggested in 1), then there would be fewer reason to use it.
 My needs are indeed rather specific and in this instance. I shall  
email you the source code code off-list.


In my opinion, a coordinating controller should not depend upon a  
mediating controller.  It should be the other way around.

Yes, i agree.



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


Re: Modal dialog without NSApplication

2008-09-18 Thread brodhage

Hi,

thank you very much for your quick answer, Jean-Daniel.

> If you want a complexe dialog...

Yes. So I guess CFUserNotification does not help.

> I don't understand why using NSApp for this kind of works will  
have an impact on the remaining of you application though.


Just because a lot of my code handles common task - and it is not  
guaranteed that there is a NSApplication at all.
For example let's take a plugin for a carbon application - here there  
is no NSApplication.


And: using NSApplication would mean to bind the code only to  
applications and to name all files ".mm" instead of ".cpp" - not  
usable if you want to build that under Win.


Cheers
Martin Brodhage
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Daniel Luis dos Santos
Sorry, I forgot to say that I was already doing that. And it does  
build, my problem is in the link stage.



On Sep 18, 2008, at 3:00 PM, Negm-Awad Amin wrote:



Am Do,18.09.2008 um 15:55 schrieb Daniel Luis dos Santos:

I am having trouble getting it to compile. From what I understand  
there must be an extern "C" before the inclusion of the C lib's  
header files.

I still get a link error. Is there anything else to 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/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]
You have to include the headers for your source code (compiling) and  
the lib itself for linking.


Cheers

Amin Negm-Awad
[EMAIL PROTECTED]






___

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

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

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

This email sent to [EMAIL PROTECTED]


How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Daniel Luis dos Santos
I am having trouble getting it to compile. From what I understand  
there must be an extern "C" before the inclusion of the C lib's header  
files.

I still get a link error. Is there anything else to 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 [EMAIL PROTECTED]


Re: Core data fetch returns no objects

2008-09-18 Thread Benjamin Stiglitz
On Thu, Sep 18, 2008 at 02:05:03PM +0200, Tomaž Kragelj wrote:
> If I use the same code for fetching immediately after adding the objects 
> to the context, the fetching works... It looks like the problem might be 
> related to fact that I use different persistent store for Project than 
> for Measurement - if I fetch other objects saved in the same persistent 
> store, fetch works.

Core Data does not support relationships across persistent stores. You may be
able to use fetched properties to grab the related objects. See the Core Data
programming guide:


-Ben
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Modal dialog without NSApplication

2008-09-18 Thread Jean-Daniel Dupas


Le 18 sept. 08 à 15:12, brodhage a écrit :


Hi,

I am developing application software for Mac and Windows.
Most of the code is developed using ObjectC - this way most of the  
code can be used for both OS. Only the OS depending stuff - like  
showing dialogs, menus... - is separated.


The problem: how can I show and handle a modal dialog for MacOS X  
without NSApplication?


Using NSApplication (and all the other classes) would mean to have a  
lot more code OS depending.


Any ideas?

Cheers
Martin Brodhage


If you just want to show simple dialog, you can use CFUserNotification.

If you want a complexe dialog that require some custom control or  
event handling, you will have to use NSApplication.


I don't understand why using NSApp for this kind of works will have an  
impact on the remaining of you application though.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Modal dialog without NSApplication

2008-09-18 Thread brodhage

Hi,

I am developing application software for Mac and Windows.
Most of the code is developed using ObjectC - this way most of the  
code can be used for both OS. Only the OS depending stuff - like  
showing dialogs, menus... - is separated.


The problem: how can I show and handle a modal dialog for MacOS X  
without NSApplication?


Using NSApplication (and all the other classes) would mean to have a  
lot more code OS depending.


Any ideas?

Cheers
Martin Brodhage

___

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

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

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

This email sent to [EMAIL PROTECTED]


Core data fetch returns no objects

2008-09-18 Thread Tomaž Kragelj

Hi all - I need some help with core data fetching...

I have 1:N relationship between Project and Measurement entities. I  
add all objects to managed context programatically using + 
[NSEntityDescription  
insertNewObjectForEntityForName:inManagedObjectContext]. First I add  
Project object, then I add all child Measuerements as needed. After  
the objects are added or updated, I save the data to XML files (the  
two object types are saved to different persistent stores).


This works fine, the files save and load correctly. When I later want  
to fetch the measurements in my custom NSTableView data cell to draw  
the statistics, no measurement is fetched (I get empty array).


If I use the same code for fetching immediately after adding the  
objects to the context, the fetching works... It looks like the  
problem might be related to fact that I use different persistent store  
for Project than for Measurement - if I fetch other objects saved in  
the same persistent store, fetch works.


Any ideas? Cheers, Tom


___

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

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

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

This email sent to [EMAIL PROTECTED]


determining system idle time in leopard

2008-09-18 Thread Memo Akten
In my app I'd like to check for system idle time, and perform an  
action after a set amount of time. I've found this code to check for  
system idle time

http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354

is this still the best way to do it on leopard?

cheers,

memo.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Binding to an NSArrayController however binding is 1-way only.

2008-09-18 Thread Ken Thomases

On Sep 17, 2008, at 10:25 AM, dreamcat7 wrote:

I am stuck finding a solution for my array of arrays problem. - A  
problem with a twist !


Quincy Morris has already explained that  
bind:toObject:withKeyPath:options: doesn't do what you guessed it might.


Here's how I would explain it (after being a participant in a couple  
of previous in-depth discussions about it): NSObject's default  
implementation of the bind:toObject:withKeyPath:options: method has no  
clearly defined semantics.  Any class which wishes to support bindings  
should define the semantics of their own bindings.  The Cocoa classes  
which define bindings document their semantics in the Cocoa Bindings  
Reference .  Any other class, including your own, would have to override  
bind:toObject:withKeyPath:options: and determine through its  
implementation what semantics it should have.



That said, I wanted to address a couple of other issues I saw with  
your question:


1) If you for some reason find that using bindings with NSTableView is  
too restrictive, you might want to think about falling back to the pre- 
bindings way of populating a table view: the data source.


2) You seem to be hung up on the internal representation of  
properties.  Although I didn't quite follow exactly what you're trying  
to do, you seem to be of the belief that you have to use  
NSMutableArray for a mutable to-many property.  This is incorrect.  A  
to-many property doesn't require any particular kind of backing  
storage.  If you implement the to-many indexed accessors, you can make  
a to-many property that works however you like under the hood.  The  
indexed accessors for to-many properties are documented in the Key- 
Value Coding Guide  and also in the comments at the declaration of - 
mutableArrayValueForKey: in NSKeyValueCoding.h.  (Sadly, the  
documentation for that method doesn't seem to be correct/complete.)


So, your "synthetic" dates and emails arrays don't need to be  
implemented in terms of a backing NSMutableArray and bindings (or  
KVO).  They can exist solely as the requisite accessor methods, which  
can then compute their value based on other model data (or whatever).   
This can be used to present multiple "flat" to-many properties from a  
single array of multi-property objects.  Although, I'm confused about  
why you want to do that.  I don't see it as providing any advantage to  
you.


Similarly, you expressed concern about exposing the implementation of  
your Items class.  Well, of course, you don't have to expose that.   
That's what properties are for -- they are an interface-level aspect  
of your class and need not expose anything about its implementation.   
With KVC and KVO, you can even access properties without seeing the  
interface declaration of the object in question.


3) You seem to be building a model which is based on an  
NSArrayController.  (I.e. you tried to make your dates and emails  
properties by binding through the controller's arrangedObjects  
property.)  This gets things backwards.  Your model should not have  
any dependencies on your controller(s).


It's possible that I misunderstood.  Perhaps dates and emails are  
properties of your coordinating controller which you intend to be a  
synthesis of values from your model.  That's OK.  However, if you do  
that, then you still shouldn't base it on an NSArrayController.  It  
should be based directly on your model plus some controller-level  
logic.  Then, an NSArrayController could be built which presents that  
synthetic property to your view layer.


In my opinion, a coordinating controller should not depend upon a  
mediating controller.  It should be the other way around.



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


Re: iPhone SDK

2008-09-18 Thread Roland King
unfortunately you can't ask questions about iPhone SDK here, even if 
they seem innocuous. In general if I download something and it works 
fine I don't worry too much about it, I know that generic XCode releases 
are all sorts of sizes.


Waqar Azeem wrote:


In last March I downloaded the iPhone SDK 2.09 GB in size. And now today I
downloaded the latest version of this SDK i.e.
iphone_sdk_for_iphone_os_2.1__final but this time the file size is 1.38 GB.



Where are the remaining 600 MBs [- Or -] XCode & other development stuff are
already there in the download and I am just bothering for nothing.



- - - - - - - - - - - 


iphone_sdk_01.dmg = 2.09 GB (2,254,514,153 bytes)

iphone_sdk_for_iphone_os_2.1__final.dmg = 1.38 GB (1,482,735,015 bytes)

- - - - - - - - - - - 




Thanks & Best Regards,
Waqar Azeem



___

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

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

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

This email sent to [EMAIL PROTECTED]
 



___

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

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

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

This email sent to [EMAIL PROTECTED]


iPhone SDK

2008-09-18 Thread Waqar Azeem
In last March I downloaded the iPhone SDK 2.09 GB in size. And now today I
downloaded the latest version of this SDK i.e.
iphone_sdk_for_iphone_os_2.1__final but this time the file size is 1.38 GB.

 

Where are the remaining 600 MBs [- Or -] XCode & other development stuff are
already there in the download and I am just bothering for nothing.

 

- - - - - - - - - - - 

iphone_sdk_01.dmg = 2.09 GB (2,254,514,153 bytes)

iphone_sdk_for_iphone_os_2.1__final.dmg = 1.38 GB (1,482,735,015 bytes)

- - - - - - - - - - - 

 

Thanks & Best Regards,
Waqar Azeem

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTimer does NOT repeat, why ?

2008-09-18 Thread Florian Soenens

Stupid me!
Thanks for the responses, works fine now...

On 18 Sep 2008, at 11:33, Thomas Davie wrote:



On 18 Sep 2008, at 11:18, Florian Soenens wrote:


Hi list,

anyone knows why in this simple piece of code, the method testTimer  
is only called once and not every 2 seconds?


Thanks in advance;
Florian.

#import "Controller.h"

@implementation Controller

-(void) awakeFromNib
{
NSLog(@"Creating NSTimer");
	timer = [[NSTimer timerWithTimeInterval:2.0 target:self  
selector:@selector(testTimer) userInfo:nil repeats:YES] retain];

[timer fire];
}

-(void) testTimer
{
NSLog(@"Test");
}


The timer only fires once, because you are only telling it to fire  
once.  You should instead be scheduling it.


Bob




Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTimer does NOT repeat, why ?

2008-09-18 Thread Thomas Davie


On 18 Sep 2008, at 11:18, Florian Soenens wrote:


Hi list,

anyone knows why in this simple piece of code, the method testTimer  
is only called once and not every 2 seconds?


Thanks in advance;
Florian.

#import "Controller.h"

@implementation Controller

-(void) awakeFromNib
{
NSLog(@"Creating NSTimer");
	timer = [[NSTimer timerWithTimeInterval:2.0 target:self  
selector:@selector(testTimer) userInfo:nil repeats:YES] retain];

[timer fire];
}

-(void) testTimer
{
NSLog(@"Test");
}


The timer only fires once, because you are only telling it to fire  
once.  You should instead be scheduling it.


Bob
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTimer does NOT repeat, why ?

2008-09-18 Thread Jason Coco


On Sep 18, 2008, at 05:18 , Florian Soenens wrote:


Hi list,

anyone knows why in this simple piece of code, the method testTimer  
is only called once and not every 2 seconds?


Yes, it is because you created a timer and then fired it manually. You  
need to schedule the timer with the run loop
in order to get it to fire repeatedly... the run loop is what is  
responsible for firing your timer every x seconds. You can
also adjust this if you don't actually need a reference to the timer  
(I assume you're keeping one because you may
have to fire it manually from time to time, or you may want to  
invalidate it outside of its normal cycle and call-back).


The example below schedules the timer automatically during  
awakeFromNib (I'm assuming that this is the functionality
that you want based on your example). You could also create the timer  
and schedule it manually with the run loop (e.g.,
in response to a button press). For further reference, you should see  
the documentation for NSTimer and NSRunLoop... links provided
at the bottom of this message for reference. It's important to note  
that a timer will never fire automatically unless it's scheduled

with a run loop and that run loop is running in the correct mode.

HTH, Jason

Replace your implementation with this:

#import "Controller.h"

@implementation Controller

-(void)awakeFromNib
{
NSLog(@"Creating NSTimer");
	timer = [[NSTimer scheduledTimerWithTimeInterval:2.0 target:self  
selector:@selector(testTimer:) userInfo:nil repeats:YES] retain];
	// do you really want to fire it manually right away? if so, leave  
this line here - this will not interrupt the regular schedule

[timer fire];
}

-(void)testTimer:(NSTimer*)aTimer
{
NSLog(@"Fired: %@", aTimer);
}
@end


NSTimer: 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html
NSRunLoop: 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSRunLoop_Class/Reference/Reference.html

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

NSTimer does NOT repeat, why ?

2008-09-18 Thread Florian Soenens

Hi list,

anyone knows why in this simple piece of code, the method testTimer is  
only called once and not every 2 seconds?


Thanks in advance;
Florian.

#import "Controller.h"

@implementation Controller

-(void) awakeFromNib
{
NSLog(@"Creating NSTimer");
	timer = [[NSTimer timerWithTimeInterval:2.0 target:self  
selector:@selector(testTimer) userInfo:nil repeats:YES] retain];

[timer fire];
}

-(void) testTimer
{
NSLog(@"Test");
}


@end

Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___


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

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

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

This email sent to [EMAIL PROTECTED]


Re: Existence of Network

2008-09-18 Thread Jean-Daniel Dupas


Le 18 sept. 08 à 21:14, kiran Sanka a écrit :


Hi all

In  my cocoa application i want to find out if there is a network  
connection exists or not ?


-The Coneection or disconnection of the network should be notified  
to my cocoa application


Any suggestions?


Use the SystemConfiguration Framework. Especially the "Network  
Reachabiliy" API.


http://developer.apple.com/documentation/Networking/Conceptual/SystemConfigFrameworks/SC_ReachConnect/chapter_5_section_4.html




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get AirPort Connection Status

2008-09-18 Thread Jason Coco


On Sep 18, 2008, at 00:50 , Rashmi Vyshnavi wrote:


I want to know when my computer connects/disconnects to WiFi/AirPort
network.
Is there a way to get the status of connection to a WiFi network. I  
tried
using System Configuration API,but I could not get the status. Here  
is the

snippet
--


[...]


--
Am able to get connection status if I connect to a modem, but it  
fails when

connected
to a WiFi/AirPort network.


According to the documentation, the SCNetworkConnection API currently  
only works with PPP.

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Existence of Network

2008-09-18 Thread Nick Zitzmann


On Sep 18, 2008, at 1:14 PM, kiran Sanka wrote:

In  my cocoa application i want to find out if there is a network  
connection exists or not ?



This is a frequently asked question, and you can probably find your  
answer in the archives...




Nick Zitzmann





___

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

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

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

This email sent to [EMAIL PROTECTED]


Existence of Network

2008-09-18 Thread kiran Sanka

Hi all

In  my cocoa application i want to find out if there is a network  
connection exists or not ?


-The Coneection or disconnection of the network should be notified to  
my cocoa application


 Any suggestions?

Regards
kiran sanka



___

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

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

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

This email sent to [EMAIL PROTECTED]


How to get AirPort Connection Status

2008-09-18 Thread Rashmi Vyshnavi
I want to know when my computer connects/disconnects to WiFi/AirPort
network.
Is there a way to get the status of connection to a WiFi network. I tried
using System Configuration API,but I could not get the status. Here is the
snippet
 --
 static void MyNetworkConnectionCallBack(SCNetworkConnectionRef
connection,SCNetworkConnectionStatus stat,void *info)
{
printf("Call back called \n");
SCNetworkConnectionStatus status = SCNetworkConnectionGetStatus(connection);
switch(status) {
case kSCNetworkConnectionInvalid:
printf("Connection invalid\n");
break;
case kSCNetworkConnectionDisconnected:
printf("Connection disconnected\n");
break;
case kSCNetworkConnectionConnecting:
printf("Connection connecting\n");
break;
case kSCNetworkConnectionConnected:
printf("Connection connected\n");
break;
case kSCNetworkConnectionDisconnecting:
printf("Connection disconnecting\n");
break;
}

}

int main (int argc, const char * argv[]) {
CFDictionaryRef userOptions;
bool scResult;
SCNetworkConnectionContext scncctx = {0, NULL, NULL, NULL, NULL};

CFStringRef currentServiceId;

scResult = SCNetworkConnectionCopyUserPreferences(NULL, ¤tServiceId,
&userOptions);


SCNetworkConnectionRef connection = nil;
connection = SCNetworkConnectionCreateWithServiceID (NULL,
currentServiceId,
MyNetworkConnectionCallBack, &scncctx );
 SCNetworkConnectionStatus status =
SCNetworkConnectionGetStatus(connection);
 if(status == kSCNetworkConnectionConnected)
printf("connected \n");
else
  printf("current status :%d\n", status);

SCNetworkConnectionScheduleWithRunLoop(connection,CFRunLoopGetCurrent(),kCFRunLoopDefaultMode);



CFRunLoopRun();

return 0;
}
--
Am able to get connection status if I connect to a modem, but it fails when
connected
to a WiFi/AirPort network.

Thanks,
Rashmi
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Utility/Floating window with titlebar on left side

2008-09-18 Thread Kyle Sluder
On Wed, Sep 17, 2008 at 3:04 PM, Nick Beadman <[EMAIL PROTECTED]> wrote:
> The issue I am having is that I want my NSPanel to have the title bar on the
> (left) side. In Carbon there is an WindowAttribute
> (kWindowSideTitlebarAttribute) which makes this trivial but I can't find
> anything equivalent in Cocoa.

Hrm.  Unless your window looks like the Formula bar in Excel, perhaps
this isn't the best idea.  But whatever, we'll roll with it.  In any
case, file an enhancement request at http://bugreport.apple.com and
see if Apple gives word on this feature.

> Searching found an item on cocodev
>  which suggests that this
> isn't possible and suggests subclassing NSWindow using
> NSBorderlessWindowMask which directed me to the "RoundTransparentWindow"
> sample. Of course, the issue with this is that the entire title bar, all of
> the close/minimize/maximize buttons and resize box have to be custom
> controls which is not an insignificant amount of work.

Psst... +[NSWindow standardWindowButton:].  :)

> More searching suggested that the controls in the window created by Carbon
> and initWithWindowRef: would have to be Carbon controls even though it would
> be much easier in this case that they be Cocoa. The solution in Leopard
> appears to be HICocoaView but that isn't an option for me as the application
> has to run on Tiger (10.4) too.

You should be creating your controls in the nib.  Though this does
present an interesting question of whether it's possible to provide
the desired mask using a Carbon nib.

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