Re: Drag-Move the Transparent windowed app over the screen

2009-11-13 Thread Andrew Farmer
On 12 Nov 2009, at 01:58, kirankumar wrote:
> goto attributes for your window ,enable the texture checkbox so that
> you can drag your window.

While this does have the desired effect, there is a much more direct approach 
available (which Dave Keck has hinted 
at).___

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

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

2009-11-13 Thread Andrew Farmer
On 11 Nov 2009, at 21:23, kirankumar wrote:
> this will help you
> keep this 3lines of code in awakeFromNib, and mpwindow is you are window name.
> 
> id closeButton = [mpWindow standardWindowButton:NSWindowCloseButton ];
> [closeButton setAction:@selector(closeapp:)];
> [closeButton setTarget:self];

No, don't do that. See -[NSApplication 
applicationShouldTerminateAfterLastWindowClosed:] for the correct approach.

> - (IBAction)closeapp:(id)sender
> {
> exit(0);
> }

I'm pretty sure that this will end up skipping most cleanup routines (including 
important ones, like syncing dirty preferences). NSApplication has a terminate: 
method for a reason.___

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

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

2009-11-13 Thread Andrew Farmer
On 12 Nov 2009, at 11:50, David Ross wrote:
> GCC does not like declaring variables in a for statement.

Adding -std=c99 or -std=gnu99 to the compiler flags will fix that.
___

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

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

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

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


Re: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property

2009-11-13 Thread BJ Homer
On Thu, Nov 12, 2009 at 2:52 AM, Joerg Simon  wrote:

> Dear all other Cocoa Developers:
>
> In an app I am developing I have the following strange thing:
>
> [code in the .h file]
> @interface XY : CALayer
>BOOL _editing;
> ...
> @property (assign, getter = isEditing) BOOL editing;
>
> [/code]
>
> [code in the .m file]
> @synthesize editing = _editing;
> @dynamic editing;


The @dynamic is entirely unnecessary; you should use @synthesize or
@dynamic, but not both.

-BJ
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property

2009-11-13 Thread Roland King
take the @dynamic out. 

Since you are synthesizing the property you don't need the @dynamic which 
suppresses the warning that you haven't defined the setter or the getter. 

You use the @dynamic statement to tell the compiler to suppress a warning if it 
can’t find an implementation of accessor methods specified by an @property 
declaration.



On 12-Nov-2009, at 5:52 PM, Joerg Simon wrote:

> Dear all other Cocoa Developers:
> 
> In an app I am developing I have the following strange thing:
> 
> [code in the .h file]
> @interface XY : CALayer
>BOOL _editing;
> ...
> @property (assign, getter = isEditing) BOOL editing;
> 
> [/code]
> 
> [code in the .m file]
> @synthesize editing = _editing;
> @dynamic editing;
> 
> [/code]
> I get: error: property 'editing' is already implemented
> 
> So, this code now compiles:
> Fine for all versions of OSes under leopart
> Only for versions 2.x under snow leopard.
> 
> Since my laptop runs snow leopard, and I am very often developing on my 
> laptop, and snow leopard lacks a OS 2.x iPhone simulator, that means I can't 
> use the simulator on the iPhone, and it secondly means that the app has 
> problems to compile with the new compiler, and that would be bad if apple 
> switches internally.
> 
> Any suggestions what to do?
> 
> Thanks,
>  Joerg Simon
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
> 
> This email sent to r...@rols.org

___

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

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

2009-11-13 Thread Dave DeLong
While this doesn't exactly address what you're looking for, I'd just thought 
I'd throw in a plug for the CHDataStructures framework, which (among other 
things) contains a whole bunch of tree-based data structures (AVL, AA, RB, etc) 
so you don't have to recreate it yourself.

It's FOSS and can be found at http://cocoaheads.byu.edu/code/chdatastructures

Cheers,

Dave 

On Nov 12, 2009, at 2:01 AM, Jonathan Guy wrote:

> Hi all
> I'm having a hard time finding a good example of this on the web so I thought 
> I'd post here. I have an array of file system paths (NSStrings) and need to 
> convert this into a tree structure using parent child tree node objects. The 
> method has to be as efficient as possible as it will be crunching a lot of 
> data. Any pointers to documentation or a good example would be much 
> appreciated.
> 
> Thanks
> 
> Jonathan


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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
> On Nov 13, 2009, at 2:53 PM, Trygve Inda wrote:
> 
>> Also...
>> 
>> NSURL*  imgURL = [NSURL fileURLWithPath:path];
>> CGImageSourceRefimgRef;
>> CGImageSourceStatus imgStatus;
>> 
>> imgRef = CGImageSourceCreateWithURL (imgURL, nil);
>> 
>> 
>> CGImageSourceGetStatus (imgRef) returns kCGImageStatusComplete
> 
> What about CGImageSourceGetStatusAtIndex() or
> CGImageSourceCreateImageAtIndex()?
> 
> Regards,
> Ken
> 
> 

Same result... No errors except for the error posted to the console.

Trygve


___

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

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

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

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


Re: beginner question, NSNumber, NSDecimalAsNumber

2009-11-13 Thread Dale Miller
PPC has the cntlzw and cltlzd hardware instructions (count leading  
zeros word/doubleword). Subtracting the result from 32 or 64 would  
give the bit number of the leading 1-bit (or 32/64 for no 1-bits).



Dale Miller
dalelmil...@comcast.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


Tracking Safari usage through a background process or dameon

2009-11-13 Thread Suresh Pandey

Hi All,

I need to develop a background process that gets started on user login to
Mac machine and then onwards it logs whatever operations the user is
performing on Safari.

Please suggest me what approach/technology/API's should use to achieve
followings:

1. How can my bg process can continuously track Safari, how to do it on
Mac?
2. How can i get information about what url is user visiting in safari, get
notified when a new tab is open, get information about what media contents
(images, streaming media etc) is present on the webpage etc.

Please suggest the correct way or guide me any particular relevent apple
discussion forun where i can get exact answers.

Thanks a lot,
Please reply.

Suresh Chandra Pandey
Tata Consultancy Services
Mailto: suresh.pan...@tcs.com
Website: http://www.tcs.com

Experience certainty.   IT Services
  Business Solutions
  Outsourcing


=-=-=
Notice: The information contained in this e-mail
message and/or attachments to it may contain 
confidential or privileged information. If you are 
not the intended recipient, any dissemination, use, 
review, distribution, printing or copying of the 
information contained in this e-mail message 
and/or attachments to it are strictly prohibited. If 
you have received this communication in error, 
please notify us by reply e-mail or telephone and 
immediately and permanently delete the message 
and any attachments. Thank you



___

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

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

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

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


iPhone: Having a touch point want to find layer it is in

2009-11-13 Thread Tino Rachui
I have a UIView and a hierarchy of CALayers added to the views layer. When a
touch event occurs I can get the 'locationInView' for instance but what is
the best way to find the top most visible CALayer in the views layer
hierarchy? I played a bit with 'hitTest' but in vain so far. Maybe I'm doing
something fundamentally wrong. Suggestions much appreciated.

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


Advice On Subclass vs. Delegate

2009-11-13 Thread s.ross
I'm building an app that has two NSTextFields (prob'ly more before I'm done). 
Each of these text fields does word splitting according to different criteria 
(comma, optional space for one, and whitespace for the other). One of them 
counts the words and checks case-insensitive for dups. The other just does the 
duplicate checking.

How it's implemented now is that I have a separate controller for each field 
and the NSTextField delegates to that controller because for each character, I 
need to:

- dup-check and possibly count
- change a label to show the count and any dup alerts
- watch for control:completions:forPartialWordRange and provide a custom list

This seems like boneheaded code duplication, when what I really want is a more 
general class that can be told:

Hey! This NSTextField needs to be watched for dups, so split on [\s*,\s*] and 
each time a new word shows up, call my method:

theresANewWord:count withDuplicates:dups.

That suggests to me that subclassing NSTextField and allowing a single 
controller to register a callback would be the right way to go, but I'm 
struggling with how to specify *which* text field and whether my design idea is 
even sound.

Any help is appreciated.

Thanks,

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


Interested in a Tampa Bay Area CocoaHeads?

2009-11-13 Thread Jason Broyles
I was thinking about starting up a Tampa Bay area CocoaHeads group.  
Are there any local devs who may be interested in the group? The  
closest one is in Orlando and this is a bit of a drive. The meetings  
could be somewhere central to Tampa / Clearwater / St. Petersburg.



--
Jason Broyles



___

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

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

2009-11-13 Thread David Ross
Jonathon,

GCC does not like declaring variables in a for statement. If you want to make 
the variable m have the scope for only the for loop, you would need:

foo()
{
...
{
int i, m;
for (i=0, m=0; i<5; i++){...}
printf("Final value of i: %d\n",i);
}
...
}

