Re: NSTask oddity with getting stdout

2011-07-30 Thread Ken Thomases
On Jul 26, 2011, at 11:22 PM, Scott Ribe wrote:

> On Jul 26, 2011, at 5:52 PM, Shane Stanley wrote:
> 
>> In Snow Leopard that worked fine; a notification would be sent when new data
>> was written to the file. In Lion, as soon as it's called it goes into a
>> loop; each time readInBackgroundAndNotify is sent, a new notification comes
>> straight back.
> 
> An actual file? I'm reading from a pipe, so that could be one difference.

Yes.  For a file (vnode), there's no such thing as non-blocking or asynchronous 
I/O through the typical BSD/POSIX APIs (ignoring aio).  All attempts to read or 
write will complete synchronously, blocking even if the file descriptor has 
been configured as non-blocking and the file system is mounted over a slow or 
broken network connection.  Attempts to test a vnode file descriptor's 
readability or writability using select() or poll() will always report that the 
file is readable or writable.

kqueue() is a bit weird for vnodes.  EVFILT_READ fires whenever the file 
pointer is not at the end of the file.  That means you'll be notified 
repeatedly until you read to the end of the file, but won't be notified when 
you're actually at the end of the file.  That is, you won't be told to read 
once more to receive the EOF indication (e.g. zero-length read).  After that, 
you won't be notified again unless and until the file is extended by something 
writing more data to it, past the current end, or if you seek to some other 
position.  Although this seems to be what Shane wants, for most programmers 
this is a surprising result and differs quite a lot from other types of file 
descriptors.  It also doesn't correspond to NSFileHandle's documented behavior, 
since that doesn't differ by descriptor type.

Kqueue's EVFILT_WRITE isn't supported at all for vnodes, as it doesn't make 
sense, since it would always fire immediately.  The caller should simply not 
use kqueue() and should just go ahead and write unconditionally, instead.

None of this applies for I/O through a pipe or socket.

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


Section header artifacts in popover

2011-07-30 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hi all,

I have been attempting to debug a strange quirk I am getting when I use
a UISearchDisplayController in conjunction with a UIPopoverController.

Consider the perfectly normal looking filtered table view seen in a
popover at http://dl.dropbox.com/u/5847625/popover-with-kb.png

(Note that, to aid debugging and visualization, I set a red border on
the searchResultsTableView's CALayer.  This has no effect on the
behavior I am about to discuss.)

Now consider the appearance when I hide the keyboard:
http://dl.dropbox.com/u/5847625/popover-without-kb.png

As I expected, the searchResultsTableView cleanly animates to fill the
new popover content size, but somehow a stray section header (clearly
deriving from the searchContentsController, not shown but which has the
header present in about the right location) becomes visible

