Grow Bug ?

2008-11-17 Thread Carlos Eduardo Mello

Hi,

Cocoa newbie here. I've  been doing Carbon developing for a while,  
but just started to learn Cocoa.

So, forgive me if my questions seem too dum.

I was working on Hillgass's Custom Views tutorial (chapter 17, pg.  
233). It involves drawing into a custom view which grows with the  
window. Everything works as expected. However, when the user moves  
the grow box towards the title bar, if the window vertical dimension  
goes under the window/view margin size, and then grows again, the top  
margin gets smaller. If the window size is shrunk to 0 and back, the  
top margin disapears. And if the user releases the grow box when the  
vertical dimension is 0, it becomes impossible to grow the window  
back again. [10.5]


Is this a know bug?
Is it just something that needs more work on my side in order to  
function properly?

Maybe It needs some code to control the min/max window sizes?

P.S.: Obviously, I understand that these little apps we make with the  
help of Hillgass's Book (Great Book, by the way!) are just there to  
demonstrate some general principle or  technique. Still, as I am  
going to be creating a lot of custom views in my app, I wanted to  
make sure I am stepping in solid ground from the start. It would be  
terrible to build a lot of functionality only to be frustated by a  
basic bug later on...


Carlos Eduardo.
___

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

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


Open second Window

2008-11-17 Thread Barry Fawthrop
Greetings All

I'm new to Xcode and Apple development
I have started my first application and on the main window I have a
button, which when pressed I would like it to open a second window.

Could someone please point me in the right direction

Thank You
Barry
___

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

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

2008-11-17 Thread Scott Anguish
there are workarounds to do this, but the basic answer is that it  
isn't intended to be used with a simple array of strings.


You can make a class that holds the simple string object, or perhaps  
use an NSDictionary with a specific key.


On 16-Nov-08, at 12:45 PM, Meik Schuetz wrote:


Dear all,
If have seen lots of examples in which a NSTableView is bound to an  
NSArrayController which is bound to an array of entity objects,  
having various properties. However I am now trying to bind a table  
column to an array of strings and I don't seem to get this working.  
The string contents show up correctly, but when I try to modify an  
existing item, or add a new item, I get the error


Error setting value for key path  of object  (from bound object  
NSTableColumn: 0x10bb40(null)): [NSCFString 0xa0609328  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key .


I got the NSArrayController bound to the NSMutableArray property of  
my AppController class. I set the class to NSMutableString (also  
tries NSString). The NSTableView is bound to the NSArrayController,  
as well as the table column.


Do I really need to create a class which only contains a string  
property to get this working, or is there any trick that I don't  
know about.


___

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

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

2008-11-17 Thread Scott Anguish


On 17-Nov-08, at 12:50 AM, Mr. Gecko wrote:

Hello I am working on a website crawler and I am needing to make a  
user agent string so people who monitoring who visits can know that  
my crawler visited.




It sounds like you're getting data just using NSURL.

You can get much more control (including specifying the agent) using  
NSURLConnection and creating an NSURLRequest.




___

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

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

2008-11-17 Thread Jean-Daniel Dupas


Le 16 nov. 08 à 23:32, Carlos Eduardo Mello a écrit :


Hi,

Cocoa newbie here. I've  been doing Carbon developing for a while,  
but just started to learn Cocoa.

So, forgive me if my questions seem too dum.

I was working on Hillgass's Custom Views tutorial (chapter 17, pg.  
233). It involves drawing into a custom view which grows with the  
window. Everything works as expected. However, when the user moves  
the grow box towards the title bar, if the window vertical dimension  
goes under the window/view margin size, and then grows again, the  
top margin gets smaller. If the window size is shrunk to 0 and back,  
the top margin disapears. And if the user releases the grow box when  
the vertical dimension is 0, it becomes impossible to grow the  
window back again. [10.5]


Is this a know bug?


This is a known limitation of the layout manager.



Is it just something that needs more work on my side in order to  
function properly?

Maybe It needs some code to control the min/max window sizes?


The min size of the window should be set in Interface Builder. (but  
you can also set is in your code, see NSWindow class reference, - 
setMinSize: method).



___

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

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

2008-11-17 Thread Stephen J. Butler
On Mon, Nov 17, 2008 at 12:02 AM, Sandro Noel [EMAIL PROTECTED] wrote:
 NSFileManager *fileManager;
fileManager = [NSFileManager defaultManager];
if ( [fileManager fileExistsAtPath:[[self
 applicationSupportFolder] stringByAppendingPathComponent:@Bonjour
 Mounter.plist] isDirectory:NULL] ) {
mounts = [[NSMutableArray alloc]
 initWithContentsOfFile:[[self applicationSupportFolder]
 stringByAppendingPathComponent:@Bonjour Mounter.plist]];

}
else{
mounts = [[NSMutableArray alloc] init];
}

I don't think this is the most robust solution. What happens if the
file exists, but isn't readable by your user? What if the file is
corrupt? mounts will end up nil . The better solution is:

mounts = [[NSMutableArray alloc]
  initWithContentsOfFile:[[self applicationSupportFolder]
  stringByAppendingPathComponent:@Bonjour Mounter.plist]];
if (mounts == nil)
  mounts = [[NSMutableArray alloc] init];
___

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

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

2008-11-17 Thread Jean-Daniel Dupas


Le 17 nov. 08 à 08:06, Ken Tozier a écrit :


Hi

I've been working with AppleEvents and discovering their internals  
by setting the following in the terminal


 export AEDebugSends=1; export AEDebugReceives=1

What I'd like to be able to do is observe apple events exactly like  
this tool but format them into an NSDictionary so they can be used  
to easily build complex events. Since the above tool observes  
events, it must be possible, but how would I capture these events in  
my own tool? Is this something that needs to be a kernel extension?  
Or is there a higher level way to do it?




What do you mean by this tool ? export is used to set an environment  
variable. I guess that system functions that send and receive event  
just check if the env var is set and log appropriatly.



___

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

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

2008-11-17 Thread Nicko van Someren

On 17 Nov 2008, at 09:10, Scott Anguish wrote:


On 17-Nov-08, at 12:50 AM, Mr. Gecko wrote:

Hello I am working on a website crawler and I am needing to make a  
user agent string so people who monitoring who visits can know that  
my crawler visited.



It sounds like you're getting data just using NSURL.

You can get much more control (including specifying the agent) using  
NSURLConnection and creating an NSURLRequest.


In case you are not used to such things, specifically you'll need an  
NSMutableURLRequest.


Nicko

___

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

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

2008-11-17 Thread Peter N Lewis

I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.

I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:

float min(float x, ...);

Can anyone suggest the implementation?


Do you really need an arbitrary length argument array?  Or would 
three or four or five be sufficient?  Are you overgeneralizing what 
would be a relatively easy problem?


inline float min( float a1, float a2, float a3 )
   { return fminf( a1, fminf( a2, a3 ) ); }

inline float min( float a1, float a2, float a3, float a4 )
  { return fminf( a1, min( a2, a3, a4 ) ); }

inline float min( float a1, float a2, float a3, float a4, float a5 )
  { return fminf( a1, min( a2, a3, a4, a5 ) ); }

etc

Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your Mac
http://www.stairways.com/   http://download.stairways.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: newbie NSMutable dictionary subclass question

2008-11-17 Thread Jean-Daniel Dupas



Can the value part of a key-value pair in an NSMutableDictionary be  
a literal NSString, like @name?


It would seem so, because this works or at least doesn't crash:

NSMutableDictionary *bobo;
bobo = [[NSMutableDictionary alloc] init];
[bobo setValue:@root forKey:@name];


However, I have a class derived from NSMutableDictionary, and it is  
crashing when I try to do the same thing:



@interface myClass : NSMutableDictionary {
}
@end

myClass *tree;
tree = [[myClass alloc] init];
[tree setValue:@root forKey:@name];


Why does that crash when the first does not?  Are subclasses  
required to have member variables, or can they just have new  
functions?  Mine don't have any variables, maybe that is the problem?







Look like someone that did not read the fondamental before coding ;-)

Short answer: because NSDictionary is a class cluster.

Long answer here:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/chapter_3_section_9.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]


kCFErrorDomainCFNetwork error -1009

2008-11-17 Thread pan xuan

Hi,
 
I have a piece of code to perform accessing a server with a test URL. The 
server I try to access is actually an wifi access point. It is supposed to 
respond with a login page before the user can be authenticated.
 
Sometimes, the replied data from the server is NULL and the error printed out 
from the delegate function connection:(NSURLConnection *)connection 
didFailWithError:(NSError *)error is  kCFErrorDomainCFNetwork error -1009 with 
NSLocalizedDescription = no internet connection . When this error occurs,  I 
can still use safari to get the login page without any problem. It happens now 
and then. I appreciate your help.
 
Best regards,
 
Pan
 
_
Color coding for safety: Windows Live Hotmail alerts you to suspicious email.
http://windowslive.com/Explore/Hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_safety_112008___

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

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


NSArrayController and table column bindings retain/dealloc woes

2008-11-17 Thread Keith Blount
Hi,

I know there have been historic problems with NSArrayController getting 
retained too many times when bound to File's Owner and so forth, causing 
dealloc problems, but my problem is slightly different... I've been through the 
archives and searched the docs etc, but have yet to find a solution.

I have an NSArrayController and a table with its columns bound to values in my 
array controller. I set the content programmatically to get around the retain 
problems that can be caused by setting the content in IB. So far, so good.

However, when my program closes, the array controller still has too high a 
retain count - it's retain count is 7 in -dealloc, so it never gets released 
properly. Investigating this, it turns out that this is caused by the table 
view column bindings. I have two columns bound to the controller and one button 
bound to the -canRemove value. These three bindings must retain the controller 
twice, causing 6 extra retains on the controller.

Now, I tested a similar set up in a new Xcode project, with File's Owner left 
as the standard MyDocument, and everything worked fine - the retain count was 
7, just like in my project, but upon deallocation everything got released 
correctly and the array controller was released as it should.

Which leads me to the big difference in my project... The File's Owner in my 
nib file is not an NSDocument or an NSWindowController, but my own custom view 
controller (my app runs on Tiger and Leopard so I can't use Leopard's new 
NSViewController - instead I rolled my own back on Tiger). My custom view 
controller just holds onto the top level nib objects and then releases them in 
-dealloc, as follows:

- (id)initWithViewNibName:(NSString *)nibName;
{
if (self = [super init])
{
if (!nibName)
{
[self release];
return nil;
}

// By using NSNib, we can get a reference to all of the 
top-level objects within
// the nib when unarchiving it. This allows us to release all 
of those objects
// (which is our responsibility) on dealloc without having to 
create an outlet
// for all of them.

NSNib *nib = [[[NSNib alloc] initWithNibNamed:nibName 
bundle:nil] autorelease];

NSArray *topItems;
if (![nib instantiateNibWithOwner:self 
topLevelObjects:topItems])
{
[self release];
return nil;
}
topLevelNibObjects = [topItems copy];

viewNibName = [nibName retain]; // Save the nib name
}
return self;
}

- (void)dealloc
{   
[viewNibName release];

// Release all of the top-level objects in the nib file
[topLevelNibObjects makeObjectsPerformSelector:@selector(release)];
[topLevelNibObjects release];
[super dealloc];
}

I am thinking that maybe NSDocument and NSWindowController do a bit more than 
this and possibly somehow unbind everything so that these retain problems are 
avoided. Is that the case? And if so, does anybody know how?

I'd be very grateful if anyone can give me some advice on how to go about 
resolving these issues... Obviously one solution would be to manually unbind 
all of the columns, but I was hoping that I could implement a more general 
solution in my view controller subclass if that is where the problem lies.

Many thanks in advance and all the best,
Keith


  
___

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

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

2008-11-17 Thread Andy Lee

On Nov 17, 2008, at 1:03 AM, Stephen J. Butler wrote:
On Sun, Nov 16, 2008 at 11:52 PM, Sandro Noel [EMAIL PROTECTED]  
wrote:
as it turns out. with the bug fixed the mounts array is left null  
because

the file does not exist yet.
so further in the program is i try to add to the array, nothing  
happens.


and if i try mounts = [[NSMutableArray alloc] init]; only the two  
arrays

