Multiple Document types

2008-09-09 Thread Chris Idou
I have an app which can open and create multiple document types. With the 
standard framework, the New menu item seems to just create a document of one of 
those types. Am I supposed to write my own dialog box to ask the user what type 
of document they want to create, or is there something in the framework which 
is supposed to do that?






  
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSInvocation

2008-09-09 Thread Chris Idou

I have a need to call performSelector:withObject etc, except I need to pass 3 
arguments. The doco to performSelector:withObject:withObject says to "See 
NSInvocation", which I have done, but I don't understand how to use it. Can 
anyone give me some code which implements performSelector:withObject etc as 
example?







  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Joel Norvell
I'm resending this to correct an egregious attribution error in my previous 
post.  My comment remains the same.

> > On Sep 9, 2008, at 03:24, Alex Reynolds wrote:

> > I am currently putting 320 to 480 character long NSString *  
> > instances into an NSMutableArray. The characters are 0 or 1.
> >
> > I guess I could use an int array, but I'm looking to speed up my app  
> > and reduce storage. Is it possible to create a BOOL array that can  
> > be put into an NSMutableArray?

> On Sep 10, 2008, at 02:32, Todd Blanchard wrote:

> You might consider using a NSMutableIndexSet since your problem  
> basically boils down to storing membership in a set for each of a  
> ranch of numbers.  NSIndexSet is what things like NSTable use to track  
> selected rows.  I would think it would be hard to beat that without  
> going to a raw C bitmap implementation.  It will be MUCH better than  
> what you have now.

The values in an NSMutableIndexSet are always sorted, so the order in which 
they are added is not preserved.  Wouldn't that defeat the purpose of the OP's 
data structure?




  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Joel Norvell
> On Sep 9, 2008, at 18:43, Quincey Morris wrote:

> > On Sep 9, 2008, at 03:24, Alex Reynolds wrote:

> > I am currently putting 320 to 480 character long NSString *  
> > instances into an NSMutableArray. The characters are 0 or 1.
> >
> > I guess I could use an int array, but I'm looking to speed up my app  
> > and reduce storage. Is it possible to create a BOOL array that can  
> > be put into an NSMutableArray?

> Or use NSMutableData objects with 1 byte for each 0 or 1 value. You  
> can then get the BOOL values as 'data.bytes [index]', set them with  
> 'data.mutableBytes [index] = someBool' and resize the array with  
> 'data.length = someLength'. In terms of source code, that's about as  
> minimalistic as it gets without being pure C.

The values in an NSMutableIndexSet are always sorted, so the order in which 
they are added is not preserved.  Wouldn't that defeat the purpose of the OP's 
data structure?




  
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Jon Buys
> I must agree with this paragraph whole-heartedly - my single favorite thing
> about OS X is the way so many applications can be installed by dragging a
> simple icon somewhere, and can be uninstalled by dragging that same icon to
> the Trash. No need to worry about an installer dumping crap where you don't
> want it, no paranoia about trusting the uninstaller to remove everything -
> just delete, and it's gone. It's a brilliant idea, and although users coming
> from Windows might be used to needing to run an installer all the time, once
> it's explained to them, it's the most natural thing in the world. After all,
> if we're designing solely for the benefit of doing what Windows users are
> used to, they're also used to launching applications through a Start menu in
> the lower-left corner. Do we need one of those too?
>

Absolutely, keep it small, keep it contained, and don't go putting files all
over the place on the customers hard drive.  That's for "other platforms".

--Jon
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Scott Anguish
It is definitely a mixed message... It needs to be at the very least  
consistent.  I've raised it with someone and will attempt to pursue it.


As bbum said, the issues with Installer packages are the need for  
authentication, and the inability to specify where it should be  
installed if it is a simple application.




On 9-Sep-08, at 5:26 PM, Bill Cheeseman wrote:

on 2008-09-09 4:16 PM, David Melgar at [EMAIL PROTECTED] wrote  
(quoting an

earlier poster, I think):


Here's what Apple says in the Software Delivery Guide (which I'd
assume to be more authoritative about which option you should use
than the PackageMaker manual),...


The poster didn't say why he assumes the Software Delivery Guide to  
be more
authoritative. The only evidence I'm aware of is that the Software  
Delivery
Guide was last updated over two years ago, in July 2006, before  
Leopard was
released. The PackageMaker User Guide is a year newer, and it states  
that it

applies to Leopard. On that evidence, I'm more inclined to think the
PackageMaker User Guide is authoritative with respect to Leopard.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Fade In and Fade Out Transitions Missing in IB

2008-09-09 Thread Brad Gibbs

hmmm that's a bummer  looked like a nice feature.



On Sep 9, 2008, at 9:39 PM, Seth Willits wrote:


On Sep 9, 2008, at 6:50 PM, Brad Gibbs wrote:

I'm sure this is user error, but the Order In and Order Out options  
shown and described in the IB User Guide as being available in the  
View Effects tab under Transitions don't seem to be available in my  
version of IB.  I'm using XCode and IB 3.1, and my project is  
targeted for 10.5, but I can't seem to cause these these options to  
appear.  What am I doing wrong / not doing?


It's not just you. They're not there. The screenshots are just from  
an earlier version.


In general, my experience with IB3's view transition settings is:  
don't bother. They either don't work at all or are somehow  
incomplete/broken. Others (at least one Apple engineer included)  
have testified to this as well.



--
Seth Willits




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/bradgibbs%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: Fade In and Fade Out Transitions Missing in IB

2008-09-09 Thread Seth Willits

On Sep 9, 2008, at 6:50 PM, Brad Gibbs wrote:

I'm sure this is user error, but the Order In and Order Out options  
shown and described in the IB User Guide as being available in the  
View Effects tab under Transitions don't seem to be available in my  
version of IB.  I'm using XCode and IB 3.1, and my project is  
targeted for 10.5, but I can't seem to cause these these options to  
appear.  What am I doing wrong / not doing?


It's not just you. They're not there. The screenshots are just from an  
earlier version.


In general, my experience with IB3's view transition settings is:  
don't bother. They either don't work at all or are somehow incomplete/ 
broken. Others (at least one Apple engineer included) have testified  
to this as well.



--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems with Key Observing Registration Performance

2008-09-09 Thread Seth Willits

On Sep 9, 2008, at 6:48 PM, Markus Spoettl wrote:

What I don't understand is why adding the auto-release pool has such  
a dramatic impact on registering observers on the objects. Anyone  
know why?


It would simply be that the methods triggered by KVC/KVO (the  
observations) are creating a huge amount of objects. Uncomment the  
pool and watch your memory usage in Activity Monitor. It'll probably  
be grabbing all available memory and paging out like crazy, which is  
what's causing it to be so slow.


Surely adding 330 items to an array shouldn't take a minute on any  
machine from this century. I think your code is doing something you're  
not realizing. You could:
a) have a method that on each observation explicitly creates a  
bajillion objects

b) have a bajillion observers that each create a bunch of objects
c) have enough observers and have enough oddly placed observations and  
method calls that you literally end up calling the same methods over  
many many times because it recurses unintentionally, for each object  
added to the array.



Use Instruments to figure out what objects are being created, from  
where, and examine your logic to see if they're actually supposed to  
be created.



*shrugs*


Hope that helps :)

--
Seth Willits




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to determine if the system is started up from firewire disk

2008-09-09 Thread Chris Suter
On Wed, Sep 10, 2008 at 10:10 AM, Ryota Tsukiashi
<[EMAIL PROTECTED]>wrote:

> I am writing a cocoa application for our firweire device. I need to
> know if the system is started up from firewire disk. For PowerPC with
> Mac OSX 10.4/10.5, I have used information from "nvram boot-device".
> For IntelMac with 10.4/10.5, I have used "nvram efi-boot-device". I am
> not sure if it is a proper way, but it has been working OK.


