NSService - I need a headslap

2009-02-04 Thread Steve Cronin

Folks;

I have a need for a stand-alone service.
Seems like Service don't get alot of love... (Maybe that's my  
problem .. but I don't think so)


To be clear here, this is a stand-alone .service type application (not  
a service vended by a larger app (like Mail).


Here's what I have done:
0) built with a .service wrapper
1) Info.plist - PrinClass=NSApp; Bundle OS Type = APPL;  
ExecutableFile=MyClassName; App is BackgroundOnly
1) Info.plist - Services{Menu, SendType, instance method name, and  
incoming service port name)

2) No xib file
3) standard main.m
4) I have a single ObjC class whose .m looks like this

+(void)initialize { [NSApp setDelegate:self]; }

- (void) applicationDidFinishLaunching:(NSNotification *)aNote {
[NSApp setServicesProvider:self];
void NSUpdateDynamicServices(void);
}

- (void) myServiceName:(NSPasteboard *)pboard userData:(NSString  
*)userData error:(NSString **)error {

.
}

What I can't get my head wrapped around is how/when does this .service  
thing get launched?
The docs seem to indicate that you can just build it as a .service,  
stuff into the ~/Library/Services and you are good to go...

(These docs are more than 8 years old Is there any later material?)

On Tiger systems I see the service appear on the Services menu   
Not so on Leopard
(On Leopard even if I log out and back in I still do not see the  
service in the menu...
But either way I never get any response.  If I put in log statements I  
never see any activity...
What am I overlooking?  I KNOW its something silly but have mercy my  
head is bloody


Thanks for any help!!
Steve
___

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

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

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

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


Re: NSService - I need a headslap

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 00:44, Steve Cronin wrote:


+(void)initialize { [NSApp setDelegate:self]; }


"self"? As in the class object? As in [MyDelegateClass class]? Are you  
sure you really want [NSApp setDelegate: [MyDelegateClass class]]?



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTask in separate thread is leaking memory

2009-02-04 Thread Ken Thomases

On Feb 4, 2009, at 4:49 AM, Oleg Krupnov wrote:


I use an NSTask to collect system info from system_profiler. Because
it takes a while to complete, I launch that task in a separate thread,
to avoid UI from freezing.


Both NSTask and NSFileHandle provide asynchronous interfaces, so it is  
not necessary to use a separate thread.




- (void)systemProfilerThread:(id)ignored
{
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

   NSString *configuration = nil;

NSPipe* inputPipe = [NSPipe pipe];


You do nothing with inputPipe, so you should just get rid of it.  If  
you want the task to not inherit your standard input, do [scriptTask  
setStandardInput:[NSFileHandle fileHandleWithNullDevice]].



NSPipe* outputPipe = [NSPipe pipe];

NSTask* scriptTask = [[[NSTask alloc] init] autorelease];

[scriptTask setLaunchPath:@"/usr/sbin/system_profiler"];
[scriptTask setArguments:[NSArray arrayWithObjects:@"-detailLevel",
@"mini", nil]];
[scriptTask setStandardOutput:outputPipe];
[scriptTask launch];

[[inputPipe fileHandleForWriting] closeFile];
configuration = [[[NSString alloc] initWithData:[[outputPipe
fileHandleForReading] readDataToEndOfFile]

   encoding:NSUTF8StringEncoding] autorelease];
if (!m_isCanceled)
{
[m_target performSelectorOnMainThread:m_action
withObject:configuration waitUntilDone:NO];
}

   [pool drain];
}

The problem is, according to the Leaks tool, is that there's a memory
leak in -systemProfilerThread. The leak disappears if I launch the
task in the main thread.


You don't say what is leaking or where it was allocated from.



I've read in docs that NSTask is NOT thread safe, but does it also
apply to the above case, when the NSTask object is created and
released within a single thread, though not the main thread? If NSTask
cannot be used this way, then which way I should use it?


Create and launch the task from the main thread.  Register for the  
task termination notification, if you're interested.


Also register for notification of read-to-end-of-file completion on  
the output file handle, and invoke - 
readToEndOfFileInBackgroundAndNotify on it.  In the handler for that  
notification is where you can decode/parse the data.


After you have registered for these notifications and launched the  
task, return immediately.  Don't block waiting for either the task to  
terminate or data to arrive from the file handle.




Also, what puzzles me is why, first and foremost, the main thread is
blocked until the task is complete? I do not call wait -waitUntilExit.
I would expect that the main thread is not blocked, but I receive the
NSTaskDidTerminateNotification, but it does not happens with the code
above.


I assume you mean the main thread is blocked if you _don't_ detach a  
separate thread, right?  In that case, it's because you're using - 
readDataToEndOfFile, which is synchronous.  It doesn't return until it  
has read to the end of the output from system_profiler -- that is,  
when system_profiler terminates and closes its standard output.


Also, where are you registering for NSTaskDidTerminateNotification?  I  
don't see it above.  In any case, regardless of on which thread you  
register for that notification, I would expect it to be posted on the  
thread which created the NSTask.  Although notifications are not  
normally passed through the run loop, this particular notification is  
the result of the framework "noticiing" that the task has completed  
(an event which is, of course, external to your program and the  
framework's direct knowledge).  In order to notice that, the framework  
needs the run loop of the thread to run.  You never run the run loop  
for your thread in the code above.


I suspect, in fact, that that's the cause of the memory leak.  The  
framework had some housekeeping to do that relies on the run loop  
running.


Cheers,
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: NSService - I need a headslap

2009-02-04 Thread Ron Fleckner


On 04/02/2009, at 7:44 PM, Steve Cronin wrote:


+(void)initialize { [NSApp setDelegate:self]; }


Hi Steve,

as Quincey has suggested, looks like the above is the problem.  I've  
done a stand-alone .service and [NSApp setDelegate:self] is in -  
(id)init, not + (void)initialize.


Ron
___

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

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


NSTask in separate thread is leaking memory

2009-02-04 Thread Oleg Krupnov
I use an NSTask to collect system info from system_profiler. Because
it takes a while to complete, I launch that task in a separate thread,
to avoid UI from freezing.

Here is my code (I borrowed it from JRFeedbackProvider,
http://github.com/rentzsch/jrfeedbackprovider/tree/master):

- (void)gatherSystemInfo
{
[NSThread detachNewThreadSelector:@selector(systemProfilerThread:)
 toTarget:self
   withObject:nil];
}

- (void)systemProfilerThread:(id)ignored
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

NSString *configuration = nil;

NSPipe* inputPipe = [NSPipe pipe];
NSPipe* outputPipe = [NSPipe pipe];

NSTask* scriptTask = [[[NSTask alloc] init] autorelease];

[scriptTask setLaunchPath:@"/usr/sbin/system_profiler"];
[scriptTask setArguments:[NSArray arrayWithObjects:@"-detailLevel",
@"mini", nil]];
[scriptTask setStandardOutput:outputPipe];
[scriptTask launch];

[[inputPipe fileHandleForWriting] closeFile];
configuration = [[[NSString alloc] initWithData:[[outputPipe
fileHandleForReading] readDataToEndOfFile]

   encoding:NSUTF8StringEncoding] autorelease];
if (!m_isCanceled)
{
[m_target performSelectorOnMainThread:m_action
withObject:configuration waitUntilDone:NO];
}

[pool drain];
}

The problem is, according to the Leaks tool, is that there's a memory
leak in -systemProfilerThread. The leak disappears if I launch the
task in the main thread.

I've read in docs that NSTask is NOT thread safe, but does it also
apply to the above case, when the NSTask object is created and
released within a single thread, though not the main thread? If NSTask
cannot be used this way, then which way I should use it?

Also, what puzzles me is why, first and foremost, the main thread is
blocked until the task is complete? I do not call wait -waitUntilExit.
I would expect that the main thread is not blocked, but I receive the
NSTaskDidTerminateNotification, but it does not happens with the code
above.
___

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

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

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

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


how to get iPhone serial number using UIDevice

2009-02-04 Thread Ankur Diyora
 Hello all,
I want iPhone serial number programatically.For that i use NSString
*deviceId = [UIDevice currentDevice]
uniqueIdentifier
;
I get deviceId but it is iPhone uniqueID(40 char). How i get correct serial
number which is given behindiPhone?

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


Core animation - Safari Find effect

2009-02-04 Thread Nick Brandaleone

Hi all,

I am just getting into core animation, and it seems very promising.

I am creating a simple search app, and I want to "highlight" the found  
word/phrase in a large body of text,
in a similar way that Safari does it (background goes dim, and word is  
highlighted).


I have the first part done (ie. dimming text), but I am not sure how  
to proceed with the second (highlight found word).


Here are my steps.  Please advise on the remaining parts.  Thanks!

  - parent view is layer backed (setWantsLayer: YES)
  - create a layer whose content is my text
  - add the text layer as a sublayer to the view
  - fade to zero opacity.

  - ... a miracle happens ... (string within text is highlighted )  ;-)

I assume that I must create a new layer (CAtext), position it in the  
correct position over the "found word", and animate this new layer  
(fade in, etc..).


Does this sound correct?

Thanks!

Nick Brandaleone

___

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

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

2009-02-04 Thread Chris Idou
That didn't seem to help. I tried overriding selectedRanges, and that makes you 
delete the whole range when you are clicked in it (good), but nothing seems to 
help the case of trying to simply backspace from the end of the range. In this 
case the selected range is not relevant because you are not inside the range 
yet as far as the existing range, and you can't predict in advance the user 
intends to backspace into it, and for the same reason, neither is the 
rangeForUserTextChange.

On Feb 3, 2009, at 5:24 PM, Chris Idou wrote:

> So I want it that if you try and delete any character that is part of a 
> token, it deletes the entire token.
> 
> So I'm overriding rangeForUserTextChange to return a different range if the 
> current range includes any part of a token.
> 
> This seems to work if the user tries to type in any part. For example, 
> clicking on the token and pressing space bar or a letter.
> 
> However, it doesn't work if you press backspace or delete, even though 
> rangeForUserTextChange is still called.

I don't think you really want to override that method. Instead override 
-[NSTextView selectionRangeForProposedRange:granularity:] which should be 
called for every selection the user makes.

~Martin


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
more
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTask in separate thread is leaking memory

2009-02-04 Thread Oleg Krupnov
Marvelous! Thank you very much, Ken. All of your advices worked like a charm.

As always, it's been a good idea to get rid of thread spawning. I've
done so using the asynchronous  readToEndOfFileInBackgroundAndNotify
method of the reading file handle of the pipe. It is indeed that I
used the synchronous readDataToEndOfFile method before, my main thread
was blocked. It has been also the reason why the
NSTaskDidTerminateNotification did not arrive. Anyway, I don't
actually need this notification, but instead I used
NSFileHandleReadToEndOfFileCompletionNotification.

So the problem is solved for now, but one question still left open for
the future is the following: would it be thread-safe to use NSTask in
the way I originally attempted? If yes, why did it leak? The leak was
reported somewhere inside NSTask internal initialization code. Funny
enough, the leak disappeared if I made one superfluous -release call
on NSTask.



On Wed, Feb 4, 2009 at 1:30 PM, Ken Thomases  wrote:
> On Feb 4, 2009, at 4:49 AM, Oleg Krupnov wrote:
>
>> I use an NSTask to collect system info from system_profiler. Because
>> it takes a while to complete, I launch that task in a separate thread,
>> to avoid UI from freezing.
>
> Both NSTask and NSFileHandle provide asynchronous interfaces, so it is not
> necessary to use a separate thread.
>
>
>> - (void)systemProfilerThread:(id)ignored
>> {
>>   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>
>>   NSString *configuration = nil;
>>
>>NSPipe* inputPipe = [NSPipe pipe];
>
> You do nothing with inputPipe, so you should just get rid of it.  If you
> want the task to not inherit your standard input, do [scriptTask
> setStandardInput:[NSFileHandle fileHandleWithNullDevice]].
>
>>NSPipe* outputPipe = [NSPipe pipe];
>>
>>NSTask* scriptTask = [[[NSTask alloc] init] autorelease];
>>
>>[scriptTask setLaunchPath:@"/usr/sbin/system_profiler"];
>>[scriptTask setArguments:[NSArray arrayWithObjects:@"-detailLevel",
>> @"mini", nil]];
>>[scriptTask setStandardOutput:outputPipe];
>>[scriptTask launch];
>>
>>[[inputPipe fileHandleForWriting] closeFile];
>>configuration = [[[NSString alloc] initWithData:[[outputPipe
>> fileHandleForReading] readDataToEndOfFile]
>>
>> encoding:NSUTF8StringEncoding] autorelease];
>>if (!m_isCanceled)
>>{
>>[m_target performSelectorOnMainThread:m_action
>> withObject:configuration waitUntilDone:NO];
>>}
>>
>>   [pool drain];
>> }
>>
>> The problem is, according to the Leaks tool, is that there's a memory
>> leak in -systemProfilerThread. The leak disappears if I launch the
>> task in the main thread.
>
> You don't say what is leaking or where it was allocated from.
>
>
>> I've read in docs that NSTask is NOT thread safe, but does it also
>> apply to the above case, when the NSTask object is created and
>> released within a single thread, though not the main thread? If NSTask
>> cannot be used this way, then which way I should use it?
>
> Create and launch the task from the main thread.  Register for the task
> termination notification, if you're interested.
>
> Also register for notification of read-to-end-of-file completion on the
> output file handle, and invoke -readToEndOfFileInBackgroundAndNotify on it.
>  In the handler for that notification is where you can decode/parse the
> data.
>
> After you have registered for these notifications and launched the task,
> return immediately.  Don't block waiting for either the task to terminate or
> data to arrive from the file handle.
>
>
>> Also, what puzzles me is why, first and foremost, the main thread is
>> blocked until the task is complete? I do not call wait -waitUntilExit.
>> I would expect that the main thread is not blocked, but I receive the
>> NSTaskDidTerminateNotification, but it does not happens with the code
>> above.
>
> I assume you mean the main thread is blocked if you _don't_ detach a
> separate thread, right?  In that case, it's because you're using
> -readDataToEndOfFile, which is synchronous.  It doesn't return until it has
> read to the end of the output from system_profiler -- that is, when
> system_profiler terminates and closes its standard output.
>
> Also, where are you registering for NSTaskDidTerminateNotification?  I don't
> see it above.  In any case, regardless of on which thread you register for
> that notification, I would expect it to be posted on the thread which
> created the NSTask.  Although notifications are not normally passed through
> the run loop, this particular notification is the result of the framework
> "noticiing" that the task has completed (an event which is, of course,
> external to your program and the framework's direct knowledge).  In order to
> notice that, the framework needs the run loop of the thread to run.  You
> never run the run loop for your thread in the code above.
>
> I suspect, in fact, that that's the cause of the memory lea

Open OtherApp just behind MyApp

2009-02-04 Thread Yang Meyer

Hi,

I want to open another application (say, Safari) in the "layer" just  
behind my application.


I've researched quite a bit now, but the two "solutions" I have found  
so far do not do exactly what I want.


"Solution" 1:
NSWorkspace * ws = [NSWorkspace sharedWorkspace];
[ws launchAppWithBundleIdentifier: @"com.apple.Safari"
  options: 
NSWorkspaceLaunchWithoutActivation
   additionalEventParamDescriptor: NULL
 launchIdentifier: nil];

Problem with solution 1: If Safari is already active, but somewhere  
behind other applications' windows (e.g. MyApp < Compose New Mail <  
Mail.app < Safari, where "<" means "in front of"), then the Safari  
window is not brought "up". (If Safari does NOT have open windows,  
solution 1 does exactly what I want.)


"Solution" 2:
[ws launchApplication:@"Safari"]; // opens Safari in front
	[NSApp activateIgnoringOtherApps:YES]; // pushes my app in front,  
effectively right above Safari


Problem with solution 2: I must be doing it wrong, because my own  
application's window doesn't ever get its focus back and the GUI seems  
to hang. I tried giving my app window the focus, but neither of these  
work:

[[NSApp mainWindow] makeKeyAndOrderFront:NSApp]; // ?
[[NSApp keyWindow] makeKeyAndOrderFront:NSApp]; // ?

Any ideas?

Thanks a lot,

Yang
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: AquaticPrime Config.php + PayPal Advanced Variables Not Working

2009-02-04 Thread Chunk 1978
$appLicense = $_REQUEST["appLicense"];

did not work either... :/

On Tue, Feb 3, 2009 at 10:28 PM, Chunk 1978  wrote:
> someone else told me that in order to use custom variables on my
> paypal buttons i needed to set up IPN, and that the variable would
> become apart of the button's URL... but i'm trying to avoid setting up
> IPN simply because it's seems like overkill and complicated for my
> tired mind... so essentially my button's only have address like this
> with a hosted_button_id:
>
> https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=1234567
>
> i see in apart of the aquatic prime script that it uses the user data:
>
> -=-=-=-=-=-=-=-=-=-=-=-=-=-
> // parse the data
> $lines = explode("\n", $res);
> $keyarray = array();
>
> if (strcmp ($lines[0], "FAIL") == 0)
> {
>// Put in a URL here to redirect back on error
>header("Location: $error_url");
>die;
> }
>
> for ($i = 1; $i < count($lines); $i++)
> {
>list($lineKey, $lineValue) = explode("=", $lines[$i]);
>$keyarray[urldecode($lineKey)] = urldecode($lineValue);
> }
>
> $product = $keyarray['item_name'];
> $name = $keyarray['first_name']." ".$keyarray['last_name'];
> $email = $keyarray['payer_email'];
> $amount = $keyarray['mc_gross'];
> $count = $keyarray['quantity'];
> // RFC 2822 formatted date
> $timestamp = date("r", strtotime($keyarray['payment_date']));
> $transactionID = $keyarray['txn_id'];
> -=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> so i tried just calling $appLicense = $_GET['item_name'] and used the
> name of the item (like "Software License") as the variable like this:
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
> $appLicense = $_GET["item_name"];
>
> $error_url = "//the error url";
>
> $key = "";
> $privateKey = "";
>
> if ($appLicense == "Software License A")
>   {
>   $key = "//the key for Software-A";
>   $privateKey = "//the private key for Software-A";
>   }
> else if ($appLicense == "Software License B")
>   {
>   $key = "//the key for Software-B";
>   $privateKey = "//the private key for Software-B";
>   }
> else
>   {
>   header("Location: $error_url");
>   die;
>   }
>
> //remaining lines of code involve the email message
> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
>
> but ultimately that didn't work either, which kinda surprised me since
> the data is clearly being used already... i must be calling it
> wrong?... :-/
>
>
>
>
>
>
>
>
> On Tue, Feb 3, 2009 at 8:56 PM, Sherm Pendley  wrote:
>> On Feb 3, 2009, at 7:21 PM, Chunk 1978 wrote:
>>
>>> $appLicense = $_POST["appLicense"];
>>
>> Try this instead:
>>
>> $appLicense = $_GET["appLicense"];
>>
>>> isn't this the correct method to incorporate
>>> customized php variables with the AquaticPrime scripts?
>>
>> It depends. When an HTML form has a "method" attribute with a value of
>> "POST", the form will be submitted using the HTTP POST method, and (in PHP)
>> the form inputs will be found in $_POST.
>>
>> When you link to an ordinary URL with a query string, such as
>> "http://foo.example/whatever.php?appLicense=Bar";, the HTTP GET method is
>> used to send the request, and the input from the query string is in $_GET.
>>
>> If you want the receiving script to handle either one, use $_REQUEST, which
>> includes the contents of both $_POST and $_GET, as well as $_COOKIES.
>>
>> sherm--
>>
>>
>
___

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

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

2009-02-04 Thread Steve Cronin
Well, sheesh - that's embarrassing!   There is no 'self' until init -  
I know that!  Ugh.


However, that doesn't change my end result!

I never see anything on the Services menu nor anything from the NSLog  
statements shown below.
(Even when I double-click on the .service file;  after whcih I CAN see  
it in the process list in Activity monitor but still no log messages)
Logging out and back in doesn't make my service name appear on the  
Service menu...
This is on a 10.5.6 system using a Release build which has been placed  
in ~/Library/Services.


SO my basic questions still stand:
What event/conditions launches a .service which resides in ~/Library/ 
Services?

Should/must .service files be 'Background Only'?
Am I missing something basic in my setup here -
I have only a Info.plist and 1 .h (NSObject) and 2 . m files (main and  
MyService) and no .xib?
Other than the 'wrapper' settings are there other compiler settings  
required for this setup?
I have only 2 steps in my build process: 'Compile Source (2)' and  
'Link Binary w/ Lib (1)' [Cocoa]


To me it feels like there is something basic about the application  
package that is not right but then I can't seem to keep 'self'  
straight either...


MyService.m

-(id) init {
[super init];   
NSLog(@"*[%@ %...@]",[self class],NSStringFromSelector(_cmd));
[NSApp setDelegate:self];
return self;
}
- (void) applicationDidFinishLaunching:(NSNotification *)aNote {
[NSApp setServicesProvider:self];
void NSUpdateDynamicServices(void);
}

- (void) myServiceName:(NSPasteboard *)pboard userData:(NSString  
*)userData error:(NSString **)error {

.
}




On Feb 4, 2009, at 5:47 AM, Ron Fleckner wrote:



On 04/02/2009, at 7:44 PM, Steve Cronin wrote:


+(void)initialize { [NSApp setDelegate:self]; }


Hi Steve,

as Quincey has suggested, looks like the above is the problem.  I've  
done a stand-alone .service and [NSApp setDelegate:self] is in -  
(id)init, not + (void)initialize.


Ron


___

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

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

2009-02-04 Thread Ken Thomases

On Feb 4, 2009, at 8:02 AM, Yang Meyer wrote:

I want to open another application (say, Safari) in the "layer" just  
behind my application.


"Solution" 2:
[ws launchApplication:@"Safari"]; // opens Safari in front
	[NSApp activateIgnoringOtherApps:YES]; // pushes my app in front,  
effectively right above Safari


Problem with solution 2: I must be doing it wrong, because my own  
application's window doesn't ever get its focus back and the GUI  
seems to hang.


I think that -activateIgnoringOtherApps: is being done "too soon".   
The NSApplicationDeactivatedEventType event is pending and hasn't had  
a chance to be processed, yet.  So, you need to make arrangements to  
call -activateIgnoringOtherApps: after a short delay.  You can use - 
performSelector:withObject:afterDelay:, but you can't use - 
activateIgnoringOtherApps: directly, because it doesn't have the  
required signature.  So, you have to implement a simple trampoline  
method.


Cheers,
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: NSMatrix, scroll wheel and tool tips

2009-02-04 Thread David Blanton
I am at a loss as there appears to be nothing in NSMatrix or  
NSScroller that would deal with this behavior.

Thanks for you comments.


On Feb 3, 2009, at 4:28 PM, Graham Cox wrote:



On 4 Feb 2009, at 4:45 am, David Blanton wrote:

I have an NSMatrix (sub-classed) of NSImage cells.  I set the  
appropriate tool tip for each cell.
When scrolling the matrix using the knob or scroll buttons the  
tool tips are fine.
When scrolling the matrix using the wheel on the mouse the tool  
tips are incorrect.
Touching the knob after scrolling with the mouse wheel brings the  
tool tips back into sync.


Is there a method to call after the user scrolls the matrix with  
the mouse wheel to bring everything back into sync?



I don't know if there is - a quick scan of the docs for the class  
doesn't reveal anything, but I just tried this with an unsubclassed  
NSMatrix, and it works fine. That would suggest that something in  
your subclass is causing this.


Why are you subclassing? Typically I have found that custom  
appearance/behaviour of an NSMatrix is achievable using custom  
cells, rather than subclassing the matrix itself.


--Graham






David Blanton




___

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

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


NSBezierPath (Modifying Paths)

2009-02-04 Thread Joseph Crawford

Hello Everyone,

I am working on something small just to learn with and I have been  
trying to figure this out for a while.  The end result that I am  
looking for is this


Draw A straight line
click the line and drag to make that line curve

Now I have been able to get all of this to work aside from one thing.   
If you draw a curve then go to draw another the first one is not  
remembered.


Code: http://paste.lisp.org/display/74870

I know it is my call to removeAllPaths on line 59 of the code pasted  
at the URL above.


I know that i need to use the elementsAtIndex: and  
elementsAtIndex:index associatedPoints:points to modify the points  
rather than remove them all


However what I do not know is where I would get this Index to use.

Any assistance would be appreciated.

Thanks,
Joseph Crawford
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: AquaticPrime Config.php + PayPal Advanced Variables Not Working

2009-02-04 Thread Sherm Pendley

On Feb 4, 2009, at 9:28 AM, Chunk 1978 wrote:


$appLicense = $_REQUEST["appLicense"];

did not work either... :/


I wouldn't expect it to, since there is no "appLicense" item in the  
query string:



https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=1234567


You should take this to a PHP forum. The fact that you're making this  
request from a Cocoa program has no bearing whatsoever on how the PHP  
script will process its input.


sherm--

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: NSTask in separate thread is leaking memory

2009-02-04 Thread Adam R. Maxwell


On Feb 4, 2009, at 3:25 PM, Oleg Krupnov wrote:


So the problem is solved for now, but one question still left open for
the future is the following: would it be thread-safe to use NSTask in
the way I originally attempted? If yes, why did it leak? The leak was
reported somewhere inside NSTask internal initialization code. Funny
enough, the leak disappeared if I made one superfluous -release call
on NSTask.


No, the NSTask class itself (at least up to 10.4) should only be used  
from the main thread, particularly if you're spawning multiple tasks  
at the same time from different threads.  I suspect this is due to a  
race condition in how it's notified of child exit, and it appears to  
have changed in 10.5.


I wrote my own subclass to get around this, since a user finally had a  
reproducible bug report.  It's BSD licensed, if anyone's interested: http://bibdesk.svn.sourceforge.net/viewvc/bibdesk/trunk/bibdesk/BDSKTask.m?view=markup


--
Adam



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: Open OtherApp just behind MyApp

2009-02-04 Thread Sean McBride
On 2/4/09 3:02 PM, Yang Meyer said:

>I want to open another application (say, Safari) in the "layer" just
>behind my application.

Have you looked at using Launch Servires?  See LSLaunchURLSpec() and
LSLaunchFlags.

--

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


___

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

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

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

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


Re: NSTask in separate thread is leaking memory

2009-02-04 Thread Ken Thomases

On Feb 4, 2009, at 7:25 AM, Oleg Krupnov wrote:

Marvelous! Thank you very much, Ken. All of your advices worked like  
a charm.


You're welcome.  I'm glad I could help.



So the problem is solved for now, but one question still left open for
the future is the following: would it be thread-safe to use NSTask in
the way I originally attempted?


Yes.  It's safe to use an NSTask in a secondary thread, just so long  
as a given instance of NSTask isn't being accessed by two different  
threads.



If yes, why did it leak? The leak was
reported somewhere inside NSTask internal initialization code. Funny
enough, the leak disappeared if I made one superfluous -release call
on NSTask.


As I said, I believe (but don't know for sure) that the leak was due  
to the fact that you didn't run the run loop of the secondary thread.   
I think that NSTask installs a run loop source to monitor the other  
process.  There's probably some housekeeping that has to happen when  
the other process terminates, which will only be noticed if the run  
loop of the thread is running when that happens.


You can file a bug against either the behavior (if you think that  
NSTask should take care of its housekeeping in some other way) or  
against the documentation (if you think the requirement to run the run  
loop should be explicit).


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


Empty window appears when going fullscreen in awakeFromNib

2009-02-04 Thread Jonathan Selander

I have a program that goes into fullscreen like this:

- (IBAction) goFullScreen:(id)sender
{
	// bort med dock och menubar, motverka tvångsavluta, alt+tab och  
utloggning

SetSystemUIMode(kUIModeAllHidden, kUIOptionDisableAppleMenu |
kUIOptionDisableForceQuit |
kUIOptionDisableProcessSwitch |
kUIOptionDisableSessionTerminate);

NSScreen *screen = [[contentView window] screen];
NSWindow *window = [[NSWindow alloc] initWithContentRect:[screen

  frame]

   styleMask:NSBorderlessWindowMask

 backing:NSBackingStoreBuffered

   defer:NO

  screen:screen];
[contentView retain];
[contentView removeFromSuperview];
[window setContentView:contentView];
[contentView release];
[window makeKeyAndOrderFront:sender];
[NSCursor setHiddenUntilMouseMoves:YES];

[fullScreenButton removeFromSuperview];
[mainWindow close];

[self _reloadRenderers];
}

This works fine if I bind a button to call the function after the  
program has loaded, but I need it to enter fullscreen when the  
application is launched, and when i do that an empty window is put in  
front (I think it's mainWindow). How can I prevent this from happening  
when calling this function when the application launches?___


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

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

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

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


Re: how to get iPhone serial number using UIDevice

2009-02-04 Thread Clark Cox
On Wed, Feb 4, 2009 at 4:08 AM, Ankur Diyora  wrote:
>  Hello all,
> I want iPhone serial number programatically.For that i use NSString
> *deviceId = [UIDevice currentDevice]
> uniqueIdentifier
> ;
> I get deviceId but it is iPhone uniqueID(40 char). How i get correct serial
> number which is given behindiPhone?

I do not believe that there is a way to get the serial number through
the API. Why do you need the serial number, and why does the
uniqueIdentifier not suffice for your needs?

-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


[Q] detecting when a NSTextField begins editing

2009-02-04 Thread Eric Gorr
I am familiar with the NSControlTextDidBeginEditingNotification  
notification, but this notification is insufficient for my needs  
because it is only sent after the user actually changes the text and  
not when the user clicks in the field and it actually allowed to  
change the text.


The reason this is important is that I have a text field which is part  
of an item in a NSCollectionView. I need to allow the user to to click  
and edit the text, but I also need the NSCollectionView to be able to  
mark the item as selected if the user does so. At the moment, if the  
user clicks in the field to edit the text, the NSCollectionView's  
selected items are not changed.


One possible solution I am considering, is sending a notification that  
my collection view is observing when the user is actually allowed to  
change the text. When the NSCollectionView responds to the  
notification, it would mark the item as selected.


The question is:  Where should the code to send the notification be  
placed?


One possible implementation is to subclass the NSTextField and  
override the becomeFirstResponder method which I think is only called  
when the user is actually allowed to being editing the text. I am  
disturbed by the fact that immediately after becomeFirstResponder is  
called, resignFirstResponder is called. Although, the fact that  
resignFirstResponder is probably not of any concern since there would  
be no reason to change the selection.


Any thoughts or comments?

(I'm kinda hoping there is an easier or standard way to do this which  
I have missed in the documentation...)

___

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

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

2009-02-04 Thread Ross Carter


On Feb 4, 2009, at 7:27 AM, Nick Brandaleone wrote:

I am creating a simple search app, and I want to "highlight" the  
found word/phrase in a large body of text,
in a similar way that Safari does it (background goes dim, and word  
is highlighted).


Would NSTextView -showFindIndicatorForRange: be helpful to you?
___

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

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

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

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


Re: Open OtherApp just behind MyApp

2009-02-04 Thread Ken Thomases

On Feb 4, 2009, at 10:08 AM, Sean McBride wrote:


On 2/4/09 3:02 PM, Yang Meyer said:


I want to open another application (say, Safari) in the "layer" just
behind my application.


Have you looked at using Launch Servires?  See LSLaunchURLSpec() and
LSLaunchFlags.


I don't think that's going to do anything better than the NSWorkspace  
techniques he's already tried.


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


why popupbuttoncell always select second item in tableview ?

2009-02-04 Thread Yang Mu

popupbuttoncell can show in table view. 
but I don't know how to change default selection of popupbuttoncell. it always 
select second item
another problem is when changing  selection of popupbuttoncell, it always back 
to before
if I make any mistake ,please give me some help
following is all codes for this problem:
 
-(void)awakeFromNib

NSPopUpButtonCell* cell = [NSPopUpButtonCell new];  [cell 
addItemsWithTitles:[NSArray arrayWithObjects:@"One", @"Two", @"Three", @"Four", 
@"Five", nil]];dataArray = [[NSMutableArray alloc] init]; [dataArray 
addObject: cell];
 
-(int) numberOfRowsInTableView:

return [dataArray count];
 
- (id)tableView:objectValueForTableColumn:row:

NSPopUpButtonCell* cell = [muArray objectAtIndex:rowIndex]; [aTableColumn 
setDataCell:cell]; return popcell;
 
-(void)tableView:setObjectValue: forTableColumn: row:

NSPopUpButtonCell* cell = [muArray objectAtIndex:rowIndex];[cell 
setObjectValue:anObject];

_
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/windows/windowslive/___

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

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


Drag and drop images to other application using NSFilesPromisePboardType

2009-02-04 Thread Dikshith Rai

Hi All,

I am trying to drag files from my application to iPhoto,Mail,Preview  
etc (any application that accepts image files).


I am using NSFilesPromisePboadType.The reason for using  
NSFilesPromisePboadType is application data is stored as a package and  
I need to extract image from the package when I drag and drop. It  
works well when I drag images from my app to the Finder.


I get this call back when there is a mouseUp

- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL  
*)dropDestination



But Incase of applications like iPhoto,Mail,Preview etc, this method  
is not being called.
Does this mean that application like iPhoto does not support  
NSFilesPromisePboadType or  am I not doing it in the right way?


Can somebody please tell me how  can I drag images to applications  
like iPhoto?


Thanks in advance.
Dikshith
___

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

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

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 07:03, Steve Cronin wrote:


However, that doesn't change my end result!


I think you threw the baby out with the bath water. *Something* has to  
create your app delegate object, since it's not coming from a NIB file  
in this case. So...


+(void) initialize {[NSApp setDelegate: [[MyDelegate alloc] init]];}

would probably do it, although 'initialize' is really supposed to have  
a check to make sure it doesn't execute twice.

___

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

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

2009-02-04 Thread Ross Carter
I don't know know if there's a better way, but I call my selection- 
fixing code in -selectionRangeForProposedRange:granularity:, and also  
in the following NSTextView overrides if the selected range length is  
0 (if it's not zero, presumably it's already been fixed by - 
selectionRangeForProposedRange:granularity:):


textView:willChangeSelectionFromCharacterRanges:toCharacterRanges:  
(delegate method)

deleteForward:
deleteBackward:
deleteWordForward:
deleteWordBackward:
deleteBackwardByDecomposingPreviousCharacter:
deleteToEndOfParagraph:

I wouldn't mess with rangeForUserTextChange; I'm sure it knows more  
about unicode normalization forms, etc., than I do.


Ross


On Feb 4, 2009, at 8:09 AM, Chris Idou wrote:

That didn't seem to help. I tried overriding selectedRanges, and  
that makes you delete the whole range when you are clicked in it  
(good), but nothing seems to help the case of trying to simply  
backspace from the end of the range. In this case the selected range  
is not relevant because you are not inside the range yet as far as  
the existing range, and you can't predict in advance the user  
intends to backspace into it, and for the same reason, neither is  
the rangeForUserTextChange.


On Feb 3, 2009, at 5:24 PM, Chris Idou wrote:

So I want it that if you try and delete any character that is part  
of a token, it deletes the entire token.


So I'm overriding rangeForUserTextChange to return a different  
range if the current range includes any part of a token.


This seems to work if the user tries to type in any part. For  
example, clicking on the token and pressing space bar or a letter.


However, it doesn't work if you press backspace or delete, even  
though rangeForUserTextChange is still called.


I don't think you really want to override that method. Instead  
override -[NSTextView selectionRangeForProposedRange:granularity:]  
which should be called for every selection the user makes.


~Martin




___

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

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

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

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


Re: why popupbuttoncell always select second item in tableview ?

2009-02-04 Thread Corbin Dunn

Howdy,


On Feb 4, 2009, at 2:45 AM, Yang Mu wrote:



popupbuttoncell can show in table view.
but I don't know how to change default selection of popupbuttoncell.  
it always select second item
another problem is when changing  selection of popupbuttoncell, it  
always back to before

if I make any mistake ,please give me some help
following is all codes for this problem:

-(void)awakeFromNib

NSPopUpButtonCell* cell = [NSPopUpButtonCell new];  [cell  
addItemsWithTitles:[NSArray arrayWithObjects:@"One", @"Two",  
@"Three", @"Four", @"Five", nil]];dataArray = [[NSMutableArray  
alloc] init]; [dataArray addObject: cell];


-(int) numberOfRowsInTableView:

return [dataArray count];

- (id)tableView:objectValueForTableColumn:row:

NSPopUpButtonCell* cell = [muArray objectAtIndex:rowIndex];  
[aTableColumn setDataCell:cell]; return popcell;


Please read up on the table view documentation. You want to return the  
content for your cell, not the cell itself.


corbin





-(void)tableView:setObjectValue: forTableColumn: row:

NSPopUpButtonCell* cell = [muArray objectAtIndex:rowIndex];[cell  
setObjectValue:anObject];


___

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

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

2009-02-04 Thread Corbin Dunn


On Feb 4, 2009, at 5:24 AM, Dikshith Rai wrote:


Hi All,

I am trying to drag files from my application to iPhoto,Mail,Preview  
etc (any application that accepts image files).


I am using NSFilesPromisePboadType.The reason for using  
NSFilesPromisePboadType is application data is stored as a package  
and I need to extract image from the package when I drag and drop.  
It works well when I drag images from my app to the Finder.


I get this call back when there is a mouseUp

- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *) 
dropDestination



But Incase of applications like iPhoto,Mail,Preview etc, this method  
is not being called.
Does this mean that application like iPhoto does not support  
NSFilesPromisePboadType or  am I not doing it in the right way?


What else are you sticking (or declaring) on the pasteboard? They may  
be preferring another type. Please post your code that fills it up and  
declares it.


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: Stroking a CATextLayer

2009-02-04 Thread Benjamin Dobson

Thank you. I now have it working nicely.

On 3 Feb 2009, at 18:09:37, David Duncan wrote:


On Feb 3, 2009, at 7:43 AM, Benjamin Dobson wrote:


On 3 Feb 2009, at 15:05:51, glenn andreas wrote:


On Feb 3, 2009, at 8:50 AM, Benjamin Dobson wrote:

Has anyone managed this, short of creating a separate layer for  
the stroke? The Google machine doesn't seem to provide any answers.


Since CATextLayer uses an attributed string, why can't you just  
set the attributes to have the text stroked (set the  
NSStrokeColorAttributeName appropriately, and then use a negative  
value for the NSStrokeWidthAttributeName to indicate that the text  
should be both stroked and filled).


That is what I would expect; however, the layer does not stroke the  
text.


The CATextLayer uses Core Text to do its drawing, so it supports  
what Core Text supports (and I'm not familiar with what the  
limitations are here). It will likely be simpler to draw the text  
yourself into a plain CALayer rather than try to make the  
CATextLayer do what you want to do.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: CoreData migration and file change

2009-02-04 Thread Barry Wark
I recently asked a related question on StackOverflow:
http://stackoverflow.com/questions/380076/manual-core-data-schema-migration-without-document-changed-warning.
The answer should help you out.

On Tue, Feb 3, 2009 at 9:08 AM, Dan Grassi  wrote:
> I have a CoreData application and am migrating the data store.  When the
> user opens an old store the migration happens automatically creating a new
> file.  The problem is when the user saves the first time after the migration
> he gets the message: "This document's file has been changed by another
> application since you opened or saved it."
>
> What is the correct procedure for handling the file change or how can I
> avoid this message?
>
> 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/barrywark%40gmail.com
>
> This email sent to barryw...@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: Core animation - Safari Find effect

2009-02-04 Thread Matt Long
It's not really clear what you are asking. Your final question is  
"Does this sound correct?" to which I would respond, "yes". Though  
earlier in the message you ask for advice on the "remaining parts".


It would help if you were to clarify what you mean. When you say "...a  
miracle happens...(string within text is highlighted )" it makes it  
sound like you've already solved the problem.


So what exactly do you need help with?

-Matt

On Feb 4, 2009, at 5:27 AM, Nick Brandaleone wrote:


Hi all,

I am just getting into core animation, and it seems very promising.

I am creating a simple search app, and I want to "highlight" the  
found word/phrase in a large body of text,
in a similar way that Safari does it (background goes dim, and word  
is highlighted).


I have the first part done (ie. dimming text), but I am not sure how  
to proceed with the second (highlight found word).


Here are my steps.  Please advise on the remaining parts.  Thanks!

 - parent view is layer backed (setWantsLayer: YES)
 - create a layer whose content is my text
 - add the text layer as a sublayer to the view
 - fade to zero opacity.

 - ... a miracle happens ... (string within text is highlighted )  ;-)