get the same pointer.


Well, then what's happening is obvious. initWithContentsOfFile: fails
because the file doesn't exist, so it performs cleanup (aka, call
release) and returns null. Your next alloc then just happens to grab
the same memory block.

1) never call the init* methods twice on the same object.
2) always use the value returned from an init* method.


To elaborate, the reasons for these are based in the way init methods  
work:


 A) When init methods fail, by convention they release their memory  
and return nil so the caller knows they failed.
 B) When init methods succeed, they may return a different object  
than the original receiver.


To spell this out:

mounts = [[NSMutableArray alloc] init];

This allocates and initializes an empty NSMutableArray.  Fine.

[mounts initWithContentsOfFile:someFile]];

There are two possible cases here.

A) If initWithContentsOfFile: fails, it releases the NSMutableArray,  
which in this case causes the memory to be deallocated, and returns  
nil.  However, you're ignoring the return value, so mounts is now  
pointing to a deallocated block of memory.


B) If initWithContentsOfFile: succeeds, your program *might* proceed  
just as you expect.  However, it is *very* possible that it returns an  
object with a different address than mounts had before the call.  So  
mounts *may* still point to a perfectly valid NSMutableArray, but not  
the one that contains your file contents.  It's also conceivable that  
the original object gets corrupted by the double init (well, we could  
look at the source for NSMutableArray, but in the general case,  
there's no requirement that double inits always be safe).


bonjourServices = [[NSMutableArray alloc]init];

What happened to you is that the memory formerly used by mounts  
happened to be reused to create bonjourServices.  So now you had two  
variables that point to the same perfectly good NSMutableArray.  Note  
that if bonjourServices was some other kind of object -- for example,  
a dictionary or a string -- you would have gotten a crash at some  
point when you tried to send a message to either mounts or  
bonjourServices that it didn't understand.


The best way to follow Stephen's rules 1 and 2 is to always, *always*  
combine the alloc and init.  Even though the following would have  
worked (assuming you added the check for a nil return)...


mounts = [NSMutableArray alloc];
mounts = [mounts initWithContentsOfFile:someFile]];

...it's just too easy to forget the assignment in the second line.   
Also, it would be easy to double-initialize by mistake.  And finally,  
it would be jarring to any other Cocoa programmer reading your code,  
since the combined alloc/init is the established idiom.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Set user agent for NSURL

2008-11-17 Thread John Pannell


Hello I am working on a website crawler and I am needing to make a  
user agent string so people who monitoring who visits can know  
that my crawler visited.



It sounds like you're getting data just using NSURL.

You can get much more control (including specifying the agent)  
using NSURLConnection and creating an NSURLRequest.


In case you are not used to such things, specifically you'll need an  
NSMutableURLRequest.


Like this:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: 
[NSURL URLWithString:theURLYouWantToScrape]];
[request setValue:theNameOfYourUserAgent forHTTPHeaderField:@User- 
Agent];
NSURLConnection *yourConnection = [NSURLConnection  
connectionWithRequest:request delegate:self];


The setting of the header field can be tough to find in the docs.   
Hope this helps!


John


John Pannell
Positive Spin Media
http://www.positivespinmedia.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: Cocoa-dev Digest, Vol 5, Issue 1956

2008-11-17 Thread Matthew Whillock

Have a look at:

http://en.wikipedia.org/wiki/Varargs

I know it's possible on linux/gcc so surely it works in osx.

Cheers,
Matt



--

Message: 2
Date: Mon, 17 Nov 2008 09:38:39 +0200
From: Oleg Krupnov [EMAIL PROTECTED]
Subject: How to implement float min(float x, ...) ?
To: Cocoa-Dev List cocoa-dev@lists.apple.com
Message-ID:
[EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.

I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:

float min(float x, ...);

Can anyone suggest the implementation?

I have read this: http://developer.apple.com/qa/qa2005/qa1405.html
but it seems to address arguments of type id, not sure it will work
for simple integral types like float.

Thanks!


--
Matthew Whillock
[EMAIL PROTECTED]
http://www.mssl.ucl.ac.uk/

Mullard Space Science Laboratory
Department Of Space And Climate Physics
Holmbury St Mary
Surrey RH5 6NT
UK






___

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

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


Opening Ports in Leopard

2008-11-17 Thread Gerriet M. Denkmann


I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.
On TIger there was a firewall, where I could open port 123 in System  
Preferences.


How can I do this in Leopard?

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Two arrays sharing the same adress space.

2008-11-17 Thread Andy Lee

On Nov 17, 2008, at 1:18 AM, Kyle Sluder wrote:

On Mon, Nov 17, 2008 at 1:03 AM, Stephen J. Butler
[EMAIL PROTECTED] wrote:

2) always use the value returned from an init* method.


This isn't strictly necessary.  If you need a singleton object that
lives for the duration of your app, for example, there's no reason you
can't just alloc/init one and let it go (unless, of course, you're
using garbage collection, in which case it might matter).  I can't
imagine a likely scenario for this outside of misapplication of an
idiom, but that doesn't make it illegal to ignore the return value of
-init.


I *think* Stephen meant we should use the value returned by the  
initializer as opposed to the value returned by alloc, not as opposed  
to ignoring it altogether.


--Andy


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to implement float min(float x, ...) ?

2008-11-17 Thread Chris Holloway
Hi,

It's not possible in C89, but in C99 you can do this (apologies if the
formatting is messed up):

#include math.h
#include stddef.h

#define ARRAY_NELEMS(A)(sizeof(A) / sizeof((A)[0]))
#define FA_MIN(...) fa_min_func((float []){
__VA_ARGS__ }, ARRAY_NELEMS(((float []){ __VA_ARGS__ })))

float fa_min_func(float f[], size_t n)
{
float ret;

if(n  1)
return NAN;

ret = f[0];

while(n--  1) {
if(f[n]  ret)
ret = f[n];
}

return ret;
}

Credit where it's due, I originally saw this 'trick' at
http://nikitadanilov.blogspot.com/2005/07/vaargs-c99-compound-literals-safe.html.

-Chris

2008/11/17 Oleg Krupnov [EMAIL PROTECTED]:
 I apologize, this is plain old C, not Cocoa-specific question, but the
 fastest way to get the answer.

 I want to create a function that finds the minimum out of a
 variable-length list of simple float arguments. In other words, I want
 this function:

 float min(float x, ...);

 Can anyone suggest the implementation?

 I have read this: http://developer.apple.com/qa/qa2005/qa1405.html
 but it seems to address arguments of type id, not sure it will work
 for simple integral types like float.

 Thanks!
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Two arrays sharing the same adress space.

2008-11-17 Thread Scott Ribe
 Mounts is being used, but just not in the init function.

You have declared it as a local variable. It *cannot* be used elsewhere.

I suspect that you have also declared it as a member (attribute, property,
whatever) and expect that you're assigning to that, but the local variable
will shadow that, and so there's your problem.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Two arrays sharing the same adress space.

2008-11-17 Thread Sandro Noel
Thank you all, for taking the time to explain the workings this was  
very instructive and very apreciated!!!


Thank you
Sandro Noel.

___

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

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

2008-11-17 Thread Andy Lee

On Nov 17, 2008, at 10:01 AM, Scott Ribe wrote:

Mounts is being used, but just not in the init function.


You have declared it as a local variable. It *cannot* be used  
elsewhere.


I suspect that you have also declared it as a member (attribute,  
property,
whatever) and expect that you're assigning to that, but the local  
variable

will shadow that, and so there's your problem.


He may have that problem as well, but improper separation of alloc  
from init as explained earlier was definitely causing the symptom  
described.  It's trivial to reproduce:


NSMutableArray *mounts;
NSMutableArray *bonjourServices;

mounts = [[NSMutableArray alloc] init];
[mounts initWithContentsOfFile:@NonexistentFile];  // causes  
dealloc
bonjourServices = [[NSMutableArray alloc] init];  // reuses  
dealloced memory


NSLog(@mounts = [%X], bonjourServices = [%X], equal? %d,  
mounts, bonjourServices, mounts == bonjourServices);



This gives me:

2008-11-17 10:10:53.285 Scratch2[21580:10b] mounts = [1317D0],  
bonjourServices = [1317D0], equal? 1


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Can you @synthesize simple arrays?

2008-11-17 Thread Greg Robertson
I have a couple of simple ivar arrays:

NSString   *myString[4];
NSInteger   myInteger[4];

How can I @synthesize these so I can access them with simple dot notation:

ie.  self.myInteger[2] = 100;

I have tried several ways to set them up in the @interface but I keep
getting compile errors. Could someone show me the proper @property or
is this not possible?

I would prefer to avoid NSArray if I can.


Thanks


Greg


P.S. Please excuse the cross post
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Can you @synthesize simple arrays?

2008-11-17 Thread Clark Cox
On Mon, Nov 17, 2008 at 7:14 AM, Greg Robertson [EMAIL PROTECTED] wrote:
 I have a couple of simple ivar arrays:

 NSString   *myString[4];
 NSInteger   myInteger[4];

 How can I @synthesize these so I can access them with simple dot notation:

I'm not sure that you can. However, this should get you the interface
that you want:

@interface MyClass :NSObject {
  NSString *myString[4];
  NSInteger *myInteger[4];
}

@property (readonly) NSString **myString;
@property (readonly) NSInteger *myInteger;
@end

@implementation MyClass

-(NSString**)myString {
  return myString;
}

-(NSInteger*)myInteger {
  return myInteger;
}

@end


 ie.  self.myInteger[2] = 100;

 I have tried several ways to set them up in the @interface but I keep
 getting compile errors. Could someone show me the proper @property or
 is this not possible?

 I would prefer to avoid NSArray if I can.


-- 
Clark S. Cox III
[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]


NSButtonCell slowdown in NSTableView

2008-11-17 Thread Robert Mullen
I have seen one other post asking this question so I will throw it out  
here and see if anyone has experienced: I have an NSTableView with 3  
NSButtonCells on it. Two are checkbox style one is bevel style (aping  
the iTunes arrow link.) The bevel style cell works swimmingly and  
gives me no grief (other than clicky text) but the checkbox style  
cells slow the scrolling in my table. Any time they are involved in a  
paint operation the scrolling gets very jerky. I have turned them off  
and changed their style and can confirm that either operation returns  
the scrolling to smooth and normal. I am not doing anything with these  
cells in code or using value formatters. They are simply dropped onto  
a column with a 1 or a 0. Has anybody else experienced this and/or  
know a solution?


TIA
___

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

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

2008-11-17 Thread Derek Chesterfield

There shouldn't be anything to open.
The Leopard application firewall should automatically allow packets  
that are responding to your query.


On 17 Nov 2008, at 12:40, Gerriet M. Denkmann wrote:


I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.
On TIger there was a firewall, where I could open port 123 in System  
Preferences.


How can I do this in Leopard?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Fetch value from field editor during editing?

2008-11-17 Thread Russ

Any ideas on why the field editor doesn't report the value as it is being 
edited? 

A further problem I've encountered: controlTextDidChange is called very 
infrequently --- only after committing the edit, after changing focus. I'm 
looking for notifications after each character --- that's my definition of when 
the field changed --- it is showing a different value, so let know, so I can 
update the REST of the UI to reflect the new, if only partially changed, name. 
That real-time responsiveness is important. (Not to fear about undo, the undos 
coalesce.)

-
Message: 15
Date: Sun, 16 Nov 2008 17:18:23 -0800 (PST)
Subject: Fetch value from field editor during editing?
To: cocoa-dev@lists.apple.com

I
need to be able to find the current value of a NSTextField even if it
is being edited. I have the following code to check if it is being
edited, and get the value from the field editor instead:

fresp = [[txtf window] firstResponder];
if ([fresp isKindOfClass:[NSTextView class]]  [(NSTextView*)fresp 
delegate] == txtf)
str = [(NSTextView*)fresp string];// being edited, 
get from field editor
else
str = [txtf stringValue];// not being edited, get from 
textfield itself

When
the text field (txtf) is being edited, the first case is definitely
used, but the wrong value still results. Ie suppose the original
textfield contained 100, I click on it to edit it and change the value
to 140. Now the code above runs (while the text field is still being
edited). The result is the original 100, not the current 140, even
though it is the field editor that is being queried. 

