Re: CoreData fetched property: one-to-one-to-many relationship

2008-08-04 Thread Negm-Awad Amin


Am Mo,04.08.2008 um 00:19 schrieb James Gregurich:



thanks for the response. Adding the property is straight forward.  
The key parts that are not clear to me are:


1) how exactly do you set up a predicate to walk an extra entity to  
get to the target entity.

Loook at the documentation of NSPredicate
You do not "set the target entity" as a preidate. A predicate is  
something liike a pattern, i.e. "color = blue". This can apply to the  
entity cars and to to the entity jeans.


The fetch request gets the entity, to whom the predicate is applied.

2) how do you specify the destination entity. pass it to  
[NSFetchRequest setEntity:] and pass that fetch request to  
[NSFetchedPropertyDescription setFetchRequest:]? I would assume in  
my example that my destination entity is the story.
NSEntityDescrition* entity = [NSEntityDescription  
entiityForName:@"story" inManagedObjectContext:/*you know*/];


Cheers





-James Gregurich
Engineering Manager
Markzware


On Aug 3, 2008, at 10:37 AM, Omar Qazi wrote:

Create an NSFetechedPropertyDescription by setting up a fetch  
request in code, then add the property using the setProperties  
method of NSEntityDescription. It is only possible to edit an  
NSEntityDescription if you are not associated with a persistent  
store coordinator, so be careful. You might want to just add a  
custom method to the class of your Core Data model to execute the  
fetch request and get the job done.


Omar Qazi
Hello, Galaxy!
1.310.294.1593

On Aug 3, 2008, at 9:49 AM, James Gregurich wrote:


greetings!


I'm trying to figure out how to dynamically (in code) set up a  
fetched property with a Coredata in-memory store. The  
documentation is not detailed enough for me to quite see what the  
correct way to set the code up is and I'm not finding much in the  
way of useful sample code when searching on  
NSFetchedPropertyDescription.


What is the correct way to programmatically add a fetched property  
to the box  to get the list of stories for a given box managed  
object?




thanks,
James Gregurich
Engineering Manager
Markzware




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Restarting an app -- AppleScript 'launch' in a detached shell

2008-08-04 Thread Andrew Farmer

On 03 Aug 08, at 23:15, Steve Cronin wrote:
OK for the sake of the group I will parade my ignorance so that  
perhaps others can learn too...


First I do understand your point that using AppleScript is using an  
unnecessary high-level tool when a lower-level tool will do!
Thanks for keeping me on-point there!!  Good old-school unix  
thinking - always a good thing.


Do note Michael Ash's email noting that exec'ing a GUI app is  
generally to be avoided. Just because it's the most straightforward  
approach (to me, at least) doesn't mean it's correct. :)



I have 4 questions
1) Given that it is higher-level than necessary, I would still  
appreciate understanding why it doesn't work.
I revamped the '&' and added it to the end of the osaxscript command  
instead of passing as argument -> no change..


The & is only interpreted by shells, as part of a command line entered  
into them (either on standard input, or through a shell script).  
Passing an ampersand as an argument acts as though you entered  
"&" (with quotes) as an argument - at best, it might be treated as a  
file called &. Passing this as an argument to a shell is no exception,  
either. It's only when it's part of a command being interpreted by the  
shell that it gains any special meaning.


2) In the script you cited, I don't understand the 'if(fork() ||  
fork())' conditional test.  Can you clarify this statement?


Keep in mind that fork() is called once and returns twice - once in  
the parent process, where it returns the PID of the child process, and  
once in the child process, where it returns 0.


As such, if(fork() || fork()) exit(0); behaves as follows:

FIRST PROCESS:
  * calls the first fork(), creating SECOND PROCESS
  * ... gets PID of SECOND PROCESS back, which evaluates as true
  * short-circuits the second fork() and runs exit(0)

SECOND PROCESS:
  * ... gets 0 back from first fork()
  * doesn't fall through, and calls the second fork()
  * ... gets pid of THIRD PROCESS back, which again evaluates as  
true, etc


THIRD PROCESS:
  * ... gets 0 back from second fork()
  * both fork()s returned 0 on this path, so it continues merrily on  
its way!


The crux of this trick is the way it uses boolean short-circuiting: if  
the first clause of a boolean OR statement (x || y) is true, the  
second one isn't even evaluated, as the answer will be true either  
way. Similarly, if the first clause of an AND statement is false, the  
second one isn't evaluated.




3) Why are you using 'execl' and not 'exec'?


There's actually no straight exec() function - there's just a bunch of  
variants like execv, execl, execlp, and a few others. They all funnel  
into the execve() syscall, so I picked execl because it's easier to  
work with than many of the others. :) (All of the members of the  
execv* family require you to construct an array of arguments, whereas  
the execl* family lets you simply pass multiple arguments to the  
function.)


4) When you say "...launch this with a single argument..."  I' not  
sure of exactly what you mean.  Launch how?


I tried creating a text file with your script as the contents  
(Restart.unixscript)


I don't believe I said anything of the sort. The "script" I gave you  
was a short C program that'd act as a helper - it definitely won't run  
as a shell script. (No, not even in csh... heh.) You'd have to compile  
it, then run it as a task with a single argument.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread Jean-Daniel Dupas


Le 4 août 08 à 06:06, Dave DeLong a écrit :


And having experimented with this myself, AppleScript can be
horrendously slow if you need to get information on more than about 50
tracks.


I do not agree with this. I just try the following script and I  
managed to get more than 4500 tracks name in less than a second.


tell application "iTunes" to get name of tracks of the current playlist



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread Gregory Weston

Kyle Sluder wrote:


4) Parse the iTunes Library XML files.

#4 is unsupported, but also the only way to get access to the iTunes
library when iTunes isn't running.  The approach you take is dictated
by your functional requirements.


I was under the impression the primary reason the XML file existed  
was so other software could interact with iTunes' library in a safe  
and reliable manner (as opposed to the binary file).

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread Mike Abdullah

You can also check out our iMedia Browser at http://code.google.com/p/imedia/

On 4 Aug 2008, at 01:41, Eric Lee wrote:

I have a problem getting the iTunes list, and then making the  
tableview display the iTunes list.


The problem, is actually getting started. Which class should I use?
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/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]


Instance vars, local vars and speed

2008-08-04 Thread Trygve Inda
I am transitioning some code from Carbon to Cocoa and redesigning a lot of
how things work. I am doing a bit of low-level pixel manipulation and
wondering about speed of access to variables declared in a method vs those
declared at the object level.

Obviously things like x,y loop counters are local to a method, but some
things need to be shared between methods and rather then passing values
around, it would be cleaner to declare these at the object level.

How much of a hit am I going to take?

Would it be best to declare them at the object level and copy it into a
local as needed... Will the compiler be smart enough to sort this out?

Will it ever put object (instance) variables in a register?

I know it may require real world testing, but it affects my overall design
too. Note that it could be going through a loop roughly 3 million times on a
large image.

Many thanks,

Trygve


___

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

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

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

This email sent to [EMAIL PROTECTED]


Good luck

2008-08-04 Thread Sachin Kumar


Hey just click on the below link and register ... it will take only not more 
than 2 mins of your time.. take a chance...Really true..

Hey Guys,

Check for free gift!! It’s true…

Click on this url:

http://mac.incentive-network.co.uk/?referral=16791


Regards,
Sachin Kumar T.




The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Good luck

2008-08-04 Thread Sachin Kumar

Hey just click on the below link and register ... it will take only not more 
than 2 mins of your time.. take a chance...Really true..

Hey Guys,

Check for free gift!! It’s true…

Click on this url:

http://mac.incentive-network.co.uk/?referral=21256


Regards,
Sachin Kumar T.




The information contained in this email and any attachments is confidential and 
may be subject to copyright or other intellectual property protection. If you 
are not the intended recipient, you are not authorized to use or disclose this 
information, and we request that you notify us by reply mail or telephone and 
delete the original message from your mail system.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Cancelling screensaver/sleep from an app

2008-08-04 Thread Allison Newman
 
Hi everyone,

In my current app, I have long periods where the user may not interact with the 
app, but where the app display updates continuously, and the user continues to 
watch the app (think playing a movie, or something like that).  How do I go 
about disabling the screensaver/sleep mode whilst the app is being used by the 
user?

Thanks in advance for any help.

Alli
___

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

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

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

This email sent to [EMAIL PROTECTED]


Documentation

2008-08-04 Thread Allison Newman
Following on from my previous message, a few months back, we had a long 
discussion on this list about whether the documentation was of a good quality 
or not.  This is an example where I find myself completely unable to find the 
documentation that I need to answer the question myself.  If anyone can give me 
a tip as to how I should have searched to get the answer myself without having 
to bother this list, that would be greatly appreciated as well :-)

More generally on the topic of documentation, this is the typical kind of 
problem where I find that the documentation fails - when you don't have a clue 
as to what sort of API might be responsible, the documentation is quite poor 
for enabling you to discover the API by yourself. Poor discoverabilty...

Alli
___

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

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

2008-08-04 Thread I. Savant
On Mon, Aug 4, 2008 at 8:26 AM, Allison Newman <[EMAIL PROTECTED]> wrote:
> Following on from my previous message, a few months back, we had a long 
> discussion on this list about whether the documentation was of a good quality 
> or not.  This is an example where I find myself completely unable to find the 
> documentation that I need to answer the question myself.  If anyone can give 
> me a tip as to how I should have searched to get the answer myself without 
> having to bother this list, that would be greatly appreciated as well :-)

  It's kind of hard to do so for those who weren't following your
thread without at least posting a link to your previous message *or*
summarizing your point in this thread.

> More generally on the topic of documentation, this is the typical kind of 
> problem where I find that the documentation fails - when you don't have a 
> clue as to what sort of API might be responsible, the documentation is quite 
> poor for enabling you to discover the API by yourself. Poor discoverabilty...

  I think the long on-list discussion(s) you mentioned about the
documentation kept pointing back to the feedback mechanism. This isn't
really the place to complain if you expect results. Post feedback,
contact DTS, et cetera. Posting it on-list really only amounts to
noise, since everyone has their opinions and it's pretty clear those
opinions are evenly polarized.

--
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: How to get music list?

2008-08-04 Thread Jean-Daniel Dupas


Le 4 août 08 à 12:47, Gregory Weston a écrit :


Kyle Sluder wrote:


4) Parse the iTunes Library XML files.

#4 is unsupported, but also the only way to get access to the iTunes
library when iTunes isn't running.  The approach you take is dictated
by your functional requirements.


I was under the impression the primary reason the XML file existed  
was so other software could interact with iTunes' library in a safe  
and reliable manner (as opposed to the binary file).


Even if it is readable and understandable, it is a private format used  
by iLife (and other Apple services). Its location, format, name, and  
more can change at anytime.

It is as reliable as are all other SPI in 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: Instance vars, local vars and speed

2008-08-04 Thread Jean-Daniel Dupas


Le 4 août 08 à 13:26, Trygve Inda a écrit :

I am transitioning some code from Carbon to Cocoa and redesigning a  
lot of

how things work. I am doing a bit of low-level pixel manipulation and
wondering about speed of access to variables declared in a method vs  
those

declared at the object level.

Obviously things like x,y loop counters are local to a method, but  
some
things need to be shared between methods and rather then passing  
values

around, it would be cleaner to declare these at the object level.

How much of a hit am I going to take?

Would it be best to declare them at the object level and copy it  
into a

local as needed... Will the compiler be smart enough to sort this out?

Will it ever put object (instance) variables in a register?

I know it may require real world testing, but it affects my overall  
design
too. Note that it could be going through a loop roughly 3 million  
times on a

large image.

Many thanks,

Trygve



IMHO, this is just premature optimisation.

That said, there is no cost to access an ivar using the 32 bits  
runtime, and I don't think the cost on 64 bits runtime is important  
enough to bother with it.






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Cancelling screensaver/sleep from an app

2008-08-04 Thread Ron Fleckner


On 04/08/2008, at 10:23 PM, Allison Newman wrote:



Hi everyone,

In my current app, I have long periods where the user may not  
interact with the app, but where the app display updates  
continuously, and the user continues to watch the app (think  
playing a movie, or something like that).  How do I go about  
disabling the screensaver/sleep mode whilst the app is being used  
by the user?


Thanks in advance for any help.

Alli


Check the archives:


But don't bother now because all you'll find there is the following:

- (void)preventSleep
{
keepAwakeTimer = [[NSTimer scheduledTimerWithTimeInterval:30
			target:self selector:@selector(stayAwake:)	 userInfo:nil  
repeats: YES] retain];

}
- (void)stayAwake:(NSTimer *)sleepTimer
{
	UpdateSystemActivity(OverallAct);// This is from Apple Tech Note  
QA1160:Preventing Sleep

}
___

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

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

2008-08-04 Thread Jean-Daniel Dupas


Le 4 août 08 à 14:26, Allison Newman a écrit :

Following on from my previous message, a few months back, we had a  
long discussion on this list about whether the documentation was of  
a good quality or not.  This is an example where I find myself  
completely unable to find the documentation that I need to answer  
the question myself.  If anyone can give me a tip as to how I should  
have searched to get the answer myself without having to bother this  
list, that would be greatly appreciated as well :-)


More generally on the topic of documentation, this is the typical  
kind of problem where I find that the documentation fails - when you  
don't have a clue as to what sort of API might be responsible, the  
documentation is quite poor for enabling you to discover the API by  
yourself. Poor discoverabilty...


Alli


That's why dev list exists:

http://www.cocoabuilder.com/search/archive/cocoa?words=prevent+screensaver+sleep



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Instance vars, local vars and speed

2008-08-04 Thread Negm-Awad Amin


Am Mo,04.08.2008 um 14:51 schrieb Jean-Daniel Dupas:



Le 4 août 08 à 13:26, Trygve Inda a écrit :

I am transitioning some code from Carbon to Cocoa and redesigning a  
lot of

how things work. I am doing a bit of low-level pixel manipulation and
wondering about speed of access to variables declared in a method  
vs those

declared at the object level.

Obviously things like x,y loop counters are local to a method, but  
some
things need to be shared between methods and rather then passing  
values

around, it would be cleaner to declare these at the object level.

How much of a hit am I going to take?

Would it be best to declare them at the object level and copy it  
into a
local as needed... Will the compiler be smart enough to sort this  
out?


Will it ever put object (instance) variables in a register?

I know it may require real world testing, but it affects my overall  
design
too. Note that it could be going through a loop roughly 3 million  
times on a

large image.

Many thanks,

Trygve



IMHO, this is just premature optimisation.

That said, there is no cost to access an ivar using the 32 bits  
runtime, and I don't think the cost on 64 bits runtime is important  
enough to bother with it.
I agree with this! It is not important how often $something is used,  
but which part of all-over costs it produces. If this operation is  
done 2389447982374329847239843298 times, the user maybe will wait four  
weeks. With a little cost added he will wait four weeks and two hours.  
Problem?


On the other hand I'm mnot sure, whether his problem ist really oo. It  
sounds a little bit to me, that he makes something oo, which is not  
oo. There *can* be advantages to put "compound values" in an object.  
But there is no need to do so every time. Sometimes a C-Structure is a  
good solution, that works: NSRect, NSPoint …