Since the errant section header overlays the red layer border, remains
fixed if I scroll the searchResultsTableView, and does not seem to
respond to touch events itself, it appears it actually sits on TOP of
the searchResultsTableView (which would appear inconsistent with the

While most users probably won't hide the keyboard manually, they will
rotate the device, which is also sufficient to trigger the quirk:
http://dl.dropbox.com/u/5847625/popover-landscape.png

I haven't had any luck Googling this, and trying to call
setNeedsDisplay/setNeedsLayout on either the searchResultsTableView or
the searchContentsController's table view has no effect.

Has anyone seen this issue and/or might have an idea of how to prevent it?

Thanks.

- -- 
Conrad Shultz

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

iEYEARECAAYFAk4zvOsACgkQaOlrz5+0JdUfxwCghjlxU4/boPJekribDWXSGRc6
5ckAn34GCUSSGb8bM1P/RhTmoEVQ1uUz
=o30v
-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


Re: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-30 Thread Thomas Davie

On 29 Jul 2011, at 23:54, wadesli...@mac.com wrote:

>> When invoking -archivedDataWithRootObject: on, say, dictionary, finding an 
>> un-encodeable object buried somewhere in the dictionary would seem to be 
>> quite common.  Similarly, when invoking -unarchiveObjectWithFile:, no 
>> programmer can guarantee what may be found on the filesystem.
> 
> And this is one of several concerns with the NSCoding system.  It may be that 
> the reason these classes haven't been updated is because there's 
> consternation over the value of such an update.  Some people consider 
> NSCoding intractably insecure and ergo unsuitable for use in pretty much 
> anything.  Others take issue with it for varied other reasons.  I personally 
> like it, but it's not flawless.
> 
> I wouldn't stress too much over it, in any case.  Sooner or later a change 
> will occur.  'til then, follow the best practices to date.

I'm not sure really what the argument here is.  What both of you seem to be 
asserting is "you could construct any object from a file… that file might be 
maliciously structured to construct objects that behave in evil ways".  This is 
true, but I'm not sure I see how this differs for *any* API that reads from the 
file system and constructs objects (as any file loading has to do).  Can you 
give me an example of something that NSCoding (particularly when using keyed 
archiving) doesn't deal with cleanly, that leads to a security problem not 
found in other file loading schemes?

Thanks

Tom Davie___

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

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

2011-07-30 Thread Ken Thomases
On Jul 28, 2011, at 1:14 PM, Jens Alfke wrote:

> On Jul 27, 2011, at 8:02 AM, Guido Sales Calvano wrote:
> 
>> Ogre3D however, uses a cocoa window to render on, and obviously I want user 
>> input. But if I start ogre in a dynamic library ui events register 
>> incorrectly. 
> 
> It’s not the fact that it’s in a dynamic library that causes trouble (for 
> example, all system frameworks are in dynamic libraries!) It’s the fact that 
> you’re starting a generic Unix process (node.js server) and then trying to 
> turn it into a GUI app by calling AppKit in it, without going through the 
> usual AppKit initialization (NSApplicationMain). However, I don’t think 
> calling NSApplicationMain is the right thing for you to do, because (a) it 
> expects to be the first thing called when the process starts, and (b) it will 
> take over the main thread.
> 
> I know that this can be done, though I don’t know the details of how.

You want to do a few things:

* Read the class overview for NSApplication.

* Invoke [SomeClass sharedApplication], where SomeClass is either NSApplication 
or a custom subclass of NSApplication.  (It's what you would set for the 
NSPrincipalClass key in the Info.plist of a more traditional app.)

* Call [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular].  If 
you need to target 10.5 or earlier, use TransformProcessType() instead.

* Load your main NIB, if you're using one.

* Use the main thread to process events.  Either invoke -[NSApplication run] or 
implement its equivalent.  See Apple's GLUT sample code for an example of what 
sorts of things -run does.
http://developer.apple.com/library/mac/#samplecode/glut/Listings/GLUTApplication_m.html

Depending on the design of the host program into which you're loading Cocoa, 
you may need to invert the work of -run so that it's suitable for being called 
regularly, processing pending events, and then returning to let the host do its 
work.

Sadly, Cocoa and many of the frameworks on which it is based really do depend 
on the main thread and its run loop.  Events have to be received there and its 
run loop has to be serviced (run) on a regular basis.

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: Filter an array

2011-07-30 Thread Ken Thomases
On Jul 29, 2011, at 11:09 AM, Wade Tregaskis wrote:

> for (NSString *path in paths) {
>   NSURL *url = [[NSURL alloc] initFileURLWithPath:path];
>   NSString *uti = nil;
>   NSError *error = nil;
> 
>   if ([url getResourceValue:&uti forKey:NSURLTypeIdentifierKey 
> error:&error]) {
>   for (NSString *supportedType in supportedTypes) {
>   if (UTTypeConformsTo(uti, supportedType)) {
>   // You have a match.
>   }
>   }
>   } else {
>   // Handle error
>   }
> }
> 
> There's a lot of nasty enumeration there, rather than hashtables which make 
> me much happier, but I don't know of a better way off hand.
> 
> However, -[NSURL getResourceValue:forKey:error:] is only available in iOS 4.0 
> and later.  So you'll have to find another route if you're targeting earlier 
> than that.

Don't know about iOS, but on Mac OS X if you're starting with a file path, 
you're probably better of using -[NSWorkspace typeOfFile:error:] rather than 
going through NSURL.

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: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Ken Thomases
On Jul 29, 2011, at 10:32 PM, Jerry Krinock wrote:

> With Auto Save enabled in a document, I find that Lion sometimes wants to 
> break into a sequence of operations to do an Auto Save.

What do you mean by "break into" or "a sequence of operations"?  The frameworks 
are almost certainly not interrupting the flow of execution of your code.  You 
must be giving them an opportunity to do their own thing by, for example, 
running the main run loop in one of the framework-defined modes.  Can you 
simply not do that?

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: Calculations in a tableview

2011-07-30 Thread Andre Masse
Thanks to all who helped me on and off the list. After a good night sleep and a 
day off coding, I think I finally got it :-)


> On 28/07/2011, at 23:15 , Quincey Morris wrote:
> 
> So how does the array controller enter this picture at all? It's a glue 
> object (aka "mediating controller") whose function is to sort and filter the 
> model array property. It has no role in sourcing actual data to your table.

This was the key!

Thanks again,

Andre Masse

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-30 Thread Fritz Anderson
On 29 Jul 2011, at 10:00 PM, Kyle Sluder wrote:

> Any code that throws exceptions will probably leak a few objects, since 
> according to the ARC design doc the ABI requires not draining autorelease 
> pools while unwinding the stack.

Are you sure (or does ARC work differently)?

:

> If you drain an autorelease pool that is not the top of the stack, all 
> (unreleased) autorelease pools above it on the stack are drained (and all 
> their objects sent appropriate release messages). If you neglect to send 
> drain to an autorelease pool when you are finished with it (something not 
> recommended), the pool is drained when one of the autorelease pools in which 
> it nests is drained.
> 
> This behavior has implications for exceptional conditions. If an exception 
> occurs, and the thread suddenly transfers out of the current context, the 
> pool associated with that context is drained. However, if that pool is not 
> the top pool on the thread’s stack, all the pools above the drained pool are 
> also drained (releasing all their objects in the process). The top 
> autorelease pool on the thread’s stack then becomes the pool previously 
> underneath the drained pool associated with the exceptional condition. 
> Because of this behavior, exception handlers do not need to release objects 
> that were sentautorelease. Neither is it necessary or even desirable for an 
> exception handler to send release to its autorelease pool, unless the handler 
> is re-raising the exception.

— F

___

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

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


NSNumberFormatter documentation error?

2011-07-30 Thread Andre Masse
Hi,

According to the NSNumberFormatter documentation:

setGeneratesDecimalNumbers:
Controls whether the receiver creates instances of NSDecimalNumber when it 
converts strings to number objects.