If you don't mind the 'm' variable having the scope of its enclosing block, 
then you can omit the outer braces around the for.

— David

On Nov 12, 2009, at 2:29 PM, Jonathon Kuo wrote:

> I can't chance upon the right incantation for using both an existing variable 
> and an inline new one in a for loop. I've boiled this down to a trivial show 
> case, same results for both gcc 4.0.1 and 4.2.1:
> 
>  int i;
>   . . .
>  for (i=0, int m=0; i<5; i++) { . . . };
>  printf("Final value of i: %d\n",i);
> 
> error: syntax error before ‘int’
> error: syntax error before ‘)’ token
> 
> So I tried this:
> 
>  int i;
>   . . .
>  for (int m=0,i=0; i<5; i++) { . . . };
>  printf("Final value of i: %d\n",i);
> 
> error: redefinition of ‘i’
> 
> Is there a rule that ALL initialized loop variables are either new and local 
> to the loop, or that none are? Surely Im doing something wrong here!
> 


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

NSColor colorUsingColorSpace: extremely slow on 10.6?

2009-11-13 Thread Aaron Epstein
Hi all,

I've got some simple color space conversion code using NSColor's
colorUsingColorSpace: method that runs fast on 10.5, but is extremely slow
on 10.6 (especially in a loop run 1,000+ times).  Has anyone else noticed
this issue?  Are there any known workarounds?

I've attached some sample code below.  Any insight or assistance would be
greatly appreciated!

Thanks,
Aaron



#import 


int main(int argc, char *argv[])

{

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

 NSLog(@"Start!");

 NSColorSpace *rgbSpace = [NSColorSpace deviceRGBColorSpace];

NSColorSpace *cmykSpace = [NSColorSpace deviceCMYKColorSpace];

 NSColor *rgbColor, *cmykColor;

 //All of the conversions below work extremely fast on 10.5.

 int i;

for (i = 0; i < 1000; i++)

{

 // SLOW on 10.6: system RGB color -> colorUsingColorSpace: ->
deviceCMYKColorSpace

rgbColor = [NSColor colorWithDeviceRed:1.0 green:0 blue:0 alpha:1.0];

cmykColor = [rgbColor colorUsingColorSpace:cmykSpace];

 /*

// SLOW on 10.6: NSCustomColorSpace RGB color -> colorUsingColorSpace: ->
deviceCMYKColorSpace

CGFloat rgbComponents[4] = {1.0, 0, 0, 1.0};

rgbColor = [NSColor colorWithColorSpace:rgbSpace components:rgbComponents
count:4];

cmykColor = [rgbColor colorUsingColorSpace:cmykSpace];

*/

 /*

// FAST on 10.6: system RGB color -> colorUsingColorSpaceName: ->
NSDeviceCMYKColorSpace

rgbColor = [NSColor colorWithDeviceRed:1.0 green:0 blue:0 alpha:1.0];

cmykColor = [rgbColor colorUsingColorSpaceName:NSDeviceCMYKColorSpace];

*/

 /*

// SLOW on 10.6: NSCustomColorSpace RGB color -> colorUsingColorSpaceName:
-> NSDeviceCMYKColorSpace

CGFloat rgbComponents[4] = {1.0, 0, 0, 1.0};

rgbColor = [NSColor colorWithColorSpace:rgbSpace components:rgbComponents
count:4];

cmykColor = [rgbColor colorUsingColorSpaceName:NSDeviceCMYKColorSpace];

*/

}

 NSLog(@"Done!");

 [pool release];

 return NSApplicationMain(argc,  (const char **) argv);

}
___

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

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


Using HTML form in cocoa app

2009-11-13 Thread Mark Reddick
Hey all. I'm trying to figure out how to use an HTML form in a cocoa  
application.


The situation is that I need to be able to read files that contain an  
HTML page with an HTML form in it. I then need to somehow present this  
form to the user (in my cocoa app) and let them fill it out. These  
forms have input fields on them but no submit buttons. So, in my cocoa  
app I need to be able to grab the data the user fills in on the form.  
These HTML form files will be on the local computer. No web access is  
involved here. These forms will basically be to allow people to extend  
my application.


At first I thought I'd read the HTML form file and convert it to a  
cocoa form but that doesn't seem very feasible. I then tried throwing  
a webview on my window and present the HTML form that way. This works  
fine but I am unable to figure out how to access the form data after  
the user fills it in (as the form is not being submitted). I tried  
using DOM to get to the data but it only seems to access the form  
without the user data.


So, if anyone has a solution for this or ideas I can try, please let  
me know.


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


[iPhone] OS 3.0 and @synthesize AND @dynamic for the same property

2009-11-13 Thread Joerg Simon

Dear all other Cocoa Developers:

In an app I am developing I have the following strange thing:

[code in the .h file]
@interface XY : CALayer
BOOL _editing;
...
@property (assign, getter = isEditing) BOOL editing;

[/code]

[code in the .m file]
@synthesize editing = _editing;
@dynamic editing;

[/code]
I get: error: property 'editing' is already implemented

So, this code now compiles:
Fine for all versions of OSes under leopart
Only for versions 2.x under snow leopard.

Since my laptop runs snow leopard, and I am very often developing on  
my laptop, and snow leopard lacks a OS 2.x iPhone simulator, that  
means I can't use the simulator on the iPhone, and it secondly means  
that the app has problems to compile with the new compiler, and that  
would be bad if apple switches internally.


Any suggestions what to do?

Thanks,
  Joerg Simon
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Drag-Move the Transparent windowed app over the screen

2009-11-13 Thread kirankumar

Hi,

goto attributes for your window ,enable the texture checkbox so that
you can drag your window.


Regards,
kiran.




On Nov 12, 2009, at 2:09 PM, Symadept wrote:


Hi,

My app's window is a BorderLess Window because of which I will not
have the Titlebar (Ref: RoundTransparentWindow of Apple examples).

Because of which I can't drag and move over the screen. Any
pointers to solve this.

Regards
symadept




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

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

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

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

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


Building a tree

2009-11-13 Thread Jonathan Guy

Hi all
I'm having a hard time finding a good example of this on the web so I  
thought I'd post here. I have an array of file system paths  
(NSStrings) and need to convert this into a tree structure using  
parent child tree node objects. The method has to be as efficient as  
possible as it will be crunching a lot of data. Any pointers to  
documentation or a good example would be much appreciated.


Thanks

Jonathan
___

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

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

2009-11-13 Thread kirankumar

hi,


this will help you
keep this 3lines of code in awakeFromNib, and mpwindow is you are window name.


id closeButton = [mpWindow standardWindowButton:NSWindowCloseButton ];
[closeButton setAction:@selector(closeapp:)];
[closeButton setTarget:self];



- (IBAction)closeapp:(id)sender
{
 exit(0);
}

Regards,
kiran
On Nov 12, 2009, at 10:18 AM, Symadept wrote:

Actually I wanted to hide the app when close button is closed such that it
shall be active still. Which I was doing. I was basically facing the problem
with Minimize the app. I don't know why the NSApp
miniaturizeAll:self;
is not functioning as expected.

Regards
Symadept


On Thu, Nov 12, 2009 at 12:27 PM, Nick Zitzmann 
mailto:n...@chronosnet.com>> wrote:


On Nov 11, 2009, at 8:50 PM, Symadept wrote:

How to close/minimize the app programmatically.

To close the app, call -[NSApplication terminate:].

I tried the following way
but no luck.

  [[NSApp mainWindow] performMiniaturize:nil];

This will only miniaturize the main window, and it won't work if
-mainWindow returns nil (e.g. the app is in the background).

[OR]
  [NSApp miniaturizeAll:self];

Now that should minimize all of the windows, unless you somehow
circumvented loading NSApplication.

And close should not terminate my app, it should place an icon in the
Dock,
I hope it would be the same. And I know to give Dock Menu items.

From that menuitem, if I click on Open, it shall be able to launch my

app.

If an app is in the Dock, it is there because the app is running, or
because the user wants to keep it in the Dock when it is not running. Please
do not programmatically add inactive applications to the Dock. Even if there
was an official way of doing this, Mac OS X has a long tradition of making
this choice opt-in instead of opt-out like on Windows.

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/kiran.koduri%40moschip.com

This email sent to kiran.kod...@moschip.com



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

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

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

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

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


Stack-based C++ class to wrap NSAutoreleasePool

2009-11-13 Thread Dan Korn
I'm building a Framework with some exported extern "C" functions in  
Objective-C++, based on this example:

http://developer.apple.com/internet/webservices/webservicescoreandcfnetwork.html

Because this is a Framework, it doesn't have its own main() function  
to set up an NSAutoreleasePool.  So I need a way to free the memory  
used by the Cocoa objects in the Framework when I'm done with it.  I  
first tried to rework the code to not use garbage collection, but that  
wasn't working.