I assume that I must create a new layer (CAtext), position it in the  
correct position over the "found word", and animate this new layer  
(fade in, etc..).


Does this sound correct?

Thanks!

Nick Brandaleone

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/matt.long%40matthew-long.com

This email sent to matt.l...@matthew-long.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: NSBezierPath (Modifying Paths)

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 07:35, Joseph Crawford wrote:


Draw A straight line
click the line and drag to make that line curve

Now I have been able to get all of this to work aside from one  
thing.  If you draw a curve then go to draw another the first one is  
not remembered.


Code: http://paste.lisp.org/display/74870

I know it is my call to removeAllPaths on line 59 of the code pasted  
at the URL above.


I know that i need to use the elementsAtIndex: and  
elementsAtIndex:index associatedPoints:points to modify the points  
rather than remove them all


However what I do not know is where I would get this Index to use.


Your general approach doesn't make a lot of sense to me. 'drawRect' is  
for drawing, and it's a really bad idea to be constructing parts of  
your data model in that method. (In particular, drawRect can get  
called multiple times without the mouse being dragged, and each time  
it's going to add more points to the existing path. Not to mention the  
fact that it'll add these points to *all* the paths, not just the  
latest one.)


I'd suggest:

-- Keep your path array just for paths that are fully created. That  
is, in mouseUp but not before, add the current path to the path array.


