Re: any help with [NSThread initWithTarget:selector:object]???

2008-05-15 Thread Alex Esplin
On Wed, May 14, 2008 at 11:26 PM, Ken Thomases [EMAIL PROTECTED] wrote:
 On May 15, 2008, at 12:15 AM, Alex Esplin wrote:

 Everything compiles, and when I run it, the Console tells me that
 debugging completed normally.  However, I'm getting nothing in the way
 of output from any of the threads:

 Is your main function waiting for the threads to complete, or is it just
 exiting?  When your main function returns, there's an implicit exit() call
 and your whole process exits.  There's no implicit waiting for all threads
 to complete.

Doh.  I knew I had to be missing something trivial.  When you start a
thread with [threadname start] how do you wait for it?  I can't seem
to find anything on that...

-- 
Alex Esplin
___

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

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

2008-05-15 Thread Uli Kusterer

Am 15.05.2008 um 02:15 schrieb Johnny Lundy:
And if I want to refer by name to that instance in my code, what is  
the name of the instance?



 You don't. What you're doing is the approach taken by other  
frameworks, like Carbon:


1) Every object in a GUI description file has a unique identifier
2) When your object loads a GUI description file, it gets a pointer to  
the root object of the loaded GUI
3a) Then you write a huge function that calls some  
FindViewByUniqueIdentifier() repeatedly to get a pointer to each  
object and stash pointers to them in your instance variables
3b) Alternately, each function that needs to access an object in the  
GUI calls this function to get a pointer to stash in a local variable,  
leading to repeated searches through your object graph


 Cocoa works differently in that it has the concept of outlets that  
take care of step 3. By control-dragging from an outlet  
myInstanceVariable in an object myObject to an object loadedView  
in IB, you make a note that IB should call [myObject setValue:  
loadedView forKey: @myInstanceVariable].


 So, instead of you asking the hierarchy: Where is Pete?, the  
hierarchy tells YOU: In case you care, Pete is over here when it  
loads the NIB and has created the object Pete.


 This may seem backwards, but since every NSObject implements  
setValue:forKey: already to look up the instance variable with the  
same name as the key and assign it the given value, this actually  
means that your instance variables will all be set up with pointers to  
the loaded objects by the time your awakeFromNib method is called.  
I.e. you don't have to write that huge function, you just drag from  
outlets to objects in IB while you're already dragging and clicking to  
create your GUI.


 The object names, as far as I'm aware, are actually only there to  
help you navigate the objects in a NIB at design time.


Say I drag out an object and set its class to MyClass. IB dutifully  
names the object MyClass also. So in my code if I code [MyClass  
somemessage], does that message go to the Class Object or to the  
instance made in IB? If to the Class Object, how do I code to refer  
to the instance?


 That object goes to the instance. You dragged out an *object*, an  
instance, so that's what you get. I expected that, myself, so never  
got confused by the name being the class name, but I can see how one  
could be.


Also, I found out that IB will not let me make 2 instances of the  
same Class. In code, I could say myClassInstance1 = [MyClass new];  
and MyClassInstance2 = [MyClass new];, but apparently not in IB.


 You can make two instances of a class in the same NIB by dragging  
out two Objects from the palette and seting their custom class. But as  
you now know, the names are only for designing, and don't really have  
any use outside that.



This has been a mystery to me for six years now.

Also, the documentation only says about File's Owner that it is the  
object that loaded the nib file. What is that object, if my nib file  
just gets loaded at application launch?


 Well, the MainMenu.nib, the main NIB file, gets loaded by the single  
NSApplication object in your application, so that's the File's Owner  
in that case. In other NIBs, the File's owner is generally the  
NSWindowController or NSViewController or NSDocument that loaded the  
corresponding NIB, or if you're using NSNibLoading directly, it's  
whatever object you passed in as the owner.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Setting NSObjectController's to file's owner

2008-05-15 Thread André Pang

Hi all,

I have a nib file containing an NSObjectController.  The  
NSObjectController's content is set to the File's Owner proxy object,  
and this creates a retain cycle.  (The file's owner never gets  
deallocated because the object controller retains it, and the object  
controller never gets deallocated because the file's owner retains it  
as an IBOutlet.)


This is obviously a bad thing to do, but I always thought that it was  
good design for views and controls to be bound to an  
NSObjectController rather than the file's owner directly, since  
NSObjectController then takes care of all the NSEditor protocol stuff,  
you get auto-completion for model key names in Interface Builder,  
etc.  Is there a better method than what I'm doing?  (I would think  
that setting an NSObjectController's content object to the file's  
owner is a reasonably common scenario, so I can't be alone in  
experiencing this memory leak.)  Binding a control directly to the  
file's owner seems kinda skanky.


Also, I've Googled around a ton and found a lot of references to  
memory leaks that occur when binding to the file's owner, but it  
appears that those bugs are fixed up in 10.4.  (The last messages and  
blog posts I saw about this topic were from 2004.)  Is that correct?



--
% Andre Pang : trust.in.love.to.save  http://www.algorithm.com.au/





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: any help with [NSThread initWithTarget:selector:object]???

2008-05-15 Thread Michael Vannorsdel
You might try using pthreads, they're easy to use but not NSThread  
easy.  They have several more options and make the base NSThread is  
built upon.  There's a join option with pthreads where one can wait  
for another to finish which might be what you're looking for.  Look at  
pthread_join.



On May 15, 2008, at 12:02 AM, Alex Esplin wrote:


Doh.  I knew I had to be missing something trivial.  When you start a
thread with [threadname start] how do you wait for it?  I can't seem
to find anything on that...


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Efficient XML loading [continuation of NSString from mapped NSData thread]

2008-05-15 Thread Matt Gough


On 15 May 2008, at 00:20, Jens Alfke wrote:

Because it would be orders of magnitude slower. Even the property  
list parser can read the iTunes library in a few seconds. Extracting  
all that information via AppleEvents would certainly take minutes.
Taking that amount of time, it would be subject to race conditions,  
since the library might change while your script is iterating it.




Fair enough. Out of interest, is it the exchange of the AppleEvents  
that is slow, or iTunes handling of them (if you can tell). I remember  
long ago writing some plain AppleScripts for an early iTunes and it  
could get fairly simple info in 'a few seconds' for large(at the time)  
libraries (10,000 songs). Maybe if things have gotten slower since  
then someone should report a bug. (No, I don't still have the scripts  
handy)


Matt
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: any help with [NSThread initWithTarget:selector:object]???

2008-05-15 Thread Ken Thomases

On May 15, 2008, at 1:02 AM, Alex Esplin wrote:


When you start a
thread with [threadname start] how do you wait for it?  I can't seem
to find anything on that...


There doesn't seem to be any join-type functionality in NSThread.   
You have to use thread synchronization primitives, I suppose.   
NSConditionLock is a good candidate.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Setting NSObjectController's to file's owner

2008-05-15 Thread Ken Thomases

On May 15, 2008, at 2:21 AM, André Pang wrote:

I have a nib file containing an NSObjectController.  The  
NSObjectController's content is set to the File's Owner proxy  
object, and this creates a retain cycle.  (The file's owner never  
gets deallocated because the object controller retains it, and the  
object controller never gets deallocated because the file's owner  
retains it as an IBOutlet.)


One of the nice things that NSWindowController and NSViewController do  
for you is, if they are a nib's owner, they resolve this retain cycle  
for you.


Cheers,
Ken

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Efficient XML loading [continuation of NSString from mapped NSData thread]

2008-05-15 Thread Jean-Daniel Dupas


Le 15 mai 08 à 10:11, Matt Gough a écrit :



On 15 May 2008, at 00:20, Jens Alfke wrote:

Because it would be orders of magnitude slower. Even the property  
list parser can read the iTunes library in a few seconds.  
Extracting all that information via AppleEvents would certainly  
take minutes.
Taking that amount of time, it would be subject to race conditions,  
since the library might change while your script is iterating it.




Fair enough. Out of interest, is it the exchange of the AppleEvents  
that is slow, or iTunes handling of them (if you can tell). I  
remember long ago writing some plain AppleScripts for an early  
iTunes and it could get fairly simple info in 'a few seconds' for  
large(at the time) libraries (10,000 songs). Maybe if things have  
gotten slower since then someone should report a bug. (No, I don't  
still have the scripts handy)


Matt


I'm using AE to query large info set from iTunes and don't get any  
performance issues. But you have to learn how to use AE.


get all tracks.
for each track in tracks
  get name

is very slow. But

get names of all tracks (using one single AE)

is pretty fast.

It depends what you need. If this it just to get a list a name, it  
will do the trick, if you want to query more info, you may have to  
choose an other path.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: glass effect - CG call to do this?

2008-05-15 Thread Michael Vannorsdel
You're probably thinking CoreImage.  Checkout the CIFilter docs,  
there's a few builtin glass filters available.



On May 15, 2008, at 3:01 AM, John Clayton wrote:

A few months ago, while browsing code headers at random (lets just  
call this a little passtime of mine), I noticed a method call that  
took an image and then added a glass effect to it.


I believe this was in the Core Graphics headers somewhere, but for  
the life of me can't find it now.


Does anyone know if this exists and where it might be? (don't tell  
me I was just dreaming).


___

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

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

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

This email sent to [EMAIL PROTECTED]


Query with PDF Page display in PDFview

2008-05-15 Thread Amrit Majumdar
Hi All,
Been working with the PDFKit for a couple of weeks now.

With the PDFView we can display upto two pages in a row.
I need to display more than two PDF pages in a row.

An earlier post pointed me to the fact that the PDFThumbnailView can be used
for the same.

But the catch is PDFThumbnailView doesn't help me acheive all my
requirements.
Is there any other  way in which I can display more than two Pages in a row
in the PDFView ?
The PDF pages displayed in the view will be edited by the user.

TIA,
Amrit
___

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

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

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

This email sent to [EMAIL PROTECTED]


Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread JanakiRam
Hi All,
I'm facing an issue with NSFileManger directoryContentsAtPath API. This
seems to be an wried issue. But its very important for me to fix. Please
help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by Finder and
Terminal in a different ways. Can any one please suggest me a way to resolve
this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@/Users/janakiram/Downloads/Folder.tiff];
int i , count = [filePath count];

for ( i = 0 ; i  count ; i++ ) {
NSLog(@ filepath  is (%@),[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/Folder.tiff

Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M




JanakiRam.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Assertion failure in -[NSNextStepFrame lockFocus]

2008-05-15 Thread Apparao Mulpuri
Here is the Stacktrace:

2008-05-15 14:45:33.469 MyCocoaApp[554:10b] NSExceptionHandler has
recorded the following exception:
NSInternalInconsistencyException -- -[NSNextStepFrame(0x12e0d0)
lockFocus] failed with window=0x145b30, windowNumber=340, [self
isHiddenOrHasHiddenAncestor]=0
Stack trace:  0x34dbc  0x9416676c  0x95df9e04  0x9112cde4  0x9569235c
0x956914c8  0x955e5498  0x955e52f8  0x95d8b018  0x95d8c1c8  0x92d823a8
 0x92d82134  0x92d8200c  0x955e33c0  0x955e2d88  0x955dca44
0x955ad448  0x251c  0x2220  0x1
2008-05-15 14:45:33.470 MyCocoaApp[554:10b]
-[NSNextStepFrame(0x12e0d0) lockFocus] failed with window=0x145b30,
windowNumber=340, [self isHiddenOrHasHiddenAncestor]=0
2008-05-15 14:45:33.508 MyCocoaApp[554:10b] *** Assertion failure in
-[NSNextStepFrame lockFocus],
/SourceCache/AppKit/AppKit-949.27/AppKit.subproj/NSView.m:4751


On Thu, May 15, 2008 at 10:01 AM, Jens Alfke [EMAIL PROTECTED] wrote:

 On 14 May '08, at 9:17 PM, Apparao Mulpuri wrote:

 ** Assertion failure in -[NSNextStepFrame lockFocus],
 /SourceCache/AppKit/AppKit-949.27/AppKit.subproj/NSView.m:4751
 May 14 17:37:39 apparao-power-mac-g5 MyCocoaApp[123]:
 -[NSNextStepFrame(0x143610) lockFocus] failed with window=0x142e60,
 windowNumber=62, [self isHiddenOrHasHiddenAncestor]

 What's the backtrace?
 Set a breakpoint at objc_exception_throw to find out.

 —Jens
___

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

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

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

This email sent to [EMAIL PROTECTED]


[NSImageView setImage:nil] clarification

2008-05-15 Thread matt . gough

It isn't explicitly mentioning anywhere, but is:

[someImageView setImage:nil];

the correct way to have an empty image view.

Often the Appkit documentation calls out the validity of nil  
parameters (e.g [NSActionCell setImage:] and [NSLevelIndicator  
setImage:]), so the lack of such a statement in NSImageView got me  
worried.


Thanks

Matt
___

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

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

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

This email sent to [EMAIL PROTECTED]


html

2008-05-15 Thread vinitha
Hi,
I'm using xcode3.0 and objective c.Is there any way to generate html from
the plain test or images?Actualy i've to send mail in both the way in
normal way and its html view also.So cocoa provide any features to
this?Anybody can help me?

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]


glass effect - CG call to do this?

2008-05-15 Thread John Clayton

Hi

A few months ago, while browsing code headers at random (lets just  
call this a little passtime of mine), I noticed a method call that  
took an image and then added a glass effect to it.


I believe this was in the Core Graphics headers somewhere, but for the  
life of me can't find it now.


Does anyone know if this exists and where it might be? (don't tell me  
I was just dreaming).


Cheers,
--
John Clayton
http://www.coderage-software.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]


Maximize/Minimize other applications

2008-05-15 Thread Adil Saleem
Hi,

Is there any method in Cocoa (other than Apple Script)
to Maximiz/Minimize other applications ?

Thanx


  
___

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

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

2008-05-15 Thread Jean-Daniel Dupas

Icon\r is an invisible file that contains a custom directory icon.

What make you think this file is handle in different way ?
The terminal displays '\r' as ^M but it's not a problem. Isn't it?


Le 15 mai 08 à 12:17, JanakiRam a écrit :


Hi All,
I'm facing an issue with NSFileManger directoryContentsAtPath API.  
This
seems to be an wried issue. But its very important for me to fix.  
Please

help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@/Users/janakiram/Downloads/Folder.tiff];
int i , count = [filePath count];

for ( i = 0 ; i  count ; i++ ) {
NSLog(@ filepath  is (%@),[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/ 
Folder.tiff


Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M




JanakiRam.
___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Maximize/Minimize other applications

2008-05-15 Thread Jean-Daniel Dupas
You cannot minimize an Application. You can hide it, or you can  
minimize an application's window.


As it's said at least 4 times a week on this list, this is not  
possible to interact directly with other applications windows.


The two most common way to interact with an other application is  
AppleEvents and accessibility API.



Le 15 mai 08 à 13:01, Adil Saleem a écrit :


Hi,

Is there any method in Cocoa (other than Apple Script)
to Maximiz/Minimize other applications ?

Thanx



___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Core data model, bindings advice.

2008-05-15 Thread Steven Hamilton
Hmm, now I've done a bit more research (my heads puggled with it  
all ;) ) I believe none of those options are appropriate.


Taking a more basic look at the issue the solution appears quite  
simple. I have an entity that contains data. I have a table that needs  
to display that data in a slightly different manner. Therefore I need  
to change that data on the way to the table. So, I believe I need a  
custom datasource to pull (or fetch) from my Core Data entity and  
formulate the data into a new array. I then bind my tableview's array  
controller to this datasource. My datasource also has to work in the  
reverse direction and update the model with new data from the tableview.


Of course, its easy using pseudo speak to describe something. It's  
another actually making it happen.


On 14/05/2008, at 9:53 PM, Steven Huey wrote:


Steven,

On May 13, 2008, at 5:12 AM, Steven Hamilton wrote:

How would I best handle translating the data from the entity model  
to the view model? I see two options;


1) Munge around with Valuetransformers. If toAccount = selected  
account then credit = amount, debit = blank, opposite if  
fromAccount = selected account. I still have the add: issue.


I don't think this is the intended purpose of ValueTransformers.

3) Would a filter be more appropriate? Is it possible to filter the  
transaction list and use the account selection (from the tree view)  
in the filter predicate?