How do I
get the correct current value? This is a generic query, it can't end
editing on the field or otherwise change the state. Needless to say,
I'm more than a little surprised by this behavior. The whole field
editor thing is kind of like hanging your underwear to dry in the
living room to start with. Now the actual state seems to be even more
opaque.

Thanks.


  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fetch value from field editor during editing?

2008-11-17 Thread I. Savant
On Mon, Nov 17, 2008 at 10:41 AM, Russ [EMAIL PROTECTED] wrote:

 Any ideas on why the field editor doesn't report the value as it is being 
 edited?

  NSTextField is a subclass of NSControl. NSControl provides the
-isContinuous / -setContinuous: methods. Try reading up on those ...

--
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: Core data save error with multiple persistent stores

2008-11-17 Thread Arthur C .

It might also be worth putting a test in awakeFromInsert -- first  
check if the object has been assigned to a persistent store, and only  
assign if it has not.Done that; it doesn't get called more than once, and it 
doesn't help to do the assignObject: toPersistentStore: outside the 
awakeFromInsert.
Note that on systems with OS 10.5 (Leopard) it works fine, while on 10.4 
(Tiger)it always gives the error... We'll try to set it up using 
configurations in the data model. Any other suggestions?Okay, I've made a 
minimal test project using configurations in the data model, so we no longer 
need the assignObject: toPersistentStore: calls.The exception 'can't reassign 
object to a different store once it has been saved' occurs on quitting the 
application in the following case:- we have two managedObjectContexts, to be 
able to have separate save actions.- in one store we have two entities having 
a one-to-many relationship (say Person and Hobby).- in the second store we 
have just a single entity.- there are object instances of all entities present 
when we start the program.- we have added a new Person *and* we set the 
relationship of two Hobbys to one Person.- we are running on Tiger (10.4), not 
on 10.5 (this seems to matter).We are using standard interface for 'many 
objects'; array controllers bound to the correspondingmanaged object 
context.It turns out that the relationship is critical; with the relationship 
set to 'No Value' there is no error; when it is set in a newly added object, 
things go wrong. When running on Leopard, no problems...It seems that problems 
only come when there is one object having a relation to two or more other 
objects.So, the problem is now more accurately defined. I hope someone has an 
idea how to tackle this one, as it prevents us in a nasty way from having 
multiple separately savable stores.Thanks,Arthur C.
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Remove '\n' char from NSString

2008-11-17 Thread Douglas Davidson


On Nov 15, 2008, at 5:41 PM, Steven Riggs wrote:

Something like [string stringByReplacingOccurrencesOfString:@\n  
withString:@ ] should do the trick


Yes, or the mutable equivalent, provided that your line terminators  
are specified to be precisely '\n'.  If you wish to deal with line  
terminators more generally, you can use e.g. - 
getParagraphStart:end:contentsEnd:forRange: in a little loop.


Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Trouble with openFileWithoutUI

2008-11-17 Thread jhjames3
I am trying to open a defined document type programmatically.  Document type is 
defined in info.plist and opens with UI just fine.
I can not get openFileWithoutUI to work. I have read documentation and I find 
no samples of code. There are several places I could be making an error but I 
can not see what I may be doing wrong.

1. I set an object: AppController as a delegate of my NSApplication in IB. In 
MainMenu.NIB if I click on AppController object I see File's Owner in the 
referencing outlet as a delegate.
 
2. I have a method in AppController:
- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename
{
return [self application:NSApp openFile:filename];
}
3: I call from another controller with the following:
NSApplication* app = [NSApplication sharedApplication];
[app application:self openFileWithoutUI: totalFile];

When this last statement is executed it does not call the AppController:: 
application:(id)sender openFileWithoutUI:(NSString *)filename  method. 
in Console we get the error:
-[NSApplication application:openFileWithoutUI:]: unrecognized selector sent to 
...

Probably be something wrong with my delegate set up. Any suggestions?
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSOutlineView setDoubleAction: working on 10.5, but not on 10.4.11

2008-11-17 Thread Corbin Dunn


Le Nov 15, 2008 à 5:54 AM, Jerry Krinock a écrit :



On 2008 Nov, 15, at 2:54, Nick Rogers wrote:

when double clicking on an item the action method is not being  
called in 10.4.11.

Its working fine on Leopard.


The behavior was indeed changed in Leopard:

http://developer.apple.com/releasenotes/Cocoa/AppKit.html

NSTableView/NSOutlineView - Single click to editNSTableView and  
NSOutlineView now behave like Finder and allow a single click to put  
it into edit mode. This is done by calling - 
hitTestForEvent:inRect:ofView: and checking if the cell returns  
NSCellHitEditableTextArea. This allows you to set a doubleAction and  
perform some different task when the doubleAction is invoked (for  
instance, Finder opens files on a double click, and edits via a  
single click). If the doubleAction is not set, editing is still  
allowed via a double click.


The converse of this statement would be that, in 10.4.11,  
doubleclicking will always edit.


Personally, I believe this should be explained in the current  
documentation, but I've seen other cases in which Apple documents  
version-specific behavior changes in Release Notes only.  I don't  
know if that is intentional Apple policy or a bug.




Please do log a bug requesting that we clarify this in the  
documentation.


Nick -- the -doubleAction will work -- you just have to make sure the  
cell isn't editable. If you do want to allow the text in it to be  
edited, then you may be out of luck, since double click means start  
editing. There are ways around it, but it involves a bit of  
subclassing and processing things differently depending on where the  
user double clicks.


corbin

___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Trouble with openFileWithoutUI

2008-11-17 Thread Etienne Guérard
Try the following instead:

3: I call from another controller with the following:
NSApplication* app = [NSApplication sharedApplication];
[self application:app /* or NSApp */ openFileWithoutUI: totalFile];

EG
-Original Message-
3: I call from another controller with the following:
NSApplication* app = [NSApplication sharedApplication];
[app application:self openFileWithoutUI: totalFile];

When this last statement is executed it does not call the AppController:: 
application:(id)sender openFileWithoutUI:(NSString *)filename  method. 
in Console we get the error:
-[NSApplication application:openFileWithoutUI:]: unrecognized selector sent to 
...

Probably be something wrong with my delegate set up. Any suggestions?


This message and any attachments (the message) are confidential and intended 
solely for the addressee(s). Any unauthorised use or dissemination is 
prohibited. E-mails are susceptible to alteration. Neither DxO Labs nor any of 
its subsidiaries or affiliates shall be liable for the message if altered, 
changed or falsified.
Ce message et toutes les pieces jointes (ci-apres le message) sont 
confidentiels et etablis a l'intention exclusive de ses destinataires. Toute 
utilisation ou diffusion non autorisee est interdite. Tout message electronique 
est susceptible d'alteration. DxO Labs et ses filiales declinent toute 
responsabilite au titre de ce message s'il a ete altere, modifie ou falsifie.

___

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

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

2008-11-17 Thread Corbin Dunn


Le Nov 17, 2008 à 7:33 AM, Robert Mullen a écrit :

I have seen one other post asking this question so I will throw it  
out here and see if anyone has experienced: I have an NSTableView  
with 3 NSButtonCells on it. Two are checkbox style one is bevel  
style (aping the iTunes arrow link.) The bevel style cell works  
swimmingly and gives me no grief (other than clicky text) but the  
checkbox style cells slow the scrolling in my table. Any time they  
are involved in a paint operation the scrolling gets very jerky. I  
have turned them off and changed their style and can confirm that  
either operation returns the scrolling to smooth and normal. I am  
not doing anything with these cells in code or using value  
formatters. They are simply dropped onto a column with a 1 or a 0.  
Has anybody else experienced this and/or know a solution?


It's a known issue. Select the cell in IB and set the scaling to None.

Also, in the future, if you have a performance issue, take a  
'sample' (from the command line) and a Shark trace. Post that info  
along with your description, and it will greatly help people in  
determining the source of your problem.


thanks!
corbin___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with openFileWithoutUI

2008-11-17 Thread Fritz Anderson

On 17 Nov 2008, at 10:44 AM, [EMAIL PROTECTED] wrote:

I am trying to open a defined document type programmatically.   
Document type is defined in info.plist and opens with UI just fine.
I can not get openFileWithoutUI to work. I have read documentation  
and I find no samples of code. There are several places I could be  
making an error but I can not see what I may be doing wrong.


1. I set an object: AppController as a delegate of my NSApplication  
in IB. In MainMenu.NIB if I click on AppController object I see  
File's Owner in the referencing outlet as a delegate.


2. I have a method in AppController:
- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename
{
return [self application:NSApp openFile:filename];
}
3: I call from another controller with the following:
NSApplication* app = [NSApplication sharedApplication];
[app application:self openFileWithoutUI: totalFile];

When this last statement is executed it does not call the  
AppController:: application:(id)sender openFileWithoutUI:(NSString  
*)filename  method.

in Console we get the error:
-[NSApplication application:openFileWithoutUI:]: unrecognized  
selector sent to ...


Probably be something wrong with my delegate set up. Any suggestions?


Read up more on Cocoa's delegate design pattern.  
application:openFileWithoutUI: and application:openFile: are methods  
an application _delegate_ may implement. The documentation shows they  
are delegate methods. They are not methods of NSApplication, and  
trying to use one on an NSApplication will give you the error you saw,  
saying that the method isn't there.


You would not (maybe there are exceptions) call delegate methods  
yourself. It isn't illegal, but it suggests a problem in your design.  
Cocoa's purpose in having delegate methods is for them to be called  
from the object that owns the delegate.


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.org/ 



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with openFileWithoutUI

2008-11-17 Thread Keary Suska


On Nov 17, 2008, at 9:44 AM, [EMAIL PROTECTED] wrote:

I am trying to open a defined document type programmatically.   
Document type is defined in info.plist and opens with UI just fine.
I can not get openFileWithoutUI to work. I have read documentation  
and I find no samples of code. There are several places I could be  
making an error but I can not see what I may be doing wrong.


1. I set an object: AppController as a delegate of my NSApplication  
in IB. In MainMenu.NIB if I click on AppController object I see  
File's Owner in the referencing outlet as a delegate.


2. I have a method in AppController:
- (BOOL)application:(id)sender openFileWithoutUI:(NSString *)filename
{
return [self application:NSApp openFile:filename];
}
3: I call from another controller with the following:
NSApplication* app = [NSApplication sharedApplication];
[app application:self openFileWithoutUI: totalFile];

When this last statement is executed it does not call the  
AppController:: application:(id)sender openFileWithoutUI:(NSString  
*)filename  method.

in Console we get the error:
-[NSApplication application:openFileWithoutUI:]: unrecognized  
selector sent to ...


Probably be something wrong with my delegate set up. Any suggestions?


Not the delegate setup. NSApplication won't respond to your custom  
method unless you set a category. Delegation only occurs for  
specifically defined delegate methods. What you probably want is  
[NSApp delegate]. This will return the application delegate. NSApp is  
a global variable that always represents the shared application object  
(same as [NSApplication sharedApplication] ).


[[NSApp delegate] application:self openFileWithoutUI: totalFile];

HTH,

Keary Suska
Esoteritech, Inc.
Demystifying technology for your home or business

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Can you @synthesize simple arrays?

2008-11-17 Thread Michael Ash
On Mon, Nov 17, 2008 at 10:20 AM, Clark Cox [EMAIL PROTECTED] wrote:
 On Mon, Nov 17, 2008 at 7:14 AM, Greg Robertson [EMAIL PROTECTED] wrote:
 I have a couple of simple ivar arrays:

 NSString   *myString[4];
 NSInteger   myInteger[4];

 How can I @synthesize these so I can access them with simple dot notation:

 I'm not sure that you can. However, this should get you the interface
 that you want:

 @interface MyClass :NSObject {
  NSString *myString[4];
  NSInteger *myInteger[4];
 }

 @property (readonly) NSString **myString;
 @property (readonly) NSInteger *myInteger;
 @end

 @implementation MyClass

 -(NSString**)myString {
  return myString;
 }

 -(NSInteger*)myInteger {
  return myInteger;
 }

 @end

This will work, but because the properties only apply to the
accessing of the actual array, not the use of the individual elements,
no memory management will be done for the NSStrings and code which
just does straight assignments is likely to leak or crash, or both.
This may a good way to do it for primitives, but it's bad for objects.