No, it's not the right way. That will only tell you what the start up disk
is set to which isn't necessarily what you started from (for example, you
could have booted by holding down the Option key).

One way to do this is to use fsstat on "/" to get the BSD information and
then use IOKit (IOServiceGetMatchingService) to find the device that refers
to and then you might have to go up the hierarchy until you hit the level
you want.

There might be easier ways to do this; that's just the one I first thought
of.

-- Chris
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to determine if the system is started up from firewire disk

2008-09-09 Thread Andrew Merenbach

On Sep 9, 2008, at 5:10 PM, Ryota Tsukiashi wrote:


Hi,

I am writing a cocoa application for our firweire device. I need to
know if the system is started up from firewire disk. For PowerPC with
Mac OSX 10.4/10.5, I have used information from "nvram boot-device".
For IntelMac with 10.4/10.5, I have used "nvram efi-boot-device". I am
not sure if it is a proper way, but it has been working OK. But on Mac
OS X 10.6, even if the systems is started from firewire disk, there is
no information in "nvram efi-boot-device" if it is connected to
firewire bus. Does anyone have an idea or know a proper way how to
determine if the system is started up from firewire disk.

Sincerely,

Ryota


Hi!  By "Mac OS X 10.6," are you referring to the still-under-NDA  
SnowLeopard system?  If so, you'd have to report the bug (or whatever  
it is) directly to Apple, as the Non-Disclosure Agreement legally  
prevents others from assisting you in this matter.  :(  (Note that  
this was not at all meant to sound harsh.)


Best,
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: Finding out in code how much memory my application uses

2008-09-09 Thread Michael Ash
On Mon, Sep 8, 2008 at 9:04 PM, Aaron VonderHaar <[EMAIL PROTECTED]> wrote:
> Hi,  I am trying to write some automated scenario tests that verify
> that my application meets it's the memory usage constraint
> requirements.
>
> What API is available to find out how much memory an
> application/process/thread has allocated?
>
> I have looked at the documentation for NSZone, NSProcessInfo,
> NSThread, NSAutoreleasePool, NSTask, NSApplication, the "Interacting
> with the Operating System" guide and the "Memory Management
> Programming Guide for Cocoa" guide but I have not found any
> information about how to find out the number of pages, bytes or
> objects that are in use.

That's probably because it's an extremely difficult concept on a UNIX system.

If you load a framework, does that framework's code count against your
process's memory usage? What if the framework is also loaded by a
bunch of other applications, and you're all sharing it?

If you malloc a large piece of memory but don't touch it yet (so that
the OS has yet to actually back that allocation), does that count?

If you memory map a file, does that count? What if some other
processes have memory mapped the same file?

If you allocate some memory, and use it, and then it gets swapped out
to disk, does that still count?

If you allocate memory using a lower-level call such as vm_allocate,
does that count?

Figure out the answers to these questions and you should be some way
toward figuring out the answer to your question. Note that none of the
question above are rhetorical; there are no "right" answers to them.
Both "yes" and "no" are "right", it all depends on how you want your
accounting to work.

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]


Fade In and Fade Out Transitions Missing in IB

2008-09-09 Thread Brad Gibbs
I'm sure this is user error, but the Order In and Order Out options  
shown and described in the IB User Guide as being available in the  
View Effects tab under Transitions don't seem to be available in my  
version of IB.  I'm using XCode and IB 3.1, and my project is targeted  
for 10.5, but I can't seem to cause these these options to appear.   
What am I doing wrong / not doing?


Thanks,

Brad
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Problems with Key Observing Registration Performance

2008-09-09 Thread Markus Spoettl

On Sep 9, 2008, at 5:28 PM, Markus Spoettl wrote:
These numbers come from a test case with 140 objects, when I double  
the object number, the test never finishes (at least not within 10  
minutes).



OK, I did some more testing and timing and there is a solution - which  
I don't understand:


Testing with 326 objects, adding each of the objects to the array like  
this


   NSMutableArray *kvoArray = [self mutableArrayValueForKey:@"array"];
   for (MyObject *obj in inputData) {
   [kvoArray addObject:newObject];
   }

This takes 580 seconds. Each add causes a chain reaction of events  
that eventually adds a new NSView to the collection view. I've  
experimented with setting the whole array at once using -setArray: but  
that does not make any difference.


However, adding an auto-release pool does make a huge difference:

   NSMutableArray *kvoArray = [self mutableArrayValueForKey:@"array"];
   for (MyObject *obj in inputData) {
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

   [kvoArray addObject:newObject];

   [pool release];
   }

The same operation now takes 60 seconds. That's 10% of the original  
time.


What I don't understand is why adding the auto-release pool has such a  
dramatic impact on registering observers on the objects. Anyone know  
why?


Regards
Markus
--
__
Markus Spoettl

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: NSRunLoop run semantics

2008-09-09 Thread Chris Kane

On Sep 9, 2008, at 17:59, Roman Kishchenko wrote:


Chris, Bill, thanks for your replies.

My question was more about seeming contradiction between method  
description ("if no input sources or timers are attached to the run  
loop, this method exits immediately") and behavior I observed  
(nothing is attached to the loop by my application, yet, it does not  
exit immediately).


I have also tested runUtilDate: and runMode:beforeDate: and they  
also block (until specified date) with no input sources registered  
by my simple tester application. So, assuming method descriptions  
are correct, some input source must have been registered by the  
Cocoa framework and is preventing runXXX methods from returning  
immediately...


So, just to clarify, I should NOT assume that the run loop of the  
thread that my application created processes only input sources  
attached by my application? I.e. the Cocoa framework may also  
schedule some application-unrelated tasks to be done on that thread?


Essentially correct.  [But you should also not assume that some  
framework WILL install something in a run loop.]  It would be  
particularly true for the main thread, that frameworks may install  
things in the main run loop, but it's possible with other threads as  
well.


It boils down to: frameworks are clients of the run loops, just like  
the app itself.



Chris Kane
Cocoa Frameworks, Apple



It would seem a little odd... since I would have assumed that only  
application tasks are performed on the thread spawned by the  
application, provided there are no loop object leaks and such.


Thanks,
Roman Kishchenko

On Mon, Sep 8, 2008 at 7:39 PM, Chris Kane <[EMAIL PROTECTED]> wrote:
On Sep 7, 2008, at 9:33, Roman Kishchenko wrote:
Hi,
I am new to Cocoa and have been experimenting with NSRunLoop. I would
appreciate clarification about 'run' method semantics. The  
documentation

states that:

"If no input sources or timers are attached to the run loop, this  
method

exits immediately"

Yet, in my thread example below, the 'run' invocation blocks and  
does not
exit. MyThread is a simple NSThread subclass. No custom input  
sources or

timers are registered with the run loop. Unless I misunderstand the
documentation or there are some 'hidden' input sources or timers are
registered with the run loop, I would expect 'run' to exist  
immediately.

Would much appreciate help with sorting this out!

Thanks,
Roman Kishchenko

@implementation MyThread

- (void)main {
  NSLog(@"++ start");
  NSRunLoop *loop = [NSRunLoop currentRunLoop];
  [loop run];
  NSLog(@"++ finish");
}

@end
___


This has come up before several times on this list over the years,  
so there are a few answers already in the archives.  But I have an  
idea for a new way to explain it.


The documentation is correct.  However, it's trying to warn you that  
the method *can* return, not explain how to get it to return.


The mistake people make is in assuming that they control the  
contents of a run loop (or even a run loop mode).  However, the run  
loop is a global object, accessible to all code run on that thread  
(and perhaps other threads if you squirrel away a copy of the  
pointer somewhere).  In particular, all frameworks that you call  
into, directly or indirectly, may access it and do things to it,  
including putting things in it.


I think you are intuiting exactly this when you mention "custom" and  
"hidden" input sources.


Try the -run...BeforeDate: method in a conditional loop if you want  
block in the run loop most of the time, but want to bail under some  
conditions (which would then be the test of the loop).



Chris Kane
Cocoa Frameworks, Apple




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Michael Ash
On Tue, Sep 9, 2008 at 5:15 PM, Jerry Krinock <[EMAIL PROTECTED]> wrote:
>
> On 2008 Sep, 09, at 11:18, Charles Srstka wrote:
>
>> On Sep 9, 2008, at 5:53 AM, Bill Cheeseman wrote:
>>
>>> Apple currently recommends that ALL applications be delivered in the form
>>> of
>>> an installer. See the "PackageMaker User Guide," last revised in July
>>> 2007:
>>
>> Here's what Apple says in the Software Delivery Guide (which I'd assume to
>> be more authoritative about which option you should use than the
>> PackageMaker manual), in the section under Managed Installs:
>
> Charles, it may appear to have a more authoritative perspective, but it was
> last revised a year earlier, in July 2006.  Therefore, I put my faith the
> document that Bill Cheeseman referred to instead.  Manual Installs are Out.
>  Installers are In.

