Re: How to Convert "#FF00FF" String Specifying RGB Color to 32 bit int

2009-08-27 Thread Peter Zegelin
Sorry Graham - I should have mentioned that the color is rgba within  
the uint32.


Thanks everyone - Robs solution worked great, though I'll have to  
strip off the # first and then shift to the left a further 8 bits.


Never used NSScanner  before but its a good solution.

On 27/08/2009, at 9:50 AM, Peter Zegelin wrote:


Hi,

I have some xml where an rgb color value is specified via a  
"#XXYYZZ" type string. The xml is being read in via NSXMLParser. I  
can't seem to find an easy Cocoa way to convert this value to an  
unsigned int. I need an unsigned int rather than an NSColor as the  
value is used in C++ code.  Does anyone know of something I may be  
missing?


Thanks!

Peter
___

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

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

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

This email sent to pe...@fracturedsoftware.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: NSSplitView resizing

2009-08-27 Thread Bill Cheeseman


On Aug 26, 2009, at 11:55 PM, Oftenwrong Soong wrote:

n this app my needs are very limited (for now at least!) so I  
implemented a simple delegate method. Everyone's input helped  
tremendously. Thanks to everyone who posted:


- (void)splitView:(NSSplitView *)sender resizeSubviewsWithOldSize: 
(NSSize)oldSize.


It's easier to code this if you make use of the incoming oldSize  
parameter value. That's what it's there for. The comments in Apple's  
header file are more informative than the documentation for this  
delegate method.


--

Bill Cheeseman
b...@cheeseman.name

___

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

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


Xcode Analyze memory misunderstanding

2009-08-27 Thread Reza Farhad

Dear all

I am running my code through xcode "Build and Analyze" to check for  
bugs.

I have the function below which gives me the following error:

Object with +0 retain counts returned to caller where a +1 (owning)  
retain count is expected


I can not understand why can anybody enlighten me.

-( NSColor *)newColour
{
NSColor *todoColour = nil;
float   newRed, newGreen, newBlue;
float   newAverage;
do{
todoColour = [ self variationOnColor:colour ];
[ todoColour getRed:&newRed green:&newGreen blue:&newBlue 
alpha:nil ];
newAverage = ( newRed + newGreen + newBlue )/3;
}while( newAverage < 0.5 );
return todoColour;
}

thanks

Reza

___

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

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

2009-08-27 Thread Jonathan del Strother
On Thu, Aug 27, 2009 at 11:29 AM, Reza Farhad wrote:
> Dear all
>
> I am running my code through xcode "Build and Analyze" to check for bugs.
> I have the function below which gives me the following error:
>
> Object with +0 retain counts returned to caller where a +1 (owning) retain
> count is expected
>
> I can not understand why can anybody enlighten me.
>
> -( NSColor *)newColour
> {
>        NSColor         *todoColour = nil;
>        float           newRed, newGreen, newBlue;
>        float           newAverage;
>        do{
>                todoColour = [ self variationOnColor:colour ];
>                [ todoColour getRed:&newRed green:&newGreen blue:&newBlue
> alpha:nil ];
>                newAverage = ( newRed + newGreen + newBlue )/3;
>        }while( newAverage < 0.5 );
>        return todoColour;
> }
>


>From here - 
>http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html#//apple_ref/doc/uid/2043-BEHDEDDB
- methods starting with 'new' should return retained objects.  Your
code is functionally fine, it just doesn't follow the usual
convention.
___

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

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


Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Graham Cox
I'm using the following code to generate thumbnail images in one of my  
user interfaces. It works fine on my machine, and on all the ones I've  
tested, but a couple of users have reported that they don't see the  
thumbnails. One user experiencing this problem helped me to log some  
results which shows that the QLThumbnailImageCreate function is  
returning nil. The docs state that this will return nil if it can't  
read the file, but it's the exact same file on every system, loaded  
from my app's resources. So why would it fail in a few percent of  
cases, but mostly work? All affected users are running the latest  
system version.



	CFURLRef url = CFURLCreateWithFileSystemPath( NULL, (CFStringRef) 
[self path], kCFURLPOSIXPathStyle, NO );


	// logging the URL/path at this point shows that the correct path is  
being returned from [self path], a path to app internal resources


CGSize  maxImageSize = CGSizeMake( 512, 512 );
	NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: 
(id)kCFBooleanTrue, kQLThumbnailOptionIconModeKey, nil];


	CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize,  
(CFDictionaryRef)options );

CFRelease( url );

// on a very few systems, qli is nil here

Is there a possibility that QuickLook can somehow be turned off?

Any ideas?

--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: Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-27 Thread Mike Abdullah
Further to earlier answers, reread the docs on -[NSManagedObject  
initWithEntity:managedObjectContext:]


There's nothing to stop you doing this:

NSManagedObject *object = [[NSManagedObject alloc]  
initWithEntity:entity managedObjectContext:nil];

[object setFoo:bar];

as long as you supply a valid entity.

Mike.

On 24 Aug 2009, at 01:32, Dieterich Lawson wrote:


Hey all,

I have objects that I use with core data that were automatically  
generated
for me by xcode and represent entities in my data store. They all  
subclass
NSManagedObject, and do not have instance variables, but instead use  
the
@dynamic setting for their properties, pretty standard. My  
understanding is

that this allows the NSManagedObject superclass to generate the
getters/setters at runtime and store data in it's own, more  
efficient, Core

Data friendly way.

What this means for me, however, is that I can't just call [[Entity  
alloc]

init] and then get/set Entity's properties, because it won't properly
initialize unless it is given a managed object context. I need to be  
able to
use my objects in places that they won't be persisted, as just  
transient
objects, but this prevents that. The only way I know to initialize  
them is

by calling [NSEntityDescription insertNewObjectForEntityForName:name
inManagedObjectContext:managedObjectContext] . But, when creating  
objects

this way, they will be persisted on the next save call.

Does anyone know of a way to modify the objects so that I can use them
wherever I want without having to insert them into a managed object  
context?
I've read different places that you shouldn't do what I'm trying to  
do, but
if Core Data doesn't allow you to use its objects without persisting  
them,

then that would be a major shortcoming for me. Are there architectural
changes I can make that would overcome this?
Just so you know, I'm making a feed reader that has the option to save
selected stories from the feed for later, offline, browsing. I want  
to be
able to download the feed XML and create 'story' objects from that  
without

having to persist every story I fetch.
___

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

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

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

This email sent to cocoa...@mikeabdullah.net


___

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

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

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

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


Temporarily disabling all input events while non-blocking animations are playing

2009-08-27 Thread Oleg Krupnov
Hi,

I'd like my app to block while an animation is playing. Normally, I
would simply use a blocking animation, but now I have two short
animations playing simultaneously, so I have to make them both
non-blocking. How do I block the app in this case? Basically I'd like
to prevent the user from (inadvertently) interacting with the app
while the animations are in progress, because the app may go into an
invalid state.

Thanks!
___

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

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

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

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


Re: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Julien Jalon
Might be interesting to ask your user to use qlmanage -t on the file
to see if anything relevant appears here.

Also what kind of file is it? Maybe the user has some plugin installed there.

On Thursday, August 27, 2009, Graham Cox  wrote:
> I'm using the following code to generate thumbnail images in one of my user 
> interfaces. It works fine on my machine, and on all the ones I've tested, but 
> a couple of users have reported that they don't see the thumbnails. One user 
> experiencing this problem helped me to log some results which shows that the 
> QLThumbnailImageCreate function is returning nil. The docs state that this 
> will return nil if it can't read the file, but it's the exact same file on 
> every system, loaded from my app's resources. So why would it fail in a few 
> percent of cases, but mostly work? All affected users are running the latest 
> system version.
>
>
>         CFURLRef url = CFURLCreateWithFileSystemPath( NULL, 
> (CFStringRef)[self path], kCFURLPOSIXPathStyle, NO );
>
>         // logging the URL/path at this point shows that the correct path is 
> being returned from [self path], a path to app internal resources
>
>         CGSize  maxImageSize = CGSizeMake( 512, 512 );
>         NSDictionary* options = [NSDictionary 
> dictionaryWithObjectsAndKeys:(id)kCFBooleanTrue, 
> kQLThumbnailOptionIconModeKey, nil];
>
>         CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize, 
> (CFDictionaryRef)options );
>         CFRelease( url );
>
>         // on a very few systems, qli is nil here
>
> Is there a possibility that QuickLook can somehow be turned off?
>
> Any ideas?
>
> --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)http://lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
>
> This email sent to jja...@gmail.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: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread jonat...@mugginsoft.com