Since each call into the Framework is basically self-contained with a  
plain old "C" interface, I thought, why not just add an  
NSAutoreleasePool to each function, and have it drain when the  
function returns?  But I didn't want to have to go through the code  
and add a call to [pool drain] before every return path.  So, I  
figured, why not do this?


class CAutoreleasePool
{
  NSAutoreleasePool *pool;

public:
  CAutoreleasePool()
  {
pool = [[NSAutoreleasePool alloc] init];
  }

  ~CAutoreleasePool()
  {
[pool drain];
  }
};

#define StackAutoreleasePool()  CAutoreleasePool _temp

Then all I need to do is declare "StackAutoreleasePool();" at the top  
of each exported function.  It seems to work just fine and prevent  
leaks.


From a C++ point of view, this is intuitive, so I figure that I can't  
the first one to have this idea, but I looked around for a similar  
solution and didn't find any.  And I'm new to Cocoa and Objective-C,  
so it's entirely possible I'm missing some pitfall with this strategy.


So, is there any reason why I shouldn't do this?

Thanks,
Dan

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Ken Thomases

On Nov 13, 2009, at 2:53 PM, Trygve Inda wrote:


Also...

NSURL*  imgURL = [NSURL fileURLWithPath:path];
CGImageSourceRefimgRef;
CGImageSourceStatus imgStatus;

imgRef = CGImageSourceCreateWithURL (imgURL, nil);


CGImageSourceGetStatus (imgRef) returns kCGImageStatusComplete


What about CGImageSourceGetStatusAtIndex() or  
CGImageSourceCreateImageAtIndex()?


Regards,
Ken

___

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

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

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

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


Re: NSPopUpButton submenu's

2009-11-13 Thread Jerry Krinock


On 2009 Nov 13, at 19:24, SRD wrote:


I can only seem
to get the first level menu and it's items, but nothing underneath.


Send -[NSMenuItem submenu].  Each level of a hierarchical menu  
consists of two parts.  First, the (sub)menu, then the menu items.   
Repeat for each level.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Jerry Krinock


On 2009 Nov 13, at 19:50, Kyle Sluder wrote:


On Fri, Nov 13, 2009 at 7:44 PM, Jerry Krinock  wrote:

Maybe you or someone could explain it a little better?


See Graham's explanation.


Got it.  "Known bug."

Yes it does, but once you build a Core Data app which is more  
complicated
than DepartmentAndEmployees, you'll be very disappointed with out- 
of-box
Undo operation.  One problem is that users typically need to click  
Undo
several times to undo what they may have done with one click.   
There are
threads on this in the list archives, or google: core data undo  
fishmeal.


That doesn't change the fact that, by default, you already have an
undo group opened for you.  Unless you're suggesting that you disable
this behavior?


Well, actually I did try to -setGroupsByEvent:NO once, but quickly  
concluded that this idea is a non-starter when Core Data is in the  
house.  What I do is to wrap the several undo groups that Core Data  
creates into one nested undo group.  I end the undo grouping in a  
performSelector:withObject:afterDelay:.  It works pretty good most of  
the time.


Thanks, Kyle.
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Jerry Krinock


On 2009 Nov 13, at 19:41, Graham Cox wrote:



On 14/11/2009, at 1:53 PM, Jerry Krinock wrote:


- (IBAction)dooDoo:(id)sender {
 [[self undoManager] beginUndoGrouping] ;
 [[self undoManager] endUndoGrouping] ;


A known bug in NSUndoManager is that doing this records an empty  
undo task - the Undo menu becomes available but does nothing. Adding  
undo tasks dirties the document. I'm not sure if this bug is fixed  
in 10.6, but other changes were made to NSUndoManager so I do hope so.


Not the answer I was hoping for, but a good explanation, Graham.


In my real app, I often manually begin and end a "super undo group".


You don't need to - the standard event loop already does that

There are not that many cases for opening your own undo groups  
unless you do a lot of mouse-based interaction such as dragging that  
you'll want to undo (because each 'step' of a drag is a different  
event).


The other case is if Core Data is involved -- see my reply to Kyle.


However, I don't know before it starts if any changes will be made  
to the store.  So, in order to avoid these false dirties, the only  
workaround I can think of is to manually track changes (which,  
fortunately, I'm already doing for other reasons), and later send a  
-clearAllChanges if no changes occurred.  Is there a less kludgey  
workaround?


Unfortunately I haven't found anything that isn't a kludge of equal  
or greater proportions for this. Rather than clearing changes after  
the fact, I wait until I get a task ready to be submitted to the  
undo manager, then make a callback to the controller which opens the  
group "just in time".


Wow!!

It then knows to close it again afterwards because the other really  
hideous fact about NSUndoManager is that unless you are EXTREMELY  
careful, it's very easy to get an unbalanced group open/close  
situation which basically shuts down that instance of the undo  
manager from then on.


Graham, you'd feel right at home if you read my console logs for the  
last year :))


In this sense NSUndoManager is extremely fragile, which is  
unfortunate as every single bit of code in an app typically calls it.


As an example, if you do open a group but subsequent code throws an  
exception, you better make sure you catch it and close the opened  
group if necessary as part of the exception handler, otherwise your  
app basically stops being undoable.


On more than one occasion I've been tempted to write my own undo  
stack from the ground up to work around these various issues. I  
haven't yet though - I've so far just piled on the kludges.


So have I, and might have actually done so were it not for the added  
complication of Core Data.


So, since this is a known bug, I guess I'll get to work on my kludge.

Thanks, Graham.

Jerry
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Kyle Sluder
On Fri, Nov 13, 2009 at 7:44 PM, Jerry Krinock  wrote:
> Maybe you or someone could explain it a little better?

See Graham's explanation.

>> AppKit already does this for you.  See -[NSUndoManager groupsByEvent]
>>
>> http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html#//apple_ref/doc/uid/2211-CHDCHADA
>
> Yes it does, but once you build a Core Data app which is more complicated
> than DepartmentAndEmployees, you'll be very disappointed with out-of-box
> Undo operation.  One problem is that users typically need to click Undo
> several times to undo what they may have done with one click.  There are
> threads on this in the list archives, or google: core data undo fishmeal.

That doesn't change the fact that, by default, you already have an
undo group opened for you.  Unless you're suggesting that you disable
this behavior?

--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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Jerry Krinock


On 2009 Nov 13, at 19:06, Kyle Sluder wrote:


On Fri, Nov 13, 2009 at 6:53 PM, Jerry Krinock  wrote:


Why would the dirty dot become dirty when no change was made to the  
store?

 I don't see any logical reason for this.


Because NSDocument change count is linked to the NSUndoManager
notifications.  See
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Documents/Tasks/FAQ.html#/ 
/apple_ref/doc/uid/2954


Kyle, I just studied the section in there titled "What's all this  
change count stuff?", which is the only place where "change count" is  
mentioned, but I'm sorry I just don't see any explanation of why the  
document would become dirty when no undo operations have been  
registered.  Beginning and ending an undo group is not changing the  
document and should not be counted as a change.


Maybe you or someone could explain it a little better?


In my real app, I often manually begin and end a "super undo group".


AppKit already does this for you.  See -[NSUndoManager groupsByEvent]
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html#/ 
/apple_ref/doc/uid/2211-CHDCHADA


Yes it does, but once you build a Core Data app which is more  
complicated than DepartmentAndEmployees, you'll be very disappointed  
with out-of-box Undo operation.  One problem is that users typically  
need to click Undo several times to undo what they may have done with  
one click.  There are threads on this in the list archives, or google:  
core data undo fishmeal.


___

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

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

2009-11-13 Thread Kyle Sluder
On Fri, Nov 13, 2009 at 6:11 PM, David Catmull
 wrote:
> Currently, I'm listening for 
> NSManagedObjectContextObjectsDidChangeNotification. This is working fine for 
> additions and deletions, but it's harder for changes, mainly because I don't 
> know the old value. If I did, I could check if the old year still has any 
> other objects in it. As it is I have to refresh the whole list. I also get 
> more notifications than I need, since I only care about date changes on this 
> one entity.

1) You could model the years as well.  To crib Michael Jurewitz's
theme from the iPhone tech talks, "Normalize as much as possible, then
denormalize as necessary."
2) There are data structures you can use to make it relatively
efficient even when you don't know the previous value.  You're already
given the changed-object set as it is, that's the best optimization
you can make.
3) The notification approach will eventually be much faster than the
KVO approach.  "Eventually" is to be determined.

For your case, think of # of objects / # of possible years.  I can't
imagine you have more than a 10 year range?  Just keep an array of
sets around and add/remove as dictated by the change notification.

--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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Graham Cox

On 14/11/2009, at 1:53 PM, Jerry Krinock wrote:

> - (IBAction)dooDoo:(id)sender {
>[[self undoManager] beginUndoGrouping] ;
>[[self undoManager] endUndoGrouping] ;

A known bug in NSUndoManager is that doing this records an empty undo task - 
the Undo menu becomes available but does nothing. Adding undo tasks dirties the 
document. I'm not sure if this bug is fixed in 10.6, but other changes were 
made to NSUndoManager so I do hope so.

> In my real app, I often manually begin and end a "super undo group".

You don't need to - the standard event loop already does that. You can record a 
whole series of tasks to the undo stack and if they are all submitted at the 
same time (meaning, within the same event cycle), they get grouped together 
under a single undo action.

There are not that many cases for opening your own undo groups unless you do a 
lot of mouse-based interaction such as dragging that you'll want to undo 
(because each 'step' of a drag is a different event).

> However, I don't know before it starts if any changes will be made to the 
> store.  So, in order to avoid these false dirties, the only workaround I can 
> think of is to manually track changes (which, fortunately, I'm already doing 
> for other reasons), and later send a -clearAllChanges if no changes occurred. 
>  Is there a less kludgey workaround?

Unfortunately I haven't found anything that isn't a kludge of equal or greater 
proportions for this. Rather than clearing changes after the fact, I wait until 
I get a task ready to be submitted to the undo manager, then make a callback to 
the controller which opens the group "just in time". It then knows to close it 
again afterwards because the other really hideous fact about NSUndoManager is 
that unless you are EXTREMELY careful, it's very easy to get an unbalanced 
group open/close situation which basically shuts down that instance of the undo 
manager from then on. In this sense NSUndoManager is extremely fragile, which 
is unfortunate as every single bit of code in an app typically calls it.

As an example, if you do open a group but subsequent code throws an exception, 
you better make sure you catch it and close the opened group if necessary as 
part of the exception handler, otherwise your app basically stops being 
undoable.

On more than one occasion I've been tempted to write my own undo stack from the 
ground up to work around these various issues. I haven't yet though - I've so 
far just piled on the kludges.

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


NSPopUpButton submenu's

2009-11-13 Thread SRD
Can anyone offer some advice on how to add submenu's on the menu of an
NSPopUpButton. I'm a bit confused as I've heard it can, and then can't
be done. And XCode has it on it's toolbar (e.g. Action -> Add -> New
Target). I just dragged an NSMenu from the palette onto my
NSPopUpButtons main menu and added items to it, and it seems to work
as expected when I click on it. But then the problem is that I don't
know how to get to the submenu from within the action. I can only seem
to get the first level menu and it's items, but nothing underneath.

Any help much appreciated.
___

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

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

2009-11-13 Thread Jerry Krinock
First of all, after reading your message, I believe the subject of  
your message should be "KVO vs MOC change notification".  But we all  
get our terms mixed up once in awhile :)


On 2009 Nov 13, at 18:11, David Catmull wrote:


Recommendations? Other options?


I believe there is no easy answer for this.  The two options you  
mentioned have issues -- not the performance issues you expect, but  
things that don't work.  I therefore use a third option, which is to  
implement custom setters so I can hook into them and post my own  
notification.


The additional issues which you have not discovered yet are explained  
in these threads:


http://lists.apple.com/archives/Cocoa-dev/2009/Feb/msg01698.html
http://lists.apple.com/archives/Cocoa-dev/2009/Feb/msg01814.html
http://lists.apple.com/archives/cocoa-dev/2009/Aug/msg2.html

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Kyle Sluder
On Fri, Nov 13, 2009 at 6:53 PM, Jerry Krinock  wrote:
>
> Why would the dirty dot become dirty when no change was made to the store?
>  I don't see any logical reason for this.

Because NSDocument change count is linked to the NSUndoManager
notifications.  See
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Documents/Tasks/FAQ.html#//apple_ref/doc/uid/2954

> In my real app, I often manually begin and end a "super undo group".

AppKit already does this for you.  See -[NSUndoManager groupsByEvent]
http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSUndoManager_Class/Reference/Reference.html#//apple_ref/doc/uid/2211-CHDCHADA

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


Core Data: Begin+End Undo Group = Dirty Dot. Why?

2009-11-13 Thread Jerry Krinock
I have discovered (one of?) the mysterious causes of a Core Data  
document becoming "dirty" (red  button in title bar gets black dot)  
when no changes have been made to the store.


STEPS TO REPRODUCE:

* Mac OS 10.5.8 (haven't tested 10.6 yet)
* Download a fresh copy of Apple's DepartmentAndEmployees sample  
project.

* Add this method implementation to the MyDocument class:

- (IBAction)dooDoo:(id)sender {
[[self undoManager] beginUndoGrouping] ;
[[self undoManager] endUndoGrouping] ;
}

* Declare dooDoo: in MyDocument.m
* Save all files.
* Open MyDocument.nib.
* Add a button in the window, title "DooDoo".
* Connect button to target MyDocument, action dooDoo:.
* Build and run.  A new document appears.  Its dirty dot is clean.
* Click the "Doodoo" button.

EXPECTED RESULT:

Nothing should happen.

ACTUAL RESULT:

The dirty dot becomes dirty.

Why would the dirty dot become dirty when no change was made to the  
store?  I don't see any logical reason for this.


In my real app, I often manually begin and end a "super undo group".   
However, I don't know before it starts if any changes will be made to  
the store.  So, in order to avoid these false dirties, the only  
workaround I can think of is to manually track changes (which,  
fortunately, I'm already doing for other reasons), and later send a - 
clearAllChanges if no changes occurred.  Is there a less kludgey  
workaround?


Thanks,

Jerry Krinock

___

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

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

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

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


Bindings vs MOC change notification

2009-11-13 Thread David Catmull
In my Core Data app, I have objects with a date property, and I want to 
maintain a list of all years that I have objects in. I'm having trouble 
settling on an approach.

Currently, I'm listening for 
NSManagedObjectContextObjectsDidChangeNotification. This is working fine for 
additions and deletions, but it's harder for changes, mainly because I don't 
know the old value. If I did, I could check if the old year still has any other 
objects in it. As it is I have to refresh the whole list. I also get more 
notifications than I need, since I only care about date changes on this one 
entity.

Another option is to use KVO so I can be notified only of date changes. I'm 
assuming that registering as an observer for potentially thousands of Core Data 
objects doesn't carry too much overhead. The down side is that if lots of 
objects change at once, I get lots of individual callbacks, and I worry that 
that would be a bottleneck.

Recommendations? Other options?

Thanks,

-- 
David Catmull
uncom...@uncommonplace.com
http://www.uncommonplace.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: Auto-scrolling view

2009-11-13 Thread Alfonso Urdaneta

Symadept wrote:

How to design Auto-scrolling view. Any pointers are highly appreciable.


Start with a view, add some scrolling, then a little auto?


--
alfonso e. urdaneta
red82.com - are you ready?
___

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

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

2009-11-13 Thread Jim Turner
Try this:

Create an outlet to your row template. When you need to update the
popups, make a copy of that template. Make a copy of the rowTemplates
the predicate editor currently tracks and iterate over them replacing
the template in the list that is the same class as your custom
template.  Then set this new list of templates back onto the predicate
editor.

The net effect is that the predicate editor will rebuild all the
templates it's currently using which gives you a chance to update the
popups as needed.  I don't know what'll happen when the popup
transitions to/from the text field... there's little you can do with
that as its an optimization the predicate editor does when building
it's templates (if there's only one option, why offer a choice?)

cheap-n-dirty code sample

-(void) updateTemplates {
MyRowTemplate *_newTemplate = [[myRowTemplateOutlet copy] autorelease];
NSMutableArray *rowTemplates = [[[predicateEditor rowTemplates]
mutableCopy] autorelease];

NSInteger ctr;
for( ctr=0; ctr<[rowTemplates count]; ctr++ ) {
if( [[rowTemplates objectAtIndex:ctr] 
isKindOfClass:[MyRowTemplate class]] ) {
[rowTemplates replaceObjectAtIndex:ctr 
withObject:_newTemplate];
break;
}
}
[predicateEditor setRowTemplates:rowTemplates];
}


-- 
Jim
http://nukethemfromorbit.com


On Fri, Nov 13, 2009 at 10:48 AM, Dave DeLong  wrote:
> Hi everyone,
>
> I have an NSPredicateEditor, with some standard row templates.  I'd like to 
> add a custom row template with three views:  a popup button (indicating the 
> attributes this template references), a second popup button (with the 
> operators), and a third popup button that's populated with a list of possible 
> values.
>
> This is very similar to a regular row template, except that the list of 
> possible values is computed at runtime and can change periodically based on 
> system events.
>
> I've tried subclassing NSPredicateEditorRowTemplate, overriding 
> -templateViews, and returning my 3 popup buttons (all properly populated).  
> This works once, but after the row is created, I haven't been able to figure 
> out how to repopulate the popup button when the list of possible values 
> changes.  I've tried setting the popup button's menu's delegate to an object 
> that will repopulate it, but the delegate methods are never called.
>
> I've also seen that when there's only one possible value, my popup button is 
> replaced with a textfield.  I suppose that's OK, except that if the list of 
> possible values changes, I need that textfield to change to a popup button.
>
> How can I achieve my dynamic popup button in an NSPredicateEditorRowTemplate?
>
> Thanks!
>
> Dave DeLong
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jturner.lists%40gmail.com
>
> This email sent to jturner.li...@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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Adam R. Maxwell

On Nov 13, 2009, at 1:31 PM, Kyle Sluder wrote:

> 2009/11/13 Trygve Inda :
>> How can I use an observer/exception handler or other notification to detect
>> such messages as NSImage accepts this image as valid when it is not.
> 
> Break on NSLog (or perhaps CFLog).

Or maybe CGPostError or some other private logging function :/.  To check it 
programmatically, the only thing I can think of is using asl(3) to query the 
log, but that's pretty gross...asl can be slow to update or search, and 
searching for a particular log string would be fragile.




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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
> This has been a known issue and was supposedly fixed in Snow Leopard - are you
> running 10.5 by any chance? If you are running Snow Leopard, I would recommend
> filing a radar at http://bugreport.apple.com.
> 
> - Joel
> 
> On Nov 13, 2009, at 12:13 PM, Trygve Inda wrote:
> 
>>> You might try checking NSImage's -isValid after loading it.
>>> 
>>> - Joel
>>> 
>>> On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:
>> 
>> isValid returns YES
>> 
>> Immediately afterwards calling
>> 
>> [image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy
>> fraction:1.0];
>> 
>> Send this to the console:
>> 
>> : Corrupt JPEG data: premature end of data segment
>> 
>> The image IS corrupt, but I see no way to detect it.
>> 
>> What a pain.
>> 
>> Trygve
>> 
>> 
> 
> 

Yes, this is on 10.6. I'll file a bug.

T.


___

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

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

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

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


Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Kyle Sluder
2009/11/13 Trygve Inda :
> How can I use an observer/exception handler or other notification to detect
> such messages as NSImage accepts this image as valid when it is not.

Break on NSLog (or perhaps CFLog).

--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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
>> You might try checking NSImage's -isValid after loading it.
>> 
>> - Joel
>> 
>> On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:
> 
> isValid returns YES
> 
> Immediately afterwards calling
> 
> [image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy
> fraction:1.0];
> 
> Send this to the console:
> 
> : Corrupt JPEG data: premature end of data segment
> 
> The image IS corrupt, but I see no way to detect it.
> 
> What a pain.
> 


Also...

NSURL*  imgURL = [NSURL fileURLWithPath:path];
CGImageSourceRefimgRef;
CGImageSourceStatus imgStatus;

imgRef = CGImageSourceCreateWithURL (imgURL, nil);


CGImageSourceGetStatus (imgRef) returns kCGImageStatusComplete





___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Gary L. Wade
Have you tried NSImage's delegate methods for loading status?

On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:

> I use:
> 
> imageWithContentsOfFile:@"a.jpg"
> 
> And sometime it generates a console message:
> 
> Corrupt JPEG data: premature end of data segment
> 
> How can I use an observer/exception handler or other notification to detect
> such messages as NSImage accepts this image as valid when it is not.
> 
> Something deeper in the OS knows the problem and I'd like to be notified.
> 
> Thanks,
> 
> Trygve


___

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

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

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

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


Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Joel Levin
This has been a known issue and was supposedly fixed in Snow Leopard - are you 
running 10.5 by any chance? If you are running Snow Leopard, I would recommend 
filing a radar at http://bugreport.apple.com.

- Joel

On Nov 13, 2009, at 12:13 PM, Trygve Inda wrote:

>> You might try checking NSImage's -isValid after loading it.
>> 
>> - Joel
>> 
>> On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:
> 
> isValid returns YES
> 
> Immediately afterwards calling
> 
> [image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy
> fraction:1.0];
> 
> Send this to the console:
> 
> : Corrupt JPEG data: premature end of data segment
> 
> The image IS corrupt, but I see no way to detect it.
> 
> What a pain.
> 
> Trygve
> 
> 

___

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

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

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

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


Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
> You might try checking NSImage's -isValid after loading it.
> 
> - Joel
> 
> On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:

isValid returns YES

Immediately afterwards calling

[image drawInRect:myRect fromRect:imageRect operation:NSCompositeCopy
fraction:1.0];

Send this to the console:

: Corrupt JPEG data: premature end of data segment

The image IS corrupt, but I see no way to detect it.

What a pain.

Trygve


___

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

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

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

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


Re: NSTableView and NSTextFieldCell redraw oddness when undo

2009-11-13 Thread jonat...@mugginsoft.com

On 13 Nov 2009, at 17:02, Corbin Dunn wrote:

> 
> On Nov 13, 2009, at 8:19 AM, jonat...@mugginsoft.com wrote:
> 
>> 
>> On 13 Nov 2009, at 15:15, Corbin Dunn wrote:
>> 
>>> 
>>> On Nov 13, 2009, at 6:35 AM, jonat...@mugginsoft.com wrote:
>>> 
 I have a subclassed NSTextFieldCell to create a cell that draws outside of 
 it's frame.
>>> 
>>> All the logic in tableview redraws things based on 
>>> -frameOfCellAtColumn:row:. Things will frequently not get redrawn if you 
>>> draw outside of those bounds.
>>> 
>>> I recommend using a "full width" cell. See the AppKit release notes for 10.5
>> Unfortunately this won't work in this situation as my custom cell is only 
>> drawing over the last half of the table width.
>> 
>> I looked -frameOfCellAtColumn:row: but overriding it seems impracticable.
>> 
>> It seems very weird that the problem pops up following an undo (it is a 
>> coredata app though...).
>> Surely the NSTableColumn  + NSCell won't know about the undo?
>> 
>> I use the same cell subclass in an NSOutlineView of the same data and it 
>> works fine.
> 
> It works fine purely by chance! Plus, there are probably some cases where it 
> doesn't update properly (and you just haven't noticed yet). If the table 
> needs to redraw cell X at column Y, it will mark the area dirty via 
> -frameOfCellAtColumn:Y row:X. 
> 
>> Would this and the fact that NSOutlineView is an NSTableView subclass tend 
>> to indicate that I am screwing up somewhere?
> 
> The error is having the cell draw outside of its given bounds. You need to 
> change that (or else do the invalidation yourself, which will be difficult to 
> get correct in all cases, unless you override frameOfCellAtColumn:row:. 
> Simply adding a -setNeedsDisplay:YES to redraw everything is bad for 
> performance).
> 
Don't know what I was going on about before.
There is nothing impracticable about overriding -frameOfCellAtColumn:row:
In fact it's trivial.
And, more to the point, it works.

/*
 
 frame of cell at column
 
 */
- (NSRect)frameOfCellAtColumn:(NSInteger)columnIndex row:(NSInteger)rowIndex
{
NSRect rect = [super frameOfCellAtColumn:columnIndex row:rowIndex];
if (columnIndex == EXTENDED_COLUMN_INDEX) {
NSCell *cell = [[[self tableColumns] objectAtIndex:columnIndex] 
dataCell];
if ([cell isKindOfClass:[MGSEntryTextCell class]] && 
[(MGSEntryTextCell *)cell extendCell]) {
rect.size.width = [self frame].size.width - 
rect.origin.x;
}
}

return rect;
}

Many thanks. I think that this would have eluded me without your input.

Jonathan

> --corbin
> 
> 
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Callback when OS delivers console msg for my process?

2009-11-13 Thread Joel Levin
You might try checking NSImage's -isValid after loading it.

- Joel

On Nov 13, 2009, at 11:23 AM, Trygve Inda wrote:

> I use:
> 
> imageWithContentsOfFile:@"a.jpg"
> 
> And sometime it generates a console message:
> 
> Corrupt JPEG data: premature end of data segment
> 
> How can I use an observer/exception handler or other notification to detect
> such messages as NSImage accepts this image as valid when it is not.
> 
> Something deeper in the OS knows the problem and I'd like to be notified.
> 
> Thanks,
> 
> Trygve
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/joel_levin%40apple.com
> 
> This email sent to joel_le...@apple.com

___

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

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

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

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


Derived Value and Core Data

2009-11-13 Thread Luther Baker
Using Core Data - I have created a named NSManagedObject that has both a
start time and end time.

In an iphone app (UITableViewController), I'd like to display a list of
these *Sessions* and I'd like the SECTION headers to break per day, based on
a Session's start *date*. So, I'm storing a *time* - and I need to group by
a *date*.