-- Don't bother trying to *change* the NSBezierPath object that's in  
the process of being created, just create a brand new one each time  
you go through mouseDragged. Performance would be the only reason not  
to do this, but you're not going to have a performance problem anytime  
soon. If you plan to be able to edit the paths later, then  
NSBezierPath isn't the best choice as a data structure.


-- Do nothing in drawRect except drawing. If you keep the "in  
progress" path out of the path array till it's done, you can also draw  
it in (say) a different color, which would be a nice visual cue.


-- Change 'numberOfClicks' to something like  
'numberOfControlPointsDrawn' (with values 0, 1 and 2) for clarity. The  
number of clicks isn't actually important, but the number of control  
points dragged out is.


While this approach to drawing paths isn't terrible, it *is* terribly  
modal. If I was to draw a straight line and then wanted to draw  
another path without making the first one a curve, how would do I do  
that? If I started dragging out a path and wanted to get rid of it and  
start a new one, how would I do that?


___

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

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

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

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


NSXML & Auto Release Pools

2009-02-04 Thread Alan Shouls
Hi

I am having some problems with NSXML and auto relese pools.

I am using NSXML in a C++ and am working through some test cases and have
come across something I can't quite figure out. Here is what I do:

1. Create an Auto Release Pool
2. Create an NSXML object using [NSXMLDocument alloc] initWithData:(NSData
*)data options:NSXMLNodeOptionsNone error:pError]
3. Release the Auto Release Pool
4. Release my NSXML object