- (void)setGeneratesDecimalNumbers:(BOOL)flag
Parameters
flag
YES if the receiver should generate NSDecimalNumber instances, NO if it should 
generate NSNumber instances.
Discussion
The default is YES.

Dragging an NSNumberFormatter object in XCode 4.1, choosing "Mac OS X 10.4 + 
Default" and "Decimal" in the popup menus generate the following error at 
runtime when using values entered by the user in a tableview'cell:

-[__NSCFNumber decimalNumberByMultiplyingBy:]: unrecognized selector sent to 
instance 0x1067f3260

You have to choose "Mac OS X 10.4 + Custom" and select the checkbox "Generate 
Decimal Numbers". It looks like the default is "NO".

Do I misinterpret the documentation or should I file a bug on radar?

Thanks,

Andre Masse


___

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

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

2011-07-30 Thread James Merkel

Thanks, I'll take a look at IK.

I also found an Apple example application called ImageApp. It seems to  
work fine. No memory leaks.


The approach for using CIImage  seems to be to draw directly to an  
NSView rather than going to an NSImageView.


Jim Merkel

On Jul 29, 2011, at 11:46 PM, Scott Anguish wrote:

If you want to display many thumbnails (or images in general) why  
not use the ImageKit?


It’s what it was designed for. Check out IK* files.

“The IKImageBrowserView class is a view for displaying and browsing  
a large amount of images and movies efficiently.”



On Jul 25, 2011, at 3:04 PM, James Merkel wrote:

What is the fastest way to generate and display a thumbnail from a  
digital camera file?
In the past I used NSImage -- however the quality (with JPEG files)  
leaves something to be desired. Now I am using CIImage with Lanczos  
scale transform -- quality is very good but it is slow  
(particularly with raw files).


Should I be using the thumbnail capability of Image I/O? Will it  
have as good a  quality as CIImage, but be faster?


I am comparing the speed of my app (running in Xcode) with the  
speed of Preview. Preview is much faster ( 2x or 3X). I wonder what  
they are doing.


Of course the fastest way to display a thumbnail is to use the  
thumbnail in the file (assuming there is one). But that's the  
problem, there may not be a thumbnail in the file, in which case  
you need to create one yourself.


Thanks for any help,

Jim Merkel

___

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

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

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

This email sent to sc...@cocoadoc.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: Running Cocoa from a dynamic library

2011-07-30 Thread Bill Appleton
>> Sadly, Cocoa and many of the frameworks on which it is based really do
depend on the main thread and its run loop.  Events have to be received
there and its run loop has to be serviced (run) on a regular basis.

this situation is basically the same on other platforms. the events come in
on some particular thread (the main one or whatever) and they must be
process & not blocked

we developed an architecture where the events come in on the main loop and
are passed off to another thread. the worker thread must run some things on
the main loop, but all in all the main loop remains free to run.

hope that helps.


On Sat, Jul 30, 2011 at 1:32 AM, Ken Thomases  wrote:

> On Jul 28, 2011, at 1:14 PM, Jens Alfke wrote:
>
> > On Jul 27, 2011, at 8:02 AM, Guido Sales Calvano wrote:
> >
> >> Ogre3D however, uses a cocoa window to render on, and obviously I want
> user
> >> input. But if I start ogre in a dynamic library ui events register
> incorrectly.
> >
> > It’s not the fact that it’s in a dynamic library that causes trouble (for
> example, all system frameworks are in dynamic libraries!) It’s the fact that
> you’re starting a generic Unix process (node.js server) and then trying to
> turn it into a GUI app by calling AppKit in it, without going through the
> usual AppKit initialization (NSApplicationMain). However, I don’t think
> calling NSApplicationMain is the right thing for you to do, because (a) it
> expects to be the first thing called when the process starts, and (b) it
> will take over the main thread.
> >
> > I know that this can be done, though I don’t know the details of how.
>
> You want to do a few things:
>
> * Read the class overview for NSApplication.
>
> * Invoke [SomeClass sharedApplication], where SomeClass is either
> NSApplication or a custom subclass of NSApplication.  (It's what you would
> set for the NSPrincipalClass key in the Info.plist of a more traditional
> app.)
>
> * Call [NSApp setActivationPolicy:NSApplicationActivationPolicyRegular].
>  If you need to target 10.5 or earlier, use TransformProcessType() instead.
>
> * Load your main NIB, if you're using one.
>
> * Use the main thread to process events.  Either invoke -[NSApplication
> run] or implement its equivalent.  See Apple's GLUT sample code for an
> example of what sorts of things -run does.
>
> http://developer.apple.com/library/mac/#samplecode/glut/Listings/GLUTApplication_m.html
>
> Depending on the design of the host program into which you're loading
> Cocoa, you may need to invert the work of -run so that it's suitable for
> being called regularly, processing pending events, and then returning to let
> the host do its work.
>
> Sadly, Cocoa and many of the frameworks on which it is based really do
> depend on the main thread and its run loop.  Events have to be received
> there and its run loop has to be serviced (run) on a regular basis.
>
> 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/billappleton%40dreamfactory.com
>
> This email sent to billapple...@dreamfactory.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: Change in animation?

2011-07-30 Thread David Rowland
Yikes, so I did, and I had forgotten. Must be Codeheimer's disease.

That is the right answer. The routine is now,