Your installer is the first thing a user sees of your product, so it
should leave a good first impression.

Alas, with me, *any* form of install is an automatic loss of points.
So by shipping an installer, you ensure that my first impression of
your product is a bad one.

Not having an installer has so many benefits. Having one has almost no
benefits. I don't think that Apple's opinion on the matter should
matter one way or the other. After all, they are not the users of your
software.

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: NSRunLoop run semantics

2008-09-09 Thread Roman Kishchenko
Chris, Bill, thanks for your replies.


My question was more about seeming contradiction between method description
("if no input sources or timers are attached to the run loop, this method
exits immediately") and behavior I observed (nothing is attached to the loop
by my application, yet, it does not exit immediately).


I have also tested runUtilDate: and runMode:beforeDate: and they also block
(until specified date) with no input sources registered by my simple tester
application. So, assuming method descriptions are correct, some input source
must have been registered by the Cocoa framework and is preventing runXXX
methods from returning immediately...


So, just to clarify, I should NOT assume that the run loop of the thread
that my application created processes only input sources attached by my
application? I.e. the Cocoa framework may also schedule some
application-unrelated tasks to be done on that thread? It would seem a
little odd... since I would have assumed that only application tasks are
performed on the thread spawned by the application, provided there are no
loop object leaks and such.


Thanks,

Roman Kishchenko

On Mon, Sep 8, 2008 at 7:39 PM, Chris Kane <[EMAIL PROTECTED]> wrote:

> On Sep 7, 2008, at 9:33, Roman Kishchenko wrote:
>
>> Hi,
>> I am new to Cocoa and have been experimenting with NSRunLoop. I would
>> appreciate clarification about 'run' method semantics. The documentation
>> states that:
>>
>> "If no input sources or timers are attached to the run loop, this method
>> exits immediately"
>>
>> Yet, in my thread example below, the 'run' invocation blocks and does not
>> exit. MyThread is a simple NSThread subclass. No custom input sources or
>> timers are registered with the run loop. Unless I misunderstand the
>> documentation or there are some 'hidden' input sources or timers are
>> registered with the run loop, I would expect 'run' to exist immediately.
>> Would much appreciate help with sorting this out!
>>
>> Thanks,
>> Roman Kishchenko
>>
>> @implementation MyThread
>>
>> - (void)main {
>>   NSLog(@"++ start");
>>   NSRunLoop *loop = [NSRunLoop currentRunLoop];
>>   [loop run];
>>   NSLog(@"++ finish");
>> }
>>
>> @end
>> ___
>>
>
>
> This has come up before several times on this list over the years, so there
> are a few answers already in the archives.  But I have an idea for a new way
> to explain it.
>
> The documentation is correct.  However, it's trying to warn you that the
> method *can* return, not explain how to get it to return.
>
> The mistake people make is in assuming that they control the contents of a
> run loop (or even a run loop mode).  However, the run loop is a global
> object, accessible to all code run on that thread (and perhaps other threads
> if you squirrel away a copy of the pointer somewhere).  In particular, all
> frameworks that you call into, directly or indirectly, may access it and do
> things to it, including putting things in it.
>
> I think you are intuiting exactly this when you mention "custom" and
> "hidden" input sources.
>
> Try the -run...BeforeDate: method in a conditional loop if you want block
> in the run loop most of the time, but want to bail under some conditions
> (which would then be the test of the loop).
>
>
> Chris Kane
> Cocoa Frameworks, Apple
>
>
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Todd Blanchard
You might consider using a NSMutableIndexSet since your problem  
basically boils down to storing membership in a set for each of a  
ranch of numbers.  NSIndexSet is what things like NSTable use to track  
selected rows.  I would think it would be hard to beat that without  
going to a raw C bitmap implementation.  It will be MUCH better than  
what you have now.


-Todd Blanchard

On Sep 9, 2008, at 3:24 AM, Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?


Thanks,
Alex
___

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

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

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


Problems with Key Observing Registration Performance

2008-09-09 Thread Markus Spoettl

Hi List,

  I'm having a strange problem with key observing performance, namely  
registering observers.


I have an array of objects which is bound to a collection view and its  
views register themselves as observers of the array objects'  
properties (1 object, 1 view). The objects' properties are being  
observed somewhere else as well. There are 17 properties that are  
observed like this:


[object addObserver:self forKeyPath:@"prop"  
options:NSKeyValueObservingOptionNew context:nil];


The time needed to register the observation depends on the number of  
objects in the array. It increases exponentially. A small portion of  
the Shark log is here:


0.0%58.8%   rubiTrack -[registerObservers]  
	0.0%	58.8%	Foundation - 
[NSObject(NSKeyValueObserverRegistration)  
addObserver:forKeyPath:options:context:]	
	0.0%	58.4%	Foundation  - 
[NSObject(NSKeyValueObserverRegistration)  
_addObserver:forProperty:options:context:]	
	0.0%	41.8%	Foundation 
_NSKeyValueObservationInfoCreateByAdding	
	8.1%	40.1%	Foundation -[NSKeyValueObservationInfo  
_initWithObservances:count:]	
	0.5%	29.8%	CoreFoundation	-[__NSPlaceholderArray  
initWithObjects:count:]	

2.6%29.1%   CoreFoundation   CFArrayCreate  
14.3%   16.6%   CoreFoundationCFRetain  

These numbers come from a test case with 140 objects, when I double  
the object number, the test never finishes (at least not within 10  
minutes).


It appears I'm running into a problem with the number of properties  
that are being observed. When I observe only one property, the above  
takes up only 0.8% of the CPU time.


Is there a problem with observing may properties of the same object if  
you have may objects of that kind that are being observed? If so, is  
there a workaround?


Thanks for any input!
Regards
Markus
--
__
Markus Spoettl



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]

How to determine if the system is started up from firewire disk

2008-09-09 Thread Ryota Tsukiashi
Hi,

I am writing a cocoa application for our firweire device. I need to
know if the system is started up from firewire disk. For PowerPC with
Mac OSX 10.4/10.5, I have used information from "nvram boot-device".
For IntelMac with 10.4/10.5, I have used "nvram efi-boot-device". I am
not sure if it is a proper way, but it has been working OK. But on Mac
OS X 10.6, even if the systems is started from firewire disk, there is
no information in "nvram efi-boot-device" if it is connected to
firewire bus. Does anyone have an idea or know a proper way how to
determine if the system is started up from firewire disk.

Sincerely,

Ryota
___

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

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

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

This email sent to [EMAIL PROTECTED]


Core Data and Garbage Collection

2008-09-09 Thread Michael Link
I'm running an application with the Core Data thread assertions on and  
am running into some issues on the garbage collection thread.