On 27 Aug 2009, at 12:34, Graham Cox wrote:

I'm using the following code to generate thumbnail images in one of  
my user interfaces. It works fine on my machine, and on all the ones  
I've tested, but a couple of users have reported that they don't see  
the thumbnails. One user experiencing this problem helped me to log  
some results which shows that the QLThumbnailImageCreate function is  
returning nil. The docs state that this will return nil if it can't  
read the file, but it's the exact same file on every system, loaded  
from my app's resources. So why would it fail in a few percent of  
cases, but mostly work? All affected users are running the latest  
system version.



	CFURLRef url = CFURLCreateWithFileSystemPath( NULL, (CFStringRef) 
[self path], kCFURLPOSIXPathStyle, NO );


	// logging the URL/path at this point shows that the correct path  
is being returned from [self path], a path to app internal resources


CGSize  maxImageSize = CGSizeMake( 512, 512 );
	NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: 
(id)kCFBooleanTrue, kQLThumbnailOptionIconModeKey, nil];


	CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize,  
(CFDictionaryRef)options );

CFRelease( url );

// on a very few systems, qli is nil here

Is there a possibility that QuickLook can somehow be turned off?

Not sure if this related. Sometimes I encounter the situation where  
the CoverFlow view in Finder stops providing previews - though I don't  
know if Finder uses QuickLook.
You could ask your users if this occurs in their case - it might  
narrow things down or throw up something else. Plus it's easy to check.



Any ideas?

--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/jonathan%40mugginsoft.com

This email sent to jonat...@mugginsoft.com


Jonathan Mitchell

Developer
http://www.mugginsoft.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


Two controllers in a window, how do I get one to run a function in another?

2009-08-27 Thread Support
I'm writing an application which has one window, with an NSTableView and a 
WebView in it.  The NSTableView will contain a list of URLs and site 
descriptions and the WebView will display the URL when it's clicked on in the 
NSTableView.  So far, so simple - especially if the NSTableView and WebView are 
in the same object.

I want to have two NSObjects (controllers) - one for the tableview and all the 
actions that it needs to perform, and one for the web view.  I am having 
difficulty getting the tableview controller to tell the webview controller to 
display a particular page.  And I can't find anything about this subject in my 
Cocoa books or on the web.  Am I barking up the wrong tree here?  Should I only 
have one controller per window?

I'd be most grateful for any enlightenment.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Two controllers in a window, how do I get one to run a function in another?

2009-08-27 Thread Graham Cox


On 27/08/2009, at 11:55 PM, Support wrote:

I want to have two NSObjects (controllers) - one for the tableview  
and all the actions that it needs to perform, and one for the web  
view.  I am having difficulty getting the tableview controller to  
tell the webview controller to display a particular page.  And I  
can't find anything about this subject in my Cocoa books or on the  
web.  Am I barking up the wrong tree here?  Should I only have one  
controller per window?


I'd be most grateful for any enlightenment.



One controller for each view sounds like a good plan. There's  
certainly no requirement that you can have only one controller per  
window.


It's up to you how your controllers communicate. For example, your  
Webview controller could have a method "showURL:" which accepts a  
NSURL object, and the first controller can turn the selection into one  
and pass it to the second. That's all there is to it pretty much. You  
could probably make it nice and complicated and involve bindings and  
so on, but why bother? K.I.S.S...


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


Best way to determine what ip address are assigned to a given network interface.

2009-08-27 Thread Mark McCray
Hello,
I've seen a bunch of methods for getting a list of ip addresses that a
machine may have. But i haven't seen a Cocoa way of figuring out what
ip address is attached to a given interface.  NSHost give's you IPs
but which network interfaces those IPs are attached to.

Can this be done with the SystemConfiguration Framework?

Why do I need this? We know a bunch of our machines have many IPs but
we only care about ethernet ip addresses. and we typically only care
about ones that are en0 or en1. We want to write an application which
will give this information to us easily without the user having to go
into System Preferences.

thanks,
Mark
___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-27 Thread Sherm Pendley
On Thu, Aug 27, 2009 at 10:04 AM, Graham Cox wrote:
>
> On 27/08/2009, at 11:55 PM, Support wrote:
>
>> I want to have two NSObjects (controllers) - one for the tableview and all
>> the actions that it needs to perform, and one for the web view.  I am having
>> difficulty getting the tableview controller to tell the webview controller
>> to display a particular page.  And I can't find anything about this subject
>> in my Cocoa books or on the web.  Am I barking up the wrong tree here?
>>  Should I only have one controller per window?
>>
>> I'd be most grateful for any enlightenment.
>
>
> One controller for each view sounds like a good plan. There's certainly no
> requirement that you can have only one controller per window.

Also, there's no requirement that outlets refer to graphical widgets
either. You can create outlets that refer to other controller objects
too, and connect them in Interface Builder.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

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


Re: Two controllers in a window, how do I get one to run a function in another?

2009-08-27 Thread bryscomat

The solution I'd recommend is in Cocoa Bindings.
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaBindings/CocoaBindings.html

A view controller per view is a good idea. For some more samples on  
that, you can look at KTUIKit.

http://katidev.com/blog/ktuikit/
I'd written something very similar before I stumbled on this. You can  
use different nibs for each view, and once you master bindings across  
different nibs, it seems to me to be perfect MVC.


On Aug 27, 2009, at 8:55 AM, Support wrote:

I'm writing an application which has one window, with an NSTableView  
and a WebView in it.  The NSTableView will contain a list of URLs  
and site descriptions and the WebView will display the URL when it's  
clicked on in the NSTableView.  So far, so simple - especially if  
the NSTableView and WebView are in the same object.


I want to have two NSObjects (controllers) - one for the tableview  
and all the actions that it needs to perform, and one for the web  
view.  I am having difficulty getting the tableview controller to  
tell the webview controller to display a particular page.  And I  
can't find anything about this subject in my Cocoa books or on the  
web.  Am I barking up the wrong tree here?  Should I only have one  
controller per window?


I'd be most grateful for any enlightenment.

___

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

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

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

This email sent to brysco...@gmail.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: Best way to determine what ip address are assigned to a given network interface.

2009-08-27 Thread Sherm Pendley
On Thu, Aug 27, 2009 at 10:09 AM, Mark McCray wrote:

> I've seen a bunch of methods for getting a list of ip addresses that a
> machine may have. But i haven't seen a Cocoa way of figuring out what
> ip address is attached to a given interface.  NSHost give's you IPs
> but which network interfaces those IPs are attached to.
>
> Can this be done with the SystemConfiguration Framework?
>
> Why do I need this? We know a bunch of our machines have many IPs but
> we only care about ethernet ip addresses. and we typically only care
> about ones that are en0 or en1. We want to write an application which
> will give this information to us easily without the user having to go
> into System Preferences.

If you know which interface(s) you want info about, you could run
"/sbin/ifconfig en0" with NSTask.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

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


Re: Best way to determine what ip address are assigned to a given network interface.

2009-08-27 Thread glenn andreas


On Aug 27, 2009, at 9:21 AM, Sherm Pendley wrote:

On Thu, Aug 27, 2009 at 10:09 AM, Mark McCray  
wrote:


I've seen a bunch of methods for getting a list of ip addresses  
that a

machine may have. But i haven't seen a Cocoa way of figuring out what
ip address is attached to a given interface.  NSHost give's you IPs
but which network interfaces those IPs are attached to.

Can this be done with the SystemConfiguration Framework?