- (void)fadeView:(UIView *)theView {
  theView.alpha = 1.0;
  infoButton.hidden = FALSE;
  [UIView animateWithDuration:2.5
delay:0
  options:UIViewAnimationOptionAllowUserInteraction
   animations:^{theView.alpha = 0.0;}
   completion:^(BOOL finished){infoButton.hidden = TRUE;}
   ];
}


and it does what I want.

Side question -- animateWithDuration: 

is a class method. How does it know which view to act on?


David




On Jul 29, 2011, at 9:58 PM, Roland King wrote:

> You asked something similar back in March
> 
> http://www.cocoabuilder.com/archive/cocoa/300383-iphone-animation-puzzle.html
> 
> I think the answer is still UIViewAnimationOptionAllowUserInteraction. Don't 
> know why changing to Lion would have made a difference however as I think 
> that option has been off by default in all versions of iOS 4.x, so it should 
> never have worked. 
> 
> On Jul 30, 2011, at 12:44 PM, David Rowland wrote:
> 
>> I have a routine that presents and then fades a label and a button,
>> 
>> - (void)fadeView:(UIView *)theView {
>> theView.alpha = 1.0;
>> infoButton.hidden = FALSE;
>> [UIView animateWithDuration:2.5
>>  animations:^{theView.alpha = 0.0;}
>>  completion:^(BOOL finished){infoButton.hidden = TRUE;}
>>  ];
>> }
>> 
>> 
___

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

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

2011-07-30 Thread Keary Suska
On Jul 30, 2011, at 9:09 AM, Andre Masse wrote:

> According to the NSNumberFormatter documentation:
> 
> setGeneratesDecimalNumbers:
> Controls whether the receiver creates instances of NSDecimalNumber when it 
> converts strings to number objects.
> 
> - (void)setGeneratesDecimalNumbers:(BOOL)flag
> Parameters
> flag
> YES if the receiver should generate NSDecimalNumber instances, NO if it 
> should generate NSNumber instances.
> Discussion
> The default is YES.
> 
> Dragging an NSNumberFormatter object in XCode 4.1, choosing "Mac OS X 10.4 + 
> Default" and "Decimal" in the popup menus generate the following error at 
> runtime when using values entered by the user in a tableview'cell:
> 
> -[__NSCFNumber decimalNumberByMultiplyingBy:]: unrecognized selector sent to 
> instance 0x1067f3260
> 
> You have to choose "Mac OS X 10.4 + Custom" and select the checkbox "Generate 
> Decimal Numbers". It looks like the default is "NO".
> 
> Do I misinterpret the documentation or should I file a bug on radar?

It's not a matter of misinterpretation per se. The documentation reflects the 
API, and would apply only to objects you create in your own code. Interface 
Builder may choose to have its own defaults for objects created by it, and 
those choices would not be documented by the API, but may be documented by 
IB-specific documentation. If there is no such IB-specific documentation (which 
is possible), I would only file a radar that Apple have specific documentation 
on object defaults in Interface Builder.

HTH,

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

___

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

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

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

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


Re: Change in animation?

2011-07-30 Thread Matt Neuburg
On Sat, 30 Jul 2011 09:22:45 -0700, David Rowland  said:
>Yikes, so I did, and I had forgotten. Must be Codeheimer's disease.
>Side question -- animateWithDuration: 
>
>is a class method. How does it know which view to act on?

You order up your animations in advance, in the block supplied as the 
animations: parameter, and then they take place at the next "redraw moment". In 
your case, you have set theView.alpha in that block, so you are asking for that 
change on that view to be portrayed as animated. My iOS book is particularly 
helpful on how Core Animation works (on iOS) - and you can read that chapter 
even if you don't have the book:

http://www.apeth.com/iOSBook/ch17.html

m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

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

2011-07-30 Thread Andre Masse
Thanks for the clarification.

Andre Masse

> It's not a matter of misinterpretation per se. The documentation reflects the 
> API, and would apply only to objects you create in your own code. Interface 
> Builder may choose to have its own defaults for objects created by it, and 
> those choices would not be documented by the API, but may be documented by 
> IB-specific documentation. If there is no such IB-specific documentation 
> (which is possible), I would only file a radar that Apple have specific 
> documentation on object defaults in Interface Builder.
> 
> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 

___

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

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

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

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


Re: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Jerry Krinock

On 2011 Jul 30, at 02:10, Ken Thomases wrote:

> On Jul 29, 2011, at 10:32 PM, Jerry Krinock wrote:
> 
>> With Auto Save enabled in a document, I find that Lion sometimes wants to 
>> break into a sequence of operations to do an Auto Save.
> 
> What do you mean by "break into" or "a sequence of operations"?

Thank you, Ken.  Sorry, I should have been more explicit – NSOperations.  To 
execute some user commands, my app queues up, oh, 5-100 NSOperations.  The 
entire sequence of operations may take 5-60 seconds.  Some of the operations 
change the data model.