I'd also say that this is a bad approach in general (not to criticize
your code, but just the original request) because you are essentially
bypassing encapsulation and giving callers direct access to your
internal data. There is no way to find out when someone has assigned
to the variable, so you can't override the behavior and provide
different ones if you need to in the future.

I'd recommend either using an NSArray even though you don't want to,
or writing accessors with indexes that you'd call like this:

[self setMyString:@foo atIndex:3];
[self myIntegerAtIndex:4];

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: NSButtonCell slowdown in NSTableView

2008-11-17 Thread Robert Mullen

Yup, that did it. Thanks much.

On Nov 17, 2008, at 9:07 AM, Corbin Dunn wrote:



Le Nov 17, 2008 à 7:33 AM, Robert Mullen a écrit :

I have seen one other post asking this question so I will throw it  
out here and see if anyone has experienced: I have an NSTableView  
with 3 NSButtonCells on it. Two are checkbox style one is bevel  
style (aping the iTunes arrow link.) The bevel style cell works  
swimmingly and gives me no grief (other than clicky text) but the  
checkbox style cells slow the scrolling in my table. Any time they  
are involved in a paint operation the scrolling gets very jerky. I  
have turned them off and changed their style and can confirm that  
either operation returns the scrolling to smooth and normal. I am  
not doing anything with these cells in code or using value  
formatters. They are simply dropped onto a column with a 1 or a 0.  
Has anybody else experienced this and/or know a solution?


It's a known issue. Select the cell in IB and set the scaling to  
None.


Also, in the future, if you have a performance issue, take a  
'sample' (from the command line) and a Shark trace. Post that info  
along with your description, and it will greatly help people in  
determining the source of your problem.


thanks!
corbin


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Open second Window

2008-11-17 Thread Fritz Anderson

On 16 Nov 2008, at 7:42 PM, Barry Fawthrop wrote:


I'm new to Xcode and Apple development
I have started my first application and on the main window I have a
button, which when pressed I would like it to open a second window.

Could someone please point me in the right direction


Welcome. Be sure to work the examples in Apple's tutorials, or in  
Aaron Hillegass's excellent book before you get too far into Cocoa  
programming. Having a foundation will save a lot of heartache.


In outline: Create a basic Cocoa project. From the Resources group,  
double-click to open MainMenu.xib. Drag an NSButton into the window  
that appears (this is your main window). Drag your second window into  
the XIB window; set its properties so Visible at Launch and Release  
When Closed are not checked.


Drag a button into your main window. Control-drag from the button to  
the second window (either its title bar, or its icon in the XIB  
window). Select the makeKeyAndOrderFront: action.


The resulting application will do what you want, but it's so  
oversimplified it's not practical for developing into something  
useful. It doesn't connect to any data or nontrivial control logic.  
You'll need to work the examples to get much further.


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- http://x3u.manoverboard.org/ 



___

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

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


CoreImage filters question

2008-11-17 Thread Jean-Nicolas Jolivet
I am working with a couple of CoreImage filters and I noticed most of  
them have a Minimum and Maximum value (as well as a default), but  
they also have a Slider Minimum and Slider Maximum value...


Which one should I assume is the real maximum?? For example, the  
inputBrightness parameter of CIColorControls has the following limits:


Default value: 0.00 Minimum: -1.00 Maximum: 0.00 Slider minimum: -1.00  
Slider maximum: 1.00 Identity: 0.00


Does it mean the value can go up to 1.0? or is the Maximum actually  
0.00?


It's a bit confusing


Jean-Nicolas Jolivet
[EMAIL PROTECTED]
http://www.silverscripting.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: How to implement float min(float x, ...) ?

2008-11-17 Thread Kirk Kerekes

How to implement float min(float x, ...) ?



I suggest you not use var_arg functions if you can avoid them.

So I propose a different path.

As a jumping-off point, here is a category method on NSData that  
assumes that self (the NSData instance) is an array of floats:


(The -floats category method merely casts NSData's -bytes to return a  
pointer-to-float, and the -floatlength category method divides -length  
by sizeof(float).)


Note that this makes the NSData the memory equivalent of a C array/ 
vector, so you can now pass it to the Accelerate framework.


Any setup overhead is likely compensated for by the hardware accel of  
vDSP (when available).


- (float) floatMinValueAndIndex:(int *) outIndex
{
float minValue = 0;
	vDSP_minvi((void *)[self floats], 1, minValue, outIndex, [self  
floatLength]);

return minValue;
}

The following NSData class category method will convert an arbitrary  
float array to the NSData required for the above:


+ (NSData *) floatsWithBlock: (float *) block count: (unsigned)  
count // count of floats

{
	NSData * result = [[self class] dataWithBytes: block length: (count *  
sizeof(float))];

return result;  
}

- (const float *) floats
{
return (const float *) [self bytes];
}

- (unsigned) count
{
return [self floatLength];
}

- (unsigned) floatLength
{
return [self length]/sizeof(float);
}


If performance is less of an issue than clarity, I would convert the  
floats to an NSArray of NSNumbers, and then just sort the array using  
the -sortedArrayUsing... methods. You get more information back -- not  
just min, but max and next-to-min, and next-to-max, etc.



___

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

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

2008-11-17 Thread Mr. Gecko

Thanks that works.

On Nov 17, 2008, at 6:15 AM, John Pannell wrote:



Hello I am working on a website crawler and I am needing to make  
a user agent string so people who monitoring who visits can know  
that my crawler visited.



It sounds like you're getting data just using NSURL.

You can get much more control (including specifying the agent)  
using NSURLConnection and creating an NSURLRequest.


In case you are not used to such things, specifically you'll need  
an NSMutableURLRequest.


Like this:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: 
[NSURL URLWithString:theURLYouWantToScrape]];
[request setValue:theNameOfYourUserAgent forHTTPHeaderField:@User- 
Agent];
NSURLConnection *yourConnection = [NSURLConnection  
connectionWithRequest:request delegate:self];


The setting of the header field can be tough to find in the docs.   
Hope this helps!


John


John Pannell
Positive Spin Media
http://www.positivespinmedia.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: How to implement float min(float x, ...) ?

2008-11-17 Thread Peter Ammon


On Nov 16, 2008, at 11:38 PM, Oleg Krupnov wrote:


I apologize, this is plain old C, not Cocoa-specific question, but the
fastest way to get the answer.

I want to create a function that finds the minimum out of a
variable-length list of simple float arguments. In other words, I want
this function:

float min(float x, ...);

Can anyone suggest the implementation?

I have read this: http://developer.apple.com/qa/qa2005/qa1405.html
but it seems to address arguments of type id, not sure it will work
for simple integral types like float.

Thanks!


In addition to what others have said, it is not possible to pass a  
float to such a function (except as one of the named arguments)  
without it being promoted to double.  So if you depend on working with  
floats, you do not want to use a vararg function.


This is why printf() doesn't have separate format specifiers for float  
and double.  Only %f, which means double.


-Peter




___

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

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


Displaying NSArray in NSTableView

2008-11-17 Thread 양승준

Hi, I'm trying to display data in an array to a table view. The table view 
shows three rows, but no data in them. What did I do wrong? In IB, I connected 
the table view to the delegate in File's owner. Many thanks!
Here is MyDocument.h:
#import Cocoa.h
@interface MyDocument : NSDocument
{
 IBOutlet NSTableView *parTableView;
 NSArray     *parBuffer; 
}
- (int)numberOfRowsInTableView:(NSTableView *)aTable;
- (id)tableView:(NSTableView *)aTable objectValueForColumn:(NSTableColumn 
*)aCol row:(int)aRow;
@end
And in MyDocument.m:
- (int) numberOfRowsInTableView:(NSTableView *)tableView
{
 return ([parBuffer count]);
}
- (id)tableView:(NSTableView *)aTable 
objectValueForColumn:(NSTableColumn *)aCol 
 row:(int)aRow
{
 return ([parBuffer objectAtIndex:aRow]);
}
The data is in parBuffer initialized inside (id) init as
 parBuffer =  [NSArray arrayWithObjects:
   [NSNumber numberWithInt:4],
   [NSNumber numberWithInt:8],
   [NSNumber numberWithFloat:3.14] , nil];
 
___

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

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

Question about interface builder

2008-11-17 Thread macdev
Hi,

 

I am migrating from PC/.NET development and I am very new to Xcode/IB/Cocoa.
I was wondering if I could generate GUIs  using code without the need to use
the IB. The main reason for this is that we have an application built with
MS.NET which generates different GUIs  based on customer
configuration/business domain programmatically.

 

Is something like this possible in Cocoa? If there a description or a file
format for (x)nib files available?

 

Thank you.

 

___

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

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

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

This email sent to [EMAIL PROTECTED]


Interface Builder Wiring Objects

2008-11-17 Thread Greg Deward

Good afternoon!

I am trying to learn Cocoa and am having difficulty remembering which  
direction to CTRL-drag controls to wire up the controls in Interface  
Builder.  For example, dragging from my button to my App Controller  
(NSObject) or vice versa.  Does anyone have a way to explain this that  
might make it stick?


It seems to me that a button should make a call to my App Controller  
when the click event is fired; therefore I should CTRL-drag FROM the  
button TO the NSObject. This would allow me to select the appropriate  
Received Action (ie, doSomething, etc.).  However, if I need to do  
something with a text box (read from it) and a table view (insert an  
item), I should go the other way... since I'm going to fetch from the  
text field and then insert into the NSArray that is feeding the text  
view.


Sorry for such a noob question.  Thank you, in advance, for your  
patience and assistance.


-- Greg
___

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

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

2008-11-17 Thread Luke the Hiesterman
With new versions of IB, it's not even necessary to remember. Simply  
right-click on an object and it will bring up a HUD with the list of  
outlets or sent messages or whatever you need. Alternatively, you can  
view this list in the outlets tab of the inspector window.


Even if the outlet you need is in a different object than the one  
you've selected, you can just drag from the new referencing outlet  
option to the object with that outlet. Using this right-click  
technique, selection is possible in either direction.


Luke


On Nov 17, 2008, at 10:09 AM, Greg Deward wrote:


Good afternoon!

I am trying to learn Cocoa and am having difficulty remembering  
which direction to CTRL-drag controls to wire up the controls in  
Interface Builder.  For example, dragging from my button to my App  
Controller (NSObject) or vice versa.  Does anyone have a way to  
explain this that might make it stick?


It seems to me that a button should make a call to my App Controller  
when the click event is fired; therefore I should CTRL-drag FROM the  
button TO the NSObject. This would allow me to select the  
appropriate Received Action (ie, doSomething, etc.).  However, if  
I need to do something with a text box (read from it) and a table  
view (insert an item), I should go the other way... since I'm going  
to fetch from the text field and then insert into the NSArray that  
is feeding the text view.


Sorry for such a noob question.  Thank you, in advance, for your  
patience and assistance.


-- Greg
___

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

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

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

This email sent to [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: Question about interface builder

2008-11-17 Thread Alex Kac
Just create a NIB with a main menu that's mostly blank except for the  
APp Name menu, and programmatically do the rest of the GUI. You can  
create all windows, add menus, etc.. all programatically.


On Nov 17, 2008, at 6:49 AM, macdev wrote:
I am migrating from PC/.NET development and I am very new to Xcode/ 
IB/Cocoa.
I was wondering if I could generate GUIs  using code without the  
need to use
the IB. The main reason for this is that we have an application  
built with

MS.NET which generates different GUIs  based on customer
configuration/business domain programmatically.

Is something like this possible in Cocoa? If there a description or  
a file

format for (x)nib files available?


Alex Kac - President and Founder
Web Information Solutions, Inc.

You cannot build a reputation on what you intend to do.
-- Liz Smith




___

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

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

2008-11-17 Thread Randall Meadows

On Nov 17, 2008, at 11:09 AM, Greg Deward wrote:


Good afternoon!

I am trying to learn Cocoa and am having difficulty remembering  
which direction to CTRL-drag controls to wire up the controls in  
Interface Builder.  For example, dragging from my button to my App  
Controller (NSObject) or vice versa.  Does anyone have a way to  
explain this that might make it stick?


Aaron Hillegass, in his Cocoa Programming for Mac OS X book explains  
it this way:


Now you are going to introduce some objects to each otherTo  
introduce one object to another, you will control-drag from the object  
that needs to know to the object it needs to know about.


So, for instance, a class needs to know about its NSButton outlet, so  
you control-drag from the class to the NSButton in the window (to set  
the IBOutlet).  The NSButton needs to know what method to call when it  
is pressed, so you control-drag from the button to the class (to set  
the IBAction).


Or do what Luke said in his response... :)