Why do I need this? We know a bunch of our machines have many IPs but
we only care about ethernet ip addresses. and we typically only care
about ones that are en0 or en1. We want to write an application which
will give this information to us easily without the user having to go
into System Preferences.


If you know which interface(s) you want info about, you could run
"/sbin/ifconfig en0" with NSTask.



Or just use getifaddrs - no need to fork off an extra task and parse  
the output when you can just look at the information directly...



Glenn Andreas  gandr...@gandreas.com
  wicked fun!
m.o.t.e.s. | minute object twisted environment simulation



___

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

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

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

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


Re: _subtreeDescription: What do the ampersands mean?

2009-08-27 Thread Ken Ferry
The ampersands are springs and the dashes are struts.
[view autoresizingMask] is NSViewMaxXMargin|NSViewMinYMargin.

-Ken


On Wed, Aug 26, 2009 at 7:22 PM, Michael A. Crawford <
michaelacrawf...@me.com> wrote:

> In the line of GDB output below, what do the ampersands following the h=
> and v= mean?
>
> (gdb) po [self _subtreeDescription]
> [ D A W#] h=--& v=&-- NDView 0x10012fca0 f=(0,113,480,473) b=(-) =>
>  TIME drawRect: min/mean/max 0.00/0.00/0.00 ms
> A=autoresizesSubviews, C=canDrawConcurrently, D=needsDisplay, F=flipped,
> G=gstate, H=hidden (h=by ancestor), O=opaque,
> P=preservesContentDuringLiveResize, S=scaled/rotated, W=wantsLayer
> (w=ancestor wantsLayer), #=has surface
>
> -Michael
>
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.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


NSTableView's delegate dataCellForTableColumn never called

2009-08-27 Thread Donnie Lee
Hello!

I have a window with NSTableView in a bundle and load this bundle from
dylib (which is a XPCOM component for Firefox extension). But I have a
big problem: dataCellForTableColumn delegate never called. All other
delegates are called, but this -- not. When I try to load this bundle
from simple cocoa app -- all works OK. When it called from Firefox
extension -- not OK. Please, what should I do, how to fix it?
Thanks in advance!

Donnie.
___

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

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


NSOperationQueue emptying

2009-08-27 Thread McLaughlin, Michael P.
I'm wondering about the timing of NSOperationQueue emptying.

In my Objective-C++ (Leopard) app, I have one opQueue of operations and the
very last thing each operation does is enqueue the results of a computation
back to the main thread.

NSPointerArray *ptr = [NSPointerArray pointerArrayWithStrongObjects];
[ptr addPointer:&PL];
[mainQueue enqueueNotification:[NSNotification
notificationWithName:@"compNotif"
object:ptr]
postingStyle:NSPostNow];
} // end of main()

I use NSPostNow instead of NSPostWhenIdle because the latter never posts!
(reason unknown)  Also, I have garbage collection *required* and do not have
any retain/release statements anywhere.

PL, the output data, is a local std::list [C++ default Ctors/Dtors is
checked.] and the main thread collects these in a list of lists until all
have been collected at which point all NSOperations *should* be finished.

They aren't -- even though I use a separate countdown int as the sentinel.

Each time through the whole process, one operation (not always the same one)
remains in the opQueue, and isFinishd == NO, at the point when the opQueue
is due to be filled up again.  [It is almost always one of the last
operations pushed onto the opQueue.]  If I then
waitUntilAllOperationsAreFinished, the program hangs forever.  Apparently,
this last operation never finishes although the other 1300 operations do and
they are all the same apart from input data.

Question: In Leopard, does an NSOperationQueue send a signal of its own when
an operation is terminating, something analogous to
applicationDidFinishLaunching?  Could garbage collection be postponing the
queue clearing?  I could not find any function that would force clearing the
opQueue.  Is there one?

BTW, I cannot use Snow Leopard for this, at least at work, because I have
only a G5.

-- 
Mike McLaughlin

___

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

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

2009-08-27 Thread Clark Cox
I would recommend renaming that method. Per Cocoa conventions, methods
that start with "new" should return an object with an outstanding
retain count like +alloc... and -copy do (among others).

On Thu, Aug 27, 2009 at 3:29 AM, Reza Farhad wrote:
> Dear all
>
> I am running my code through xcode "Build and Analyze" to check for bugs.
> I have the function below which gives me the following error:
>
> Object with +0 retain counts returned to caller where a +1 (owning) retain
> count is expected
>
> I can not understand why can anybody enlighten me.
>
> -( NSColor *)newColour
> {
>        NSColor         *todoColour = nil;
>        float           newRed, newGreen, newBlue;
>        float           newAverage;
>        do{
>                todoColour = [ self variationOnColor:colour ];
>                [ todoColour getRed:&newRed green:&newGreen blue:&newBlue
> alpha:nil ];
>                newAverage = ( newRed + newGreen + newBlue )/3;
>        }while( newAverage < 0.5 );
>        return todoColour;
> }
>
> thanks
>
> Reza
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
>
> This email sent to clarkc...@gmail.com
>



-- 
Clark S. Cox III
clarkc...@gmail.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


NSFile and NSTask

2009-08-27 Thread Brent Smith

Hey all,

Ive been trying to think of a good way around my current solution for  
displaying contents of a text file.


Right now I basically run an NSTask on tail -f and that's about it. I  
plan on redoing this section of the code to allow the scroll view to  
go all the way back to the beginning of the document, and possibly  
adding in markers. I'm really curious if I should just parse through  
the file and add the contents into the text area/scrollview or should  
I build out an object and pass that object to a sub classed textview  
that displays the contents of the object. Am I still able to setup a  
notification set to tell me when new lines are added to the file?


I'm really worried about how efficient this method is and what will  
happen with very large files. Does anyone know how console.app  
accomplishes this? Are there any sample projects I can take a look at  
that do something similar?


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: NSOperationQueue emptying

2009-08-27 Thread Adam R. Maxwell


On Aug 27, 2009, at 8:18 AM, McLaughlin, Michael P. wrote:


I'm wondering about the timing of NSOperationQueue emptying.

In my Objective-C++ (Leopard) app, I have one opQueue of operations  
and the
very last thing each operation does is enqueue the results of a  
computation

back to the main thread.

NSPointerArray *ptr = [NSPointerArray pointerArrayWithStrongObjects];
[ptr addPointer:&PL];
[mainQueue enqueueNotification:[NSNotification
notificationWithName:@"compNotif"
   object:ptr]
   postingStyle:NSPostNow];
} // end of main()


If this is the main thread's NSNotificationQueue, you can only use it  
from the main thread, since it's listed as being unsafe to use from  
multiple threads:


http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html

Your usage could cause all sorts of hard-to-diagnose problems, unless  
I misread what you're doing.





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: NSTableView's delegate dataCellForTableColumn never called

2009-08-27 Thread Corbin Dunn
The method only works for applications that link against 10.5 or  
higher. The said app probably doesn't link against 10.5


-corbin

On Aug 27, 2009, at 8:08 AM, Donnie Lee wrote:


Hello!

I have a window with NSTableView in a bundle and load this bundle from
dylib (which is a XPCOM component for Firefox extension). But I have a
big problem: dataCellForTableColumn delegate never called. All other
delegates are called, but this -- not. When I try to load this bundle
from simple cocoa app -- all works OK. When it called from Firefox
extension -- not OK. Please, what should I do, how to fix it?
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: NSTableView's delegate dataCellForTableColumn never called

2009-08-27 Thread Donnie Lee
Hi Corbin,

Do you mean that the problem is in Firefox? Have you any ideas how to
workaround this?

Donnie.

On Thu, Aug 27, 2009 at 8:34 PM, Corbin Dunn wrote:
> The method only works for applications that link against 10.5 or higher. The
> said app probably doesn't link against 10.5
>
> -corbin
>
> On Aug 27, 2009, at 8:08 AM, Donnie Lee wrote:
>
>> Hello!
>>
>> I have a window with NSTableView in a bundle and load this bundle from
>> dylib (which is a XPCOM component for Firefox extension). But I have a
>> big problem: dataCellForTableColumn delegate never called. All other
>> delegates are called, but this -- not. When I try to load this bundle
>> from simple cocoa app -- all works OK. When it called from Firefox
>> extension -- not OK. Please, what should I do, how to fix it?
>> 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: NSTableView's delegate dataCellForTableColumn never called