Before my fix, Lion would typically sneak in one or more Auto Saves in between 
some of these operations.  These Auto Saves were pointless and annoying.  After 
my fix, the operations proceed without interruption, then Auto Save kicks in to 
do its thing 10-15 seconds after they are done.  Makes much more sense.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread wadeslists
> - (void)saveToURL:(NSURL *)url
>  ofType:(NSString *)typeName
> forSaveOperation:(NSSaveOperationType)saveOperation
> completionHandler:(void (^)(NSError *errorOrNil))completionHandler {
>   if (saveOperation == NSAutosaveInPlaceOperation) {
>   if ([[[NSOperationQueue mainQueue] operations] count] != 0) {
>   // "No, I'm busy now"
> 
>   // If you don't do this, it hangs forever…
>   completionHandler(nil) ;
> 
>   return ;
>   }
>   }

That doesn't seem right at all.  I haven't played with autosaving that much 
yet, but as I understand it, your document will be told to auto-save in a 
variety of situations - such as when another application wants to read the 
document on disk, which could be a consequence of the user dragging and 
dropping the document into e.g. Mail, as an attachment.

The point is to ensure that what's on disk is the latest copy; what the user is 
seeing.  You're lying to the save machinery by saying that you have saved, when 
you have not.  So NSFileCoordinator will then think your file is up to date, 
and let others read (or write) it.  It could lead to all sorts of nasty 
behaviours.

It may also confuse NSDocument's internal change management machinery; the 
NSDocument will think it's saved, but it's not.  It may show the document as 
unmodified even though in-memory changes have not been persisted to disk.  That 
could in turn have consequences of data loss if sudden application termination 
is in play.

What you should be doing is deferring the save - just hang on to 
'completionHandler', queue up the save for the next available opportunity, and 
invoke the handler after the save really happens.

You mentioned in a separate message that you're using NSOperations - could you 
not just add another operation to the end of your operation graph, that 
performs the save?

The only way I'd consider your current behaviour correct is if you're in the 
middle of an extended user interaction (e.g. you have a sheet open to apply 
some mutation, and the user is still in the middle of choosing the parameters 
of that mutation).  But in that case any changes the operation might entail 
shouldn't yet be applied to the document, so it shouldn't be thinking it's 
modified to begin with.  And a big hint that you're in this scenario is if you 
have a big 'Cancel' button which aborts the prospective changes and leaves the 
document unmodified.  It sounds more like you're in the middle of applying a 
user action, one that has been expressly approved and is merely taking some 
time.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Jerry Krinock

On 2011 Jul 30, at 15:39, wadesli...@mac.com wrote:

> You're lying to the save machinery by saying that you have saved, when you 
> have not.  So NSFileCoordinator will then think your file is up to date, and 
> let others read (or write) it.  It could lead to all sorts of nasty behaviors…

Thank you, Wade.  Yes, that's a good point.

> What you should be doing is deferring the save - just hang on to 
> 'completionHandler', queue up the save for the next available opportunity, 
> and invoke the handler after the save really happens.

OK, but I thought of an easier solution.  Replace this line of code 

completionHandler(nil) ;

which told the system that I had saved with no error, with this:

completionHandler([NSError errorWithDomain:NSCocoaErrorDomain
  code:NSUserCancelledError
  userInfo:nil]) ;

Now I'm not lying to Mother any more.  And because this particular error 
domain/code is documented to not be displayed (see -Document-Based Applications 
Overview ▸ Error Handling in the Document Architecture), the user doesn't get 
any crap.

Indeed, the behavior is a little different now.  Instead of waiting 10-15 
seconds after my operations are completed, now the Auto Save happens 
immediately after my operations are completed.  This implies that the system 
now knows that it has unsaved data, and so it kicks in more aggressively.

I like it better now.  But it still seems that Apple should document the 
correct way to handle this situation.

> you're in the middle of applying a user action, one that has been expressly 
> approved and is merely taking some time

Yes, that is the situation.

___

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

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

2011-07-30 Thread James Merkel
I tried ImageKit and it works great.  Excellent quality. Thanks for  
the suggestion, Scott.
I didn't have to do much more than change an NSImageView to an  
IKImageView in InterfaceBuilder and the code.


However, there doesn't appear to be an easy way to print a CGImageRef  
(which you get from an IKImageView) . So I figure for the printing  
case,  I'll just open the file again and create an NSImage.
Seems counterintuitive to open the file again, but its' probably  
easier than converting a CGImageRef to an NSImage.
Interestingly, the quality of the printed NSImage is very good  
compared to the screen rendition. Never understood why that is.


Jim Merkel

On Jul 30, 2011, at 8:12 AM, James Merkel wrote:


Thanks, I'll take a look at IK.

I also found an Apple example application called ImageApp. It seems  
to work fine. No memory leaks.


The approach for using CIImage  seems to be to draw directly to an  
NSView rather than going to an NSImageView.


Jim Merkel

On Jul 29, 2011, at 11:46 PM, Scott Anguish wrote:

If you want to display many thumbnails (or images in general) why  
not use the ImageKit?


It’s what it was designed for. Check out IK* files.

“The IKImageBrowserView class is a view for displaying and browsing  
a large amount of images and movies efficiently.”



On Jul 25, 2011, at 3:04 PM, James Merkel wrote:

What is the fastest way to generate and display a thumbnail from a  
digital camera file?
In the past I used NSImage -- however the quality (with JPEG  
files) leaves something to be desired. Now I am using CIImage with  
Lanczos scale transform -- quality is very good but it is slow  
(particularly with raw files).


Should I be using the thumbnail capability of Image I/O? Will it  
have as good a  quality as CIImage, but be faster?


I am comparing the speed of my app (running in Xcode) with the  
speed of Preview. Preview is much faster ( 2x or 3X). I wonder  
what they are doing.


Of course the fastest way to display a thumbnail is to use the  
thumbnail in the file (assuming there is one). But that's the  
problem, there may not be a thumbnail in the file, in which case  
you need to create one yourself.


Thanks for any help,

Jim Merkel

___

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

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

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


This email sent to sc...@cocoadoc.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


Nib File Distortion

2011-07-30 Thread Ralph Long
I have a complex form or screen in which I have buttons, images, text boxes, 
boxes. Since using Xcode 4, 5, I have had problems sizing the text boxes and 
the images and having them retain their new location.
These items were nib was built using Xcode 3 and was properly aligned until I 
upgraded. 
Is there a maximum number of object that can occur on in a window (I have 
around 50)?
I select the save option but whoever I review or move around with IB I get the 
original screen with the items jumbled and extended 
around.___

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

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

2011-07-30 Thread John Hawkinson
> > I'm not sure if there is a way to observe file system stuff during
> > launch - if anyone knows, please let me know!

Greg Parker:
> Run in a debugger with a breakpoint at the top of main(). When you
> hit the breakpoint, start on fs_usage and continue. If you need to

In addition to this, TN2124
(http://developer.apple.com/library/mac/#technotes/tn2124/_index.html)
suggests setting INIT_Processes which gives you a 15-second startup
delay, and also cites QA1573
(http://developer.apple.com/library/mac/#qa/qa1573/_index.html) which
a whole slew of tricks including a DTrace probe, launchd property,
etc.

--jh...@mit.edu
  John Hawkinson

___

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

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


Issues where code produced in Snow Leopard won't work in Lion, but will compile in Xcode 4.1

2011-07-30 Thread Tom Miller
Hey everyone,

I'm having a strange issue with some code I produced in Snow Leopard on
Xcode 4.0 The code successfully compiled on 4.0. Once I upgraded to Lion and
Xcode 4.1 I had an issue where the code would compile and build the app
without any errors but wouldn't work in either debug mode of release mode
with it properly pointing to the correct object in IB.

- Tom Miller
  Pixelogic Software
  t...@pxlc.me
___

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

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

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

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


Re: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Quincey Morris
On Jul 30, 2011, at 18:41, Jerry Krinock wrote:

>  But it still seems that Apple should document the correct way to handle this 
> situation.

I can't help thinking that there was a (brief) section about this in the 2011 
WWDC session video that I watched. "If you don't want to be interrupted by an 
Auto Save, ...". If you haven't watched this video, it might be worth spending 
the 50 minutes it takes, to see if there's anything in there that would help.


___

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

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


Ticker tape display

2011-07-30 Thread Scott Steinman
I have drawn text into a CALayer.  I'd like to allow the user select the type 
of animation effect displayed, such as fading the text in/out by changing the 
CALayer's opacity.

One of the effects I'm trying to do is a ticker tape display where a line of 
text is scrolled repeatedly from off-screen on the right side to off-screen on 
the left side. What would be a good approach for this?

1. Use a CALayer whose width is that of its containing NSView, with its 
position animated from off-screen on the right, across the screen, then 
off-screen to the left? I can't find any documentation that would suggest that 
a CALayer's starting position can be off-screen past the edges of its 
containing NSView (with the contents of the CALayer clipped to the edges of the 
NSView).  

2. Make the containing NSView's width three times the width of the screen (so 
the CALayer has enough room to be off the screen to the left and to the right)? 
That would be very expensive memory-wise, so I'm hesitant to do it.

3. Use a CALayer that is scrolled by translating in 3D space, or would this 
preclude using other animation effects, such as fading the text in and out by 
changing transparency?

I hope I've made myself clear enough.  All I'm asking for is advice for a 
starting point to use.  I'll do the research and coding after that so I can 
learn Core Animation.

Thanks in advance for your help.

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


Release build throw "unrecognized selector sent to instance" for a category method

2011-07-30 Thread Bruno Berisso
Hi all.

I'm working on tow projects. One is a Mac application and the other is a static 
library used for the application. Both are in the same Xcode workspace.
In the library project I use several categories, one of them add some methods 
to NSDate to move a date around (ej: 'moveDateToNextMonth'). For some reason 
when set the build configuration to Release the calls '[date 
moveDateToNextMonth]' in my library project I get the "unrecognized selector 
sent to instance" error.

If some one has any clue I will really appreciate it.

Bruno.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-30 Thread Jens Alfke

On Jul 29, 2011, at 8:22 PM, Jerry Krinock wrote:

> +[NSKeyedArchiver isEncodeable:(id)object]
> +[NSKeyedUnarchiver isAValidArchive:(NSData*)data]

Neither of these are feasible without actually running the archiving, including 
calling all of the arbitrary -initWithCoder: and -encodeWithCoder: methods. So 
they’d have all the same issues we’ve been discussing so far — they’d have to 
use a try…catch block around the [un]archiving, basically.

—Jens



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: Nib File Distortion

2011-07-30 Thread Jens Alfke

On Jul 28, 2011, at 11:50 PM, Ralph Long wrote:

> I have a complex form or screen in which I have buttons, images, text boxes, 
> boxes. Since using Xcode 4, 5, I have had problems sizing the text boxes and 
> the images and having them retain their new location.
> These items were nib was built using Xcode 3 and was properly aligned until I 
> upgraded. 
> Is there a maximum number of object that can occur on in a window (I have 
> around 50)?

No; and that’s not a particularly large number.

> I select the save option but whoever I review or move around with IB I get 
> the original screen with the items jumbled and extended around.

You’re saying that if you close and re-open the nib in IB, the changes you made 
are lost?
That sounds like a bug in IB, and/or a corrupted nib file, perhaps.

—Jens



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: Issues where code produced in Snow Leopard won't work in Lion, but will compile in Xcode 4.1

2011-07-30 Thread Jens Alfke

On Jul 30, 2011, at 11:19 AM, Tom Miller wrote:

> the code would compile and build the app
> without any errors but wouldn't work in either debug mode of release mode
> with it properly pointing to the correct object in IB.

One more time: We don’t know what “wouldn’t work” means in this case. You have 
to describe EXACTLY what went wrong, what side effects there were (errors, 
crash logs, etc.) and what you expected to happen. In detail. We are not 
psychic and don’t watch over your shoulder while you run the app. 

I don’t know how you can expect us to give you any help at all, from the kind 
of descriptions you’ve been giving us for days now, but honestly, we can’t. We 
are not psychic and don’t watch over your shoulder while you run the app. I’m 
almost at the point of writing you off as intentionally trolling us.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: Ticker tape display

2011-07-30 Thread Graham Cox

On 31/07/2011, at 1:23 PM, Scott Steinman wrote:

> I have drawn text into a CALayer.  I'd like to allow the user select the type 
> of animation effect displayed, such as fading the text in/out by changing the 
> CALayer's opacity.

Do you mean CATextLayer? It's already optimised for displaying text and is 
really easy to use.

> One of the effects I'm trying to do is a ticker tape display where a line of 
> text is scrolled repeatedly from off-screen on the right side to off-screen 
> on the left side. What would be a good approach for this?
> 
> 1. Use a CALayer whose width is that of its containing NSView, with its 
> position animated from off-screen on the right, across the screen, then 
> off-screen to the left? I can't find any documentation that would suggest 
> that a CALayer's starting position can be off-screen past the edges of its 
> containing NSView (with the contents of the CALayer clipped to the edges of 
> the NSView).  

This will work. You can simply set the position property to place it within the 
view. It's OK if it's "off the edge", it will be clipped to the view's frame.

> 3. Use a CALayer that is scrolled by translating in 3D space, or would this 
> preclude using other animation effects, such as fading the text in and out by 
> changing transparency?

This amounts to the same thing. You can either translate the layer's transform, 
or simply set its position property. All properties such as transparency are 
independent of each other.



--Graham


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Jerry Krinock

On 2011 Jul 30, at 20:12, Quincey Morris wrote:

> I can't help thinking that there was a (brief) section about this in the 2011 
> WWDC session video that I watched. "If you don't want to be interrupted by an 
> Auto Save, ...". If you haven't watched this video, it might be worth 
> spending the 50 minutes it takes, to see if there's anything in there that 
> would help.

Thank you, Quincey.  I watched that a few weeks ago, and studied the part on 
Auto Save carefully.  I think that what you are recalling is the ability to 
cancel an Auto Save after it is started, by returning NO in 
-writeToURL:ofType:error:.  What I want to do is at a higher level – and 
simpler – which is to prevent the Auto Save from beginning in the first place.

Upon reviewing the slides one more time, I noticed that they recommend 
returning the same NSCocoaErrorDomain/NSUserCancelledError in 
-writeToURL:ofType:error: that I am now returning in 
-saveToURL:ofType:forSaveOperation:completionHandler:.

So, I feel better about my code now.  I'm doing what they recommend, but in a 
higher-level method, to achieve a higher-level result.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Release build throw "unrecognized selector sent to instance" for a category method

2011-07-30 Thread Jerry Krinock

On 2011 Jul 30, at 20:58, Bruno Berisso wrote:

> If some one has any clue I will really appreciate it.

Wow.  I remember a similar bug if you had a category in a framework, way back 
in Mac OS 10.3!  Read these…

http://www.cocoabuilder.com/archive/xcode/263621-framework-links-work-ok-in-10-5-and-10-4-crash-in-10-3.html?q=%22Framework+Links%22#264078

http://www.cocoabuilder.com/archive/cocoa/201996-simple-out-of-box-demo-private-framework-crashes-in-10-3-9.html?q=%22Simple+Out-of-Box%22#201996

However, 6 months later, after updating to Xcode 3.1.1, the workaround I 
published at the end of that second thread no longer worked.  I gave up and 
dropped support for Mac OS 10.3 at that point.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Telling Auto Save, "No, I'm busy now"

2011-07-30 Thread Jens Alfke

On Jul 30, 2011, at 9:45 PM, Jerry Krinock wrote:

> Thank you, Quincey.  I watched that a few weeks ago, and studied the part on 
> Auto Save carefully.  I think that what you are recalling is the ability to 
> cancel an Auto Save after it is started, by returning NO in 
> -writeToURL:ofType:error:.  What I want to do is at a higher level – and 
> simpler – which is to prevent the Auto Save from beginning in the first place.

Don’t you just want to _defer_ it until your data is in a consistent state 
again? Otherwise it’s possible to have a situation where by chance, every time 
AppKit tries to autosave, your code happens to be busy with some async 
operation. The autosave could be delayed indefinitely in that case, which is 
bad news.

I liked the earlier suggestion of just holding onto the completion routine, 
scheduling the autosave for after your last NSOperation completes, and then 
calling the completion handler.

—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


Re: Printing options

2011-07-30 Thread Eli Bach

On Jul 21, 2011, at 9:31 PM, Matt Neuburg wrote:

> On Thu, 21 Jul 2011 16:34:07 -0400, davel...@mac.com said:
> 
>> On Jul 19, 2011, at 3:25 PM, Amy Gibbs wrote:
> 
>>> In my app I have customer orders, and I just want to print out a copy. ... 
>>> I could lay it all out on a view and print that?
> 
> Yup, I've written an application that prints out customer orders in nice 
> columnar fashion with a header, columns, prices, total at the bottom, etc., 
> and it does exactly that. Printing is just drawing, it isn't hard. Just draw 
> lines in the places where you want lines, text in the places where you want 
> text, etc. m.

Another way that may be more flexible for you is to use a WebKit view, and use 
html to do your drawing for you.  It's pretty straightforward to use and then 
you can modify how it looks using a css file.

Eli

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-30 Thread Jerry Krinock

On 2011 Jul 30, at 21:09, Jens Alfke wrote:

> On Jul 29, 2011, at 8:22 PM, Jerry Krinock wrote:
> 
>> +[NSKeyedArchiver isEncodeable:(id)object]
>> +[NSKeyedUnarchiver isAValidArchive:(NSData*)data]

BTW, I forgot to mention those methods should return BOOLs.

> Neither of these are feasible without actually running the archiving, 
> including calling all of the arbitrary -initWithCoder: and -encodeWithCoder: 
> methods. So they’d have all the same issues we’ve been discussing so far — 
> they’d have to use a try…catch block around the [un]archiving, basically.

I don't think so, Jens.  "They" is Apple.  Apple has the source code for 
-initWithCoder: and -encodeWithCoder:.  They could remove the lines of code 
where those exceptions are created and return NO instead.

Anyhow, Apple is smarter than me, and they've clearly got the resources to 
handle this as well as fix the more important bugs in Lion that I'm holding my 
breath waiting for them to fix :))