Would I simply add a readonly property 'startDate' to the literal Session
code (.h,.m) that Core Data generated from my data model - in which I would
derive the start date from the start time? or would this be a case for
declaring a 'transient' property in my Core Data model? I don't exactly know
when to use or not to use Transient properties.

It would be used as follows:

fetchedResultsController_ =
[[NSFetchedResultsController alloc]
initWithFetchRequest:fetchRequest
managedObjectContext:managedObjectContext_
sectionNameKeyPath:@"startDate"
cacheName:cacheName];



Will this manually defined property actually work in this method? I've
created a transient property in my Core Data model and implemented my own
getter for the property but I only ever get back the 'default' value I
created in the Core Data model gui. In other words, the infrastructure never
seems to invoke my version of

- (NSString*)startDate {
...
}

implemented in the code-gen'd Session (NSManagedObject) class.

What is the proper way to do this?

-Luther
___

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

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


Callback when OS delivers console msg for my process?

2009-11-13 Thread Trygve Inda
I use:

imageWithContentsOfFile:@"a.jpg"

And sometime it generates a console message:

Corrupt JPEG data: premature end of data segment

How can I use an observer/exception handler or other notification to detect
such messages as NSImage accepts this image as valid when it is not.

Something deeper in the OS knows the problem and I'd like to be notified.

Thanks,

Trygve


___

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

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

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

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


Re: CPU sampling and +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]

2009-11-13 Thread Paulo Andrade
Hello,

I'm using the CPU sampler template.

Here (http://1wzi.sl.pt) is a sample of a very simple run to prove my point.

Here's how I collected it:
- Start the app and let it fully launch (it does a few request at boot)
- Attach instruments with the CPU Sampler template
- Let it run for 30 seconds and not touch the iphone 

You'll see that the time is equally divided between +[UIApplication run] and 
+[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]

Please let me know if you have any other ideas that could explain this.

Thanks a lot

Paulo Andrade


On Nov 13, 2009, at 4:40 PM, Joar Wingfors wrote:

> 
> On 13 nov 2009, at 04.36, Paulo Andrade wrote:
> 
>> I'm guessing that when using a NSURLConnection the framework spawns a new 
>> thread and creates a runloop for it,
> 
> 
> That sounds about right. I could also see that the framework might choose to 
> keep this thread around after you've finished using it (in case you need it 
> again later).
> 
> 
>> this runloop just like the runloop on the main thread is constantly running 
>> even when I'm no longer using any NSURLConnection.
> 
> 
> I don't believe this to be the case though. When not handling any input 
> sources (sending / receiving data), I'd expect for this run loop (just like 
> the run loop for the main thread) to be "parked", not consuming any (or at 
> least not basically any) CPU.
> 
> How are you running your CPU profile (what is the configuration you're using 
> when launching Instruments), and how are you filtering your data after 
> collecting the sample? If you want more feedback, upload the whole sample 
> instead of a screenshot next time.
> 
> 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


Detect - Corrupt JPEG data: premature end of data segment

2009-11-13 Thread Trygve Inda
I am downloading an image from the server and sometimes I get an image that
is only the first half of the data, either because of a lost connection to
the server or the file being replaced on the server while I am downloading.

Opening in preview, generates a console message:

Corrupt JPEG data: premature end of data segment

However, the image renders ok - except the bottom half is solid grey. How
can I detect in code that there is a "premature end of data segment" since

imageWithContentsOfFile:@"a.jpg"  works ok to build an image, albeit with a
grey block in half or a quarter of the image.

Thanks,

Trygve


___

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

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

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

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


Re: NSTableView and NSTextFieldCell redraw oddness when undo

2009-11-13 Thread Corbin Dunn

On Nov 13, 2009, at 8:19 AM, jonat...@mugginsoft.com wrote:

> 
> On 13 Nov 2009, at 15:15, Corbin Dunn wrote:
> 
>> 
>> On Nov 13, 2009, at 6:35 AM, jonat...@mugginsoft.com wrote:
>> 
>>> I have a subclassed NSTextFieldCell to create a cell that draws outside of 
>>> it's frame.
>> 
>> All the logic in tableview redraws things based on 
>> -frameOfCellAtColumn:row:. Things will frequently not get redrawn if you 
>> draw outside of those bounds.
>> 
>> I recommend using a "full width" cell. See the AppKit release notes for 10.5
> Unfortunately this won't work in this situation as my custom cell is only 
> drawing over the last half of the table width.
> 
> I looked -frameOfCellAtColumn:row: but overriding it seems impracticable.
> 
> It seems very weird that the problem pops up following an undo (it is a 
> coredata app though...).
> Surely the NSTableColumn  + NSCell won't know about the undo?
> 
> I use the same cell subclass in an NSOutlineView of the same data and it 
> works fine.

It works fine purely by chance! Plus, there are probably some cases where it 
doesn't update properly (and you just haven't noticed yet). If the table needs 
to redraw cell X at column Y, it will mark the area dirty via 
-frameOfCellAtColumn:Y row:X. 

> Would this and the fact that NSOutlineView is an NSTableView subclass tend to 
> indicate that I am screwing up somewhere?

The error is having the cell draw outside of its given bounds. You need to 
change that (or else do the invalidation yourself, which will be difficult to 
get correct in all cases, unless you override frameOfCellAtColumn:row:. Simply 
adding a -setNeedsDisplay:YES to redraw everything is bad for performance).

--corbin




___

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

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

2009-11-13 Thread David Duncan
On Nov 13, 2009, at 1:27 AM, Mirko Viviani wrote:

> To be honest I didn't remember the resolution indipendent thing, but I was 
> supposing something similar
> since drawing my image in tiles on this context resulted with gaps !
> But I was not able to obtain the scale factor of the printing context so I 
> didn't understand.

Technically you are not drawing to the printer, but rather a specialized PDF 
context. Getting the current DPI of the printer isn't always possible, and it 
is easy for the user to invalidate that information (printing to PDF or moving 
a print job between printers) so it isn't recommended.

> CGContextConvertSizeToDeviceSpace() does not seem to correctly convert my 
> paperSize
> (from NSPrintInfo) to device space. (see below)
> I need this information because I want to scale an image (ie 500 Mpx) to a 
> reasonable size instead of
> crashing my app! :)
> 
> I haven't checked the context transform matrix yet, but which route should I 
> follow to obtain this information?


It is doing exactly what it should do given the reality as explained above. I 
would choose a reasonable scaling factor for your image and use that to resize 
it before drawing it to the print context.
--
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


NSPredicateEditorRowTemplate and dynamic popups

2009-11-13 Thread Dave DeLong
Hi everyone,

I have an NSPredicateEditor, with some standard row templates.  I'd like to add 
a custom row template with three views:  a popup button (indicating the 
attributes this template references), a second popup button (with the 
operators), and a third popup button that's populated with a list of possible 
values.

This is very similar to a regular row template, except that the list of 
possible values is computed at runtime and can change periodically based on 
system events.

I've tried subclassing NSPredicateEditorRowTemplate, overriding -templateViews, 
and returning my 3 popup buttons (all properly populated).  This works once, 
but after the row is created, I haven't been able to figure out how to 
repopulate the popup button when the list of possible values changes.  I've 
tried setting the popup button's menu's delegate to an object that will 
repopulate it, but the delegate methods are never called.

I've also seen that when there's only one possible value, my popup button is 
replaced with a textfield.  I suppose that's OK, except that if the list of 
possible values changes, I need that textfield to change to a popup button.

How can I achieve my dynamic popup button in an NSPredicateEditorRowTemplate?

Thanks!

Dave DeLong

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: CPU sampling and +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]

2009-11-13 Thread Joar Wingfors

On 13 nov 2009, at 04.36, Paulo Andrade wrote:

> I'm guessing that when using a NSURLConnection the framework spawns a new 
> thread and creates a runloop for it,


That sounds about right. I could also see that the framework might choose to 
keep this thread around after you've finished using it (in case you need it 
again later).


> this runloop just like the runloop on the main thread is constantly running 
> even when I'm no longer using any NSURLConnection.


I don't believe this to be the case though. When not handling any input sources 
(sending / receiving data), I'd expect for this run loop (just like the run 
loop for the main thread) to be "parked", not consuming any (or at least not 
basically any) CPU.

How are you running your CPU profile (what is the configuration you're using 
when launching Instruments), and how are you filtering your data after 
collecting the sample? If you want more feedback, upload the whole sample 
instead of a screenshot next time.

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


LSOpenFromURLSpec() returns -10825 on Tiger

2009-11-13 Thread Mirko Viviani
Hi,

I have a problem building an application targeted to 10.4.10 and up.

Launching the app with open I get:

$ open /Applications/myapp.app
... LSOpenFromURLSpec() returned -10825 for application (null) urls 
file://localhost/Applications/myapp.app/.