2009-08-27 Thread Corbin Dunn
Donnie - the problem is, people can run FireFox on 10.4, where the  
method doesn't exist, and hence it wouldn't work.


If you rebuild Firefox to target 10.5 or higher, then the method will  
be called.


--corbin


On Aug 27, 2009, at 9:39 AM, Donnie Lee wrote:


Hi Corbin,

Do you mean that the problem is in Firefox? Have you any ideas how to
workaround this?

Donnie.

On Thu, Aug 27, 2009 at 8:34 PM, Corbin Dunn wrote:
The method only works for applications that link against 10.5 or  
higher. The

said app probably doesn't link against 10.5

-corbin

On Aug 27, 2009, at 8:08 AM, Donnie Lee wrote:


Hello!

I have a window with NSTableView in a bundle and load this bundle  
from
dylib (which is a XPCOM component for Firefox extension). But I  
have a

big problem: dataCellForTableColumn delegate never called. All other
delegates are called, but this -- not. When I try to load this  
bundle

from simple cocoa app -- all works OK. When it called from Firefox
extension -- not OK. Please, what should I do, how to fix it?
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


Starting editing for a Row as soon as it is Added.

2009-08-27 Thread Joshua Garnham
I have an NSOutlineView and what I want to happen is that when a row is
added I want the row that has been added to Start Editing immediately
like when you double click on a row.

Cheers,
Josh.




___

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

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

2009-08-27 Thread Squ Aire

Thank you both for the info so far.

However, do you have any idea how to accomplish what I actually want to do? Is 
my original idea of forcing asserts to crash maybe bad, which is why noone even 
thought of suggesting a way to do it?

How do people normally do it? Do they just make a crash reporter framework 
catch an exception like Rob suggested? What crash reporter framework would you 
recommend?

Just some general info on this and related things, for a newbie who wants hand 
out his simple app for some other people to use, would be appreciated.


>> You could raise exceptions instead of generating assertion failures.
>> Exceptions are caught by several of the crash reporting frameworks.
>> You could probably map the NSAssert macros to exception-generation
>> code for your beta builds.
>
>
> The NSAssert macros raise exceptions by default in debug builds.



--.
_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

http://www.microsoft.com/windows/windowslive/products/photos.aspx___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Quincey Morris

On Aug 27, 2009, at 04:34, Graham Cox wrote:

I'm using the following code to generate thumbnail images in one of  
my user interfaces. It works fine on my machine, and on all the ones  
I've tested, but a couple of users have reported that they don't see  
the thumbnails. One user experiencing this problem helped me to log  
some results which shows that the QLThumbnailImageCreate function is  
returning nil. The docs state that this will return nil if it can't  
read the file, but it's the exact same file on every system, loaded  
from my app's resources. So why would it fail in a few percent of  
cases, but mostly work? All affected users are running the latest  
system version.



	CFURLRef url = CFURLCreateWithFileSystemPath( NULL, (CFStringRef) 
[self path], kCFURLPOSIXPathStyle, NO );


	// logging the URL/path at this point shows that the correct path  
is being returned from [self path], a path to app internal resources


CGSize  maxImageSize = CGSizeMake( 512, 512 );
	NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: 
(id)kCFBooleanTrue, kQLThumbnailOptionIconModeKey, nil];


	CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize,  
(CFDictionaryRef)options );

CFRelease( url );

// on a very few systems, qli is nil here


a. It would be worth trying to read the file directly, before calling  
QLThumbnailImageCreate, to find out if the problem is the reference to  
the file or the image creation.


b. What file system is being used on the Macs where it fails? I don't  
know much about such things, but it seems at least theoretically  
possible that there might be a capabilities mismatch between the file  
system and QL.


FWIW

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTableView's delegate dataCellForTableColumn never called

2009-08-27 Thread Donnie Lee
Thanks Corbin, now I fully understand.

Donnie.

On Thu, Aug 27, 2009 at 8:41 PM, Corbin Dunn wrote:
> Donnie - the problem is, people can run FireFox on 10.4, where the method
> doesn't exist, and hence it wouldn't work.
>
> If you rebuild Firefox to target 10.5 or higher, then the method will be
> called.
>
> --corbin
>
>
> On Aug 27, 2009, at 9:39 AM, Donnie Lee wrote:
>
>> Hi Corbin,
>>
>> Do you mean that the problem is in Firefox? Have you any ideas how to
>> workaround this?
>>
>> Donnie.
>>
>> On Thu, Aug 27, 2009 at 8:34 PM, Corbin Dunn wrote:
>>>
>>> The method only works for applications that link against 10.5 or higher.
>>> The
>>> said app probably doesn't link against 10.5
>>>
>>> -corbin
>>>
>>> On Aug 27, 2009, at 8:08 AM, Donnie Lee wrote:
>>>
 Hello!

 I have a window with NSTableView in a bundle and load this bundle from
 dylib (which is a XPCOM component for Firefox extension). But I have a
 big problem: dataCellForTableColumn delegate never called. All other
 delegates are called, but this -- not. When I try to load this bundle
 from simple cocoa app -- all works OK. When it called from Firefox
 extension -- not OK. Please, what should I do, how to fix it?
 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


Fwd: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread David Blanton



Begin forwarded message:


From: David Blanton 
Date: August 27, 2009 9:42:45 AM MDT
To: Graham Cox 
Subject: Re: Reasons why QL would fail to create thumbnail?

One of my customers reported last week that our QL Generator  
suddenly quit working.


Today the customer reported that after running software update and  
finding a huge OS X update they updated and the QL Generator started  
working.




On Aug 27, 2009, at 5:34 AM, Graham Cox wrote:

I'm using the following code to generate thumbnail images in one of  
my user interfaces. It works fine on my machine, and on all the  
ones I've tested, but a couple of users have reported that they  
don't see the thumbnails. One user experiencing this problem helped  
me to log some results which shows that the QLThumbnailImageCreate  
function is returning nil. The docs state that this will return nil  
if it can't read the file, but it's the exact same file on every  
system, loaded from my app's resources. So why would it fail in a  
few percent of cases, but mostly work? All affected users are  
running the latest system version.



	CFURLRef url = CFURLCreateWithFileSystemPath( NULL, (CFStringRef) 
[self path], kCFURLPOSIXPathStyle, NO );


	// logging the URL/path at this point shows that the correct path  
is being returned from [self path], a path to app internal resources


CGSize  maxImageSize = CGSizeMake( 512, 512 );
	NSDictionary* options = [NSDictionary dictionaryWithObjectsAndKeys: 
(id)kCFBooleanTrue, kQLThumbnailOptionIconModeKey, nil];


	CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize,  
(CFDictionaryRef)options );

CFRelease( url );

// on a very few systems, qli is nil here

Is there a possibility that QuickLook can somehow be turned off?

Any ideas?

--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/airedale%40tularosa.net

This email sent to aired...@tularosa.net






___

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

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

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

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


Making NSNumberFormatter empty-tolerant

2009-08-27 Thread Markus Spoettl

Hello,

  before I get to the question this is my setup:

1) NSTextField ("field")
2) bound to an NSNumber property ("number") of an object.
3) "field" has an NSNumberFormatter attached with all default
   values (as set up by IB), except maximum fraction digits is set to  
1.

4) "number" can be nil - in fact it is when we start our app.

Starting this little app, one can tab into and out-of an the empty  
field, nothing happens. This as expected and what I want.


When you enter a value and tab out, "number" gets set to the new  
value. If you now attempt to remove the value by emptying the field  
you will get formatting error message. This is kind of unexpected as  
the empty field was fine with the formatter moments ago.


In other words, once the value is set to something non-nil it never  
can get nil again. I would like to be able to nil out a number by  
clear a field.