So I filed an Enhancement - Apple Bug ID# 9870474 asking for those two methods.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Why Don't Cocoa's (Un)Archiving Methods return Errors?

2011-07-30 Thread Jens Alfke

On Jul 30, 2011, at 10:21 PM, Jerry Krinock wrote:

> I don't think so, Jens.  "They" is Apple.  Apple has the source code for 
> -initWithCoder: and -encodeWithCoder:. 

No they don’t — not for the implementations of those methods in our own 
classes. Anyone implementing an archivable class has to create custom 
implementations of those methods. Apple has no idea what those methods look 
like, and most importantly, what other objects they might try to archive.

So consider you have an NSArray that contains a Foo object. Foo is some 3rd 
party class that implements NSCoding. The Foo object has a reference to an 
NSDictionary, one of whose keys is a Bar object. Bar isn’t archivable.

So now you call +isEncodable: with that array. The best Apple (aka the 
Foundation framework) can do is to find that your Foo object is going to be 
archived since it’s in the array. Without calling into -[Foo encodeWithCoder:] 
it can’t possibly tell that Foo is going to try to archive that array it has, 
which contains the unarchivable Bar object. But if it does call into Foo, it’s 
eventually going to find itself trying to archive the Bar object and have no 
way to signal failure short of throwing an exception.