It seems to me that a button should make a call to my App Controller  
when the click event is fired; therefore I should CTRL-drag FROM the  
button TO the NSObject. This would allow me to select the  
appropriate Received Action (ie, doSomething, etc.).


Yep, sounds like you have the basic gist of it...

However, if I need to do something with a text box (read from it)  
and a table view (insert an item), I should go the other way...  
since I'm going to fetch from the text field and then insert into  
the NSArray that is feeding the text view.


But, what triggers the action of reading from the text field and  
inserting that into the array that feeds the table (you said text, but  
I assume that's a typo) view?  A button gets pressed? The user presses  
Enter?  You set the action of the object that does that action just as  
you would otherwise.

___

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

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

2008-11-17 Thread Quincey Morris

On Nov 17, 2008, at 04:03, 양승준 wrote:

Hi, I'm trying to display data in an array to a table view. The  
table view shows three rows, but no data in them. What did I do  
wrong? In IB, I connected the table view to the delegate in File's  
owner. Many thanks!

Here is MyDocument.h:
#import Cocoa.h
@interface MyDocument : NSDocument
{
IBOutlet NSTableView *parTableView;
NSArray *parBuffer;
}
- (int)numberOfRowsInTableView:(NSTableView *)aTable;
- (id)tableView:(NSTableView *)aTable objectValueForColumn: 
(NSTableColumn *)aCol row:(int)aRow;

@end


These are data source methods, not delegate methods. Did you connect  
the table view's data source to the document?



___

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

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

2008-11-17 Thread Greg Deward

Luke / Randall,

Thanks for replying.  I did not want to embarrass Mr. Hillegass with  
my ignorance, but his book IS the one I am trying to follow.  I am  
currently working on his To Do List example in Chapter 6 (page 110).


In my example, I have the following items in my App Controller class:

Text Field (along with an IBOutlet)
Button (along with an IBOutlet)
Table View (along with an IBOutlet) 
Mutable Array instance variable

My concern is whether or not the DIRECTION in which I CTRL-drag the  
objects.  For example, if do I drag from the Button object to the App  
Controller or do I CTRL-drag from the App Controller to the Button?


I'm coming from a C# / .NET environment.  While there ARE visual  
design tools involved, it is much more manual.  For example, adding a  
Button to a Form creates the implmentation in the source file.  Double- 
clicking the control then creates the event handler for the object.   
Anything that you may want to do is handled programatically.


Basically, since I cannot see what is happening under the hood, I'm  
beginning to second-guess that the calls will be made in the right  
direction.


I hope that made sense.  Again, my apologies for such a noob-ish  
question.


Thanx,
Fred



On Nov 17, 2008, at 1:56 PM, Randall Meadows wrote:


On Nov 17, 2008, at 11:09 AM, Greg Deward wrote:


Good afternoon!

I am trying to learn Cocoa and am having difficulty remembering  
which direction to CTRL-drag controls to wire up the controls in  
Interface Builder.  For example, dragging from my button to my App  
Controller (NSObject) or vice versa.  Does anyone have a way to  
explain this that might make it stick?


Aaron Hillegass, in his Cocoa Programming for Mac OS X book  
explains it this way:


Now you are going to introduce some objects to each otherTo  
introduce one object to another, you will control-drag from the  
object that needs to know to the object it needs to know about.


So, for instance, a class needs to know about its NSButton outlet,  
so you control-drag from the class to the NSButton in the window (to  
set the IBOutlet).  The NSButton needs to know what method to call  
when it is pressed, so you control-drag from the button to the class  
(to set the IBAction).


Or do what Luke said in his response... :)

It seems to me that a button should make a call to my App  
Controller when the click event is fired; therefore I should CTRL- 
drag FROM the button TO the NSObject. This would allow me to select  
the appropriate Received Action (ie, doSomething, etc.).


Yep, sounds like you have the basic gist of it...

However, if I need to do something with a text box (read from it)  
and a table view (insert an item), I should go the other way...  
since I'm going to fetch from the text field and then insert into  
the NSArray that is feeding the text view.


But, what triggers the action of reading from the text field and  
inserting that into the array that feeds the table (you said text,  
but I assume that's a typo) view?  A button gets pressed? The user  
presses Enter?  You set the action of the object that does that  
action just as you would otherwise.


___

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

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

2008-11-17 Thread Clark Cox
On Mon, Nov 17, 2008 at 11:36 AM, Greg Deward [EMAIL PROTECTED] wrote:
 Luke / Randall,

 Thanks for replying.  I did not want to embarrass Mr. Hillegass with my
 ignorance, but his book IS the one I am trying to follow.  I am currently
 working on his To Do List example in Chapter 6 (page 110).

 In my example, I have the following items in my App Controller class:

Text Field (along with an IBOutlet)
Button (along with an IBOutlet)
Table View (along with an IBOutlet)
Mutable Array instance variable

 My concern is whether or not the DIRECTION in which I CTRL-drag the objects.
  For example, if do I drag from the Button object to the App Controller or
 do I CTRL-drag from the App Controller to the Button?

Think of it this way: The object that you drag FROM is the object
whose attributes you are changing.

So, dragging from a button to its target is roughly equivalent to calling:
[button setTarget: theTargetObject]

and dragging from, for instance, a view controller to its view is
equivalent to calling:
[viewController setView: theView]

-- 
Clark S. Cox III
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with openFileWithoutUI

2008-11-17 Thread jhjames3
Documentation for application:openFileWithoutUI:
Sent directly by sender to the delegate to request that the file filename be 
opened as a linked file. The method should open the file without bringing up 
its application’s user interface—that is, work with the file is under 
programmatic control of sender, rather than under keyboard control of the user.

It seemed like the think to use. 

Ok, How do I open a file pragramatically? 

 -- Original message --
From: Fritz Anderson [EMAIL PROTECTED]
 On 17 Nov 2008, at 10:44 AM, [EMAIL PROTECTED] wrote:
 
  I am trying to open a defined document type programmatically.   

 Read up more on Cocoa's delegate design pattern.  
 application:openFileWithoutUI: and application:openFile: are methods  
 an application _delegate_ may implement. The documentation shows they  
 are delegate methods. They are not methods of NSApplication, and  
 trying to use one on an NSApplication will give you the error you saw,  
 saying that the method isn't there.
 
 You would not (maybe there are exceptions) call delegate methods  
 yourself. It isn't illegal, but it suggests a problem in your design.  
 Cocoa's purpose in having delegate methods is for them to be called  
 from the object that owns the delegate.
 
   — F
 
 -- 
 Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- 
 http://x3u.manoverboard.org/ 
  
 

___

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

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

2008-11-17 Thread Andrew Farmer

On 17 Nov 08, at 04:40, Gerriet M. Denkmann wrote:

I am trying to move a Cocoa app from Tiger to Leopard.
This program wants to send and receive on port 123 (Network Time  
Protocoll) but it never gets no answers on Leopard.


Do you have network time synchronization turned on already (in the  
Date and Time prefpane)? The built-in ntpd uses that port, so you'll  
need to either disable that or use another port.

___

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

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


NSDateFormatter strangeness

2008-11-17 Thread Greg Hoover
I've worked with formatters for a while now, but this morning  
something odd happened.  The following code translates the date string  
17 Nov 2008 to 2007-12-23 00:00:00 -0800.


NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat: @dd MMM ];

NSString *dateString = @17 Nov 2008;
	NSLog(@%@ - %@, dateString, [dateFormatter dateFromString:  
dateString]);

[dateFormatter release];

I'm at a loss for what's happening.  When I run stringFromDate on with  
[NSDate date] I get 17 Nov 2008.


Thanks,
Greg
___

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

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

2008-11-17 Thread Andy Lee

On Nov 17, 2008, at 2:36 PM, Greg Deward wrote:

In my example, I have the following items in my App Controller class:

Text Field (along with an IBOutlet)
Button (along with an IBOutlet)
Table View (along with an IBOutlet) 
Mutable Array instance variable


The technical term for these items is instance variable, or ivar  
for short.  Your AppController class has instance variables of type  
NSTextField, NSButton, etc. which are named myTextField, myButton, or  
whatever made sense to you.


You don't have ivars along with outlets.  An outlet *is* a  
particular kind of ivar.  It's an object reference that is declared in  
such a way that IB recognizes it and allows you to assign its value  
graphically in IB.  Typically the declaration has the modifier  
IBOutlet in front of it, as in:


@interface AppController : NSObject {
IBOutlet NSTextField *myTextField;
...
}

This is just a hint to IB to say I want you to treat this ivar as an  
outlet.  The IBOutlet modifier has no other effect or purpose --  
indeed, it's just a macro that evaluates to nothing.


My concern is whether or not the DIRECTION in which I CTRL-drag the  
objects.  For example, if do I drag from the Button object to the  
App Controller or do I CTRL-drag from the App Controller to the  
Button?


Remember that an outlet is an object reference.  You can think of an  
object reference as a pointer that points TO another object.  When you  
Control-drag, imagine an arrowhead at the end of the line you're  
dragging.  You're making a connection FROM where you started the drag  
TO wherever you decide to drop that arrowhead.  As was explained  
earlier, you're making the FROM object aware of the TO object.


In your specific example, you would drag FROM your AppController  
instance to each of the objects it needs to be aware of:


Hey app controller, I want this to be the text field your  
myTextField outlet points to.


Hey app controller, I want this to be the button your myButton  
outlet points to.


Then when the nib is loaded at runtime, the app controller's ivars  
will point to those respective objects.


To specify a button's target/action, you would say Hey button  
[dragging from the button], I want this [dragging TO the app  
controller] to be your target.


Similarly:

Hey text field, I want this to be your delegate.