I then get a warning NSCFString autoreleased with no pool in place - just
leaking

If, however I do things so that I release my NSXML object before releaseing
the Auto Release Pool - no message.

Does anyone have any insight into why this is happening and what might be
going on here?

Best regards

Alan 



___

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

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


[Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Eric Gorr
When launching an application which requires a newer version of the  
OS, the OS displays the string:


 "You cannot use the application "XXX" with this version of Mac  
OS X."


I was just wondering if there was any way to control what appeared  
here so it wasn't so curt - it would be nice to mention what the  
minimum version of the OS was, for example.


I'm guessing there isn'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: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Joar Wingfors


On Feb 4, 2009, at 10:12 AM, Eric Gorr wrote:

When launching an application which requires a newer version of the  
OS, the OS displays the string:


   "You cannot use the application "XXX" with this version of Mac OS  
X."


I was just wondering if there was any way to control what appeared  
here so it wasn't so curt - it would be nice to mention what the  
minimum version of the OS was, for example.


I'm guessing there isn't...



Please file bug reports if you're not happy with the current behavior!

j o a r


___

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

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

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

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


Re: NSXML & Auto Release Pools

2009-02-04 Thread Nick Zitzmann


On Feb 4, 2009, at 11:06 AM, Alan Shouls wrote:

I then get a warning NSCFString autoreleased with no pool in place -  
just

leaking

If, however I do things so that I release my NSXML object before  
releaseing

the Auto Release Pool - no message.

Does anyone have any insight into why this is happening and what  
might be

going on here?



You must be using the NSXML* class in its own thread. If you're using  
NSThread to detach a thread, and you are not using GC, then your  
threaded method is responsible for setting up its own autorelease  
pool, and keeping it active at all times. What's going on is releasing  
the object is apparently autoreleasing some other internal object, but  
since there's no pool in place, then the object gets leaked.


So you have to either wrap the entire method in its own pool, or use  
GC, or use the +[NSApplication  
detachDrawingThread:toTarget:withObject:] method, which is just like  
the similar NSThread method, but it makes the pool for you.


Nick Zitzmann


___

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

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

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

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


Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Eric Gorr


On Feb 4, 2009, at 1:24 PM, Joar Wingfors wrote:



On Feb 4, 2009, at 10:12 AM, Eric Gorr wrote:

When launching an application which requires a newer version of the  
OS, the OS displays the string:


  "You cannot use the application "XXX" with this version of Mac OS  
X."


I was just wondering if there was any way to control what appeared  
here so it wasn't so curt - it would be nice to mention what the  
minimum version of the OS was, for example.


I'm guessing there isn't...



Please file bug reports if you're not happy with the current behavior!


Before I file a bug report, I wanted to make sure that it was behavior  
I didn't have control over first.


I'm guessing that you are confirming that there is no control.


___

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

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

2009-02-04 Thread James Montgomerie

On 4 Feb 2009, at 18:06, Alan Shouls wrote:
I am using NSXML in a C++ and am working through some test cases and  
have

come across something I can't quite figure out. Here is what I do:

1. Create an Auto Release Pool
2. Create an NSXML object using [NSXMLDocument alloc] initWithData: 
(NSData

*)data options:NSXMLNodeOptionsNone error:pError]
3. Release the Auto Release Pool
4. Release my NSXML object

I then get a warning NSCFString autoreleased with no pool in place -  
just

leaking

If, however I do things so that I release my NSXML object before  
releaseing

the Auto Release Pool - no message.