Take a look at NSPredicate. If you have your entities in an NSArray  
you should be able to filter that using an NSPredicate in memory  
very quickly. You could then use the results in your table view.



On 13/05/2008, at 12:27 AM, Steven Huey wrote:


Steven,

In my app I have a similar setup, although without the detail view.

I have the Table Column of my NSOutlineView bound to a  
NSTreeController using the Controller Key arrangedObjects and  
the Model Key Path set to the name of a method in the custom  
NSManagedObject subclass that my NSTreeController is managing.


The table columns of my NSTableView are bound to an  
NSArrayController whose content set is bound to my  
NSTreeController's selection. Each column is then bound to a  
property of the entity returned by the array controller's content.


I think you could bind your detail view similarly, to the current  
selection of your array controller.


Take a look at: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html 
 for lots of great examples of how to use bindings.


Best regards,
Steven Huey

--
Steven Huey Software - http://www.stevenhuey.com

On May 12, 2008, at 8:03 AM, Steven Hamilton wrote:


Hi folks,
Continuing my learning into Cocoa I'm developing a personal  
finance application. An admirable project I believe since none  
available suit my purposes and it always pays to have a project  
that one would use to learn from.


I have a simple core data model consisting of AccountGroup,  
Account, Transaction and I've jammied these all into a window  
with outline view, transaction tableview and detail at the  
bottom. The model looks like this;


AccountGroup (Asset, expense, income etc)name (string)
accounts (relationship to Account)Account (Bank, Savings etc)name  
(string)

transactions (fetched properties explained below)
credit (relationship to transaction)
debit (relationship to transaction)Transaction
memo (string)
date (date)
amount (NSNumber)
fromAccount (reverse of debit)
toAccount (reverse of credit)
I believe this to be the true model as a transaction is an object  
and is of an amount that goes from somewhere to somewhere. This  
is double entry accounting. My problem is in presenting this to  
the user.


Problem 1

Most finance apps, and mine included you select an account from a  
list (my outlineview) and it then displays all the transactions  
involved. So I created a fetched property with a predicate that  
included any transactions that had the selected account name in  
either fromAccount or toAccount. This works to a point. My  
tableview displays all the transactions of the selected account  
but since its a fetched properties (contentArray) the list isn't  
the true transaction array (contentSet), therefore I cannot add  
to it using the bound detail table below it.


I must admit the bindings for this are really playing with my  
head. I struggled quite immensely getting the selection from the  
treecontroller and in the end it started working without me fully  
understanding why. I have further complications to come as I have  
the decide whether the transaction amount is a debit or credit  
(based on the from/to account relationships) and then display the  
amount in the correct column and then also work out a way to add  
transactions back in like this.


It seems even though I'm set on what I believe to be the correct  
data model for this, the method of which a user expects to see  
this information is a little too different. Does anyone have any  
advice? Have I talked too much?


Re: Assertion failure in -[NSNextStepFrame lockFocus]

2008-05-15 Thread Apparao Mulpuri
Here is the complete stacktrace:

2008-05-15 15:58:53.730 MyCocoaApp[618:10b] *** Assertion failure in
-[NSNextStepFrame lockFocus],
/SourceCache/AppKit/AppKit-949.27/AppKit.subproj/NSView.m:4751
2008-05-15 15:58:53.737 MyCocoaApp[618:10b] NSExceptionHandler has
recorded the following exception:
NSInternalInconsistencyException -- -[NSNextStepFrame(0x146050)
lockFocus] failed with window=0x1457e0, windowNumber=230, [self
isHiddenOrHasHiddenAncestor]=0
Stack trace:  0x34dbc  0x9416676c  0x95df9e04  0x9112cde4  0x9569235c
0x956914c8  0x9568610c  0x956d0650  0x95809cdc  0x9587d248  0x956bb1fc
 0x47b4  0x9569f3bc  0x9573aabc  0x9573a7ec  0x9571bfac  0x92d58f6c
0x92d58104  0x92d750e4  0x92daafd4  0x92dd183c  0x92dd1728  0x92e239dc
 0x92e233b0  0x957f14a4  0x958257d4  0x95acfb74  0x95acf52c
0x9569da7c  0x9569c340  0x95792338  0x9566f79c  0x955dca6c  0x955ad448
 0x224c  0x1f50  0x1
NSExceptionHandlerExceptionRaiser (in ExceptionHandling)
objc_exception_throw (in libobjc.A.dylib)
+[NSException raise:format:] (in CoreFoundation)
-[NSAssertionHandler
handleFailureInMethod:object:file:lineNumber:description:] (in
Foundation)
-[NSView lockFocus] (in AppKit)
-[NSView _displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:]
(in AppKit)
-[NSWindow _setFrameCommon:display:stashSize:] (in AppKit)
-[NSMoveHelper _stopAnimation] (in AppKit)
-[NSMoveHelper _doAnimation] (in AppKit)
-[NSMoveHelper _resizeWindow:toFrame:display:] (in AppKit)
-[NSWindow setFrame:display:animate:] (in AppKit)
-[MyController changeGridType:] (in MyCocoaApp)
-[NSApplication sendAction:to:from:] (in AppKit)
-[NSMenu performActionForItemAtIndex:] (in AppKit)
-[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] (in AppKit)
AppKitMenuEventHandler (in AppKit)
DispatchEventToHandlers(EventTargetRec*, OpaqueEventRef*,
HandlerCallRec*) (in HIToolbox)
SendEventToEventTargetInternal(OpaqueEventRef*, OpaqueEventTargetRef*,
HandlerCallRec*) (in HIToolbox)
SendEventToEventTarget (in HIToolbox)
SendHICommandEvent(unsigned long, HICommand const*, unsigned long,
unsigned long, unsigned char, OpaqueEventTargetRef*,
OpaqueEventTargetRef*, OpaqueEventRef**) (in HIToolbox)
SendMenuItemSelectedEvent (in HIToolbox)
FinishMenuSelection(MenuData*, MenuData*, MenuResult*, MenuResult*,
unsigned long, unsigned long, unsigned long, unsigned char) (in
HIToolbox)
PopUpMenuSelectCore(MenuData*, Point, double, Point, unsigned short,
unsigned int, Rect const*, unsigned short, unsigned long, Rect const*,
Rect const*, __CFString const*, OpaqueMenuRef**, unsigned short*) (in
HIToolbox)
_HandlePopUpMenuSelection7 (in HIToolbox)
_NSPopUpCarbonMenu3 (in AppKit)
-[NSCarbonMenuImpl
popUpMenu:atLocation:width:forView:withSelectedItem:withFont:withFlags:withOptions:]
(in AppKit)
+[NSStatusBarButtonCell popupStatusBarMenu:inRect:ofView:withEvent:] (in AppKit)
-[NSStatusBarButtonCell trackMouse:inRect:ofView:untilMouseUp:] (in AppKit)
-[NSControl mouseDown:] (in AppKit)
-[NSWindow sendEvent:] (in AppKit)
-[NSStatusBarWindow sendEvent:] (in AppKit)
-[NSApplication sendEvent:] (in AppKit)
-[NSApplication run] (in AppKit)
NSApplicationMain (in AppKit)
_start (in MyCocoaApp)
start (in MyCocoaApp)


On Thu, May 15, 2008 at 2:54 PM, Apparao Mulpuri
[EMAIL PROTECTED] wrote:
 Here is the Stacktrace:

 2008-05-15 14:45:33.469 MyCocoaApp[554:10b] NSExceptionHandler has
 recorded the following exception:
 NSInternalInconsistencyException -- -[NSNextStepFrame(0x12e0d0)
 lockFocus] failed with window=0x145b30, windowNumber=340, [self
 isHiddenOrHasHiddenAncestor]=0
 Stack trace:  0x34dbc  0x9416676c  0x95df9e04  0x9112cde4  0x9569235c
 0x956914c8  0x955e5498  0x955e52f8  0x95d8b018  0x95d8c1c8  0x92d823a8
  0x92d82134  0x92d8200c  0x955e33c0  0x955e2d88  0x955dca44
 0x955ad448  0x251c  0x2220  0x1
 2008-05-15 14:45:33.470 MyCocoaApp[554:10b]
 -[NSNextStepFrame(0x12e0d0) lockFocus] failed with window=0x145b30,
 windowNumber=340, [self isHiddenOrHasHiddenAncestor]=0
 2008-05-15 14:45:33.508 MyCocoaApp[554:10b] *** Assertion failure in
 -[NSNextStepFrame lockFocus],
 /SourceCache/AppKit/AppKit-949.27/AppKit.subproj/NSView.m:4751


 On Thu, May 15, 2008 at 10:01 AM, Jens Alfke [EMAIL PROTECTED] wrote:

 On 14 May '08, at 9:17 PM, Apparao Mulpuri wrote:

 ** Assertion failure in -[NSNextStepFrame lockFocus],
 /SourceCache/AppKit/AppKit-949.27/AppKit.subproj/NSView.m:4751
 May 14 17:37:39 apparao-power-mac-g5 MyCocoaApp[123]:
 -[NSNextStepFrame(0x143610) lockFocus] failed with window=0x142e60,
 windowNumber=62, [self isHiddenOrHasHiddenAncestor]

 What's the backtrace?
 Set a breakpoint at objc_exception_throw to find out.

 —Jens

___

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

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

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

This 

Re: Problem with NSFileManger directoryContentsAtPath

2008-05-15 Thread Graham Cox

How do the two outputs differ from your expectations?

G.


On 15 May 2008, at 8:17 pm, JanakiRam wrote:


But its very important for me to fix. Please
help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.


___

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

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

2008-05-15 Thread Michael Vannorsdel
This has to do with non-printable characters in pathnames.  Each  
application can different how they visually represent these  
characters.  The terminal just replaces them with '?', the Finder  
might use a space.


When you have a path from NSFileManager, leave it as is in the  
NSString if you're going to pass it to other Foundation file manager  
APIs.  If you need a C string of the path for C APIs, you can use  
NSFileManager's fileSystemRepresentationWithPath: to get a properly  
encoded C string.  Also displayNameAtPath: can give you the proper  
representation for displaying the path to the user but may not work  
when passed to file system APIs.



On May 15, 2008, at 4:17 AM, JanakiRam wrote:

I'm facing an issue with NSFileManger directoryContentsAtPath API.  
This
seems to be an wried issue. But its very important for me to fix.  
Please

help me.

My application is trying to enumerate  the folders in inside a Mac
using NSFileManager  API. But for some files its failing.