Hey table view, I want this to be your data source.  (And again if  
you also want to set the table view's delegate.)


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Writing a more usable AppleEvent logger

2008-11-17 Thread has

Ken Tozier wrote:


I've been working with AppleEvents and discovering their internals by
setting the following in the terminal


export AEDebugSends=1; export AEDebugReceives=1


What I'd like to be able to do is observe apple events exactly like
this tool but format them into an NSDictionary so they can be used to
easily build complex events. Since the above tool observes events, it
must be possible, but how would I capture these events in my own tool?
Is this something that needs to be a kernel extension? Or is there a
higher level way to do it?


Have you looked at AE Monitor?

http://software.oxalyn.com/AEMonitor

Not aware of public APIs for sniffing AE traffic myself (if any exist,  
they aren't advertised), but at worst you could always capture and  
parse AEDebug output yourself. It's pretty straightforward, and most  
of it could probably be massaged to pass to the Apple Event Manager's  
AEBuild* functions and reconstitute that way.


There's also ASTranslate, which allows you to run AppleScript commands  
and get the equivalent Python/Ruby/ObjC appscript code (basically the  
same trick as Script Editor's 'Event Log' pane uses):


http://appscript.sourceforge.net/tools.html

Mike Ash's AEVTBuilder might also be of some interest to you, being an  
ObjC version of the AEBuild* functions.



HTH

has

p.s. None of this is specific to Cocoa, so might be a good idea to  
move future discussion to applescript-implementors.


--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

___

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

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

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

This email sent to [EMAIL PROTECTED]


core data - delete of object.

2008-11-17 Thread John Clayton

Hi All,

I'm using core-data and need to know when a particular core-data  
object (derived from NSManagedObject of course) is about to be  
deleted.   I'm deleting objects simply by using the managed object  
context's deleteObject method, like this:

[[theObject managedObjectContext] deleteObject:theObject];

Is there a way to be notified immediately of the delete?  I need to  
know immediately, not only when the context is saved.  Am I missing  
something painfully obvious here?


now, I could of course put a 'deleteThisObject' method onto the class  
I'm deleting, but isn't there a core-data way to handle this?


I've tried catching the  
NSManagedObjectContextObjectsDidChangeNotification notification - but  
that only fires on context saves, same with the willTurnIntoFault  
method as well as the dealloc - all these methods are only ever called  
when the context is being saved - which in my case is (a)  
unpredictable, (b) too late .


Help / tips are greatly appreciated,

Thanks
--
John Clayton
Skype: johncclayton




___

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

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


OutlineView, bindings and array of NSDictionaries.

2008-11-17 Thread Sandro Noel

Greetings!

Once again, I am faced with a problem :)

I cant seem to get my data to display properly in the Outline View,  
and i am sure it is because of the organisation of my data that it  
does not display

so I'm asking you guy's to sugest some ideas.

I have an array of Dictionaries the dictionary is organised like this.

ServerName
VolumeName
TransportName
MountDirectory
UserName
Password
Async

I would like to use the ServerName as a root node (grouped) an then  
use the VolumeName as child nodes of that server name.

using bindings if possible. so for instance, if i had,

Dictionary 1
serverName = Server1
VolumeName = Volume1

Dictionary 2
serverName = Server1
VolumeName = Volume2

Dictionary 3
serverName = Server1
VolumeName = Volume3

in the outline view they would be displayed as:

 Server 1
Volume1
Volume2
Volume3

is that at all possible with my model, or do i have to change the  
model to fit with some requirements ?
I cant find a tutorial on the outline view that explains how to use  
bindings in this way.


Thank you!
Sandro Noel.
___

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

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

2008-11-17 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 7:49 AM, macdev [EMAIL PROTECTED] wrote:
 I am migrating from PC/.NET development and I am very new to Xcode/IB/Cocoa.
 I was wondering if I could generate GUIs  using code without the need to use
 the IB.

Why does everyone new to the platform want to immediately discard IB?
It is the correct (yes, correct, not preferred, not easiest, but
*correct*) way to implement your interface.

 The main reason for this is that we have an application built with
 MS.NET which generates different GUIs  based on customer
 configuration/business domain programmatically.

Think very carefully about how much interface generation you really
want to do.  Often times a capable professional UI designer can come
up with an interface that isn't generated so much as having parts of
it hidden or resized.

--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: core data - delete of object.

2008-11-17 Thread Jim Correia

On Nov 17, 2008, at 4:51 PM, John Clayton wrote:

I'm using core-data and need to know when a particular core-data  
object (derived from NSManagedObject of course) is about to be  
deleted.   I'm deleting objects simply by using the managed object  
context's deleteObject method, like this:

[[theObject managedObjectContext] deleteObject:theObject];

Is there a way to be notified immediately of the delete?  I need to  
know immediately, not only when the context is saved.  Am I missing  
something painfully obvious here?


now, I could of course put a 'deleteThisObject' method onto the  
class I'm deleting, but isn't there a core-data way to handle this?


I've tried catching the  
NSManagedObjectContextObjectsDidChangeNotification notification -  
but that only fires on context saves, same with the  
willTurnIntoFault method as well as the dealloc - all these methods  
are only ever called when the context is being saved - which in my  
case is (a) unpredictable, (b) too late .


Is -validateForDelete: time too late? If not, that's an option.

You can also try

[context deleteObject: object];
[context processPendingChanges];

... handle notification ...

[context save: error];

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: Writing a more usable AppleEvent logger

2008-11-17 Thread Dave DeLong
AEMonitor, AFAIK, is totally dead.  My inquiries to the developer  
(Eric Oxalyn) haven't been answered.


Dave

On Nov 17, 2008, at 2:46 PM, has wrote:


Have you looked at AE Monitor?

http://software.oxalyn.com/AEMonitor

___

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

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

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 4:59 PM, Kyle Sluder wrote:


Why does everyone new to the platform want to immediately discard IB?
It is the correct (yes, correct, not preferred, not easiest, but
*correct*) way to implement your interface.


I can tell you that the majority of iPhone developers are refusing to  
use IB.  The reasons I usually see are


It's one more thing to learn.
It's not as good as GUI builders on other platforms.
Generating a UI in code gives more control.
For a long time IB was buggy and incomplete for iPhone development so  
developers got used to generating their UIs without it.


In addition:

The UI's on iPhone tend to be simpler and have fewer different views  
so whatever savings in time there might be with IB are not so  
pronounced.


Apple examples tend to not use IB.  For instance there are no Apple  
examples for UITableView that use IB.  The UICatalog example app,  
which demonstrates every UI element, is almost completely done in  
code.  IMO, there's no excuse for this.


Certain aspects of the UI must be done in code because things aren't  
revealed in IB or simply can't be done there.


Apple spending months diddling over its NDA meant that most iPhone  
developers found non-Apple forums to discuss iPhone development so any  
guidance that Apple might have had over how to write proper apps has  
been very late in coming.


I do use IB for a lot of my UI on iPhone but quite a bit of it is in  
code also.


--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about interface builder

2008-11-17 Thread Alex Kac
That's an interesting question. We use IB where we can on the iPhone  
and frankly we can use it a lot. Most of Apple's samples were redone  
to use IB when IB for iPhone became usable. Yes, there are many  
reasons to do things in code, but there are many to use IB. Its a  
balance. Using IB cuts down the amount of work dramatically. We have a  
very big iPhone product that we've been working on *since March* and  
we still have a ways to go. We had to do everything by code at first -  
and I'm personally used to doing that on Windows because all the GUI  
designers there are horrible - but once we got IB working it  
accelerated our development in many areas.


So its a balance - code and IB. There are plenty of areas where  
frankly code is better on the iPhone. But there are many that people  
are just not using IB because they are being obstinate.


One thing I think many newbies try to avoid IB for is simply because  
they don't get Cocoa dev very well. They are used to Win32 or .NET  
generating everything in code because thats how its done. And yes,  
even in .NET expert devs tend to generate the UI in code because  
that's really all the .NET UI builders do.


On Nov 17, 2008, at 4:25 PM, Brian Stern wrote:



On Nov 17, 2008, at 4:59 PM, Kyle Sluder wrote:


Why does everyone new to the platform want to immediately discard IB?
It is the correct (yes, correct, not preferred, not easiest,  
but

*correct*) way to implement your interface.


I can tell you that the majority of iPhone developers are refusing  
to use IB.  The reasons I usually see are


It's one more thing to learn.
It's not as good as GUI builders on other platforms.
Generating a UI in code gives more control.
For a long time IB was buggy and incomplete for iPhone development  
so developers got used to generating their UIs without it.


In addition:

The UI's on iPhone tend to be simpler and have fewer different views  
so whatever savings in time there might be with IB are not so  
pronounced.


Apple examples tend to not use IB.  For instance there are no Apple  
examples for UITableView that use IB.  The UICatalog example app,  
which demonstrates every UI element, is almost completely done in  
code.  IMO, there's no excuse for this.


Certain aspects of the UI must be done in code because things aren't  
revealed in IB or simply can't be done there.


Apple spending months diddling over its NDA meant that most iPhone  
developers found non-Apple forums to discuss iPhone development so  
any guidance that Apple might have had over how to write proper apps  
has been very late in coming.


I do use IB for a lot of my UI on iPhone but quite a bit of it is in  
code also.


--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Alex Kac - President and Founder
Web Information Solutions, Inc.

You cannot build a reputation on what you intend to do.
-- Liz Smith




___

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

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

2008-11-17 Thread mmalcolm crawford


On Nov 17, 2008, at 1:46 PM, Andy Lee wrote:

You don't have ivars along with outlets.  An outlet *is* a  
particular kind of ivar.  It's an object reference that is declared  
in such a way that IB recognizes it and allows you to assign its  
value graphically in IB.  Typically the declaration has the modifier  
IBOutlet in front of it, as in:

@interface AppController : NSObject {
   IBOutlet NSTextField *myTextField;
   ...
}


Going forward, you're encouraged to declare outlets as follows:

@interface AppController : NSObject {
   NSTextField *myTextField;
   ...
}

@property (nonatomic, retain) IBOutlet NSTextField *myTextField;


http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html 



mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Question about interface builder

2008-11-17 Thread macdev
 mistakes. So it's really not a recommended technique. I understand
 that what you're describing is what you're used to. You need to
 understand that what you're used to isn't even close to optimal for
 this platform.

I guess 10+ years of developing in one platform pretty much shapes the way
one thinks about how to build and write code. Learning to think like a Mac
developer is the hardest part so far... 

Regards,
Gevik.


___

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

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

2008-11-17 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 5:25 PM, Brian Stern [EMAIL PROTECTED] wrote:
 I can tell you that the majority of iPhone developers are refusing to use
 IB.  The reasons I usually see are

I didn't get the implication that the OP was doing iPhone development.
 In fact, I'd be very surprised if he were, considering the situation
he described.

 It's one more thing to learn.

It's part of the platform.  (Well, more accurately, it's part of
developing with AppKit.)

 It's not as good as GUI builders on other platforms.

I think your statement is very incorrect, in part because IB is
nothing like GUI builders on other platforms.  IB doesn't generate
code, it instantiates objects and archives them.  This is the primary
hurdle people with experience on other platforms run into.  Barring
that, I'd like to see an example of a GUI builder that you think is
superior to IB, even for all its bugs and flaws.

 Generating a UI in code gives more control.

Generating a UI in code introduces a much larger margin for error for
little to no added benefit.  With exceedingly rare exception, there is
nothing you can do to lay out your interface in code that you can't do
in IB.

 For a long time IB was buggy and incomplete for iPhone development so
 developers got used to generating their UIs without it.

Since I'm not talking about iPhone development I will accept your
point prima facie.  The rest of your points are therefore superfluous.

--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: Question about interface builder

2008-11-17 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 6:17 PM, macdev [EMAIL PROTECTED] wrote:
 I guess 10+ years of developing in one platform pretty much shapes the way
 one thinks about how to build and write code. Learning to think like a Mac
 developer is the hardest part so far...

It very much does, and I don't mean to come across as attacking you
for it.  There are, however, quite a few people coming to Mac
development from other platforms who stubbornly insist on not using
Interface Builder, despite all explanations that by going the nibless
Cocoa route they are violating assumptions that the framework,
documentation, and development community are making, thus setting
themselves up for failure when they run into an issue and few people
are willing to assist them.

I'm wondering if Apple's doing a good enough job explaining how IB is
different from UI code generators and why it is important that one use
it.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Trouble with openFileWithoutUI

2008-11-17 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 2:52 PM,  [EMAIL PROTECTED] wrote:
 It seemed like the think to use.

Read that first sentence again.  Sent directly by the sender to the
delegate...  The delegate is the receiver, not the NSApplication
instance.

 Ok, How do I open a file pragramatically?

Read up on the Cocoa document architecture again and look at
-[NSDocumentController openDocumentWithContentsOfURL:display:error:].

--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: NSDateFormatter strangeness

2008-11-17 Thread Kyle Sluder
I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa).

So, don't log NSDate objects, send them through an NSDateFormatter instead.

--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: OutlineView, bindings and array of NSDictionaries.

2008-11-17 Thread Quincey Morris

On Nov 17, 2008, at 13:51, Sandro Noel wrote:

I cant seem to get my data to display properly in the Outline View,  
and i am sure it is because of the organisation of my data


See here:


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTreeController_Class/Reference/Reference.html

(the overview), and here:

	http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/Concepts/CntrlContent.html#/ 
/apple_ref/doc/uid/TP40002147-185041


You're basically going to need an additional set of objects that  
represent the servers, each of which has an array of volumes. The  
trick is making sure that they all properly respond to the children,  
countOfChildren and isLeaf property names that you specify to the  
tree controller.


In the simplest case, you just just need a children property:

Dictionary 0
serverName = Server1
VolumeName = @
children = {Dictionary 1, Dictionary 2, Dictionary 3}

Dictionary 1
serverName = Server1
VolumeName = Volume1
children = {}

Dictionary 2
serverName = Server1
VolumeName = Volume2
children = {}

Dictionary 3
serverName = Server1
VolumeName = Volume3
children = {}

and then bind either the server dictionary as the content object for  
the tree controller or (if there are multiple servers) an array of  
server dictionaries as the content array.



___

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

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


NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-17 Thread Rua Haszard Morris
I have found that NSSuperscriptAttributeName,  
NSUnderlineStyleAttributeName, and NSObliquenessAttributeName (those  
are the attributes that I have tested) render differently when Cocoa  
Text is used to draw the string.  The attributes appear to be  
intrepreted inverted, in that 1 for superscript produces subscript,  
positive obliqueness is a leftward tilt, etc. In normal controls the  
attributes render as expected.


Has anyone else seen this problem? I've implemented some workarounds,  
tweaking the attribute values depending on whether the string is drawn  
via standard controls or within custom views, but I'd like to clear up  
whether I'm doing something wrong, or it's expected behaviour, or if  
it is a bug in Cocoa Text.


I've reported the bug, with a small project demonstrating the problem:  
rdar://6379047


thanks
Rua HM.


___

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

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

2008-11-17 Thread Andy Lee

On Nov 17, 2008, at 6:23 PM, Kyle Sluder wrote:

I'm wondering if Apple's doing a good enough job explaining how IB is
different from UI code generators and why it is important that one use
it.


I think this is a good question.  Maybe it'd be worth having a WWDC  
session dedicated to clearing this up, if there isn't already?


I do think IB can also feel a little less than transparent even when  
you know how it all works.  The only way to check that all your  
connections are where you think they are is by inspecting everything  
manually (and by test-running your app, of course).  There's no way to  
generate a text dump that you can eyeball.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about interface builder

2008-11-17 Thread j o a r


On Nov 17, 2008, at 3:23 PM, Kyle Sluder wrote:


I'm wondering if Apple's doing a good enough job explaining how IB is
different from UI code generators and why it is important that one use
it.



I don't agree that it's somehow more important for Cocoa developers to  
use an UI design tool, compared to developers using other development  
environments. Cocoa developers, much like developers on other  
platforms, can always choose not to use the designer, if they'd rather  
spend their time cranking out and maintaining UI configuration code  
than business critical code.


Also note that Microsoft has moved away from code generation with  
their recent WPF designers that uses XML for storage.



j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSAttributedString rendering bugs when rendered with Cocoa Text (rdar://6379047)

2008-11-17 Thread Douglas Davidson


On Nov 17, 2008, at 3:50 PM, Rua Haszard Morris wrote:

I have found that NSSuperscriptAttributeName,  
NSUnderlineStyleAttributeName, and NSObliquenessAttributeName (those  
are the attributes that I have tested) render differently when Cocoa  
Text is used to draw the string.  The attributes appear to be  
intrepreted inverted, in that 1 for superscript produces subscript,  
positive obliqueness is a leftward tilt, etc. In normal controls the  
attributes render as expected.


Make sure that you are drawing in a flipped context.

Douglas Davidson

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about interface builder

2008-11-17 Thread Shawn Erickson
On Mon, Nov 17, 2008 at 3:53 PM, Andy Lee [EMAIL PROTECTED] wrote:

 There's no way to generate a text dump that you can eyeball.

Can generate XML that you can eyeball or transform into something more
readable... (not ideal but better then nothing)

ibtool --connections /Developer/Examples/Quartz/Core\
Image/CIRAWFilterSample/ImageDocument.xib

-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: Question about interface builder

2008-11-17 Thread Kyle Sluder
On Mon, Nov 17, 2008 at 6:54 PM, j o a r [EMAIL PROTECTED] wrote:
 I don't agree that it's somehow more important for Cocoa developers to use
 an UI design tool, compared to developers using other development
 environments. Cocoa developers, much like developers on other platforms, can
 always choose not to use the designer, if they'd rather spend their time
 cranking out and maintaining UI configuration code than business critical
 code.

My point is that this isn't the case.  Avoiding IB has been shown to
introduce subtle bugs.

--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: Question about interface builder

2008-11-17 Thread j o a r


On Nov 17, 2008, at 4:02 PM, Kyle Sluder wrote:


My point is that this isn't the case.  Avoiding IB has been shown to
introduce subtle bugs.



Like what?

I know of one thing that's currently difficult to do in code: Setting  
up the main menu. Difficult yes, but not impossible. Should this be  
fixed to be fully supported and robust? Of course. If you care about  
this, I'd suggest that you file bug reports.


j o a r


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Question about interface builder

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 6:19 PM, Kyle Sluder wrote:

On Mon, Nov 17, 2008 at 5:25 PM, Brian Stern  
[EMAIL PROTECTED] wrote:
I can tell you that the majority of iPhone developers are refusing  
to use

IB.  The reasons I usually see are


I didn't get the implication that the OP was doing iPhone development.
In fact, I'd be very surprised if he were, considering the situation
he described.


Um, OK.  I hijacked the thread.  You asked the question.  I replied in  
a little different direction because it's something I've been thinking  
about for a while.


You misunderstand my original post.  Those points I listed were not  
mine.  They were the  points that I see every day posted on the non- 
Apple iPhone forums explaining why many developers don't use IB.


The points I listed after 'In Addition' are mine.

Apple is obviously failing, or at least not succeeding, in its task of  
educating iPhone developers.



--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


CMGetImageSpace() replacement?

2008-11-17 Thread Randall Meadows
The code I'm working on uses CMGetImageSpace(), which is deprecated in  
10.5, but the docs don't suggest anything to use in its stead.


Anyone know?
___

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

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

2008-11-17 Thread Gregory Weston


On Nov 17, 2008, at 6:53 PM, Andy Lee wrote:


On Nov 17, 2008, at 6:23 PM, Kyle Sluder wrote:

I'm wondering if Apple's doing a good enough job explaining how IB is
different from UI code generators and why it is important that one  
use

it.


I think this is a good question.  Maybe it'd be worth having a WWDC  
session dedicated to clearing this up, if there isn't already?


I do think IB can also feel a little less than transparent even  
when you know how it all works.  The only way to check that all  
your connections are where you think they are is by inspecting  
everything manually (and by test-running your app, of course).   
There's no way to generate a text dump that you can eyeball.


XIB files and nibtool output *somewhat* address that.

But I agree there needs to be more on the educational side. And I  
don't think WWDC is the place/time to do it, frankly, because the  
people that really need to understand it by and large don't go to  
WWDC *when* they need to understand 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: Re: Displaying NSArray in NSTableView

2008-11-17 Thread 양승준

Thank you for replying. 
I connected dataSource by ctrl-dragging from the  tableView to File's owner and 
selecting dataSource. If I change the number of elements of the array, the 
number of rows in the tableView changes. The problem is that the data in the 
array doesn't show up... 
-Original Message-
From: Quincey Morrislt;[EMAIL PROTECTED]gt; 
To: cocoa-dev@lists.apple.com
Cc: 
Sent: 08-11-18(화) 04:01:57
Subject: Re: Displaying NSArray in NSTableView
On Nov 17, 2008, at 04:03, 양승준 wrote:
 Hi, I'm trying to display data in an array to a table view. The 
 table view shows three rows, but no data in them. What did I do 
 wrong? In IB, I connected the table view to the delegate in File's 
 owner. Many thanks!
 Here is MyDocument.h:
 #import Cocoa.h
 @interface MyDocument : NSDocument
 {
 IBOutlet NSTableView *parTableView;
 NSArray *parBuffer;
 }
 - (int)numberOfRowsInTableView:(NSTableView *)aTable;
 - (id)tableView:(NSTableView *)aTable objectValueForColumn: 
 (NSTableColumn *)aCol row:(int)aRow;
 @end
These are data source methods, not delegate methods. Did you connect 
the table view's data source to the document?
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/mozartwa%40naver.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]

Regex

2008-11-17 Thread Mr. Gecko

Hello I have been trying to find a good Regex framework for cocoa.
I am trying to find urls in an html page, I have this regex from php  
that I made so all I would need is a way to bring it to cocoa, the  
regex is /a\s[^]*href=(\??)([^\ ]*?)\\1[^]*.*\/a/siU


Thanks for the help.
Mr. Gecko
___

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

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

2008-11-17 Thread Greg Hoover

I am using NSDateFormatter.  The code snippet included shows this.

Greg
On Nov 17, 2008, at 3:38 PM, Kyle Sluder wrote:


I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa).

So, don't log NSDate objects, send them through an NSDateFormatter  
instead.


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

2008-11-17 Thread Dave DeLong

http://regexkit.sourceforge.net

I use it pretty frequently (the Lite version, anyway).

HTH,

Dave

On 17 Nov, 2008, at 6:04 PM, Mr. Gecko wrote:


Hello I have been trying to find a good Regex framework for cocoa.
I am trying to find urls in an html page, I have this regex from php  
that I made so all I would need is a way to bring it to cocoa, the  
regex is /a\s[^]*href=(\??)([^\ ]*?)\\1[^]*.*\/a/siU


Thanks for the help.
Mr. Gecko

___

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

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

2008-11-17 Thread Quincey Morris

On Nov 17, 2008, at 04:03, 양승준 wrote:


The data is in parBuffer initialized inside (id) init as
parBuffer =  [NSArray arrayWithObjects:
  [NSNumber numberWithInt:4],
  [NSNumber numberWithInt:8],
  [NSNumber numberWithFloat:3.14] , nil];


Is this a garbage-collected application? If not, then you have a  
memory management problem because 'parBuffer' is not being retained.


Are there any error messages in the log?


___

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

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

2008-11-17 Thread Andrew Farmer

On 17 Nov 08, at 17:04, Mr. Gecko wrote:

Hello I have been trying to find a good Regex framework for cocoa.
I am trying to find urls in an html page...


Assuming that you're loading the web page into a WebView or similar,  
you'll have a much easier time doing this through the HTML DOM. Trying  
to parse HTML with regular expressions is risky, as there are numerous  
edge cases which are easy to miss.

___

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

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

2008-11-17 Thread Mr. Gecko
I've never thought of that, but I am using NSURL because I want it to  
be a crawler.

I'll see if I can do that with what I got so far.

On Nov 17, 2008, at 7:43 PM, Andrew Farmer wrote:


On 17 Nov 08, at 17:04, Mr. Gecko wrote:

Hello I have been trying to find a good Regex framework for cocoa.
I am trying to find urls in an html page...


Assuming that you're loading the web page into a WebView or similar,  
you'll have a much easier time doing this through the HTML DOM.  
Trying to parse HTML with regular expressions is risky, as there are  
numerous edge cases which are easy to miss.


___

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

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

2008-11-17 Thread Mr. Gecko
I've found RegexKit but I couldn't figure out how to get an array from  
my string.


On Nov 17, 2008, at 7:43 PM, Andrew Farmer wrote:


On 17 Nov 08, at 17:04, Mr. Gecko wrote:

Hello I have been trying to find a good Regex framework for cocoa.
I am trying to find urls in an html page...


Assuming that you're loading the web page into a WebView or similar,  
you'll have a much easier time doing this through the HTML DOM.  
Trying to parse HTML with regular expressions is risky, as there are  
numerous edge cases which are easy to miss.


___

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

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


Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread mmalcolm crawford


On Nov 17, 2008, at 3:06 PM, mmalcolm crawford wrote:


Going forward, you're encouraged to declare outlets as follows:
@interface AppController : NSObject {
  NSTextField *myTextField;
  ...
}
@property (nonatomic, retain) IBOutlet NSTextField *myTextField;


Jeff asked (posted with permission):

One remaining question. Are you expected to release the outlet when  
your

controller is dealloc'd?  And did you have to prior to properties?
I believed the answer to the latter was no but I'm prepared to be
wrong on that..


Since the property is declared with the 'retain' attribute, the memory  
management semantics are made clear here.  Yes, you should release the  
outlet in dealloc.


The problem heretofor was that the story was a mess -- whether or not  
you released the outlet was dependent upon what class File's Owner  
inherited from, and whether or not you had accessor methods.  The  
principal advantage with the property-based pattern is that memory  
management is consistent across all classes across all patterns.  It  
will also work on modern runtimes that use instance variable synthesis  
(where there may be no instance variable declaration with which to  
attach the IBOutlet).


There may be some variation; if you have a delegate that may be  
connected using a delgate, then you may have:


@interface AppController : NSObject {
  id delegate;
  ...
}
@property (nonatomic, assign) IBOutlet id delegate;

although again use of a property declaration makes the memory  
management semantics clear (in this case you would of course not  
release delegate in dealloc).