while launching the exe inside the application bundle works like a charm.

It is compiled for ppc7400 and i386 with gcc 4.0 and xcode 3.2.1, 10.5sdk and 
deployment to 10.4
LSMinimumSystemVersion is set to 10.4.10

It seems to me an incompatibility in the Info.plist or at least a file/dir 
permission, but I'm not able find it.

Is there a way to enable a more verbose output?
Things to check?
Are the sources of LSOpenFromURLSpec() of tiger available somewhere?

Thank you.

-- 
Ciao,
Mirko

___

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

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

2009-11-13 Thread jonat...@mugginsoft.com

On 13 Nov 2009, at 15:15, Corbin Dunn wrote:

> 
> On Nov 13, 2009, at 6:35 AM, jonat...@mugginsoft.com wrote:
> 
>> I have a subclassed NSTextFieldCell to create a cell that draws outside of 
>> it's frame.
> 
> All the logic in tableview redraws things based on -frameOfCellAtColumn:row:. 
> Things will frequently not get redrawn if you draw outside of those bounds.
> 
> I recommend using a "full width" cell. See the AppKit release notes for 10.5
Unfortunately this won't work in this situation as my custom cell is only 
drawing over the last half of the table width.

I looked -frameOfCellAtColumn:row: but overriding it seems impracticable.

It seems very weird that the problem pops up following an undo (it is a 
coredata app though...).
Surely the NSTableColumn  + NSCell won't know about the undo?

I use the same cell subclass in an NSOutlineView of the same data and it works 
fine.
Would this and the fact that NSOutlineView is an NSTableView subclass tend to 
indicate that I am screwing up somewhere?

> 
> corbin
> 
> 
>> This is to enable NSTableView rows to have one line of text that runs 
>> beneath several other cells.
>> Bindings are utilised.
>> 
>> This works fine except, curiously, when an operation is undone.
>> In this case the cell only redraws within its initial cellFrame.
>> In other words, it doesn't redraw within the extended area as detailed in - 
>> (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView 
>> detailed below.
>> If I click the table row redrawing occurs correctly.
>> 
>> Tracing shows that the bindings are firing okay and that my code path is the 
>> same for do/undo.
>> All cellFrame rects look as expected.
>> 
>> Is it to be presumed that there is different code path within NSCell 
>> following an undo?
>> 
>> - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
>> {
>>  
>>  if (self.twoLine) {
>>  if (self.displayOnSecondLine) {
>>  
>>  // draw text for line 2
>>  cellFrame.size.height /= 2;
>>  cellFrame.origin.y += cellFrame.size.height;
>>  
>>  // draw to edge of control ?
>>  if (self.extendCell) {
>>  cellFrame.size.width = [controlView 
>> frame].size.width - cellFrame.origin.x;
>>  }
>>  } else {
>>  
>>  // draw only on first line
>>  cellFrame.size.height /= 2;
>>  }
>>  }
>> 
>>  [super drawInteriorWithFrame:cellFrame inView:controlView]; 
>> }
>> 
>> Regards
>> 
>> 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/corbind%40apple.com
>> 
>> This email sent to corb...@apple.com
> 

___

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

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

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

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


Printing panel issue

2009-11-13 Thread Mirko Viviani
Hi,

in my application I have implemented a printing view like the one in the 
ImageApp example
and it works like a charm apart a small thing in the Layout panel printing 
sheet.

In 10.6.2 the "Flip horizontally" does not work, but "Reverse page orientation" 
does.
In 10.5.7 "Reverse page orientation" does not work, and there is not the flip 
checkbox.

The only thing different from ImageApp is that my app is not document-based.
I've tryed to use the same code of ImageApp with no luck.

The only thing that the PrintView does is draw an image with quartz,
and I don't draw the image in tiles.

Any ideas?

Thank you.

-- 
Ciao,
Mirko___

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

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

2009-11-13 Thread Corbin Dunn

On Nov 13, 2009, at 6:35 AM, jonat...@mugginsoft.com wrote:

> I have a subclassed NSTextFieldCell to create a cell that draws outside of 
> it's frame.

All the logic in tableview redraws things based on -frameOfCellAtColumn:row:. 
Things will frequently not get redrawn if you draw outside of those bounds.

I recommend using a "full width" cell. See the AppKit release notes for 10.5

corbin


> This is to enable NSTableView rows to have one line of text that runs beneath 
> several other cells.
> Bindings are utilised.
> 
> This works fine except, curiously, when an operation is undone.
> In this case the cell only redraws within its initial cellFrame.
> In other words, it doesn't redraw within the extended area as detailed in - 
> (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView 
> detailed below.
> If I click the table row redrawing occurs correctly.
> 
> Tracing shows that the bindings are firing okay and that my code path is the 
> same for do/undo.
> All cellFrame rects look as expected.
> 
> Is it to be presumed that there is different code path within NSCell 
> following an undo?
> 
> - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
> {
>   
>   if (self.twoLine) {
>   if (self.displayOnSecondLine) {
>   
>   // draw text for line 2
>   cellFrame.size.height /= 2;
>   cellFrame.origin.y += cellFrame.size.height;
>   
>   // draw to edge of control ?
>   if (self.extendCell) {
>   cellFrame.size.width = [controlView 
> frame].size.width - cellFrame.origin.x;
>   }
>   } else {
>   
>   // draw only on first line
>   cellFrame.size.height /= 2;
>   }
>   }
> 
>   [super drawInteriorWithFrame:cellFrame inView:controlView]; 
> }
> 
> Regards
> 
> 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/corbind%40apple.com
> 
> This email sent to corb...@apple.com

___

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

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

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

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


NSTableView and NSTextFieldCell redraw oddness when undo

2009-11-13 Thread jonat...@mugginsoft.com
I have a subclassed NSTextFieldCell to create a cell that draws outside of it's 
frame.
This is to enable NSTableView rows to have one line of text that runs beneath 
several other cells.
Bindings are utilised.

This works fine except, curiously, when an operation is undone.
In this case the cell only redraws within its initial cellFrame.
In other words, it doesn't redraw within the extended area as detailed in - 
(void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView 
detailed below.
If I click the table row redrawing occurs correctly.

Tracing shows that the bindings are firing okay and that my code path is the 
same for do/undo.
All cellFrame rects look as expected.

Is it to be presumed that there is different code path within NSCell following 
an undo?

- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{

if (self.twoLine) {
if (self.displayOnSecondLine) {

// draw text for line 2
cellFrame.size.height /= 2;
cellFrame.origin.y += cellFrame.size.height;

// draw to edge of control ?
if (self.extendCell) {
cellFrame.size.width = [controlView 
frame].size.width - cellFrame.origin.x;
}
} else {

// draw only on first line
cellFrame.size.height /= 2;
}
}

[super drawInteriorWithFrame:cellFrame inView:controlView]; 
}

Regards

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


Re: KVO cross dependencies

2009-11-13 Thread Roland King
One option - use Garbage Collection under Snow Leopard, it does it all for you. 

If you can't do that. I assume, from the fact that your observed objects are 
being released at all that the observing objects are not retaining them (or 
keeping strong references if you are using Garbage Collection), if you had them 
retained by the observing object then they wouldn't be getting dealloced. If 
the observations are in a tree, then you could have the observers retain the 
objects they are observing and unobserve them as they release them, then you'll 
never have the issue of an object with registered observers being deallocated. 

If, however you can't do that, because the objects all observe each other, 
you'll get retain cycles (again assuming you are not using GC), so you cannot 
retain and need to tell the observing object to remove its observations on the 
observed object before it dies. One way to do that is to have another property 
on the objects, something like canBeObserved, and have all your observers 
observe that property *as well* as other observations they have. In your 
dealloc method, right at the start of it, flip that property to NO and all your 
observers will be told you are no longer observable, they are then responsible 
for removing their observations. This happens synchronously, so by the time you 
continue with dealloc, nobody is observing you any more. 

We had a thread about this a few months ago where we discussed whether it was 
legitimate to do this in dealloc and discussing a note in the Snow Leopard 
release notes about that message and I believe that most people were satisfied 
that it was a supported thing to do. Note that even if you do this, under 10.5 
you will STILL get that warning message (not an exception) because it was 
emitted at the start of dealloc() before you had a chance to tell your 
observers to stop observing, that was what the release note addressed. 

I don't think there is a documented way of finding out who is observing you and 
what they are observing. 



On 13-Nov-2009, at 9:43 PM, Half Activist wrote:

> Hi all,
> 
>   I have sevral objects of different kind that observe values on each 
> other.
>   Now, when the objects are being released, I get an exception from the 
> KVO stuff telling me that an object is being deallocated while still 
> observed. And that's justified. Yet, the problem is in whatever way, order I 
> deallocate the objects that will always happen because of these cross 
> observations. Therefore what I should do is tell everyone that's observing an 
> object to remove them as observers. But how can I get a list of all observed 
> keys and the observers?
> 
> Regards.
> 
> PS: I thought about setting the observation info to nil but I guess this is a 
> one way ticket to a segfault.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
> 
> This email sent to r...@rols.org

___

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

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


KVO cross dependencies

2009-11-13 Thread Half Activist

Hi all,

	I have sevral objects of different kind that observe values on each  
other.
	Now, when the objects are being released, I get an exception from the  
KVO stuff telling me that an object is being deallocated while still  
observed. And that's justified. Yet, the problem is in whatever way,  
order I deallocate the objects that will always happen because of  
these cross observations. Therefore what I should do is tell everyone  
that's observing an object to remove them as observers. But how can I  
get a list of all observed keys and the observers?


Regards.

PS: I thought about setting the observation info to nil but I guess  
this is a one way ticket to a segfault.


___

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

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


CPU sampling and +[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]

2009-11-13 Thread Paulo Andrade
Hello,

I'm sampling an iPhone app to detect any bottlenecks in performance.
Interesting thing is that, from the first use of an NSURLConnection the 
following method will appear on Instruments:

+[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:]

And it's constantly running, even when the app is stopped (screenshot: 
http://1wwj.sl.pt).

I'm guessing that when using a NSURLConnection the framework spawns a new 
thread and creates a runloop for it, this runloop just like the runloop on the 
main thread is constantly running even when I'm no longer using any 
NSURLConnection.

Is my guess correct? Does this have any effect performance wise?



Regards,
Paulo Andrade___

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

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

2009-11-13 Thread Ken Tozier


On Nov 12, 2009, at 11:04 AM, Matt Neuburg wrote:


On Thu, 12 Nov 2009 12:08:20 + (UTC), kentoz...@comcast.net said:
I'm using NSXMLParser to parse XML output from Microsoft Word and  
am finding
that if a string contains a single quote, the parser is only giving  
me the part
of the string from the single quote onward. For example given the  
following

string:



"The topic of Jim's discussion was on the yeti crab"


But that isn't XML. Can you give an example using XML? That would  
make it

possible for others to reproduce and consider the actual problem. m.


Someone else answered the question off list. I was replacing the found  
chars rather than appending it

___

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

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

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

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


Re: Possible hardware-platform-dependent bug in NSTextView?!?

2009-11-13 Thread Jay Reynolds Freeman
I seem to have a fix for this one; at least, the person who
originally reported the problem does not see it any more.
But the situation is a little disturbing: On review of my code
I find that perhaps "scrollRangeToVisible" doesn't always do
what its name suggests, at least, not on all Macintoshes.
(I call "scrollRangeToVisible" on the selected range after
each keyDown event has been passed to super, I neglected to
mention that in my original posting about this problem.)

What does seem to work is a follow-up to keyDown that works 
like this: (variable declarations omitted to save space)

mainBounds = [self bounds];
theClipView = (NSClipView *)[self superview];
clipViewBounds = [theClipView bounds];

newPoint.x = 0;
newPoint.y = mainBounds.size.height - clipViewBounds.size.height;

if( newPoint.y < 0 )
newPoint.y = 0;

[theClipView scrollToPoint:newPoint];

Why I have to do that I cannot imagine, but it does seem to fix
the problem.

I would like to try to file a bug report on this one, but I am kind
of hampered because the bug does *not* occur on any Mac I own, which
makes it kind of hard to work up and verify a small test case from my
50,000-line  application.  Any advice?  Any folks from Apple
listening?

--  Jay Reynolds Freeman
-
jay_reynolds_free...@mac.com
http://web.mac.com/jay_reynolds_freeman (personal web site)

[...]

The bug occurs when a user is typing into an instance of a
subclass of NSTextView that I have created.  (Side issue:  I
do believe I had good reason to subclass rather than to use a
delegate, details on request.)  On some platforms, it appears
that the following happens:

   1) When there is more than one line of text in the
  instance ...
   2) And the insertion point is at the end of the text
  (that is, the next ordinary character typed will
  become the new last character in the text) ...
   3) And the user types a blank-space character, then ...

  The view scrolls by one line.  The direction of
  scroll is that if the insert cursor was 10 cm
  up from the bottom of the screen before the 'space',
  it will appear at 9.something cm up from the bottom
  of the screen after the 'space' has been typed.

  That is true whether or not there is any other
  text preceding the new 'space', in the last line
  of the text.