Amin







___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Documentation

2008-08-04 Thread Allison Newman
 
On Monday, August 04, 2008, at 02:42PM, "I. Savant" <[EMAIL PROTECTED]> wrote:
>  I think the long on-list discussion(s) you mentioned about the
>documentation kept pointing back to the feedback mechanism. This isn't
>really the place to complain if you expect results. Post feedback,
>contact DTS, et cetera. Posting it on-list really only amounts to
>noise, since everyone has their opinions and it's pretty clear those
>opinions are evenly polarized.
>

During the discussion there were numerous people that felt that the 
documentation was just fine the way it was, and they wanted explicit examples 
of where the documentation failed.  At the time I couldn't remember any 
specific examples, but I know that I quite often feel frustrated by the 
documentation.  So I decided that the next time I had a good example, I would 
post it to the list, along with a request for how other people use the 
documentation to figure out the answer for themselves.

Frankly, I think asking other Cocoa programmers about how to use the Cocoa 
documentation effectively, using a specific example to examine the question, is 
a perfectly legitimate use of the Cocoa Developer's list - I certainly don't 
appreciate you appointing yourself high judge of what is and isn't appropriate.
___

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

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

2008-08-04 Thread Allison Newman
 
On Monday, August 04, 2008, at 02:42PM, "I. Savant" <[EMAIL PROTECTED]> wrote:
>  I think the long on-list discussion(s) you mentioned about the
>documentation kept pointing back to the feedback mechanism. This isn't
>really the place to complain if you expect results. Post feedback,
>contact DTS, et cetera. Posting it on-list really only amounts to
>noise, since everyone has their opinions and it's pretty clear those
>opinions are evenly polarized.
>

During the discussion there were numerous people that felt that the 
documentation was just fine the way it was, and they wanted explicit examples 
of where the documentation failed.  At the time I couldn't remember any 
specific examples, but I know that I quite often feel frustrated by the 
documentation.  So I decided that the next time I had a good example, I would 
post it to the list, along with a request for how other people use the 
documentation to figure out the answer for themselves.

Frankly, I think asking other Cocoa programmers about how to use the Cocoa 
documentation effectively, using a specific example to examine the question, is 
a perfectly legitimate use of the Cocoa Developer's list - I certainly don't 
appreciate you appointing yourself high judge of what is and isn't appropriate.
___

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

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

2008-08-04 Thread Gerriet M. Denkmann


On 3 Aug 2008, at 16:53, Jonathan Dann wrote:


On 3 Aug 2008, at 04:35, Gerriet M. Denkmann wrote:


On 3 Aug 2008, at 05:51, Jonathan Dann wrote:


On 1 Aug 2008, at 14:04, Gerriet M. Denkmann wrote:

But all disclosure triangels are now closed. Is there some way  
to reopen them to the previous state?
I have the strong feeling that I will have to handle this  
myself. Ok. So be it.


It's a common problem.  Can I point you here:

http://www.cocoabuilder.com/archive/message/cocoa/2008/2/23/199705


Thank you very much for this link. You provide there a very clever  
solution, but, as you aptly put in your posting: "It uses  
NSTreeNode and -representedObject, so is 10.5 only."
But alas!, I need Tiger 10.4.11. (And am reluctant to use private  
methods which you hint at in your posting).


Ah, sorry about that, I didn't realise.  What you can do is have a  
look at


http://www.wilshipley.com/blog/2006/04/pimp-my-code-part-10-whining- 
about.html


Wil gives a few category methods like -objectAtIndexPath:  You can  
(maybe) get the index path the _NSArrayControllerTreeNode and then  
get your real object, in which you have an isExpanded flag.


I had a look at this. It seems that to get the real object one has to  
recursively search the whole tree.
In my case it seems to be much simpler just to forget about  
NSTreeController and use the good old DataSource.
This is not a question about premature optimization (the trees in my  
case are quite small) but just a disgust about the silly design of  
the 10.4 NSTreeController.


Thanks for your help!

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


CGImageSourceCreateFromURL failed with error -11

2008-08-04 Thread Nicolas Zinovieff

Hey all,

I have this app that constantly updates a series of thumbnails in the  
background for a Cocoa view.
When I have less than, say, 40 items in there, there is no problem at  
all.
If I add three times that many elements, CGImageSourceCreateWithURL  
fails with error -11


Now, I know it's not a memory issue, since my app takes less than 70  
megs of RAM (and I have no leak), and I know this is not a threaded vs  
main thread issue, since it works beautifully up until that roughly  
100-items-limit.


My trouble is -11 isn't documented. I found some info on a -15 (bad  
param) with that function, but -11 is supposed to be  
dsDisassemblerInstalled. Is MacsBug back in Leopard? ;)


Does anyone know what this error is about?

--
Zino
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Instance vars, local vars and speed

2008-08-04 Thread Trygve Inda

> 
> IMHO, this is just premature optimisation.
> 
> That said, there is no cost to access an ivar using the 32 bits
> runtime, and I don't think the cost on 64 bits runtime is important
> enough to bother with it.
> 

This is what I was trying to determine. Thanks.

Trygve


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Instance vars, local vars and speed

2008-08-04 Thread David Wilson
On Mon, Aug 4, 2008 at 9:16 AM, Trygve Inda <[EMAIL PROTECTED]> wrote:

>> IMHO, this is just premature optimisation.
>>
>> That said, there is no cost to access an ivar using the 32 bits
>> runtime, and I don't think the cost on 64 bits runtime is important
>> enough to bother with it.
>>
>
> This is what I was trying to determine. Thanks.

It's not strictly true- the compiler can do more on a local variable
than it can on an ivar. That said, this is *definitely* premature
optimization; the difference won't be noticed except for extremely
tight loops, and it's simple enough to make local copies of an ivar
*after* Shark has shown that it's a problem.

I have gotten performance wins from that in a few isolated cases, however.

-- 
- David T. Wilson
[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: Restarting an app -- AppleScript 'launch' in a detached shell

2008-08-04 Thread Michael Ash
On Mon, Aug 4, 2008 at 12:22 AM, Andrew Farmer <[EMAIL PROTECTED]> wrote:
> On 03 Aug 08, at 19:53, Michael Ash wrote:
>>
>> On Sun, Aug 3, 2008 at 5:12 PM, Andrew Farmer <[EMAIL PROTECTED]> wrote:
>>>
>>> On 03 Aug 08, at 14:00, Steve Cronin wrote:

 I am trying to simply restart my app.  To my dismay, I cannot find a way
 to do this in Cocoa.
 Please enlighten me if I have failed to understand something!!

 After perusing the archives, what makes the most sense to me is to
 launch
 a detached shell that executes a simple AppleScript.
 The script has a delay of 2 seconds and then simply does a 'launch'.
>>>
>>> You're overcomplicating things.
>>>
>>> int main(int argc, char **argv) {
>>>  if(fork() || fork()) exit(0);
>>>  sleep(2);
>>>  execl(argv[1], argv[1], NULL);
>>>  exit(1);
>>> }
>>>
>>> Launch this with a single argument - the path to your application's
>>> executable. It'll background itself, sleep two seconds, and exec your
>>> application.
>>
>> This is, IMO, a rather bad approach. If your app takes longer than two
>> seconds to quit, it will fail. It's generally a bad idea to use exec()
>> on GUI apps. And you end up creating three subprocesses for no
>> particularly good reason.
>
> The double-fork is to fully detach the child process from the parent - note
> that all of the parent processes immediately die, because fork() returns
> nonzero.

I understand that, but I don't see the point of it. This sort of
detachment is used to prevent zombie processes. You have no danger of
zombie processes, because you intend to outlive your parent, and even
if you don't, your parent will be quick to die in any case. There is
no other utility besides that.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Instance vars, local vars and speed

2008-08-04 Thread Michael Ash
On Mon, Aug 4, 2008 at 7:26 AM, Trygve Inda <[EMAIL PROTECTED]> wrote:
> I am transitioning some code from Carbon to Cocoa and redesigning a lot of
> how things work. I am doing a bit of low-level pixel manipulation and
> wondering about speed of access to variables declared in a method vs those
> declared at the object level.
>
> Obviously things like x,y loop counters are local to a method, but some
> things need to be shared between methods and rather then passing values
> around, it would be cleaner to declare these at the object level.
>
> How much of a hit am I going to take?

If you can't answer this question yourself by measuring it, you
shouldn't be asking it yet.

Rules of Optimization:
Rule 1: Don't do it.
Rule 2 (for experts only): Don't do it yet.

Particularly when dealing with this sort of nitpicky low-level
optimization, it is impossible to start from scratch and write code
that is both fast and functional. (As opposed to code which is totally
broken, but which is really fast at being totally broken.) If you
start out by trying to write fast code, you'll end up with code that
doesn't work, probably isn't all that fast, and is so difficult to
work with that you have no hope of making it correct.

So the proper approach is to build code that's simple,
straightforward, and functional. Then if it's not fast enough, run a
profiler on it to see what parts of it are slow. (This is the part
that will tell you how much of a hit you'll take from using instance
variables.) Then fix those parts to make them faster. If it turns out
that using instance variables is hurting you a lot, at this point you
can port them across to local variables to gain some speed.

Note that the above advice doesn't apply to everything. If there is
some sort of design or grand algorithmic optimization to be made, it's
often good to do it from the start. But when it comes down to
low-level stuff, if you're doing it before you have written functional
code, you're doing it too early. You say that this question affects
your overall design, but it really shouldn't. If ivars are slow, you
just move them into local variables before the beginning of your loop.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Dependent NSOperations (and best practices)

2008-08-04 Thread Andrew Merenbach

Hi, all,

I have a situation in which I am using two subclasses of NSOperation:  
one is to execute an algorithm (in this case, to simulate the rolling  
of dice), while the other is to log the result of that action.  (I'm  
using an operation for the logging since the logging can take some  
time due to its need to process the results of the first operation.)


I have things almost working, but I'm basically wondering what others  
think of this.


---

The user clicks a button, and...

1a. If an operation for the main algorithm is *not* already in  
progress, an operation for the main algorithm begins.

1b. If the main algorithm is already going, then it is stopped.

2a. Ideally, when the main algorithm's operation finishes  
successfully, I would like the logging operation to begin (it will be  
added to a queue specifically for the logging operations).
2b. If the main algorithm's operation is cancelled, I would like to  
*not* perform any logging.


3a. When the logging completes successfully, we're done!
3b. If the logging is cancelled, then we're also done.

This seems like reasonable behavior to me -- but you may notice that  
I've left something out.  With regard to step 1b: what happens if a  
logging operation is still in progress when the main algorithm is  
stopped?  Ideally, would one simply stop the most recent logging  
operation?  Stop all of them?  Stop none of them, and simply let them  
run their course?  I can see cons to all of these, and can't quite  
figure out what's best (e.g., for the first, what if the most recent  
logging operation belongs to a *previous* incarnation of the main  
algorithm, and not the one that's presently running?  For the second,  
what if the user doesn't want to interrupt his or her logging, again  
for previous rolls, with the cancellation of the main algorithm? and,  
for the third, what if the user *wants* to interrupt one or all of the  
logging operations??).


All guidance is appreciated!

Cheers,
Andrew


smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Documentation

2008-08-04 Thread I. Savant
> Frankly, I think asking other Cocoa programmers about how to use the Cocoa 
> documentation effectively, using a specific example to examine the question, 
> is a perfectly legitimate use of the Cocoa Developer's list

  Sure, but it's been stated numerous times that feedback about the
documentation should be pointed to WorldWide Developer Relations (not
DTS as I had previously erroneously stated) and/or filed using the
feedback form at the bottom of each documentation page.


> I certainly don't appreciate you appointing yourself high judge of what is 
> and isn't appropriate.

  As I said when you contacted me offline, if you have a problem with
any list member fighting to keep the list
on-topic and flame-free (I mention flame-free because of the *last*
time people geot into a debate on this list about the documentation),
complain to the moderator at [EMAIL PROTECTED]

  This list is very valuable when dead horses aren't beaten daily and
I make no apologies for being one of those who fight to keep it so.
Further posts online in an attempt to lambaste me will be ignored.

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

2008-08-04 Thread I. Savant
On Mon, Aug 4, 2008 at 8:42 AM, I. Savant <[EMAIL PROTECTED]> wrote:

>> More generally on the topic of documentation, this is the typical kind of 
>> problem where I find that the documentation fails - when you don't have a 
>> clue as to what sort of API might be responsible, the documentation is quite 
>> poor for enabling you to discover the API by yourself. Poor discoverabilty...
>
>  I think the long on-list discussion(s) you mentioned about the
> documentation kept pointing back to the feedback mechanism. This isn't
> really the place to complain if you expect results. Post feedback,
> contact DTS, et cetera. Posting it on-list really only amounts to
> noise, since everyone has their opinions and it's pretty clear those
> opinions are evenly polarized.

  For the record (because I appear to have deeply offended someone),
the request for clarification on where to find an answer to the OP's
other thread wasn't what I had the problem with. Having followed the
previous discussions on the documentation (where some posters became
outright vicious regarding the documentation and its authors), it was
the second comment I quoted above that I took exception to. It boils
down to this:

A - It's been stated numerous times that the list is no place for this
type of feedback (because it won't change anything whatsoever) but the
feedback forms on the bottom of the documentation pages or WWDR are.
B - This type of feedback touches off a "sore spot" that doesn't
benefit much because of point A.
C - There is nothing wrong with citing the rules and general topic
relevance; there are thousands of list members and only two
moderators. Some generalized self-moderation is required. I certainly
didn't threaten with banning or other forms of censure because I am
NOT a moderator.

  Also, perhaps the use of the words "complain" and "noise" were what
caused the panty bunching, so for that choice of words I do apologize.
The general spirit of my comment was to keep the list on-topic and
flame-free, a responsibility we all share. Unfortunately some people
*really* don't like to be disagreed with ...

--
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: Dependent NSOperations (and best practices)

2008-08-04 Thread I. Savant
> I have a situation in which I am using two subclasses of NSOperation: one is
> to execute an algorithm (in this case, to simulate the rolling of dice),
> while the other is to log the result of that action.  (I'm using an
> operation for the logging since the logging can take some time due to its
> need to process the results of the first operation.)

  You haven't mentioned whether you're making use of dependencies:

http://developer.apple.com/documentation/Cocoa/Reference/NSOperation_class/Reference/Reference.html#//apple_ref/doc/uid/TP40004591-RH2-SW14

  (see "Operation Dependencies")

  ... I think the answer to that will determine much of (if not all)
the rest. :-)

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

2008-08-04 Thread Andy Lee

On Aug 4, 2008, at 8:26 AM, Allison Newman wrote:
This is an example where I find myself completely unable to find the  
documentation that I need to answer the question myself.  If anyone  
can give me a tip as to how I should have searched to get the answer  
myself without having to bother this list, that would be greatly  
appreciated as well :-)


First rule of problem reporting: tell us what you tried.  Since you  
didn't, here's my approach to searching in general for topics where  
I'm not sure where to start:


 * full-text search in the Xcode documentation window
 * search of the list archives via cocoabuilder.com
 * Google search targeted at developer.apple.com, e.g., "prevent  