My solution for this is a sub-class of NSNumberFormatter which  
implements -getObjectValue:forString:range:error: as follows:


- (BOOL)getObjectValue:(out id *)anObject
 forString:(NSString *)aString
 range:(inout NSRange *)rangep
 error:(out NSError **)error
{
BOOL result = [super getObjectValue:anObject forString:aString  
range:rangep error:error];


if (!result && ((aString == nil) || ([aString  
isEqualToString:@""]))) {

*anObject = nil;
result = YES;
}

return result;
}

The docs tell me that I have to feed a valid NSNumber into anObject  
when returning YES - nil is valid therefore this should be OK.


The question is: Is this safe? Do I overlook an aspect that I'd better  
not? Or even better, is there a simpler solution?


Regards
Markus
--
__
Markus Spoettl



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Making NSNumberFormatter empty-tolerant

2009-08-27 Thread bryscomat
I solved this before by putting a single space in the Null Placeholder  
spot on the bindings panel in IB.

It worked for me.

On Aug 27, 2009, at 1:45 PM, Markus Spoettl wrote:


Hello,

 before I get to the question this is my setup:

1) NSTextField ("field")
2) bound to an NSNumber property ("number") of an object.
3) "field" has an NSNumberFormatter attached with all default
  values (as set up by IB), except maximum fraction digits is set to  
1.

4) "number" can be nil - in fact it is when we start our app.

Starting this little app, one can tab into and out-of an the empty  
field, nothing happens. This as expected and what I want.


When you enter a value and tab out, "number" gets set to the new  
value. If you now attempt to remove the value by emptying the field  
you will get formatting error message. This is kind of unexpected as  
the empty field was fine with the formatter moments ago.


In other words, once the value is set to something non-nil it never  
can get nil again. I would like to be able to nil out a number by  
clear a field.


My solution for this is a sub-class of NSNumberFormatter which  
implements -getObjectValue:forString:range:error: as follows:


- (BOOL)getObjectValue:(out id *)anObject
forString:(NSString *)aString
range:(inout NSRange *)rangep
error:(out NSError **)error
{
   BOOL result = [super getObjectValue:anObject forString:aString  
range:rangep error:error];


   if (!result && ((aString == nil) || ([aString  
isEqualToString:@""]))) {

   *anObject = nil;
   result = YES;
   }

   return result;
}

The docs tell me that I have to feed a valid NSNumber into anObject  
when returning YES - nil is valid therefore this should be OK.


The question is: Is this safe? Do I overlook an aspect that I'd  
better not? Or even better, is there a simpler solution?


Regards
Markus
--
__
Markus Spoettl

___

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

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

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

This email sent to brysco...@gmail.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: Making failed NSAsserts crash an app

2009-08-27 Thread Kyle Sluder
On Thu, Aug 27, 2009 at 9:46 AM, Squ Aire wrote:
> However, do you have any idea how to accomplish what I actually want to do? 
> Is my original idea of forcing asserts to crash maybe bad, which is why noone 
> even thought of suggesting a way to do it?

It's a bad idea.  Assertions should be optimized out of your release build.

Making assertions visible crashes to your users discourages you from
writing assertions and discourages users who have to deal with
crashes.  If they are debug-only issues, you can safely write tons of
assertions and only deal with those that have user-visible effects.

This is what we do with OBASSERT and friends (in OmniBase.framework,
part of the OmniSource library found at
http://www.omnigroup.com/developer/ ).

--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: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Keith Duncan

QLThumbnailImageCreate function is returning nil


So why would it fail in a few percent of cases, but mostly work? All  
affected users are running the latest system version.


What is your preview being generated from, a QuickLook generator or  
the Preview and Thumbnail files in your bundle's QuickLook folder?


Keith
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Starting editing for a Row as soon as it is Added.

2009-08-27 Thread Sean McBride
On 8/27/09 4:42 PM, Joshua Garnham said:

>I have an NSOutlineView and what I want to happen is that when a row is
>added I want the row that has been added to Start Editing immediately
>like when you double click on a row.

@implementation NSTableView (RRExtra)

- (void)makeEditableSelectedCellOfColumnIdentifier:
(NSString*)inColumnIdentifier
{
NSTableColumn* column = [self 
tableColumnWithIdentifier:inColumnIdentifier];
if (column && ![column isHidden])
{
if ([self numberOfSelectedRows] == 1)
{
NSInteger columnIndex = [self 
columnWithIdentifier:inColumnIdentifier];
NSInteger selectRowIndex = [self selectedRow];
if ((columnIndex != -1) && (selectRowIndex != -1))
{
[self editColumn:columnIndex row:selectRowIndex 
withEvent:nil select:YES];
}
}
}
}

@end

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: Making failed NSAsserts crash an app

2009-08-27 Thread Ed Wynne


On Aug 27, 2009, at 3:12 PM, Kyle Sluder wrote:

On Thu, Aug 27, 2009 at 9:46 AM, Squ Aire wrote:
However, do you have any idea how to accomplish what I actually  
want to do? Is my original idea of forcing asserts to crash maybe  
bad, which is why noone even thought of suggesting a way to do it?


It's a bad idea.  Assertions should be optimized out of your release  
build.




This attitude is, at best, a perversion of the very definition of an  
assertion. Assertions are things that must be true, that is why they  
are assertions. They do not, check that, should not become less true  
just because your app is built release vs debug.



Making assertions visible crashes to your users discourages you from
writing assertions and discourages users who have to deal with
crashes.  If they are debug-only issues, you can safely write tons of
assertions and only deal with those that have user-visible effects.


If you are using assertions to test for things that are handleable  
situations or recoverable errors, you are doing it wrong. Checking is  
good, but its just that, checking... not asserting.


Developers should definitely do both, not overload checks into some  
type of cuckolded assertion.




-Ed



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

Fwd: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread David Blanton



Begin forwarded message:


From: David Blanton 
Date: August 27, 2009 1:32:30 PM MDT
To: Keith Duncan 
Subject: Re: Reasons why QL would fail to create thumbnail?

A QLGenerator

On Aug 27, 2009, at 1:12 PM, Keith Duncan wrote:


QLThumbnailImageCreate function is returning nil


So why would it fail in a few percent of cases, but mostly work?  
All affected users are running the latest system version.


What is your preview being generated from, a QuickLook generator or  
the Preview and Thumbnail files in your bundle's QuickLook folder?


Keith
___

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

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

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

This email sent to aired...@tularosa.net






___

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

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

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

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


Re: Making NSNumberFormatter empty-tolerant

2009-08-27 Thread Frédéric Testuz

Le 27 août 09 à 20:45, Markus Spoettl a écrit :


Hello,

 before I get to the question this is my setup:

1) NSTextField ("field")
2) bound to an NSNumber property ("number") of an object.
3) "field" has an NSNumberFormatter attached with all default
  values (as set up by IB), except maximum fraction digits is set to  
1.

4) "number" can be nil - in fact it is when we start our app.

Starting this little app, one can tab into and out-of an the empty  
field, nothing happens. This as expected and what I want.


When you enter a value and tab out, "number" gets set to the new  
value. If you now attempt to remove the value by emptying the field  
you will get formatting error message. This is kind of unexpected as  
the empty field was fine with the formatter moments ago.


In other words, once the value is set to something non-nil it never  
can get nil again. I would like to be able to nil out a number by  
clear a field.


My solution for this is a sub-class of NSNumberFormatter which  
implements -getObjectValue:forString:range:error: as follows:


- (BOOL)getObjectValue:(out id *)anObject
forString:(NSString *)aString
range:(inout NSRange *)rangep
error:(out NSError **)error
{
   BOOL result = [super getObjectValue:anObject forString:aString  
range:rangep error:error];


   if (!result && ((aString == nil) || ([aString  
isEqualToString:@""]))) {

   *anObject = nil;
   result = YES;
   }

   return result;
}

The docs tell me that I have to feed a valid NSNumber into anObject  
when returning YES - nil is valid therefore this should be OK.