On the GC thread (#2 usually in GDB), finalizeOneObject() is running  
the finalize method of an NSTextValueBinder object. This object is  
bound to the attribute of an NSManagedObject by way of a couple of  
other objects. From the way the stack trace looks I assume that the  
finalize method of NSTextValueBinder is undoing the observers and in  
the process calls -valueForKey: on the MO (not on the main thread  
where its managed object context lives) and this triggers an assertion  
failure from the MOC.


During -finalize on the GC thread is it allowed to use the MOC from  
the main thread (I wouldn't do this myself)? Or does the binding/ 
observers need to be undone before this reaches GC? I was under the  
impression that observers would be cleaned up automatically.


The binding key path is:

representedObject.fromUser.name

representedObject is an NSManagedObject
fromUser is an NSManagedObject
name is an NSString attribute of fromUser

#0  0x90debbb4 in -[NSAssertionHandler  
handleFailureInMethod:object:file:lineNumber:description:] ()
#1  0x0021d9af in -[NSManagedObjectContext(_NSInternalAdditions)  
_PFAssertSafeMultiThreadedAccess_impl:] ()

#2  0x0015e995 in -[NSManagedObject valueForKey:] ()
#3  0x90d7afa1 in -[NSKeyValueNestedProperty  
object:didRemoveObservance:] ()
#4  0x90d5a203 in -[NSObject(NSKeyValueObserverRegistration)  
_removeObserver:forProperty:] ()
#5  0x90d59fa4 in -[NSObject(NSKeyValueObserverRegistration)  
removeObserver:forKeyPath:] ()
#6  0x90d7afc1 in -[NSKeyValueNestedProperty  
object:didRemoveObservance:] ()
#7  0x90d5a203 in -[NSObject(NSKeyValueObserverRegistration)  
_removeObserver:forProperty:] ()
#8  0x90d59fa4 in -[NSObject(NSKeyValueObserverRegistration)  
removeObserver:forKeyPath:] ()

#9  0x90207b74 in -[NSBinder _updateObservingRegistration:] ()
#10 0x9024e1ef in -[NSBinder  
releaseConnectionWithSynchronizePeerBinders:] ()
#11 0x9024e3f5 in -[NSValueBinder  
releaseConnectionWithSynchronizePeerBinders:] ()

#12 0x903f0ee0 in -[NSBinder finalize] ()
#13 0x91675976 in finalizeOneObject ()
#14 0x92d75dab in foreach_block_do ()
#15 0x91675b3b in batchFinalize ()
#16 0x91675e02 in batchFinalizeOnTwoThreads ()
#17 0x92d76f0e in auto_collect_internal ()
#18 0x92d77b8f in auto_collection_thread ()
#19 0x93f8c6f5 in _pthread_start ()
#20 0x93f8c5b2 in thread_start ()

(gdb) info frame
Stack level 2, frame at 0xb01025f0:
 eip = 0x15e995 in -[NSManagedObject valueForKey:]; saved eip  
0x90d7afa1

 called by frame at 0xb01026c0, caller of frame at 0xb0102590
 Arglist at 0xb01025e8, args:
 Locals at 0xb01025e8, Previous frame's sp is 0xb01025f0
 Saved registers:
  ebx at 0xb01025e0, ebp at 0xb01025e8, esi at 0xb01025e4, eip at  
0xb01025ec

(gdb) po *(int*)(0xb01025e8 + 16)
fromUser
(gdb) info frame
Stack level 13, frame at 0xb0102c60:
 eip = 0x91675976 in finalizeOneObject; saved eip 0x92d75dab
 called by frame at 0xb0102c90, caller of frame at 0xb0102c40
 Arglist at 0xb0102c58, args:
 Locals at 0xb0102c58, Previous frame's sp is 0xb0102c60
 Saved registers:
  ebp at 0xb0102c58, eip at 0xb0102c5c
(gdb) po *(int*)(0xb0102c58 + 8)
{object: (null), bindings:  
value=representedObject.fromUser.name}

(gdb) c
Continuing.
2008-09-09 17:47:06.883 Spyder[1140:2903] *** Assertion failure in - 
[NSManagedObjectContext _PFAssertSafeMultiThreadedAccess_impl:], / 
SourceCache/Persistence/Persistence-186/NSManagedObjectContext.m:2340
objc[1140]: GC: -finalize resulted in an exception (0x2ec4600) being  
thrown, break on objc_exception_during_finalize_error to debug
	CoreData: warning: Access by another thread to NSManagedObjectContext  
during valueForKey:


--
Michael
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: singleton managed object / obtaining mo context SOLVED

2008-09-09 Thread Daniel Child
As a followup to my own question, it seems that the context is not  
created until awakeFromNib.

If I wait until awakeFromNib, I can access it via:

[[NSApp delegate] managedObjectContext];

OR

[[[NSApplication sharedApplication] delegate] managedObjectContext];

and those return the same value. Clearly you don't want to alloc/init  
a new instance of the delegate class.


Regarding the singleton issue, I realized you need to grab the  
singleton from the persistent store and count it. Thus,


NSError *error;
NSManagedObjectContext *moc = [[NSApp delegate] managedObjectContext];
	NSUInteger numLibrarians = [EntityUtilities countObjectsOfType:  
@"Librarian" inContext: moc];


if (numLibrarians == 0) {
		librarian = [NSEntityDescription insertNewObjectForEntityForName:  
@"Librarian"

inManagedObjectContext: moc]; // moc becomes nil here !!!

etc.

enables me to determine how many librarians I have (once I set up such  
a utility).


Thanks for looking.

On Sep 9, 2008, at 3:11 PM, Daniel Child wrote:


Hi All,

I am trying to implement a singleton class which is a subclass of  
NSManagedObject, but it is not behaving as expected.  The librarian  
singleton is supposed to keep a list of the data sources, which are  
added periodically. I'm trying to cache the Librarian as an instance  
variable of my App Controller so that I can access it easily. The  
app controller tries to create/retrieve the instance during its own  
init as follows:



- (id)init
{
  if (self = [super init])
  {
// a bunch of variables initialized here
theLibrarian = [Librarian getLibrarianInstance];
  }
  return self;
}

What's totally weird is that my managed object context disappears  
midway through the following lines of code.



static Librarian *librarian = nil;
@implementation Librarian
@dynamic dataSources;
@dynamic numSources;

+ (Librarian *) getLibrarianInstance {
NSError *error;
	NSManagedObjectContext *moc = [[NSApp delegate]  
managedObjectContext]; // moc exists at this point

if (librarian == nil) {
	  librarian = [NSEntityDescription insertNewObjectForEntityForName:  
@"Librarian"

inManagedObjectContext: moc]; // moc 
becomes nil here !!!
  [moc insertObject: librarian];
  if (![moc save: &error]) {
[[NSApplication sharedApplication] presentError:error];
  }
}
// [moc insertObject: librarian];
return librarian;
}

I have two basic questions. Where is the best place to initialize a  
singleton for a Core Data application?


And secondly, what is the best way to access the managed object  
context. In my init, if I call


moc = [[NSApp delegate] managedObjectContext]; // value is nil
moc = [[[NSApplication sharedApplication] delegate]  
managedObjectContext]; // value is nil

coreDataDelegate = [[CoreDataLibrarian_AppDelegate alloc] init];
moc = [coreDataDelegate managedObjectContext]; // value exists

Surely you aren't supposed to alloc/init the AppDelegate class  
everywhere in your app just to get the context. What is the best way  
for accessing it throughout your code? (I notice most examples  
write //assume context exists.)


Thanks in advance.

Daniel






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Bill Cheeseman
on 2008-09-09 4:16 PM, David Melgar at [EMAIL PROTECTED] wrote (quoting an
earlier poster, I think):

>> Here's what Apple says in the Software Delivery Guide (which I'd
>> assume to be more authoritative about which option you should use
>> than the PackageMaker manual),...

The poster didn't say why he assumes the Software Delivery Guide to be more
authoritative. The only evidence I'm aware of is that the Software Delivery
Guide was last updated over two years ago, in July 2006, before Leopard was
released. The PackageMaker User Guide is a year newer, and it states that it
applies to Leopard. On that evidence, I'm more inclined to think the
PackageMaker User Guide is authoritative with respect to Leopard.

Speaking only for myself, I am less enamoured of drag-install than I was
originally, given all the stories about newcomers to the platform failing to
understand how it works. The relatively recent fad of putting an Application
folder symlink next to the application icon in the DMG window is a popular
attempt to grapple with this problem, but in my personal view it only
increases the confusion.

Apple has given vague hints that installers will bring greater benefits in
the future. I don't know what those benefits might be, but I'm guessing that
improved security might be one of them.

I discovered a year ago that an application implementing a certain
security-related feature of the system cannot use an embedded framework, for
security reasons. (Specifically, an application that uses the
AXMakeProcessTrusted function from the accessibility API, which requires
user authentication, can't use embedded frameworks. I confirmed this with
Apple engineers at the time.) Thus, such an application cannot be
drag-installed, because it is necessary to install the framework in an
external location, such as /Library/Frameworks. It is therefore necessary to
use an installer to install it correctly. Scenarios like this may be the
wave of the future.

--

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

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Bill Bumgarner

On Sep 9, 2008, at 2:15 PM, Jerry Krinock wrote:
Charles, it may appear to have a more authoritative perspective, but  
it was last revised a year earlier, in July 2006.  Therefore, I put  
my faith the document that Bill Cheeseman referred to instead.   
Manual Installs are Out.  Installers are In.


But:

- installers that require authentication are seriously uncool (unless  
absolutely positively necessary)


- installers that aren't also uninstallers (that work) is akin to  
mixing striped pots & polka dotted shirts


- installers that do not allow for custom installation location is  
moldy fruit in a gourmet buffet


If you are going down the Installer path, do it right.  Otherwise,  
don't do it at all.  Drag and Drop FTW.


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: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Jerry Krinock


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


On Sep 9, 2008, at 5:53 AM, Bill Cheeseman wrote:

Apple currently recommends that ALL applications be delivered in  
the form of
an installer. See the "PackageMaker User Guide," last revised in  
July 2007:


Here's what Apple says in the Software Delivery Guide (which I'd  
assume to be more authoritative about which option you should use  
than the PackageMaker manual), in the section under Managed Installs:


Charles, it may appear to have a more authoritative perspective, but  
it was last revised a year earlier, in July 2006.  Therefore, I put my  
faith the document that Bill Cheeseman referred to instead.  Manual  
Installs are Out.  Installers are In.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Invoking -setNeedsDisplay: Whacks frame of NSTextView

2008-09-09 Thread Jerry Krinock

Just when I think I've seen everything

Code:
NSLog(@"myTextView is a %@", [myTextView class]) ;
NSLog(@"Before, its frame is: %@", NSStringFromRect([myTextView  
frame])) ;

[myTextView setNeedsDisplay:YES] ;
NSLog(@" After, its frame is: %@", NSStringFromRect([myTextView  
frame])) ;


Console Output:
myTextView is a NSTextView
Before, its frame is: {{17, 63}, {250, 75}}
 After, its frame is: {{17, 123}, {250, 45}}

Why did -setNeedsDisplay: move my text view's y-origin up by 60 and  
reduce its height by 30?


A possible answer [1] is that Cocoa does "not support" views  
overlapping one another.  Indeed, there are are sibling views that may  
be overlapping at this point.


The code above is part of a method which "lays out" a window which I  
create programatically.  It is an enhanced NSAlert that, besides  
having an icon, some text and three buttons, can have a progress bar,  
editable text fields with labels, pulldown menus, checkbox, etc.  I  
use it for all of my alerts, errors, and more.  However, since the  
presence and size of all these subviews changes dynamically, I have  
this method which, just prior to display, scans horizontally and then  
vertically and sets all the frames.  It's a handy class, and cool when  
the layout works, which it does about 99% of the time.  I inserted  
that -setNeedsDisplay while troubleshooting one of the 1% cases and  
WHOA the frame got whacked.  I suspect that the same frame-whacking  
mechanism is causing the actual problem I need to solve.


Also, I wonder if this is might be related to -[NSTextView  
setNeedsDisplayInRect:avoidAdditionalLayout:].  But the documentation  
seems to indicate that "layout" in this case has to do with word  
positioning and line wrapping.


Nowhere can I find any documentation that setNeedsDisplay: should  
whack an NSView's frame.  This is all in Leopard, so it's not some old  
long-fixed bug.


Jerry

[1] http://www.cocoabuilder.com/archive/message/cocoa/2006/10/17/172951


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSTableView works in 10.5 but not in 10.4

2008-09-09 Thread Ellen Chou
Thanks,

reloadData resolve the problem with 10.4.8.

- Ellen

On Mon, Sep 8, 2008 at 3:20 PM, Corbin Dunn <[EMAIL PROTECTED]> wrote:

>
> On Sep 8, 2008, at 2:36 PM, Ellen Chou wrote:
>
> Hi Stephane,
>>
>> Indeed, reloadData is not called at all.  But why can it work fine in
>> 10.5.2?
>>
>> When and where I should call reloadData?
>>
>>
> That's easy; after you change your model. When do you initialize your
> arrays, etc? After that point, call reloadData. Possibly in -awakeFromNib.
>
> If it is working by chance on Leopard, then it is probably because of some
> ordering issue that changed slightly.
>
> corbin
>
>
>
>
> Thanks,
>> Ellen
>>
>> On Mon, Sep 8, 2008 at 9:52 AM, Stéphane Sudre <[EMAIL PROTECTED]> wrote:
>>
>>
>>> On Sep 8, 2008, at 12:58 PM, Ellen Chou wrote:
>>>
>>> I have a tree view window that uses NSTableView and NSOutlineView lists
>>> out
>>>
 all the sub folders under user's home directory.  For some reason, this
 window shows the folder contents correctly in Mac OS 10.5.2, but not in
 Mac
 OS 10.4.x running on iMac which is PowerPC host running on Intel Duel
 Core
 CPUs.

 It seems to me the Notification/Event was not functioning properly in
 Mac
 OS
 10.4.x iMac.  I don't get a chance to run on MacBook 10.4.x.  If any one
 has
 MacBook Intel CPU running 10.4.x, please let me know.

 Anyone run into the similar problem?


>>> Are you referring to a specific sample code?
>>>
>>> Which notification/event are you referring to?
>>>
>>> When there's a display strangeness in NSTableView/NSOutlineView, the
>>> first
>>> thing to check is that reloadData is called before at least once.
>>>
>>>
>>>
___

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

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

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

This email sent to [EMAIL PROTECTED]


No action msg after NSPathControl "Choose"

2008-09-09 Thread David Hoerl
The NSPathControl.h file says that when in Popup mode, the control 
will send a action message. However, I cannot get it to work. I've 
tried using no types, and a type of "public.folder".


Is this a known problem?

I was able to create a hack work-around: use the NSPathControl 
delegate method "- (void)pathControl:(NSPathControl *)pathControl 
willDisplayOpenPanel: (NSOpenPanel *)openPanel" that is called just 
prior to the NSOpenPanel showing. In that method send the main run 
loop a message to performSelector with your IBACtion method.


When the user finishes with the open panel, the run loop dequeues 
your message and sends it to your action method.



David

PS: from NSPathControl.h: "When the URL value in the NSPathControl 
changes from an automatic drag and drop operation, or from the user 
selecting a new path via the open panel, the action is sent, but the 
clickedPathComponentCell will be nil."

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread David Melgar
I agree. Being able to install applications in unprivelaged locations  
is one of the best qualities of mac os x.


Sent from my iPhone

