Re: web-based Cocoa dev docs inaccessible

2010-09-13 Thread Andy Lee
On Sep 12, 2010, at 6:32 PM, Jeffrey Oleander wrote:
> Normally, I'd file an on-line criticism of the docs, but I can't get there, 
> and this is the closest means I have to doing so.

This list isn't an official channel for bug reports, so filing a Radar might 
actually be closer:



> 
> I was trying to look up something about NSAttributedStrings
> and found that the usual link led me to a page that no longer
> has a search box, links to docs, etc.
> 
> My BookMark has the URL:
> http://developer.apple.com/mac/library/navigation/index.html

This link works for me.  I get a page titled "Mac OS X Reference Library", with 
a search box and other stuff I expect.  Maybe you ran into a temporary glitch 
on Apple's servers?

> 
> but it took me here, so apparently there's a redirect:
> http://developer.apple.com/library/mac/#navigation/index.html

It works the other way for me: the "#navigation" link redirects to the 
"navigation" link.

> 
> and by successive trimming (first of "index.html" and then of everything from 
> the pound sign right) to try to get to something that works I tried this:
> http://developer.apple.com/library/mac/
> 
> When I trim off more, removing the "mac/" it takes me to 
> http://developer.apple.com/resources/
> Trying links from there, merely takes me back to the same garbage.

The resources link works for me.

What browser are you using?  Do you have any plugins or extensions installed 
that might be mucking with URLs or CSS?  What if you try a different browser?  
What if you try clearing your cache?

--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 arch...@mail-archive.com


Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread aaron smith
Hey all, quick question.

I'm working on a test to catch when an application crashes, and launch
another executable (eventually crash reporter).

I'm exhibiting strange behavior - whenever I quit the application
normally, the information I'm getting back about what happened and why
it stopped is always a signal, but the signal is never the same.

So a couple questions:

-Where can I find all of the signal definitions? I've found up to
about 50 of them, but I'm getting signals in the hundreds.
-Would you be willing to skim this code real quick?
(http://pastebin.org/859983). It's pretty short. The focus is the
main() function.

There are a couple printf's in there just so I could figure out which
signals are being reported. I'm getting all kinds. Here's a couple of
session outputs.

--
error: Interrupted system call
waited: 7095
signal: 55
--
error: Interrupted system call
waited: 7136
signal: 96
--
error: Interrupted system call
waited: 7151
signal: 111

I get these from quitting the application normally (cmd+q) or going to
the menu>quit option.

Since I'm not able to find where some of these signals are defined I'm
not sure what they are.

Alternatively, I found a list of signals that come directly from the
kernel and are sent to processes:
http://www.mugginsoft.com/content/how-crash-cocoa-app-testing-purposes-abnormal-termination
http://www.opensource.apple.com/source/xnu/xnu-1228.3.13/bsd/uxkern/ux_exception.c?f=text
would it be valid to check against those and ignore the rest?

Thanks in advance!
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread Ken Thomases
On Sep 13, 2010, at 2:30 AM, aaron smith wrote:

> I'm working on a test to catch when an application crashes, and launch
> another executable (eventually crash reporter).
> 
> I'm exhibiting strange behavior - whenever I quit the application
> normally, the information I'm getting back about what happened and why
> it stopped is always a signal, but the signal is never the same.

You're using the wait() call incorrectly.  The return value on success is a 
PID, not the status.  (You've understood that at least once, since you compare 
it to the child PID.)  The status is output through a parameter.

Note the values you posted and how they're monotonically increasing (7095, 
7136, 7151).  PIDs.

So, the values you're seeing are not signals.  They're garbage.


That said, you have a more fundamental problem.  It is not valid to run Cocoa 
or Core Foundation or any high-level framework in a child after a fork() and 
before an exec*().  Apple has made note of this here and there.  Unfortunately, 
the clearest description is no longer online.  It's in the Leopard release 
notes for Core Foundation.  If you install the Leopard Core Library docset into 
Xcode, you can find it in there.

Here is what it says:

> CoreFoundation and fork()
> 
> Due to the behavior of fork(), CoreFoundation cannot be used on the 
> child-side of fork(). If you fork(), you must follow that with an exec*() 
> call of some sort, and you should not use CoreFoundation APIs within the 
> child, before the exec*(). The applies to all higher-level APIs which use 
> CoreFoundation, and since you cannot know what those higher-level APIs are 
> doing, and whether they are using CoreFoundation APIs, you should not use any 
> higher-level APIs either. This includes use of the daemon() function.
> 
> Additionally, per POSIX, only async-cancel-safe functions are safe to use on 
> the child side of fork(), so even use of lower-level libSystem/BSD/UNIX APIs 
> should be kept to a minimum, and ideally to only async-cancel-safe functions.
> 
> This has always been true, and there have been notes made of this on various 
> Cocoa developer mailling lists in the past. But CoreFoundation is taking some 
> stronger measures now to "enforce" this limitation, so we thought it would be 
> worthwhile to add a release note to call this out as well. A message is 
> written to stderr when something uses API which is definitely known not to be 
> safe in CoreFoundation after fork(). If file descriptor 2 has been closed, 
> however, you will get no message or notice, which is too bad. We tried to 
> make processes terminate in a very recognizable way, and did for a while and 
> that was very handy, but backwards binary compatibility prevented us from 
> doing so.

Regards,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread aaron smith
Thanks for pointing that I can't use high level frameworks in a child.
I'll set up everything I need for the execvp call before the actual
fork.

AH! I totally missed that I need to use an int to store the child exit
status info.

Here's a version that works now..

http://pastebin.org/860040

Thanks!

On Mon, Sep 13, 2010 at 12:47 AM, Ken Thomases  wrote:
> On Sep 13, 2010, at 2:30 AM, aaron smith wrote:
>
>> I'm working on a test to catch when an application crashes, and launch
>> another executable (eventually crash reporter).
>>
>> I'm exhibiting strange behavior - whenever I quit the application
>> normally, the information I'm getting back about what happened and why
>> it stopped is always a signal, but the signal is never the same.
>
> You're using the wait() call incorrectly.  The return value on success is a 
> PID, not the status.  (You've understood that at least once, since you 
> compare it to the child PID.)  The status is output through a parameter.
>
> Note the values you posted and how they're monotonically increasing (7095, 
> 7136, 7151).  PIDs.
>
> So, the values you're seeing are not signals.  They're garbage.
>
>
> That said, you have a more fundamental problem.  It is not valid to run Cocoa 
> or Core Foundation or any high-level framework in a child after a fork() and 
> before an exec*().  Apple has made note of this here and there.  
> Unfortunately, the clearest description is no longer online.  It's in the 
> Leopard release notes for Core Foundation.  If you install the Leopard Core 
> Library docset into Xcode, you can find it in there.
>
> Here is what it says:
>
>> CoreFoundation and fork()
>>
>> Due to the behavior of fork(), CoreFoundation cannot be used on the 
>> child-side of fork(). If you fork(), you must follow that with an exec*() 
>> call of some sort, and you should not use CoreFoundation APIs within the 
>> child, before the exec*(). The applies to all higher-level APIs which use 
>> CoreFoundation, and since you cannot know what those higher-level APIs are 
>> doing, and whether they are using CoreFoundation APIs, you should not use 
>> any higher-level APIs either. This includes use of the daemon() function.
>>
>> Additionally, per POSIX, only async-cancel-safe functions are safe to use on 
>> the child side of fork(), so even use of lower-level libSystem/BSD/UNIX APIs 
>> should be kept to a minimum, and ideally to only async-cancel-safe functions.
>>
>> This has always been true, and there have been notes made of this on various 
>> Cocoa developer mailling lists in the past. But CoreFoundation is taking 
>> some stronger measures now to "enforce" this limitation, so we thought it 
>> would be worthwhile to add a release note to call this out as well. A 
>> message is written to stderr when something uses API which is definitely 
>> known not to be safe in CoreFoundation after fork(). If file descriptor 2 
>> has been closed, however, you will get no message or notice, which is too 
>> bad. We tried to make processes terminate in a very recognizable way, and 
>> did for a while and that was very handy, but backwards binary compatibility 
>> prevented us from doing so.
>
> Regards,
> Ken
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread Stephen J. Butler
On Mon, Sep 13, 2010 at 3:05 AM, aaron smith
 wrote:
> Thanks for pointing that I can't use high level frameworks in a child.
> I'll set up everything I need for the execvp call before the actual
> fork.
>
> AH! I totally missed that I need to use an int to store the child exit
> status info.
>
> Here's a version that works now..
>
> http://pastebin.org/860040

You really shouldn't use the result of -[NSString UTF8String] past the
lifetime of the object itself. Either do a strcpy real quick, or use
-[NSString maximumLengthOfBytesUsingEncoding:] with -[NSString
getCString:maxLength:encoding:]
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread Ken Thomases
On Sep 13, 2010, at 3:05 AM, aaron smith wrote:

> Thanks for pointing that I can't use high level frameworks in a child.
> I'll set up everything I need for the execvp call before the actual
> fork.

You haven't addressed the problem.  I was not talking about the later fork(), 
but the first one.  These two lines:

pid_t child = fork();
if(child==0) return NSApplicationMain(argc,(const char **)argv);

are untenable.  You are running the bulk of the original application in a 
forked-but-not-exec'ed child process.  Your whole approach to this issue is 
unworkable.

Sorry,
Ken

___

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

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

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

This email sent to arch...@mail-archive.com


Re: i5 & i7 auto graphics switching

2010-09-13 Thread Stephane Madrau
2010/9/12 

> When it is running on the slow card, the CGDirectDisplayID will be x, and on
> the fast card it will be y. Is there anyway to derive x from y or y from x?
> I am trying to be able to uniquely identify screens even before/after a
> processor switch.

Given a CGDirectDisplayID, you can use
IORegistryEntryCreateCFProperties to get the display properties. In
the returned CFDictionary, the value associated with the
IODisplayPrefsKey remains the same before/after any GPU switch.

I don't know if this is documented anywhere, it's just the result of
my observations.

-- 
Stéphane
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread aaron smith
Thanks for the suggestions!

Yeah sorry I was getting around to fixing that return NSApplication thing.

here's another version that avoids higher level framework usage..

http://pastebin.com/20W1ZD8r

Does that look better?


On Mon, Sep 13, 2010 at 1:38 AM, Ken Thomases  wrote:
> On Sep 13, 2010, at 3:05 AM, aaron smith wrote:
>
>> Thanks for pointing that I can't use high level frameworks in a child.
>> I'll set up everything I need for the execvp call before the actual
>> fork.
>
> You haven't addressed the problem.  I was not talking about the later fork(), 
> but the first one.  These two lines:
>
>        pid_t child = fork();
>        if(child==0) return NSApplicationMain(argc,(const char **)argv);
>
> are untenable.  You are running the bulk of the original application in a 
> forked-but-not-exec'ed child process.  Your whole approach to this issue is 
> unworkable.
>
> Sorry,
> Ken
>
>
___

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

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

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

This email sent to arch...@mail-archive.com


MediaPlayer.framework causing Core Data migration errors

2010-09-13 Thread Ben
What a pain this has been for me. I have finally narrowed down the culprit for 
an error during migration of core data. 

When I run migration without including MediaPlayer.framework my app runs fine...


2010-09-13 10:41:33.942 Test[3446:207] beginEntityMapping
2010-09-13 10:41:35.803 Test[3446:207] endEntityMapping


When I include MediaPlayer.framework I get this error...

2010-09-13 10:46:15.660 Test[3468:207] beginEntityMapping
2010-09-13 10:46:17.505 Test[3468:207] endEntityMapping
2010-09-13 10:46:20.978 Test[3468:207] Unresolved error Error 
Domain=NSCocoaErrorDomain Code=134110 UserInfo=0x1e2a00 "Operation could not be 
completed. (Cocoa error 134110.)", {
NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=256 
UserInfo=0x1e4860 "Operation could not be completed. (Cocoa error 256.)";
reason = "Failed to save new store after first pass of migration.";
}
Program received signal:  “SIGABRT”.



Does anyone have any idea why this is happening or how I can resolve 
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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread aaron smith
One more note about this. It does work as expected. But I am going to
take out the dependency of having that hardcoded "1" parameter - which
the child looks for so it only runs the cocoa app. I'll probably
change it to use named pipes. Then it won't depend on having arguments
correct.

On Mon, Sep 13, 2010 at 2:24 AM, aaron smith
 wrote:
> Thanks for the suggestions!
>
> Yeah sorry I was getting around to fixing that return NSApplication thing.
>
> here's another version that avoids higher level framework usage..
>
> http://pastebin.com/20W1ZD8r
>
> Does that look better?
>
>
> On Mon, Sep 13, 2010 at 1:38 AM, Ken Thomases  wrote:
>> On Sep 13, 2010, at 3:05 AM, aaron smith wrote:
>>
>>> Thanks for pointing that I can't use high level frameworks in a child.
>>> I'll set up everything I need for the execvp call before the actual
>>> fork.
>>
>> You haven't addressed the problem.  I was not talking about the later 
>> fork(), but the first one.  These two lines:
>>
>>        pid_t child = fork();
>>        if(child==0) return NSApplicationMain(argc,(const char **)argv);
>>
>> are untenable.  You are running the bulk of the original application in a 
>> forked-but-not-exec'ed child process.  Your whole approach to this issue is 
>> unworkable.
>>
>> Sorry,
>> Ken
>>
>>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Problem managing BLOB containing images

2010-09-13 Thread Andrea Mattiuz
I have problems with download and upload blob data in my iPhone app using 
Sqlite. Everything seems to be ok if I insert the photos in the blob field with 
SQLite manager: I can read the image and manage it with my app.
When I export the table to xml with the SQLite manager's feature, it creates a 
file that contains in the photo field a value like X'FFD8FFE000104A46
0101010001000'.
After that I catch that value in a string with the method:

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
 
str = [str stringByAppendingString:string];
 }
 
How can I get the image back from that string?

Thanks,
Andrea




___

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

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

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

This email sent to arch...@mail-archive.com


Re: web-based Cocoa dev docs inaccessible

2010-09-13 Thread Richard Somers

On Sep 12, 2010, at 4:32 PM, Jeffrey Oleander wrote:


My BookMark has the URL:
http://developer.apple.com/mac/library/navigation/index.html


This takes me to:

 http://developer.apple.com/library/mac/navigation/

which I think is the official link for the Mac OS X Reference Library.

I never use this link because it has never worked properly. I get the  
spinning wait cursor (beach ball) so much when using this page that it  
is unusable. Just tested and confirmed using Mac OS X 10.5.8 PPC,  
Safari 5.0.2 with NO plug-ins installed, with Safari reset.


When I submit the above link to the Markup Validation Service

 http://validator.w3.org/

it results in 9 errors and 2 warnings.

--Richard

___

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

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

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

This email sent to arch...@mail-archive.com


How to highlight only part of the text in a text field?

2010-09-13 Thread Ulf Dunkel
When I open an openPanel in any application, I often see the file name 
field's content partly highlighted (or name it pre-selected), e.g.


   "[myFileName].extension"

where the string part in [] is already selected and ready to be 
overwritten, keeping the ".extension" part untouched by default.


I would like to use a similar behaviour in an editable text field of my 
document window, which I activate when the window is shown, using


   [mainWindow makeFirstResponder:myTextField];

The myTextField content has already be composed (like e.g. @"foo: bar").

I would like to see only "bar" preselected when the window opens and the 
myTextField is selected for editing.


I guess you folks know how to, while I poke through the documentation.
Can you help me out?

Thanks in advance,
Ulf Dunkel
___

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

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

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

This email sent to arch...@mail-archive.com


Re: How to highlight only part of the text in a text field?

2010-09-13 Thread Vincent Habchi
Le 13 sept. 2010 à 16:46, Ulf Dunkel a écrit :

> The myTextField content has already be composed (like e.g. @"foo: bar").
> 
> I would like to see only "bar" preselected when the window opens and the 
> myTextField is selected for editing.
> 
> I guess you folks know how to, while I poke through the documentation.
> Can you help me out?

Look at NSTextViewDelegate methods, especially:

 - (NSRange)textView:(NSTextView *)aTextView 
willChangeSelectionFromCharacterRange:(NSRange)oldRange 
toCharacterRange:(NSRange)newRange

Vincent

PS: Is calamus.net the same editor that was selling the Calamus application for 
Atari ST so long ago?___

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

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

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

This email sent to arch...@mail-archive.com


Re: CALayer instant content update