It looks like the file name ( inside bundle ) is interpreted by  
Finder and
Terminal in a different ways. Can any one please suggest me a way to  
resolve

this issue.

Thanks in Advance

*Cocoa Code for your reference.*

NSFileManager *defaultManager = [NSFileManager defaultManager];
NSArray *filePath = [defaultManager directoryContentsAtPath:
@/Users/janakiram/Downloads/Folder.tiff];
int i , count = [filePath count];

for ( i = 0 ; i  count ; i++ ) {
NSLog(@ filepath  is (%@),[filePath objectAtIndex:i]);

}

*Output:*

[Session started at 2008-05-15 15:34:38 +0530.]
2008-05-15 15:34:38.951 FileEnumerator[4094:10b]  filepath  is (Icon
)

FileEnumerator has exited with status 0.

*Terminal View of Folder :*

Janakirams-iMac-G5:~ janakiram$ cd /Users/janakiram/Downloads/ 
Folder.tiff


Janakirams-iMac-G5:Folder.tiff janakiram$ ls -la
total 112
drwxr-xr-x@  3 janakiram  staff   102 May 15 15:36 .
drwx--+ 92 janakiram  staff  3128 May 15 15:17 ..
-rwxr-xr-x@  1 janakiram  staff 0 Aug  8  2006 Icon?

Janakirams-iMac-G5:Folder.tiff janakiram$ cp -R Icon^M


___

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

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

2008-05-15 Thread Mike Fischer

Am 15.05.2008 um 02:20 schrieb Jonathan Hess:

As for the original question, you can modify an IB file, to some  
extent, using ibtool --import and ibtool --export. For example, you  
might consider placing all of your views and objects in the XIB/ 
NIB, and then using these options to control the isHidden property  
of various views.


That's certainly the most interesting idea I've heard so far. So with  
this method I could in theory assemble different nibs into a single  
one at build time?



That won't be easy though, as it isn't an intended usage of ibtool.  
I think the best option here is to make the changes in code, and to  
only use on IB file.


I gather that IB is apparently not meant to allow for scripted build  
processes. It seems to be a purely graphical tool operated manually.  
For many purposes this is fine. But once you have a complex nib and  
want to make incremental changes or changes dependent on some build  
setting it becomes very complicated.


Even worse IMHO a nib can hide many rather important settings making  
it very hard to understand for someone who is not the original author  
for example. This makes nibs very fragile because small mistakes in  
say connecting things can lead to program errors that are hard to  
debug later on.




Good Luck -
Jon Hess



Yes thanks! I keep wondering though how companies that make large  
complicated apps in teams are coping with these limitations. I can't  
imagine building something like Photoshop using nibs for everything  
and working on a nib with more than one person. I'd guess one would  
use nibs for simple things and possibly building blocks and do  
everything else at run-time where what happens is clear and self  
documenting.



Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

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

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

2008-05-15 Thread Mike Fischer

Am 15.05.2008 um 01:10 schrieb Hamish Allan:

On Wed, May 14, 2008 at 11:25 PM, Mike Fischer  
[EMAIL PROTECTED] wrote:


(I know this can be hacked, and that while verbose it's only xml.  
But I'd

want my apps building in the next Xcode (sub-)release as well.)


Sure, well, you can't eat your cake and have it ;)


Too bad ;-)



I'd have thought that you could maybe try to automate Whenever any of
the parts of nib N1 and N2 change that are identical in both nibs I
have to remember to make the changes in both.


Well yes, it's possible. But I think one would have to be quite  
desperate to choose that path.




You can also use ibtool for verification, so I don't buy that
extremely dangerous stuff, and the bit about backwards compatibility
is irrelevant.


Well, looking at one of these beasts I'm so sure. There is a lot of  
stuff in there that is not obvious and baring heavy experimentation  
I'd guess that many things need to fit together even if they are in  
totally separate places. I could probably change the dimensions of a  
view or the title of a window. But anything more complicated would be  
a very ambitious undertaking. And I'm not even talking about the  
IBDocument.RunnableNib block of data at the end of the XIB.



Thanks for your thoughts though.

Mike
--
Mike Fischer Softwareentwicklung, EDV-Beratung
Schulung, Vertrieb
Web: http://homepage.mac.com/mike_fischer/index.html
Note: I read this list in digest mode!
  Send me a private copy for faster responses.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Basic info about outlets

2008-05-15 Thread John Love
I *think* I understand about outlets and actions .. but now I am not so
sure.

Specifically, if I set (NSWindow *)documentWindow as an Outlet in my main
nib and I declare in MyDocument.h file:

interface MyDocument:NSDocument {
  IBOutlet NSWindow *documentWindow;
}
...

- (void) someMethod:documentWindow;

and in MyDocument.m file:

- (void) someMethod {
  // some operation that accesses a property of documentWindow
}

Okay, documentWindow is typed as a outlet in the main nib and in the
interface,.h, file ... and I have control-dragged from the FileOwner to the
title bar of the Window, selecting documentWindow as the Outlet.  But,
just exactly HOW does the actual documentWindow object get passed so that
someMethod can look at one of its properties?

This question is oriented to behind the scenes.

Thanks in advance

John Love
___

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

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

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

This email sent to [EMAIL PROTECTED]


iPhone SDK List?

2008-05-15 Thread Rich Curtis
Been lurking on the list for a couple of days. Is there another list  
for iPhone SDK programmers?


Doesn't seem to be much of that in this list. Am I in the wrong place  
for that sort of stuff?


Thanks,

RC
___

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

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

2008-05-15 Thread Michael Vannorsdel
This block is probably causing some corruption.  You're assigning 123  
to a uchar pointer and not the uchar, then passing the address of a  
pointer to a method that tries to printout the pointer as an int  
rather than the intended uchar value.



On May 14, 2008, at 7:19 PM, Julius Guzy wrote:


- (void) callPrintConstUnsignedCharRef:(id)pId;
{
unsigned char * tvarUnsignedChar= 123;
[pId printUnsignedCharRef:tvarUnsignedChar];
}


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: iPhone SDK List?

2008-05-15 Thread Don Arnel
Unfortunately, no. The iPhone SDK is under NDA so it cannot be  
discussed at this time.


On May 15, 2008, at 7:39 AM, Rich Curtis wrote:

Been lurking on the list for a couple of days. Is there another list  
for iPhone SDK programmers?


Doesn't seem to be much of that in this list. Am I in the wrong  
place for that sort of stuff?


Thanks,

RC
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/dmarnel%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: iPhone SDK List?

2008-05-15 Thread Michael Vannorsdel
Currently NDA software from Apple is intended for you to quietly play  
with.  No public or private forum exists for discussion on this SDK.



On May 15, 2008, at 5:39 AM, Rich Curtis wrote:

Been lurking on the list for a couple of days. Is there another list  
for iPhone SDK programmers?


Doesn't seem to be much of that in this list. Am I in the wrong  
place for that sort of stuff?


___

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

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

2008-05-15 Thread Graham Cox

Yep, you're basically correct, sounds right to me.

When the nib is loaded, documentWindow will point to (refer to)  
the window object.


someMethod is able to simply use the variable documentWindow because  
that is an instance variable of the MyDocument object, and all methods  
of MyDocument are able to use the object's ivars as if they were  
locally declared. This is one of the main reasons that OOP is a useful  
way to program.


so someMethod could then message the window itself, for example:

- (void) someMethod
{
// set a property:

[documentWindow setTitle:@Arrggahh!!];

// read a property:

NSRect wFrame = [documentWindow frame];
}


If you're asking *how* this works, the answer lies in the Obj-C  
runtime. Basically all of an object's methods are implicitly passed a  
pointer to the object itself (self) as a hidden parameter to the  
function that the method is wrapping. The compiler thus generates code  
that makes use of this implicit parameter, so the real code is really  
doing the equivalent of:


void someMethod( NSDocument* self )
{
setTitle( self-documentWindow, @string );
}

underneath, it's all procedural ;-) (I'm simplifying, it's not  
literally quite like this, Find out more here: file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html) 
.


hth,


G.



On 15 May 2008, at 9:30 pm, John Love wrote:

I *think* I understand about outlets and actions .. but now I am not  
so

sure.

Specifically, if I set (NSWindow *)documentWindow as an Outlet in my  
main

nib and I declare in MyDocument.h file:

interface MyDocument:NSDocument {
 IBOutlet NSWindow *documentWindow;
}
...

- (void) someMethod:documentWindow;

and in MyDocument.m file:

- (void) someMethod {
 // some operation that accesses a property of documentWindow
}

Okay, documentWindow is typed as a outlet in the main nib and in the
interface,.h, file ... and I have control-dragged from the FileOwner  
to the
title bar of the Window, selecting documentWindow as the Outlet.   
But,
just exactly HOW does the actual documentWindow object get passed so  
that

someMethod can look at one of its properties?

This question is oriented to behind the scenes.

Thanks in advance

John Love
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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: Flash'In'App – Free Cocoa Framework

2008-05-15 Thread Julia Rixon
That's correct, all these things can be done with Flash'in'App. You can 
perform the following:

- disable contextual menu and replace it with your own menu
- send messages in Flash and receive return value, process functions 
invoked by flash movie and return result
- intercept all attempts of SWF file to load external resources and 
disable/permit those attempts. Or you can replace external resources.


--
Sincerely yours,

Julia Rixon


John Stiles wrote:
 There are a couple of gotchas... trying to disable the right-click 
menu is one issue (maybe you can subclass the view for this, I haven't 
tried), and having the Flash app send messages back to the main app is 
another problem.



 Julia Rixon wrote:
 Ferhat Ayaz wrote:
 Why don't load flash via WebKit ?

 Ferhat

 You can use WebKit for some purposes, but sometimes it doesn’t allow 
to implement all necessary features. For example there is no option to 
disable Flash Local Security. Many features are hard to implement 
using WebKit.




___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Setting NSObjectController's to file's owner

2008-05-15 Thread Chris Suter


On 15/05/2008, at 5:21 PM, André Pang wrote:

I have a nib file containing an NSObjectController.  The  
NSObjectController's content is set to the File's Owner proxy  
object, and this creates a retain cycle.  (The file's owner never  
gets deallocated because the object controller retains it, and the  
object controller never gets deallocated because the file's owner  
retains it as an IBOutlet.)


This is obviously a bad thing to do, but I always thought that it  
was good design for views and controls to be bound to an  
NSObjectController rather than the file's owner directly, since  
NSObjectController then takes care of all the NSEditor protocol  
stuff, you get auto-completion for model key names in Interface  
Builder, etc.  Is there a better method than what I'm doing?


I wouldn't set the content to file's owner. I think you should set the  
content to an object that's contained by the file's owner, i.e. make  
the file's owner a controller object that owns the NSObjectController  
and has a reference/owns the content object.


- Chris



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: iPhone SDK List?

2008-05-15 Thread Matt Gough
When the SDK comes out of NDA it would be nice if there were a  
separate list for iPhone related issues, otherwise I can imagine this  
list being swamped with postings that a lot of us here have no  
interest in (since we aren't developing iPhone apps). General  
questions about common APIs could remain here.


Matt


On 15 May 2008, at 13:39, Rich Curtis wrote:

Been lurking on the list for a couple of days. Is there another list  
for iPhone SDK programmers?


Doesn't seem to be much of that in this list. Am I in the wrong  
place for that sort of stuff?


___

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

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

2008-05-15 Thread Torsten Curdt
Hm ...I would have though the runtime would just do dependency/ 
reference injection.
And the procedural code has a (hidden) reference/parameter to the  
object instance - that would be self.


cheers
--
Torsten

On May 15, 2008, at 13:53, Graham Cox wrote:


Yep, you're basically correct, sounds right to me.

When the nib is loaded, documentWindow will point to (refer to)  
the window object.


someMethod is able to simply use the variable documentWindow  
because that is an instance variable of the MyDocument object, and  
all methods of MyDocument are able to use the object's ivars as if  
they were locally declared. This is one of the main reasons that OOP  
is a useful way to program.


so someMethod could then message the window itself, for example:

- (void) someMethod
{
   // set a property:

   [documentWindow setTitle:@Arrggahh!!];

   // read a property:

   NSRect wFrame = [documentWindow frame];
}


If you're asking *how* this works, the answer lies in the Obj-C  
runtime. Basically all of an object's methods are implicitly passed  
a pointer to the object itself (self) as a hidden parameter to the  
function that the method is wrapping. The compiler thus generates  
code that makes use of this implicit parameter, so the real code is  
really doing the equivalent of:


void someMethod( NSDocument* self )
{
   setTitle( self-documentWindow, @string );
}

underneath, it's all procedural ;-) (I'm simplifying, it's not  
literally quite like this, Find out more here: file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html) 
.


hth,


G.



On 15 May 2008, at 9:30 pm, John Love wrote:

I *think* I understand about outlets and actions .. but now I am  
not so

sure.

Specifically, if I set (NSWindow *)documentWindow as an Outlet in  
my main

nib and I declare in MyDocument.h file:

interface MyDocument:NSDocument {
IBOutlet NSWindow *documentWindow;
}
...

- (void) someMethod:documentWindow;

and in MyDocument.m file:

- (void) someMethod {
// some operation that accesses a property of documentWindow
}

Okay, documentWindow is typed as a outlet in the main nib and in the
interface,.h, file ... and I have control-dragged from the  
FileOwner to the
title bar of the Window, selecting documentWindow as the Outlet.   
But,
just exactly HOW does the actual documentWindow object get passed  
so that