On Sep 9, 2008, at 2:18 PM, Charles Srstka <[EMAIL PROTECTED]>  
wrote:



On Sep 9, 2008, at 5:53 AM, Bill Cheeseman wrote:


on 2008-09-08 11:31 PM, Chris Markle at [EMAIL PROTECTED] wrote:


I'd prefer to ship this as a DMG... But if I understand DMG-based
delivery correctly, the idea is that Mac users are used to this and
"know" to copy the application bundle to the Applications folder.


Apple currently recommends that ALL applications be delivered in  
the form of
an installer. See the "PackageMaker User Guide," last revised in  
July 2007:


Here's what Apple says in the Software Delivery Guide (which I'd  
assume to be more authoritative about which option you should use  
than the PackageMaker manual), in the section under Managed Installs:


http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Managed_Installs/chapter_5_section_1.html#//apple_ref/doc/uid/1145i-CH6-SW8

"As described in “Overview of Software Delivery,” managed installs g 
ive you more control over the installation process, which, among oth 
er things, allows you to fine-tune the user’s install experience. Ho 
wever, when your product is made up of a single component that doesn 
’t need to be placed at privileged locations in the file system, suc 
h as /Applications or /Library, you should provide users with a manu 
al install for your product. Manual installs are faster and easier t 
o perform for novice and expert users alike. See “Manual Installs” f 
or details."


I must agree with this paragraph whole-heartedly - my single  
favorite thing about OS X is the way so many applications can be  
installed by dragging a simple icon somewhere, and can be  
uninstalled by dragging that same icon to the Trash. No need to  
worry about an installer dumping crap where you don't want it, no  
paranoia about trusting the uninstaller to remove everything - just  
delete, and it's gone. It's a brilliant idea, and although users  
coming from Windows might be used to needing to run an installer all  
the time, once it's explained to them, it's the most natural thing  
in the world. After all, if we're designing solely for the benefit  
of doing what Windows users are used to, they're also used to  
launching applications through a Start menu in the lower-left  
corner. Do we need one of those too?


Charles___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


simple window close question

2008-09-09 Thread Bob Sabiston

Hi,

  I've got a cocoa-in-carbon window, and I want to let my carbon app  
know when the cocoa window closes.  I'm kind of new to cocoa--how do I  
do this? Here's what I've tried so far.


I made File's Owner the delegate of my window by dragging a line  
between them in Interface Builder.  In my Controller class  
implementation I added this:


- (BOOL)windowShouldClose:(id)sender {
return NO;
}

I'm not sure that's the right place for it.  What connects my one  
controller class to the File's Owner?  By having that function return  
NO, shouldn't it prevent me from closing the window?  I thought I  
would start there and then add the carbon-connectivity.  In any case,  
it isn't preventing me from closing the window, and I don't think I  
can add debugging stops to halt execution within my cocoa bundle.


Thanks for any tips,
Bob


___

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

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

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

This email sent to [EMAIL PROTECTED]


singleton managed object / obtaining mo context

2008-09-09 Thread Daniel Child

Hi All,

I am trying to implement a singleton class which is a subclass of  
NSManagedObject, but it is not behaving as expected.  The librarian  
singleton is supposed to keep a list of the data sources, which are  
added periodically. I'm trying to cache the Librarian as an instance  
variable of my App Controller so that I can access it easily. The app  
controller tries to create/retrieve the instance during its own init  
as follows:



- (id)init
{
  if (self = [super init])
  {
// a bunch of variables initialized here
theLibrarian = [Librarian getLibrarianInstance];
  }
  return self;
}

What's totally weird is that my managed object context disappears  
midway through the following lines of code.



static Librarian *librarian = nil;
@implementation Librarian
@dynamic dataSources;
@dynamic numSources;

+ (Librarian *) getLibrarianInstance {
NSError *error;
	NSManagedObjectContext *moc = [[NSApp delegate]  
managedObjectContext]; // moc exists at this point

if (librarian == nil) {
	  librarian = [NSEntityDescription insertNewObjectForEntityForName:  
@"Librarian"

inManagedObjectContext: moc]; // moc 
becomes nil here !!!
  [moc insertObject: librarian];
  if (![moc save: &error]) {
[[NSApplication sharedApplication] presentError:error];
  }
}
// [moc insertObject: librarian];
return librarian;
}

I have two basic questions. Where is the best place to initialize a  
singleton for a Core Data application?


And secondly, what is the best way to access the managed object  
context. In my init, if I call


moc = [[NSApp delegate] managedObjectContext]; // value is nil
moc = [[[NSApplication sharedApplication] delegate]  
managedObjectContext]; // value is nil

coreDataDelegate = [[CoreDataLibrarian_AppDelegate alloc] init];
moc = [coreDataDelegate managedObjectContext]; // value exists

Surely you aren't supposed to alloc/init the AppDelegate class  
everywhere in your app just to get the context. What is the best way  
for accessing it throughout your code? (I notice most examples write // 
assume context exists.)


Thanks in advance.

Daniel




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Andy Lee

On Sep 9, 2008, at 12:43 PM, Quincey Morris wrote:

On Sep 9, 2008, at 03:24, Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my  
app and reduce storage. Is it possible to create a BOOL array that  
can be put into an NSMutableArray?


Or use NSMutableData objects with 1 byte for each 0 or 1 value. You  
can then get the BOOL values as 'data.bytes [index]', set them with  
'data.mutableBytes [index] = someBool' and resize the array with  
'data.length = someLength'. In terms of source code, that's about as  
minimalistic as it gets without being pure C.


Very nice.  This is simple, it performs well, and depending on how  
you're storing the data, might possibly cut down the storage space of  
your array significantly (for example if you're using a plist).


My only question would be how many of these arrays you have and how  
often you're stuffing booleans into them, and whether you're sure  
operations on this array are actually taking a noticeable amount of  
time.


--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: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Charles Srstka

On Sep 9, 2008, at 5:53 AM, Bill Cheeseman wrote:


on 2008-09-08 11:31 PM, Chris Markle at [EMAIL PROTECTED] wrote:


I'd prefer to ship this as a DMG... But if I understand DMG-based
delivery correctly, the idea is that Mac users are used to this and
"know" to copy the application bundle to the Applications folder.


Apple currently recommends that ALL applications be delivered in the  
form of
an installer. See the "PackageMaker User Guide," last revised in  
July 2007:


Here's what Apple says in the Software Delivery Guide (which I'd  
assume to be more authoritative about which option you should use than  
the PackageMaker manual), in the section under Managed Installs:


http://developer.apple.com/documentation/DeveloperTools/Conceptual/SoftwareDistribution/Managed_Installs/chapter_5_section_1.html#/ 
/apple_ref/doc/uid/1145i-CH6-SW8


"As described in “Overview of Software Delivery,” managed installs  
give you more control over the installation process, which, among  
other things, allows you to fine-tune the user’s install experience.  
However, when your product is made up of a single component that  
doesn’t need to be placed at privileged locations in the file system,  
such as /Applications or /Library, you should provide users with a  
manual install for your product. Manual installs are faster and easier  
to perform for novice and expert users alike. See “Manual Installs”  
for details."


I must agree with this paragraph whole-heartedly - my single favorite  
thing about OS X is the way so many applications can be installed by  
dragging a simple icon somewhere, and can be uninstalled by dragging  
that same icon to the Trash. No need to worry about an installer  
dumping crap where you don't want it, no paranoia about trusting the  
uninstaller to remove everything - just delete, and it's gone. It's a  
brilliant idea, and although users coming from Windows might be used  
to needing to run an installer all the time, once it's explained to  
them, it's the most natural thing in the world. After all, if we're  
designing solely for the benefit of doing what Windows users are used  
to, they're also used to launching applications through a Start menu  
in the lower-left corner. Do we need one of those too?


Charles___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Andrew Merenbach

On Sep 9, 2008, at 3:24 AM, Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?


Thanks,
Alex