The question is: Is this safe? Do I overlook an aspect that I'd  
better not? Or even better, is there a simpler solution?


I had the same problem. For the 10.4 behaviour of NSNumberFormatter,  
you don't have to subclass it.


Just set the nil symbol with:

[myNumberFormatter setNilSymbol:@""];

Alternatively, you can set it in IB:

In the number formatter attribute palette, go down until you see Nil  
Symbol, enter a character and then delete it.



Note: if only the NSDateFormatter has the same attribute.

Frédéric___

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

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

2009-08-27 Thread bryscomat
Interesting. Is that documented anywhere? That's why I was confused as  
to exactly how I got mine to work. Seems like a fluke...


On Aug 27, 2009, at 2:39 PM, Frédéric Testuz wrote:


Le 27 août 09 à 20:45, Markus Spoettl a écrit :


Hello,

before I get to the question this is my setup:

1) NSTextField ("field")
2) bound to an NSNumber property ("number") of an object.
3) "field" has an NSNumberFormatter attached with all default
 values (as set up by IB), except maximum fraction digits is set to  
1.

4) "number" can be nil - in fact it is when we start our app.

Starting this little app, one can tab into and out-of an the empty  
field, nothing happens. This as expected and what I want.


When you enter a value and tab out, "number" gets set to the new  
value. If you now attempt to remove the value by emptying the field  
you will get formatting error message. This is kind of unexpected  
as the empty field was fine with the formatter moments ago.


In other words, once the value is set to something non-nil it never  
can get nil again. I would like to be able to nil out a number by  
clear a field.


My solution for this is a sub-class of NSNumberFormatter which  
implements -getObjectValue:forString:range:error: as follows:


- (BOOL)getObjectValue:(out id *)anObject
   forString:(NSString *)aString
   range:(inout NSRange *)rangep
   error:(out NSError **)error
{
  BOOL result = [super getObjectValue:anObject forString:aString  
range:rangep error:error];


  if (!result && ((aString == nil) || ([aString  
isEqualToString:@""]))) {

  *anObject = nil;
  result = YES;
  }

  return result;
}

The docs tell me that I have to feed a valid NSNumber into anObject  
when returning YES - nil is valid therefore this should be OK.


The question is: Is this safe? Do I overlook an aspect that I'd  
better not? Or even better, is there a simpler solution?


I had the same problem. For the 10.4 behaviour of NSNumberFormatter,  
you don't have to subclass it.


Just set the nil symbol with:

[myNumberFormatter setNilSymbol:@""];

Alternatively, you can set it in IB:

In the number formatter attribute palette, go down until you see Nil  
Symbol, enter a character and then delete it.



Note: if only the NSDateFormatter has the same attribute.

Frédéric___

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

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

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

This email sent to brysco...@gmail.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


Launching a document-based app with no document

2009-08-27 Thread Dylan McNamee
Which hook should I use to detect that my document-based app has been  
launched without a document having been dropped on it (or double- 
clicked upon)?


Right now my app just launches and shows its menu.

What I'd like to do is catch this case, and at least pop up an "Open"  
dialog.


I tried checking the length of the "orderedDocuments" array at the end  
of my MenuController's awakeFromNib handler, but that's too soon -  
it's always empty at that point.


Should I register a listener for applicationDidFinishLaunching?

In reading the documentation for the various info.plist options, I  
half-expected an option that says something like  
"openDialogOnLaunchIfNoDefaultDocument" or something, but came up dry.


Googling the documentation and this list popped up way too many  
negative hits (I guess the obvious keywords are too generic).  Where  
would someone start looking to find answers to questions like this?   
NSApplication's documentation wasn't it, the various books I own  
didn't cover this case (that I saw).


thanks,
dylan
___

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

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

2009-08-27 Thread Kyle Sluder
On Thu, Aug 27, 2009 at 12:29 PM, Ed Wynne wrote:
> This attitude is, at best, a perversion of the very definition of an
> assertion. Assertions are things that must be true, that is why they are
> assertions. They do not, check that, should not become less true just
> because your app is built release vs debug.

Strictly speaking I believe you're more accurately describing an
invariant than an assertion.

> If you are using assertions to test for things that are handleable
> situations or recoverable errors, you are doing it wrong. Checking is good,
> but its just that, checking... not asserting.

There's a difference between a condition that will cause your app to
crash and a condition that will cause your app to perform extra
work/graphics glitch/other easily fixed state.  Obviously these latter
cases are not desirable, but they're not crashers.

Not all error states are fatal states.  Assert happens when entering
an error state, and is left out of release.  abort() happens when
entering a fatal state, and is kept in release (hopefully to never be
executed).

(Just for the record, these opinions are mine and do not necessarily
reflect those of my employer.  If you want to see how we use OBASSERT
and friends, grab the OmniSource frameworks and look at the code.)

--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: Making NSNumberFormatter empty-tolerant

2009-08-27 Thread Frédéric Testuz

Le 27 août 09 à 21:46, bryscomat a écrit :

Interesting. Is that documented anywhere? That's why I was confused  
as to exactly how I got mine to work. Seems like a fluke...


On Aug 27, 2009, at 2:39 PM, Frédéric Testuz wrote:


I had the same problem. For the 10.4 behaviour of  
NSNumberFormatter, you don't have to subclass it.


Just set the nil symbol with:

[myNumberFormatter setNilSymbol:@""];

Alternatively, you can set it in IB:

In the number formatter attribute palette, go down until you see  
Nil Symbol, enter a character and then delete it.



Note: if only the NSDateFormatter has the same attribute.

Frédéric___

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

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

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


This email sent to brysco...@gmail.com


I don't think I saw it written explicitly. When I had the problem,  
before subclassing NSNumberFormatter, I check the docs, see  
setNilSymbol and try to use it.
For the IB trick I can't remember how I found it. It must be something  
like thinking about how IB is probably archiving objects and trying  
some solutions.


Frédéric___

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

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

2009-08-27 Thread Keith Duncan

They do not, check that, should not become less true just
because your app is built release vs debug.


Strictly speaking I believe you're more accurately describing an
invariant than an assertion.



Not all error states are fatal states.  Assert happens when entering
an error state, and is left out of release.  abort() happens when
entering a fatal state, and is kept in release (hopefully to never be
executed).


Instead of debating the meaning of assertion we should discuss the  
specific implementation of  Cocoa 'assertions', as found in the  
NSException header. As observed by inspection they call methods on  
NSAssertionHandler which are documented to raise an exception.



If you are using assertions to test for things that are handleable
situations or recoverable errors, you are doing it wrong. Checking  
is good,

but its just that, checking... not asserting.


There's a difference between a condition that will cause your app to
crash and a condition that will cause your app to perform extra
work/graphics glitch/other easily fixed state.  Obviously these latter
cases are not desirable, but they're not crashers.


On the basis of an exception causing your application to crash the  
NSAssert family of assertions should only be used as shorthand for  
throwing an NSException and in the situations where that is appropriate.


I'm pretty sure the reasons for throwing an exception have been  
discussed on the list before and can be found in the archives.


So,


How can I guarantee that a failed NSAssert will crash my application?


Depending on where you fail an assertion (which will throw an  
exception) either the uncaught exception handler or the NSApplication  
handler will be called.


NSExceptions that originate on the main thread are caught by  
NSApplication and printed to the system log. NSExceptions that occur  
elsewhere are caught by the uncaught exception handler and will crash  
your application. You can manipulate the uncaught exception handler  
using NSSetUncaughtExceptionHandler.


If you want to do something other than simply log main thread  
exceptions you can capture them by overriding -[NSApplication  
reportException:] in a subclass or category. This is illustrated in  
the cocoadev wiki http://www.cocoadev.com/index.pl?StackTraces


As you've duly noted NSAssert/NSException are for programmer error,  
you've either done something wrong or received an unsuitable input.  
Make sure to use NSError as appropriate too.


Keith
___

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

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


debugging a 64 bit app