—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


Re: Release build throw "unrecognized selector sent to instance" for a category method

2011-07-30 Thread Bruno Berisso
Thanks for the links, but my problem is a little different.
The code in my library is executed fine, it's only crash when build in 
'Release' mode and just in this category. Other categories work just fine.

Thanks again.

On Jul 31, 2011, at 2:02 AM, Jerry Krinock wrote:

> 
> On 2011 Jul 30, at 20:58, Bruno Berisso wrote:
> 
>> If some one has any clue I will really appreciate it.
> 
> Wow.  I remember a similar bug if you had a category in a framework, way back 
> in Mac OS 10.3!  Read these…
> 
> http://www.cocoabuilder.com/archive/xcode/263621-framework-links-work-ok-in-10-5-and-10-4-crash-in-10-3.html?q=%22Framework+Links%22#264078
> 
> http://www.cocoabuilder.com/archive/cocoa/201996-simple-out-of-box-demo-private-framework-crashes-in-10-3-9.html?q=%22Simple+Out-of-Box%22#201996
> 
> However, 6 months later, after updating to Xcode 3.1.1, the workaround I 
> published at the end of that second thread no longer worked.  I gave up and 
> dropped support for Mac OS 10.3 at that point.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/bruno%40southlabs.net
> 
> This email sent to br...@southlabs.net

-- 
SouthLabs |  www.southlabs.com
Apple recommends SharePlus

SharePlus: NOW for 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: Return causes EXC_BAD_ACCESS

2011-07-30 Thread vincent habchi
> Memory is "virtual", the addresses you appear to be working with are not real 
> (i.e. they don't refer to the real address of the physical RAM underneath). 
> Instead, a bit of hardware translates these to the real addresses as needed 
> at some level far below the perception of your program. You cannot access the 
> virtual address space of any other process other than your own.

That is, of course, not true. When a process forks, the child and the parent, 
though being two separate processes, still share the same virtual memory map 
(at least until the child calls exec (3)). And you can arrange to share pages 
of memory in different processes via, e.g, shmat (2), at the Unix level. That's 
how most databases (e.g. PostGreSQL) work, inter alia.

Vincent___

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

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