someMethod can look at one of its properties?

This question is oriented to behind the scenes.

Thanks in advance

John Love
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/tcurdt%40vafer.org

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Basic info about outlets

2008-05-15 Thread Graham Cox

I did say I was simplifying. Write for the audience.

The procedural code doesn't have a hidden 'self', it's completely  
explicit:


id objc_msgSend(id theReceiver, SEL theSelector, ...);

G.

On 15 May 2008, at 11:21 pm, Torsten Curdt wrote:

Hm ...I would have though the runtime would just do dependency/ 
reference injection.
And the procedural code has a (hidden) reference/parameter to the  
object instance - that would be self.


___

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

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

2008-05-15 Thread Mike Abdullah

Furthermore, if you want to see it in action a little more:

If you create an object with an outlet like so:

IBOutlet NSWindow *window

and also give it methods like so:

- (NSWindow *)window;
- (void)setWindow:(NSWindow *)aWindow;

When loading the nib, rather than directly setting the instance  
variable, the system is kind enough to call the accessor method for  
you instead. So, you can stick a breakpoint on -setWindow: and watch  
it happen. There's no real magic, just variables getting hooked up.


Mike.

On 15 May 2008, at 14:21, Torsten Curdt wrote:

Hm ...I would have though the runtime would just do dependency/ 
reference injection.
And the procedural code has a (hidden) reference/parameter to the  
object instance - that would be self.


cheers
--
Torsten

On May 15, 2008, at 13:53, Graham Cox wrote:


Yep, you're basically correct, sounds right to me.

When the nib is loaded, documentWindow will point to (refer to)  
the window object.


someMethod is able to simply use the variable documentWindow  
because that is an instance variable of the MyDocument object, and  
all methods of MyDocument are able to use the object's ivars as if  
they were locally declared. This is one of the main reasons that  
OOP is a useful way to program.


so someMethod could then message the window itself, for example:

- (void) someMethod
{
  // set a property:

  [documentWindow setTitle:@Arrggahh!!];

  // read a property:

  NSRect wFrame = [documentWindow frame];
}


If you're asking *how* this works, the answer lies in the Obj-C  
runtime. Basically all of an object's methods are implicitly passed  
a pointer to the object itself (self) as a hidden parameter to the  
function that the method is wrapping. The compiler thus generates  
code that makes use of this implicit parameter, so the real code is  
really doing the equivalent of:


void someMethod( NSDocument* self )
{
  setTitle( self-documentWindow, @string );
}

underneath, it's all procedural ;-) (I'm simplifying, it's not  
literally quite like this, Find out more here: file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Reference/ObjCRuntimeRef/index.html) 
.


hth,


G.



On 15 May 2008, at 9:30 pm, John Love wrote:

I *think* I understand about outlets and actions .. but now I am  
not so

sure.

Specifically, if I set (NSWindow *)documentWindow as an Outlet in  
my main

nib and I declare in MyDocument.h file:

interface MyDocument:NSDocument {
   IBOutlet NSWindow *documentWindow;
}
...

- (void) someMethod:documentWindow;

and in MyDocument.m file:

- (void) someMethod {
   // some operation that accesses a property of documentWindow
}

Okay, documentWindow is typed as a outlet in the main nib and in the
interface,.h, file ... and I have control-dragged from the  
FileOwner to the
title bar of the Window, selecting documentWindow as the  
Outlet.  But,
just exactly HOW does the actual documentWindow object get passed  
so that

someMethod can look at one of its properties?

This question is oriented to behind the scenes.

Thanks in advance

John Love
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.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/tcurdt%40vafer.org

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


cocoa mentoring (was Re: Bypassing Interface Builder)

2008-05-15 Thread Torsten Curdt


On May 15, 2008, at 07:55, Uli Kusterer wrote:


Am 15.05.2008 um 00:53 schrieb colo:

Well. Huh. After reading all of that. I wish there was sorta mentor
program. Ah but where would be the fun in that. Any way thats off
topic.



There is a mentor program. It is called: 'Pay Scott Stevenson of http://treehouseideas.com 
 to mentor you'


Where?

There's probably other people that will teach you Cocoa and answer  
your questions, but Scott is the only one I've heard announce this  
publicly (http://bignerdranch.com/ comes to mind, though they're  
more into doing classes than one-on-one tutoring, though they  
obviously do the one-on-one stuff as part of their classes).


I have been thinking about BigNerdRanch. It would have been a great  
start   ...but I guess now I would be more interested in advanced  
topics.


Talking with an experienced Cocoa guy would probably help a lot. Which  
is why I am looking forward to WWDC. The CocoaHeads meetings also come  
to mind.


Unfortunately there are no CocoHeads meetings in Germany ...even  
continental Europe. So I was thinking about getting a CocoaHeads  
Frankfurt started - if people are interested and would show up.  
(Please drop me a mail off list. If I get more than 10 people  
confirmed I'll get that started.)


cheers
--
Torsten
___

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

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

2008-05-15 Thread Torsten Curdt


On May 15, 2008, at 15:32, Graham Cox wrote:


I did say I was simplifying. Write for the audience.


I know, I know ...just think of me as one of the guys asking a  
question after a presentation ;)


cheers
--
Torsten

___

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

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

2008-05-15 Thread Paul Bruneau

On May 15, 2008, at 9:36 AM, Torsten Curdt wrote:

I have been thinking about BigNerdRanch. It would have been a great  
start   ...but I guess now I would be more interested in advanced  
topics.


Although Big Nerd Ranch's Cocoa Bootcamp is great for people just  
starting in Cocoa, it does have sections on Bindings, Core Data,  
Applescript-enabling your app, custom views, and other advanced  
topics. I can tell you that your head is chock full when you leave. In  
my experience, even though I had already read Kochan's Obj-C book and  
Aaron's book before I went to his Boot Camp, the camp very much set  
in place the ideas of Cocoa in my head in a way that I can't imagine  
a book doing. It was an amazing week.

___

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

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

2008-05-15 Thread Erik Buck
  But, just exactly HOW does the actual documentWindow object get passed so that
someMethod can look at one of its properties?

This question is oriented to behind the scenes
   
  For the current version of Interface Builder, see 
  - (void)connectOutlet:(NSString 
*)outletofSourceObject:(id)sourcetoDestinationObject:(id)destination
   
  of the IBDocument class in the InterfaceBuilderKit framework.
   
  In the current version of Interface Builder, the precise mechanism for 
storing connection information is not documented and therefore considered an 
implementation detail.  However, in previous versions of Interface Builder, it 
worked like the following:
   
  There is/was a class called IBConnector which looked something like this
   
  @interface IBConnector : NSObject NSCoding
  {
 id  source;
 NSString   *outletName;
 id  destination;
  }
   
  - (void)setSource:(id)anObject;
  - (void)setOutletName:(NSString *)aName;
  - (void)setDestination:(id)anObject;
   
  - (void)connect;
   
  @end
   
  When you drag a connection in IB, a new instance of IBConnector is created, 
initialized with a source, outlet name, and destination accordingly, and 
archived into the .nib file.
   
  When the nib file is tested in IB or loaded into your application at 
run-time, the IBConnector instances are unarchived just like every other object 
in the nib.  Once unarchived, each IBConnector instance's source and 
destination instance variables are restored to a reference to the corresponding 
unarchived objects. [That is just how archiving and unarchiving graphs of 
objects works.  Read up on archiving for details].
   
  As part of the nib loading process but before -awakFromNib is sent to any 
objects unarchived from the nib, the connect message is sent to each unarchived 
IBConnection instance.
   
  The -connect method of IBConnector is implemented something like this
  - (void)connect
  {
 Ivar   ivar = class_getInstanceVariable([source class], [outletName 
UTF8String]);
 object_setIvar(source , ivar, destination);
  }  
   
  See 
http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/Reference/reference.html
 for information about class_getInstanceVariable() and object_setIvar(). The 
source code for the runtime is also available.
   
  Once the connections are all made, the IBConnector instances are no longer 
needed and may be deallocated.
   
  Then -awakeFromNib is called for every object unarchived from the nib and 
incidentally also the File's Owner object.  Because the connections were all 
restored before -awakeFromNib, it is safe to use the connections in your 
implementation of -awakeFromNib.
   
  Does that answer you behind the scenes question ?
___

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

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

2008-05-15 Thread Uli Kusterer


Am 15.05.2008 um 15:36 schrieb Torsten Curdt:



On May 15, 2008, at 07:55, Uli Kusterer wrote:


Am 15.05.2008 um 00:53 schrieb colo:

Well. Huh. After reading all of that. I wish there was sorta mentor
program. Ah but where would be the fun in that. Any way thats off
topic.



There is a mentor program. It is called: 'Pay Scott Stevenson of http://treehouseideas.com 
 to mentor you'


Where?


 At treehouseideas.com, as mentioned above?

Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

2008-05-15 Thread Graham Cox

That's interesting :)

And I think I answered the completely wrong question. duh.

G.


On 16 May 2008, at 12:08 am, Erik Buck wrote:

 But, just exactly HOW does the actual documentWindow object get  
passed so that

someMethod can look at one of its properties?

This question is oriented to behind the scenes

 For the current version of Interface Builder, see
 - (void)connectOutlet:(NSString *)outletofSourceObject: 
(id)sourcetoDestinationObject:(id)destination


 of the IBDocument class in the InterfaceBuilderKit framework.


___

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

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

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

This email sent to [EMAIL PROTECTED]


cocoaheads frankfurt (was Re: cocoa mentoring)

2008-05-15 Thread Torsten Curdt

People interested in such an event please drop me a comment here.

http://vafer.org/blog/20080515154119

cheers
--
Torsten
___

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

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

2008-05-15 Thread Torsten Curdt


On May 15, 2008, at 15:47, Paul Bruneau wrote:


On May 15, 2008, at 9:36 AM, Torsten Curdt wrote:

I have been thinking about BigNerdRanch. It would have been a great  
start   ...but I guess now I would be more interested in advanced  
topics.


Although Big Nerd Ranch's Cocoa Bootcamp is great for people just  
starting in Cocoa, it does have sections on Bindings, Core Data,  
Applescript-enabling your app, custom views, and other advanced  
topics.


Yeah ..but I have done all that already. At least basic examples. No  
need to build RaiseMan in class again.


I can tell you that your head is chock full when you leave. In my  
experience, even though I had already read Kochan's Obj-C book and  
Aaron's book before I went to his Boot Camp, the camp very much set  
in place the ideas of Cocoa in my head in a way that I can't  
imagine a book doing. It was an amazing week.


I bet it was! I mean I would love to go no matter what.
But if you pay for it from your pocket you really think twice (or  
even more) before spending that money ;)


cheers
--
Torsten

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Setting NSObjectController's to file's owner

2008-05-15 Thread André Pang

On 15/05/2008, at 5:21 PM, André Pang wrote:

I have a nib file containing an NSObjectController.  The  
NSObjectController's content is set to the File's Owner proxy  
object, and this creates a retain cycle.  (The file's owner never  
gets deallocated because the object controller retains it, and the  
object controller never gets deallocated because the file's owner  
retains it as an IBOutlet.)


Hmm, I just created a small test application to try to reproduce this  
problem and couldn't get the retain cycle to happen.  It's a dead- 
simple document-based Cocoa application with a single  
NSObjectController in the nib file, with a single text field binding  
that was bound through the object controller to an ivar in the file's  
owner.


However, now the weird thing is that I call -[objectController  
release] in the file's owner -dealloc (which I guess should be the  
correct behaviour, since the object controller is declared as an  
IBOutlet and is a top-level nib file object), I get into an infinite  
release cycle loop.  Test program here, for those willing to lend a  
hand:


  http://algorithm.com.au/tmp/NSObjectControllerRetainCycleTest.zip

Am I completely misunderstanding memory management of bindings/nib  
files objects?


One more note: in the application where I was having this retain cycle  
problem, I deleted the content outlet from the object controller in  
the .nib file, and instead set it programmatically via - 
setContent:self in the document's -awakeFromNib, balanced by a - 
setContent:nil in the document's -close method.  That fixed it, which  
strongly implied that there was a retain cycle with the object  
controller and the file's owner object (the NSDocument subclass).  I'm  
very puzzled.


Cheers,
Andre.


--
% Andre Pang : trust.in.love.to.save  http://www.algorithm.com.au/





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Getting help...

2008-05-15 Thread john darnell
Okay, okay, this probably is off-topic, but I just spent fifteen minutes
at the Apple site trying to figure out how to get the needed help
without success, so at the risk of fiery flames shooting my way and
verbal attacks the likes of which would make H.L. Mencken proud, I am
going to ask my question anyway.

I am attempting to look up information on Cocoa commands, in this
particular instance, NSAlert.  When I get to the screen that lists all
the parameters that are associated with NSAlert, they look like this:

- (void) beginSheetModalForWindow:(NSWindow *) ykpfqy  //the gibberish
is italicized

This is constant throughout the help files.  Most times I can figure out
what the gibberish should represent, but not always.  Does anyone know
why my Help articles are appearing like this, and more importantly, how
do I fix it? 

BTW, someone suggested that I might need to update Safari, so I did
that, and it had no effect.

TIA!

R, 
John A.M. Darnell 
Team Leader 
Walsworth Publishing Company 
Brookfield, MO 
John may also be reached at [EMAIL PROTECTED] 
  