Hi!  You might save some memory by using [NSNumber numberWithBool:YES]  
and [NSNumber numberWithBool:NO] as your NSMutableArray contents --  
that way you're not wasting strings.


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]

Cocoaheads Lake Forest will not have a formal meeting this month. Informal meeting

2008-09-09 Thread Scott Ellsworth
Hello, all,

CocoaHeads Lake Forest will not have a formal meeting this month.  Our
next meeting on the second Wednesday in
October from 7 to 9 PM.

(Our venue is still down, but is expected to be repaired in the next
week.  As the NSCoder group met just a week ago, I do not want to wear
out our Lake Forest Cocoa developers with too many meetings.)

Scott
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Quincey Morris

On Sep 9, 2008, at 03:24, Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?


Or use NSMutableData objects with 1 byte for each 0 or 1 value. You  
can then get the BOOL values as 'data.bytes [index]', set them with  
'data.mutableBytes [index] = someBool' and resize the array with  
'data.length = someLength'. In terms of source code, that's about as  
minimalistic as it gets without being pure C.




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BOOL array

2008-09-09 Thread Jean-Daniel Dupas

Le 9 sept. 08 à 12:24, Alex Reynolds a écrit :

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?




I you don't need to much control over you data, you may use a  
CFBitVector (and mutable counterpart).
As it is a CFTypeRef, it is free-bridged with NSObject and can be  
stored in an NSArray.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Custom Array/Set keypath

2008-09-09 Thread Mike Abdullah
Create a custom NSValueTransformer subclass that takes the data and  
calculates its standard deviation


On 9 Sep 2008, at 16:22, Jamie Phelps wrote:

I would like to bind the value of an NSTextField to the standard  
deviation of a keypath. My class Foo has an  instance variable  
"amount." I found the NSExpression function stddev: and thought I  
would create a category but that didn't work out like I had hoped.


Any thoughts appreciated.

Thanks,
Jamie
___

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

Please do not post admin requests or moderator comments to the list.
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]


Re: BOOL array

2008-09-09 Thread Jason Coco


On Sep 9, 2008, at 06:24 , Alex Reynolds wrote:

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?


You can use a BOOL array or an int array... or an array of uint8_t.  
BOOL is just a signed char anyway. Just wrap the array in an NSValue  
object when you put it into the NSMutableArray:


BOOL boolArrayOne[320];

/* ... */

NSValue *boolArrayOneAsValue = [NSValue valueWithPointer:&boolArrayOne];

Jason

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Using control:didFailToFormatString:errorDescription:

2008-09-09 Thread Matt Neuburg
On Tue, 9 Sep 2008 12:10:10 +1000, Rohan Lloyd <[EMAIL PROTECTED]> said:
>
>On 9 Sep 2008, at 12:48 AM, Matt Neuburg wrote:
>
>> On Mon, 8 Sep 2008 11:23:30 +1000, Rohan Lloyd > [EMAIL PROTECTED]> said:
>>> I don't like the vague "Format Error" and want to display my own
>>> message, so I've written my own
>>> control:didFailToFormatString:errorDescription: method (In my
>>> NSWindowController subclass), and set the text field delegate to
>>> point
>>> at it.
>>>
>>> - (BOOL)control: (NSControl*)control didFailToFormatString:
>>> (NSString*)str errorDescription: (NSString*)errDescription
>>> {
>>>NSError *error = [NSError errorWithDomain: NSCocoaErrorDomain
>>> code: NSFormattingError userInfo: nil]; // Add custom description
>>> later
>>>[control presentError: error modalForWindow: [self window]
>>> delegate: nil
>>>   didPresentSelector: nil
>>>  contextInfo: nil];
>>>
>>>return YES;
>>> }
>>
>> First thing's first. Documentation says return value should be:
>>
>>> Return Value
>>> YES if the value in the string parameter should be accepted as is;
>>> otherwise,
>>> NO if the value in the parameter should be rejected.
>>
>> If you don't like the string, you should not be returning YES. m.
>
>You're right I should have read that part of the documentation.
>However, I had tried returning NO, and it didn't really help.
>
>If I return NO, not only do I get my error displayed, but the standard
>error dialog is also shown. Which suggests that the return value is
>overloaded with a "I have handled this error" meaning. This is backed
>up by the following page that I read:
>
>   ://initgraf.blogspot.com/2007/11/customizing-errors-generated-by.html
>
>Where it says, "You need to return YES, or else you'll get both your
>custom error and the standard error."

Okay, well, that's why I preceded my reply with the phrase "first thing's
first". What I meant by that was: If you insist on using
control:didFailToFormatString: it's probably a good idea to use it in
accordance with the documentation. But now we're ready for the real issue,
which is, is it right to be using control:didFailToFormatString: at all? It
seems to me that this does not supplement or modify, but rather conflicts
with, the normal pattern of validation. Now that you've revealed where
you're getting the idea to use control:didFailToFormatString:, I wonder
whether you're following a dangerous white rabbit down an even more
dangerous rabbit hole.

IIRC, your original complaint was that you have text fields in a sheet bound
to an NSObjectController and when the user tries to tab out of one of these
fields you want an invalid value to result in (1) presentation of your
customized message and (2) the user winding up back in the bad field. The
way I would do this is to implement validateValue:forKeyPath: in the
NSObjectController, where the NSObjectController, not the text field, is
holding on to the formatter. (The text field's binding should include
"validates immediately".)

For an example, take a look at my NotLight application. Choose Window > Date
Assistant and enter -3 into the Relative Times text field. Now try to tab
out or to use the corresponding Use This button. You will see a custom error
message and if you click Cancel you will fall back into the invalid field.
Isn't that just what you say you're trying to do?

And notice that because this approach *uses* the validation mechanism rather
than fighting against it, there is no need to call presentError: as in that
blog post. The NSError that you create in validateValue: *is* the error that
will be presented - for you, by the validation mechanism.

m.

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




___

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

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

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

This email sent to [EMAIL PROTECTED]


Saving some managed objects separately

2008-09-09 Thread Arthur C .
In my application I have a status log which is kept in Core Data. This gives a 
nice interface and persistence for the log. 
However, I would like to be able to save the log to disk independent from other 
parts of my Core Data model. This is needed to prevent the log from getting 
lost in the event of a power failure or program crash. The uptime is supposed 
to be several months, at least, so things should be saved at some point. 
 
It is possible to assign the log objects to a second persistent store, but that 
gives no second 'save action' to save it independently. The only save action I 
found is in the managedObjectContext but that saves everything, destroying the 
undo stack. So should I have two managed object contexts? And then, also with 
another persistent store coordinator? Or is there a simpler way?
 
 
Thanks for your time,
Arthur 
_
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___

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

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

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

This email sent to [EMAIL PROTECTED]


BOOL array

2008-09-09 Thread Alex Reynolds
I am currently putting 320 to 480 character long NSString * instances  
into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can be  
put into an NSMutableArray?


Thanks,
Alex
___

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

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

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

This email sent to [EMAIL PROTECTED]


Custom Array/Set keypath

2008-09-09 Thread Jamie Phelps
I would like to bind the value of an NSTextField to the standard  
deviation of a keypath. My class Foo has an  instance variable  
"amount." I found the NSExpression function stddev: and thought I  
would create a category but that didn't work out like I had hoped.


Any thoughts appreciated.

Thanks,
Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Do I Need Multiple NSArrayControllers For This?

2008-09-09 Thread Jamie Phelps
I have a Core Data entity that has a date and relationship. I want to  
create a label like.


"25 Foos (12 New)"

A Foo is active if it its relationship is null and it is new if its  
date is within the startDate and endDate specified by the user.


My intuition is that this does require two NSArrayControllers each  
with a filter predicate binding to get the desired array of Foos, but  
I wanted to see if there was anything I hadn't considered.


Thanks,
Jamie
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Thomas Engelmeier