In my subclass, I did override keyDown, but there is nothing
in my code that treats 'space"' in any special way; that is,
it is *very* mystifying why the display scrolls for 'space'
but does not scroll for, e.g., 'a', 'b', 'c', -- they are all
passed through to [super keyDown:theEvent] without any
variation in treatment in my code.

[...]

The reason this is a problem is that my NSTextView subclass
instance is only one line tall, and the unwanted scrolling
moves the actual insertion point below the bottom of the
view, where the user can't see it.
___

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

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

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

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


Re: [Q] copy operation and authorization

2009-11-13 Thread Dave Keck
> As a user, I would become very suspicious if Finder suddenly requires me to
> authorize some copy operation just because I launched an app, or, even
> worse, because I took some action within an app...

Absolutely - that's the point of the "Details" disclosure triangle in
the authorization window: so the user knows what application is
requesting permission to do a specific operation.

And what about /etc/authorization? If your app relies on the Finder to
carry out its privileged operations, it also relies on the
com.apple.desktopservices right. And if the user happened to modify
that right, they've also unknowingly modified your app's behavior,
even though your app isn't published by Apple, nor is it related to
"Desktop Services."

On the other hand, it's a cruel joke to suggest a launchd daemon (BAS)
for the simple operation of copying a file to a privileged directory;
talk about bloat and cluttering users' computers.

Use AEWP. From 
http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/listing6.html

"You should only use BetterAuthorizationSample if your application needs ongoing
access to privileged operations.  For example, if you're writing a packet
capture tool ... On the other hand, if your application
needs elevated privileges for a one-off task (like installing or uninstalling),
you should consider using AuthorizationExecuteWithPrivileges directly."
___

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

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

2009-11-13 Thread Mirko Viviani
On 12/nov/2009, at 23.46, David Duncan wrote:

> Just like with all CGContexts you can apply a transform matrix to change the 
> coordinate system. However in general this isn't necessary. If you want an 
> image to display in a 1" x 1" area on screen, draw it into a 72x72 box. The 
> pixel size of the image will determine DPI. If you wanted to draw a 1" image 
> at 300 DPI then you would just need a 300x300 image drawn into a 72x72 box. 
> If you wanted to draw a 1" image at 600 DPI then you would need a 600x600 
> image drawn into the same 72x72 box.

To be honest I didn't remember the resolution indipendent thing, but I was 
supposing something similar
since drawing my image in tiles on this context resulted with gaps !
But I was not able to obtain the scale factor of the printing context so I 
didn't understand.

CGContextConvertSizeToDeviceSpace() does not seem to correctly convert my 
paperSize
(from NSPrintInfo) to device space. (see below)
I need this information because I want to scale an image (ie 500 Mpx) to a 
reasonable size instead of
crashing my app! :)

I haven't checked the context transform matrix yet, but which route should I 
follow to obtain this information?


Preview printing view:

paperSize={595.00 842.00} devicePaperSize={212.70 -301.00}

PDF:

paperSize={595.00 842.00} devicePaperSize={595.00 842.00}

Canon printer:

paperSize={595.00 842.00} devicePaperSize={595.00 842.00}


Thank you!

-- 
Ciao,
Mirko

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: [Q] copy operation and authorization

2009-11-13 Thread Jens Miltner


Am 13.11.2009 um 07:53 schrieb Jerry Krinock:



On 2009 Nov 12, at 14:24, Kyle Sluder wrote:

No.  Do not do this.  Follow the pattern of  
BetterAuthorizationSample:

http://developer.apple.com/mac/library/samplecode/BetterAuthorizationSample/listing4.html


Yes, what Kyle says is true.  AEWP is not recommended.

Now, thought, the *correct* way, integrating  
BetterAuthorizationSample into an app is a *lot* of work.  However,  
there is a very slick shortcut for which I credit Jean-Daniel  
Dupas:  If possible, send the Finder an AppleEvent instructing it to  
do the work for you.  In this case, for example, you might be able  
to ask Finder to copy that file from /Library to the user's  
temporary directory.  Now, if elevated privileges are needed, Finder  
should interface with Authorization Services to put up the  
authentication dialog, doing all of the heavy lifting.


But in that base, the user won't know why Finder needs the  
authorization, right?
As a user, I would become very suspicious if Finder suddenly requires  
me to authorize some copy operation just because I launched an app,  
or, even worse, because I took some action within an app...





___

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

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