sleep site:developer.apple.com"
 * AppKiDo (my app), which is actually my first choice if I think I  
can guess a substring that will be in a relevant API, but sometimes I  
can't.  You can also do substring API search in Xcode.


--Andy

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread Keith Duncan

I might as well pimp my own project too.

http://code.google.com/sourcelist hosts an iLife like Source List  
NSView subclass and provides an "iTunes Music Library.xml" parser as  
an example.



Keith Duncan
[EMAIL PROTECTED], 33software.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


help linking sqlite3 wrapper

2008-08-04 Thread John Velman
I need a sqlite wrapper.   After much surfing and reading, I decided to try
the one: 

//  Created by Dustin Mierau on Tue Apr 02 2002.
//  Copyright (c) 2002 Blackhole Media, Inc. All rights reserved.
//



After making changes to move the download from sqlite to sqlite3, and
checking that I have  /usr/local/lib/libsqlite3.a, and putting
/usr/local/lib in the library search path of the project, the source for
the Demo compiles but does not link.  

I'm using SDK10.4 on Leopqard with XCode 3.1  (The target machine for my app
is still running Tiger).

Here are some typical error messages, that cover both the cocoa and sqlite3
aspects of the linkage:

  ".objc_class_name_NSMutableString", referenced from:
  [EMAIL PROTECTED]@[EMAIL PROTECTED] in SQLDatabase.o
  [EMAIL PROTECTED]@[EMAIL PROTECTED] in SQLRow.o
  "_sqlite3_free_table", referenced from:
  -[SQLDatabase performQuery:] in SQLDatabase.o
  -[SQLDatabase performQuery:] in SQLDatabase.o
  -[SQLResult dealloc] in SQLResult.o

I've checked with nm that my libsqlite3.a has the entry point
_sqlite3_free_table;  (Have also checked several of the other sqlite
related linking errors).

Other cocoa, Xcode, objective-c, SDK10.4 projects work fine on my setup
(after I get the spelling and punctuation right).   So evidently there is
something about my project setup that is keeping this from linking.

Would appreciate any hints about where to look.

Thanks.

John V.
___

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

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

2008-08-04 Thread Andrew Merenbach

On Aug 4, 2008, at 8:45 AM, I. Savant wrote:

I have a situation in which I am using two subclasses of  
NSOperation: one is
to execute an algorithm (in this case, to simulate the rolling of  
dice),

while the other is to log the result of that action.  (I'm using an
operation for the logging since the logging can take some time due  
to its

need to process the results of the first operation.)


 You haven't mentioned whether you're making use of dependencies:

http://developer.apple.com/documentation/Cocoa/Reference/NSOperation_class/Reference/Reference.html#/ 
/apple_ref/doc/uid/TP40004591-RH2-SW14


 (see "Operation Dependencies")

 ... I think the answer to that will determine much of (if not all)
the rest. :-)

--
I.S.


Wow!  Although you and the other list members have my profuse  
apologies for missing that, I thought that my case was so unique that  
I didn't actually think to look for that particular aspect of  
NSOperation -- right-under-the-nose, eh? -- and instead just came up  
with the term on my own.  I really appreciate your pointing that out,  
I.S.


While I'll certainly examine that, looking at the docs don't seem to  
quite answer the final question from my post (to quote myself):


... what happens if a logging operation is still in progress when  
the main algorithm is stopped?  Ideally, would one simply stop the  
most recent logging operation?  Stop all of them?  Stop none of  
them, and simply let them run their course?  I can see cons to all  
of these, and can't quite figure out what's best (e.g., for the  
first, what if the most recent logging operation belongs to a  
*previous* incarnation of the main algorithm, and not the one that's  
presently running?  For the second, what if the user doesn't want to  
interrupt his or her logging, again for previous rolls, with the  
cancellation of the main algorithm? and, for the third, what if the  
user *wants* to interrupt one or all of the logging operations??).


While dependent operations may produce a particular behavior, or be  
configurable to produce certain behaviors, what behavior would be a  
best practice from a UI and user-experience perspective?


Anyway, thank you for your assistance!

Cheers,
Andrew

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: AuthorizationExecuteWithPrivileges flag error

2008-08-04 Thread Kevin Elliott

Glancing at your code, this:


AuthorizationItem right = { RIGHT, 0, NULL, 0 };


Looks completely wrong.  What is RIGHT?

Your flags also look wrong.  Your not allowing interaction, so the  
system won't be allowed to authorize to create your right.


Not to mention that I have no idea why your messing around with  
AuthorizationCreateFromExternalForm- the entire point of  
AuthorizationCreateFromExternalForm is to work with authorizations  
that came from other processes, which makes calling it with a stack  
allocated empty form very odd.  Honestly, I'm a little surprised it  
didn't just crash.


All of which leads to this- what are you trying to do?

AuthorizationExecuteWithPrivileges is NOT an API you should be using  
to call something like sysctl.  It's intended to be used by  
installers, not as a general purpose API for running random things as  
root.


You need to take a very close look at the following doc:
http://developer.apple.com/documentation/Security/Conceptual/authorization_concepts/01introduction/chapter_1_section_1.html

In addition take a look at the following sample:
http://developer.apple.com/samplecode/BetterAuthorizationSample/index.html

On Jul 30, 2008, at 6:16 AM, sheen mac wrote:


Hi All,

In my project , I added an executable and created AuthorizationRef
successfully.The AuthorizationCopyRights also worked without
error.But when AuthorizationExecuteWithPrivileges , it shows
the invalid flags error.

Kindly help me.

Thanks In Advance,
Sheen

OSStatus status;AuthorizationRef auth;
AuthorizationExternalForm extAuth;


if (geteuid() != 0) {
setuid(0);
}

if (fread(&extAuth, sizeof(extAuth), 1, stdin) != 1)
exit(-1);
if (AuthorizationCreateFromExternalForm(&extAuth, &auth))
exit(-1);


AuthorizationItem right = { RIGHT, 0, NULL, 0 };
AuthorizationRights rights = { 1, &right };
	AuthorizationFlags flags = kAuthorizationFlagDefaults |  
kAuthorizationFlagExtendRights;



	if (status = AuthorizationCopyRights(auth, &rights,  
kAuthorizationEmptyEnvironment, flags, NULL)) {

exit(-1);
}

char* args[3];
   OSStatus err = 0;
   FILE* iopipe;


   args[0] = "-w";
   args[1]="net.inet.ip.forwarding=1";
   args[2]=NULL;

   err = AuthorizationExecuteWithPrivileges(auth,
"/usr/sbin/sysctl",
flags, args, &iopipe);


if(err!=errAuthorizationSuccess)
fprintf(stderr,"failed\n");   


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread Keith Duncan

I might as well pimp my own project too.


The actual project link: http://code.google.com/p/sourcelist

Keith Duncan
[EMAIL PROTECTED], 33software.com

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGImageSourceCreateFromURL failed with error -11

2008-08-04 Thread David Duncan

On Aug 4, 2008, at 4:00 AM, Nicolas Zinovieff wrote:

I have this app that constantly updates a series of thumbnails in  
the background for a Cocoa view.
When I have less than, say, 40 items in there, there is no problem  
at all.
If I add three times that many elements, CGImageSourceCreateWithURL  
fails with error -11



How is CGImageSourceCreateWithURL failing with any error when its  
return value is a CGImageSourceRef and not an OSStatus?

--
David Duncan
Apple DTS Animation and Printing
[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: [Q] is NSFileHandle's writeData method faster than the FSWriteFork?

2008-08-04 Thread James Bucanek
That probably won't gain you that much. Fractional page writes 
will still requires FSWRriteFork to first copy the data into its 
file buffer, which is where I suspect much of your current 
overhead is.


Writing your data into a local, aligned, buffer shouldn't be too 
difficult to re-engineer. I assume that it's your code that's 
performing the FSWriteFork calls. Replace that with a subroutine 
to copy the fractional block into your own buffer. When you have 
some multiple of getpagesize() bytes copied, write that and repeat.


The solution for my application was only a little more 
sophisticated. My code maintains a set of circular buffers and 
the data is written to the file on a separate thread. My main 
thread can continue to assemble new data while the first 
buffer's worth is being written concurrently.


Also consider asking this question on the filesystem-dev list. 
There's some serious filesystem knowledge on that list that 
often doesn't have time to monitor Cocoa-dev.


James

JongAm Park  wrote 
(Sunday, August 3, 2008 8:55 PM -0700):



Thank you very much for the valuable information.

I will try the 1st and the 3rd options, because the 2nd option will not be 
easily applicable withouth refactoring the current code a lot.


- Align the data to be written in memory to page boundaries 
(man valloc).

- Write data in multiples of page size blocks (man getpagesize)
- Turn off caching (see Cache Constants of FSWriteFork)

--
James Bucanek

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: help linking sqlite3 wrapper

2008-08-04 Thread Brian Stern


On Aug 4, 2008, at 11:56 AM, John Velman wrote:


After making changes to move the download from sqlite to sqlite3, and
checking that I have  /usr/local/lib/libsqlite3.a, and putting
/usr/local/lib in the library search path of the project, the source  
for

the Demo compiles but does not link.


Did you add libsqlite3.a to your project?

BTW, unless you have a specific reason for not doing so I'd recommend  
you use the system-supplied sqlite dylib rather than a third party .a  
file.  This file is contained within the SDKs included with Xcode.  In  
that case add this file to your project:


/Xcode3.1/SDKs/MacOSX10.4u.sdk/usr/lib/libsqlite3.dylib


___

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

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

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

This email sent to [EMAIL PROTECTED]


Bindings to display an NSArray of NSStrings as a single NSString?

2008-08-04 Thread Dustin Robert Kick
This seems like it would be common enough, to me, that it would have  
bindings for it.  I can't find anything, and am thinking I will write  
an NSValueTransformer to do this (also thought there might be a value  
transformer for this, but no).  Am I missing something?  I thought  
that there should be either a [EMAIL PROTECTED] operator, or a  
patternValue binding, or an NSValueTransformer to do this, but I  
haven't found anything.  I thought I might be able to get something by  
using [EMAIL PROTECTED], or something similar, but that  
wouldn't work either.



Dustin  
KC9MEL  




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]

Message Framework and Garbage Collection

2008-08-04 Thread Ruotger Skupin

Hi,

I'm trying to use the Message Framework with Garbage Collection  
enabled and it crashes deep down in the framework. With retain/release  
it works fine. Am I correct in assuming that since it is deprecated  
for 10.5 it can't be used with GC?


Is there anything that can be used instead?

Ruotger

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Documentation

2008-08-04 Thread Allison Newman

Yup, I should have made that clearer in the initial post.

Basically what I was trying to get at is what happens when keyword  
searches fail to turn up the info that you need.  I generally try  
searching in much the same way as you (API search, list archives,  
Google - though I use non-site limited search there), except I don't  
use AppKiDo (sorry!)  I also try flipping through the index of the  
Hillegass book to see if there's maybe a chapter in there talking  
about what I want, that I may have forgotten about.


In this particular case for example, my searches failed, because I was  
searching on "screensaver" rather than "sleep".  This happens quite  
often when you are coming from a non-OSX environment, such as Windows,  
Linux, Java, whatever - different platforms use different terminology  
for the same thing - you say 'bonjour' and I say 'zeroconf' type of  
thing.  Or, as was my case this time, I was searching for  
"screensaver" because it was my screensaver that was getting in the  
way on my own computer, not the sleep function.  I got fixated on the  
wrong word.  I learned an awful lot about ScreenSaverView,  
ScreenSaverDefaults, and how to write my own screensaver, but  
absolutely nothing about how to turn off the system screensaver.


So, to reword my question, does anyone have a trick/useful reference  
document that helps them out when keyword searches aren't getting them  
the result they want?


Le 4 août 08 à 17:51, Andy Lee a écrit :

First rule of problem reporting: tell us what you tried.  Since you  
didn't, here's my approach to searching in general for topics where  
I'm not sure where to start:


* full-text search in the Xcode documentation window
* search of the list archives via cocoabuilder.com
* Google search targeted at developer.apple.com, e.g., "prevent  
sleep site:developer.apple.com"
* AppKiDo (my app), which is actually my first choice if I think I  
can guess a substring that will be in a relevant API, but sometimes  
I can't.  You can also do substring API search in Xcode.


--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: Irritating Problem with NSString Method and File Paths

2008-08-04 Thread Jack Carbaugh

when i refer to a file, i used:

file = [[NSMutableDictionary alloc] initWithContentsOfFile:[Folder  
stringByAppendingPathComponent: FileName]];


Folder is set up as:
Folder  = [[NSString alloc] initWithString:[@"path"  
stringByExpandingTildeInPath]];


and Filename is:
FileName= [[NSMutableString alloc] initWithString:@"filename.txt"];


perhaps that may help.

jack


On Aug 4, 2008, at Mon-08 /04 /08-12:43 AM, Patrick Walker wrote:

It seems that whenever I use Xcode to spawn the program, it is able  
to find the file but when spawning the program from Finder, it can  
never, ever find the file.  I've been looking online and no one  
seems to have come across this before or maybe it's because it's so  
late that I'm not seeing the obvious.


  NSString *fileContents = [[NSString alloc] initWithContentsOfFile: 
[filename stringValue]
  
encoding:NSASCIIStringEncoding

error:nil];
Filename is an NSTextField outlet, btw.

We've tried all sorts of things to try and find the file,  
File.txt, ./File.txt, ~/File.txt, "./File.txt".   I can understand  
maybe the ~ doesn't work for all shells but explicitly using
./File.txt should be opening the file in the current directory with  
the executable, shouldn't it?  Do I *really* have to append a huge  
long path each time I want to open a file?


Any ideas?  It says path and the documentation says that it has to  
be NSString.  I've used filepaths before for open() but those are C  
strings and those are full paths though, i.e., /dev/stdout.  It's  
such a simple problem what am I missing here?

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/intrntmn%40aol.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: NSSplitView Question

2008-08-04 Thread Iain Houston
The TwoManyControllers sample code does what you want I think mostly  
generated  from declarative as far as I can see


On 4 Aug 2008, at 06:41, Graham Cox wrote:

This is not any thing to do with NSSplitView as such. You're asking  
"how to implement a master-detail interface". Try doing searching on  
those terms, phrase or a variation of it, I'm sure it's been well- 
covered.


The essentials are - detect the selection change in the master view,  
use it to update the contents of the detail view. Beyond that it's  
hard to give much concrete advice as there are about four million  
ways to implement this. You do have to do it yourself however.


hth,

Graham


On 4 Aug 2008, at 3:35 pm, Eric Lee wrote:

Sorry, I accidently did something wrong on that message. Here's the  
one I'm actually asking...



How do you make a NSSplitView so that when you click something on  
one side, the other side is updated. For example, take the mail  
application. When you click trash, the other side is updated to  
display the trash content, and when you press Inbox, the other side  
displays the inbox.


How do you do this?
___

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

Please do not post admin requests or moderator comments to the list.
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/iainhouston%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: Interface Builder, tree view like Mac Mail or itunes

2008-08-04 Thread Stefan Bethke

Am 04.08.2008 um 02:11 schrieb Sandro Noel:


Hello!

I would like to know how to design an interface that resembles the  
Mac Mail application
most specifically, the tree view, I cant seem to set the proper  
properties in interface builder