Am 09.09.2008 um 12:53 schrieb Bill Cheeseman:


on 2008-09-08 11:31 PM, Chris Markle at [EMAIL PROTECTED] wrote:


I'd prefer to ship this as a DMG... But if I understand DMG-based
delivery correctly, the idea is that Mac users are used to this and
"know" to copy the application bundle to the Applications folder.


Apple currently recommends that ALL applications be delivered in the  
form of

an installer.


The quoted paragraph means "an Apple installer", not "an installer"

Leopard leverages these features to provide users an improved  
install experience."


*LOL* Well, dreaming is legitimate...




Regards,
Tom_E
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: While we're on the subject of DMG's for software distribution...

2008-09-09 Thread Bill Cheeseman
on 2008-09-08 11:31 PM, Chris Markle at [EMAIL PROTECTED] wrote:

> I'd prefer to ship this as a DMG... But if I understand DMG-based
> delivery correctly, the idea is that Mac users are used to this and
> "know" to copy the application bundle to the Applications folder.

Apple currently recommends that ALL applications be delivered in the form of
an installer. See the "PackageMaker User Guide," last revised in July 2007:

"The installation package­based mechanism is the preferred method for
delivering products in Mac OS X. This model is a change for experienced Mac
OS X developers and packagers. Before Mac OS X v10.5 (Leopard), the
preferred software delivery mechanism was the manual install, where users
drag the product from its container, a disk image, onto their file system.
However, managed installs (which are steered by the Installer application
after the user opens an installation package) on Leopard clients make
possible advanced installation-management features, such as better package
management through the Installer package database, downloadable packages,
and certificate-based signing. Leopard leverages these features to provide
users an improved install experience."

I don't have any inside information, but I assume this change is because so
many switchers from that other platform have difficulty with the concept of
drag-installing an application package.

This doesn't answer your question about DMGs, however. You can deliver an
installer in a DMG, as I do these days, or in a zip file, or whatever.

--

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

PreFab Software - www.prefabsoftware.com


___

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

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

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

This email sent to [EMAIL PROTECTED]


RTFFromRange vs. NSTextTableBlock

2008-09-09 Thread Mark Allerton

Hi all,

I ran into some strangeness with NSAttributedString -RTFFromRange when  
using text table attributes. I'm actually implementing a custom  
NSTextStorage and ran into this when copying to the clipboard, but  
have been able to boil this down to a simple example using  
NSMutableAttributedString.


Basically the implementation of RTFFromRange gets confused in some  
cases and can call attributesAtIndex with an out-of-bounds index. It  
could be that I am the one confusing it, because I have somehow  
mangled the attributes, so I'd welcome any advice.


What follows is an example that sets up some table attributes  
programmatically on the string - in the first case making a the table  
span the entire string, and in the second case making it span all but  
the last character. In the second case, calling RTFFromRange on the  
string causes an exception.


- (void) testTableBug {
	NSMutableAttributedString* test = [[NSMutableAttributedString alloc]  
initWithString:@"Testa"];


// create some 'default' attributes
NSMutableDictionary* baseAttrs = [NSMutableDictionary dictionary];
	NSParagraphStyle* baseParaStyle = [NSParagraphStyle  
defaultParagraphStyle];
	[baseAttrs setObject:baseParaStyle  
forKey:NSParagraphStyleAttributeName];


// create some attributes with a 1-cell table
NSMutableDictionary* tableAttrs = [NSMutableDictionary dictionary];

NSTextTable* table = [[NSTextTable alloc] init];
[table setNumberOfColumns:1];

NSTextTableBlock* block = [[NSTextTableBlock alloc]
   initWithTable:table
   startingRow:0
   rowSpan:1
   startingColumn:0
   columnSpan:1];

	NSMutableParagraphStyle* paraStyle = [[NSMutableParagraphStyle alloc]  
init];

[paraStyle setParagraphStyle:baseParaStyle];
[paraStyle setTextBlocks:[NSArray arrayWithObjects:block,nil]];
[tableAttrs setObject:paraStyle forKey:NSParagraphStyleAttributeName];

	// test 1: make the table style span the whole string, the convert to  
RTF (will work OK)

NSRange everything = NSMakeRange(0, [test length]);
[test setAttributes:tableAttrs range:everything];

	NSData* data = [test RTFFromRange:everything documentAttributes: 
[NSDictionary dictionary]];


	// test 2: make the table span all but the last character, then  
convert again (will break)

NSRange tableRange = NSMakeRange(0, [test length] - 1);
NSRange baseRange = NSMakeRange(NSMaxRange(tableRange), 1);

[test setAttributes:tableAttrs range:tableRange];
[test setAttributes:baseAttrs range:baseRange];

	data = [test RTFFromRange:everything documentAttributes:[NSDictionary  
dictionary]];

}

BTW, this is on 10.5.4 (Intel) and my app is GC-only.

Cheers

..Mark..

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSSpellChecker (foundation) broken for custom NSSpellServer servers

2008-09-09 Thread Adam Strzelecki

If you want a response from Apple, file a bug report at
bugreport.apple.com.  Otherwise, there's no guarantee anyone from
Apple will even see your message.


Okay, thanks. For a first time I thought that bugreport.apple.com  
requires paid ADC subscription, which I has not. But it worked with my  
ADC account great.
Also I just felt that this list may be good place to report this  
problem as it isn't really any product bug, but Foundation.framework  
bug.


Anyway please follow the discussion at 6206237: https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/51/wo/L6qK9EpzwAhafH2fLAhk7g/7.57.20.0.3 
 now.


Thanks,
--
Adam Strzelecki

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Best 'native' formats for NSImage and NSSound?

2008-09-09 Thread Phil
On Tue, Sep 2, 2008 at 5:18 AM, Matt <[EMAIL PROTECTED]> wrote:
> In running Shark on my app recently I noticed that by far, my app spent most
> of its time in: CGSConvertBGR888toRGBA.
>

This has come up on the quartz-dev mailing list:


Where there was a suggestion that you can get much better performance
through OpenGL with some Apple extensions:


Phil
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Best 'native' formats for NSImage and NSSound?

2008-09-09 Thread Negm-Awad Amin

Hi,

do you load the image with -imageNamed: and add the suffix? IIRC, this  
forces NSImage to reload the image file. Did you try to refer to the  
image without suffx? In this case NSImage looks for a appropiate image  
in iits image heap and takes this one instead of the file. If it does  
not find a image with this name, it looks inside the bundle for the  
image, accepting all suffixes.


Maybe this helps.


Cheers,
Amin


Am Mo,01.09.2008 um 19:18 schrieb Matt:

I am building an app that uses NSImage to repeatedly draw subrects  
from a
set of large .PNG files. I am also using NSSound to play sound  
effects. I

have been using .WAV files for the NSSound's.

In running Shark on my app recently I noticed that by far, my app  
spent most

of its time in: CGSConvertBGR888toRGBA.

I'm having trouble understanding what this means. It appears that
CoreGraphics is having to convert some of my non-alpha channel  
images to

have an alpha, and perhaps re-order the bytes? But shouldn't these
conversions only occur once, when CG realizes it needs this additional
channel? My app is re-using the same NSImages each frame, simply  
compositing

various sub-rects from the original large images.

This leads me to my question, which is two-part: can I optimize my  
graphics
files or manipulate NSImage into avoiding this  
(CGSConvertBGR888toRGBA)

processing? Or this an unavoidable part of the drawing?

And also, seeing how much work NSImage is having to do, it got me  
wondering,
are there any image/sound file formats which require 'less work' on  
the part
of NSImage and NSSound? In terms of loading the initial data,  
unpacking the

bytes, etc.

I was wondering if switching to .TIFF or .AIFF (or any other  
formats) could

possibly provide a performance boost?

Thank you in advance for any help/advice,
-Matt
___

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

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

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