Trivia Question:  In SciFi Channel's hit series, FARSCAPE, who played
the voice of Pilot?


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Guidance for Cocoa's steep learning curve

2008-05-15 Thread Jens Alfke


On 14 May '08, at 10:16 PM, David Wilson wrote:

3) Instance methods (with the -) are virtual functions. Class  
methods (with the +) are static functions.


Class methods aren't exactly like static functions, because they're  
still dynamically dispatched and can be overridden by subclasses.


A closer analogy is to think of there being a singleton class object  
for every class (which is what -class returns), and the class methods  
are instance methods of those class objects. The class objects have an  
inheritance hierarchy that parallels the class hierarchy, so if B is a  
subclass of A, B's class object will be a subclas of A's class object.


(For more detail, look up metaclass; I'm sure there's an abstruse  
Wikipedia article about it. The concept goes back to Smalltalk-80, on  
which Objective-C's runtime model and syntax were based.)


—Jens

PS: In regards to the thread subject, I didn't find Cocoa to have a  
steep learning curve. I took a training class and was amazed at how  
easy it was to learn, and to build sophisticated apps with, compared  
to every other GUI API or framework I'd used.

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Getting help...

2008-05-15 Thread I. Savant
 - (void) beginSheetModalForWindow:(NSWindow *) ykpfqy  //the gibberish
 is italicized

 This is constant throughout the help files.  Most times I can figure out
 what the gibberish should represent, but not always.  Does anyone know
 why my Help articles are appearing like this, and more importantly, how
 do I fix it?

  You might try reinstalling XCode Tools ... but this question is more
suited to the xcode-users list.

--
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: Efficient XML loading [continuation of NSString from mapped NSData thread]

2008-05-15 Thread Jens Alfke


On 15 May '08, at 1:36 AM, Jean-Daniel Dupas wrote:

I'm using AE to query large info set from iTunes and don't get any  
performance issues. But you have to learn how to use AE.


Agreed. (Disclosure: I worked on AppleScript 1.0 and 1.1, and on some  
of the underlying AppleEvent infrastructure.)



get names of all tracks (using one single AE) is pretty fast.


Yup; most of the performance issues come down to how many round-trips  
you need. In some cases the application's handling of events is slow,  
too. Sophisticated AppleEvents with where... clauses are effectively  
database queries, but most applications implement them via linear  
search. I've constructed single-event commands to iTunes that take a  
minute or more to return a result, with iTunes chewing up 100% of the  
CPU the whole time.


It depends what you need. If this it just to get a list a name, it  
will do the trick, if you want to query more info, you may have to  
choose an other path.


I was basing my statements on what it would take to get all or most of  
the info in the XML file, which is basically all available metadata  
for every single track and playlist; i.e. everything but the album  
covers.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: [NSImageView setImage:nil] clarification

2008-05-15 Thread Jens Alfke


On 15 May '08, at 3:37 AM, [EMAIL PROTECTED] wrote:


It isn't explicitly mentioning anywhere, but is:

[someImageView setImage:nil];

the correct way to have an empty image view.


Yes. Basically, all content-displaying views let the content object be  
nil.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Assertion failure in -[NSNextStepFrame lockFocus]

2008-05-15 Thread Jens Alfke


On 15 May '08, at 2:24 AM, Apparao Mulpuri wrote:


Here is the Stacktrace:


The binary backtrace is hard to decipher (and it has to be deciphered  
on the same computer, or at least one with the exact same system  
version and frameworks.) Instead follow my directions about setting a  
breakpoint.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Assertion failure in -[NSNextStepFrame lockFocus]

2008-05-15 Thread Jens Alfke


On 15 May '08, at 3:41 AM, Apparao Mulpuri wrote:


Here is the complete stacktrace:


Thanks. This looks like a pretty normal backtrace (up until the  
exception), with only minimal involvement of your code, so it does  
seem like an AppKit bug. You should file a bug report, definitely  
including the backtrace, ideally including your program.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Bypassing Interface Builder

2008-05-15 Thread Andy Lee

On May 14, 2008, at 10:33 PM, Johnny Lundy wrote:
So it's the application instance. I don't understand what the  
application instance is. I can recite the documentation, which says  
it is a shared instance of NSApplication, also known as NSApp which  
is a global variable, none of which help me.


To me this indicates a very fundamental disconnect, because what you  
recited explains NSApp perfectly.  I can't tell where the disconnect  
is, so I'll try to spell this out quickly.  No offense intended here  
-- I honestly don't know where the disconnect is.


You are writing a Cocoa application.  There is a class called  
NSApplication that represents the concept of a Cocoa application.   
That's the purpose of a class in an object-oriented language, to  
describe a *class* of things conceptually.  Classes are usually named  
for the thing they describe -- hence NSApplication.  NSApplication  
handles the generic things that Cocoa applications do: managing the  
main menu, managing the window list, dealing with mouse and keyboard  
events, and so on.


Cocoa applications create objects (instances of classes).  That's what  
they do all day.  Objects get created, they send messages to each  
other, they get dealloc'ed.  Thousands and thousands of objects, all  
day long.  In your application there is one special object that is an  
instance of NSApplication.  It represents the application itself.  I  
repeat: there is an object in your application that represents the  
running application itself.  There is only one such object, and it is  
stored in a global variable called NSApp.  That is what application  
instance means.



Why would someone bind to File's Owner? What specifically is it?


Unlike most other objects in a nib file (First Responder being the  
exception), File's Owner is not a specific object.  It is a  
placeholder for an owner object that will be specified when the nib  
file is loaded.  You edit a nib file knowing that it will be loaded at  
some point in your program, and *at that future time* the owner of the  
file (hence File's Owner) will be specified.


The file's owner gives your program access to the objects in the nib  
file, through the connections you made to it in the nib.


I think newcomers sometimes assume that when you load a nib you get  
some sort of NibObject that you can query to get at the objects in the  
nib, perhaps using the name you assigned in the nib file.  This is an  
understandable assumption, but you don't get any such object.  You  
need to specify a file's owner for the nib (using the second argument  
to +loadNibNamed:owner:), and you need to have constructed the nib so  
it connects the file's owner to at least one of its objects.


--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: Getting help...

2008-05-15 Thread Chris Woods

john darnell wrote:


- (void) beginSheetModalForWindow:(NSWindow *) ykpfqy  //the gibberish
is italicized


For what it's worth, I experienced this yesterday when I was looking at the 
docs in Firefox on a Windows machine.


Looking now with Firefox and Safari on my Mac, the docs all look correct.


--
  Chris Woods   AIM: gnarrlybob   MSN: [EMAIL PROTECTED]
  [EMAIL PROTECTED]  Y!: cjwoodsGTalk: [EMAIL PROTECTED]
  http://bitspace.org/   ICQ: 21740987Skype: bitspace.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: Guidance for Cocoa's steep learning curve

2008-05-15 Thread Scott Ribe
 if you've spent a lot of time abusing void * to
 hack runtime dynamism into C++

Or if you've done it the right way, with templates--was more what I was
thinking...

1-5 are all very good points. Much of what's been said here belongs in an
intro document somewhere...

-- 
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: Guidance for Cocoa's steep learning curve

2008-05-15 Thread colo
Lets add to this fun madness. Nice simple clean tutorials like this
http://cocoadevcentral.com/d/learn_objectivec/

Could cocoa parts in the frame work be summed up like that as well?
How many examples or paragraphs and or pages of text does it take to
finally drill down the Cocoa method into your head? Where do you reach
Gestalt and can sum up how these commands are typed onto the page in
Xcode and they just work?

I get messages and oop [Sender Dosomething] or in Ruby
@sender.dosomething. OOP was easy for me as thats how I already
thought code would be like. Of course I am still learning but I fail
to see why Cocoa syntax could be any different than Ruby. I'll test
Macruby when 1.9 comes out, but reading Cocoa is like bash my head
into needless [] : @ syntax every which way.

Ack, back to books to many emails to read.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Assertion failure in -[NSNextStepFrame lockFocus]

2008-05-15 Thread Kyle Sluder
On Thu, May 15, 2008 at 11:10 AM, Jens Alfke [EMAIL PROTECTED] wrote:
 Thanks. This looks like a pretty normal backtrace (up until the exception),
 with only minimal involvement of your code, so it does seem like an AppKit
 bug. You should file a bug report, definitely including the backtrace,
 ideally including your program.

And do this regardless of whether or not you think anyone else has
done so already.  If your bug gets marked as a dup, so be it; it lets
the engineers know that this issue is affecting multiple users.

--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: Anybody using Pantomime or mail-core framework?

2008-05-15 Thread Matt Burnett

Its not hard to enable HTTP authentication.

On May 13, 2008, at 1:07 AM, Jens Alfke wrote:



On 12 May '08, at 10:57 PM, Omar Qazi wrote:

I have an app that sends emails, and what I did is have it post the  
message parameters to my server. Then, a PHP page processes the  
parameters and sends mail using  PHP.


Cool! What's the address of your PHP script? I have a couple million  
V**gr* ads I need to send untraceably... ;-)


No, what I meant to say was, this seems like the sort of thing that  
could be exploited by spammers, and get you blacklisted from your  
hosting site, so watch out.


—Jens___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.w.burnett%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: Guidance for Cocoa's steep learning curve

2008-05-15 Thread Uli Kusterer

Am 15.05.2008 um 03:19 schrieb Erik Buck:
2) Learn C and at least learn to recognize low level operations like  
bit manipulation, pointers, intrinsic types, pointers to pointers,  
pointers to functions, etc.  Without this, you will be lost and  
dangerous when writing Cocoa programs in Objective-C.



 Let me take this opportunity to once again shamelessly plug my C  
tutorial:


http://masters-of-the-void.com

which covers most of this (it doesn't cover pointers to functions and  
bitwise operations), especially memory management and pointers.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Password entry dialog

2008-05-15 Thread Ron Aldrich

Hello Folks,

I'm trying to figure out where the API for the system's password entry  
dialog is defined.


In particular, I'm interested in using the dialog which is used by  
Disk Utility (i.e. diskimages-helper) to enter passwords.


Is there a public API for password entry dialogs? Or should I just  
roll my own?


Thanks,

Ron Aldrich
Software Architects, Inc.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Setting NSObjectController's to file's owner

2008-05-15 Thread Michael Babin


On May 15, 2008, at 9:53 AM, André Pang wrote:

Hmm, I just created a small test application to try to reproduce  
this problem and couldn't get the retain cycle to happen.  It's a  
dead-simple document-based Cocoa application with a single  
NSObjectController in the nib file, with a single text field binding  
that was bound through the object controller to an ivar in the  
file's owner.


However, now the weird thing is that I call -[objectController  
release] in the file's owner -dealloc (which I guess should be the  
correct behaviour, since the object controller is declared as an  
IBOutlet and is a top-level nib file object), I get into an infinite  
release cycle loop.  Test program here, for those willing to lend  
a hand:


 http://algorithm.com.au/tmp/NSObjectControllerRetainCycleTest.zip

Am I completely misunderstanding memory management of bindings/nib  
files objects?


In the small test application, you added the NSObjectController to the  
document's nib file (MyDocument.xib). As MyDocument is a descendant of  
NSDocument and you did not override -[NSDocument  
makeWindowControllers], the default implementation creates an  
NSWindowController with the windowNibName and MyDocument as the file's  
owner.


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSDocument_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDocument/makeWindowControllers 



Since the created NSWindowController actually loads the nib, it is  
responsible for (and performs) freeing all top-level objects in the  
nib file. Doing so yourself in MyDocument's dealloc method is  
unnecessary and leads to an over-release problem, as you have  
discovered.


See: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWindowController_Class/Reference/Reference.html#//apple_ref/doc/c_ref/NSWindowController 
, Overview.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Guidance for Cocoa's steep learning curve

2008-05-15 Thread colo
  Let me take this opportunity to once again shamelessly plug my C tutorial:

http://masters-of-the-void.com

 which covers most of this (it doesn't cover pointers to functions and
 bitwise operations), especially memory management and pointers.


Shameless plug but oh so nice of a Tut. 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]


Re: Password entry dialog

2008-05-15 Thread Michael Vannorsdel
Look at the Security framework and functions like  
AuthorizationExecuteWithPrivileges.



On May 14, 2008, at 6:12 PM, Ron Aldrich wrote:


Hello Folks,

I'm trying to figure out where the API for the system's password  
entry dialog is defined.


In particular, I'm interested in using the dialog which is used by  
Disk Utility (i.e. diskimages-helper) to enter passwords.


Is there a public API for password entry dialogs? Or should I just  
roll my own?

___

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

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

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

This email sent to [EMAIL PROTECTED]


RE: Getting help...

2008-05-15 Thread john darnell
I have a feeling that it may tie into Unicode interpretation of
characters, but that's just a guess on my part...

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On
Behalf Of Chris Woods
Sent: Thursday, May 15, 2008 10:12 AM
To: cocoa-dev@lists.apple.com
Subject: Re: Getting help...

john darnell wrote:

 - (void) beginSheetModalForWindow:(NSWindow *) ykpfqy  //the gibberish
 is italicized

For what it's worth, I experienced this yesterday when I was looking at
the 
docs in Firefox on a Windows machine.

Looking now with Firefox and Safari on my Mac, the docs all look
correct.