to achieve the same thing...

so far, i've got the split view, and the right pane, just liek i  
want them,

but i can not get the tree view to behave.

Could any of you guru's out there point me in the correct direction?


I found this example to be quite helpful:
http://developer.apple.com/samplecode/SourceView/

Stefan

--
Stefan Bethke <[EMAIL PROTECTED]>   Fon +49 170 346 0140


___

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

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

2008-08-04 Thread Scott Anguish


On 4-Aug-08, at 9:00 AM, Allison Newman wrote:



On Monday, August 04, 2008, at 02:42PM, "I. Savant" <[EMAIL PROTECTED] 
> wrote:

I think the long on-list discussion(s) you mentioned about the
documentation kept pointing back to the feedback mechanism. This  
isn't

really the place to complain if you expect results. Post feedback,
contact DTS, et cetera. Posting it on-list really only amounts to
noise, since everyone has their opinions and it's pretty clear those
opinions are evenly polarized.



During the discussion there were numerous people that felt that the  
documentation was just fine the way it was, and they wanted explicit  
examples of where the documentation failed.  At the time I couldn't  
remember any specific examples, but I know that I quite often feel  
frustrated by the documentation.  So I decided that the next time I  
had a good example, I would post it to the list, along with a  
request for how other people use the documentation to figure out the  
answer for themselves.


This is useful, however as I.S. said, this isn't the place where such  
feedback will be effectively noticed and acted upon.






Frankly, I think asking other Cocoa programmers about how to use the  
Cocoa documentation effectively, using a specific example to examine  
the question, is a perfectly legitimate use of the Cocoa Developer's  
list - I certainly don't appreciate you appointing yourself high  
judge of what is and isn't appropriate.



I don't read him having done that.  He did point out the various  
options to provide the feedback in a form that it could be acted upon.



___

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

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

2008-08-04 Thread Bill Bumgarner

On Aug 4, 2008, at 10:35 AM, Ruotger Skupin wrote:
I'm trying to use the Message Framework with Garbage Collection  
enabled and it crashes deep down in the framework. With retain/ 
release it works fine. Am I correct in assuming that since it is  
deprecated for 10.5 it can't be used with GC?


Is there anything that can be used instead?


If it is in 10.5, it should work.  Please file a radar.

b.bum



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: help linking sqlite3 wrapper

2008-08-04 Thread John Velman
Since I sent the previous message, I was looking at the SDK 10.4
sqlite3.dylib,  and thinking of giving it a try.  I didn't know I
specifically had to add it to the project.

I'll let you know what happens!

Thanks.

John V.

On Mon, Aug 04, 2008 at 01:22:37PM -0400, Brian Stern wrote:
>
> On Aug 4, 2008, at 11:56 AM, John Velman wrote:
>
>> After making changes to move the download from sqlite to sqlite3, and
>> checking that I have  /usr/local/lib/libsqlite3.a, and putting
>> /usr/local/lib in the library search path of the project, the source for
>> the Demo compiles but does not link.
>
> Did you add libsqlite3.a to your project?
>
> BTW, unless you have a specific reason for not doing so I'd recommend you 
> use the system-supplied sqlite dylib rather than a third party .a file.  
> This file is contained within the SDKs included with Xcode.  In that case 
> add this file to your project:
>
> /Xcode3.1/SDKs/MacOSX10.4u.sdk/usr/lib/libsqlite3.dylib
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/velman%40cox.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]


CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread Steve Cronin

Folks;

Here's the pretty simple tool I'm trying to create (THANK-YOU Michael  
Ash!!)


int main (int argc, const char * argv[]) {
char dummy;
read(STDIN_FILENO, &dummy, 1);
[NSAutoreleasePool new];
	NSURL *url = [NSURL fileURLWithPath:[NSString  
stringWithUTF8String:argv[1]]];

LSOpenCFURLRef((CFURLRef)url, NULL);
return 0;
}

I'm using XCode3.1 with the 10.5 SDK deploying to 10.4.
I open new project using the  CoreFoundation - Command Line Tool  
template, and place the code shown above.


My question is what are the #imports necessary to make this work?
I have figured out:
#import   
  //for the STDIN_FILENO and the read()
#import 		//for the  
LSOpenCFURLRef


I've tried various usages of #import  but  
can't seem to get it right so that NSURL & NSAutoreleasePool are  
defined...
I believe that both NSURL and NSAutoreleasePool are defined in the  
Foundation framework, which is why I am focused on getting it  
#imported,  I just need the syntax..

(with Foundation framework added to the project)
NO --> #include   (~700 errors...)
NO --> #include   (45 errors..)

Oh out of exasperation, I tried  ---> ~1700 errors

I know this is probably pretty easy for most, but its got me just  
bamboozled


THANK-YOU for any help!
Steve
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread David Duncan

On Aug 4, 2008, at 11:51 AM, Steve Cronin wrote:


Folks;

I open new project using the  CoreFoundation - Command Line Tool  
template, and place the code shown above.


I've tried various usages of #import  but  
can't seem to get it right so that NSURL & NSAutoreleasePool are  
defined...
I believe that both NSURL and NSAutoreleasePool are defined in the  
Foundation framework, which is why I am focused on getting it  
#imported,  I just need the syntax..

(with Foundation framework added to the project)
NO --> #include   (~700 errors...)
NO --> #include   (45 errors..)

Oh out of exasperation, I tried  ---> ~1700 errors



My guess would be that the compiler thinks its compiling C (or C++)  
code, when you've given it Obj-C. Simplest fix if that is the case is  
to change the file extension to ".m". But without seeing the actual  
errors, it would have to remain a guess.


Alternatively, you can keep this all in the land of C by using  
CFURLCreateWithFileSystemPath() and CFStringCreateWithCString(). Then  
you won't need any Obj-C (or Foundation) at all.


Of course, while I realize this is probably a learning project, the  
same thing can be accomplished with the "open" command line tool :).

--
David Duncan
Apple DTS Animation and Printing
[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: CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread Chris Parker


On Aug 4, 2008, at 11:51 AM, Steve Cronin wrote:

Here's the pretty simple tool I'm trying to create (THANK-YOU  
Michael Ash!!)


int main (int argc, const char * argv[]) {
char dummy;
read(STDIN_FILENO, &dummy, 1);
[NSAutoreleasePool new];
	NSURL *url = [NSURL fileURLWithPath:[NSString  
stringWithUTF8String:argv[1]]];

LSOpenCFURLRef((CFURLRef)url, NULL);
return 0;
}

I'm using XCode3.1 with the 10.5 SDK deploying to 10.4.
I open new project using the  CoreFoundation - Command Line Tool  
template, and place the code shown above.


You've created a CoreFoundation tool from the template, but you're  
using Foundation code (NSString, NSURL, etc.). You really want to be  
creating a Foundation tool (there's a template for that too).


Creating a CoreFoundation tool creates a pure C configuration in the  
project, which has no idea how to deal with Objective C.



My question is what are the #imports necessary to make this work?
I have figured out:
#import   
  //for the STDIN_FILENO and the read()
#import 		//for the  
LSOpenCFURLRef


I've tried various usages of #import  but  
can't seem to get it right so that NSURL & NSAutoreleasePool are  
defined...
I believe that both NSURL and NSAutoreleasePool are defined in the  
Foundation framework, which is why I am focused on getting it  
#imported,  I just need the syntax..

(with Foundation framework added to the project)
NO --> #include   (~700 errors...)
NO --> #include   (45 errors..)

Oh out of exasperation, I tried  ---> ~1700 errors

I know this is probably pretty easy for most, but its got me just  
bamboozled


Creating a Foundation tool instead will get you a lot farther. :)

As far as parsing arguments go, you may wish to look at using  
[[NSProcessInfo processInfo] arguments], which gives you an NSArray of  
NSStrings of the arguments.


.chris

--
Chris Parker
Cocoa Frameworks
Apple, 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: Dependent NSOperations (and best practices)

2008-08-04 Thread I. Savant
> Wow!  Although you and the other list members have my profuse apologies for
> missing that, I thought that my case was so unique that I didn't actually
> think to look for that particular aspect of NSOperation --
> right-under-the-nose, eh? -- and instead just came up with the term on my
> own.  I really appreciate your pointing that out, I.S.

  Meh ... we all miss stuff, especially if we work with multiple
environments / APIs, etc.

>> ... what happens if a logging operation is still in progress when the main
>> algorithm is stopped?  Ideally, would one simply stop the most recent
>> logging operation?  Stop all of them?  Stop none of them, and simply let
>> them run their course?  I can see cons to all of these, and can't quite
>> figure out what's best (e.g., for the first, what if the most recent logging
>> operation belongs to a *previous* incarnation of the main algorithm, and not
>> the one that's presently running?  For the second, what if the user doesn't
>> want to interrupt his or her logging, again for previous rolls, with the
>> cancellation of the main algorithm? and, for the third, what if the user
>> *wants* to interrupt one or all of the logging operations??).
>
> While dependent operations may produce a particular behavior, or be
> configurable to produce certain behaviors, what behavior would be a best
> practice from a UI and user-experience perspective?

  It really, truly depends on your application requirements. If the
logging for "roll 1" is dependent on that roll, you'll be adding the
"roll" and "log" operations in tandem (with appropriate dependancies)
to your queue, right? So if the roll is canceled, so would be its
associated log operation, correct? With this behavior, if a roll is
cancelled, it won't be logged. I presume that if the roll occurred
uninterrupted, you'd want it logged, so the user shouldn't be able to
cancel a log event for a completed roll. Again, this depends on your
requirements. Maybe a bit more in-depth explanation is required.

--
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: Dependent NSOperations (and best practices)

2008-08-04 Thread Ronny Reichmann

Hello Andrew,


...
While dependent operations may produce a particular behavior, or be  
configurable to produce certain behaviors, what behavior would be a  
best practice from a UI and user-experience perspective?


In my eyes you should keep it simple for the users sake. The algorithm  
and the processing of it's associated log are both belonging to the  
same task in the users point of view. Executing a queue of such tasks  
can be made visible very cleanly. In this order, even canceling a task  
can just be done in one logical way. Or canceling the whole queue. But  
splitting everything up leads to big confusion. You should think about  
the reason why you "need“ to split it up and why you "need“ to make it  
visible in behavior/interface. Are there any benefits at all?


Cheers,
Ron___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get the value of a NSNumber contained in an array while debugging ?

2008-08-04 Thread Sean McBride
On 8/3/08 3:01 PM, Kyle Sluder said:

>> If your array is called myArray, type
>>
>> po myArray
>>
>> in the debugger, and it will print the value of all objects in the array.
>
>More specifically, it will send -description to all the objects in the
>array, and print the result.  Useful even if you have an array of your
>own objects and need to inspect them in the debugger; override
>-description and return a meaningful string.

Actually, according to:


"print-object actually calls the debugDescription method of the
specified object. NSObject implements this method by calling through to
the description method. Thus, by default, an object's debug description
is the same as its description. However, you can override
debugDescription if you want to decouple these; many Cocoa objects do this."

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dependent NSOperations (and best practices)

2008-08-04 Thread I. Savant
> But splitting everything up leads
> to big confusion. You should think about the reason why you "need" to split
> it up and why you "need" to make it visible in behavior/interface. Are there
> any benefits at all?

  Nicely put. I wasn't (and still am not) sure if this is a
requirement for some good reason but I agree 100%. If it's not
necessary for the user to know that the computation and its resulting
logging action are two separate threaded operations, then they most
certainly shouldn't be burdened with that visual info.

--
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 / AppleScript Folder Action

2008-08-04 Thread has

John Joyce wrote:


I know I can do awkward things with AppleScript and Folder Action
scripts,
but is there a strictly Cocoa/Objective-C way to do something like
Folder Action scripts short of a  daemon?



Try kqueue or FSEvents.

HTH

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to get music list?

2008-08-04 Thread has

Eric Lee wrote:


I have a problem getting the iTunes list, and then making the
tableview display the iTunes list.



Using objc-appscript [1], here's how to list the name, artist and  
album of every track in the current playlist:



#import "ITGlue/ITGlue.h"

// To create glue files: osaglue  -o ITGlue  -p IT  iTunes

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

	ITApplication *itunes = [ITApplication applicationWithBundleID:  
@"com.apple.itunes"];


ITReference *tracks = [[itunes currentPlaylist] tracks];

/* Note: if player is stopped then current playlist isn't available.
 * You could either test for this in advance (as shown here) or check
 * for nil results after sending the 'get' events. Additional NSError
 * info is also optionally available.
 */
if ([[[tracks exists] send] boolValue]) {

/*
 * Note: Apple event IPC is query-based, allowing you to get a
 * property from all elements at once. This is far quicker than
 * iterating over elements yourself if there are lots of them.
 */
NSArray *names = [[tracks name] getList];
NSArray *artists = [[tracks artist] getList];
NSArray *albums = [[tracks album] getList];

int i;
for (i = 0; i < [names count]; i++)
			printf("%-60s  %-60s  %-60s\n", [[names objectAtIndex: i]  
UTF8String],


[[artists objectAtIndex: i] UTF8String],

[[albums objectAtIndex: i] UTF8String]);

} else
printf("Current playlist is not available.\n");

[pool drain];
return 0;
}


HTH

has

[1] Which is a bit like Scripting Bridge, but without the application  
compatibility problems and with 10.3.9 and 10.4.x support, better  
documentation and developer tools.

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread Michael Ash
On Mon, Aug 4, 2008 at 3:10 PM, David Duncan <[EMAIL PROTECTED]> wrote:
> On Aug 4, 2008, at 11:51 AM, Steve Cronin wrote:
>
>> Folks;
>>
>> I open new project using the  CoreFoundation - Command Line Tool template,
>> and place the code shown above.
>>
>> I've tried various usages of #import  but can't
>> seem to get it right so that NSURL & NSAutoreleasePool are defined...
>> I believe that both NSURL and NSAutoreleasePool are defined in the
>> Foundation framework, which is why I am focused on getting it #imported,  I
>> just need the syntax..
>> (with Foundation framework added to the project)
>> NO --> #include   (~700 errors...)
>> NO --> #include   (45 errors..)
>>
>> Oh out of exasperation, I tried  ---> ~1700 errors
>
>
> My guess would be that the compiler thinks its compiling C (or C++) code,
> when you've given it Obj-C. Simplest fix if that is the case is to change
> the file extension to ".m". But without seeing the actual errors, it would
> have to remain a guess.
>
> Alternatively, you can keep this all in the land of C by using
> CFURLCreateWithFileSystemPath() and CFStringCreateWithCString(). Then you
> won't need any Obj-C (or Foundation) at all.
>
> Of course, while I realize this is probably a learning project, the same
> thing can be accomplished with the "open" command line tool :).

I think you may have missed the read() at the beginning of the
function, which is critical to the operation of the tool. (The purpose
is to wait for the parent process to quit, then restart it.) If,
however, I have instead missed a way to make the "open" tool wait for
its parent to die before opening the argument, I would very much
appreciate enlightenment on that subject.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Rick Hoge


I'm working on an application that will allow users to add columns of  
descriptive information to an NSTableView - the available columns are  
determined at launch time by loading a dictionary.