One other consideration, particularly in iPhone applications, is where  
you might have outlets to subviews of a main view that might be  
released in sime situations -- e.g. a UIViewController whose view is  
released in didReceiveMemoryWarning. To ensure that you don't prolong  
the lifetime of objects you got from the nib, you should set (use your  
accessor methods to) set those variables to nil in the relevant  
method, e.g.:


@interface MyController : UIViewController {
  UILabel *label;
  ...
}
@property (nonatomic, retain) IBOutlet UILabel *label;

then

- (void)didReceiveMemoryWarning {
self.label = nil;
[super didReceiveMemoryWarning];
}


mmalc

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 9:11 PM, mmalcolm crawford wrote:

One other consideration, particularly in iPhone applications, is  
where you might have outlets to subviews of a main view that might  
be released in sime situations -- e.g. a UIViewController whose view  
is released in didReceiveMemoryWarning. To ensure that you don't  
prolong the lifetime of objects you got from the nib, you should set  
(use your accessor methods to) set those variables to nil in the  
relevant method, e.g.:


@interface MyController : UIViewController {
 UILabel *label;
 ...
}
@property (nonatomic, retain) IBOutlet UILabel *label;

then

- (void)didReceiveMemoryWarning {
   self.label = nil;
   [super didReceiveMemoryWarning];
}


OK, this issue has come up for me very recently.  It appears that on  
iPhoneOS IBOutlets are retained, regardless of the presence of  
properties.  Even worse, in the presence of an assign property the  
outlet is still retained.  Whatever code is retaining the outlets  
never releases them.  So it seems that client code must release all  
outlets.


The documentation on this is vague, with a lot of 'should's and not  
clear statements of what really happens.  Actually this isn't (only)  
related to didReceiveMemoryWarning (which I hadn't considered related  
to this problem until you raised it).


Is this the way that things are supposed to work on iPhone OS?

--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fetch value from field editor during editing?

2008-11-17 Thread Russ
Nice try, but that definitely doesn't affect typing. According to the docs, it 
affects mouse tracking.

NSTextField: why use the rowboat you need, when you can use an aircraft carrier 
instead. 

Still no way to find the text editor value while it is editing, or receive 
notifications as the value changes.


- Original Message 
Sent: Monday, November 17, 2008 10:52:46 AM
Subject: Re: Fetch value from field editor during editing?

On Mon, Nov 17, 2008 at 10:41 AM, Russ wrote:

 Any ideas on why the field editor doesn't report the value as it is being 
 edited?

  NSTextField is a subclass of NSControl. NSControl provides the
-isContinuous / -setContinuous: methods. Try reading up on those ...

--
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: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Luke the Hiesterman


On Nov 17, 2008, at 7:12 PM, Brian Stern wrote:

OK, this issue has come up for me very recently.  It appears that on  
iPhoneOS IBOutlets are retained, regardless of the presence of  
properties.  Even worse, in the presence of an assign property the  
outlet is still retained.  Whatever code is retaining the outlets  
never releases them.  So it seems that client code must release all  
outlets.


Seems to me that the outlets must have a retain count of at least one  
when they're unarchived, as though they were alloc'd. It makes sense  
that the programmer should have to manually release objects in  
dealloc. How else would it happen?


Luke
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Fetch value from field editor during editing?

2008-11-17 Thread Randall Meadows

On Nov 17, 2008, at 8:17 PM, Russ wrote:

Nice try, but that definitely doesn't affect typing. According to  
the docs, it affects mouse tracking.


NSTextField: why use the rowboat you need, when you can use an  
aircraft carrier instead.


Still no way to find the text editor value while it is editing, or  
receive notifications as the value changes.


-controlTextDidChange: delegate method; I use it all the time to find  
out when a text field changes.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 10:17 PM, Luke the Hiesterman wrote:



On Nov 17, 2008, at 7:12 PM, Brian Stern wrote:

OK, this issue has come up for me very recently.  It appears that  
on iPhoneOS IBOutlets are retained, regardless of the presence of  
properties.  Even worse, in the presence of an assign property the  
outlet is still retained.  Whatever code is retaining the outlets  
never releases them.  So it seems that client code must release all  
outlets.


Seems to me that the outlets must have a retain count of at least  
one when they're unarchived, as though they were alloc'd. It makes  
sense that the programmer should have to manually release objects in  
dealloc. How else would it happen?


IBOutlets are not necessarily top level objects.  Most are simply  
views that happen to be in the view hierarchy.  There will typically  
be one top level object in an iPhone nib.  This will be the view that  
belongs to UIViewController.  It is the UIViewController base class  
that loads the nib.  As long as it retains that top level view then  
all the subviews will also be retained.  They should be released when  
the UIViewController releases its view outlet.


Furthermore, NSBundle loadNibNamed:owner:options: on iPhone OS returns  
an array of the top level objects.  It would be trivial for the  
UIViewController base class object that is loading the nib to retain  
that array and of course release it in its dealloc.


If user code doesn't retain the outlets I don't understand why user  
code should be releasing those objects.



--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Help on Software update application

2008-11-17 Thread Arnab Ganguly
Hi All,
I am planning to develop an application similar to what you get in the
Software Update in Mac.If you click on that it checks any update is
required for your machine etc...Mine application will look for the updates
specific to the developed Client.
Is there any sample app I can refer to ?Any help would be very much
appreciated.
Thanks
Arnab
___

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

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

2008-11-17 Thread Dave Fernandes

Have you looked at the Sparkle framework?

http://en.wikipedia.org/wiki/Sparkle_(software)

On Nov 17, 2008, at 10:48 PM, Arnab Ganguly wrote:


Hi All,
I am planning to develop an application similar to what you get in the
Software Update in Mac.If you click on that it checks any update is
required for your machine etc...Mine application will look for the  
updates

specific to the developed Client.
Is there any sample app I can refer to ?Any help would be very much
appreciated.
Thanks
Arnab
___

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

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

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


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 10:53 PM, Luke the Hiesterman wrote:



On Nov 17, 2008, at 7:46 PM, Brian Stern wrote:



On Nov 17, 2008, at 10:17 PM, Luke the Hiesterman wrote:



On Nov 17, 2008, at 7:12 PM, Brian Stern wrote:

OK, this issue has come up for me very recently.  It appears that  
on iPhoneOS IBOutlets are retained, regardless of the presence of  
properties.  Even worse, in the presence of an assign property  
the outlet is still retained.  Whatever code is retaining the  
outlets never releases them.  So it seems that client code must  
release all outlets.


Seems to me that the outlets must have a retain count of at least  
one when they're unarchived, as though they were alloc'd. It makes  
sense that the programmer should have to manually release objects  
in dealloc. How else would it happen?


IBOutlets are not necessarily top level objects.  Most are simply  
views that happen to be in the view hierarchy.  There will  
typically be one top level object in an iPhone nib.  This will be  
the view that belongs to UIViewController.  It is the  
UIViewController base class that loads the nib.  As long as it  
retains that top level view then all the subviews will also be  
retained.  They should be released when the UIViewController  
releases its view outlet.


Right, and view is a property of UIViewController. When you have  
your UIViewController release view, that is an example of the  
programmer releasing an outlet assigned from IB, which you seem to  
be arguing that the programmer shouldn't have to release objects  
given to it from IB.


Top.  Level.  Object.

Whatever code loads the nib is the owner of the array of top level  
objects and should retain them.  That object is UIViewController, not  
my subclass.


At any rate.  The problem is that this is poorly documented.

--
Brian Stern
[EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Roland King


OK, this issue has come up for me very recently.  It appears that  
on iPhoneOS IBOutlets are retained, regardless of the presence of  
properties.  Even worse, in the presence of an assign property the  
outlet is still retained.  Whatever code is retaining the outlets  
never releases them.  So it seems that client code must release  
all outlets.



Seems to me that the outlets must have a retain count of at least  
one when they're unarchived, as though they were alloc'd. It makes  
sense that the programmer should have to manually release objects  
in dealloc. How else would it happen?



IBOutlets are not necessarily top level objects.  Most are simply  
views that happen to be in the view hierarchy.  There will typically  
be one top level object in an iPhone nib.  This will be the view  
that belongs to UIViewController.  It is the UIViewController base  
class that loads the nib.  As long as it retains that top level view  
then all the subviews will also be retained.  They should be  
released when the UIViewController releases its view outlet.



Right, and view is a property of UIViewController. When you have your  
UIViewController release view, that is an example of the programmer  
releasing an outlet assigned from IB, which you seem to be arguing  
that the programmer shouldn't have to release objects given to it 
from  IB.


Luke

Exactly - most of the things you're hooking up in IB are your own 
objects, those outlets are just instance variables which are being set 
for you. It's your object, you have to deal with the lifetimes of the 
objects you refer to. I don't see why IB makes any difference, it's just 
calling setFoo: on some instance of your class, what you define setFoo 
to do is entirely up to you, but if it retains the argument, then you 
have to release it one day, in dealloc() would be the natural place.


The iPhone version of nib unarchiving and hookup seemed very consistent 
to me, it makes use of properties or setFoo: if you have them, allowing 
you to manage objects any way you like.


Perhaps the new @property() syntax makes it easy to forget about object 
lifetimes because it does the set/get/change automagically. These days 
when I add any property I go right to the dealloc method (and init if I 
have one) and ensure I've managed that property before I forget.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Brian Stern


On Nov 17, 2008, at 11:05 PM, Roland King wrote:



OK, this issue has come up for me very recently.  It appears  
that  on iPhoneOS IBOutlets are retained, regardless of the  
presence of  properties.  Even worse, in the presence of an  
assign property the  outlet is still retained.  Whatever code is  
retaining the outlets  never releases them.  So it seems that  
client code must release  all outlets.



Seems to me that the outlets must have a retain count of at  
least  one when they're unarchived, as though they were alloc'd.  
It makes  sense that the programmer should have to manually  
release objects  in dealloc. How else would it happen?



IBOutlets are not necessarily top level objects.  Most are simply   
views that happen to be in the view hierarchy.  There will  
typically  be one top level object in an iPhone nib.  This will be  
the view  that belongs to UIViewController.  It is the  
UIViewController base  class that loads the nib.  As long as it  
retains that top level view  then all the subviews will also be  
retained.  They should be  released when the UIViewController  
releases its view outlet.



Right, and view is a property of UIViewController. When you have  
your  UIViewController release view, that is an example of the  
programmer  releasing an outlet assigned from IB, which you seem to  
be arguing  that the programmer shouldn't have to release objects  
given to it from  IB.


Luke

Exactly - most of the things you're hooking up in IB are your own  
objects, those outlets are just instance variables which are being  
set for you. It's your object, you have to deal with the lifetimes  
of the objects you refer to. I don't see why IB makes any  
difference, it's just calling setFoo: on some instance of your  
class, what you define setFoo to do is entirely up to you, but if it  
retains the argument, then you have to release it one day, in  
dealloc() would be the natural place.


The iPhone version of nib unarchiving and hookup seemed very  
consistent to me, it makes use of properties or setFoo: if you have  
them, allowing you to manage objects any way you like.


Perhaps the new @property() syntax makes it easy to forget about  
object lifetimes because it does the set/get/change automagically.  
These days when I add any property I go right to the dealloc method  
(and init if I have one) and ensure I've managed that property  
before I forget.


Yes, but this is exactly the point.  If I have no property for an  
Outlet it's still retained.  If I have a property for an outlet that  
is assign, and not retain the outlet is still retained, and I still  
must release it, even though I never retained it.


When you say I can manage the outlets any way I like this is wrong.   
They are managed for me.  I want them to not be retained.  I don't  
have that option.


Now that I understand this I can live with it.  But it still makes no  
sense to me.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Outlets / IBOutlet declarations (was Re: Interface Builder Wiring Objects)

2008-11-17 Thread Luke the Hiesterman


On Nov 17, 2008, at 8:15 PM, Brian Stern wrote:

When you say I can manage the outlets any way I like this is wrong.   
They are managed for me.  I want them to not be retained.  I don't  
have that option.


I never said this. I compared having objects unarchived from a nib to  
being alloc'd, where the retain count is initially set to 1.


Luke
___

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

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


  1   2   >