-- 
   Chris Woods   AIM: gnarrlybob   MSN: [EMAIL PROTECTED]
   [EMAIL PROTECTED]  Y!: cjwoodsGTalk: [EMAIL PROTECTED]
   http://bitspace.org/   ICQ: 21740987Skype: bitspace.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/john.darnell%40walswort
h.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]


Cocoa Programming for Mac OS X 3rd ed Shipping?

2008-05-15 Thread colo
Oh look at that. http://theocacao.com/document.page/571
Says amazon is shipping, but a call to Borders tells me it will be
first of June.
Sooo Should I order from Amazon? Is it really out? Or a sanfoo?
___

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

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

2008-05-15 Thread glenn andreas


On May 14, 2008, at 7:12 PM, Ron Aldrich wrote:


Hello Folks,

I'm trying to figure out where the API for the system's password  
entry dialog is defined.


In particular, I'm interested in using the dialog which is used by  
Disk Utility (i.e. diskimages-helper) to enter passwords.


Is there a public API for password entry dialogs? Or should I just  
roll my own?



What are you trying to do?

If you just need a dialog with a password field, NSSecureTextField is  
your friend (say, for example, to send over a secure channel on the  
network to log in to your network based service).


If you want to have that dialog that authenticates the user to allow  
them to perform tasks as root (or some other elevated privilege), you  
don't show that dialog - the authentication mechanism handles it.   
Look at AuthorizationExecuteWithPrivileges and friends.


Under no circumstances should you try to roll your own well, lets ask  
for the root password using our own dialog, and then pass it to an  
NSTask invoking sudo with the dangerous thing that mortals aren't  
suppose to do.





Glenn Andreas  [EMAIL PROTECTED]
 http://www.gandreas.com/ wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



___

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

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

2008-05-15 Thread Jean-Daniel Dupas

All security related API are in the Security Framework(s).

You do not have control of what to user enter in this dialog, its main  
purpose is to create some rights and return them to you if the user  
is allow to use them.


Usually this dialog is automatically displayed when you query some  
authorizaton. The cocoa way to do this is to use the SFAuthorization  
class from SecurityFoundation framework.


What do you want to do exactly with this dialog ?



Le 15 mai 08 à 02:12, Ron Aldrich a écrit :


Hello Folks,

I'm trying to figure out where the API for the system's password  
entry dialog is defined.


In particular, I'm interested in using the dialog which is used by  
Disk Utility (i.e. diskimages-helper) to enter passwords.


Is there a public API for password entry dialogs? Or should I just  
roll my own?


Thanks,

Ron Aldrich
Software Architects, Inc.

___

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

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

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

This email sent to [EMAIL PROTECTED]



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Password entry dialog

2008-05-15 Thread Jack Repenning


On May 14, 2008, at 5:12 PM, Ron Aldrich wrote:

Is there a public API for password entry dialogs? Or should I just  
roll my own?


Perhaps NSSecureTextField would be what you want.



-==-
Jack Repenning
[EMAIL PROTECTED]
Project Owner
SCPlugin
http://scplugin.tigris.org
Subversion for the rest of OS X


___

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

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

2008-05-15 Thread Johnny Lundy


On May 15, 2008, at 5:26 AM, [EMAIL PROTECTED] wrote:


Message: 6
Date: Thu, 15 May 2008 08:15:41 +0200
From: Uli Kusterer [EMAIL PROTECTED]
Subject: Re: Bypassing Interface Builder
To: Johnny Lundy [EMAIL PROTECTED]
Cc: cocoa-dev@lists.apple.com
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes

Am 15.05.2008 um 02:15 schrieb Johnny Lundy:



 This may seem backwards, but since every NSObject implements
setValue:forKey: already to look up the instance variable with the
same name as the key and assign it the given value, this actually
means that your instance variables will all be set up with pointers to
the loaded objects by the time your awakeFromNib method is called.
I.e. you don't have to write that huge function, you just drag from
outlets to objects in IB while you're already dragging and clicking to
create your GUI.

 The object names, as far as I'm aware, are actually only there to
help you navigate the objects in a NIB at design time.



OK - I really don't need the name then, but I am puzzled as to how my  
new class got instantiated. Here's what I did:


1. Create the class, the .h and .m files.
2. Code the ivars, their @property directives, and their @synthesize  
directives.
3. Write 2 instance methods plus the -init method. There are no class  
methods, and no IBOutlets.

4. Write an -init method that doesn't instantiate anything.
5. There is no +initialize method, as I don't understand it. When I  
have tried to use it, it complains I can't refer to ivars.

6. Compile.
7. In IB, make an NSTextField and read in my class header file.
8. In IB, drag out an NSObject and give it the class name of my new  
class. I did NOT control-drag anything to anything, and there are no  
IBOutlets in my code.


Somehow, doing the above steps must have created an instance of my  
class, as one instance method can call another. I  know that dragging  
out the NSObject made an instance, but my class does not know about  
it. So how come the instance methods in my class work? How can the  
property that I bound to an NSTextField work if there is no instance  
of my class to hold the property?


Strangely enough, the hard APIs like NSURLConnection were easy for  
me, and worked the first time, because the documentation was extensive  
and said exactly what the API parameters were for. Not so for  
trivially simple things like instantiating an object, or even worse,  
explaining what all the myriad of popups and checkboxes in an IB  
Bindings pane do. The tool tips are a complete joke - all they do is  
repeat the label of the item.


There needs to be an actual reference manual, one page per item on  
these checkboxes and popups, to explain them. I know the engineers who  
wrote the code behind them understand it, so it is not magic - and  
shouldn't require massive trial and error of every binding and every  
controller property to get something to work. These things are not  
difficult - they are just *not documented*.


Amazon shipped my copy of Aaron's Third Edition yesterday, so I'll be  
devouring that as soon as it arrives.




Say I drag out an object and set its class to MyClass. IB dutifully
names the object MyClass also. So in my code if I code [MyClass
somemessage], does that message go to the Class Object or to the
instance made in IB? If to the Class Object, how do I code to refer
to the instance?


 That object goes to the instance. You dragged out an *object*, an
instance, so that's what you get. I expected that, myself, so never
got confused by the name being the class name, but I can see how one
could be.



But [MyClass somemessage] tries to message the class, and I get a  
Class MyClass may not respond to somemessage, which makes sense  
since there is no class method somemessage.




Also, I found out that IB will not let me make 2 instances of the
same Class. In code, I could say myClassInstance1 = [MyClass new];
and MyClassInstance2 = [MyClass new];, but apparently not in IB.


 You can make two instances of a class in the same NIB by dragging
out two Objects from the palette and seting their custom class. But as
you now know, the names are only for designing, and don't really have
any use outside that.



It won't let me set the class for the second Object. I can type it in,  
but on hitting Tab or Return or clicking out of the field, the text I  
entered disappears and it gets replaced with a dimmed NSObject. I  
thought it was a glitch in IB, but I discovered that it only does that  
if you try and set more than one IB object to the same class.



This has been a mystery to me for six years now.

Also, the documentation only says about File's Owner that it is the
object that loaded the nib file. What is that object, if my nib file
just gets loaded at application launch?


 Well, the MainMenu.nib, the main NIB file, gets loaded by the single
NSApplication object in your application, so that's the File's Owner
in that case. In other NIBs, 

Re: Create NSStrings from a mapped NSData object - safe?

2008-05-15 Thread Dennis Munsie
It doesn't move the file -- it removes the entry for it in the
directory.  Once the reference count for it go to 0, then it gets
removed from the filesystem -- i.e, it's space on the filesystem
gets marked as being available.

dennis

On Wed, May 14, 2008 at 11:05 AM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
 At least on HFS+ volume, if one process uses a file, rm does not remove it
 but move it somewhere nobody can find it until it is no longer used (there
 is some folder that cannot be access using path on HFS volumes). Then it is
 deleted.
___

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

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

2008-05-15 Thread Yann Disser
Thank you all for your help. I managed to fix the problem by going  
over your suggestions.


The problem was that I access a file (without proper error-handling; I  
will add that now :-)). The default working directory is the main- 
bundle path when run from within XCode and it is / when run from  
Finder.


I repaired this by adding
[[NSFileManager defaultManager] changeCurrentDirectoryPath:
[[[NSBundle mainBundle] bundlePath]  
stringByDeletingLastPathComponent]];

to my awakeFromNib. I hope this works as I intend.

Yann
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 Programming for Mac OS X 3rd ed Shipping?

2008-05-15 Thread colo
I have my finger on the one day shipping button.
The Orileys Safari is painful on the eyes due to crapy jpg scan.


On Thu, May 15, 2008 at 12:35 PM, Joseph Heck [EMAIL PROTECTED] wrote:
 My copy just shipped from Amazon - I should have it in about 6 days. What's
 a week worth to you? Seems about the difference.

 -joe

 On May 15, 2008, at 9:29 AM, colo wrote:

 Oh look at that. http://theocacao.com/document.page/571
 Says amazon is shipping, but a call to Borders tells me it will be
 first of June.
 Sooo Should I order from Amazon? Is it really out? Or a sanfoo?
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Launching Cocoa Application externally

2008-05-15 Thread Jean-Daniel Dupas


Le 15 mai 08 à 18:42, Yann Disser a écrit :

Thank you all for your help. I managed to fix the problem by going  
over your suggestions.


The problem was that I access a file (without proper error-handling;  
I will add that now :-)). The default working directory is the main- 
bundle path when run from within XCode and it is / when run from  
Finder.


I repaired this by adding
[[NSFileManager defaultManager] changeCurrentDirectoryPath:
[[[NSBundle mainBundle] bundlePath]  
stringByDeletingLastPathComponent]];

to my awakeFromNib. I hope this works as I intend.

Yann


I hope your are not trying to access some bundle resources using a  
relative path? To access resources into a bundle you should always use  
NSBundle methods, it will avoid you this kind of problem.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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 Programming for Mac OS X 3rd ed Shipping?

2008-05-15 Thread Brad Carter
 Mine shipped two days ago from the Amazon.com preorder.

-Brad
On Thursday, May 15, 2008, at 10:30AM, colo [EMAIL PROTECTED] wrote:
Oh look at that. http://theocacao.com/document.page/571
Says amazon is shipping, but a call to Borders tells me it will be
first of June.
Sooo Should I order from Amazon? Is it really out? Or a sanfoo?
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


iPhone: Question about keyboard / drawing

2008-05-15 Thread Stuart Carnie
If I want to implement my own keyboard, I'd like it to behave similarly to
the built-in iPhone keyboard.  Specifically, when a key receives a 'touch'
it pops out above the key, so the user can see it.  As I understand, the
UIKeyboard class is derived from UIView.  When you touch one of the keys on
the top row, it pops out outside the bounds of the UIView - how would I go
about doing this 'correctly'?
Cheers,

Stuart

-- 
Stuart Carnie
___

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

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

2008-05-15 Thread Sherm Pendley
On Thu, May 15, 2008 at 12:42 PM, Yann Disser [EMAIL PROTECTED] wrote:

 Thank you all for your help. I managed to fix the problem by going over
 your suggestions.

 The problem was that I access a file (without proper error-handling; I will
 add that now :-)). The default working directory is the main-bundle path
 when run from within XCode and it is / when run from Finder.

 I repaired this by adding
 [[NSFileManager defaultManager] changeCurrentDirectoryPath:
[[[NSBundle mainBundle] bundlePath] stringByDeletingLastPathComponent]];
 to my awakeFromNib. I hope this works as I intend.


You shouldn't rely on the current working directory. Just use the call to
-bundlePath (or one of NSBundles many other methods for finding paths to
different bundle internals) to create a fully-qualified path to the file you
want to open.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.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]


Re: iPhone: Question about keyboard / drawing

2008-05-15 Thread I. Savant
On Thu, May 15, 2008 at 12:52 PM, Stuart Carnie [EMAIL PROTECTED] wrote:
 If I want to implement my own keyboard, I'd like it to behave similarly to
 the built-in iPhone keyboard.  Specifically, when a key receives a 'touch'
 it pops out above the key, so the user can see it.  As I understand, the
 UIKeyboard class is derived from UIView.  When you touch one of the keys on
 the top row, it pops out outside the bounds of the UIView - how would I go
 about doing this 'correctly'?

http://www.cocoabuilder.com/archive/message/cocoa/2008/5/7/206059
http://www.cocoabuilder.com/archive/message/cocoa/2008/3/7/200686
http://www.cocoabuilder.com/archive/message/cocoa/2008/3/6/200645
http://www.cocoabuilder.com/archive/message/cocoa/2008/5/10/206307
http://www.cocoabuilder.com/archive/message/cocoa/2008/4/10/203800
  ... and many, MANY more ...

--
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: Cocoa Programming for Mac OS X 3rd ed Shipping?

2008-05-15 Thread colo
heh. I caved, I might see it tomorrow if it does not lie.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Subject: Re: Bypassing Interface Builder

2008-05-15 Thread Erik Buck
 OK - I really don't need the name then, but I am puzzled as to 
   how my new class got instantiated. Here's what I did:

 1. Create the class, the .h and .m files.
  Great.  This is how Objective-C classes are generally created.  Good job.
  
 2. Code the ivars, their @property directives, and their
   @synthesize directives.
  So far so good.  The @property directives expose properties to Interface 