2009-08-27 Thread kvic...@pobox.com
with a 32 bit app, when i hit a breakpoint in gdb, i could select a 
stack frame and enter the following into the gdb console:


(gdb) po *(int *)($ebp+)

where  was 8 to see the receiver of the message, 16 to see the 
first "meaningful" parameter, etc.


however, i'm not building a 64 bit app and using synthesized iVars 
and when i type the above on the gdb console, i get:


Argument to arithmetic operation not a number or boolean.

what is the proper way to see stack parameters with cocoa 64 bit apps with gdb?

thanx,
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: debugging a 64 bit app

2009-08-27 Thread Nick Zitzmann


On Aug 27, 2009, at 3:23 PM, kvic...@pobox.com wrote:

what is the proper way to see stack parameters with cocoa 64 bit  
apps with gdb?




If you're developing for X86-64, you really ought to read the part  
about calling conventions. Basically, unless you're hitting a case  
where class MEMORY is hit when calling a function (which is not  
common, especially in objc programs), then argument 0 (self) will be  
in $rdi, argument 1 (_cmd) will be in $rsi, etc...


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


Re: debugging a 64 bit app

2009-08-27 Thread Sean McBride
On 8/27/09 2:23 PM, kvic...@pobox.com said:

>with a 32 bit app, when i hit a breakpoint in gdb, i could select a
>stack frame and enter the following into the gdb console:
>
>   (gdb) po *(int *)($ebp+)
>
>where  was 8 to see the receiver of the message, 16 to see the
>first "meaningful" parameter, etc.
>
>however, i'm not building a 64 bit app and using synthesized iVars
>and when i type the above on the gdb console, i get:
>
>   Argument to arithmetic operation not a number or boolean.
>
>what is the proper way to see stack parameters with cocoa 64 bit apps
>with gdb?

See:


--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


CALayer drawing delay

2009-08-27 Thread Ivy Feraco


I am using CALayers and a delegate to provide content with the method

- (void)drawLayer:(CALayer *)theLayer
inContext:(CGContextRef)theContext

in the method I use CGImage to draw .png bitmaps of numerals that  
count up from 0. The .pngs all have transparency.


Everything works, the counter changes count, but as it changes you can  
see a slight transition between the two digits.
It almost looks like a brief fade, but I don't have any animation  
applied to it.


I've tried throwing in a CGContextClearRect right before drawing the  
new bitmap, but it doesn't seem to work.


Any ideas why the drawing might be having this effect?

Ivy Feraco

___

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

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

2009-08-27 Thread Gabriel Zachmann

When my code executes this line

	ppt_ = [[SBApplication  
applicationWithBundleIdentifier:@"com.microsoft.Powerpoint"] retain];


then I get the following output on the console:

MyApp: unknown type name "constant".
MyApp: unknown type name "null".

Does anyone have an idea, what might be causing this?

Best regards,
Gabriel.


Eigentlich bin ich ganz anders, nur komme ich so selten dazu.
  ( Ödön von Horváth )

   http://zach.in.tu-clausthal.de












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: CALayer drawing delay

2009-08-27 Thread David Duncan

On Aug 27, 2009, at 3:28 PM, Ivy Feraco wrote:

in the method I use CGImage to draw .png bitmaps of numerals that  
count up from 0. The .pngs all have transparency.


Everything works, the counter changes count, but as it changes you  
can see a slight transition between the two digits.
It almost looks like a brief fade, but I don't have any animation  
applied to it.


This is expected. By default when the contents of an animation change,  
Core Animation will apply a 0.25s crossfade animation. You can disable  
this in various ways – see the documentation for -actionForKey:


If your just drawing an image, you could instead just set the contents  
directly to the image (same issue applies).

--
David Duncan
Apple DTS Animation and Printing

___

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

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


Subversion and Interface Builder

2009-08-27 Thread Alexander Hartner
For some time now I have been struggling with interface builder's NIB  
files and subversion. Every time I localise the .svn folder seem to be  
removed or get broken in other ways. I had a look online and found the  
suggestion below. Since this link is a little dated I am wondering if  
there are other solutions available. RTFD and pages files are also  
suffering similar issues as NIB files. As it stands now subversion  
does not work for me at all.


If not subversion what other collaborative development tools do you  
suggest / use ?


http://jerakeen.org/code/subversion_and_interface_builder/

The .svn folder vanishes (Working copy 'MainMenu.nib' not locked)
It turns out that whenever you save a folder, IB will move the  
existing .nib file out the way, and create a new one, instead of  
changing the files in the folder. It'll keep the old version as a  
backup, if you have 'create backup files' turned on, or throw it away  
if not, but the crucial problem is that the newly-created folder  
doesn't have a .svn folder in it, and so subversion will get confused.


Fortunately, there was this same problem with CVS, and so there's a  
(panther-only, apparently) fix for it - we tell XCode/IB that .svn  
files are also version control files, and should be special.


$ defaults write com.apple.InterfaceBuilder \
VersionControlDirectory "(CVS, .svn)"
Now IB knows that it must keep the .svn folder from the old copy of  
the nib, and put it in the new copy as well.


I hate computers. But these two fixes have solved my immediate problem.
___

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

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

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

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


Alert dialog in agent app?

2009-08-27 Thread Gabriel Zachmann
My Cocoa application has the plist flag "application is background  
only" set.

(I believe, this is the former LSUIElement property.)

Now I would like to display an alert dialog.

Unfortunately, this does not work; it even seems it makes the  
application hang.


The code for the alert box looks like this:

//  NSAlert *alert = [NSAlert alertWithMessageText: @"Bla!"
//   defaultButton: @"OK" alternateButton: nil 
otherButton: nil
//  informativeTextWithFormat: @"bla." ];
//  [alert runModal];

I also tried NSRunAlertPanel() to no avail.

When I switch off the property "application is background only", then  
everything is fine.



Any suggestions, how I can still display alert or informative dialogs  
in my background-only app will be highly appreciated.


Best regards,
Gabriel.



Eigentlich bin ich ganz anders, nur komme ich so selten dazu.
  ( Ödön von Horváth )

   http://zach.in.tu-clausthal.de












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: Subversion and Interface Builder

2009-08-27 Thread Jason Sallis
Subversion (and CVS) create .svn/.cvs folders inside every folder in your
hierarchy. I'd recommend a different version control system that creates one
dot folder at the top of your hierarchy like Git or Mercurial.

On Thu, Aug 27, 2009 at 5:04 PM, Alexander Hartner wrote:

> For some time now I have been struggling with interface builder's NIB files
> and subversion. Every time I localise the .svn folder seem to be removed or
> get broken in other ways. I had a look online and found the suggestion
> below. Since this link is a little dated I am wondering if there are other
> solutions available. RTFD and pages files are also suffering similar issues
> as NIB files. As it stands now subversion does not work for me at all.
>
> If not subversion what other collaborative development tools do you suggest
> / use ?
>
> http://jerakeen.org/code/subversion_and_interface_builder/
>
> The .svn folder vanishes (Working copy 'MainMenu.nib' not locked)
> It turns out that whenever you save a folder, IB will move the existing
> .nib file out the way, and create a new one, instead of changing the files
> in the folder. It'll keep the old version as a backup, if you have 'create
> backup files' turned on, or throw it away if not, but the crucial problem is
> that the newly-created folder doesn't have a .svn folder in it, and so
> subversion will get confused.
>
> Fortunately, there was this same problem with CVS, and so there's a
> (panther-only, apparently) fix for it - we tell XCode/IB that .svn files are
> also version control files, and should be special.
>
> $ defaults write com.apple.InterfaceBuilder \
>VersionControlDirectory "(CVS, .svn)"
> Now IB knows that it must keep the .svn folder from the old copy of the
> nib, and put it in the new copy as well.
>
> I hate computers. But these two fixes have solved my immediate problem.
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jsallis%40gmail.com
>
> This email sent to jsal...@gmail.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: Subversion and Interface Builder

2009-08-27 Thread Kyle Sluder
Use XIB?

--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: CALayer drawing delay

2009-08-27 Thread David Duncan