In my test app, I can add columns to my table no problem.  Now I am  
trying to decide on a robust and efficient way to make sure that the  
set of columns chosen by the user, and their geometry, is saved when  
quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an array  
of column identifiers and/or value bindings to user preferences, for  
example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The autosave  
info appears to restore the geometry of columns defined in the nib  
file, but it won't force a reload of columns created programatically  
in the last session.  I suspect that the autosave file may actually  
contain the identifiers of all columns displayed as of the last  
application quit, and wonder if there is a way, during nib loading, to  
access this list so I can initialize the table.


I don't like having the same information stored multiple places (i.e.  
my own NSArray in user prefs replicating info that might be more  
complete in the NSTableView autosave file) if I can avoid it, but  
can't seem to find a way to get at all the info in this file.


If anyone has some good examples of how this can be done, or some past  
experience to share on what works well, I'd be very grateful.


Thanks!

Rick


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Help no longer needed! (was: help linking sqlite3 wrapper)

2008-08-04 Thread John Velman
O.K.  I had messed up the original project sufficiently that it didn't
work,  So I started over, made a Cocoa app, added the sql stuff from
blackhole (modified for sqlite3), added the libsqlite3.dylib from SDK4,
and made an interface with one pushbutton, "test" with the original demo
code (which just writes to the console) in the Action.

WONDERFUL.  It works just fine.  I can't believe how much time I've wasted
trying to do something more complicated.  :-)


Thanks again!

John V.

On Mon, Aug 04, 2008 at 11:39:42AM -0700, John Velman wrote:
> Since I sent the previous message, I was looking at the SDK 10.4
> sqlite3.dylib,  and thinking of giving it a try.  I didn't know I
> specifically had to add it to the project.
> 
> I'll let you know what happens!
> 
  ,
> >
> > /Xcode3.1/SDKs/MacOSX10.4u.sdk/usr/lib/libsqlite3.dylib
> >
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/velman%40cox.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/velman%40cox.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]


Re: CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread David Duncan

On Aug 4, 2008, at 2:00 PM, Michael Ash wrote:


I think you may have missed the read() at the beginning of the
function, which is critical to the operation of the tool. (The purpose
is to wait for the parent process to quit, then restart it.) If,
however, I have instead missed a way to make the "open" tool wait for
its parent to die before opening the argument, I would very much
appreciate enlightenment on that subject.



Ah, I think you might want to make the parent process a launchd agent  
instead then. I'm not completely familiar with the intricacies of this  
(nor the problem to be solved in general) but it is capable of  
relaunching a process when necessary, and it will also auto-throttle  
the relaunch if the process is being troublesome (i.e. dying over and  
over and over in a short time).

--
David Duncan
Apple DTS Animation and Printing
[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: How to get music list?

2008-08-04 Thread Eric Lee


On Aug 4, 2008, at 3:51 PM, has wrote:


Eric Lee wrote:


I have a problem getting the iTunes list, and then making the
tableview display the iTunes list.



Using objc-appscript [1], here's how to list the name, artist and  
album of every track in the current playlist:



#import "ITGlue/ITGlue.h"

// To create glue files: osaglue  -o ITGlue  -p IT  iTunes

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

	ITApplication *itunes = [ITApplication applicationWithBundleID:  
@"com.apple.itunes"];


ITReference *tracks = [[itunes currentPlaylist] tracks];

/* Note: if player is stopped then current playlist isn't available.
 * You could either test for this in advance (as shown here) or check
 * for nil results after sending the 'get' events. Additional NSError
 * info is also optionally available.
 */
if ([[[tracks exists] send] boolValue]) {

/*
 * Note: Apple event IPC is query-based, allowing you to get a
 * property from all elements at once. This is far quicker than
 * iterating over elements yourself if there are lots of them.
 */
NSArray *names = [[tracks name] getList];
NSArray *artists = [[tracks artist] getList];
NSArray *albums = [[tracks album] getList];

int i;
for (i = 0; i < [names count]; i++)
			printf("%-60s  %-60s  %-60s\n", [[names objectAtIndex: i]  
UTF8String],


[[artists objectAtIndex: i] UTF8String],

[[albums objectAtIndex: i] UTF8String]);

} else
printf("Current playlist is not available.\n");

[pool drain];
return 0;
}


HTH

has

[1] Which is a bit like Scripting Bridge, but without the  
application compatibility problems and with 10.3.9 and 10.4.x  
support, better documentation and developer tools.

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



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Corbin Dunn
If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should work out  
okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add columns  
of descriptive information to an NSTableView - the available columns  
are determined at launch time by loading a dictionary.


In my test app, I can add columns to my table no problem.  Now I am  
trying to decide on a robust and efficient way to make sure that the  
set of columns chosen by the user, and their geometry, is saved when  
quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an array  
of column identifiers and/or value bindings to user preferences, for  
example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The  
autosave info appears to restore the geometry of columns defined in  
the nib file, but it won't force a reload of columns created  
programatically in the last session.  I suspect that the autosave  
file may actually contain the identifiers of all columns displayed  
as of the last application quit, and wonder if there is a way,  
during nib loading, to access this list so I can initialize the table.


I don't like having the same information stored multiple places  
(i.e. my own NSArray in user prefs replicating info that might be  
more complete in the NSTableView autosave file) if I can avoid it,  
but can't seem to find a way to get at all the info in this file.


If anyone has some good examples of how this can be done, or some  
past experience to share on what works well, I'd be very grateful.


___

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

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

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

This email sent to [EMAIL PROTECTED]


"backporting" nibs question / Rhapsody license anyone?

2008-08-04 Thread Lars Sonchocky-Helldorf

Hi everybody,

I got hold of the source code of an ancient OpenStep application for  
Rhapsody DR1/DR2 and Mac OS X Server (that little known version of  
Mac OS X that came without Carbon and predates the Public Beta).


While I got the code itself to compile without relatively few tweaks  
and almost without warnings on OPENSTEP 4.2 (this is the closest to  
Rhapsody I could get hold of), I now have the problems that the nibs  
that came with the code are to "new".
I get an Exception when loading the nibs (regardless if during  
application launch or trying to open the nibs with IB:  
 *** file inconsistency: read '@',  
expecting 'ii'.
I am, however, able to open those nibs with a recent version of IB  
(version 2.5.3 of Mac OS X 10.4), although there seem to be some  
minor troubles with it, IB says there are some unconnected outlets.


- So does anyone on this list know of a way to "backport" nibs to an  
earlier version (besides recreating all the nibs from scratch)?


- Or does someone here still own a copy/license of either Rhapsody  
DR1/DR2 or that ancient Mac OS X Server (without any "10" in it)  
complete with the matching dev tools and wants to sell that copy/ 
license to me? Or maybe somebody knows of a tiny countryside computer  
shack quite behind the times somewhere far off that still offers it?  
That would be really great.



regards,

Lars
___

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

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

2008-08-04 Thread Andy Lee

On Aug 4, 2008, at 1:50 PM, Allison Newman wrote:
In this particular case for example, my searches failed, because I  
was searching on "screensaver" rather than "sleep".  This happens  
quite often when you are coming from a non-OSX environment, such as  
Windows, Linux, Java, whatever - different platforms use different  
terminology for the same thing - you say 'bonjour' and I say  
'zeroconf' type of thing.  Or, as was my case this time, I was  
searching for "screensaver" because it was my screensaver that was  
getting in the way on my own computer, not the sleep function.  I  
got fixated on the wrong word.  I learned an awful lot about  
ScreenSaverView, ScreenSaverDefaults, and how to write my own  
screensaver, but absolutely nothing about how to turn off the system  
screensaver.


Don't Windows and Linux machines sleep too?

Once in a while people post questions here and it turns out they  
weren't searching for the right keywords.  Or they have no idea what  
keywords to search for and are only asking for what they *should*  
search for, and they'll be happy to do their own homework after that.   
I don't think any tool or document can eliminate the occasional need  
for questions like these; at some point you need human beings, who are  
better at figuring out what you mean.  It helps if you have a large  
collection of knowedgeable human beings, like, say, this list.  I  
don't think folks here mind answering these questions as long as the  
poster has shown a good-faith effort to do his or her own homework.


--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: "backporting" nibs question / Rhapsody license anyone?

2008-08-04 Thread Bill Bumgarner

On Aug 4, 2008, at 2:46 PM, Lars Sonchocky-Helldorf wrote:
- So does anyone on this list know of a way to "backport" nibs to an  
earlier version (besides recreating all the nibs from scratch)?


Your problem statement doesn't make sense.  The NIBs don't need to be  
backported.  The problem is that the NIBs contain constructs that no  
longer unarchive correctly -- most likely because the code used to  
unarchive the ancient version of the NIBs compatibility has been  
removed.


Given that the NIB does actually open, your choices are two fold.

The shortest, but most manual labor way, would be to open the NIBs in  
IB, fix up the broken connections, then save it.  That should result  
in a working NIB, with a bit of debugging.


The second way is slightly more indirect.

You'll need to find a copy of Rhapsody DR1 or DR2, Mac OS X Public  
Beta, and -- most likely -- Mac OS X 10.1 or so.   You can then open  
the NIB file in each version, save it in that version, and then move  
on to the next OS Release.  Rinse.  Repeat.  This generally results in  
a working NIB on the modern system.


Unless, of course, the code involves custom IB palettes.  If it does,  
you are going to need to either port those across the systems, making  
the palette available on each interim system, or figure out a way to  
eliminate the palettes altogether on the most ancient OS you can work  
with.


And you might have to write a palette of your own to adjust the NIB  
along the way.  Fortunately, IB has long had a powerful API for  
adjusting the NIB's object graph as it is loaded.  I used it to fix a  
number of issues along a similar path when moving a codebase from NS  
3.3 to Mac OS X 10.2 (Jaguar).


Oh -- one other thing -- with a bit of cajoling, I found it possible  
to run all the various flavors of Mac OS X and OpenStep under Virtual  
PC.  Maybe the same thing will be possible with the modern "emulators".


Have fun,
b.bum

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]

Opening and Saving an RTFD

2008-08-04 Thread Mark Munz
I must be missing something obvious here and I'm hoping someone can
point it out.

When I try to read in an RTFD and then write it back out, I lose the
attachments (images) in the file if I open it up again. I'm using a
filewrapper to write it back out. The images are still in the package,
but they are no longer in the file when opened via TextEdit.

NSFileWrapper* filewrapper = [[NSFileWrapper alloc] initWithPath:path];
NSAttributedString* origFile = [[NSAttributedString alloc]
initWithRTFDFileWrapper:filewrapper
documentAttributes:&docAttributes];
if (origFile)
{
NSAttributedString* newFile = origFile;
if (newFile)
{
NSFileWrapper* newFilewrapper = [newFile 
RTFDFileWrapperFromRange:
  NSMakeRange(0,
[newFile length]) documentAttributes:nil];
[newFilewrapper writeToFile:path atomically:YES 
updateFilenames:YES];
}
}

To rule out any changes I might have made to the attributed string, I
just used the original string and wrote it back to demonstrate the
problem.

Your help is much appreciated. Thanks.

-- 
Mark Munz
unmarked software
http://www.unmarked.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: "backporting" nibs question / Rhapsody license anyone?

2008-08-04 Thread Jonathan Hess
I read the original question to mean that Lars was trying to get the  
NIB's from Rhapsody to run on Open Step. If so, I don't know of anyway  
to do this. It's largely the reason we use NSKeyedArchiver on Mac OS X  
instead of NSArchiver. Generally, we're pretty good about reading old  
binary formatted archives with newer code.


Jon Hess

On Aug 4, 2008, at 2:55 PM, Bill Bumgarner wrote:


On Aug 4, 2008, at 2:46 PM, Lars Sonchocky-Helldorf wrote:
- So does anyone on this list know of a way to "backport" nibs to  
an earlier version (besides recreating all the nibs from scratch)?


Your problem statement doesn't make sense.  The NIBs don't need to  
be backported.  The problem is that the NIBs contain constructs that  
no longer unarchive correctly -- most likely because the code used  
to unarchive the ancient version of the NIBs compatibility has been  
removed.


Given that the NIB does actually open, your choices are two fold.

The shortest, but most manual labor way, would be to open the NIBs  
in IB, fix up the broken connections, then save it.  That should  
result in a working NIB, with a bit of debugging.


The second way is slightly more indirect.

You'll need to find a copy of Rhapsody DR1 or DR2, Mac OS X Public  
Beta, and -- most likely -- Mac OS X 10.1 or so.   You can then open  
the NIB file in each version, save it in that version, and then move  
on to the next OS Release.  Rinse.  Repeat.  This generally results  
in a working NIB on the modern system.


Unless, of course, the code involves custom IB palettes.  If it  
does, you are going to need to either port those across the systems,  
making the palette available on each interim system, or figure out a  
way to eliminate the palettes altogether on the most ancient OS you  
can work with.


And you might have to write a palette of your own to adjust the NIB  
along the way.  Fortunately, IB has long had a powerful API for  
adjusting the NIB's object graph as it is loaded.  I used it to fix  
a number of issues along a similar path when moving a codebase from  
NS 3.3 to Mac OS X 10.2 (Jaguar).


Oh -- one other thing -- with a bit of cajoling, I found it possible  
to run all the various flavors of Mac OS X and OpenStep under  
Virtual PC.  Maybe the same thing will be possible with the modern  
"emulators".


Have fun,
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/jhess%40apple.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDistributedNotifications and scripting languages

2008-08-04 Thread has

Jens Alfke wrote:


I was wondering if anyone had any ideas about sending notifications
to Cocoa applications using either Ruby, or PHP? I want to send
notifications using a cocoa application to another cocoa application
and / or send notifications from a web based application.


Notifications are a general broadcast mechanism, used to announce that  
something of interest has happened when you don't know or care who's  
listening. If you're looking for point-to-point or two-way  
communication, there are other, more suitable, IPC mechanisms for that.




AppleEvents are the standard way to do this. Cocoa's scriptability
APIs make it pretty easy to implement AppleEvent/AppleScript support.
From Ruby you can use the bridge to invoke AppleScript, and from any
language you can launch an AppleScript as a separate task or use the
'osascript' tool to send raw AppleEvents.



If the OP is writing both client and server applications for their own  
use and both are using Cocoa, I'd suggest looking at Distributed  
Objects first. Apple events can be a bear to do well - the main reason  
for using them is if you need to talk to third-party applications, or  
allow third-parties to talk to yours.


Also, I'd strongly recommend Ruby or Python over PHP since the first  
two have excellent and very mature Apple event and Cocoa bindings  
while PHP doesn't have either.


HTH

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Rick Hoge


Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column from  
code, but on next launch it only showed the columns that are defined  
in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should work  
out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add columns  
of descriptive information to an NSTableView - the available  
columns are determined at launch time by loading a dictionary.


In my test app, I can add columns to my table no problem.  Now I am  
trying to decide on a robust and efficient way to make sure that  
the set of columns chosen by the user, and their geometry, is saved  
when quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The  
autosave info appears to restore the geometry of columns defined in  
the nib file, but it won't force a reload of columns created  
programatically in the last session.  I suspect that the autosave  
file may actually contain the identifiers of all columns displayed  
as of the last application quit, and wonder if there is a way,  
during nib loading, to access this list so I can initialize the  
table.