Builder in much the same way IBOutlet exposed instance variables.  Interface 
Builder will parse your header files and extract the property information.
  
 3. Write 2 instance methods plus the -init method. There are no
   class methods, and no IBOutlets.
  Fine.  -init is usually a good name for a designated initializer.  You will 
need to understand the concept of a designated initializer if you write 
non-trivial classes.  IBOutlets are never required.  Interface Builder is able 
to use @property too.
  
 4. Write an -init method that doesn't instantiate anything.
  What do you mean ?  Do you understand Cocoa's convention of two stage 
instance creation using a variant of +alloc and a variant of -init ?  Have you 
written any Objective-C code at all before ?  I recommend that you write a few 
simple command line Objective-C programs so you understand basics of the 
language and conventions of the frameworks.
  
 5. There is no +initialize method, as I don't understand it.
   When I have tried to use it, it complains I can't refer to 
   ivars.
  +  initialize is a CLASS method.  You can tell by the '+' instead of the '-' 
used to declare instance methods.  You should learn the difference between 
class methods and instance methods.  This is a basic concept of Objective-C.  
Apple's on-line Objective-C manual should help you.
  
 6. Compile.
  If you pass this step you are doing well based on the nature of your 
questions.
  
 7. In IB, make an NSTextField and read in my class header file.
  These are two unrelated steps.  Also, the current Interface Builder does not 
require you to explicitly read in a header file.  Are you sure you did that ?
  
 8. In IB, drag out an NSObject and give it the class name of my
   new class. I did NOT control-drag anything to anything, and
   there are no IBOutlets in my code.
  Dragging any object from a palette (what does IB call palettes these days?) 
instantiates (creates an instance) of some object.  Interface Builder calls 
[[SOMECLASS alloc] init]  just like you would in your own source code.  The 
value of SOMECLASS depends on which object/icon you drag in IB.  If you drag a 
text field, there is a good chance the value of SOMECLASS will be NSTextField.
   
  Note: You can also instantiate any object by selecting a class in the class 
browser and using a menu item to instantiate it.
   
  When you instantiate any object, an actual instance of the appropriate class 
is created right then LIVE in Interface Builder.  All of those settings in 
Interface Builder send messages to the LIVE object in exactly the same way you 
would send the messages via code.
   
  The LIVE objects are archived to create a nib file.  The nib file contains an 
interconnected graph of archived objects.  When a nib file is loaded into your 
application or into test interface mode of Interface Builder, the LIVE objects 
are reconstituted from the archive complete with all of their state and 
interconnections from when they were archived.
   
  When you change the class of an instantiated object (for example when you 
changes an NSObject instance into an instance of you subclass of NSObject), 
Interface Builder stores the class name you specified into the nib file along 
with the archived object.  When the object is unarchived into your application 
or into test interface mode, the normal Cocoa NSUnarchiver behavior allows 
class substitution.  If possible, the unarchived instance created by IB is 
replaced by an instance of the class you specified.  Your custom subclass of 
NSObject is not linked into Interface Builder so it will not work in test 
interface mode.  However, your subclass is linked into your application, so 
when the nib is unarchived, the NSObject instance in the nib is replaced by an 
instance of your class including all of the property bindings and other 
connections if you made any.
   
  Try working through some simple tutorials.
   
___

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

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

2008-05-15 Thread Dennis Munsie
I really don't understand why you wouldn't pay for it out of your
pocket, as long as it would further a goal of yours -- i.e, if you
want to work somewhere doing Cocoa or you want to finally write that
great shareware app in Cocoa, you should look at it as an investment.

Now, I understand that if you don't have the money that you can't do
it -- but if you have the money and the desire and the goals, what's
holding you back?

dennis

On Thu, May 15, 2008 at 10:51 AM, Torsten Curdt [EMAIL PROTECTED] wrote:
 I bet it was! I mean I would love to go no matter what.
 But if you pay for it from your pocket you really think twice (or even
 more) before spending that money ;)
___

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

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

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

This email sent to [EMAIL PROTECTED]


ButtonCell with Text in OutlineView

2008-05-15 Thread David
I'm trying to have a hierarchical set of choices with a checkbox next to
each one. How can I best set this up?
My current thinking was to try and create a NSButtonCell subclass which
would act like a NSTextCell in that setting its value would set its title,
but I'd parse the string which is encoded with a flag to indicate if the
button is selected or not.

I have NSTreeController bound to my model and the column in NSOutlineView
bound to the appropriate key path in NSTreeController.

I do not understand how the column in the NSOutlineView knows how to set the
property to the cell. How are the cell and column related? How do they
interact?

What method do I need to implement in my cell to intercept the value being
set so that I can in turn set the title and button state?

Is this the best approach? Is there some other preferred approach to this
common problem?

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: iPhone: Question about keyboard / drawing

2008-05-15 Thread Hank Heijink (Mailinglists)
I don't know how many times this has already come up: until the NDA is  
lifted, you can't ask questions about the iPhone SDK on this list.


On May 15, 2008, at 12:52 PM, Stuart Carnie wrote:

If I want to implement my own keyboard, I'd like it to behave  
similarly to
the built-in iPhone keyboard.  Specifically, when a key receives a  
'touch'
it pops out above the key, so the user can see it.  As I understand,  
the
UIKeyboard class is derived from UIView.  When you touch one of the  
keys on
the top row, it pops out outside the bounds of the UIView - how  
would I go

about doing this 'correctly'?
Cheers,

Stuart

--
Stuart Carnie
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/hank.list 
%40runbox.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: Subject: Re: Bypassing Interface Builder

2008-05-15 Thread Jeff LaMarche


On May 15, 2008, at 1:23 PM, Erik Buck wrote:

 Dragging any object from a palette (what does IB call palettes  
these days?) i


It's called the Library...
___

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

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

2008-05-15 Thread Carsten
While we are on the topic, is anyone aware of anything related in
Berlin, Germany? If not, is there anyone around who would be
interested in occasional meetings?

Carsten Whimster