2010-09-13 Thread Matt Neuburg
On Fri, 3 Sep 2010 10:44:44 -0700, David Duncan 
said:

>If you want to have a layer that doesn't animate (crossfade) content changes,
then set the layer's actions dictionary like so:
>
>layer.actions = [NSDictionary dictionaryWithObject:[NSNull null]
forKey:@"contents"];
>
>This will prevent animation of the "contents" property. There are a lot of
other ways to do this too, I would recommend you read the documentation for
-[CALayer actionForKey:] for more details.

I would recommend that Apple improve the documentation so that the details
on actionForKey: are correct and complete. The documentation on this point
is probably the worst written and most incorrect and incomplete of anything
in the corpus. The particular document containing at least an attempt at
describing the action mechanism is this one:



But it *never* explicitly states the point you're making, that not only the
delegate but the actions dictionary, or any point along the search for an
action, can return NSNull to stop the search and prevent animation.

Other mistakes on that page include:

* The hidden property being set to NO or YES generates a search for an
action by the key kCAOnOrderIn or kCAOnOrderOut. (False. That key would be
@"hidden".)

* replaceSublayer:with: generates a search for an action by the key
kCATransition. (False. That key would be @"sublayers". As far as I can tell,
*nothing* ever generates a search on kCATransition.)

* Several other action search triggers, such as layout of the layer, are
omitted entirely.

The summary under actionForKey: on the CALayer class documentation page is,
if anything, even worse:

* "Return the value NULL if the search should not continue." (False. The
value to return, to stop the search, is [NSNull null]. And this is true for
every stage of the search, not just the first.)

* "If nil is returned their is no action specified for requested key."
(Gibberish, and even more so standing alone as a bulleted item in the middle
of the list.)

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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

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

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

This email sent to arch...@mail-archive.com


Re: i5 & i7 auto graphics switching

2010-09-13 Thread Trygve Inda
> 2010/9/12 
> 
>> When it is running on the slow card, the CGDirectDisplayID will be x, and on
>> the fast card it will be y. Is there anyway to derive x from y or y from x?
>> I am trying to be able to uniquely identify screens even before/after a
>> processor switch.
> 
> Given a CGDirectDisplayID, you can use
> IORegistryEntryCreateCFProperties to get the display properties. In
> the returned CFDictionary, the value associated with the
> IODisplayPrefsKey remains the same before/after any GPU switch.
> 
> I don't know if this is documented anywhere, it's just the result of
> my observations.

How do I get the CGDirectDisplayID into IORegistryEntryCreateCFProperties?

Is this any different than:

io_service_t    servicePort = CGDisplayIOServicePort (myCGDirectDisplayID);
CFDictionaryRef oldInfoDict = IODisplayCreateInfoDictionary (servicePort,
kNilOptions);

T.


___

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

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

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

This email sent to arch...@mail-archive.com


Re: CALayer instant content update

2010-09-13 Thread David Duncan
On Sep 13, 2010, at 7:58 AM, Matt Neuburg wrote:

> I would recommend that Apple improve the documentation

https://bugreport.apple.com/ or the feedback links at the bottom of every page 
in the documentation. If there isn't a bug, the issue doesn't exist.
--
David Duncan

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Number of layout managers for NSTextStorage increases

2010-09-13 Thread Jens Bauer
Hi Ross,