I don't like having the same information stored multiple places  
(i.e. my own NSArray in user prefs replicating info that might be  
more complete in the NSTableView autosave file) if I can avoid it,  
but can't seem to find a way to get at all the info in this file.


If anyone has some good examples of how this can be done, or some  
past experience to share on what works well, I'd be very grateful.




(43092.6825)

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: "backporting" nibs question / Rhapsody license anyone?

2008-08-04 Thread Lars Sonchocky-Helldorf


Am 04.08.2008 um 23:55 schrieb Bill Bumgarner:


On Aug 4, 2008, at 2:46 PM, Lars Sonchocky-Helldorf wrote:
- So does anyone on this list know of a way to "backport" nibs to  
an earlier version (besides recreating all the nibs from scratch)?


Your problem statement doesn't make sense.  The NIBs don't need to  
be backported.


Well, I indeed want to backport it. I forgot to mention that the code  
I got depends on SoundKit - and this is the reason I want at first  
take a step back in time - to predecessor OPENSTEP 4.2, which I got  
from a colleague and then port it slowly over to MusicKit (http:// 
musickit.sourceforge.net/) which has some similarities to SoundKit  
and later eventually to something more modern. My aim is also to keep  
that application compatible to GNUstep so maybe I don't ditch the  
MusicKit dependency to soon.


The problem is that the NIBs contain constructs that no longer  
unarchive correctly -- most likely because the code used to  
unarchive the ancient version of the NIBs compatibility has been  
removed.


Given that the NIB does actually open, your choices are two fold.

The shortest, but most manual labor way, would be to open the NIBs  
in IB, fix up the broken connections, then save it.  That should  
result in a working NIB, with a bit of debugging.


The second way is slightly more indirect.

You'll need to find a copy of Rhapsody DR1 or DR2, Mac OS X Public  
Beta,


I still have the public beta lying around at my shelf, I'd just need  
to install it on my PowerBook Pismo. But my memories fail me at the  
availability of the dev tools on the Public Beta CD-ROM. Were those  
on it or were the dev tools a separate download then?

And: wasn't SoundKit already gone by that time?

and -- most likely -- Mac OS X 10.1 or so.   You can then open the  
NIB file in each version, save it in that version, and then move on  
to the next OS Release.  Rinse.  Repeat.  This generally results in  
a working NIB on the modern system.


Unless, of course, the code involves custom IB palettes.


I don't think so.

If it does, you are going to need to either port those across the  
systems, making the palette available on each interim system, or  
figure out a way to eliminate the palettes altogether on the most  
ancient OS you can work with.


And you might have to write a palette of your own to adjust the NIB  
along the way.  Fortunately, IB has long had a powerful API for  
adjusting the NIB's object graph as it is loaded.  I used it to fix  
a number of issues along a similar path when moving a codebase from  
NS 3.3 to Mac OS X 10.2 (Jaguar).


Oh -- one other thing -- with a bit of cajoling, I found it  
possible to run all the various flavors of Mac OS X and OpenStep  
under Virtual PC.  Maybe the same thing will be possible with the  
modern "emulators".


Have fun,
b.bum___


Thanks for your help,

Lars
___

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

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

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

This email sent to [EMAIL PROTECTED]


Get keystrokes without subclassing NSWindow or NSView

2008-08-04 Thread Mike

I have a simple Cocoa app with one app controller that controls everything.

Inside my controller class I have an NSWindow, which is my main window, 
and a WebView, which in IB, resides in the window.


In my app's controller class I want to be able to:

1) Intercept, inspect, and then forward any keystrokes pressed on the 
keyboard, including character and modifers keys.


2) Detect when any given keystrokes are occurring in an edit field in 
the WebView (some pages will have edit fields, some won't).


Is there an easy way to get both in the controller class without having 
to subclass either my window or the WebView?


Thanks,

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGImageSourceCreateFromURL failed with error -11

2008-08-04 Thread Nicolas Zinovieff


On 04 Aug 2008, at 18:54, David Duncan wrote:

How is CGImageSourceCreateWithURL failing with any error when its  
return value is a CGImageSourceRef and not an OSStatus?


Well, it returns NULL, and prints in the console that it failed with  
error -11... And that takes a very long time to return, too.


--
Zino



___

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

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

2008-08-04 Thread David Duncan

On Aug 4, 2008, at 3:58 PM, Nicolas Zinovieff wrote:


On 04 Aug 2008, at 18:54, David Duncan wrote:

How is CGImageSourceCreateWithURL failing with any error when its  
return value is a CGImageSourceRef and not an OSStatus?


Well, it returns NULL, and prints in the console that it failed with  
error -11... And that takes a very long time to return, too.



What types of images are you trying to load?
--
David Duncan
Apple DTS Animation and Printing
[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: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Corbin Dunn
Are you calling setAutosaveName: yourself? Set it to nil in the nib.  
Then, call it yourself. Before you call it, print out all the table  
columns to see what they are. Then, load your tablecolumns that you  
want (add new ones). Then call setAutosaveName:. Change the  
width of a column in your GUI. This should save out the autosave  
values. Quit your app. Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and save  
panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column from  
code, but on next launch it only showed the columns that are defined  
in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should work  
out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add columns  
of descriptive information to an NSTableView - the available  
columns are determined at launch time by loading a dictionary.


In my test app, I can add columns to my table no problem.  Now I  
am trying to decide on a robust and efficient way to make sure  
that the set of columns chosen by the user, and their geometry, is  
saved when quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The  
autosave info appears to restore the geometry of columns defined  
in the nib file, but it won't force a reload of columns created  
programatically in the last session.  I suspect that the autosave  
file may actually contain the identifiers of all columns displayed  
as of the last application quit, and wonder if there is a way,  
during nib loading, to access this list so I can initialize the  
table.


I don't like having the same information stored multiple places  
(i.e. my own NSArray in user prefs replicating info that might be  
more complete in the NSTableView autosave file) if I can avoid it,  
but can't seem to find a way to get at all the info in this file.


If anyone has some good examples of how this can be done, or some  
past experience to share on what works well, I'd be very grateful.




(43092.6825)



___

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

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

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

This email sent to [EMAIL PROTECTED]


guidelines/tutorial for implementing custom controls

2008-08-04 Thread Rua Haszard Morris
Can anybody point me to some good tutorials/guides for implementing  
custom controls?


I've been reading the Cocoa Event Handling Guide, The reference and  
accompanying conceptual guides for NSControl, NSCell, NSActionCell and  
NSView, but I'm more confused than when I started.


If anyone could answer these more specific questions or point me to  
good reference material I'd really appreciate it:


1. How does one setup the target/action mechanism for a custom  
control, i.e. client code can call setAction: and setTarget: and have  
these stored in the class? Does this come for free when you subclass  
NSActionCell? Or is it more correct to implement these methods  
yourself, in an NSView subclass? Or NSControl subclass?


2. Is wrapping existing controls in a custom control class a good  
idea? I.e. the custom control class is a container for a handful of  
standard controls, configures them in an appropriate way, and presents  
an interface to client code as if it were a single control, i.e. a  
target-action mechanism, and public properties for querying the state  
of the control?


My (current) higher level goal is implementing a control that includes  
3 momentary buttons, the middle button showing a menu when pressed.  
These buttons all edit one piece of data, a ratio. This control needs  
to be invoked (i.e. added to parent view) from code and be reusable.  
The client code needs to be informed when a button is clicked and be  
able to query the control's current value. The new control is  
responsible for the appearance, and the contents of the menu. In  
future I will also need to implement more complex custom controls/ 
views, that include custom drawing and a handful of subcontrols (that  
are all related and present a unified interface to client code).


I've noticed that NSSegmentedControl can implement pretty much all of  
the control, so I think I want to use that internally, implementing  
all the config for the segmented control, and mapping the actions of  
the individual buttons to set the data in the control and invoke the  
custom action (that the client code, the target receives).


Is there a way to achieve this? Am I barking up the wrong tree?

thanks
Rua HM.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Rick Hoge


Hmmm.  Does not seem to be doing it.

I set autoSaveFileName to nil in the nib file, then do the following  
in my code:


1) add the new table columns (addTableColumn: etc.)

2) call setAutosaveName:@"someFile" , call setAutosaveTableColumns:YES

3) manually change width of table column in UI just in case this will  
force an autosave


4) quit app

On next launch, the column I added in step 1 is not there.  Changes to  
width of columns defined in the nib are preserved though.


Also is step 3 really needed to force an autosave?  Ideally the added  
columns would have to be 'remembered' even if the user does not resize  
any...


thanks for the suggestions, though!

Rick

On 4-Aug-08, at 7:05 PM, Corbin Dunn wrote:

Are you calling setAutosaveName: yourself? Set it to nil in the nib.  
Then, call it yourself. Before you call it, print out all the table  
columns to see what they are. Then, load your tablecolumns that you  
want (add new ones). Then call setAutosaveName:. Change  
the width of a column in your GUI. This should save out the autosave  
values. Quit your app. Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and save  
panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column from  
code, but on next launch it only showed the columns that are  
defined in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should work  
out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add  
columns of descriptive information to an NSTableView - the  
available columns are determined at launch time by loading a  
dictionary.


In my test app, I can add columns to my table no problem.  Now I  
am trying to decide on a robust and efficient way to make sure  
that the set of columns chosen by the user, and their geometry,  
is saved when quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The  
autosave info appears to restore the geometry of columns defined  
in the nib file, but it won't force a reload of columns created  
programatically in the last session.  I suspect that the autosave  
file may actually contain the identifiers of all columns  
displayed as of the last application quit, and wonder if there is  
a way, during nib loading, to access this list so I can  
initialize the table.


I don't like having the same information stored multiple places  
(i.e. my own NSArray in user prefs replicating info that might be  
more complete in the NSTableView autosave file) if I can avoid  
it, but can't seem to find a way to get at all the info in this  
file.


If anyone has some good examples of how this can be done, or some  
past experience to share on what works well, I'd be very grateful.




(43092.6825)





(43092.6825)

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Corbin Dunn

On Aug 4, 2008, at 4:32 PM, Rick Hoge wrote:



Hmmm.  Does not seem to be doing it.


Unfortunately, I'm out of ideas; these were mainly off the top of my  
head. Without seeing your specific source code, I can't offer any more  
suggestions -- it is quite possible something else is wrong (ie: the  
identifier isn't set). You probably want to debug the app to find out  
why/when your columns are being removed, and go from there. You can  
try breaking on the internal tableview methods,  
_readPersistentTableColumns and _writePersistentTableColumns, however,  
these methods are purely internal, and may be removed in future  
releases. In other words, don't call them or override them.


You are correct, step #3 shouldn't be required.

If all else fails, you may have to hand-roll a solution where you  
don't use the tableview logic, and store out the widths/table columns  
yourself.


-corbin





I set autoSaveFileName to nil in the nib file, then do the following  
in my code:


1) add the new table columns (addTableColumn: etc.)

2) call setAutosaveName:@"someFile" , call setAutosaveTableColumns:YES

3) manually change width of table column in UI just in case this  
will force an autosave


4) quit app

On next launch, the column I added in step 1 is not there.  Changes  
to width of columns defined in the nib are preserved though.


Also is step 3 really needed to force an autosave?  Ideally the  
added columns would have to be 'remembered' even if the user does  
not resize any...


thanks for the suggestions, though!

Rick

On 4-Aug-08, at 7:05 PM, Corbin Dunn wrote:

Are you calling setAutosaveName: yourself? Set it to nil in the  
nib. Then, call it yourself. Before you call it, print out all the  
table columns to see what they are. Then, load your tablecolumns  
that you want (add new ones). Then call  
setAutosaveName:. Change the width of a column in your  
GUI. This should save out the autosave values. Quit your app.  
Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and save  
panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column  
from code, but on next launch it only showed the columns that are  
defined in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should  
work out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add  
columns of descriptive information to an NSTableView - the  
available columns are determined at launch time by loading a  
dictionary.


In my test app, I can add columns to my table no problem.  Now I  
am trying to decide on a robust and efficient way to make sure  
that the set of columns chosen by the user, and their geometry,  
is saved when quitting the app and restored at the next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout information under  
Leopard through the framework, and this appears to work.  The  
autosave info appears to restore the geometry of columns defined  
in the nib file, but it won't force a reload of columns created  
programatically in the last session.  I suspect that the  
autosave file may actually contain the identifiers of all  
columns displayed as of the last application quit, and wonder if  
there is a way, during nib loading, to access this list so I can  
initialize the table.


I don't like having the same information stored multiple places  
(i.e. my own NSArray in user prefs replicating info that might  
be more complete in the NSTableView autosave file) if I can  
avoid it, but can't seem to find a way to get at all the info in  
this file.


If anyone has some good examples of how this can be done, or  
some past experience to share on what works well, I'd be very  
grateful.




(43092.6825)





(43092.6825)



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.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: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Rick Hoge




Hmmm.  Does not seem to be doing it.


Unfortunately, I'm out of ideas; these were mainly off the top of my  
head. Without seeing your specific source code, I can't offer any  
more suggestions -- it is quite possible something else is wrong  
(ie: the identifier isn't set). You probably want to debug the app  
to find out why/when your columns are being removed, and go from  
there. You can try breaking on the internal tableview methods,  
_readPersistentTableColumns and _writePersistentTableColumns,  
however, these methods are purely internal, and may be removed in  
future releases. In other words, don't call them or override them.


Thanks anyway -

Of course it never hurts to actually show some code (in case this  
might prompt an idea).


This is a test method that adds a column and then sets the autosave  
info - I wouldn't actually use it this way, but for testing it does  
the steps in the suggested order.


-(IBAction)addTableColumnTest:(id)sender {

  // documentTable is an IBOutlet
  // autoSaveTableName:  is empty in the nib

  // Get existing column to copy some formatting info
  NSTableColumn *prototypeColumn = [[documentTable tableColumns]  
lastObject];


  //  Create and add the new column
  NSTableColumn *newColumn = [[NSTableColumn alloc]  
initWithIdentifier:@"comments"]; // app is GC
  [[newColumn headerCell] setStringValue:@"Comments"]; // Assign  
header text
  [[newColumn dataCell] setFont:[[prototypeColumn dataCell]  
font]]; // Copy font from existing table column
  [newColumn bind:@"value" toObject:documentArrayController  
withKeyPath:@"arrangedObjects.comments" options:nil];

  [documentTable addTableColumn:newColumn];

  // Set the autoSave info
  [documentTable setAutosaveTableColumns:YES];
  [documentTable setAutosaveName:@"MyDocTableInfo"];

}






You are correct, step #3 shouldn't be required.

If all else fails, you may have to hand-roll a solution where you  
don't use the tableview logic, and store out the widths/table  
columns yourself.


-corbin





I set autoSaveFileName to nil in the nib file, then do the  
following in my code:


1) add the new table columns (addTableColumn: etc.)

2) call setAutosaveName:@"someFile" , call  
setAutosaveTableColumns:YES


3) manually change width of table column in UI just in case this  
will force an autosave


4) quit app

On next launch, the column I added in step 1 is not there.  Changes  
to width of columns defined in the nib are preserved though.