On Aug 27, 2009, at 3:58 PM, David Duncan wrote:


By default when the contents of an animation change



contents of a layer change, sorry for any confusion...
--
David Duncan
Apple DTS Animation and Printing

___

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

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

2009-08-27 Thread Nick Zitzmann


On Aug 27, 2009, at 5:03 PM, Gabriel Zachmann wrote:

My Cocoa application has the plist flag "application is background  
only" set.

(I believe, this is the former LSUIElement property.)


No; LSUIElement is still around, but if you have the friendly key view  
turned on (which is the default setting), it's called "application is  
agent (UI element)" or something like that.



Now I would like to display an alert dialog.

Unfortunately, this does not work; it even seems it makes the  
application hang


LSBackgroundOnly apps can connect to the window server, but can't  
display a UI, IIRC. You have two choices:


1. Make your app use LSUIElement instead, where this will work, though  
you'll have to manually bring the alert to the front using - 
activateIgnoringOtherApps:.


2. Use the CFUserNotification API instead of NSAlert.

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


Re: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Graham Cox


On 28/08/2009, at 5:12 AM, Keith Duncan wrote:

What is your preview being generated from, a QuickLook generator or  
the Preview and Thumbnail files in your bundle's QuickLook folder?





The bundle's QuickLook folder - I do not have a QL Generator, I just  
write an image to /QuickLook/Thumbnail.jpg when the document (package)  
is saved. I can also load this image directly and I am now doing so if  
the thumbnail creation fails, though it doesn't look as nice. I  
haven't found out yet whether this fallback succeeds in the cases  
where the thumbnail creation fails.


--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: QuickTime Animation Rendering

2009-08-27 Thread Kevin Cathey
(1)  Is there a way for me to create the animations with  
CoreAnimation Layers (CALayer and sublayers) and simply tell some  
object to write to file? If so, how?
Yes, check out CARenderer. This will require some knowledge of OpenGL  
to do it completely correctly. See rendering to a framebuffer:

http://developer.apple.com/documentation/graphicsimaging/Conceptual/OpenGL-MacProgGuide/opengl_offscreen/opengl_offscreen.html#//apple_ref/doc/uid/TP40001987-CH403-SW7

After creating and rendering to the framebuffer using CARenderer, you  
can pull out the contents of the frame buffer and create a CGImage  
from that. Make sure you get your alpha [pre]multiplication correct.


Kevin


___

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

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


Drawing Text in an NSImage

2009-08-27 Thread Seth Willits


drawAtPoint/drawInRect in NSString/NSAttributedString says...

"You should only invoke this method when an NSView object has focus."
"Don’t invoke this method while no NSView is focused."


When an image is focused, and you draw text, it'll definitely do wonky  
things if the currently focused view is flipped. If we can't use these  
methods, are we really supposed to drop down to NSLayoutManager etc  
etc to draw a simple string? Is there really no secret API for image- 
friendly string drawing? Just want to double check before I have to go  
invent one...



--
Seth Willits



___

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

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

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

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


creating registration codes

2009-08-27 Thread Rick C.
hello,

my apologies if this is a bit off-topic, but once an app is done does anyone 
have a recommendation on how to go about setting up a registration code system 
for the created app.  i guess it needs some programming in partner with some 
scripting on the web side.  maybe a 3rd parth service?  with so many developers 
in here with much more experience than myself i thought someone could point me 
in the right direction on coding/preparing an app to be sold.  thank you very 
much,

rick


  
___

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

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

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

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


Re: Drawing Text in an NSImage

2009-08-27 Thread Henry McGilton (Boulevardier)


On Aug 27, 2009, at 8:13 PM, Seth Willits wrote:



drawAtPoint/drawInRect in NSString/NSAttributedString says...

"You should only invoke this method when an NSView object has focus."
"Don’t invoke this method while no NSView is focused."


When an image is focused, and you draw text, it'll definitely do  
wonky things if the currently focused view is flipped. If we can't  
use these methods, are we really supposed to drop down to  
NSLayoutManager etc etc to draw a simple string? Is there really no  
secret API for image-friendly string drawing? Just want to double  
check before I have to go invent one...


Not quite sure what is the problem you're having here, Seth.

Create your NSImage.lockFocus on the image.Draw into the image.
i have two apps that draw into images using drawAtPoint, and I don't see
any problems relating to views . . .

Cheers,
. . . . . . . .  Henry



___

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

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

2009-08-27 Thread Nathan Vander Wilt

On Aug 27, 2009, at 9:18 PM, Rick C. wrote:

hello,

my apologies if this is a bit off-topic, but once an app is done  
does anyone have a recommendation on how to go about setting up a  
registration code system for the created app.  i guess it needs some  
programming in partner with some scripting on the web side.  maybe a  
3rd parth service?  with so many developers in here with much more  
experience than myself i thought someone could point me in the right  
direction on coding/preparing an app to be sold.  thank you very much,


Yep, off topic for this list. But software registration options have  
been discussed on the macsb mailing list, which is a great place to  
talk with developers other developers who sell their own Mac apps:

http://tech.groups.yahoo.com/group/macsb/

HTH,
-nvw
___

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

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

2009-08-27 Thread Joar Wingfors

Hello Kyle,

I would beg to differ:

On 27 aug 2009, at 13.23, Kyle Sluder wrote:


Strictly speaking I believe you're more accurately describing an
invariant than an assertion.



Terminology aside, I think that he accurately describes how the Cocoa  
provided assertion macros are implemented and used in general. These  
macros allow the developer to describe things that always must be  
true, and ensures that a failure prevents execution from continuing  
beyond that point. Used like this, the biggest upshot of turning them  
off is saving a few CPU cycles, but you will at the same time expose  
the end user to undefined state and behavior of your application and  
rob yourself of well defined failure points that assists in  
troubleshooting.




Not all error states are fatal states.  Assert happens when entering
an error state, and is left out of release.  abort() happens when
entering a fatal state, and is kept in release (hopefully to never be
executed).



For reference, the UNIX assert() calls abort() at the end.


Best,

j o a r


___

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

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

2009-08-27 Thread Uli Kusterer

On Aug 28, 2009, at 5:13 AM, Seth Willits wrote:

drawAtPoint/drawInRect in NSString/NSAttributedString says...

"You should only invoke this method when an NSView object has focus."
"Don’t invoke this method while no NSView is focused."


 I think, for the discussion of this particular API, an NSView object  
having focus includes the case of an NSImage object having focus. You  
may want to file a documentation bug requesting clarification.


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





___

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

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

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

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


Core Data Predicate Builder - comparing dates

2009-08-27 Thread Steve Cronin

Folks;

I have a Core Data entity that has a dateCreated and a dateModified -  
both NSDates in the object files.
I'd like to construct a predicate that will retrieve all records where  
a record's dateModified is greater than that record's dateCreated.


Its deceptively easy to setup something that looks like it should work  
using 'Control-click' and 'Key' in the predicate builder in XCode.

But when I run queries it doesn't appear to yield the right results.
My thinking is that the comparison operators don't properly evaluate  
dates (am I wrong?)


So dropping back to code - how would I write this predicate in code?

Thanks for any help!
Steve

___

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

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

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

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


core-data app design question

2009-08-27 Thread Martin Hewitson

Dear list,

I have a question, or rather, I'm looking for advice, on the design of  
an application. Essentially I'm wanting to write a labbook-type  
application. My plan was to use core-data for the model. In the model  
will be an Entry entity. Each entry will have a one-to-one  
relationship to a Content entity. The Content entity will just (at the  
moment) contain a single attribute (data) which will be binary data.  
Implementing this on the Mac I planned to use NSTextView to provide a  
rich-text entry for the data attribute. Now comes the problem. I want  
to make a Cocoa Touch version of the app, and make then synchronize  
over Mobile me. The problem is I see no way to handle the  
NSAttributedString that will be stored in the data attribute on the  
iPhone.


Does anyone have any advice as to how I might go about this? I was  
considering dropping back to plain text, but am loath to do this.


Best wishes,

Martin


Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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