The NSXML object is probably calling autorelease on something in its  
dealloc method (this is perfectly legal, and should generally be seen  
as implementation detail - you're just seeing a side effect of it here).


In general, you need to wrap your /entire/ Cocoa usage in an  
autorelease pool if you're using it in a non-Cocoa app (or a thread  
that doesn't otherwise have a pool pre-created for you), to account  
for just this sort of thing.


Jamie.
___

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

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

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

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


Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Eric Gorr


On Feb 4, 2009, at 1:24 PM, Joar Wingfors wrote:



On Feb 4, 2009, at 10:12 AM, Eric Gorr wrote:

When launching an application which requires a newer version of the  
OS, the OS displays the string:


  "You cannot use the application "XXX" with this version of Mac OS  
X."


I was just wondering if there was any way to control what appeared  
here so it wasn't so curt - it would be nice to mention what the  
minimum version of the OS was, for example.


I'm guessing there isn't...



Please file bug reports if you're not happy with the current behavior!


bug reported:  rdar://646

___

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

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

2009-02-04 Thread Jean-Nicolas Jolivet

Thanks guys, turns out it was a stupid mistake on my end!

I'll only say this: If you're trying to prevent your app from creating  
a new document when it launches, make sure your App delegate isn't  
getting instantiated in your Document's nib! :P


(Oh and Andy, you're absolutely right about the terminology;   
Implemented should've been used and not override!)




On 3-Feb-09, at 6:59 PM, Andy Lee wrote:


On Feb 3, 2009, at 3:06 PM, Jean-Nicolas Jolivet wrote:
I tried overriding the applicationShouldOpenUntitledFile in my App  
delegate


P.S.  This may sound nitpicky, but I suspect you weren't actually  
*overriding* the method but merely *implementing* it.  You're only  
overriding a method if it is implemented by an ancestor class, and  
for app delegates that's usually not the case. I only mention this  
because the term "override" was misused in another thread and I  
wonder if it's a common error I hadn't noticed before.


--Andy



Jean-Nicolas Jolivet
silver...@videotron.ca
http://www.silverscripting.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: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Sean McBride
On 2/4/09 10:24 AM, Joar Wingfors said:

>> When launching an application which requires a newer version of the
>> OS, the OS displays the string:
>>
>>"You cannot use the application "XXX" with this version of Mac OS
>> X."
>>
>> I was just wondering if there was any way to control what appeared
>> here so it wasn't so curt - it would be nice to mention what the
>> minimum version of the OS was, for example.
>>
>> I'm guessing there isn't...
>
>
>Please file bug reports if you're not happy with the current behavior!

Eric, please do file.  But be ready to wait years.  I filed this exact
request in 2004.  .

And yes, there is no control over the message.

--

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


___

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

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

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

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


How can I display a pop-up alert message to a user from a background launchd daemon?

2009-02-04 Thread Tom Fortmann
Can anyone offer some guidance on how to pop-up a dialog box from a
background process?  I have a system daemon started by launchd out of the
/Library/LaunchDaemons folder.  Among other things the daemon manages a
background software update process, and depending on the extent of the
change requires the user to restart the system.  It is currently written in
C++ and for the most part only uses POSIX API's with a very small number of
CoreServices and CoreFoundation functions.  Can anyone offer some advice on
the best way to approach this?  

 

Thanks in advance for any help you can provide,

Tom  

 

___



THOMAS FORTMANN
Director of Development


XCAPE SOLUTIONS, INC. 
207 Crystal Grove Blvd. 
Lutz, FL 33548

 
TEL 847 228 9831

  www.xcapesolutions.net
  tfortm...@xcapesolutions.net 



 

___

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

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

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

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


Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Eric Gorr


On Feb 4, 2009, at 1:44 PM, Sean McBride wrote:


On 2/4/09 10:24 AM, Joar Wingfors said:


When launching an application which requires a newer version of the
OS, the OS displays the string:

  "You cannot use the application "XXX" with this version of Mac OS
X."

I was just wondering if there was any way to control what appeared
here so it wasn't so curt - it would be nice to mention what the
minimum version of the OS was, for example.

I'm guessing there isn't...



Please file bug reports if you're not happy with the current  
behavior!


Eric, please do file.  But be ready to wait years.  I filed this exact
request in 2004.


Ya, my oldest bug report is from around that time as well - 21- 
Oct-2004 10:17 AM


A documentation bug that still hasn't been fixed - rdar://problem/ 
3848015



 .


Oh, is this the correct url for rdar? I think it used to be:

rdar://xxx

Thanks. I'll start using rdar://problem/xx  now.

> And yes, there is no control over the message.

Thanks.
___

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

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

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

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


Re: NSBezierPath (Modifying Paths)

2009-02-04 Thread Joseph Crawford

Quincey,

You make some very good points.  Let me first start out by saying I  
was doing ALL the path work in drawRect: based on someone telling me  
that was the best practice, I then had a few people including you tell  
me that is not the case.


I am not worried about performance right now that is true.  I am also  
not worried about you drawing a curve and then wanting to draw a  
straight line.


This is all just messing around trying to replicate the capabilities  
of the curve tool in many drawing applications, I already saw how to  
replicate the drawing of a line and that would be a different tool to  
choose from.


What would you suggest I look into for wanting to modify the points?

I had this working perfectly with a tempPath for the dragging and  
actually had it grey in color and when it was drawn it was done so in  
black (the visual queue) but was told that I could do it with only one  
path which is why I was looking into modifying the path elements.   
When I have one point the dragging operation always added more and  
more points which led to the line being drawn with every drag and that  
was not the wanted solution.


Thanks,
Joseph Crawford


On Feb 4, 2009, at 12:59 PM, Quincey Morris wrote:


On Feb 4, 2009, at 07:35, Joseph Crawford wrote:


Draw A straight line
click the line and drag to make that line curve

Now I have been able to get all of this to work aside from one  
thing.  If you draw a curve then go to draw another the first one  
is not remembered.


Code: http://paste.lisp.org/display/74870

I know it is my call to removeAllPaths on line 59 of the code  
pasted at the URL above.


I know that i need to use the elementsAtIndex: and  
elementsAtIndex:index associatedPoints:points to modify the points  
rather than remove them all


However what I do not know is where I would get this Index to use.


Your general approach doesn't make a lot of sense to me. 'drawRect'  
is for drawing, and it's a really bad idea to be constructing parts  
of your data model in that method. (In particular, drawRect can get  
called multiple times without the mouse being dragged, and each time  
it's going to add more points to the existing path. Not to mention  
the fact that it'll add these points to *all* the paths, not just  
the latest one.)


I'd suggest:

-- Keep your path array just for paths that are fully created. That  
is, in mouseUp but not before, add the current path to the path array.


-- Don't bother trying to *change* the NSBezierPath object that's in  
the process of being created, just create a brand new one each time  
you go through mouseDragged. Performance would be the only reason  
not to do this, but you're not going to have a performance problem  
anytime soon. If you plan to be able to edit the paths later, then  
NSBezierPath isn't the best choice as a data structure.


-- Do nothing in drawRect except drawing. If you keep the "in  
progress" path out of the path array till it's done, you can also  
draw it in (say) a different color, which would be a nice visual cue.


-- Change 'numberOfClicks' to something like  
'numberOfControlPointsDrawn' (with values 0, 1 and 2) for clarity.  
The number of clicks isn't actually important, but the number of  
control points dragged out is.


While this approach to drawing paths isn't terrible, it *is*  
terribly modal. If I was to draw a straight line and then wanted to  
draw another path without making the first one a curve, how would do  
I do that? If I started dragging out a path and wanted to get rid of  
it and start a new one, how would I do that?


___

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

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

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

This email sent to codeb...@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: How can I display a pop-up alert message to a user from a background launchd daemon?

2009-02-04 Thread Nick Zitzmann


On Feb 4, 2009, at 11:49 AM, Tom Fortmann wrote:


Can anyone offer some guidance on how to pop-up a dialog box from a
background process?  I have a system daemon started by launchd out  
of the
/Library/LaunchDaemons folder.  Among other things the daemon  
manages a

background software update process, and depending on the extent of the
change requires the user to restart the system.  It is currently  
written in
C++ and for the most part only uses POSIX API's with a very small  
number of
CoreServices and CoreFoundation functions.  Can anyone offer some  
advice on

the best way to approach this?



You're going to need to write a socket interface into your daemon. It  
can use either DO, or NSDistributedNotificationCenter, or Unix socket  
files, or something similar. Then you'll need to write an LSUIElement  
application that listens to that socket interface and does the actual  
GUI work based on messages received. I've done this before with a  
background daemon process, and although this sounds complicated, you  
pretty much have to do it this way, since background tasks not  
launched under your user's account generally can't make window server  
connections for security reasons.


Nick Zitzmann


___

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

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

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

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


Re: NSBezierPath (Modifying Paths)

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 10:54, Joseph Crawford wrote:

This is all just messing around trying to replicate the capabilities  
of the curve tool in many drawing applications, I already saw how to  
replicate the drawing of a line and that would be a different tool  
to choose from.


What would you suggest I look into for wanting to modify the points?

I had this working perfectly with a tempPath for the dragging and  
actually had it grey in color and when it was drawn it was done so  
in black (the visual queue) but was told that I could do it with  
only one path which is why I was looking into modifying the path  
elements.  When I have one point the dragging operation always added  
more and more points which led to the line being drawn with every  
drag and that was not the wanted solution.


You *could* take an approach where your underlying data model  
consisted of just NSBezierPath objects. Then, drawing in your user  
interface would be easy -- just stroke the underlying paths. However,  
the *usability* isn't great, and would likely get worse as you added  
more functionality. (For example, by following this approach, you  
already lost the ability to draw new stuff in gray.)


You'll find things easier, though, if you design your own objects for  
your underlying data model. How you would break it down depends on  
what you're trying to achieve. Perhaps each path/contour/outline is an  
object, which contains an array of segment objects, and each segment  
has 2 or 4 points. Maybe you have curved and straight line segment  
objects in a path object, or maybe you have only curved segments in a  
curved path and only straight line segments in a polyline path. Maybe  
you have to keep track of whether your paths are open or closed. At  
some point you'll need to work out where to keep track of the stroke  
width and color, probably. It all depends what you want.


Most likely you'd want to use NSBezierPaths for actual drawing. It  
wouldn't be wrong to create *those* on the fly in your drawRect, used  
for drawing and discarded, but if that was anything but trivial you  
might want to consider pre-creating these drawing paths and having  
them ready before you get to the actual drawing. Again, it depends.


The messing around part is fine, but I think you'll find that it very  
quickly becomes a data model design exercise PLUS a user interface  
design exercise, neither of them trivial. (Cue Graham Cox...)

___

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

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

2009-02-04 Thread Christian Graus
Thanks Rob.  Knowing what to type into google is usually the hardest part (
I had done some searching and had not seen this ).  I'm looking at the docs
now, this looks perfect for what I needed.
Thanks again

Christian
___

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

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

2009-02-04 Thread Alan Shouls

Hi James,

The NSXML object is probably calling autorelease on something in its  
dealloc method (this is perfectly legal, and should generally be  
seen as implementation detail - you're just seeing a side effect of  
it here).


Right - thanks for this. This explains what is happening.

Best regards

Alan
___

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

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

2009-02-04 Thread Dan Grassi

After having read everything I can google I have only progressed to:

"The document “project.xml” has been moved."

I am doing a manual migration so I do not call  
configurePersistentStore:... as Miguel suggests but have tried  
setFileModificationDate as suggested and I only get a slightly better  
but still confusing message as above.


I have tried FSExchangeObjects but that did not help.

I have not tried moving the migration code to a -writeToURL: or -  
saveToURL: method and calling that if I need to migrate, surely there  
is a less convoluted way.



Any help will be greatly appreciated.

Dan



On Feb 4, 2009, at 12:42 PM, Barry Wark wrote:


I recently asked a related question on StackOverflow:
http://stackoverflow.com/questions/380076/manual-core-data-schema-migration-without-document-changed-warning 
.

The answer should help you out.

On Tue, Feb 3, 2009 at 9:08 AM, Dan Grassi  wrote:
I have a CoreData application and am migrating the data store.   
When the
user opens an old store the migration happens automatically  
creating a new
file.  The problem is when the user saves the first time after the  
migration
he gets the message: "This document's file has been changed by  
another

application since you opened or saved it."

What is the correct procedure for handling the file change or how  
can I

avoid this message?

Thanks,

Dan


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: NSService - I need a headslap

2009-02-04 Thread Peter Ammon

Hi Steve,

What appears in the Services menu is entirely determined by the  
NSServices portion of your Info.plist.  If you post that to the list,  
we can look for any problems.


Your Service is launched on-demand when the user selects it from the  
menu.  Services may be background only, but do not have to be.


On Tiger and earlier, there is no way to avoid needing to log in and  
out.  On Leopard, you can use the function NSUpdateDynamicServices()  
to immediately scan for new Services.  If you're just testing, a quick  
way to scan for new Services is to run pbs directly:


/System/Library/CoreServices/pbs

However, pbs has no supported public interface and this will (has  
already) change, so don't include any reference to pbs in a script.   
NSUpdateDynamicServices() is the right way to programmatically refresh  
Services.


-Peter

On Feb 4, 2009, at 7:03 AM, Steve Cronin wrote:

Well, sheesh - that's embarrassing!   There is no 'self' until init  
- I know that!  Ugh.


However, that doesn't change my end result!

I never see anything on the Services menu nor anything from the  
NSLog statements shown below.
(Even when I double-click on the .service file;  after whcih I CAN  
see it in the process list in Activity monitor but still no log  
messages)
Logging out and back in doesn't make my service name appear on the  
Service menu...
This is on a 10.5.6 system using a Release build which has been  
placed in ~/Library/Services.


SO my basic questions still stand:
What event/conditions launches a .service which resides in ~/Library/ 
Services?

Should/must .service files be 'Background Only'?
Am I missing something basic in my setup here -
I have only a Info.plist and 1 .h (NSObject) and 2 . m files (main  
and MyService) and no .xib?
Other than the 'wrapper' settings are there other compiler settings  
required for this setup?
I have only 2 steps in my build process: 'Compile Source (2)' and  
'Link Binary w/ Lib (1)' [Cocoa]



___

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

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


Getting the value of GUI elements from non-main threads

2009-02-04 Thread Cem Karan
I know that we can only modify GUI elements from the main thread, but  
can we get the values for objects from other than the main thread?   
E.g., assume I have an editable NSTextField, and I have a worker  
thread.  The user edits the field, clicks a button, and the main  
thread hands off the analysis to a worker thread.  The worker thread  
then directly queries the NSTextField via its stringValue method.  Is  
this kosher?


Thanks,
Cem Karan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Getting the value of GUI elements from non-main threads

2009-02-04 Thread Ken Thomases

On Feb 4, 2009, at 2:47 PM, Cem Karan wrote:

I know that we can only modify GUI elements from the main thread,  
but can we get the values for objects from other than the main  
thread?  E.g., assume I have an editable NSTextField, and I have a  
worker thread.  The user edits the field, clicks a button, and the  
main thread hands off the analysis to a worker thread.  The worker  
thread then directly queries the NSTextField via its stringValue  
method.  Is this kosher?


No.  First, NSTextField isn't on the list of thread-safe classes.

But quite aside from that, even if it were safe, you could not be sure  
the value you would get is the value you should get.  It might have  
changed since the task was started.


In the scenario you describe, the button action method should marshal  
all of the inputs for the worker unit that's to be processed on the  
worker thread.  Those inputs should be passed as integral parts of the  
work unit to the worker thread.


Cheers,
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: how to get iPhone serial number using UIDevice

2009-02-04 Thread Robert Marini
There is no way to obtain the serial number of a device using the SDK.  
The unique identifier, as the name indicates, is a string guaranteed  
to be unique for each device. If you need access to the serial number  
for some other reason (i.e. tracking devices in an enterprise  
environment) I'd advise checking out the iPhone Configuration utility.


http://support.apple.com/downloads/iPhone_Configuration_Utility_1_1_for_Mac_OS_X

-rob.

On Feb 4, 2009, at 11:27 AM, Clark Cox wrote:

On Wed, Feb 4, 2009 at 4:08 AM, Ankur Diyora > wrote:

Hello all,
I want iPhone serial number programatically.For that i use NSString
*deviceId = [UIDevice currentDevice]
uniqueIdentifier
;
I get deviceId but it is iPhone uniqueID(40 char). How i get  
correct serial

number which is given behindiPhone?


I do not believe that there is a way to get the serial number through
the API. Why do you need the serial number, and why does the
uniqueIdentifier not suffice for your needs?

--
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

This email sent to wisequ...@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: CoreData migration and file change

2009-02-04 Thread sanchezm


On Feb 4, 2009, at 12:25 PM, Dan Grassi wrote:


After having read everything I can google I have only progressed to:

"The document “project.xml” has been moved."

I am doing a manual migration so I do not call  
configurePersistentStore:... as Miguel suggests but have tried  
setFileModificationDate as suggested and I only get a slightly  
better but still confusing message as above.




so where are you doing the migration?
If you're moving the document during your manual migration, I might  
suggest copying it and then migrating over the original copy.


- Miguel



I have tried FSExchangeObjects but that did not help.

I have not tried moving the migration code to a -writeToURL: or -  
saveToURL: method and calling that if I need to migrate, surely  
there is a less convoluted way.



Any help will be greatly appreciated.

Dan



On Feb 4, 2009, at 12:42 PM, Barry Wark wrote:


I recently asked a related question on StackOverflow:
http://stackoverflow.com/questions/380076/manual-core-data-schema-migration-without-document-changed-warning.
The answer should help you out.

On Tue, Feb 3, 2009 at 9:08 AM, Dan Grassi  wrote:
I have a CoreData application and am migrating the data store.   
When the
user opens an old store the migration happens automatically  
creating a new
file.  The problem is when the user saves the first time after the  
migration
he gets the message: "This document's file has been changed by  
another

application since you opened or saved it."

What is the correct procedure for handling the file change or how  
can I

avoid this message?

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/ 
sanchezm95%40gmail.com


This email sent to sanchez...@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: NSService - I need a headslap

2009-02-04 Thread Steve Cronin

Peter;

Thanks for the response!
Launched on demand based on the Service specifications in Info.plist  
-  there that's a big conceptual milestone!  Thank-you!!

(I wish that was written down somewhere I could find...)
So for a stand-alone service should we -terminate after each call?

Here's how I'm installing the .service:

	servicesFolderPath =  
[[NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,  
NSUserDomainMask, YES) objectAtIndex:0]  
stringByAppendingPathComponent:@"Services"];

if (![fileManager fileExistsAtPath:servicesFolderPath]) {
[fileManager createDirectoryAtPath:servicesFolderPath 
attributes:nil];
}
	srcPath = [[NSBundle  bundleForClass:[self class]]  
pathForResource:@"MyService" ofType:@"service"];
	destPath =  [servicesFolderPath  
stringByAppendingPathComponent:@"MyService.service"];
	if ( ([fileManager fileExistsAtPath:srcPath]) && (![fileManager  
fileExistsAtPath:destPath]) )  {

[fileManager copyPath:srcPath toPath:destPath handler:nil];
NSUpdateDynamicServices();
}  else {
if (![fileManager fileExistsAtPath:srcPath]) {
_WDIfV NSLog(@"MyService.service - Payload Not 
Located.");
} else {
_WDIfV NSLog(@"MyService.service was already 
installed.");
}
}   

Nothing appears in the Service menu on Leopard EVER, even after re- 
logging in.
What I observe is that on Tiger, after installing as above, the next  
time I launch any application its Service menu DOES include my item...


Here's the Info.plist:

http://www.apple.com/DTDs/PropertyList-1.0.dtd 
">



CFBundleInfoDictionaryVersion
6.0
NSPrincipalClass
NSApplication
CFBundleIdentifier
com.mycompany.myService
CFBundlePackageType
APPL
CFBundleVersion
1.0.0
LSBackgroundOnly

CFBundleIconFile
MyIcony
CFBundleGetInfoString
	Version 1.0, Copyright © 2009 My Company.  All rights  
reserved.

NSHumanReadableCopyright
Copyright © 2009, My Company.
All rights reserved.
LSMinimumSystemVersion
10.4
CFBundleExecutable
MyService
CFBundleName
MyService
NSServices


NSMessage
myServiceMethod
NSPortName
MyService
NSMenuItem

Menu item title
MyService

NSSendTypes

NSStringPboardType
NSRTFPboardType








On Feb 4, 2009, at 2:37 PM, Peter Ammon wrote:


Hi Steve,

What appears in the Services menu is entirely determined by the  
NSServices portion of your Info.plist.  If you post that to the  
list, we can look for any problems.


Your Service is launched on-demand when the user selects it from the  
menu.  Services may be background only, but do not have to be.


On Tiger and earlier, there is no way to avoid needing to log in and  
out.  On Leopard, you can use the function NSUpdateDynamicServices()  
to immediately scan for new Services.  If you're just testing, a  
quick way to scan for new Services is to run pbs directly:


   /System/Library/CoreServices/pbs

However, pbs has no supported public interface and this will (has  
already) change, so don't include any reference to pbs in a script.   
NSUpdateDynamicServices() is the right way to programmatically  
refresh Services.


-Peter

On Feb 4, 2009, at 7:03 AM, Steve Cronin wrote:

Well, sheesh - that's embarrassing!   There is no 'self' until init  
- I know that!  Ugh.


However, that doesn't change my end result!

I never see anything on the Services menu nor anything from the  
NSLog statements shown below.
(Even when I double-click on the .service file;  after whcih I CAN  
see it in the process list in Activity monitor but still no log  
messages)
Logging out and back in doesn't make my service name appear on the  
Service menu...
This is on a 10.5.6 system using a Release build which has been  
placed in ~/Library/Services.


SO my basic questions still stand:
What event/conditions launches a .service which resides in ~/ 
Library/Services?

Should/must .service files be 'Background Only'?
Am I missing something basic in my setup here -
I have only a Info.plist and 1 .h (NSObject) and 2 . m files (main  
and MyService) and no .xib?
Other than the 'wrapper' settings are there other compiler settings  
required for this setup?
I have only 2 steps in my build process: 'Compile Source (2)' and  
'Link Binary w/ Lib (1)' [Cocoa]





___

Cocoa-dev mailing list (C

Re: NSService - I need a headslap

2009-02-04 Thread Dave Dribin

On Feb 4, 2009, at 2:37 PM, Peter Ammon wrote:
On Tiger and earlier, there is no way to avoid needing to log in and  
out.  On Leopard, you can use the function NSUpdateDynamicServices()  
to immediately scan for new Services.  If you're just testing, a  
quick way to scan for new Services is to run pbs directly:


   /System/Library/CoreServices/pbs

However, pbs has no supported public interface and this will (has  
already) change, so don't include any reference to pbs in a script.   
NSUpdateDynamicServices() is the right way to programmatically  
refresh Services.


FYI, I've found that using RubyCocoa is a nice way to do this, for  
testing:


% ruby -rosx/cocoa -e 'OSX.NSUpdateDynamicServices()'

-Dave

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Getting the value of GUI elements from non-main threads

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 13:10, Ken Thomases wrote:


On Feb 4, 2009, at 2:47 PM, Cem Karan wrote:

I know that we can only modify GUI elements from the main thread,  
but can we get the values for objects from other than the main  
thread?  E.g., assume I have an editable NSTextField, and I have a  
worker thread.  The user edits the field, clicks a button, and the  
main thread hands off the analysis to a worker thread.  The worker  
thread then directly queries the NSTextField via its stringValue  
method.  Is this kosher?


No.  First, NSTextField isn't on the list of thread-safe classes.

But quite aside from that, even if it were safe, you could not be  
sure the value you would get is the value you should get.  It might  
have changed since the task was started.


And quite aside from *that*, in absence of mitigating evidence, it  
would be an abuse of the MVC design pattern for the analyzing code to  
ask the user interface for the data model's data.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Getting the value of GUI elements from non-main threads

2009-02-04 Thread Cem Karan

On Feb 4, 2009, at 4:10 PM, Ken Thomases wrote:


On Feb 4, 2009, at 2:47 PM, Cem Karan wrote:

I know that we can only modify GUI elements from the main thread,  
but can we get the values for objects from other than the main  
thread?  E.g., assume I have an editable NSTextField, and I have a  
worker thread.  The user edits the field, clicks a button, and the  
main thread hands off the analysis to a worker thread.  The worker  
thread then directly queries the NSTextField via its stringValue  
method.  Is this kosher?


No.  First, NSTextField isn't on the list of thread-safe classes.


OK, this is the part that I need to worry about, as I'm concerned  
about crashes.


But quite aside from that, even if it were safe, you could not be  
sure the value you would get is the value you should get.  It might  
have changed since the task was started.


In the scenario you describe, the button action method should  
marshal all of the inputs for the worker unit that's to be processed  
on the worker thread.  Those inputs should be passed as integral  
parts of the work unit to the worker thread.


Fully and wholeheartedly agreed; I should have spent more time  
explaining.  In my case, it doesn't even matter if the worker thread  
gets the correct value, or a value at all, as this is some fast and  
dirty test code that I'm going to use once and never look at again.   
However, you're right, even for something like that (maybe especially  
for something like that) its best to do it correctly.  It just means I  
need to rewrite my real code a little so that testing can go more  
smoothly, something I was hoping to avoid doing.


Thanks,
Cem Karan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Eric Gorr


On Feb 4, 2009, at 1:44 PM, Sean McBride wrote:


On 2/4/09 10:24 AM, Joar Wingfors said:


When launching an application which requires a newer version of the
OS, the OS displays the string:

  "You cannot use the application "XXX" with this version of Mac OS
X."

I was just wondering if there was any way to control what appeared
here so it wasn't so curt - it would be nice to mention what the
minimum version of the OS was, for example.

I'm guessing there isn't...



And yes, there is no control over the message.



I'm actually curious about something.

Do people just accept this behavior or does anyone bypass the check  
that Apple does and do their own checking, supplying their own message?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Benjamin Dobson


On 4 Feb 2009, at 22:01:06, Eric Gorr wrote:



On Feb 4, 2009, at 1:44 PM, Sean McBride wrote:


On 2/4/09 10:24 AM, Joar Wingfors said:


When launching an application which requires a newer version of the
OS, the OS displays the string:

 "You cannot use the application "XXX" with this version of Mac OS
X."

I was just wondering if there was any way to control what appeared
here so it wasn't so curt - it would be nice to mention what the
minimum version of the OS was, for example.

I'm guessing there isn't...



And yes, there is no control over the message.



I'm actually curious about something.

Do people just accept this behavior or does anyone bypass the check  
that Apple does and do their own checking, supplying their own  
message?


This seems popular, but I personally just accept the behaviour.

http://weblog.bignerdranch.com/?p=13

___

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

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


Update an existing Core Data store when the model changes?

2009-02-04 Thread Daniel Thorpe

Hello everyone.

I'm currently developing a Core Data based app, which stores the  
results of some (relatively) computational intensive calculations as  
object attributes.


While Core Data is great, it really annoys me that I have to trash my  
current persistent store whenever I make a change to the data model.  
So, I'm wondering how feasible it would be to write a script that  
could "update" a store when the model changes. Sort of like the http://rentzsch.com/code/mogenerator_v1.10 
 script for creating NSManagedObject subclasses?


Anyone got any thoughts on that?

Cheers
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: NSXML & Auto Release Pools

2009-02-04 Thread Michael Ash
On Wed, Feb 4, 2009 at 3:23 PM, Alan Shouls  wrote:
> Hi James,
>
>> The NSXML object is probably calling autorelease on something in its
>> dealloc method (this is perfectly legal, and should generally be seen as
>> implementation detail - you're just seeing a side effect of it here).
>
> Right - thanks for this. This explains what is happening.

And if you want to check it out further, the error message refers to
an _NSAutoreleaseNoPool function being called. Stick a breakpoint on
that function in the debugger and make the problem happen again, and
then you can see precisely where it's happening and, hopefully, get an
idea as to why.

Mike
___

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

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

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

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


Re: Confused about NSTrackingAreas with autoscroll

2009-02-04 Thread Luke Evans
Well, it's beyond any doubt in my mind now: my view's tracking areas  
are not adjusted when I'm performing a drag operation and during this  
operation an autoScroll is performed (in response to the user dragging  
outside the visible rect of the view/clipView within the local  
scrollView).


Calling my own -updateTrackingAreas when I know the autoscroll has  
occurred does not help at all - I can see the rectangles being  
constructed with the correct locations, but the view still sends  
events as if the scroll offsets within the clipView were the same as  
when the drag started.


Up until now I was relatively happy with my first real sojourn in the  
land of NSTrackingArea - with the possible exception of finding out  
that you don't get mouse entered/exited messages when the view scrolls  
_under_ the mouse (e.g. use of the scroll wheel on the mouse) - but in  
that case you _do_ get officially called to regenerate tracking areas,  
so I send my own synthesized events when I generate the new tracking  
area rectangles.


The situation when in a mouse dragging loop is much more serious  
though.  The eventing concerning tracking area boundaries is totally  
unreliable, seeing as the view seems to be stuck with the tracking  
states as they were when the drag started.  The mouse dragged messages  
arrive reliably, and one can perform _immediate_ hit testing on  
objects for which the tracking areas were intended, but now my view  
has to know to ignore the dodgy mouseEntered/Exited events which  
entails having some 'in drag' state distastefully pushed into the view  
object from the drag loop.  Oh well.


I knew I should have stuck with good old fashioned on-the-fly hit  
testing in the entire view, rather than using these new-fangled  
tracking area appliances ;-)








___

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

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

2009-02-04 Thread Michael Ash
On Wed, Feb 4, 2009 at 10:03 AM, Steve Cronin  wrote:
> Well, sheesh - that's embarrassing!   There is no 'self' until init - I know
> that!  Ugh.

Sure there is. There's a 'self' in every method. It refers to the
receiver of the message that was sent. In instance methods, 'self'
refers to the instance. In class methods, 'self' refers to the class.
Example:

@implementation Foo
+ foo {
   NSLog(@"self is %@ (%p) and Foo is %@ (%p)", self, self, [Foo
class], [Foo class]);
}
@end

You'll get the same values for both, since they give you the same thing.

Of course it's the class, not the instance, so the self you have isn't
the self you *wanted* here.

Mike
___

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

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

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

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


Re: [Q] Control over the "You cannot use the application ... with this version of Mac OS X" string

2009-02-04 Thread Michael Ash
On Wed, Feb 4, 2009 at 1:44 PM, Sean McBride  wrote:
> On 2/4/09 10:24 AM, Joar Wingfors said:
>
>>> When launching an application which requires a newer version of the
>>> OS, the OS displays the string:
>>>
>>>"You cannot use the application "XXX" with this version of Mac OS
>>> X."
>>>
>>> I was just wondering if there was any way to control what appeared
>>> here so it wasn't so curt - it would be nice to mention what the
>>> minimum version of the OS was, for example.
>>>
>>> I'm guessing there isn't...
>>
>>
>>Please file bug reports if you're not happy with the current behavior!
>
> Eric, please do file.  But be ready to wait years.  I filed this exact
> request in 2004.  .

And even if by some miracle they fixed it tomorrow, you'll *still*
have to wait years.

- 10.5: broken
- 10.6: fixed
- 10.7: first time you can ship software that activates the fixed
message on 10.6
- 10.8: first time you can activate the fixed message on 10.6 if you
follow the common "n-1" pattern of OS support

Mike
___

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

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

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

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


Re: NSService - I need a headslap

2009-02-04 Thread Steve Cronin

Peter;

I think I may have found into the core issue for me:

I don't have a xib file in this stand-alone app.
In main.m the invocation of NSApplicationMain() is equivalent to:
void NSApplicationMain(int argc, char *argv[]) {
[NSApplication sharedApplication];
[NSBundle loadNibNamed:@"myMain" owner:NSApp];
[NSApp run];
}

As you can see from my Info.plist sent earlier I don’t have ‘Main nib  
file base name’ set.

Could this cause the whole app to just go plunk?

Would I need to subclass NSApplication instead of NSObject here?
(Yikes that sound BIG?)  (I’d need to switch out Principal Class in  
Info.plist to be MyService, yes?)

What would main.m need to look like then?

int main(int argc, char *argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; 
	freopen([[NSHomeDirectory() stringByAppendingPathComponent:@"Library/ 
Logs/com.myCompany.MyService.log"] fileSystemRepresentation], "w",  
stderr);	

[pool release];
[MyService sharedApplication];
return [NSApp run];
}
I’m willing to bet that the above is NOT right!

On the whole would it just be easier to add a xib with nothing in it?  
Seems kinda wonky

My gut tells me that this is where I am going wroing!
Steve


On Feb 4, 2009, at 2:37 PM, Peter Ammon wrote:


Hi Steve,

What appears in the Services menu is entirely determined by the  
NSServices portion of your Info.plist.  If you post that to the  
list, we can look for any problems.


Your Service is launched on-demand when the user selects it from the  
menu.  Services may be background only, but do not have to be.


On Tiger and earlier, there is no way to avoid needing to log in and  
out.  On Leopard, you can use the function NSUpdateDynamicServices()  
to immediately scan for new Services.  If you're just testing, a  
quick way to scan for new Services is to run pbs directly:


   /System/Library/CoreServices/pbs

However, pbs has no supported public interface and this will (has  
already) change, so don't include any reference to pbs in a script.   
NSUpdateDynamicServices() is the right way to programmatically  
refresh Services.


-Peter

On Feb 4, 2009, at 7:03 AM, Steve Cronin wrote:

Well, sheesh - that's embarrassing!   There is no 'self' until init  
- I know that!  Ugh.


However, that doesn't change my end result!

I never see anything on the Services menu nor anything from the  
NSLog statements shown below.
(Even when I double-click on the .service file;  after whcih I CAN  
see it in the process list in Activity monitor but still no log  
messages)
Logging out and back in doesn't make my service name appear on the  
Service menu...
This is on a 10.5.6 system using a Release build which has been  
placed in ~/Library/Services.


SO my basic questions still stand:
What event/conditions launches a .service which resides in ~/ 
Library/Services?

Should/must .service files be 'Background Only'?
Am I missing something basic in my setup here -
I have only a Info.plist and 1 .h (NSObject) and 2 . m files (main  
and MyService) and no .xib?
Other than the 'wrapper' settings are there other compiler settings  
required for this setup?
I have only 2 steps in my build process: 'Compile Source (2)' and  
'Link Binary w/ Lib (1)' [Cocoa]





___

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

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

2009-02-04 Thread Peter Ammon


On Feb 4, 2009, at 1:23 PM, Steve Cronin wrote:


NSMenuItem

Menu item title
MyService



The key here needs to be "default" instead of "Menu item title".

This is a dictionary because it used to be keyed by localization, with  
"default" the value for an unknown loc.  Now we use the  
ServicesMenu.strings file for localization, but the dictionary remains.


-Peter

___

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

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

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

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


Re: NSBezierPath (Modifying Paths)

2009-02-04 Thread Graham Cox
I just thought I'd throw my 2¢ worth in here, since I've been down  
this very long road in great detail while building DrawKit, so I've  
learned a thing or two about this.


On 5 Feb 2009, at 5:54 am, Joseph Crawford wrote:

You make some very good points.  Let me first start out by saying I  
was doing ALL the path work in drawRect: based on someone telling me  
that was the best practice, I then had a few people including you  
tell me that is not the case.


Absolutely wrong. -drawRect: is solely and unequivocally for drawing  
*only*. If you find yourself adding or removing points to a path in  
there, you've made an error in design.


This is all just messing around trying to replicate the capabilities  
of the curve tool in many drawing applications, I already saw how to  
replicate the drawing of a line and that would be a different tool  
to choose from.


Some apps don't do this all that well actually. For my money, the  
approach that Inkscape (and DrawKit) takes is the one I've found the  
more intuitive. This uses a mouse down to set the on-path point, then  
the immediately following drag to set the off-path (control) point for  
the two control points that are either side of the just-placed on-path  
point. These two control points and the on-path point always form a  
straight line, thus the curve that passes through the on-path point is  
tangent to this line. This ensures that the join between elements of  
the curve is smooth. If you don't want that you can go back and change  
the points later, but for initially laying down a curve, this is rapid  
and graceful. The next on-path point along then requires a new mouse- 
down, which implies that during the intervening mouse-up period, you  
need to attach the current end-point of the curve to the mouse and use  
mouse-moved events. Because of that, using a view's mouseDown/ 
mouseDragged/mouseUp methods is terribly unwieldy, so I found that  
making your own tracking loop and entering it from the mouseDown only,  
and staying in it until you've finished the entire curve works much  
better. This forms a short-term temporary mode where you are  
constructing your curved path. The next problem is how do you get out  
of this mode? I do it in several ways. If you double-click at the end  
of the path it finishes, or if you click on the first point of the  
path, forming a closed path, it finishes, or if you hit Escape, it  
finishes. Having the modal loop here allows you to make use of four  
mouse gestures (down, drag, up, move) instead of the usual three. It  
also allows you to use a different modal loop for others kinds of  
drawing tool - lines and polygons require a different series of  
gestures to create them.


There are other niceties too, like allowing modifier keys to constrain  
drags in various ways, such as forcing the angles between a control  
point and the on-path point to be whole intervals, or temporarily  
toggling "snap to grid" plus a few others. Real drawing apps need  
these sorts of things, so while you will probably feel that's overkill  
at this stage, it may be worth thinking about how you'd incorporate  
those into your design.



What would you suggest I look into for wanting to modify the points?


Essentially all that Cocoa provides is the - 
elementAtIndex:associatedPoints: method and its inverse. That's about  
as minimalistic as it gets - all of the other interactive stuff needed  
you'll have to write. In DrawKit I tackle this in several stages.  
First, I have a category on NSBezierPath that extends the low-level  
tools available for basic path manipulation. This provides methods for  
identifying the different points on a path relative to one another  
(for example if dragging a curve element control point you need to  
also modify its mate, bearing in mind that if the next or previous  
element isn't a curve it doesn't exist, etc). The highest level method  
in this category is the method:


- (void) moveControlPointPartcode:(int) pc toPoint:(NSPoint) p  
colinear:(BOOL) colin coradial:(BOOL) corad constrainAngle:(BOOL) acon;


Which wraps up all the nasty tricky stuff into one method which  
basically implements moving of any point on any path, so you'd call  
this in a loop (or from mouseDragged:) when dragging.


I have other classes that call this when they are responding to user  
edits in their paths, but basically this one does the grunt work. By  
the way you could use this if you want, DrawKit is free under a BSD  
license.


I had this working perfectly with a tempPath for the dragging and  
actually had it grey in color and when it was drawn it was done so  
in black (the visual queue) but was told that I could do it with  
only one path which is why I was looking into modifying the path  
elements.  When I have one point the dragging operation always added  
more and more points which led to the line being drawn with every  
drag and that was not the wanted solution.


NSBezierPath is not 

Re: NSBezierPath (Modifying Paths)

2009-02-04 Thread Rob Keniger


On 05/02/2009, at 10:11 AM, Graham Cox wrote:

You can download a very bare-bones demo app that also shows how DK  
implements curve creation/editing among others here:http://apptree.net/code/dk/Binaries/DKMiniDemo_app_1.2.zip



...which, by the way, is one hell of an impressive "bare bones demo  
app". DrawKit is fantastic and the fact that it's open source is  
remarkable, thank you Graham.


--
Rob Keniger



___

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

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


Interface Builder Nested Object Selection

2009-02-04 Thread Richard Somers
In Interface Builder to select a nested object in a view hierarchy you  
drill down by using the click-wait-click approach. How do you back up  
the other direction without deselecting and starting the drill down  
all over again?


Richard

___

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

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

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

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


Re: Update an existing Core Data store when the model changes?

2009-02-04 Thread Hal Mueller

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreDataVersioning/Introduction/Introduction.html

Hal

___

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

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


Full Screen Mode With MenuBar

2009-02-04 Thread Adam Gerson
I am looking to implement a fullscreen window while showing the
menubar. The consensus is that NSView's enterFullScreenMode is buggy
and doesn't support showing the menu bar. What is the alternative? Are
there any good examples out there? I have done many google searches
and read through the archives. Looks like many have asked, but an
exact answer is hard to come by.

Thanks,
Adam
___

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

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

2009-02-04 Thread Joey Hagedorn

Richard,

On Feb 4, 2009, at 5:24 PM, Richard Somers wrote:
In Interface Builder to select a nested object in a view hierarchy  
you drill down by using the click-wait-click approach. How do you  
back up the other direction without deselecting and starting the  
drill down all over again?


One tip that you might find helpful to select nested items quickly in  
Interface Builder is to hold down Shift + Control when clicking. This  
brings up a menu of selectable items under the mouse. You can directly  
select the item you want on the first try with this method.


-Joey
___

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

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

2009-02-04 Thread Jonathan Hess

Hey Richard -

Try "shift-right-click" or "shift-control-left-click" to see a context  
menu of everything under the mouse.


Alternatively, see the "Tools->Select Parent" menu item with a key  
equivalent of command+control+Up Arrow.


Good Luck -
Jon Hess

On Feb 4, 2009, at 5:24 PM, Richard Somers wrote:

In Interface Builder to select a nested object in a view hierarchy  
you drill down by using the click-wait-click approach. How do you  
back up the other direction without deselecting and starting the  
drill down all over again?


Richard

___

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

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

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

This email sent to jh...@apple.com


___

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

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

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

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


Re: Full Screen Mode With MenuBar

2009-02-04 Thread Seth Willits

On Feb 4, 2009, at 5:26 PM, Adam Gerson wrote:


I am looking to implement a fullscreen window while showing the
menubar. The consensus is that NSView's enterFullScreenMode is buggy
and doesn't support showing the menu bar. What is the alternative? Are
there any good examples out there? I have done many google searches
and read through the archives. Looks like many have asked, but an
exact answer is hard to come by.



Just resize the window?

If you need to hide the dock you can use SetSystemUIMode


--
Seth Willits



___

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

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

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

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


Re: Confused about NSTrackingAreas with autoscroll

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 14:55, Luke Evans wrote:

Calling my own -updateTrackingAreas when I know the autoscroll has  
occurred does not help at all - I can see the rectangles being  
constructed with the correct locations, but the view still sends  
events as if the scroll offsets within the clipView were the same as  
when the drag started.


This really does sound like a coordinate system issue after all. It  
may be a bug, or it may be correct but surprising behavior, or it may  
be a gray area of expectation. It seems worth a bug report to try to  
find out.


Is it "when the drag started", or is it when autoscroll last scrolled  
the view?


The situation when in a mouse dragging loop is much more serious  
though.  The eventing concerning tracking area boundaries is totally  
unreliable, seeing as the view seems to be stuck with the tracking  
states as they were when the drag started.  The mouse dragged  
messages arrive reliably, and one can perform _immediate_ hit  
testing on objects for which the tracking areas were intended, but  
now my view has to know to ignore the dodgy mouseEntered/Exited  
events which entails having some 'in drag' state distastefully  
pushed into the view object from the drag loop.  Oh well.


Or perhaps there's a slightly cleaner workaround: regenerate your  
tracking areas at every autoscroll, using whatever offset you find to  
be necessary to get the tracking areas to behave as if they're in the  
right place. At mouseUp, regenerate the tracking areas one more time  
without the fudge factor, if you did the fudgy thing during scrolling.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Confused about NSTrackingAreas with autoscroll [WORKAROUND]

2009-02-04 Thread Luke Evans

OK, FWIW for the record here is the resolution I've arrived at:

mouseEntered and mouseExited events from tracking areas that are  
active when mouse dragging begins are dysfunctional in the drag,  
specifically when autoscrolling at the boundaries of the cliprect.  I  
have a drag event loop per one of the suggested methods of handing  
drag in the Cocoa Event-Handling Guide, and start/stop NSPeriodic  
events to perform autoscrolling.


By way of a work-around, my drag loop requests these events in  
nextEventMatchingMask, but does not dispatch them.  NSLeftMouseDragged  
is dispatched from the loop, and in the appropriate mouseDragged  
handler there's code to detect important boundary crossings  
(ordinarily handled by the tracking areas) that then sends synthetic  
mouseEntered and mouseExit events before handling the normal drag  
actions.  The mouseEntered and mouseExit methods handle all the  
tracking area boundary crossing in all cases (and were working without  
any special work in the case of non-dragging mouse moves and even  
dragging that didn't involve displacement of the view in scroll view).


So far, this approach seems to satisfactorily make up for the apparent  
'misplacement' of the tracking areas if the scroll viewport is moved  
over the view while in the drag operation (as happens with autoscroll).


I'm certainly not sure that there's no better fix for this situation  
(including the possibility that there might be a way to have the view  
hierarchy 'fix up' the tracking areas correctly after the autoscroll  
is performed), but so far nobody has suggested that I might be missing  
some piece of magic, so chances are that this problem is 'real' and  
requires some sort of work-around if you have a similar code  
configuration.




___

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

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


Saving application data in ~/Library/Application Support/

2009-02-04 Thread Josh de Lioncourt

Hi,

I have some products under development written in C++.  I am not using  
Cocoa for the most part, as these are cross-platform projects.


The apps themselves need to save, store, and access information, such  
as registration keys, user preferences, etc.  It seems to me that the  
logical place to do this is in the ~/Library/Application Support/  
directory.


Is it safe/recommended to access this directory using the above  
format, or is there a more accepted shortcut designation for that  
particular dir?


Josh de Lioncourt
Mac-cessibility: http://www.Lioncourt.com
Twitter: http://twitter.com/Lioncourt

"Beauty was a savage garden, so why should it wound him that the most  
despairing music is full of beauty?"

The Vampire Lestat--Anne Rice





Josh de Lioncourt
Mac-cessibility: http://www.Lioncourt.com
Twitter: http://twitter.com/Lioncourt

"Beauty was a savage garden, so why should it wound him that the most  
despairing music is full of beauty?"

The Vampire Lestat--Anne Rice



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Saving application data in ~/Library/Application Support/

2009-02-04 Thread Shawn Erickson
On Wed, Feb 4, 2009 at 6:05 PM, Josh de Lioncourt
 wrote:
> Hi,
>
> I have some products under development written in C++.  I am not using Cocoa
> for the most part, as these are cross-platform projects.

Review...

http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/LowLevelFileMgmt/Tasks/LocatingDirectories.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: Saving application data in ~/Library/Application Support/

2009-02-04 Thread Graham Cox


On 5 Feb 2009, at 1:05 pm, Josh de Lioncourt wrote:


Hi,

I have some products under development written in C++.  I am not  
using Cocoa for the most part, as these are cross-platform projects.


The apps themselves need to save, store, and access information,  
such as registration keys, user preferences, etc.  It seems to me  
that the logical place to do this is in the ~/Library/Application  
Support/ directory.


Is it safe/recommended to access this directory using the above  
format, or is there a more accepted shortcut designation for that  
particular dir?



Usually you'd create a folder in the support folder for your app,  
rather than place files directly at that level. It's also prudent to  
use the FindFolder method rather than hard-coding the path. Here are a  
couple of methods I use as part of a category extending  
NSFolderManager. The last one creates a subfolder using the bundle  
identifier - in fact most apps don't do that and advice I've received  
on this list suggests using the app's name is more usual.


hth,

-Graham


- (NSString*)	pathToFolderOfType:(const OSType) folderType  
shouldCreateFolder:(BOOL) create

{
OSErr   err;
FSRef   ref;
NSString*   path = nil;

err = FSFindFolder( kUserDomain, folderType, create, &ref);

if ( err == noErr )
{
// convert to CFURL and thence to path

		CFURLRef url = CFURLCreateFromFSRef( kCFAllocatorSystemDefault,  
&ref );
		path = (NSString*) CFURLCopyFileSystemPath( url,  
kCFURLPOSIXPathStyle );

CFRelease( url );
}

return [path autorelease];
}


- (NSString*)   applicationSupportFolder
{
	// returns the path to the general app support folder for the current  
user


	return [self pathToFolderOfType:kApplicationSupportFolderType  
shouldCreateFolder:YES];

}


- (NSString*)   thisApplicationsSupportFolder
{
	// returns a path to a folder within the applicaiton support folder  
having the same name as the app

// itself. This is a good place to place support files.

NSString* appname = [[NSBundle mainBundle] bundleIdentifier];
	NSString* path = [[self applicationSupportFolder]  
stringByAppendingPathComponent:appname];


// create this folder if it doesn't exist

BOOL result = NO;

if (![self fileExistsAtPath:path])
{
result = [self createDirectoryAtPath:path attributes:nil];

if( !result )
			[NSException raise:NSGenericException format:@"The folder '%@'  
could not be created", path ];

}

return path;
}

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Saving application data in ~/Library/Application Support/

2009-02-04 Thread Graham Cox


On 5 Feb 2009, at 1:26 pm, Graham Cox wrote:


a category extending NSFolderManager



I meant NSFileManager

--G
___

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

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

2009-02-04 Thread Luke Evans
This really does sound like a coordinate system issue after all. It  
may be a bug, or it may be correct but surprising behavior, or it  
may be a gray area of expectation. It seems worth a bug report to  
try to find out.


Indeed, I'll file one with as clear a description of the scenario as I  
can muster and someone at Apple can presumably choose between those  
possibilities :-)


Is it "when the drag started", or is it when autoscroll last  
scrolled the view?


It is when the autoscroll scrolls the view.  Dragging works fine so  
long as there's no change in the position of the underlying view (i.e.  
scrolling) during the drag operation.  Until the scroll offset is  
changed all the mouseEntered, mouseExited events arrive and they're  
clearly coming from the right areas w.r.t. the placement of the  
tracking areas in relation to the mouse movements.


Or perhaps there's a slightly cleaner workaround: regenerate your  
tracking areas at every autoscroll, using whatever offset you find  
to be necessary to get the tracking areas to behave as if they're in  
the right place. At mouseUp, regenerate the tracking areas one more  
time without the fudge factor, if you did the fudgy thing during  
scrolling.




This is one of the first things I tried.  From memory, the tracking  
areas were automatically requested when the mouse went up anyway, but  
in any case all the tracking returns to normal at this point (I have  
some mouse-over logic that suddenly starts working again at the right  
place as soon as the drag is complete).



...if you did the fudgy thing during scrolling



Mmm.  I'm going to have to check with you what this "fudgy thing"  
actually is, in case I'm not doing something that is required  
(officially or conventionally) to make things work.  Certainly, I was  
doing all my autoscroll during receipt of NSPeriodic events, at which  
point the view was requested to scroll and I attempted to refresh my  
tracking areas as mentioned - nothing more.  I was expecting  
subsequent events to arrive with correct mouse positions relative to  
the view when transformed per usual from window to view coords.  Is  
there some extra offset from the beginning of the drag, or some other  
'fudge' I'm supposed to be mixing in to mouse locations while a drag  
operation is underway?  My fix suggests otherwise, as I'm able to  
ascertain correct positions of items manually in mouseDragged with  
only the 'normal' transformation of window-to-view coords, but I'm  
curious as to what you mean about the fudge-factor.


Cheers

-- lwe



___

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

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

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

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


RE: why popupbuttoncell always select second item in tableview ?

2009-02-04 Thread Yang Mu

thanks Corbin,  greate help !!
I return [cell objectValue] now . it works fine> Subject: Re: why 
popupbuttoncell always select second item in tableview ?> From: 
corb...@apple.com> CC: cocoa-dev@lists.apple.com> Date: Wed, 4 Feb 2009 
09:30:26 -0800> To: david0...@msn.com> > Howdy,> > > On Feb 4, 2009, at 2:45 
AM, Yang Mu wrote:> > >> > popupbuttoncell can show in table view.> > but I 
don't know how to change default selection of popupbuttoncell. > > it always 
select second item> > another problem is when changing selection of 
popupbuttoncell, it > > always back to before> > if I make any mistake ,please 
give me some help> > following is all codes for this problem:> >> > 
-(void)awakeFromNib> >> > NSPopUpButtonCell* cell = [NSPopUpButtonCell new]; 
[cell > > addItemsWithTitles:[NSArray arrayWithObjects:@"One", @"Two", > > 
@"Three", @"Four", @"Five", nil]];dataArray = [[NSMutableArray > > alloc] 
init]; [dataArray addObject: cell];> >> > -(int) numberOfRowsInTableView:> >> > 
return [dataArray count];> >> > - (id
 )tableView:objectValueForTableColumn:row:> >> > NSPopUpButtonCell* cell = 
[muArray objectAtIndex:rowIndex]; > > [aTableColumn setDataCell:cell]; return 
popcell;> > Please read up on the table view documentation. You want to return 
the > content for your cell, not the cell itself.> > corbin> > > > >> > 
-(void)tableView:setObjectValue: forTableColumn: row:> >> > NSPopUpButtonCell* 
cell = [muArray objectAtIndex:rowIndex];[cell > > setObjectValue:anObject];> 
_
News, entertainment and everything you care about at Live.com. Get it now!
http://www.live.com/getstarted.aspx
___

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

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

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

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


RE: why popupbuttoncell always select second item in tableview ?

2009-02-04 Thread Yang Mu

 
How to implement difference popup items in each row in table view?
 
I want to make popup cell related to others. so different row show different 
pop cell.
 
but table view only can set datacell to column, how to set datacell to row? 



From: david0...@msn.comto: corb...@apple.comcc: 
cocoa-...@lists.apple.comsubject: RE: why popupbuttoncell always select second 
item in tableview ?Date: Thu, 5 Feb 2009 02:34:31 +

thanks Corbin,  greate help !!I return [cell objectValue] now . it works fine> 
Subject: Re: why popupbuttoncell always select second item in tableview ?> 
From: corb...@apple.com> CC: cocoa-dev@lists.apple.com> Date: Wed, 4 Feb 2009 
09:30:26 -0800> To: david0...@msn.com> > Howdy,> > > On Feb 4, 2009, at 2:45 
AM, Yang Mu wrote:> > >> > popupbuttoncell can show in table view.> > but I 
don't know how to change default selection of popupbuttoncell. > > it always 
select second item> > another problem is when changing selection of 
popupbuttoncell, it > > always back to before> > if I make any mistake ,please 
give me some help> > following is all codes for this problem:> >> > 
-(void)awakeFromNib> >> > NSPopUpButtonCell* cell = [NSPopUpButtonCell new]; 
[cell > > addItemsWithTitles:[NSArray arrayWithObjects:@"One", @"Two", > > 
@"Three", @"Four", @"Five", nil]];dataArray = [[NSMutableArray > > alloc] 
init]; [dataArray addObject: cell];> >> > -(int) numberOfRowsInTableView:> >> > 
return [dataArray count];> >> > - (id)tableView:objectValueForTableColumn:row:> 
>> > NSPopUpButtonCell* cell = [muArray objectAtIndex:rowIndex]; > > 
[aTableColumn setDataCell:cell]; return popcell;> > Please read up on the table 
view documentation. You want to return the > content for your cell, not the 
cell itself.> > corbin> > > > >> > -(void)tableView:setObjectValue: 
forTableColumn: row:> >> > NSPopUpButtonCell* cell = [muArray 
objectAtIndex:rowIndex];[cell > > setObjectValue:anObject];> 



Get news, entertainment and everything you care about at Live.com. Check it out!
_
Drag n’ drop—Get easy photo sharing with Windows Live™ Photos.

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

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

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

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

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


Re: nsarraycontroller "auto rearrange content"

2009-02-04 Thread Chris Anderson
I was able to work around it by unchecking "auto rearrange content"  
and calling rearrageObjects directly.  But I'd still like to know if  
anyone knows why this happens or if it's a bug.


C.

On 3-Feb-09, at 1:40 PM, Chris Anderson wrote:


Hello,

Been bashing my head on this one.  Did lots of googling and apple  
docs reading but haven't found an answer so any help would be  
appreciated.


As an example I have 2 entities in a Core Data app...

Project
Project.name
Project.startDate

Type
Type.name

...add a one-to-one relationship...

Project.type --> Type

When the application starts I auto populate Type with a bunch of  
entries from info.plist in App Delegate and set a sort descriptor on  
the Projects array controller based on "startDate".


I set up a table with the following columns...

Name --> value --> Project.arrangedObjects.name

Date --> value --> Project.arrangedObjects.startDate

Type --> value --> Project.arrangedObjects.type.name

Everything works great so faradd/edit/remove/sort...great.

I want to now be able to have the table re-sorted on-the-fly after  
the startDate has been changed on any of the objects in the table.   
I turn on  "Auto Rearrange Content" on the Projects array controller  
in IB and that seems to work in the app.  If I restart the app I get  
this in the log...


"Cannot remove an observer  for the key path  
"type.name" from  because it is not  
registered as an observer"


...and trying to add/remove any objects results in more errors like  
above.  I played around with this and it only seems to happen when  
there's a column bound through a relationship.  If I remove this  
binding, essentially removing the "type" column on the example table  
above, it works fine.


Has anyone run into this and how does one deal with it?

Thanks!

Chris
___

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

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

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

This email sent to cpander...@mac.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


Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Devraj Mukherjee
Hi all,

I have a few classes that form the domain logic of my application and
comprise of objects of NSNumber, NSDate, NSString. I initialize these
with new objects in the init message of each of these classes.

These properties are defined using the @property (nonatomic, retain)
and @synthesize directives.

When I create objects of these Classes and replace these other values
(objects), my app seems to leak memory (according to Instruments)
specially when working with NSDates. Is there a trick that I should be
looking for when using @property and @synthesize or should I actually
be writing my own setters and getters to handle these properly.

Thanks.

-- 
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

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

2009-02-04 Thread Quincey Morris

On Feb 4, 2009, at 19:28, Luke Evans wrote:

Mmm.  I'm going to have to check with you what this "fudgy thing"  
actually is, in case I'm not doing something that is required  
(officially or conventionally) to make things work.  Certainly, I  
was doing all my autoscroll during receipt of NSPeriodic events, at  
which point the view was requested to scroll and I attempted to  
refresh my tracking areas as mentioned - nothing more.  I was  
expecting subsequent events to arrive with correct mouse positions  
relative to the view when transformed per usual from window to view  
coords.  Is there some extra offset from the beginning of the drag,  
or some other 'fudge' I'm supposed to be mixing in to mouse  
locations while a drag operation is underway?  My fix suggests  
otherwise, as I'm able to ascertain correct positions of items  
manually in mouseDragged with only the 'normal' transformation of  
window-to-view coords, but I'm curious as to what you mean about the  
fudge-factor.


I just meant, if you recreate the tracking areas at some point(s)  
during the autoscroll and they behave *as if* they're in the  
unscrolled position, then you could try offsetting their bounds by the  
distance between the right and wrong positions, so that they behave  
*as if* they were where you wanted them to be. (And then fix them  
later.)


But maybe it's a lame idea.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Kiel Gillard

Hi Devraj,

If you have declared and synthesized a property:
@property (retain, nonatomic) NSString *name;

...then any value assigned to name will retain it. Therefore, to  
initialise it, you could do something like:

self.name = [NSString string];

However, doing this will yield a memory leak:
self.name = [[NSString alloc] init];

...because the property definition tells the compiler the methods it  
synthesizes should retain the value.


Hope this helps,

Kiel

On 05/02/2009, at 3:54 PM, Devraj Mukherjee wrote:


Hi all,

I have a few classes that form the domain logic of my application and
comprise of objects of NSNumber, NSDate, NSString. I initialize these
with new objects in the init message of each of these classes.

These properties are defined using the @property (nonatomic, retain)
and @synthesize directives.

When I create objects of these Classes and replace these other values
(objects), my app seems to leak memory (according to Instruments)
specially when working with NSDates. Is there a trick that I should be
looking for when using @property and @synthesize or should I actually
be writing my own setters and getters to handle these properly.

Thanks.

--
"The secret impresses no-one, the trick you use it for is everything"
- Alfred Borden (The Prestiege)
___

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

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

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

This email sent to kiel.gill...@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: Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Chris Suter
Hi Kiel,

On Thu, Feb 5, 2009 at 4:10 PM, Kiel Gillard  wrote:

> However, doing this will yield a memory leak:
> self.name = [[NSString alloc] init];
>
> ...because the property definition tells the compiler the methods it
> synthesizes should retain the value.

You're right that it will leak in that case but you've given the wrong
reason as to why. Memory management rules are covered by Apple's
documentation.

Regards,

Chris
___

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

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

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

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


Re: Memory management question in Objective-C 2.0 @property notation

2009-02-04 Thread Kiel Gillard

On 05/02/2009, at 4:20 PM, Chris Suter wrote:

On Thu, Feb 5, 2009 at 4:10 PM, Kiel Gillard  
 wrote:



However, doing this will yield a memory leak:
self.name = [[NSString alloc] init];

...because the property definition tells the compiler the methods it
synthesizes should retain the value.


You're right that it will leak in that case but you've given the wrong
reason as to why. Memory management rules are covered by Apple's
documentation.

Regards,

Chris


Thanks for your reply, Chris.

I suggest that the code quoted above will yield a memory leak because  
the NSString instance allocated will have a retain count of two after  
the setName: message has be sent to self. To correct this error, I  
suggest that the code should read:

self.name = [[[NSString alloc] init] autorelease];

Under the heading of "Setter Semantics" of , I can see that Apple's documentation clearly states that the  
implementation of a property declared with a retain attribute will  
send a retain message to the value given in the right hand side of the  
assignment.


I'm confused as to why else the memory would be leaking? Can you  
please identify my error?


Thanks,

Kiel

___

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

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