Also is step 3 really needed to force an autosave?  Ideally the  
added columns would have to be 'remembered' even if the user does  
not resize any...


thanks for the suggestions, though!

Rick

On 4-Aug-08, at 7:05 PM, Corbin Dunn wrote:

Are you calling setAutosaveName: yourself? Set it to nil in the  
nib. Then, call it yourself. Before you call it, print out all the  
table columns to see what they are. Then, load your tablecolumns  
that you want (add new ones). Then call  
setAutosaveName:. Change the width of a column in your  
GUI. This should save out the autosave values. Quit your app.  
Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and save  
panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column  
from code, but on next launch it only showed the columns that are  
defined in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should  
work out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add  
columns of descriptive information to an NSTableView - the  
available columns are determined at launch time by loading a  
dictionary.


In my test app, I can add columns to my table no problem.  Now  
I am trying to decide on a robust and efficient way to make  
sure that the set of columns chosen by the user, and their  
geometry, is saved when quitting the app and restored at the  
next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout information  
under Leopard through the framework, and this appears to work.   
The autosave info appears to restore the geometry of columns  
defined in the nib file, but it won't force a reload of columns  
created programatically in the last session.  I suspect that  
the autosave file may actually contain the identifiers of all  
columns displayed as of the last application quit, and wonder  
if there is a way, during nib loading, to access this list so I  
can initialize the table.


I don't like having the same information stored multiple places  
(i.e. my ow

Re: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Corbin Dunn
Also, let me step back for a moment and recommend another approach.  
Ideally, if you know all possible permutations of the columns that the  
user could ever want, then just add them all at design time in the  
nib, and hide (setHidden:YES) the ones you initially want hidden.  
Then, add a pop on the header to hide/unhiden individual columns. That  
is the ideal way to do this. Granted, I realize all table columns  
can't always be known at design time (ie: populating them from a SQL  
database, or whatever other logic).


corbin

On Aug 4, 2008, at 5:31 PM, Rick Hoge wrote:





Hmmm.  Does not seem to be doing it.


Unfortunately, I'm out of ideas; these were mainly off the top of  
my head. Without seeing your specific source code, I can't offer  
any more suggestions -- it is quite possible something else is  
wrong (ie: the identifier isn't set). You probably want to debug  
the app to find out why/when your columns are being removed, and go  
from there. You can try breaking on the internal tableview methods,  
_readPersistentTableColumns and _writePersistentTableColumns,  
however, these methods are purely internal, and may be removed in  
future releases. In other words, don't call them or override them.


Thanks anyway -

Of course it never hurts to actually show some code (in case this  
might prompt an idea).


This is a test method that adds a column and then sets the autosave  
info - I wouldn't actually use it this way, but for testing it does  
the steps in the suggested order.


-(IBAction)addTableColumnTest:(id)sender {

 // documentTable is an IBOutlet
 // autoSaveTableName:  is empty in the nib

 // Get existing column to copy some formatting info
 NSTableColumn *prototypeColumn = [[documentTable tableColumns]  
lastObject];


 //  Create and add the new column
 NSTableColumn *newColumn = [[NSTableColumn alloc]  
initWithIdentifier:@"comments"]; // app is GC
 [[newColumn headerCell] setStringValue:@"Comments"]; // Assign  
header text
 [[newColumn dataCell] setFont:[[prototypeColumn dataCell]  
font]]; // Copy font from existing table column
 [newColumn bind:@"value" toObject:documentArrayController  
withKeyPath:@"arrangedObjects.comments" options:nil];

 [documentTable addTableColumn:newColumn];

 // Set the autoSave info
 [documentTable setAutosaveTableColumns:YES];
 [documentTable setAutosaveName:@"MyDocTableInfo"];

}






You are correct, step #3 shouldn't be required.

If all else fails, you may have to hand-roll a solution where you  
don't use the tableview logic, and store out the widths/table  
columns yourself.


-corbin





I set autoSaveFileName to nil in the nib file, then do the  
following in my code:


1) add the new table columns (addTableColumn: etc.)

2) call setAutosaveName:@"someFile" , call  
setAutosaveTableColumns:YES


3) manually change width of table column in UI just in case this  
will force an autosave


4) quit app

On next launch, the column I added in step 1 is not there.   
Changes to width of columns defined in the nib are preserved though.


Also is step 3 really needed to force an autosave?  Ideally the  
added columns would have to be 'remembered' even if the user does  
not resize any...


thanks for the suggestions, though!

Rick

On 4-Aug-08, at 7:05 PM, Corbin Dunn wrote:

Are you calling setAutosaveName: yourself? Set it to nil in the  
nib. Then, call it yourself. Before you call it, print out all  
the table columns to see what they are. Then, load your  
tablecolumns that you want (add new ones). Then call  
setAutosaveName:. Change the width of a column in your  
GUI. This should save out the autosave values. Quit your app.  
Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and  
save panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column  
from code, but on next launch it only showed the columns that  
are defined in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before calling  
setAutosaveName:, or setAutosaveTableColumns:, then it should  
work out okay; it will restore all of the widths, positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add  
columns of descriptive information to an NSTableView - the  
available columns are determined at launch time by loading a  
dictionary.


In my test app, I can add columns to my table no problem.  Now  
I am trying to decide on a robust and efficient way to make  
sure that the set of columns chosen by the user, and their  
geometry, is saved when quitting the app and restored at the  
next launch.


I can think of a number of brute force ways to do it - save an  
array of column identifiers and/or value bindings to user  
preferences, for example.


I know it's possible to autosave column layout 

Re: Automatic population of NSTableView with custom columns at launch time

2008-08-04 Thread Rick Hoge


Also, let me step back for a moment and recommend another approach.  
Ideally, if you know all possible permutations of the columns that  
the user could ever want, then just add them all at design time in  
the nib, and hide (setHidden:YES) the ones you initially want  
hidden. Then, add a pop on the header to hide/unhiden individual  
columns. That is the ideal way to do this. Granted, I realize all  
table columns can't always be known at design time (ie: populating  
them from a SQL database, or whatever other logic).


I'd seen mention of the fact that it's better to define 'known'  
columns in the nib and use hide/unhide to control display - thanks for  
confirming that this is indeed a recommended practice.


Unfortunately I have a combination of known columns (comments, path)  
and other stuff that isn't known until launch time (a dictionary is  
loaded and could have hundreds of possible pieces of information, of  
which a user would typically select some small number).


So I'm stuck supporting at least part of the table structure  
programatically.


Rick




corbin

On Aug 4, 2008, at 5:31 PM, Rick Hoge wrote:





Hmmm.  Does not seem to be doing it.


Unfortunately, I'm out of ideas; these were mainly off the top of  
my head. Without seeing your specific source code, I can't offer  
any more suggestions -- it is quite possible something else is  
wrong (ie: the identifier isn't set). You probably want to debug  
the app to find out why/when your columns are being removed, and  
go from there. You can try breaking on the internal tableview  
methods, _readPersistentTableColumns and  
_writePersistentTableColumns, however, these methods are purely  
internal, and may be removed in future releases. In other words,  
don't call them or override them.


Thanks anyway -

Of course it never hurts to actually show some code (in case this  
might prompt an idea).


This is a test method that adds a column and then sets the autosave  
info - I wouldn't actually use it this way, but for testing it does  
the steps in the suggested order.


-(IBAction)addTableColumnTest:(id)sender {

// documentTable is an IBOutlet
// autoSaveTableName:  is empty in the nib

// Get existing column to copy some formatting info
NSTableColumn *prototypeColumn = [[documentTable tableColumns]  
lastObject];


//  Create and add the new column
NSTableColumn *newColumn = [[NSTableColumn alloc]  
initWithIdentifier:@"comments"]; // app is GC
[[newColumn headerCell] setStringValue:@"Comments"]; // Assign  
header text
[[newColumn dataCell] setFont:[[prototypeColumn dataCell]  
font]]; // Copy font from existing table column
[newColumn bind:@"value" toObject:documentArrayController  
withKeyPath:@"arrangedObjects.comments" options:nil];

[documentTable addTableColumn:newColumn];

// Set the autoSave info
[documentTable setAutosaveTableColumns:YES];
[documentTable setAutosaveName:@"MyDocTableInfo"];

}






You are correct, step #3 shouldn't be required.

If all else fails, you may have to hand-roll a solution where you  
don't use the tableview logic, and store out the widths/table  
columns yourself.


-corbin





I set autoSaveFileName to nil in the nib file, then do the  
following in my code:


1) add the new table columns (addTableColumn: etc.)

2) call setAutosaveName:@"someFile" , call  
setAutosaveTableColumns:YES


3) manually change width of table column in UI just in case this  
will force an autosave


4) quit app

On next launch, the column I added in step 1 is not there.   
Changes to width of columns defined in the nib are preserved  
though.


Also is step 3 really needed to force an autosave?  Ideally the  
added columns would have to be 'remembered' even if the user does  
not resize any...


thanks for the suggestions, though!

Rick

On 4-Aug-08, at 7:05 PM, Corbin Dunn wrote:

Are you calling setAutosaveName: yourself? Set it to nil in the  
nib. Then, call it yourself. Before you call it, print out all  
the table columns to see what they are. Then, load your  
tablecolumns that you want (add new ones). Then call  
setAutosaveName:. Change the width of a column in  
your GUI. This should save out the autosave values. Quit your  
app. Restart it. Are the columns restored?


This pattern should work; I use it internally in the open and  
save panel.


corbin

On Aug 4, 2008, at 3:36 PM, Rick Hoge wrote:



Thanks for the suggestion -

I tried calling setAutosaveTableColumns: after adding a column  
from code, but on next launch it only showed the columns that  
are defined in the nib with IB.


Rick

On 4-Aug-08, at 5:39 PM, Corbin Dunn wrote:

If you add all the columns (and remove old ones) before  
calling setAutosaveName:, or setAutosaveTableColumns:, then it  
should work out okay; it will restore all of the widths,  
positions, etc.


corbin

On Aug 4, 2008, at 2:03 PM, Rick Hoge wrote:



I'm working on an application that will allow users to add  
columns of descriptive information to an NSTableView

Re: CoreFoundation Command Line Tool - an easy beginner question

2008-08-04 Thread Michael Ash
On Mon, Aug 4, 2008 at 5:19 PM, David Duncan <[EMAIL PROTECTED]> wrote:
> On Aug 4, 2008, at 2:00 PM, Michael Ash wrote:
>
>> I think you may have missed the read() at the beginning of the
>> function, which is critical to the operation of the tool. (The purpose
>> is to wait for the parent process to quit, then restart it.) If,
>> however, I have instead missed a way to make the "open" tool wait for
>> its parent to die before opening the argument, I would very much
>> appreciate enlightenment on that subject.
>
>
> Ah, I think you might want to make the parent process a launchd agent
> instead then. I'm not completely familiar with the intricacies of this (nor
> the problem to be solved in general) but it is capable of relaunching a
> process when necessary, and it will also auto-throttle the relaunch if the
> process is being troublesome (i.e. dying over and over and over in a short
> time).

The scenario I've used it for is for an auto-updating application.
After the new version is put in place, the app needs to restart
itself. The best way to do it that I've found is to spawn a small
subprocess doing something like what this code does, then terminate.
The subprocess then relaunches, and terminates as well. It's not meant
to keep the app running all the time, just manage a single restart, so
it's not quite the same thing that launchd would handle.

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: guidelines/tutorial for implementing custom controls

2008-08-04 Thread Erik Buck

Can anybody point me to some good tutorials/guides for implementing
custom controls?


Do you have some objection to the examples at developer.apple.com ?
http://developer.apple.com/samplecode/Clock_Control/index.html
http://developer.apple.com/samplecode/TrackBall/
http://developer.apple.com/samplecode/bMoviePalette/index.html

There are some fun third party samples:
http://www.sticksoftware.com/software/CircularSlider.html
http://developer.snowmintcs.com/controls/smdoubleslider/index.html
http://www.stepwise.com/Articles/Technical/NSCell.html

See also Omni Group
http://www.omnigroup.com/developer/

There are some custom controls in the DrawDemo for DrawKit
http://apptree.net/drawkit.htm




I've been reading the Cocoa Event Handling Guide, The reference and
accompanying conceptual guides for NSControl, NSCell, NSActionCell and
NSView, but I'm more confused than when I started.

Odd.  Those are relevant documents.



If anyone could answer these more specific questions or point me to
good reference material I'd really appreciate it:

1. How does one setup the target/action mechanism for a custom
control, i.e. client code can call setAction: and setTarget: and have
these stored in the class? Does this come for free when you subclass
NSActionCell? Or is it more correct to implement these methods
yourself, in an NSView subclass? Or NSControl subclass?
Subclasses of NSControl already have target/action support and can be  
connected via Interface Builder.  You can also use NSActionCell  
without NSControl but won't automatically get Interface Builder  
interaction.  Target action is also easy to implement on your own via  
NSApplication's - (BOOL)sendAction:(SEL)anAction to:(id)aTarget from: 
(id)sender method.





2. Is wrapping existing controls in a custom control class a good
idea? I.e. the custom control class is a container for a handful of
standard controls, configures them in an appropriate way, and presents
an interface to client code as if it were a single control, i.e. a
target-action mechanism, and public properties for querying the state
of the control?

I guess that would work.  Why would you want to do that ?




My (current) higher level goal is implementing a control that includes
3 momentary buttons, the middle button showing a menu when pressed.
These buttons all edit one piece of data, a ratio. This control needs
to be invoked (i.e. added to parent view) from code and be reusable.
The client code needs to be informed when a button is clicked and be
able to query the control's current value. The new control is
responsible for the appearance, and the contents of the menu. In
future I will also need to implement more complex custom controls/
views, that include custom drawing and a handful of subcontrols (that
are all related and present a unified interface to client code).
I don't think you need a custom control to meet any of your goals.   
Just embed your buttons etc. in a convenient parent view and provide  
suitable Controller logic (ref: Model View Controller).  You can save  
your embedded views in their own interface builder nib file for reuse  
or even add your pre-configured group of objects to Interface  
Builder's library. See "Adding Modified Objects Back to the Library"  
In Interface Builder's help.


You will need to subclass NSView or one of its existing subclasses  
when you want custom drawing unless you use CALayer's instead.





I've noticed that NSSegmentedControl can implement pretty much all of
the control, so I think I want to use that internally, implementing
all the config for the segmented control, and mapping the actions of
the individual buttons to set the data in the control and invoke the
custom action (that the client code, the target receives).

Is there a way to achieve this? Am I barking up the wrong tree?

I think what you are suggesting is workable.  Have you tried it ?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: guidelines/tutorial for implementing custom controls

2008-08-04 Thread Rua Haszard Morris

Can anybody point me to some good tutorials/guides for implementing
custom controls?


Do you have some objection to the examples at developer.apple.com ?
http://developer.apple.com/samplecode/Clock_Control/index.html
http://developer.apple.com/samplecode/TrackBall/
http://developer.apple.com/samplecode/bMoviePalette/index.html

There are some fun third party samples:
http://www.sticksoftware.com/software/CircularSlider.html
http://developer.snowmintcs.com/controls/smdoubleslider/index.html
http://www.stepwise.com/Articles/Technical/NSCell.html