Thank you for your reply and pointers.
(Sorry it took so long; I didn't see your reply until today).

>On Sep 7, 2010, at 12:22 PM, Jens Bauer wrote:
>
>> ...Does anyone have an idea about why the number of layout managers
>> increase ?
>
>I don't know the answer, but I expect it is easy to find out. Set a
>breakpoint on layout manager -init and see who is creating them. Or,
>look at the contents of the layout managers array and see what it tells you.

As I don't know how to set breakpoint in NSLayoutManager's -init with
Xcode 2.5, I picked the second option.
Looking and comparing the layout managers in the array, I found out only
one was unique; the first (n-1) layout managers all had the same
information (compared using cmd-e and cmd-g in the log window.

- For instance, I get 15 of these (after switching back and forth 15 times):

,
,
,
,
,
,
,
,
,
,
,
,
,
,

...all containing the following:

1 containers, text backing has 2952 characters
selected character range {0, 0} affinity: downstream granularity:
character
marked character range {2952, 0}
Currently holding 2952 glyphs.
Glyph tree contents:  2952 characters, 2952 glyphs, 1 nodes, 32 node
bytes, 4096 storage bytes, 4128 total bytes, 1.40 bytes per character,
1.40 bytes per glyph
Layout tree contents:  2952 characters, 2952 glyphs, 2952 laid
glyphs, 106 laid line fragments, 1 nodes, 32 node bytes, 10200 storage
bytes, 10232 total bytes, 3.47 bytes per character, 3.47 bytes per
glyph, 27.85 laid glyphs per laid line fragment, 96.53 bytes per laid
line fragment


and one of these, which is the last one in the array:

1 containers, text backing has 2952 characters
selected character range {0, 0} affinity: upstream granularity: character
marked character range {2952, 0}
Currently holding 2952 glyphs.
Glyph tree contents:  2952 characters, 2952 glyphs, 1 nodes, 32 node
bytes, 0 storage bytes, 32 total bytes, 0.01 bytes per character, 0.01
bytes per glyph
Layout tree contents:  2952 characters, 2952 glyphs, 0 laid glyphs,
0 laid line fragments, 1 nodes, 32 node bytes, 0 storage bytes, 32 total
bytes, 0.01 bytes per character, 0.01 bytes per glyph, 0.00 laid glyphs
per laid line fragment, 0.00 bytes per laid line fragment

I do not know much about the inner workings of the layout manager, but I
can see that the "Glyph storage bytes" is zero (as well as laid glyphs)
in the last layout manager, where it's 4096 in all the others); the
storage bytes for the Layout tree is also zero in the last layout
manager, where it's 10200 bytes in the others.
-This is probably because the new layout manager didn't do any "work" yet.


When doing something I probably should not do, it fixes the # of layout
managers problem...

[layoutManager replaceTextStorage:fileContents];// This 
seems to fix
the crash, but keeps creating more layoutManagers!

  // keep only the last added layout manager:
while([[[textView textStorage] layoutManagers] count] > 1)
{
[[textView textStorage] removeLayoutManager:[[[textView 
textStorage]
layoutManagers] objectAtIndex:0]];
}

I'm pretty convinced I'm not supposed to do things like that.
If removing all the layout managers before I do a replaceTextStorage, I
get a crash. :)

The extra layout managers are probably present because there's something
I did not clean up; maybe I've overlooked something in the docs, or I
need to use a different approach for having a file list that is switched
in/out of a single NSTextView.


Love,
Jens


___

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

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

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

This email sent to arch...@mail-archive.com


ScriptingBridge problem

2010-09-13 Thread John Nairn
I  am working with my Cocoa app to be scriptable by Python and Ruby  
using ScriptingBridge as well as by AppleScript. It is all working  
well, but I hit a serious issue today when I ran a long script. A  
python script that is fine and thoroughly checked will crash if it  
runs a long time. It crashes with no message to the Console or  to  
standard error. It crashes both when I run using tools in my Cocoa app  
or if it is run from Terminal app. I got it to work with a script  
rewrite, but it raises some serious concerns.


I reduced the problem to these two loop fragments. Note: the question  
here is about the Cocoa ScriptingBridge and not about these python  
code fragments, hence the reason to post on this Cocoa list. The issue  
must be related to how these commands trigger Apple Events through the  
Scripting Bridge. In these scripts, recs is an SBElementArray with a  
collection of objects from my app. The methods birthSDN() and  
birthSDNMax() are properties of my app's Cocoa objects and thus will  
trigger an AppleEvent to read them.


Method 1:

for indi in recs:
emin=indi.birthSDN()
emax=indi.birthSDNMax()
if emin!=0 and emin==emax:
(code to save details on indi)

Method 2:

emin=recs.arrayByApplyingSelector_("birthSDN")
emax=recs.arrayByApplyingSelector_("birthSDNMax")
for i in range(len(recs)):
if emin[i]!=0 and emin[i]==emax[i]:
(code to save details on indi)

Method 1 crashes if len(recs) is above about 6000. Method 2 is much  
faster and has not crashed yet (but I haven't tried huge files). The  
idea for method 2 came from Apple ScriptingBridge documentation that  
recommended using [SBElementArray arrayByApplyingSelector:] whenever  
possible. Specifically it says:


"As a corollary to the above guideline, avoid enumerating  
SBElementArray objects if there are alternatives, which Scripting  
Bridge and Cocoa provide..."


and then mentions [SBElementArray arrayByApplyingSelector:] (and some  
other tools). To check if "enumerating" was the problem, I modified  
method 1 to be


Method 1b:

for i in range(len(recs)):
indi=recs[i]
emin=indi.birthSDN()
emax=indi.birthSDNMax()
if emin!=0 and emin==emax:
(code to save  details on indi)

This version lasts longer than Method 1, but still crashes before  
long. I counted the total number of Apple Events triggered in these  
loops. The crashes occur in the range of 16000 to 2 events.


My concern is that the ScriptingBridge does not scale to long scripts  
and will always crash if too many AppleEvents are triggered. I would  
be happy if method 1 was just inefficient and slow (as implied by the  
documentation), but it is a serious problem if inefficient (but valid)  
scripts are crashing. Furthermore, I am working on numerous other  
scripts and method 2 simply cannot be used. Thus, while I try to  
"avoid" method 1, it cannot always be avoided?



John Nairn
http://www.geditcom.com
Genealogy Software for the Mac

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Number of layout managers for NSTextStorage increases

2010-09-13 Thread Kyle Sluder
On Mon, Sep 13, 2010 at 9:47 AM, Jens Bauer  wrote:
> As I don't know how to set breakpoint in NSLayoutManager's -init with
> Xcode 2.5, I picked the second option.

Unless you're still on Tiger, you should be running the latest version
of Xcode 3.

Either way, gdb hasn't changed. Pause the debugger and use the `break`
command. GDB documentation is available on the ADC site:
http://developer.apple.com/library/mac/#documentation/DeveloperTools/gdb/gdb/gdb_toc.html

It's important to know your tools.

--Kyle Sluder
___

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

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

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

This email sent to arch...@mail-archive.com


Re: ScriptingBridge problem

2010-09-13 Thread Kyle Sluder
On Mon, Sep 13, 2010 at 9:54 AM, John Nairn  wrote:
> I  am working with my Cocoa app to be scriptable by Python and Ruby using
> ScriptingBridge as well as by AppleScript. It is all working well, but I hit
> a serious issue today when I ran a long script. A python script that is fine
> and thoroughly checked will crash if it runs a long time. It crashes with no
> message to the Console or  to standard error. It crashes both when I run
> using tools in my Cocoa app or if it is run from Terminal app. I got it to
> work with a script rewrite, but it raises some serious concerns.

Are you timing out?

What happens if you use the same technique from Cocoa? Are you able to
ascertain any more useful information at the point of the crash?

--Kyle Sluder
___

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

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

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

This email sent to arch...@mail-archive.com


Backup color label

2010-09-13 Thread gMail.com
Hi,
I need to backup only these files changes (not the content):
Label color in the Finder
Filename (uppercase, lowercase)
Permissions
Lock Status
So I check the st_ctime of the files and detect whether to copy or not to
copy their attributes with FSSetCatalogInfo. The problem is that the
destination file st_ctime gets the system date at the moment I call
FSSetCatalogInfo. Instead I need to set it as well as the source file,
otherwise if I run the backup again I soon discover that the destination
file's st_ctime is more recent than the source file's one, while the
attributes are equal. So I wrongly backup forth and back forever.
Any solution?

Thanks
Leo


___

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

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

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

This email sent to arch...@mail-archive.com


Viewing a single NSTextStorage with two sets of attributes

2010-09-13 Thread Andrew Hughes

Hello all,

I'm trying to figure out the cleanest method for viewing one  
NSTextStorage with multiple attributes (mostly font and paragraph  
attributes). Basically I am developing a text editor program and I  
would like to have two different views on the same text, one in a non- 
paginated mode and another in a paginated mode, and I would like to be  
able to automatically apply a different font and paragraph style for  
the paginated mode. I'm not worried about the user being able to edit  
the attributes in this mode, but they should be able to edit the text  
itself.


I could simply apply and revert the attributes when the user switches  
between the modes, and in fact this is my current implementation.  
However, I would like to allow the user to have multiple windows open  
on the same document, and not necessarily have them in the same mode,  
and thus with the same formatting.


My initial thought was to subclass NSLayoutManager's attributedString:  
method, returning a different attributed string for each view.  
However, this didn't seem to work. It may have been a problem with  
glyph caching. I tried to invalidate the glyphs and layout, but the  
text persisted in the original formatting. Should this have worked?


The next thought was to subclass NSTextStorage and have two different  
text storage classes that passed on primitive calls to each other  
(such that they stayed in sync). However, this quickly became more  
complicated and problematic than I would like because I make extensive  
use of various delegate calls and the multiple text storages caused  
problems with this.


So I'm wondering if anyone else has solved this problem. I found one  
reference to this on the list archive, but the solution was  
essentially to use another solution that doesn't work for me.


Another possible solution would be to have the NSTextStorage send  
different attributed strings to the different layout managers.  
However, I'm unclear as to how the text storage object will know which  
layout manager is querying it, and thus which set of attributes to  
apply.


It seems like the best place for me to implement this would be  
somewhere in the layout manager because the layout manager is  
associated with the particular view and thus knows which set of  
attributes should be applied. Unfortunately, the layout manager is  
complex and it's unclear to me what I should override or change to  
make this happen.


Any help would be greatly appreciated.

Andrew
___

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

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

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

This email sent to arch...@mail-archive.com


INSTALL_PATH ignored in XCode

2010-09-13 Thread Daniele
Hello guys,
I'm making a plugin extensible application with bundles. Now, when I 
compile each bundle I would to put it automatically in a certain 
location in order to make some tests.
My location is a folder inside Application Support.
So I've taken the bundle target of my plugin project and I've set the:
INSTALL_PATH = "$(HOME)/Application Support/MyApp/Plugin"
and set to true DEPLOYMENT_LOCATION and DEPLOYMENT_POSTPROCESSING.
However nothing happends and no file are installed in that directory.
Where I'm wrong?
Thank you.
___

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

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

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

This email sent to arch...@mail-archive.com


Timing of UI events

2010-09-13 Thread Andrew Coad

Can I ask for advice on the most accurate way of determining the exact time 
that a UI event occurs at? I have timing information coming into the 
application from the audio sub-system - this is translating audio samples into 
host time. I need to compare the time that the user touches a UIButton relative 
to the audio events. There is approximately a +/- 2-5mS window either side of 
the audio event within which the application considers the two events to be "at 
the same time."

Right now, in early protoyping, I am grabbing the host time in the UIButton 
event handler thus:

- (IBAction)handleButtonEvent:(id)sender {

UInt64 hostTime;
uint64_t hostTimeInNanos;

hostTime = mach_absolute_time();
hostTimeInNanos = hostTime * hostTimeToNanosConversionFactor;

if (![sender isKindOfClass:[UIButton class]])
return;

switch ([sender tag]) {
case kETRTRightPadButton:
// handle right pad touch etc. etc
// compare hostTimeInNanos to audio timestamp and figure difference

I am assuming that this is not the best way as I am grabbing the time after the 
event has been dispatched which could add indeterminate delays and certainly 
more than the 2-5mS window I'm trying to measure within.

I can see that UIEvent has a timestamp of type NSInterval which has 
sub-millisecond resolution. Should I use this? What is the relationship between 
this timestamp and mach_absolute_time()? Any better ways to do this?

Andrew Coad

  
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Question about architecture

2010-09-13 Thread Daniel Lopes
Thanks a lot for answer Chris, so I'm in the right direction.

Have good week.

--
Daniel Lopes


On Sat, Sep 11, 2010 at 7:18 AM, Chris Hanson  wrote:

> On Sep 9, 2010, at 7:32 AM, Daniel Lopes wrote:
>
> > My idea for organization is separate the entire content on the left side
> in
> > a new Nib called sidebar and set the FileOwner to a controller in Window
> > Nib. Also do the same thing for the right part of the Split View.
> >
> > That behavior the behavior to separate big "components" of the UI in
> > diferent nib's is right? Create custom views for the header is a good
> > pratice? I know this a big question but the answer will help me a lot.
>
> That’s a perfectly reasonable way to organize your application, and pretty
> much why NSViewController exists.
>
> You’d have, say, MySidebarController and MyContentController, both
> subclasses of NSViewController and with their own nibs, which you could
> instantiate in your NSWindowController subclass or its nib.  You’d get your
> NSViewController subclass’s views, and put them in or use them to replace
> the appropriate “placeholder” views in your main window.
>
> Similarly, when it comes to doing things like creating custom views for
> things like headers, that’s how it’s done in Cocoa.  Custom drawing is done
> by subclassing, not by using drawing tools on a nib.
>
>  -- 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 arch...@mail-archive.com


Re: INSTALL_PATH ignored in XCode

2010-09-13 Thread Kyle Sluder
Your question is more appropriate for the xcode-users list. You might
have better luck asking there.

--Kyle Sluder

On Mon, Sep 13, 2010 at 3:34 AM, Daniele  wrote:
> Hello guys,
> I'm making a plugin extensible application with bundles. Now, when I
> compile each bundle I would to put it automatically in a certain
> location in order to make some tests.
> My location is a folder inside Application Support.
> So I've taken the bundle target of my plugin project and I've set the:
> INSTALL_PATH = "$(HOME)/Application Support/MyApp/Plugin"
> and set to true DEPLOYMENT_LOCATION and DEPLOYMENT_POSTPROCESSING.
> However nothing happends and no file are installed in that directory.
> Where I'm wrong?
> Thank you.
___

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

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

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

This email sent to arch...@mail-archive.com


Re: Viewing a single NSTextStorage with two sets of attributes

2010-09-13 Thread Aki Inoue
Andrew,

I usually recommend subclassing NSTextStorage returning different attributes 
based on a property/flag.

The tricky part is (as you might already encountered) to make sure setting up 
the property at the right moment.
In normal operations, the Text System queries the attributes roughly in two 
places: rendering and performing layout.

Capturing the rendering is relatively easy.  You can override -[NSTextView 
drawRect:], or appropriate NSLayoutManager rendering methods: 
-drawGlyphsForGlyphRange:atPoint: and/or -drawBackgroundForGlyphRange:atPoint:.

The layout side is a bit involved since it can be invoked asynchronously from 
the background layout and/or non-contiguous layout settings.

You can override two points: -[NSLayoutManager 
textStorage:edited:range:changeInLength:invalidatedRange:] and 
-[NSATSTypesetter 
layoutCharactersInRange:forLayoutManager:maximumNumberOfLineFragments :].

From there, you can ensure the text storage property is right whenever 
accessing the layout manager methods.

Aki

On 2010/09/12, at 11:27, Andrew Hughes wrote:

> Hello all,
> 
> I'm trying to figure out the cleanest method for viewing one NSTextStorage 
> with multiple attributes (mostly font and paragraph attributes). Basically I 
> am developing a text editor program and I would like to have two different 
> views on the same text, one in a non-paginated mode and another in a 
> paginated mode, and I would like to be able to automatically apply a 
> different font and paragraph style for the paginated mode. I'm not worried 
> about the user being able to edit the attributes in this mode, but they 
> should be able to edit the text itself.
> 
> I could simply apply and revert the attributes when the user switches between 
> the modes, and in fact this is my current implementation. However, I would 
> like to allow the user to have multiple windows open on the same document, 
> and not necessarily have them in the same mode, and thus with the same 
> formatting.
> 
> My initial thought was to subclass NSLayoutManager's attributedString: 
> method, returning a different attributed string for each view. However, this 
> didn't seem to work. It may have been a problem with glyph caching. I tried 
> to invalidate the glyphs and layout, but the text persisted in the original 
> formatting. Should this have worked?
> 
> The next thought was to subclass NSTextStorage and have two different text 
> storage classes that passed on primitive calls to each other (such that they 
> stayed in sync). However, this quickly became more complicated and 
> problematic than I would like because I make extensive use of various 
> delegate calls and the multiple text storages caused problems with this.
> 
> So I'm wondering if anyone else has solved this problem. I found one 
> reference to this on the list archive, but the solution was essentially to 
> use another solution that doesn't work for me.
> 
> Another possible solution would be to have the NSTextStorage send different 
> attributed strings to the different layout managers. However, I'm unclear as 
> to how the text storage object will know which layout manager is querying it, 
> and thus which set of attributes to apply.
> 
> It seems like the best place for me to implement this would be somewhere in 
> the layout manager because the layout manager is associated with the 
> particular view and thus knows which set of attributes should be applied. 
> Unfortunately, the layout manager is complex and it's unclear to me what I 
> should override or change to make this happen.
> 
> Any help would be greatly appreciated.
> 
> Andrew
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/aki%40apple.com
> 
> This email sent to a...@apple.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 arch...@mail-archive.com


Re: Is kCAOnOrderOut too good to be true?

2010-09-13 Thread Matt Neuburg

David Duncan said on Mar 09 2010 at 21:13:
> Unfortunately the answer is that this is a bug without a clear solution (in
> the removal case). Your best bet is to hide the layer, then remove it after
> the animation has completed rather than to remove it directly.

Unfortunately this seems not to work either: an animation returned as an
action by e.g. actionForLayer:forKey: when hiding a layer (key @"hidden") is
never performed. So the workaround would presumably involve setting the
layer's opacity to 0.

What I would do, then, is something like this:

[CATransaction setCompletionBlock: ^{
[layer removeFromSuperlayer];
}];
[CATransaction setValue:@"" forKey:@"byebye"];
layer.opacity = 0;

Now in the delegate's actionForLayer:forKey: you test for the incoming
@"opacity" key and the CATransaction @"byebye" key, and if both conditions
are met, return the desired animation.

m.

> 
> On Mar 9, 2010, at 11:52 AM, Steven Degutis wrote:
> 
>> Not yet; still asking everyone I know and hoping a Core Animation wizard
>> comes across this thread.
>> 
>> On Tue, Mar 9, 2010 at 2:49 PM, Jon Buffington wrote:
>> 
>>> Steven,
>>> 
>>> Did you ever find a solution to the kCAOnOrderOut animation problem? I was
>>> frustrated by this problem in the past but gave up as the animation was
>>> optional.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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 arch...@mail-archive.com


Re: Timing of UI events

2010-09-13 Thread Matt Neuburg
On Mon, 13 Sep 2010 11:56:51 -0400, Andrew Coad 
said:
>I can see that UIEvent has a timestamp of type NSInterval which has
sub-millisecond resolution. Should I use this? What is the relationship between
this timestamp and mach_absolute_time()? Any better ways to do this?

The timestamp is the time when the event occurred. mach_absolute_time(), or
CACurrentMediaTime(), is the time now.

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.apeth.net/matt/default.html#applescriptthings



___

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

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

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

This email sent to arch...@mail-archive.com


Testing Harness, or a/b testing scenario, and sending logs back to developer

2010-09-13 Thread Anna Billstrom
Hi,
Since last posting, I've done some more research. Has anyone used MixPanel for 
testing? The goal I'm looking for is getting touchevents, and feature usage, 
sent back to the apple developer so that we can do true a/b testing on user 
interface elemetns. Similar to web analytics, we can test drive features and 
see if they're being used in the field more than a control group. 

The main issue I'm running into architecturally: how to send the user log back 
from apps that aren't using network connectivity. Initiating an email or a 
"crash/recovery" send-to-server message the user clicks when an issue happens, 
is less than ideal because it only captures data on a failure basis, not on a 
successful usage basis. 

Is there any way to send the log back once an upgrade occurs? Another developer 
asked me this question and I honestly didn't know.

Any thoughts on how to set this up, or what you have used in the past, are 
welcome.

Thanks
Anna



Sent from my iPad___

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

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

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

This email sent to arch...@mail-archive.com


Re: web-based Cocoa dev docs inaccessible

2010-09-13 Thread Jeffrey Oleander
> On Mon, 2010/09/13, Andy Lee  wrote:
> From: Andy Lee 
> Subject: Re: web-based Cocoa dev docs inaccessible
> To: "Jeffrey Oleander" 
> Cc: cocoa-dev@lists.apple.com
> Date: Monday, 2010 September 13, 2:01
>> On 2010 Sep 12, at 6:32 PM, Jeffrey Oleander wrote:
>> Normally, I'd file an on-line criticism of the docs,
>> but I can't get there, and this is the closest means I have
>> to doing so.
>
> This list isn't an official channel for bug reports, so
> filing a Radar might actually be closer:
> 
> http://bugreport.apple.com

Good point.  I usually don't think of problems with the dev docs
as "product bugs", but appears I have a couple more still open 
from several years ago.  When I went there it displayed the 
vile message:
"Your Browser does not support JavaScript, or it is disabled.
To run this application, you must enable JavaScript!!"

MSFT JavaScript is evil!!

"AppleConnect requires Safari 1.0 or better."

Yes, indeed; JavaScript == evil evil evil.  It keeps 
(swly) reloading itself as I try to make 
pop-up menu choices (I had that problem with a simple 
math app implemented using php; we went with Python
and the guy I was working with became a Python fanatic).

But enabling or disabling JavaScript makes no difference 
with the accessibilty of the docs.

But I managed to work through that and file:
8423662  Dev Docs on web are inaccessible

For now, I'll try to get by with the down-loaded docs, but 
this is going to put a serious crimp in my efforts to stay 
current with versions I don't have.


  
___

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

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

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

This email sent to arch...@mail-archive.com


Core Data Migration : Splitting an Entity : Source Fetch ?

2010-09-13 Thread Jerry Krinock
I'm preparing a Core Data mapping model using the GUI in Xcode.  In the old 
model, I had, say, an Animal entity.  In the new model, I am replacing Animal 
with two new entities, Bird and Fish.

I can distinguish Birds from Fish because birds have a beak but fish do not.  
The old Animal entity had a relationship to Beak, 'beak', used for Birds only.  
Aha!

I can't find any examples, but I've guessed that the "Source Fetch" is what I 
need.  I created two Entity Mappings, AnimalToBird and AnimalToFish.  After 
trying various incantations from the Core Data Migration Guide and Predicate 
Programming Guide, I found that Xcode accepted my input if I set "Source Fetch" 
to Default and entered one of these as "Filter Predicate":

($source.beak != nil)  // Bird
($source.beak == nil)  // Fish

Because I'm working on a huge mapping model, I want to reduce uncertainties.  
The document "Xcode Mapping Tool for Core Data" gives only a trivial example, 
and NSEntityMigrationPolicy doesn't mention filters or predicates; this feature 
seems to be an "Xcode exclusive bonus".

So I'd appreciate if someone could indicate whether or not I've done this 
correctly.

Jerry Krinock

___

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

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

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

This email sent to arch...@mail-archive.com


Interpreting a Crash Log

2010-09-13 Thread koko
As I understand the entries below from a crash log my app crashed in  
objc_msgSend which was called from the method changeAColor:newColor in  
the class BMatrix, 1499 bytes into the method.


How do I find the offending line in the source from this information?

-koko



0   libobjc.A.dylib 0x93d2ded7 objc_msgSend + 23
1   com.BriTonLeap.convertitmac   	0x000140e7 -[BMatrix  
changeAColor:newColor:] + 1499

___

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

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

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

This email sent to arch...@mail-archive.com


Re: Interpreting a Crash Log

2010-09-13 Thread Jerry Krinock

On 2010 Sep 13, at 16:15, k...@highrolls.net wrote:

> As I understand the entries below from a crash log my app crashed in 
> objc_msgSend which was called from the method changeAColor:newColor in the 
> class BMatrix, 1499 bytes into the method.
> 
> How do I find the offending line in the source from this information?

If you *really want to*, read this:

http://www.cocoabuilder.com/archive/cocoa/276690-debugging-stack-traces.html?q=crash+report+line+number#276690

However unless you've made the mistake of writing a method which is 1000 lines 
long, you can usually find crashing bugs much faster by turning off Twitter, 
etc. and doing a "what if" critical reading of the errant method.

___

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

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

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

This email sent to arch...@mail-archive.com


CALayers - printing and flippedness

2010-09-13 Thread Gideon King
HI, I'm just getting started with some core animation work, and have run into a 
couple of issues pretty much straight away. 

The first is that I am trying to make sure that I will be able to print what I 
have on my view, but this doesn't seem to be working. I tried creating a layer 
backed view, which in its drawRect: method fills the rect with red, and added a 
sub-layer that has an image drawn on it, and an opacity on that layer of 0.5. 
It draws my image over the red background, but when I try to print the view, it 
just prints the drawing that happened in the view itself and not the sub-layer.

I then tried adding a subview with the image on it, and using the layer opacity 
setting for the layer backing of the subview, and it looked OK on screen, but 
printing it showed the image at full opacity. 

Is there some trick I need to know to be able to print exactly what I see on 
the screen?

The second part of this is that I am a little confused by the documentation's 
statements about layer coordinate system. I want to be able to write the 
drawing code once and deploy both on Mac and maybe iOS later. The documentation 
says that UIView uses a flipped coordinate system and that therefore the root 
layer also has a flipped coordinate system. I tried making my view flipped, but 
its layer doesn't appear to be flipped. Does this mean that I have to apply a 
flipping transform to the root layer? 

It also says that layers you instantiate on iOS are flipped and on Mac are not, 
so I presume this means that for every layer I instantiate on MacOS, I have to 
apply a flip transform to get it to the state where I can use the same drawing 
for both platforms, right? (I am so used to drawing in flipped views, that that 
is the way I would want to work anyway).


Thanks

Gideon



___

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

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

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

This email sent to arch...@mail-archive.com


Re: Interpreting a Crash Log

2010-09-13 Thread Wim Lewis

On Sep 13, 2010, at 4:15 PM, k...@highrolls.net wrote:
> As I understand the entries below from a crash log my app crashed in 
> objc_msgSend which was called from the method changeAColor:newColor in the 
> class BMatrix, 1499 bytes into the method.
> 
> How do I find the offending line in the source from this information?

IIRC, you can use atos(1) for this --- see its man page for details. You'll 
need to make sure of two things: that you're giving atos the same executable 
(or DWARF dsym file) that the crash report came from, and that you're adjusting 
for any load slide. You can use the LC_UUIDs to make sure of the first (see the 
thread that Jerry Krinock linked to).


___

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

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

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

This email sent to arch...@mail-archive.com


iOS Popup Menus?

2010-09-13 Thread Philip Mobley
How do you create the popup (and scrollable) contextual style menus that are in 
Safari's when you click the Bookmark / History button?

I can't find a prebuilt class in the UIKit that uses that specific behavior, 
and find it amazing that there isn't one available.

At this point, I am guessing that I can create one with a custom UIView and 
floating that on top of the main menu that uses a UITableView for the menu 
items.  But there are a number of basic issues that I am not sure how to 
approach, such as the fact that clicking outside the menu would close the menu. 
 (Do I push a full window sized transparent UIView with the menu as a subview 
of that and handle clicks that way?)

Does anyone have code that already does 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/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS Popup Menus?

2010-09-13 Thread Dave DeLong
How about a UITableViewController that's presented modally using 
-presentModalViewController:animated:?

Dave

On Sep 13, 2010, at 8:37 PM, Philip Mobley wrote:

> How do you create the popup (and scrollable) contextual style menus that are 
> in Safari's when you click the Bookmark / History button?
> 
> I can't find a prebuilt class in the UIKit that uses that specific behavior, 
> and find it amazing that there isn't one available.
> 
> At this point, I am guessing that I can create one with a custom UIView and 
> floating that on top of the main menu that uses a UITableView for the menu 
> items.  But there are a number of basic issues that I am not sure how to 
> approach, such as the fact that clicking outside the menu would close the 
> menu.  (Do I push a full window sized transparent UIView with the menu as a 
> subview of that and handle clicks that way?)
> 
> Does anyone have code that already does this?


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 arch...@mail-archive.com

Re: iOS Popup Menus?

2010-09-13 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 9/13/10 7:37 PM, Philip Mobley wrote:
> How do you create the popup (and scrollable) contextual style menus
> that are in Safari's when you click the Bookmark / History button?
> 
> I can't find a prebuilt class in the UIKit that uses that specific
> behavior, and find it amazing that there isn't one available.
> 
> At this point, I am guessing that I can create one with a custom
> UIView and floating that on top of the main menu that uses a
> UITableView for the menu items.  But there are a number of basic
> issues that I am not sure how to approach, such as the fact that
> clicking outside the menu would close the menu.  (Do I push a full
> window sized transparent UIView with the menu as a subview of that
> and handle clicks that way?)
> 
> Does anyone have code that already does this?

I assume you are talking about on iPad?

UIPopoverController:

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIPopoverController_class/Reference/Reference.html


- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFMjuERaOlrz5+0JdURArH5AJ9yrnrxFYaGDfEXxH0UKiFE/VjiMwCfSUfC
6IjnvnDBVgu46BM12PsN0QI=
=XER6
-END PGP 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 arch...@mail-archive.com


over-released NSIdEnumerator

2010-09-13 Thread Jeffrey Oleander
After my main NSDocument algorithm method was done doing its thing and returned 
up the call chain to where the button click had started its action, it would 
flip to showing NSPopAutoreleasePool and I was crashing with EXC_BAD_ACCESS.  
So, I looked at all of my alloc, initWith..., retain, and releases.  I did find 
a couple things which I should have been releasing, but had not, but no obvious 
ones I had been releasing that I should not have been.

So, I looked in the archives and on the web and fired up some of the tools, one 
by one: MallocDebug, ObjectAlloc (and tried malloc_history with no luck at 
all).  I got these:

from NSLog and the run log/Debugger Console:
2010-09-13 21:11:40.899 DijkstraCocoa[411] MyDocument findRelationship:  
---display predecessors---
(gdb) continue
2010-09-13 21:11:46.345 DijkstraCocoa[411] displayResults: 
resultsField=
2010-09-13 21:11:46.346 DijkstraCocoa[411] displayResults: 
superView=, superSuperView= 
window=
(gdb) continue
2010-09-13 21:11:48.638 DijkstraCocoa[411] MyDocument findRelationship:  --- 
DONE ---
Program received signal:  "EXC_BAD_ACCESS".
(gdb)

0 objc_msgSend
1 NSPopAutoreleasePool
2 -[NSApplication run]
3 NSApplicationMain
4 main

0 objc_msgSend
0x908611e4  <+0004>  beq-   0x90861308 
0x908611e8  <+0008>  lwzr12,0(r3)
0x908611ec  <+0012>  lwzr12,32(r12)
0x908611f0  <+0016>  stwr9,48(r1)
0x908611f4  <+0020>  lwzr11,0(r12)
0x908611f8  <+0024>  addi   r9,r12,8
0x908611fc  <+0028>  rlwinm r11,r11,2,0,29
0x90861200  <+0032>  andr12,r4,r11
0x90861204  <+0036>  lwzx   r2,r9,r12
0x90861208  <+0040>  addi   r12,r12,4
0x9086120c  <+0044>  cmplwi r2,0
0x90861210  <+0048>  beq-   0x90861234 

1 NSPopAutoreleasePool
0x90a21da8  <+0336>  beq+   cr7,0x90a21dbc 
0x90a21dac  <+0340>  addis  r4,r31,4097
0x90a21db0  <+0344>  mr r3,r29
0x90a21db4  <+0348>  lwzr4,-3720(r4)
0x90a21db8  <+0352>  bl 0x90b47aa8 
0x90a21dbc  <+0356>  lwzr2,8(r30)
0x90a21dc0  <+0360>  addi   r27,r27,1
0x90a21dc4  <+0364>  cmplw  cr7,r28,r2
0x90a21dc8  <+0368>  blt+   cr7,0x90a21d64 

2 -[NSApplication run]
0x9730407c  <+0592>  bl 0x976f8028 
0x97304080  <+0596>  lwzr3,864(r1)
0x97304084  <+0600>  addis  r4,r31,4095
0x97304088  <+0604>  lwzr4,6316(r4)
0x9730408c  <+0608>  bl 0x976f8028 
0x97304090  <+0612>  lwzr2,1320(r1)
0x97304094  <+0616>  lhar0,50(r2)
0x97304098  <+0620>  cmpwi  cr7,r0,0
0x9730409c  <+0624>  bne+   cr7,0x97303fe4 <-[NSApplication run]+440>
0x973040a0  <+0628>  addi   r3,r1,80
0x973040a4  <+0632>  bl 0x976f8208 
0x973040a8  <+0636>  b  0x97304130 <-[NSApplication run]+772>

3 NSApplicationMain
0x973c0750  <+0444>  bl 0x976fbb68 
0x973c0754  <+0448>  lwzr3,0(r30)
0x973c0758  <+0452>  addis  r4,r31,4083
0x973c075c  <+0456>  lwzr4,24824(r4)
0x973c0760  <+0460>  bl 0x976f8028 
0x973c0764  <+0464>  li r3,0
0x973c0768  <+0468>  orir3,r3,41471
0x973c076c  <+0472>  li r4,0
0x973c0770  <+0476>  li r5,0
0x973c0774  <+0480>  li r6,0
0x973c0778  <+0484>  bl 0x976fbb68 

4 main
#import 

int main(int argc, char *argv[])
{
return NSApplicationMain(argc, (const char **) argv);
}


MallocDebug says:
/Users/giovanni/Projects/DijkstraCocoa/build/DijkstraCocoa.app/Contents/MacOS/DijkstraCocoa
 accessed memory at 0x5575 illegally. It probably tried to dereference a 
pointer in freed memory.

The most interesting thing ObjAlloc were some tiny objects containing only an 
unsigned long long, which I allocate to stuff in a set, the sole purpose of 
which is as a quick test for the status of a node of my graph (not yet 
examined, examined and now in the priority queue, visited and removed from the 
priority queue).  (Come to think of it, there may be a better way.)  Anyway, it 
was the only kind of object that jumped out at me has having any irregularity, 
so I looked at them quite closely, before NSZombies told me it was worried 
about an enumerator.

NSZombies says:
2010-09-13 22:47:33.575 DijkstraCocoa[511] *** *** Selector 'release' sent to 
dealloced instance 0x593180 of class NSIdEnumerator.
Break at '-[_NSZombie release]' to debug.
2010-09-13 22:47:33.575 DijkstraCocoa[511] *** -[NSAutoreleasePool dealloc]: 
Exception ignored while releasing an object in an autorelease pool: 
NSGenericException *** Selector 'release' sent to dealloced instance 0x593180 
of class NSIdEnumerator.
Break at '-[_NSZombie release]' to debug.

0x90adb928  <+>  mr r5,r3
0x90adb92c  <+0004>  mr r3,r4
0x90adb930  <+0008>  b  0x90adb580 

0 -[_NSZombie release]
1 NSPopAutoreleasePool
2 _NSAppleEventManagerGenericHandler
3 aeDispatchAppleEvent(AEDesc const*, A...
4 dispatchEventAndSendReply(AEDesc cor...
5 aeProcessAppleEvent
6 AEProcessAppleEvent
7 _DPSNextEvent
8 -[NSApplication nextEventMatchingMask:untilDate:i...
9 -[NSApplication run]
10 NSApplicationMain
11 main

0 -[_NSZombie release]
1 NSPopAutoreleasePool
2 -[NSApplic

Re: Unix Signals Delivered from Quitting Cocoa Apps?

2010-09-13 Thread aaron smith
I finished this if anyone's interested. it's all controlled by the
Info.plist file now. And you don't need an arbitrary argument to
notify the child that it should only run the app.

The child only uses execvp so there's no high-leve api used.

http://pastebin.com/1pH8dxuM



On Mon, Sep 13, 2010 at 2:54 AM, aaron smith
 wrote:
> One more note about this. It does work as expected. But I am going to
> take out the dependency of having that hardcoded "1" parameter - which
> the child looks for so it only runs the cocoa app. I'll probably
> change it to use named pipes. Then it won't depend on having arguments
> correct.
>
> On Mon, Sep 13, 2010 at 2:24 AM, aaron smith
>  wrote:
>> Thanks for the suggestions!
>>
>> Yeah sorry I was getting around to fixing that return NSApplication thing.
>>
>> here's another version that avoids higher level framework usage..
>>
>> http://pastebin.com/20W1ZD8r
>>
>> Does that look better?
>>
>>
>> On Mon, Sep 13, 2010 at 1:38 AM, Ken Thomases  wrote:
>>> On Sep 13, 2010, at 3:05 AM, aaron smith wrote:
>>>
 Thanks for pointing that I can't use high level frameworks in a child.
 I'll set up everything I need for the execvp call before the actual
 fork.
>>>
>>> You haven't addressed the problem.  I was not talking about the later 
>>> fork(), but the first one.  These two lines:
>>>
>>>        pid_t child = fork();
>>>        if(child==0) return NSApplicationMain(argc,(const char **)argv);
>>>
>>> are untenable.  You are running the bulk of the original application in a 
>>> forked-but-not-exec'ed child process.  Your whole approach to this issue is 
>>> unworkable.
>>>
>>> Sorry,
>>> Ken
>>>
>>>
>>
>
___

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

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

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

This email sent to arch...@mail-archive.com


Re: over-released NSIdEnumerator

2010-09-13 Thread Quincey Morris
On Sep 13, 2010, at 20:34, Jeffrey Oleander wrote:

> After my main NSDocument algorithm method was done doing its thing and 
> returned up the call chain to where the button click had started its action, 
> it would flip to showing NSPopAutoreleasePool and I was crashing with 
> EXC_BAD_ACCESS.  So, I looked at all of my alloc, initWith..., retain, and 
> releases.  I did find a couple things which I should have been releasing, but 
> had not, but no obvious ones I had been releasing that I should not have been.

> NSZombies says:
> 2010-09-13 22:47:33.575 DijkstraCocoa[511] *** *** Selector 'release' sent to 
> dealloced instance 0x593180 of class NSIdEnumerator.
> Break at '-[_NSZombie release]' to debug.
> 2010-09-13 22:47:33.575 DijkstraCocoa[511] *** -[NSAutoreleasePool dealloc]: 
> Exception ignored while releasing an object in an autorelease pool: 
> NSGenericException *** Selector 'release' sent to dealloced instance 0x593180 
> of class NSIdEnumerator.
> Break at '-[_NSZombie release]' to debug.
> 
> 0x90adb928  <+>  mr   r5,r3
> 0x90adb92c  <+0004>  mr   r3,r4
> 0x90adb930  <+0008>  b0x90adb580 
> 
> 0 -[_NSZombie release]
> 1 NSPopAutoreleasePool
> 2 _NSAppleEventManagerGenericHandler
> 3 aeDispatchAppleEvent(AEDesc const*, A...
> 4 dispatchEventAndSendReply(AEDesc cor...
> 5 aeProcessAppleEvent
> 6 AEProcessAppleEvent
> 7 _DPSNextEvent
> 8 -[NSApplication nextEventMatchingMask:untilDate:i...
> 9 -[NSApplication run]
> 10 NSApplicationMain
> 11 main

> What I'm wondering is how do I go about tracking down which enumerator is 
> causing the problems?  I'm not explicitly using autorelease pools of my own.

At the risk of sounding rude, I'd suggest you'll get more effective help on 
this list if you are a little more specific in your questions. Vagueness ("my 
main NSDocument algorithm method was done doing its thing" -- what does that 
even mean?) and dumping too much information into your post (how does it help 
you or us to include disassembly of Apple-supplied frameworks functions?) 
discourages others even from reading it, let alone responding.

In this case, your symptoms *appear* very straightforward. You have 
over-released an object (a NSIdEnumerator, whatever that is, since it's not a 
public class) which is otherwise autoreleased. Because of the autorelease, the 
point at which the exception occurs is deferred from the offending source code 
to the point at which the autorelease pool is drained. At the time of the 
exception, it's far too late to debug the problem directly.

Assuming that NSIdEnumerator is in fact a concrete subclass of NSEnumerator, 
examining your code for ways it uses enumerators may be the most efficient way 
to proceed. However, it's also possible that the enumerator object is something 
internal to another object's actions (your code appears to have been servicing 
an apple event), so it's also possible that an over-release of a higher level 
object may be the cause of your problem, and NSIdEnumerator is only 
accidentally the place where the problem first shows up.

If careful examination of your code doesn't prove fruitful, you might try using 
Instruments to debug the problem. From the address of the object at the time of 
the exception, Instruments can tell you where in your application the object 
was originally allocated, and that will probably tell you why it was allocated, 
and from there you can start asking yourself questions like, "How long does 
this object need to stay alive, and what's keeping it alive?"


___

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

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

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

This email sent to arch...@mail-archive.com


Re: CALayers - printing and flippedness

2010-09-13 Thread Scott Anguish

On Sep 13, 2010, at 8:31 PM, Gideon King wrote:

> HI, I'm just getting started with some core animation work, and have run into 
> a couple of issues pretty much straight away. 
> 
> The first is that I am trying to make sure that I will be able to print what 
> I have on my view, but this doesn't seem to be working. I tried creating a 
> layer backed view, which in its drawRect: method fills the rect with red, and 
> added a sub-layer that has an image drawn on it, and an opacity on that layer 
> of 0.5. It draws my image over the red background, but when I try to print 
> the view, it just prints the drawing that happened in the view itself and not 
> the sub-layer.

Layer backed views should not have their layer’s messed with. You don’t own the 
layer, the view does. 

> 
> I then tried adding a subview with the image on it, and using the layer 
> opacity setting for the layer backing of the subview, and it looked OK on 
> screen, but printing it showed the image at full opacity. 

again, messing with the layer settings of a layer backed view. Set the opacity 
of the image you’re drawing. Don’t mess with a layer that isn’t yours.

> 
> Is there some trick I need to know to be able to print exactly what I see on 
> the screen?
> 
> The second part of this is that I am a little confused by the documentation's 
> statements about layer coordinate system. I want to be able to write the 
> drawing code once and deploy both on Mac and maybe iOS later. The 
> documentation says that UIView uses a flipped coordinate system and that 
> therefore the root layer also has a flipped coordinate system. I tried making 
> my view flipped, but its layer doesn't appear to be flipped. Does this mean 
> that I have to apply a flipping transform to the root layer? 
> 
> It also says that layers you instantiate on iOS are flipped and on Mac are 
> not, so I presume this means that for every layer I instantiate on MacOS, I 
> have to apply a flip transform to get it to the state where I can use the 
> same drawing for both platforms, right? (I am so used to drawing in flipped 
> views, that that is the way I would want to work anyway).

Yeah, this is a confusing issue.

UIView’s have a coordinate origin at the top, NSView’s at the bottom. Any 
default layer you make on iOS will have the the same origin, and same on OS X.

It’s hard to tell why you’re using layer’s in this case rather than strictly 
the views though.


___

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

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

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

This email sent to arch...@mail-archive.com


OT: Back To School

2010-09-13 Thread Jeremy Matthews
So I'm very likely going back to school for my CS degree...

Since I already work, I'm looking for an online class, most likely development 
(hence this email).
I was wondering if anyone had used any schools that leaned towards the 
iOS/Cocoa development environment, which they felt they benefitted from.

Thanks,
jeremy
___

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

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

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

This email sent to arch...@mail-archive.com


Re: over-released NSIdEnumerator

2010-09-13 Thread Nick Zitzmann

On Sep 13, 2010, at 9:34 PM, Jeffrey Oleander wrote:

> After my main NSDocument algorithm method was done doing its thing and 
> returned up the call chain to where the button click had started its action, 
> it would flip to showing NSPopAutoreleasePool and I was crashing with 
> EXC_BAD_ACCESS.  So, I looked at all of my alloc, initWith..., retain, and 
> releases.  I did find a couple things which I should have been releasing, but 
> had not, but no obvious ones I had been releasing that I should not have been.
> 
> So, I looked in the archives and on the web and fired up some of the tools, 
> one by one: MallocDebug, ObjectAlloc (and tried malloc_history with no luck 
> at all).  I got these:

What version of the developer tools are you using? MallocDebug and ObjectAlloc 
were replaced by Instruments in Xcode 3, and Instruments is far better at 
debugging these problems than the old tools.

> What I'm wondering is how do I go about tracking down which enumerator is 
> causing the problems?  I'm not explicitly using autorelease pools of my own.

If you're using Snow Leopard, then start up Instruments and use the Zombies 
instrument. Crash the app, and Instruments will show you the bad access.

If you're using Xcode 3 in Leopard, then start up Instruments and use the 
allocations instrument. Also start Console, because you will need to keep an 
eye on the console log. Start your app with the NSZombieEnabled environmental 
variable set to YES, and the instrument set to record reference counts. Then 
crash the app, watch the console log for the memory address, and search the 
trace for that address. Hopefully it won't take long to catch, because 32-bit 
Instruments won't last long with reference counting turned on.

If you're using Xcode 2 or earlier, then you can probably do the same thing 
using ObjectAlloc instead of Instruments.

Nick Zitzmann




___

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

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

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

This email sent to arch...@mail-archive.com