2008/5/15 Torsten Curdt [EMAIL PROTECTED]:

 On May 15, 2008, at 07:55, Uli Kusterer wrote:

 Am 15.05.2008 um 00:53 schrieb colo:

 Well. Huh. After reading all of that. I wish there was sorta mentor
 program. Ah but where would be the fun in that. Any way thats off
 topic.


 There is a mentor program. It is called: 'Pay Scott Stevenson of
 http://treehouseideas.com to mentor you'

 Where?

 There's probably other people that will teach you Cocoa and answer your
 questions, but Scott is the only one I've heard announce this publicly
 (http://bignerdranch.com/ comes to mind, though they're more into doing
 classes than one-on-one tutoring, though they obviously do the one-on-one
 stuff as part of their classes).

 I have been thinking about BigNerdRanch. It would have been a great start
 ...but I guess now I would be more interested in advanced topics.

 Talking with an experienced Cocoa guy would probably help a lot. Which is
 why I am looking forward to WWDC. The CocoaHeads meetings also come to mind.

 Unfortunately there are no CocoHeads meetings in Germany ...even continental
 Europe. So I was thinking about getting a CocoaHeads Frankfurt started - if
 people are interested and would show up. (Please drop me a mail off list. If
 I get more than 10 people confirmed I'll get that started.)

 cheers
 --
 Torsten
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Bypassing Interface Builder

2008-05-15 Thread Paul Sargent


On 15 May 2008, at 17:40, Johnny Lundy wrote:




but I am puzzled as to how my new class got instantiated. Here's  
what I did:


1. Create the class, the .h and .m files.
2. Code the ivars, their @property directives, and their @synthesize  
directives.
3. Write 2 instance methods plus the -init method. There are no  
class methods, and no IBOutlets.

4. Write an -init method that doesn't instantiate anything.
5. There is no +initialize method, as I don't understand it. When I  
have tried to use it, it complains I can't refer to ivars.

6. Compile.
7. In IB, make an NSTextField and read in my class header file.
8. In IB, drag out an NSObject and give it the class name of my new  
class. I did NOT control-drag anything to anything, and there are no  
IBOutlets in my code.


Somehow, doing the above steps must have created an instance of my  
class, as one instance method can call another. I  know that  
dragging out the NSObject made an instance, but my class does not  
know about it. So how come the instance methods in my class work?  
How can the property that I bound to an NSTextField work if there is  
no instance of my class to hold the property?


I think you're confusing yourself (or others are), and you're tying  
yourself up in knots.


You placed the NSObject in the NIB, you gave it a class name of your  
class. What you're saying when you do that is When this NIB is  
loaded, create an instance of my class. It's an NSObject you drag  
because NSObject is the super class of all other classes. i.e. your  
class is-a NSObject.


But [MyClass somemessage] tries to message the class, and I get a  
Class MyClass may not respond to somemessage, which makes sense  
since there is no class method somemessage.


You're right. [MyClass somemessage] sends a message to the class  
object, not an instance of the class. For that to work you'd need to  
have +(void) somemessage; defined in MyClass. (Notice the '+' meaning  
class method, as opposed to '-' meaning instance method).


Class methods cannot access instance variables (ivars) because there  
is no instance associated with the call to contains the variables.  
(There might be hundreds of instances of a class in the system, which  
one contains the ivar I want to access) This is why you get the issues  
with +initalize() not being allowed to access ivars. It's a class  
method.


It won't let me set the class for the second Object. I can type it  
in, but on hitting Tab or Return or clicking out of the field, the  
text I entered disappears and it gets replaced with a dimmed  
NSObject. I thought it was a glitch in IB, but I discovered that  
it only does that if you try and set more than one IB object to the  
same class.


This shouldn't be the case, and suggests you're not doing things quite  
right.


Make sure you are setting the class by editing the Class Identity  
field in the Identity inspector, rather than just changing the name.


I just tried to do this in a new project and succeeded. Here's what I  
did:


1. Started a Cocoa Application Project
2. With 'New File' I added a Objective-C Class called MyClass. I left  
it empty, except I gave it an init method.


- (id) init
{
self = [super init];
if (self != nil) {
NSLog(@Initialized MyClass);
}
return self;
}

3. Opened the NIB and dragged an NSObject into play. I then set the  
class of the Object to MyClass.

4. Added a second MyClass instance in exactly the same way.
5. Saved, build, run, and look at the console.

You'll see that two messages are present, as two instances were  
created. and init is always the first message sent to a new instance.



Right. I can understand that, that the owner is the shared  
application instance. But why do people bind nib objects to File's  
Owner?


You're right, in this case the Files Owner is the shared NSApplication  
instance. That's not always true, because NIBs can be loaded by any  
class, but NSApplication is always the owner of the first NIB loaded.


People connect to file's owner to allow the owner to access the  
objects in the NIB. (I use connect rather than bind to avoid  
confusion. Bindings are something different in cocoa-speak)


A common practice is to connect an object to the delegate outlet of  
the NSApplication instance. This allows the NSApplication to send  
messages to your code a predetermined key times. For example, when the  
user selects quit from the menu, the object linked to the delegate  
outlet of the NSApplication will be sent a message to confirm if the  
application should terminate, by sending it the aptly named  
applicationShouldTerminate message. These messages are detailed in the  
NSApplication docs under delegate methods.


If that link wasn't made the NSApplication wouldn't know where to send  
the message. There are no magic connections made between objects  
instantiated by the NIB, and those that are instantiated some other  
way. File's Owner tends to be the gateway between 

Re: html

2008-05-15 Thread Douglas Davidson


On May 15, 2008, at 3:56 AM, [EMAIL PROTECTED] wrote:

I'm using xcode3.0 and objective c.Is there any way to generate html  
from

the plain test or images?Actualy i've to send mail in both the way in
normal way and its html view also.So cocoa provide any features to
this?Anybody can help me?


NSAttributedString has methods defined in AppKit (in the AppKit/ 
NSAttributedString.h header) that will read and write a variety of  
file formats, including HTML and XHTML.  There are also options that  
provide a high degree of control over the tags that will be used in  
the generated HTML.  Take a look at the source to TextEdit for examples.


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: cocoa mentoring - Berlin, Germany

2008-05-15 Thread Carsten
While we are on the topic, is anyone aware of anything related in
Berlin, Germany? If not, is there anyone around who would be
interested in occasional meetings?

Carsten Whimster


2008/5/15 Torsten Curdt [EMAIL PROTECTED]:

 On May 15, 2008, at 07:55, Uli Kusterer wrote:

 Am 15.05.2008 um 00:53 schrieb colo:

 Well. Huh. After reading all of that. I wish there was sorta mentor
 program. Ah but where would be the fun in that. Any way thats off
 topic.


 There is a mentor program. It is called: 'Pay Scott Stevenson of
 http://treehouseideas.com to mentor you'

 Where?

 There's probably other people that will teach you Cocoa and answer your
 questions, but Scott is the only one I've heard announce this publicly
 (http://bignerdranch.com/ comes to mind, though they're more into doing
 classes than one-on-one tutoring, though they obviously do the one-on-one
 stuff as part of their classes).

 I have been thinking about BigNerdRanch. It would have been a great start
 ...but I guess now I would be more interested in advanced topics.

 Talking with an experienced Cocoa guy would probably help a lot. Which is
 why I am looking forward to WWDC. The CocoaHeads meetings also come to mind.

 Unfortunately there are no CocoHeads meetings in Germany ...even continental
 Europe. So I was thinking about getting a CocoaHeads Frankfurt started - if
 people are interested and would show up. (Please drop me a mail off list. If
 I get more than 10 people confirmed I'll get that started.)

 cheers
 --
 Torsten
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Using NSThreads in command-line apps

2008-05-15 Thread ben syverson

Hi all,

I have a bit of a dilemma. I'm working on a Foundation-based command- 
line utility that needs to manage a few threads. The obvious choice is  
NSThread, since it's nice and clean.


Actually, I'm able to spawn new threads perfectly well. The problem is  
that I can't (?) use performSelectorOnMainThread: because I'm not an  
NSApplication, and so I don't get the default main thread that loops  
for user input...


Am I busted? I would like to be able to run this app without the  
window server running (ie, in Single User Mode), because it's server  
software.


I can always fall back to POSIX threads, but I'd rather use NSThread  
if possible. Is there an alternate way to have my spawned NSThreads  
call back to a controller thread (that doesn't require 10.5)?


Thanks!

- ben

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Launching Cocoa Application externally

2008-05-15 Thread Jens Alfke


On 15 May '08, at 9:42 AM, Yann Disser wrote:

The problem was that I access a file (without proper error-handling;  
I will add that now :-)). The default working directory is the main- 
bundle path when run from within XCode and it is / when run from  
Finder.


I repaired this by adding
[[NSFileManager defaultManager] changeCurrentDirectoryPath:
[[[NSBundle mainBundle] bundlePath]  
stringByDeletingLastPathComponent]];

to my awakeFromNib. I hope this works as I intend.



That will work, although if any other -awakeFromNib method (of an  
object in that nib) wants to use a relative path, you have a race  
condition, because the order in which -awakeFromNib methods are called  
is, basically, random.


But it's better to just avoid using relative paths, if possible. If  
you're accessing a file inside your bundle, you should use the  
NSBundle resource APIs to get its location.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

[MODERATOR] Re: iPhone: Question about keyboard / drawing

2008-05-15 Thread Scott Anguish

ONCE AGAIN.

Discussion of this technology is NOT appropriate here.

Doing so can cause you to be moderated, banned from the list entirely,  
or other actions taken.


Please respect the policy that NO NDA discussion of any sort should  
take place here.



Scott

Moderator


On May 15, 2008, at 12:52 PM, Stuart Carnie wrote:

If I want to implement my own keyboard, I'd like it to behave  
similarly to
the built-in iPhone keyboard.  Specifically, when a key receives a  
'touch'
it pops out above the key, so the user can see it.  As I understand,  
the
UIKeyboard class is derived from UIView.  When you touch one of the  
keys on
the top row, it pops out outside the bounds of the UIView - how  
would I go

about doing this 'correctly'?
Cheers,


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Using NSThreads in command-line apps

2008-05-15 Thread Bill Bumgarner

On May 15, 2008, at 11:42 AM, ben syverson wrote:
Actually, I'm able to spawn new threads perfectly well. The problem  
is that I can't (?) use performSelectorOnMainThread: because I'm not  
an NSApplication, and so I don't get the default main thread that  
loops for user input...


Am I busted? I would like to be able to run this app without the  
window server running (ie, in Single User Mode), because it's server  
software.


I can always fall back to POSIX threads, but I'd rather use NSThread  
if possible. Is there an alternate way to have my spawned NSThreads  
call back to a controller thread (that doesn't require 10.5)?


Run an NSRunLoop on your main thread.   That'll support - 
performSelectorOnMainThread:.


b.bum

___

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

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

2008-05-15 Thread Uli Kusterer


Am 15.05.2008 um 18:40 schrieb Johnny Lundy:

1. Create the class, the .h and .m files.
2. Code the ivars, their @property directives, and their @synthesize  
directives.


3. Write 2 instance methods plus the -init method. There are no  
class methods, and no IBOutlets.



 Just like you'd do without NIBs, yes.


4. Write an -init method that doesn't instantiate anything.


 Well, init gets called when your object is instantiated, it doesn't  
instantiate the object itself. Of course, init can instantiate *other*  
objects that your object needs, like an NSTextField would probably  
instantiate an NSMutableString object to hold whatever text it's  
supposed to display.


5. There is no +initialize method, as I don't understand it. When I  
have tried to use it, it complains I can't refer to ivars.


 +initialize is a class method, hence the +. It is kind of a  
constructor for the class (as opposed to the -init methods that get  
called on objects. This was one of the harder parts in Objective C, to  
teach oneself to read + to mean class method and - to mean object/ 
instance method.



6. Compile.
7. In IB, make an NSTextField and read in my class header file.


 Not related, and as others have said, IB3 reads your classes  
automagically as soon as you save them.


8. In IB, drag out an NSObject and give it the class name of my new  
class. I did NOT control-drag anything to anything, and there are no  
IBOutlets in my code.


 If that is all you did, then an object of your class was never  
instantiated. The only thing you got was an NSObject. The least you'll  
have to do is go to the identity pane of the inspector for this  
instance and type the name of your class into the custom class field.


Somehow, doing the above steps must have created an instance of my  
class, as one instance method can call another.


 What do you mean by 'one instance method can call another' ? Who is  
calling whom, how? If you just created this object, and nobody else  
has an outlet pointing to it, then while it was instantiated, nobody  
can call a method on it, because nobody has a pointer to it. Someone  
needs to have an outlet or a binding to it to call a method on it (or  
if your object has an action, then it'll probably pass a pointer to  
itself as the sender of that action, so whoever is the target could  
send a message back then, etc. etc.)


I  know that dragging out the NSObject made an instance, but my  
class does not know about it.


 What? How? Who? I'm not following you here. When you drag an  
NSObject from the palette, you essentially tell IB to call alloc and  
init on that icon's custom class (or on a generic NSObject if you  
don't specify a custom class). That is how your object gets  
instantiated: NSNibLoading calls alloc to get a block of memory the  
size of your object, and your init method then sets that block of  
memory up in the appropriate way.


So how come the instance methods in my class work? How can the  
property that I bound to an NSTextField work if there is no instance  
of my class to hold the property?


 Well, the object you drag out is the instance. Though if it's just  
an NSObject, you'll probably find your console full of error messages  
that the binding to that property can't be established, because  
NSObject doesn't have these properties.


Strangely enough, the hard APIs like NSURLConnection were easy for  
me, and worked the first time, because the documentation was  
extensive and said exactly what the API parameters were for. Not so  
for trivially simple things like instantiating an object, or even  
worse, explaining what all the myriad of popups and checkboxes in an  
IB Bindings pane do. The tool tips are a complete joke - all they do  
is repeat the label of the item.


 Actually, they've been very helpful to me today. But it depends on  
what tool tips you look at.


 And don't feel disheartened: Bindings, as the documentation states,  
are an advanced topic. It's OK if you start out with properties,  
connections and target/action, and write the rest of the code yourself  
for now. Once you feel familiar with that, go back to bindings. Once  
you are intimately familiar with what manual work is involved in a  
Cocoa application, you'll realize how bindings can save you work there  
because they replace this or that piece of code you had to hand-write  
before. You'll essentially know what bindings do under the hood.



That object goes to the instance. You dragged out an *object*, an
instance, so that's what you get. I expected that, myself, so never
got confused by the name being the class name, but I can see how one
could be.

But [MyClass somemessage] tries to message the class, and I get a  
Class MyClass may not respond to somemessage, which makes sense  
since there is no class method somemessage.


 Yes, if you specify the class name as the target, then the message  
will go to the class. If you want to message an actual instance, i.e.  
an 

Re: Launching Cocoa Application externally

2008-05-15 Thread Douglas Davidson


On May 15, 2008, at 11:45 AM, Jens Alfke wrote:

The problem was that I access a file (without proper error- 
handling; I will add that now :-)). The default working directory  
is the main-bundle path when run from within XCode and it is /  
when run from Finder.


I repaired this by adding
[[NSFileManager defaultManager] changeCurrentDirectoryPath:
   [[[NSBundle mainBundle] bundlePath]  
stringByDeletingLastPathComponent]];

to my awakeFromNib. I hope this works as I intend.



That will work, although if any other -awakeFromNib method (of an  
object in that nib) wants to use a relative path, you have a race  
condition, because the order in which -awakeFromNib methods are  
called is, basically, random.


But it's better to just avoid using relative paths, if possible. If  
you're accessing a file inside your bundle, you should use the  
NSBundle resource APIs to get its location.


Let me echo what Jens said.  The cwd is for command-line tools; don't  
use it, or anything that relies on it, in an application context, if  
you can do anything to avoid it.


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: Query with PDF Page display in PDFview

2008-05-15 Thread John Calhoun

On May 15, 2008, at 3:07 AM, Amrit Majumdar wrote:

With the PDFView we can display upto two pages in a row.
I need to display more than two PDF pages in a row.

An earlier post pointed me to the fact that the PDFThumbnailView can  
be used

for the same.

But the catch is PDFThumbnailView doesn't help me acheive all my
requirements.


What are your requirements?

You may, I think, have to write your own PDFView.  This is not as hard  
as it seems though (depending on how much functionailty you want).   
PDFVew itself is just using the other classes in PDF Kit (like PDFPage  
for rendering, PDFSelection for selecting text, etc.).


John Calhoun—___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Using NSThreads in command-line apps

2008-05-15 Thread Randall Meadows

On May 15, 2008, at 12:42 PM, ben syverson wrote:

I have a bit of a dilemma. I'm working on a Foundation-based command- 
line utility that needs to manage a few threads. The obvious choice  
is NSThread, since it's nice and clean.


Actually, I'm able to spawn new threads perfectly well. The problem  
is that I can't (?) use performSelectorOnMainThread: because I'm not  
an NSApplication, and so I don't get the default main thread that  
loops for user input...


Am I busted? I would like to be able to run this app without the  
window server running (ie, in Single User Mode), because it's server  
software.


I can always fall back to POSIX threads, but I'd rather use NSThread  
if possible. Is there an alternate way to have my spawned NSThreads  
call back to a controller thread (that doesn't require 10.5)?


Can't you cache the main thread [NSThread +currentThread] when you  
start up, and then use NSObject's - 
performSelector:onThread:withObject:waitUntilDone: 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: Using NSThreads in command-line apps

2008-05-15 Thread Jens Alfke


On 15 May '08, at 11:42 AM, ben syverson wrote:

Actually, I'm able to spawn new threads perfectly well. The problem  
is that I can't (?) use performSelectorOnMainThread: because I'm not  
an NSApplication, and so I don't get the default main thread that  
loops for user input...


You don't need an NSApplication; all you need is an NSRunLoop on the  
main thread.


To get one, you should structure your main thread's code like
... initialization ...
[[NSRunLoop currentRunLoop] run];
... teardown ...

The runloop call will cause the thread to block and repeatedly wait  
for and then handle events, until there are no more runloop sources.  
Runloop sources are things like NSTimers and the various - 
performSelector... utilities declared in NSRunLoop and NSThread  
(after delay, on main thread, etc.)


If you know exactly when to quit and don't want to deal with removing  
all runloop sources, you can just call exit(0) at the point where you  
want to exit (after any necessary cleanup.)


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Using NSThreads in command-line apps

2008-05-15 Thread ben syverson

On May 15, 2008, at 1:47 PM, Bill Bumgarner wrote:
Run an NSRunLoop on your main thread.   That'll support - 
performSelectorOnMainThread:.


Okay -- interesting. One follow-up question... my core loop is  
basically:


while(_running) {
// do stuff
}

I don't want to listen to any input, and I want the loop to execute as  
fast as possible. However, NSRunLoop says I need to set a timer or an  
input...


- ben

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Guidance for Cocoa's steep learning curve

2008-05-15 Thread Stefan Werner


On May 14, 2008, at 8:33 PM, Scott Ribe wrote:


=== If you are primarily an experienced C++ programmer (In my
experience you will have the hardest time)



(2) I will have to personally disagree with this.


I wonder, seriously, if it doesn't depend somewhat on whether or not  
you're

a really good C++ programmer...


I think it depends on whether you actually used C++ for what it is or  
just as C with 'class' instead of 'struct' and // comments.


At least from my point of view, I didn't feel at all like C++  
knowledge was in the way or that I had to 'unlearn' things. If you've  
used a decent OO UI toolkit, STL and BOOST before and read the gang  
of four book then there's not that much new in Objective-C/Cocoa IMHO.


-Stefan
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using NSThreads in command-line apps

2008-05-15 Thread ben syverson

On May 15, 2008, at 1:49 PM, Randall Meadows wrote:

Can't you cache the main thread [NSThread +currentThread] when you  
start up, and then use NSObject's - 
performSelector:onThread:withObject:waitUntilDone: method?


Yes, that would be ideal! Unfortunately that method is 10.5 only...

- ben

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Using NSThreads in command-line apps

2008-05-15 Thread Bill Bumgarner

On May 15, 2008, at 12:16 PM, ben syverson wrote:

On May 15, 2008, at 1:47 PM, Bill Bumgarner wrote:
Run an NSRunLoop on your main thread.   That'll support - 
performSelectorOnMainThread:.


Okay -- interesting. One follow-up question... my core loop is  
basically:


while(_running) {
// do stuff
}

I don't want to listen to any input, and I want the loop to execute  
as fast as possible. However, NSRunLoop says I need to set a timer  
or an input...


Your main thread loop?

If that is the design you want to use, then you can use NSLock --  
NSConditionLock, typically -- to do the synchronization between  
threads.   If your loop really is running flat out, then using a  
condition lock will be marginally faster.


b.bum

___

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

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