See also Omni Group
http://www.omnigroup.com/developer/

There are some custom controls in the DrawDemo for DrawKit
http://apptree.net/drawkit.htm
Thanks for the links, of those I had only consulted Clock_Control,  
which seemed too out of date to bother with (it was a .pbproj). I'll  
have a look at the other links, thanks.



1. How does one setup the target/action mechanism for a custom
control, i.e. client code can call setAction: and setTarget: and have
these stored in the class? ...
Subclasses of NSControl already have target/action support and can  
be connected via Interface Builder.  You can also use NSActionCell  
without NSControl but won't automatically get Interface Builder  
interaction.  Target action is also easy to implement on your own  
via NSApplication's - (BOOL)sendAction:(SEL)anAction to:(id)aTarget  
from:(id)sender method.
I wasn't able to get it to work (from code, not from IB, the  
target&action connection has to be made from code for my situation);  
when I called setTarget and setAction in the client code on an  
instance of my NSControl subclass, and queried the target and action,  
they were nil/nullselector.


I did work out how to solve this though: implement (override)  
+cellClass for my custom control class, and return NSActionCell. Then  
I get target-action for free. This made sense, and indicated I did  
learn something when reading the docs :)



2. Is wrapping existing controls in a custom control class a good
idea? 

I guess that would work.  Why would you want to do that ?
Well, because it seems that it may be a convenient and standard  
approach - is it? Or is it flawed and doomed to failure? Or just  
inelegant?


My (current) higher level goal is implementing a control that  
includes

3 momentary buttons, the middle button showing a menu when pressed.
...
I don't think you need a custom control to meet any of your goals.   
Just embed your buttons etc. in a convenient parent view and provide  
suitable Controller logic (ref: Model View Controller).  You can  
save your embedded views in their own interface builder nib file for  
reuse or even add your pre-configured group of objects to Interface  
Builder's library. See "Adding Modified Objects Back to the Library"  
In Interface Builder's help.


You will need to subclass NSView or one of its existing subclasses  
when you want custom drawing unless you use CALayer's instead.\
This is a valid point - that I am actually implementing a custom view  
rather than control. I may in future take this approach for more  
complex controls/views, but from code rather than in IB (these  
controls/views are instantiated from cross-platform code).



I've noticed that NSSegmentedControl can implement pretty much all of
the control, so I think I want to use that internally, implementing
all the config for the segmented control, and mapping the actions of
the individual buttons to set the data in the control and invoke the
custom action (that the client code, the target receives).

Is there a way to achieve this? Am I barking up the wrong tree?

I think what you are suggesting is workable.  Have you tried it ?
Yep, it was perfect, except for the fact that the appearance I needed  
was 10.5+ (I need to support 10.4+), and I didn't have a solution for  
abstracting away the actions for the menu and buttons so the client  
just saw a unified "value has changed" type action.


What I am looking at now, and it seems appropriate and workable, is  
subclassing NSControl, setting my class' cellClass to NSActionCell,  
instantiating and configuring NSButtons, the menu etc appropriately  
and handling their actions internally, dispatching the custom  
control's action when appropriate so the client code is notified.


I'm still pondering whether I should be instantiating NSButtons, or  
NSButtonCells in the NSControl subclass, and if I should be splitting  
some of that logic into an NSActionCell subclass, but I guess until I  
have a reason to do so there's no need...


I guess what I'm looking for is a "when to subclass NSView vs.  
NSControl vs. NSCell" guide, it seems there must be some rules of  
thumb. I.e. NSView => if you need to draw. NSControl => when you need  
target/action (remember to implement +cellClass:). NSCell => when you  
need to reuse your control draw etc logic for NSMatrix, table view  
etc. And then how to correctly set up the link with your NSControl and  
NSCe

Re: Opening and Saving an RTFD

2008-08-04 Thread chaitanya pandit

Hi,
I'm not sure what exactly you are trying to do but i believe you need  
to create a NSTextAttachment from the file wrapper and then generate  
an attributed string out of it.


NSFileWrapper* filewrapper = [[NSFileWrapper alloc] initWithPath:path];
NSTextAttachment *attachment = [[[NSTextAttachment alloc]  
initWithFileWrapper:filewrapper]autorelease];
NSAttributedString* origFile = [NSAttributedString  
attributedStringWithAttachment:attachment];
NSData *data = [origFile RTFDFromRange:NSMakeRange(0, [origFile  
length]) documentAttributes:nil];
[[NSFileManager defaultManager] createFileAtPath:path contents:data  
attributes:nil];


If  you just want to create an attributed string from RTFD data you  
can use NSAttributedString's AppKit addition method :
- (id)initWithPath:(NSString *)path documentAttributes:(NSDictionary  
**)docAttributes


Then if you want to write it back, you can do the same  by:

NSData *data = [origFile RTFDFromRange:NSMakeRange(0, [origFile  
length]) documentAttributes:nil];
[[NSFileManager defaultManager] createFileAtPath:path contents:data  
attributes:nil];


Hope this helps.
- Chaitanya

On 04-Aug-08, at 6:03 PM, Mark Munz wrote:


I must be missing something obvious here and I'm hoping someone can
point it out.

When I try to read in an RTFD and then write it back out, I lose the
attachments (images) in the file if I open it up again. I'm using a
filewrapper to write it back out. The images are still in the package,
but they are no longer in the file when opened via TextEdit.

NSFileWrapper* filewrapper = [[NSFileWrapper alloc]  
initWithPath:path];

NSAttributedString* origFile = [[NSAttributedString alloc]
initWithRTFDFileWrapper:filewrapper
documentAttributes:&docAttributes];
if (origFile)
{
NSAttributedString* newFile = origFile;
if (newFile)
{
NSFileWrapper* newFilewrapper = [newFile 
RTFDFileWrapperFromRange:
 NSMakeRange(0,
[newFile length]) documentAttributes:nil];
		[newFilewrapper writeToFile:path atomically:YES  
updateFilenames:YES];

}
}

To rule out any changes I might have made to the attributed string, I
just used the original string and wrote it back to demonstrate the
problem.

Your help is much appreciated. Thanks.

--
Mark Munz
unmarked software
http://www.unmarked.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/chaitanya%40expersis.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: "backporting" nibs question / Rhapsody license anyone?

2008-08-04 Thread Bill Bumgarner

On Aug 4, 2008, at 3:41 PM, Lars Sonchocky-Helldorf wrote:

Am 04.08.2008 um 23:55 schrieb Bill Bumgarner:

On Aug 4, 2008, at 2:46 PM, Lars Sonchocky-Helldorf wrote:
- So does anyone on this list know of a way to "backport" nibs to  
an earlier version (besides recreating all the nibs from scratch)?


Your problem statement doesn't make sense.  The NIBs don't need to  
be backported.


Well, I indeed want to backport it. I forgot to mention that the  
code I got depends on SoundKit - and this is the reason I want at  
first take a step back in time - to predecessor OPENSTEP 4.2, which  
I got from a colleague and then port it slowly over to MusicKit (http://musickit.sourceforge.net/ 
) which has some similarities to SoundKit and later eventually to  
something more modern. My aim is also to keep that application  
compatible to GNUstep so maybe I don't ditch the MusicKit dependency  
to soon.


Bahh.. sorry -- I misread the original post and, as Jon indicated,  
backporting the NIBs from a later version to an earlier version will  
be exceedingly difficult.


b.bum



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]

Properties and memory management

2008-08-04 Thread Mike Manzano

Hi,

Sorry about this cross-post, but the obj-c language list seems sort of  
dead.


If I have a property:

@property( retain ) NSString *blah ;

and in my code I assign it:

myObj.blah = @"woot!" ;

and then I want to reassign it, do I have to release it?

[myObj.blah release] ;
myObj.blah = @"new woot!" ;

or does the new assignment automatically release the retain? How about  
for


@property( copy ) NSString *blah ;

Do I have to release the copy?

Thanks,

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Properties and memory management

2008-08-04 Thread Jonathan Hess

Hey Mike -

The implementation of the property will manage the retaining and the  
releasing. You only need to worry about sending retain and release  
messages manually if you access the instance variable directly (not  
through a property). The only place you would typically need to do  
that would be in your dealloc method.


Jon Hess

On Aug 4, 2008, at 8:51 PM, Mike Manzano wrote:


Hi,

Sorry about this cross-post, but the obj-c language list seems sort  
of dead.


If I have a property:

@property( retain ) NSString *blah ;

and in my code I assign it:

myObj.blah = @"woot!" ;

and then I want to reassign it, do I have to release it?

[myObj.blah release] ;
myObj.blah = @"new woot!" ;

or does the new assignment automatically release the retain? How  
about for


@property( copy ) NSString *blah ;

Do I have to release the copy?

Thanks,

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


[SOLVED[ Re: Properties and memory management

2008-08-04 Thread Mike Manzano
Thanks! For some reason I was finding it extremely hard to find the  
answer in the docs.


Mike

On Aug 4, 2008, at 8:55 PM, Jonathan Hess wrote:


Hey Mike -

The implementation of the property will manage the retaining and the  
releasing. You only need to worry about sending retain and release  
messages manually if you access the instance variable directly (not  
through a property). The only place you would typically need to do  
that would be in your dealloc method.


Jon Hess

On Aug 4, 2008, at 8:51 PM, Mike Manzano wrote:


Hi,

Sorry about this cross-post, but the obj-c language list seems sort  
of dead.


If I have a property:

@property( retain ) NSString *blah ;

and in my code I assign it:

myObj.blah = @"woot!" ;

and then I want to reassign it, do I have to release it?

[myObj.blah release] ;
myObj.blah = @"new woot!" ;

or does the new assignment automatically release the retain? How  
about for


@property( copy ) NSString *blah ;

Do I have to release the copy?

Thanks,

Mike
___

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

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

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

This email sent to [EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


[Moderator] - List Guidelines and iPhone SDK NDA status

2008-08-04 Thread CocoaDev Admins

Moderation
--

Due to circumstances, newly subscribed users are currently moderated.  
Once a message or two has been posted and approved, the moderation is  
lifted. Hopefully this will be a temporary issue.


On August 5,6, and 7 postings that require more than simple approval  
may be delayed. Sorry for the inconvenience.



iPhone SDK
--

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


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


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



Xcode 3.1
-

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


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


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


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



SnowLeopard NDA
===

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




Discussing Private API
==

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



Please stay on-topic


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


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


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

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

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

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

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


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


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


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




Other mailing lists
===

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

in particular see:
Xcode-users: 

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


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




List etiquette
==

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


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

Re: Opening and Saving an RTFD [Solved]

2008-08-04 Thread Mark Munz
It turns out that my code was working correctly. The bug was in
another part of the app.

The problem actually was in use of NSDirectoryEnumerator (via
enumeratorAtPath) which was traversing into packages. So the code
found the RTF file inside the package, which is read in and wrote out,
stripping off the attachments in the process.

A thanks to those folks that offered up some additional options to
help me track down the problem.


On Mon, Aug 4, 2008 at 3:03 PM, Mark Munz <[EMAIL PROTECTED]> wrote:
> I must be missing something obvious here and I'm hoping someone can
> point it out.
>
> When I try to read in an RTFD and then write it back out, I lose the
> attachments (images) in the file if I open it up again. I'm using a
> filewrapper to write it back out. The images are still in the package,
> but they are no longer in the file when opened via TextEdit.
>
> NSFileWrapper* filewrapper = [[NSFileWrapper alloc] initWithPath:path];
> NSAttributedString* origFile = [[NSAttributedString alloc]
> initWithRTFDFileWrapper:filewrapper
> documentAttributes:&docAttributes];
> if (origFile)
> {
>NSAttributedString* newFile = origFile;
>if (newFile)
>{
>NSFileWrapper* newFilewrapper = [newFile 
> RTFDFileWrapperFromRange:
>  NSMakeRange(0,
> [newFile length]) documentAttributes:nil];
>[newFilewrapper writeToFile:path atomically:YES 
> updateFilenames:YES];
>}
> }
>
> To rule out any changes I might have made to the attributed string, I
> just used the original string and wrote it back to demonstrate the
> problem.
>
> Your help is much appreciated. Thanks.
>
> --
> Mark Munz
> unmarked software
> http://www.unmarked.com/
>



-- 
Mark Munz
unmarked software
http://www.unmarked.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]


Colour of Symlink

2008-08-04 Thread Gerriet M. Denkmann
I want to get the colour of a symlink (NOT the colour of the thing  
the symlinks points at).

Is there a Cocoa way to get this?

Currently I am using FSPathMakeRef (or CFURLGetFSRef) to get an  
FSRef, and then FSGetCatalogInfo to get the colour.


But both FSPathMakeRef and CFURLGetFSRef seem to follow through  
symlinks (not aliases though).
So I always get the colour of the destination (or an error if the  
symlink is broken).


How can I get the colour of my symlink?

Kind regards,

Gerriet.

___

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

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

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

This email sent to [EMAIL PROTECTED]


File's Owner problems

2008-08-04 Thread Chris Idou
I've got a class, let's call it Foo, that loads a NIB called "Bar". In IB, the 
File's owner of Bar is set to class Foo. When Foo loads Bar, passing self as 
the file's owner, Foo.awakeFromNib gets called during the nib loading process.

Is that meant to happen? It doesn't make sense to me.





  
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDocumentController openDocumentWithContentsOfURL

2008-08-04 Thread Mark Munz
Under 10.5, I'm trying to switch over to using UTI's but am seeing
some weird results:

Given a pathName: if I call NSWorkspaces' typeOfFile:pathName
error:&error, it returns the proper type (com.apple.rtfd) for an RTFD
document.

But when I then create an NSURL of the path and pass that URL to
NSDocumentController's openDocumentWithContentsOfURL, it determines
the document type to be MSWORD which fails because it tries using
initWithDocFormat to load the document.

The RTFD document was created in TextEdit. I have an MSWORD type in my
CFBundleDocumentTypes, but there is no LSItemContentTypes defined for
it. Here are the two entries for these types.

Is there a reason why openDocumentWithContentsOfURL would somehow
override the type when compared with NSWorkspaces' typeOfFile? I'm
trying to understand what it is doing so I can take the right measures
to correct it.


CFBundleTypeExtensions

rtfd

CFBundleTypeIconFile
rtfd.icns
CFBundleTypeName
RTFD
CFBundleTypeOSTypes

RTFD

CFBundleTypeRole
Editor
LSItemContentTypes

com.apple.rtfd

LSTypeIsPackage

NSDocumentClass
RTFDocument
NSPersistentStoreTypeKey
Binary



CFBundleTypeExtensions

doc

CFBundleTypeName
MSWORD
CFBundleTypeOSTypes

W8BN
W6BN

CFBundleTypeRole
Viewer
NSDocumentClass
RTFDocument



Thanks.

-- 
Mark Munz
unmarked software
http://www.unmarked.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGImageSourceCreateFromURL failed with error -11

2008-08-04 Thread Nicolas Zinovieff

David,

the images are GIFs, roughly 40KB each, 200x100 (or 100x200).
Nothing fancy.

On 05 Aug 2008, at 01:05, David Duncan wrote:


What types of images are you trying to load?


--
Zino



___

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

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

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

This email sent to [EMAIL PROTECTED]