Re: CrashReporter alternatives for third-party apps?

2009-03-05 Thread Torsten Curdt
Maybe you are looking for something like this?

 http://vafer.org/projects/feedbackreporter/

The screencast is a little outdated. But I hope to fix that up soon.

Also have a look here:

 http://developer.apple.com/qa/qa2001/qa1288.html

cheers
--
Torsten

On Thu, Mar 5, 2009 at 03:26, Rick Mann  wrote:
> Can you guys suggest something I can use to submit crash reports to my own
> servers (and perhaps to suppress Apple's CrashReporter)?
>
> TIA,
> --
> Rick
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tcurdt%40vafer.org
>
> This email sent to tcu...@vafer.org
>
___

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

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

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

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


How to search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread haresh vavdiya
Hello,

Hope that everyone is fine.

I  am developing one application in which user can retrieve
music file from machine and use can play this music file also.

So i have to search for ".mp3" files in all folders and then
display into table. Can anyone tell me that how can i search, retrieve .mp3
file and play this particular file into my apps.

   Please anyone help me on this topic.

Thanks,
Haresh.
___

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

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

Help/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 search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread Graham Cox


On 05/03/2009, at 8:41 PM, haresh vavdiya wrote:


   I  am developing one application in which user can retrieve
music file from machine and use can play this music file also.

   So i have to search for ".mp3" files in all folders and  
then
display into table. Can anyone tell me that how can i search,  
retrieve .mp3

file and play this particular file into my apps.



Briefly, scan the disk using NSFileManager. You can use - 
enumeratorAtPath: to get an NSDirectoryEnumerator that will perform  
the scan. Gather the results into some sort of data storage that suits  
the purpose - a simple array would probably do, such as NSMutableArray.


To display the results in a table, NSTableView hooked to a controller  
e.g. NSArrayController that uses the above array as its data model.


To play an mp3 file, the simplest way is to use Quicktime via QTKit.  
e.g. [QTMovie movieWithURL:error:] followed by [myMovie play];


--Graham






___

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

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

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

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


Re: How to search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread rajesh
Scanning system directory for files with NSFileManager traversing each  
node ? I think it is not an efficient ... not to mention so many nodes  
in an hierarchy you need to scan


A simple google search will help you in this regard, for starters  
there are file handlers and spotlight guides could be your friends


Good luck

Rajesh

On Mar 5, 2009, at 10:49 AM, Graham Cox wrote:



On 05/03/2009, at 8:41 PM, haresh vavdiya wrote:


  I  am developing one application in which user can retrieve
music file from machine and use can play this music file also.

  So i have to search for ".mp3" files in all folders and  
then
display into table. Can anyone tell me that how can i search,  
retrieve .mp3

file and play this particular file into my apps.



Briefly, scan the disk using NSFileManager. You can use - 
enumeratorAtPath: to get an NSDirectoryEnumerator that will perform  
the scan. Gather the results into some sort of data storage that  
suits the purpose - a simple array would probably do, such as  
NSMutableArray.


To display the results in a table, NSTableView hooked to a  
controller e.g. NSArrayController that uses the above array as its  
data model.


To play an mp3 file, the simplest way is to use Quicktime via QTKit.  
e.g. [QTMovie movieWithURL:error:] followed by [myMovie play];


--Graham






___

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

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

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

This email sent to raj...@vangennep.nl


___

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

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

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

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


Odd crash-loading AppleScripts

2009-03-05 Thread Reza Farhad

Has

Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was creating  
the issue I made a little app to reproduce the problem. This app Loads  
a simple "Hello World" script and displays it in a window. Again if I  
have Guard Malloc on, it would crash the app, but otherwise it seems  
to work. Here is a link to the test project app, so others can have a  
look and see if they can get to the bottom of this.


http://www.Qu-s.eu/Dev/AppleScriptLoader.zip

Thanks
Reza

On 4 Mar 2009, at 19:27, has wrote:


Reza Farhad wrote:


Paul

I switched on Guard Malloc from the Run Menu in Xcode

It appears that I am getting the crash for a call that is trying to
load an AppleScript.

NSDictionary*errors = [ NSDictionary dictionary ];
NSAppleScript   *script = [[ NSAppleScript alloc ]
initWithContentsOfURL:url error:&errors ];



One point, which may or may not be related: as with **NSError  
arguments, you do not need to allocate an NSDictionary instance  
yourself. If there is an error to report,  
initWithContentsOfURL:error: will create it for you.


HTH

has
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net



___

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

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

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

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


Re: How to search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread Luca Pazzerello
  I would suggest you to use the unix command line tool `find`.  Perform a
command like thisfind . -name "*.mp3" -print
in an NSTask context. Every line of the output will be a file path.
  I suggest to authenticate the user - running as root will avoid permission
troubles finding the files.
  Note that this tool will take some time to browse ALL your files, so it'd
be better to specify a path in wich search files.

--Luca C.

2009/3/5 haresh vavdiya 

> Hello,
>
>Hope that everyone is fine.
>
>I  am developing one application in which user can retrieve
> music file from machine and use can play this music file also.
>
>So i have to search for ".mp3" files in all folders and then
> display into table. Can anyone tell me that how can i search, retrieve .mp3
> file and play this particular file into my apps.
>
>   Please anyone help me on this topic.
>
> Thanks,
> Haresh.
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/cocoa-dev/luca.pazzerello%40gmail.com
>
> This email sent to luca.pazzere...@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: Odd crash-loading AppleScripts

2009-03-05 Thread Matt Gough

Reza,

I suspect this is not your fault. I suggest you file a radar bug.

BTW - You never release NSAppleScript *script, so this code would leak.

and your spelling is as bad as ever  :) 'laodRunScript'

Matt


On 5 Mar 2009, at 11:25, Reza Farhad wrote:


Has

Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was  
creating the issue I made a little app to reproduce the problem.  
This app Loads a simple "Hello World" script and displays it in a  
window. Again if I have Guard Malloc on, it would crash the app, but  
otherwise it seems to work. Here is a link to the test project app,  
so others can have a look and see if they can get to the bottom of  
this.


http://www.Qu-s.eu/Dev/AppleScriptLoader.zip

Thanks
Reza

On 4 Mar 2009, at 19:27, has wrote:


___

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

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

Help/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: Can't get setDelegate to work on NSMenu attached toNSStatusItem (SOLVED)

2009-03-05 Thread Paul Sanders
> I never noticed the wee warning triangle next to the call.  I do miss C++ 
> compiler
> errors!

I personalyy have a zero-tolerance policy on warnings in my code.  Then, 
when I do get one, I pay attention to it.  Warnings in Objective-C would 
often be errors in a more strongly typed language. 

___

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

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

Help/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: Odd crash-loading AppleScripts

2009-03-05 Thread matt . gough

In fact, even this simpler version will trip up GuardMalloc


-( void ) laodRunScript
{
NSDictionary*errors = nil;
NSString*fieldContent = @"Could not Load Script, See 
Logs";
	NSAppleScript   *script = [[ NSAppleScript alloc ]  
initWithSource:@"return \"Hello World\""];

if ( script ){
NSAppleEventDescriptor* returnDescriptor = nil;
returnDescriptor = [ script executeAndReturnError: &errors ];
if ( !errors ){
			fieldContent = [ NSString stringWithFormat:@"Message from script:  
%@", [ returnDescriptor stringValue ]];

}
else{
NSLog( @"there was an error loading the script:%@", 
errors );
}
[script release];
}
else{
NSLog( @"there was an error loading the script:%@", errors );
}

[ textField_m setStringValue:fieldContent ];
}   

On 5 Mar 2009, at 13:00, matt.go...@agfa.com wrote:


Reza,

I suspect this is not your fault. I suggest you file a radar bug.

BTW - You never release NSAppleScript *script, so this code would  
leak.


and your spelling is as bad as ever  :) 'laodRunScript'

Matt


On 5 Mar 2009, at 11:25, Reza Farhad wrote:


Has

Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was  
creating the issue I made a little app to reproduce the problem.  
This app Loads a simple "Hello World" script and displays it in a  
window. Again if I have Guard Malloc on, it would crash the app,  
but otherwise it seems to work. Here is a link to the test project  
app, so others can have a look and see if they can get to the  
bottom of this.


http://www.Qu-s.eu/Dev/AppleScriptLoader.zip

Thanks
Reza

On 4 Mar 2009, at 19:27, has wrote:


___

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

Please do not post admin requests or moderator comments to the list.
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.gough%40agfa.com

This email sent to matt.go...@agfa.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: Odd crash-loading AppleScripts

2009-03-05 Thread Reza Farhad

Matt

I thought this could be some issue beyond my control.
I agree with the leak, which in the real project  would be handled.
About the spelling no comment

Reza

On 5 Mar 2009, at 12:00, Matt Gough wrote:


Reza,

I suspect this is not your fault. I suggest you file a radar bug.

BTW - You never release NSAppleScript *script, so this code would  
leak.


and your spelling is as bad as ever  :) 'laodRunScript'

Matt


On 5 Mar 2009, at 11:25, Reza Farhad wrote:


Has

Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was  
creating the issue I made a little app to reproduce the problem.  
This app Loads a simple "Hello World" script and displays it in a  
window. Again if I have Guard Malloc on, it would crash the app,  
but otherwise it seems to work. Here is a link to the test project  
app, so others can have a look and see if they can get to the  
bottom of this.


http://www.Qu-s.eu/Dev/AppleScriptLoader.zip

Thanks
Reza

On 4 Mar 2009, at 19:27, has wrote:




___

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

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

Help/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 search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread Graham Cox


On 05/03/2009, at 11:13 PM, haresh vavdiya wrote:

enumeratorAtPath is not helpful because we don't know exact path...  
we have to search in whole directoriesis there any another way  
to do that.



Umm... well a path of "/" represents the entire volume...

To be honest scanning the whole disk is a poor strategy. Music files  
are usually found in a few expected places, try looking there (like "~/ 
Music") or by querying the location of the iTunes music folder from  
its plist. If you do scan the whole disk, expect it to take many, many  
minutes. As another poster suggested, the Spotlight APIs might help  
you because they've already indexed the disk and know where files of a  
given type are.


--Graham


___

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

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

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

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


Re: Odd crash-loading AppleScripts

2009-03-05 Thread Reza Farhad

Reported the bug to Apple.
Reza

On 5 Mar 2009, at 12:00, Matt Gough wrote:


Reza,

I suspect this is not your fault. I suggest you file a radar bug.

BTW - You never release NSAppleScript *script, so this code would  
leak.


and your spelling is as bad as ever  :) 'laodRunScript'

Matt


On 5 Mar 2009, at 11:25, Reza Farhad wrote:


Has

Thanks for your suggestion but it did not make any difference.
To make sure that there was nothing else in my code that was  
creating the issue I made a little app to reproduce the problem.  
This app Loads a simple "Hello World" script and displays it in a  
window. Again if I have Guard Malloc on, it would crash the app,  
but otherwise it seems to work. Here is a link to the test project  
app, so others can have a look and see if they can get to the  
bottom of this.


http://www.Qu-s.eu/Dev/AppleScriptLoader.zip

Thanks
Reza

On 4 Mar 2009, at 19:27, has wrote:




___

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

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

Help/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: Checking for NULL (was "Re: Can't get setDelegate to work...")

2009-03-05 Thread Steven Noyes


On Mar 4, 2009, at 7:54 PM, Mark D. Gerl wrote:


Precisely.. code-in-email.  I do handle all else cases, and wrap it  
all up inside exceptions.  Kind of habit by now.


What I was kind of fishing for in the nil/NULL checking - was - to  
recognize that it seems Cocoa programmers are trending towards the  
lazy side (like Java); and there's too much "just trust the force,  
Luke" stuff going on there.  Preventative programming seems to go  
right out the window, and what makes me think twice about all of  
this stuff is this - it's all sitting on top of C; and no amount of  
magic will help you track down gnarly memory overwrites and such,  
than trying to trap anomalies as soon as you can.  The key, though, is


I don't see this as the lazy side as much as the "smart" side.  In any  
language definition (and all languages are built on top of assembly at  
some point) there are specific aspects of the language.In C++,  
accessing an object that has a NULL pointer is defined to send you to  
the dump.  In Objective-C, it is defined as any call to a nil object  
is effectively a NOP.  It is defined to do nothing.  This makes the  
following code:


if (someObject != nil)
{
[someObject doSomething:self];
}

The same as:
if (someObject != nil)
{
if (someObject != nil)
{
[someObject doSomething:self];
}
}

From a testing standpoint, the second condition is purely untestable  
and includes a dead branch condition.  At the end of the day, it  
really means you wrote WAY too much code.  A second point is, simply  
checking for nil is not enough.  If you are checking for error  
conditions, you must provide an alternate path to do something about  
it even if it is to exit.  To have a dormant failure in the code is  
not a good thing and these can take months to locate.  If nil is  
possible but undesirable, trap it and take some action.


Steven
___

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

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

Help/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: Checking for NULL (was "Re: Can't get setDelegate to work...")

2009-03-05 Thread Roland King


On Mar 5, 2009, at 9:32 PM, Steven Noyes wrote:



On Mar 4, 2009, at 7:54 PM, Mark D. Gerl wrote:


Precisely.. code-in-email.  I do handle all else cases, and wrap it  
all up inside exceptions.  Kind of habit by now.


What I was kind of fishing for in the nil/NULL checking - was - to  
recognize that it seems Cocoa programmers are trending towards the  
lazy side (like Java); and there's too much "just trust the force,  
Luke" stuff going on there.  Preventative programming seems to go  
right out the window, and what makes me think twice about all of  
this stuff is this - it's all sitting on top of C; and no amount of  
magic will help you track down gnarly memory overwrites and such,  
than trying to trap anomalies as soon as you can.  The key, though,  
is


I don't see this as the lazy side as much as the "smart" side.  In  
any language definition (and all languages are built on top of  
assembly at some point) there are specific aspects of the  
language.In C++, accessing an object that has a NULL pointer is  
defined to send you to the dump.  In Objective-C, it is defined as  
any call to a nil object is effectively a NOP.  It is defined to do  
nothing.  This makes the following code:


if (someObject != nil)
{
[someObject doSomething:self];
}

The same as:
if (someObject != nil)
{
if (someObject != nil)
{
[someObject doSomething:self];
}
}

From a testing standpoint, the second condition is purely untestable  
and includes a dead branch condition.  At the end of the day, it  
really means you wrote WAY too much code.  A second point is, simply  
checking for nil is not enough.  If you are checking for error  
conditions, you must provide an alternate path to do something about  
it even if it is to exit.  To have a dormant failure in the code is  
not a good thing and these can take months to locate.  If nil is  
possible but undesirable, trap it and take some action.


Steven


One small point .. sending a message to nil is defined to do nothing  
at runtime, do however read the actual documentation which describes  
what is returned in the case that the method returns something. Thus  
far for me the default return has made sense, but if you're sending  
messages to nil and they have return values, you have to consider if  
having a default return (for instance returning 0) gives you the  
information you need or if you do need to check for nil in those cases  
in order not to get a bogus value you then use. 
___


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

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

Help/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: MVC - Model View Control

2009-03-05 Thread Erik Buck
As an author, I humbly recommend 
http://my.safaribooksonline.com/9780321591210.  Check out the table of contents.
___

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

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

Help/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: CrashReporter alternatives for third-party apps?

2009-03-05 Thread Sean McBride
On 3/4/09 6:26 PM, Rick Mann said:

>Can you guys suggest something I can use to submit crash reports to my
>own servers (and perhaps to suppress Apple's CrashReporter)?

With  it's as easy as adding 2 items to
your Info.plist, though the user has to have SCR installed.

--

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: Doing NSStringDrawingTruncatesLastVisibleLine with NSLayoutManger

2009-03-05 Thread Eric Gorr


On Mar 4, 2009, at 4:57 PM, Eric Gorr wrote:


I am drawing a string with a NSLayoutManager by doing:

[layoutManager drawGlyphsForGlyphRange:glyphRange  
atPoint:NSMakePoint( [self bounds].origin.x,[self bounds].origin.y )];


What I would like is if the string I am drawing goes beyond the last  
visible line, is for the string to draw a truncated form of itself  
with an elipses at the last visible part of the string.


As near as I can tell, this is what the NSString drawing option  
NSStringDrawingTruncatesLastVisibleLine will do.


The paragraph style NSLineBreakByTruncatingTail comes close, but I  
have a single string that can be drawn over multiple lines and still  
be visible. The NSLineBreakByTruncatingTail style restrict my  
drawing to just a single line which isn't enough.


Anyone tried to emulate NSStringDrawingTruncatesLastVisibleLine with  
NSLayoutManager drawing?


Is there any sample code out there demonstrating the technique?



Here is the start of something that I think will work, but I have a  
strange problem...


NSRange glyphRange  = [layoutManager  
glyphRangeForTextContainer:container];

NSUInteger  index   = 0;
NSUInteger  x;
NSUInteger  numberOfGlyphs  = glyphRange.length;
NSMutableArray  *visibleLines   = [NSMutableArray array];
NSRect  bounds  = [self bounds];

if ( numberOfGlyphs > 0 ) {
//
// Find visible lines
//
for ( x = 0, index = 0; index < numberOfGlyphs; x++) {
NSRange lineRange;
NSRect  lineRect= [layoutManager  
lineFragmentRectForGlyphAtIndex:index
   
effectiveRange:&lineRange];



if ( NSContainsRect( bounds, lineRect ) ) {
[visibleLines addObject:[NSDictionary  
dictionaryWithObjectsAndKeys:[NSValue valueWithRange:lineRange],  
@"range",
   [NSValue 
 valueWithRect:lineRect], @"rect",
   nil 
]];

}

index = NSMaxRange(lineRange);
}

//
// draw visible lines
//
if ( [visibleLines count] > 0 ) {
NSDictionary *visibleLine;

for ( visibleLine in visibleLines ) {
NSRange visibleRange= [[visibleLine  
objectForKey:@"range"] rangeValue];
NSRect  visibleRect = [[visibleLine  
objectForKey:@"rect"] rectValue];


NSLog( @"%@", NSStringFromRect( visibleRect ) );

[layoutManager drawGlyphsForGlyphRange:visibleRange  
atPoint:visibleRect.origin];

}
}
}



My text container is of unlimited height, so glyphRange will hold the  
range for all of the glyphs. I cycle through all of the lines of text  
remembering those lines which are visible. I then cycle through the  
visible lines to draw them.


My thought was that since I can obtain the range of characters for the  
glyphs on the last visible line  
(characterRangeForGlyphRange:actualGlyphRange:), I could set the  
NSLineBreakByTruncatingTail NSParagraphStyle for the the characters  
which appear on the last visible line to the end of the string. This  
should cause the ellipsis to appear for the last visible line of text.


However, the strange problem is that while I can see the  
visibleRect.origin's are all correct, the drawing appears to be double  
spaced which one can see at:


  http://ericgorr.net/cocoadev/outlinetable/doublespace.png

The visibleRect.origin's are:

2009-03-05 09:24:50.723 OutlineCollection-VB[29692:813] {{0, 0}, {70,  
12}}
2009-03-05 09:24:50.731 OutlineCollection-VB[29692:813] {{0, 12}, {70,  
12}}
2009-03-05 09:24:50.732 OutlineCollection-VB[29692:813] {{0, 24}, {70,  
12}}
2009-03-05 09:24:50.733 OutlineCollection-VB[29692:813] {{0, 36}, {70,  
12}}
2009-03-05 09:24:50.738 OutlineCollection-VB[29692:813] {{0, 48}, {70,  
12}}


But, the characters which should be drawn at {{0, 12}, {70, 12}} are  
being drawn at {{0, 24}, {70, 12}} and I don't know why. I be  
interested in learning what I am doing wrong...anyone have any ideas?




My other thought is to use  
characterRangeForGlyphRange:actualGlyphRange: and  
glyphRangeForCharacterRange:actualCharacterRange: to figure out where  
I should clip the string and manually insert an ellipsis. If I do  
this, I can just use drawGlyphsForGlyphRange:atPoint: on the entire  
string.




p.s. through my searches, I found this useful bit of info...

unichar ellipsis = 0x2026;





___

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

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

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

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


Any sample code to record in aiff format

2009-03-05 Thread Anshul jain


hi
Is there any sample code to record in aiff format

Regards,
Anshul jain






___

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

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

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

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


User In-Activity hook?

2009-03-05 Thread Rich Collyer

Are there any hooks for tracking user activity?

I need to be able to determine if there has been any user activity  
(mouse, keyboard, disk access) for a period of time.


+++
Rich Collyer - Senior Software Engineer
+++






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: Any sample code to record in aiff format

2009-03-05 Thread I. Savant
On Thu, Mar 5, 2009 at 10:15 AM, Anshul jain
 wrote:

>        Is there any sample code to record in aiff format

http://www.lmgtfy.com/?q=cocoa+record+aiff

  With thanks to Nick for the helpful link ...

--
I.S.
___

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

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

Help/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: Any sample code to record in aiff format

2009-03-05 Thread Eric Gorr


On Mar 5, 2009, at 10:34 AM, I. Savant wrote:


On Thu, Mar 5, 2009 at 10:15 AM, Anshul jain
 wrote:


   Is there any sample code to record in aiff format


http://www.lmgtfy.com/?q=cocoa+record+aiff


Rather then googling everything, I have found:

http://bit.ly/macdev

to be quite useful. Marc Liyanage mentioned it here several days ago  
and you can read more about it here:


http://www.entropy.ch/blog/Developer/2009/01/17/Google-Custom-Search-Engine-for-Mac-OS-X-Developers.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: User In-Activity hook?

2009-03-05 Thread Torsten Curdt
On Thu, Mar 5, 2009 at 16:35, Rich Collyer  wrote:
> Are there any hooks for tracking user activity?
>
> I need to be able to determine if there has been any user activity (mouse,
> keyboard, disk access) for a period of time.

http://vafer.org/blog/20081118145046

cheers
--
Torsten
___

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

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

Help/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: User In-Activity hook? And a request

2009-03-05 Thread m

For the archives, the blog Torsten linked to had this bit of code:

double CGSSecondsSinceLastInputEvent(long evType);
double idleTime = CGSSecondsSinceLastInputEvent(-1);

Might I humbly request that when feasible, actual answers be posted to  
the list, and not merely links to answers? One way folks use this list  
is by searching the archives. The archives are maintained for a long  
time, but links often go stale. Twice yesterday, I found links to  
answers but they were dead.


_murat

On Mar 5, 2009, at 8:08 AM, Torsten Curdt wrote:

On Thu, Mar 5, 2009 at 16:35, Rich Collyer   
wrote:

Are there any hooks for tracking user activity?

I need to be able to determine if there has been any user activity  
(mouse,

keyboard, disk access) for a period of time.


 http://vafer.org/blog/20081118145046
 
___


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

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

Help/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: Any sample code to record in aiff format

2009-03-05 Thread Matt Neuburg
On Thu, 5 Mar 2009 20:45:13 +0530, Anshul jain
 said:
> 
>hi
> Is there any sample code to record in aiff format

Did you try a search on "recording audio" at the apple developer site?

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



___

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

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

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

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


Re: User In-Activity hook? And a request

2009-03-05 Thread Shawn Erickson
On Thu, Mar 5, 2009 at 8:58 AM, m  wrote:
> For the archives, the blog Torsten linked to had this bit of code:
>
> double CGSSecondsSinceLastInputEvent(long evType);
> double idleTime = CGSSecondsSinceLastInputEvent(-1);
>

You should note that those are private / undocumented API ...so you
shouldn't use them.

-Shawn
___

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

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

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

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


Disabling key bindings

2009-03-05 Thread Shayne Wissler
I have an application in which the user's normal OSX key bindings are
meaningless, and while they are in that application I would like to detect
any keyboard event. Right now I am using KeyDown, KeyUp, and FlagsChanged,
but these of course are subject to the user's key bindings. Is there either
a way to disable the key bindings in a Cocoa app, or is there perhaps a
different method for receiving the raw, literal keycodes? Or is what I'm
after impossible unless you modify the user's key bindings?


Thanks,
 Shayne Wissler
___

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

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

Help/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: Checking for NULL (was "Re: Can't get setDelegate to work...")

2009-03-05 Thread Clark Cox
On Thu, Mar 5, 2009 at 5:32 AM, Steven Noyes  wrote:
>
> On Mar 4, 2009, at 7:54 PM, Mark D. Gerl wrote:
>>
>> Precisely.. code-in-email.  I do handle all else cases, and wrap it all up
>> inside exceptions.  Kind of habit by now.
>>
>> What I was kind of fishing for in the nil/NULL checking - was - to
>> recognize that it seems Cocoa programmers are trending towards the lazy side
>> (like Java); and there's too much "just trust the force, Luke" stuff going
>> on there.  Preventative programming seems to go right out the window, and
>> what makes me think twice about all of this stuff is this - it's all sitting
>> on top of C; and no amount of magic will help you track down gnarly memory
>> overwrites and such, than trying to trap anomalies as soon as you can.  The
>> key, though, is
>
> I don't see this as the lazy side as much as the "smart" side.  In any
> language definition (and all languages are built on top of assembly at some
> point) there are specific aspects of the language.    In C++, accessing an
> object that has a NULL pointer is defined to send you to the dump.

It's actually worse than that. It's not defined as doing anything at
all. So it's perfectly possible, in C++, for it to "work" for years,
and only fail when the stars align.

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


Re: User In-Activity hook? And a request

2009-03-05 Thread Michael Ash
On Thu, Mar 5, 2009 at 11:58 AM, m  wrote:
> For the archives, the blog Torsten linked to had this bit of code:
>
> double CGSSecondsSinceLastInputEvent(long evType);
> double idleTime = CGSSecondsSinceLastInputEvent(-1);
>
> Might I humbly request that when feasible, actual answers be posted to the
> list, and not merely links to answers? One way folks use this list is by
> searching the archives. The archives are maintained for a long time, but
> links often go stale. Twice yesterday, I found links to answers but they
> were dead.

Copyright issues make that less easy than it ought to be, and it's
mostly pointless, as archive.org will recover your old links in 99% of
the cases. A link to a long, detailed explanation is *vastly* better
than a quickie summary posted inline.

In any case, using the above private API is a bad idea. This post
shows a way that uses only public APIs

http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354

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


NSString leak or RedHerring again?

2009-03-05 Thread James Cicenia

Hello -

I do this a lot but only this give me leaks:

 while (sqlite3_step(statement) == SQLITE_ROW) {
AvailableItem *newItem = [[AvailableItem alloc]init];

	[newItem setName: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 0)]];
	[newItem setType: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 1)]];
	[newItem setSubtype: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 2)]];


[items addObject:newItem];
[newItem release];
}

My instruments tells me it is leaking NSString.

AvailableItem is a bare bones class with just synthesize and nothing  
else.


Why is it leaking?
Thanks
James Cicenia

___

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

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

Help/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: NSString leak or RedHerring again?

2009-03-05 Thread Clark Cox
What does -[AvailableItem dealloc] look like?

On Thu, Mar 5, 2009 at 10:54 AM, James Cicenia  wrote:
> Hello -
>
> I do this a lot but only this give me leaks:
>
>  while (sqlite3_step(statement) == SQLITE_ROW) {
>        AvailableItem *newItem = [[AvailableItem alloc]init];
>
>        [newItem setName: [NSString stringWithUTF8String:(char
> *)sqlite3_column_text(statement, 0)]];
>        [newItem setType: [NSString stringWithUTF8String:(char
> *)sqlite3_column_text(statement, 1)]];
>        [newItem setSubtype: [NSString stringWithUTF8String:(char
> *)sqlite3_column_text(statement, 2)]];
>
>        [items addObject:newItem];
>        [newItem release];
> }
>
> My instruments tells me it is leaking NSString.
>
> AvailableItem is a bare bones class with just synthesize and nothing else.
>
> Why is it leaking?
> Thanks
> James Cicenia
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
>
> This email sent to clarkc...@gmail.com
>



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

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

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

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

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


NSStatusItem when clicked shows custom view

2009-03-05 Thread Chris Purcell
I'm looking to do something similar to this app: http://transmissionapps.com/ 
 (Logbook).  I've seen that done in a handful of apps, a custom  
window/view invoked when the NSStatusItem is clicked.  My two quesitons:


1)  How is that window created.  Is it a custom NSWindow or a regular  
NSWindow with a custom view?


2)  How can I position the window so that it is directly below the  
NSStatusItem?


Or am I going about this the wrong way.

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/archive%40mail-archive.com

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


Re: User In-Activity hook? And a request

2009-03-05 Thread Rich Collyer
I appreciate the importance of NOT using undocumented APIs and the  
IOKit option listed below works great.


Thank you,

+++
Rich Collyer - Senior Software Engineer
+++




On Mar 5, 2009, at 10:23 AM, Michael Ash wrote:


On Thu, Mar 5, 2009 at 11:58 AM, m  wrote:

For the archives, the blog Torsten linked to had this bit of code:

double CGSSecondsSinceLastInputEvent(long evType);
double idleTime = CGSSecondsSinceLastInputEvent(-1);

Might I humbly request that when feasible, actual answers be posted  
to the
list, and not merely links to answers? One way folks use this list  
is by
searching the archives. The archives are maintained for a long  
time, but
links often go stale. Twice yesterday, I found links to answers but  
they

were dead.


Copyright issues make that less easy than it ought to be, and it's
mostly pointless, as archive.org will recover your old links in 99% of
the cases. A link to a long, detailed explanation is *vastly* better
than a quickie summary posted inline.

In any case, using the above private API is a bad idea. This post
shows a way that uses only public APIs

http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354

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/rcollyer 
%40ironkey.com


This email sent to rcoll...@ironkey.com




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: Disabling key bindings

2009-03-05 Thread Ken Thomases

On Mar 5, 2009, at 11:59 AM, Shayne Wissler wrote:


I have an application in which the user's normal OSX key bindings are
meaningless, and while they are in that application I would like to  
detect
any keyboard event. Right now I am using KeyDown, KeyUp, and  
FlagsChanged,

but these of course are subject to the user's key bindings.


No, they're not.  These deal in raw keyboard events.  In fact, the key  
bindings technology is all about invoking action methods specific to a  
given key function, so almost by definition they wouldn't be keyDown:,  
keyUp: and flagsChanged:.  Now, the key bindings stuff is done within  
keyDown:, but only if you so choose.


See .


Regards,
Ken

___

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

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

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

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


Re: NSString leak or RedHerring again?

2009-03-05 Thread Bill Bumgarner

On Mar 5, 2009, at 10:54 AM, James Cicenia wrote:
AvailableItem is a bare bones class with just synthesize and nothing  
else.


Why is it leaking?


You need to release the strings in AvaiableItem's -dealloc method.

b.bum

___

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

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

Help/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: NSString leak or RedHerring again?

2009-03-05 Thread James Cicenia

I had thought that @synthesize does that autmatically.

I guess not.

On Mar 5, 2009, at 1:18 PM, Bill Bumgarner wrote:


On Mar 5, 2009, at 10:54 AM, James Cicenia wrote:
AvailableItem is a bare bones class with just synthesize and  
nothing else.


Why is it leaking?


You need to release the strings in AvaiableItem's -dealloc method.

b.bum



___

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

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

Help/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: User In-Activity hook? And a request

2009-03-05 Thread Rich Collyer
BTY, is there a similar dictionary item for mass storage accesses?   
i.e. how long since the last time a file system read or write took  
place.


+++
Rich Collyer - Senior Software Engineer
+++




On Mar 5, 2009, at 11:13 AM, Rich Collyer wrote:

I appreciate the importance of NOT using undocumented APIs and the  
IOKit option listed below works great.


Thank you,

+++
Rich Collyer - Senior Software Engineer
+++




On Mar 5, 2009, at 10:23 AM, Michael Ash wrote:


On Thu, Mar 5, 2009 at 11:58 AM, m  wrote:

For the archives, the blog Torsten linked to had this bit of code:

double CGSSecondsSinceLastInputEvent(long evType);
double idleTime = CGSSecondsSinceLastInputEvent(-1);

Might I humbly request that when feasible, actual answers be  
posted to the
list, and not merely links to answers? One way folks use this list  
is by
searching the archives. The archives are maintained for a long  
time, but
links often go stale. Twice yesterday, I found links to answers  
but they

were dead.


Copyright issues make that less easy than it ought to be, and it's
mostly pointless, as archive.org will recover your old links in 99%  
of

the cases. A link to a long, detailed explanation is *vastly* better
than a quickie summary posted inline.

In any case, using the above private API is a bad idea. This post
shows a way that uses only public APIs

http://www.cocoabuilder.com/archive/message/cocoa/2004/10/27/120354

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/rcollyer%40ironkey.com

This email sent to rcoll...@ironkey.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/rcollyer 
%40ironkey.com


This email sent to rcoll...@ironkey.com




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: NSString leak or RedHerring again?

2009-03-05 Thread Bill Bumgarner

On Mar 5, 2009, at 11:20 AM, James Cicenia wrote:

I had thought that @synthesize does that autmatically.

I guess not.


It is desired, but it is actually exceedingly difficult to generalize  
a solution that is correct in all cases.


There is a radar tracking this particular feature request -- I don't  
have the number handy at the moment -- and we are considering how to  
solve the issue in a non-surprising & intuitive fashion.


(So, no, no need to file a feature request radar -- this one is well  
known and well covered)


b.bum

___

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

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

Help/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: NSString leak or RedHerring again?

2009-03-05 Thread James Cicenia

OK That worked but now that I got you:

Why is it complaining about  the indicated array below:



while (sqlite3_step(statement) == SQLITE_ROW) {
//find subtype as key in the dict first
if(![aDict objectForKey: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 2)]]){


	NSMutableArray *tmparray = [[NSMutableArray alloc]init];  <==  
=  Says it leaks?


	[aDict setValue:tmparray forKey: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 2)]];

[tmparray release];
}


subtypeArray = [aDict objectForKey: [NSString stringWithUTF8String: 
(char *)sqlite3_column_text(statement, 2)]];
[subtypeArray addObject: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 0)]];
[aDict setValue:subtypeArray forKey: [NSString stringWithUTF8String: 
(char *)sqlite3_column_text(statement, 2)]];

}


Thanks again,
James Cicenia


On Mar 5, 2009, at 1:18 PM, Bill Bumgarner wrote:


On Mar 5, 2009, at 10:54 AM, James Cicenia wrote:
AvailableItem is a bare bones class with just synthesize and  
nothing else.


Why is it leaking?


You need to release the strings in AvaiableItem's -dealloc method.

b.bum



___

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

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

Help/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] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Eric Gorr
I have a need to use poseAsClass, but I see that it has been  
deprecated in 10.5 and won't be available for 64-bit applications.


So, is there a replacement?

___

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

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

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

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


Search Kit Proximity Searching

2009-03-05 Thread Steve Scott
I am having trouble with proximity searching using Search Kit under OS  
X 10.5.6.


I have two simple text documents in my index one just contains the  
phrase


"Sometimes I am amazed at how stupid Scotty can really be!"

and the other contains the phrase

" I am amazed at how stupid some people are compared to the brilliant  
Scotty and the mac"


When I declare the index I do it with the following code.


NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
0, @"kSKMaximumTerms",

kCFBooleanTrue,@"kSKProximityIndexing", nil];

filesIndex =  SKIndexCreateWithMutableData(
(CFMutableDataRef)[NSMutableData data], 
CFSTR("Files Index"),
kSKIndexInverted,
(CFDictionaryRef)properties);


When I do a search on the phrase "amazed at how stupid some" only the  
file containing the second phrase is returned which seems correct but  
if I search for the phrase "amazed at how stupid Scotty" the search  
returns both files which does not match my expectation from the  
documentation.


If I was just searching for the separate words it would make sense but  
not when searching for a phrase.  The docs all say Search Kit only  
supports phrase searching not proximity searching so I would only  
expect to receive the file containing the first phrase as a result for  
this second  search.


I am going mad, doing something stupid or just mis-understanding this  
whole thing completely.


Thanks in Advance

Scotty
The Mac Developer Network
http://www.mac-developer-network.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] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Eric Gorr


On Mar 5, 2009, at 2:33 PM, Eric Gorr wrote:


I have a need to use poseAsClass, but I see that it has been
deprecated in 10.5 and won't be available for 64-bit applications.

So, is there a replacement?



Well, with a bit of searching I came up with what might be an option:

http://theocacao.com/document.page/266
http://www.cocoadev.com/index.pl?MethodSwizzling

(I believe both sites describe the same technique.)

Are there any other alternatives?
___

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

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

Help/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] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Benjamin Stiglitz
> I have a need to use poseAsClass, but I see that it has been deprecated 
> in 10.5 and won't be available for 64-bit applications.
>
> So, is there a replacement?

WAYTTD: What are you trying to do? Maybe you don’t need to pose.

-Ben
___

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

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

Help/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] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Eric Gorr


On Mar 5, 2009, at 2:47 PM, Benjamin Stiglitz wrote:

I have a need to use poseAsClass, but I see that it has been  
deprecated

in 10.5 and won't be available for 64-bit applications.

So, is there a replacement?


WAYTTD: What are you trying to do? Maybe you don’t need to pose.


Well, sadly, I am pretty sure I do...at least for now.

Although, this bug is not quite confirmed yet, but I suspect I know  
what the problem is.


I am working on a Carbon -> Cocoa conversion. In the carbon part, the  
cursor is being set to a 64x64 cursor constantly - via NSCursor set.  
The problem comes when I move the cursor over a cocoa view which I  
believe, by default, changing the cursor to what it wants - which I  
believe is a 32x32 cursor.


So, in the constantly fighting over what the cursor should be, there  
is some weird cursor behavior...it flickers - moves quickly to a  
nearby location and then back again.


I figure I could write my own NSCursor subclass, pose it as the normal  
NSCursor class and make sure that it is always trying to set cursor in  
the same way in every situation.


Yes, I know, this isn't a good situation any way you slice it...but I  
need a quick fix and poseAsClass: seems to be the best option -  
assuming the bug is what I think it is.


___

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

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

Help/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: Disabling key bindings

2009-03-05 Thread Shayne Wissler
On Thu, Mar 5, 2009 at 12:17 PM, Ken Thomases  wrote:

> On Mar 5, 2009, at 11:59 AM, Shayne Wissler wrote:
>
>  I have an application in which the user's normal OSX key bindings are
>> meaningless, and while they are in that application I would like to detect
>> any keyboard event. Right now I am using KeyDown, KeyUp, and FlagsChanged,
>> but these of course are subject to the user's key bindings.
>>
>
> No, they're not.  These deal in raw keyboard events.


So why don't I get events for F1-F4, F7-12? I was assuming it was because
they were bound, evidently there's a different level of key binding going
on?


> In fact, the key bindings technology is all about invoking action methods
> specific to a given key function, so almost by definition they wouldn't be
> keyDown:, keyUp: and flagsChanged:.  Now, the key bindings stuff is done
> within keyDown:, but only if you so choose.
>
> See <
> http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/HandlingKeyEvents/chapter_6_section_3.html
> >.
>
>
Thanks for the link.


Shayne Wissler
___

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

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

Help/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: Disabling key bindings

2009-03-05 Thread Ken Thomases

On Mar 5, 2009, at 2:18 PM, Shayne Wissler wrote:

On Thu, Mar 5, 2009 at 12:17 PM, Ken Thomases   
wrote:



On Mar 5, 2009, at 11:59 AM, Shayne Wissler wrote:

I have an application in which the user's normal OSX key bindings  
are
meaningless, and while they are in that application I would like  
to detect
any keyboard event. Right now I am using KeyDown, KeyUp, and  
FlagsChanged,

but these of course are subject to the user's key bindings.



No, they're not.  These deal in raw keyboard events.



So why don't I get events for F1-F4, F7-12? I was assuming it was  
because
they were bound, evidently there's a different level of key binding  
going

on?


I suspect you would if you used the "fn" key with them.  In System  
Preferences, Keyboard & Mouse pane, Keyboard tab, take a look at the  
"Use all F1, F2, etc. keys as standard function keys" checkbox.   
Unless that is checked, the function keys you refer to are acting as  
"hardware" keys.


This is not part of the Cocoa key bindings technology.  It's happening  
at a lower level than that.  You can check to see if a Quartz Event  
Tap gives you access to those key events, but even that might not.


Another thing to be aware of is the Keyboard Shortcuts tab of that  
preference pane.  Shortcuts assigned there are also not part of the  
Cocoa key bindings system, but you do have some more control over  
them.  If you override -[NSApplication sendEvent:] you can see those  
key events and even prevent their normal processing.



See .



Thanks for the link.


You're welcome.

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: Question about the Foundation Framework

2009-03-05 Thread Steve Shepard
On Thu, Feb 19, 2009 at 7:36 AM, Michael Ash  wrote:
>
> If you're looking for more information, note that NSTemporaryDirectory
> is essentially equivalent to /tmp on a normal UNIX system

This is not quite true.

On Leopard, the dirhelper utility deletes files from
NSTemporaryDirectory that were last accessed more than three days ago;
if a user leaves your app running for more than 3 days, dirhelper will
happily delete files out from under it.

See http://www.cocoabuilder.com/archive/message/cocoa/2009/1/15/227830

Unfortunately, this makes NSTemporaryDirectory unusable for my
purposes as I need the data to be around for the lifetime of the app.

-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: Disabling key bindings

2009-03-05 Thread Shayne Wissler
>
>
>> So why don't I get events for F1-F4, F7-12? I was assuming it was because
>> they were bound, evidently there's a different level of key binding going
>> on?
>>
>
> I suspect you would if you used the "fn" key with them.


For F1-F4, it works as you suspect. For F8-F12, even holding FN doesn't let
them pass through.


>  In System Preferences, Keyboard & Mouse pane, Keyboard tab, take a look at
> the "Use all F1, F2, etc. keys as standard function keys" checkbox.  Unless
> that is checked, the function keys you refer to are acting as "hardware"
> keys.


When I set that option, it simply inverts the FN behavior, which has no
effect on keys F8-F12, interestingly enough. The pane says "Use all F1, F2,
etc. keys standard function keys..." Evidently, "etc." stands for "F3, F4."
;)

Also, when I make the caps lock key act as an additional control, then the
caps lock keycode is also not sent via KeyDown/Up anymore.


>
>
> This is not part of the Cocoa key bindings technology.  It's happening at a
> lower level than that.  You can check to see if a Quartz Event Tap gives you
> access to those key events, but even that might not.


OK, thanks. Maybe that's what I'm supposed to be using for my purposes?


> Another thing to be aware of is the Keyboard Shortcuts tab of that
> preference pane.  Shortcuts assigned there are also not part of the Cocoa
> key bindings system, but you do have some more control over them.  If you
> override -[NSApplication sendEvent:] you can see those key events and even
> prevent their normal processing.


 So there are really 3 key bindings systems to be aware of then.


Shayne Wissler
___

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

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

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

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


Thread usage : Main thread interrupting secondary thread

2009-03-05 Thread Miles
I'm new to using threads and hitting an unexpected issue.

*There is an object moving across the screen on a separate thread started
like this:*

[NSThread detachNewThreadSelector:@selector( startObjectsAnimation: )
toTarget:animationHelper withObject:nil];

* Then in animationHelper:*

NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self
selector:@selector(doAnimation: ) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:animationTimer
forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] run];
[autoreleasepool release];


*Then I have another object that when touched, gets a fade animation applied
to it (on the main thread):*

CAAnimationGroup *anim = [AnimationCreatorUtil
createAnimationsForOnWayOut];
anim.delegate= tv;
[[tv.mview layer] addAnimation:anim forKey:@"fade"];
[tv.mview setAlpha:0];

This is happening on the main thread. However, when this fade animation is
applied on the main thread, the animation of the other object on the
secondary thread pauses for a really brief moment. Since they are happening
on different threads I'd expect neither of them to affect one another. What
could be causing this?

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: Question about the Foundation Framework

2009-03-05 Thread Steve Shepard
On Thu, Mar 5, 2009 at 1:06 PM, Bill Bumgarner  wrote:
> Then touch the files every 24 hours or so?

That would work. Of course you'd also have to register for sleep
notifications in case your user closed the laptop lid and left it
closed for more than three days, and you'd have to convince yourself
that you'd get the wake notification before the system level utilities
run.

> In general any cache type data
> should be stuffed in one of the cache locations (unless you really want the
> data to self destruct after reboot).

In my case, it isn't cache data, it is the working copy--the project
data from a zip file.

> Hopefully, your app is also hardened against the data disappearing.

Yes, it recognizes when data is deleted out from under it and notifies
the user :-)

Note that from 10.0 until Leopard, the data in NSTemporaryDirectory
wasn't purged until you rebooted your system and the docs said ""Files
put in the temporary directory may be moved to the Trash in a
'Recovered Files' directory when the user's system is restarted. You
should therefore ensure that you delete temporary files before your
application terminates."

Now the system potentially removes the files for you before your
application terminates.

-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


NSPopUPButton and selectedTag binding seems to give me index instead

2009-03-05 Thread Stuart Malin
I have a NSPopUpButton that is driven by bindings. I establish  
(programmatically) a binding between the NSPopUpButtom instance's  
"selectedTag" property and an NSTreeController that contains objects  
that have a property that should correspond with the available tag  
values. This does not seem to work. It appears that the binding is  
instead working with the popup button's index value. Symptoms and  
circumstance:


1) I changed the binding for the popup button's contentValues to refer  
to the tag property of the bound collection (rather than the title),  
and sure enough the proper tag values are displayed, so the menu items  
do have tag values.


2) When I change the popup button selection, the value in the object  
bound to the "selectedTag" is changed -- problem is: the value that is  
set is the index value, not the tag value.


The code...

First, what works: I drive the content and contentValues from an  
object that I construct which is an indexed accessor KVC (read-only)  
compliant with a backing store array of NSMenuItem items.  When I  
initialize the collection, the menu items are initialized with a  
title. I also set the tag property.  The bindings for these to the  
NSPopUpButton instance is done programmatically:


[twitterUpdateFrequencyPopupButton bind:@"content"
toObject:updateItems
withKeyPath:@"UpdateFrequencyMenuItems"
options:nil];
[twitterUpdateFrequencyPopupButton bind:@"contentValues"
toObject:updateItems

withKeyPath:@"UpdateFrequencyMenuItems.tag"
options:nil];

"updateItems" is the ordered collection of NSMenuItems; its indexed  
accessor property is "UpdateFrequencyMenuItems"


Here's what doesn't work, the binding for the selected tag value:

[twitterUpdateFrequencyPopupButton bind:@"selectedTag"
toObject:twitterAccountsArrayController
withKeyPath:@"selection.frequency"
options:nil];


"twitterAccountsArrayController" is an NSArrayController. The objects  
it manages have a "frequency" property.


When this is run, I receive no messages in the console about anything  
bad or wrong.


I've tried searching the usual places and with Marc Liyange's Mac  
Developer Search Engine for matters related to NSPopUpButton and  
selectedTag, but haven't found anything germane. So I post here.








___

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

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

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

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


mouseUp event for NSSlider

2009-03-05 Thread Norio

Hi,

Would you give me any suggestions to get the mouseUp event for NSSlider?

I've tried to make subclass of NSSlider and override mouseUp: and then  
put a breakpoint,

but the debugger didn't stop at the breakpoint.

Best regards,
Norio
___

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

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

Help/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: Disabling key bindings

2009-03-05 Thread Ken Thomases

On Mar 5, 2009, at 3:09 PM, Shayne Wissler wrote:

For F1-F4, it works as you suspect. For F8-F12, even holding FN  
doesn't let

them pass through.


Those keys are bound to Exposé, Dashboard, and Spaces by default.  See  
the Keyboard Shortcuts tab or the separate preference panes for those  
features.


For what it's worth, if you happen to be writing a full-screen program  
and you capture the displays, then those features are disabled and  
whatever keys are assigned to them automatically start getting  
delivered to your app.


Regards,
Ken

___

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

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

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

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


Re: NSPopUPButton and selectedTag binding seems to give me index instead

2009-03-05 Thread Ken Thomases

On Mar 5, 2009, at 3:35 PM, Stuart Malin wrote:

First, what works: I drive the content and contentValues from an  
object that I construct which is an indexed accessor KVC (read-only)  
compliant with a backing store array of NSMenuItem items.


I'm pretty sure that doesn't work like you expect it to.

The content bindings of an NSPopUpButton don't expect the bound-to  
objects to be NSMenuItems, and they don't take special advantage of it  
if they are.  They're just generic objects as far as NSPopUpButton is  
concerned.  If the contentValues is bound, then the titles of the  
menus in the pop-up are take from that key path.  Otherwise, the  
titles are obtained by applying -description to each object in the  
content binding.  If contentObjects is bound, then the represented  
object for each item in the menu is the corresponding object in the  
binding.  Otherwise, it's just the corresponding object in the content  
binding.  The represented object is really just used when the  
selectedObject of the pop-up is bound.  Selecting a new item in the  
pop-up sets the bound value to be the represented object for the item;  
when the bound value is set in a KVO-compliant way, the pop-up changes  
to show the corresponding item selected.


I suspect that NSPopUpButton is just synthesizing tags for its menu  
items in this case.  I see no way to specify the tags of the items  
when the content is specified via bindings.


If you have a set of NSMenuItems that you want the NSPopUpButton to  
use, then don't use bindings to set the content of the pop-up.  Just  
set the menu directly.  In that case, I assume the tags are kept as  
they are, and the selectedTag binding will operate as you expect.


Alternatively, you can specify the key path to the tag value as the  
contentObjects binding.  Then, bind selectedObject to  
twitterAccountsArrayController.selection.frequency.  That should have  
the effect you're looking for, too.


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


CoreData, SyncServices & NSURL ...

2009-03-05 Thread Mic Pringle
Hi,

I'm having a small problem with CoreData and SyncServices using the
Bookmarks schema (com.apple.bookmarks.Bookmark) located in
/System/Library/SyncServices/Schemas.

One of the entities of that schema is url, which is of type url, which
apparently maps to NSURL according to the Apple reference.

However, you can't store NSURL natively via CoreData, so the
references suggest using a transformer. I one setup okay so that when
I read the bookmarks it's transformed and stored correctly (as
follows) ...

- (id)reverseTransformedValue:(id)value
{
if (value == nil)
return nil;

NSURL *url = [NSKeyedUnarchiver unarchiveObjectWithData:value];
if (url) {
return [NSString stringWithString:[url absoluteString]];
} else {
return nil;
}
}

The problem lies when I try to transform back the other way, and then
push the changes. If I use the opposite, which is ...

- (id)transformedValue:(id)value
{
if (value == nil)
return nil;

NSURL *url = [NSURL URLWithString:value];
if (url) {
return [NSKeyedArchiver archivedDataWithRootObject:url];
} else {
return nil;
}
}

I get the error 'ISyncInvalidRecordException ISyncSession record
validation failure: Value pushed for property url on
com.apple.bookmarks.Bookmark is not of expected class NSURL (url),
rather NSCFString.'

If I try just returning an NSURL object which is what it seems to
want, as in ...

- (id)transformedValue:(id)value
{
if (value == nil)
return nil;

NSURL *url = [NSURL URLWithString:value];
if (url) {
return url;
} else {
return nil;
}
}

I get the error ...

*** -[NSURL bytes]: unrecognized selector sent to instance 0x1ac080
ISyncManager: exception raised during sync alert callout. A session
will not be created: *** -[NSURL bytes]: unrecognized selector sent to
instance 0x1ac080

Can anyone help with how to transform a string into an NSURL that will
cooperate with both CoreData and SyncServices ?

Thanks in advance as I'm really tearing out my hair with this one.

-Mic
___

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

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

Help/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 - Notification and Threads

2009-03-05 Thread Seth Willits


It seems to me that the thread a task was launched on must continue to  
exist until the thread is terminated, in order for the task to send  
NSTaskDidTerminateNotification. I can either make my thread continue  
to exist (I'd prefer not) or I can make the launch happen on the main  
thread and use a condition to know when it's actually happened. The  
latter seems pretty reasonable. Anything else? Anyone have solid  
experience with this situation?


I find it odd the docs don't mention this, but maybe it's one of those  
things I'm "just  supposed to know."



--
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: NSTask - Notification and Threads

2009-03-05 Thread Ken Thomases

On Mar 5, 2009, at 4:22 PM, Seth Willits wrote:

It seems to me that the thread a task was launched on must continue  
to exist until the thread is terminated, in order for the task to  
send NSTaskDidTerminateNotification. I can either make my thread  
continue to exist (I'd prefer not) or I can make the launch happen  
on the main thread [...]


I find it odd the docs don't mention this, but maybe it's one of  
those things I'm "just  supposed to know."


Yeah.  You can provide feedback for the documentation to ask for  
clarification.


In order for the framework to know when the task has exited it has to  
monitor an external resource or event.  The description of the  
NSTaskDidTerminateNotification notification hints at this.  Monitoring  
of such external resources/events is typically done through the run  
loop.  It's not really feasible to install the run loop source onto  
the run loop of some other thread, so it naturally uses the current  
thread.  That also seems least surprising -- least surprising once you  
know that a run loop is involved, that is -- to the developer as  
client of the framework.


So, it's not even sufficient that the launch thread continues to  
exist, it must run its run loop.


By the way, you don't necessarily need to use a condition lock to  
learn when the task has been launched.  If you have the secondary  
thread tell the main thread to launch the task using - 
performSelectorOnMainThread:withObject:waitUntilDone: and pass YES for  
the wait parameter, you get that synchronization pretty simply.


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: mouseUp event for NSSlider

2009-03-05 Thread Ron Fleckner


On 06/03/2009, at 8:43 AM, Norio wrote:


Hi,

Would you give me any suggestions to get the mouseUp event for  
NSSlider?


I've tried to make subclass of NSSlider and override mouseUp: and  
then put a breakpoint,

but the debugger didn't stop at the breakpoint.

Best regards,
Norio


Hi Norio,

I think this thread on cocoabuilder will help you:


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: Making NSTableView behave more like a spreadsheet with arrow keys

2009-03-05 Thread Dave Geering
Hi all,

My solution to this problem can be found at:

http://stackoverflow.com/questions/612805/arrow-keys-with-nstableview

It's not very elegant but it gets the job done, and I'm welcome to
suggestions for improvements.

Cheers,
Dave.

On Thu, Mar 5, 2009 at 3:13 PM, Dave Geering wrote:
> Hi all,
>
> Is there a clean way to subclass NSTableView or the field editor to
> provide a way for users to change the currently editable cell in an
> NSTableView by pressing the arrow keys? I've already tried subclassing
> NSTableView but that will only be sent keyDown if a cell isn't being
> edited, and I've tried creating a custom field editor but I cannot
> reliably get the current position in the table so I don't know what to
> pass to [tableView editColumn:row:withEvent:select] (assuming that's
> the way I need to go).
>
> Is NSTableView even the control I want? The table of data in my
> application can span perhaps 100 rows and up to 5 columns. The user
> will be expected to enter data into a fair majority of these cells. I
> already have everything set up using bindings so that the user can
> edit the data but it is painstakingly tedious to double-click on each
> cell to change it's value. Tabbing works quite well but because there
> are other responders in my window, tabbing in the last column takes
> you to the next key view.
>
> Thanks,
> 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


launching per-user background agent 10.5 and higher

2009-03-05 Thread Rick Mann
We need to run a background agent that manages some data on a regular  
basis and displays a status item (menu bar item). We'd like to use the  
latest-and-greatest APIs for keeping it running while a user is logged  
in (including multiple users), but there seem to be issues with launchd.


In particular, a comment here (by Tom Harrington):

http://www.red-sweater.com/blog/245/taming-launchd

Suggests launchd won't reliably run user agents. is this true in 10.5+?



--
Rick

___

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

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

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

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


launching per-user background agent 10.5 and higher

2009-03-05 Thread Rick Mann

Sorry, added more info:


We need to run a background agent that manages some data on a regular  
basis and displays a status item (menu bar item). We'd like to use the  
latest-and-greatest APIs for keeping it running while a user is logged  
in (including multiple users), but there seem to be issues with launchd.


In particular, a comment here (by Tom Harrington):

http://www.red-sweater.com/blog/245/taming-launchd

Suggests launchd won't reliably run user agents. Is this true in 10.5+?

"However launchd doesn’t quite clean things up normally on log-out.  
The upshot is that if you log in, log out, and then back in, your  
LaunchAgents entries will not start up on the second login (or any  
subsequent logins)."


TIA,


--
Rick

___

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

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

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

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


Re: launching per-user background agent 10.5 and higher

2009-03-05 Thread David Duncan

On Mar 5, 2009, at 4:05 PM, Rick Mann wrote:

Suggests launchd won't reliably run user agents. is this true in  
10.5+?



This is resolved on 10.5. See TN 2083 Deamons and Agents 

--
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: NSString leak or RedHerring again?

2009-03-05 Thread Keary Suska


On Mar 5, 2009, at 12:26 PM, James Cicenia wrote:


OK That worked but now that I got you:

Why is it complaining about  the indicated array below:



while (sqlite3_step(statement) == SQLITE_ROW) {
//find subtype as key in the dict first
if(![aDict objectForKey: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 2)]]){


	NSMutableArray *tmparray = [[NSMutableArray alloc]init];   
<== =  Says it leaks?


	[aDict setValue:tmparray forKey: [NSString stringWithUTF8String: 
(char *)sqlite3_column_text(statement, 2)]];

[tmparray release];
}


May be a false positive, unless there is other code that may cause it  
to leak. But, the following:


subtypeArray = [aDict objectForKey: [NSString stringWithUTF8String: 
(char *)sqlite3_column_text(statement, 2)]];
[subtypeArray addObject: [NSString stringWithUTF8String:(char  
*)sqlite3_column_text(statement, 0)]];
[aDict setValue:subtypeArray forKey: [NSString stringWithUTF8String: 
(char *)sqlite3_column_text(statement, 2)]];

}



If subtypeArray is mutable, as it appears to be, the last statement is  
useless and potentially dangerous.


Best,

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

___

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

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

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

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


Re: launching per-user background agent 10.5 and higher

2009-03-05 Thread Rick Mann

Thanks!

On Mar 5, 2009, at 17:00:26, David Duncan wrote:


On Mar 5, 2009, at 4:05 PM, Rick Mann wrote:

Suggests launchd won't reliably run user agents. is this true in  
10.5+?



This is resolved on 10.5. See TN 2083 Deamons and Agents 

--
David Duncan
Apple DTS Animation and Printing



--
Rick

___

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

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

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

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


More user agent questions

2009-03-05 Thread Rick Mann

We can run on 10.5 or later (no need for pre-10.5).

Our app needs to run as a background user agent, both to support the  
status item, and to periodically connect to our product that lives on  
the network and sync with it. There is an app or Sys Prefs Pane to  
provide the configuration UI.


We have several concerns. I'd appreciate any suggestions or  
reassurance that launchd/launchctl can handle these things.


If multiple users are logged in, there will (possibly) be multiple  
instances of the agent running. If not all users are currently logged  
in, then some instances won't be running.


Our product (on the network) periodically updates its own software,  
and that update may include a new version of the Mac software. When  
the agent checks in and sees there's a new version, we'd like it to  
update ASAP, transparently (no user intervention required).


Can any running instance (even if it's not for an admin user) shut  
down and relaunch other instances? Can it update launchd configuration  
as necessary for the other users?


If the UI is running, it will present a Sparkle-like dialog to warn  
the user that a new version is available. It may time out after a  
period of time and force the update. Basically, if our product updates  
its software, it's important that the Mac software update as well,  
otherwise things might break (we have no backward-compatibility  
requirement).


How do people deal with their agents running when there are multiple  
users logged in?


TIA,
--
Rick

___

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

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

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

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


Re: Path for writeToFile

2009-03-05 Thread Pierce Freeman
Maybe I'm off base here, but I haven't really found any more documentation
on FSFindFolder() and a search of Google doesn't really revile anything
either.  Also, I read on one archived site, that the 10.5.6 upgrade breaks
FSFindFolder().


On 3/3/09 8:55 AM, "Nick Zitzmann"  wrote:

> 
> On Mar 3, 2009, at 8:40 AM, Pierce Freeman wrote:
> 
>> I may be crazy here, but could you point me to some documentation?
>> The only
>> one I found is legacy.
> 
> 
> I think the parent meant FSFindFolder(), which will return an FSRef
> for a given special folder. That API is not legacy, and works on all
> four architectures. You can search the archives of this list for more
> details.
> 
> 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: Path for writeToFile

2009-03-05 Thread Nick Zitzmann


On Mar 5, 2009, at 8:24 PM, Pierce Freeman wrote:

Maybe I'm off base here, but I haven't really found any more  
documentation
on FSFindFolder() and a search of Google doesn't really revile  
anything

either.


Did you try Cocoabuilder? We've discussed FSFindFolder() on this list  
in the past.





Also, I read on one archived site, that the 10.5.6 upgrade breaks
FSFindFolder().



That's news to me; I haven't noticed that.

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: Path for writeToFile

2009-03-05 Thread Pierce Freeman
> Did you try Cocoabuilder? We've discussed FSFindFolder() on this list
> in the past.
> 
> 

Looks like Cocoabuilder saved the day once again.  I found some code on
there and it works wonderfully.

> That's news to me; I haven't noticed that.

Maybe the author mistakenly posted it, as I am running 10.5.6 and the code
from Cocoabuilder seems to work.


Thanks for the help!


___

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

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

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

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


How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Graham Cox
My app needs to show an EULA on start-up (yes, I know, but what can  
you do?). Handling this is all fine, but I need the modal dialog that  
is shown to completely block the normal start-up of the app until it  
completes.


Right now I show the dialog using [NSApp runModalForWindow:] and I  
call that from the app delegate's appWillFinishLaunching method. The  
problem is the normal start-up of the app, including creating an  
untitled doc, etc. continues behind the dialog.


--Graham


___

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

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

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

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


Re: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Kyle Sluder
Implement -applicationShouldOpenUntitledFile: in your app delegate to
return a flag variable.  Make sure that flag starts out as NO until
your EULA is dismissed.

--Kyle Sluder
___

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

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

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

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


Re: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Graham Cox


On 06/03/2009, at 3:39 PM, Kyle Sluder wrote:


Implement -applicationShouldOpenUntitledFile: in your app delegate to
return a flag variable.  Make sure that flag starts out as NO until
your EULA is dismissed.

--Kyle Sluder



OK. Then after closing the dialog the app doesn't open an untitled  
window.


--Graham


___

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

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

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

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


Re: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Graham Cox


On 06/03/2009, at 3:50 PM, Graham Cox wrote:


Implement -applicationShouldOpenUntitledFile: in your app delegate to
return a flag variable.  Make sure that flag starts out as NO until
your EULA is dismissed.

--Kyle Sluder



OK. Then after closing the dialog the app doesn't open an untitled  
window.



Actually the problem is more complicated than this.

The app might have been launched with a file or files, or just by  
double-clicking. So if the EULA needs to be displayed this should just  
defer opening the required documents. By stopping the untitled or  
other files from opening, they never do.


The apple events that supply the launch files or otherwise need to be  
captured (for later resending) or deferred, a the moment they are  
either discarded or processed, neither of which is appropriate.


This is WAY too hard. NSApplication should either provide a delegate  
hook for the purpose of displaying a modal window at startup or else  
detect that a modal window was put up during launch and defer the  
launch events until later.


I need a workaround, and fast - I've got to get this in before the end  
of the weekend.


--Graham
___

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

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

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

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


Re: Question about the Foundation Framework

2009-03-05 Thread Michael Ash
On Thu, Mar 5, 2009 at 3:45 PM, Steve Shepard  wrote:
> On Thu, Feb 19, 2009 at 7:36 AM, Michael Ash  wrote:
>>
>> If you're looking for more information, note that NSTemporaryDirectory
>> is essentially equivalent to /tmp on a normal UNIX system
>
> This is not quite true.
>
> On Leopard, the dirhelper utility deletes files from
> NSTemporaryDirectory that were last accessed more than three days ago;
> if a user leaves your app running for more than 3 days, dirhelper will
> happily delete files out from under it.
>
> See http://www.cocoabuilder.com/archive/message/cocoa/2009/1/15/227830
>
> Unfortunately, this makes NSTemporaryDirectory unusable for my
> purposes as I need the data to be around for the lifetime of the app.

Nothing guarantees that files in /tmp will remain around forever
either. If your app needs these files to stick around, keep them open.

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: mouseUp event for NSSlider

2009-03-05 Thread Michael Ash
On Thu, Mar 5, 2009 at 4:43 PM, Norio  wrote:
> Hi,
>
> Would you give me any suggestions to get the mouseUp event for NSSlider?
>
> I've tried to make subclass of NSSlider and override mouseUp: and then put a
> breakpoint,
> but the debugger didn't stop at the breakpoint.

http://www.lmgtfy.com/?q=mouseUp+event+for+NSSlider

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] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Michael Ash
On Thu, Mar 5, 2009 at 3:00 PM, Eric Gorr  wrote:
>
> On Mar 5, 2009, at 2:47 PM, Benjamin Stiglitz wrote:
>
>>> I have a need to use poseAsClass, but I see that it has been deprecated
>>> in 10.5 and won't be available for 64-bit applications.
>>>
>>> So, is there a replacement?
>>
>> WAYTTD: What are you trying to do? Maybe you don’t need to pose.
>
> Well, sadly, I am pretty sure I do...at least for now.
>
> Although, this bug is not quite confirmed yet, but I suspect I know what the
> problem is.
>
> I am working on a Carbon -> Cocoa conversion. In the carbon part, the cursor
> is being set to a 64x64 cursor constantly - via NSCursor set. The problem
> comes when I move the cursor over a cocoa view which I believe, by default,
> changing the cursor to what it wants - which I believe is a 32x32 cursor.
>
> So, in the constantly fighting over what the cursor should be, there is some
> weird cursor behavior...it flickers - moves quickly to a nearby location and
> then back again.
>
> I figure I could write my own NSCursor subclass, pose it as the normal
> NSCursor class and make sure that it is always trying to set cursor in the
> same way in every situation.
>
> Yes, I know, this isn't a good situation any way you slice it...but I need a
> quick fix and poseAsClass: seems to be the best option - assuming the bug is
> what I think it is.

Sounds to me like what you actually need is for your views to stop
fighting over the cursor. At most, a subclass of whatever Cocoa view
is screwing with your cursor might be called for. Posing as NSCursor
for this is like swatting a fly with a grenade.

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: Path for writeToFile

2009-03-05 Thread Michael Ash
On Thu, Mar 5, 2009 at 10:24 PM, Pierce Freeman
 wrote:
> Maybe I'm off base here, but I haven't really found any more documentation
> on FSFindFolder() and a search of Google doesn't really revile anything
> either.  Also, I read on one archived site, that the 10.5.6 upgrade breaks
> FSFindFolder().

Really? When I google "FSFindFolder" the first hit is the Folder
Manager Reference which contains detailed documentation on
FSFindFolder.

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: mouseUp event for NSSlider

2009-03-05 Thread John C. Randolph


On Mar 5, 2009, at 1:43 PM, Norio wrote:


Hi,

Would you give me any suggestions to get the mouseUp event for  
NSSlider?


I've tried to make subclass of NSSlider and override mouseUp: and  
then put a breakpoint,

but the debugger didn't stop at the breakpoint.


What's tripping you up there is a legacy of how some of the older  
controls are implemented.  NSSliderCell has a bad habit, which is  
capturing the event stream.  Once you send it a -mouseDown: message,  
it will consume all mouse events until -mouseUp:.  If you subclass  
NSSliderCell to work around this, don't send [super mouseDown:].


-jcr

___

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

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

Help/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 create a modal dialog that blocks on start-up?

2009-03-05 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 12:01 AM, Graham Cox  wrote:
> The app might have been launched with a file or files, or just by
> double-clicking. So if the EULA needs to be displayed this should just defer
> opening the required documents. By stopping the untitled or other files from
> opening, they never do.

So what?  Implement the appropriate methods in your NSApp delegate, or
perhaps a custom subclass of NSDocumentController, and have them stow
any arguments and keep reminding themselves using
-performSelector:withObject:afterDelay: until conditions change such
that the original message can be processed as normal.

--Kyle Sluder
___

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

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

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

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


Re: [Q] NSObject's poseAsClass - Replacement?

2009-03-05 Thread John C. Randolph


On Mar 5, 2009, at 12:00 PM, Eric Gorr wrote:



On Mar 5, 2009, at 2:47 PM, Benjamin Stiglitz wrote:

I have a need to use poseAsClass, but I see that it has been  
deprecated

in 10.5 and won't be available for 64-bit applications.

So, is there a replacement?


WAYTTD: What are you trying to do? Maybe you don’t need to pose.


Well, sadly, I am pretty sure I do...at least for now.

Although, this bug is not quite confirmed yet, but I suspect I know  
what the problem is.


I am working on a Carbon -> Cocoa conversion. In the carbon part,  
the cursor is being set to a 64x64 cursor constantly - via NSCursor  
set. The problem comes when I move the cursor over a cocoa view  
which I believe, by default, changing the cursor to what it wants -  
which I believe is a 32x32 cursor.


So, in the constantly fighting over what the cursor should be, there  
is some weird cursor behavior...it flickers - moves quickly to a  
nearby location and then back again.


I figure I could write my own NSCursor subclass, pose it as the  
normal NSCursor class and make sure that it is always trying to set  
cursor in the same way in every situation.


Yes, I know, this isn't a good situation any way you slice it...but  
I need a quick fix and poseAsClass: seems to be the best option -  
assuming the bug is what I think it is.


That's a band-aid, not a solution.  Figure out why the carbon code is  
constantly trying to change the cursor, and fix it.


-jcr

___

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

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

Help/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 search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread Kyle Sluder
On Thu, Mar 5, 2009 at 4:41 AM, haresh vavdiya  wrote:
>            So i have to search for ".mp3" files in all folders and then
> display into table. Can anyone tell me that how can i search, retrieve .mp3
> file and play this particular file into my apps.

We have this amazing technology called Spotlight, have you thought of using it?

--Kyle Sluder
___

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

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

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

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


Re: MVC - Model View Control

2009-03-05 Thread John C. Randolph


On Mar 5, 2009, at 5:55 AM, Erik Buck wrote:

As an author, I humbly recommend http://my.safaribooksonline.com/9780321591210 
.  Check out the table of contents.


I'll second Eric's recommendation.  Also, there's a pretty good  
conceptual intro to MVC in the Cocoa docs.  See


file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaDesignPatterns/chapter_5_section_4.html

on any machine with Xcode installed.

-jcr
___

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

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

Help/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 create a modal dialog that blocks on start-up?

2009-03-05 Thread Jeff Laing
> So what?  Implement the appropriate methods in your NSApp delegate, or
> perhaps a custom subclass of NSDocumentController, and have them stow
> any arguments and keep reminding themselves using
> -performSelector:withObject:afterDelay: until conditions change such
> that the original message can be processed as normal.

Why not just have those methods be the ones that display the EULA in a
modal window, if required, then continue on as normal (if the user
accepts, of course!)
___

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

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

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

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


NSView bottom part is cut off

2009-03-05 Thread Adam Gerson
I have a view that looks just fine in interface builder. When I
display it in a window in my app it cuts off the bottom part of the
content. Visual:

http://screencast.com/t/YEXgqlAcP

What could cause this?

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: NSView bottom part is cut off

2009-03-05 Thread John C. Randolph


On Mar 5, 2009, at 9:29 PM, Adam Gerson wrote:


I have a view that looks just fine in interface builder. When I
display it in a window in my app it cuts off the bottom part of the
content. Visual:

http://screencast.com/t/YEXgqlAcP

What could cause this?


Looks to me like you've probably got the wrong resizing attributes on  
either the scrollview or its superview.


-jcr

___

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

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

Help/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 search for mop3 files, retrieve those file and play these file into apps

2009-03-05 Thread haresh vavdiya
I tried SpotLight examples. Its working but the problem is that it search
mp3 file in /user/emp/Music directorynot for all directoriesactually
i stored my songs oon Desktop/Songs/*.mp3but it doesn't search for
that..what should i do for full search.

On Fri, Mar 6, 2009 at 10:48 AM, Kyle Sluder  wrote:

> On Thu, Mar 5, 2009 at 4:41 AM, haresh vavdiya 
> wrote:
> >So i have to search for ".mp3" files in all folders and then
> > display into table. Can anyone tell me that how can i search, retrieve
> .mp3
> > file and play this particular file into my apps.
>
> We have this amazing technology called Spotlight, have you thought of using
> it?
>
> --Kyle Sluder
>
___

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

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

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

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


Re: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Graham Cox


On 06/03/2009, at 4:27 PM, Jeff Laing wrote:


Why not just have those methods be the ones that display the EULA in a
modal window, if required, then continue on as normal (if the user
accepts, of course!)



Ah, thank you - seems obvious, and indeed, works. :)


--Graham


___

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

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

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

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


Re: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Andy Lee

On Mar 5, 2009, at 11:21 PM, Graham Cox wrote:
My app needs to show an EULA on start-up (yes, I know, but what can  
you do?). Handling this is all fine, but I need the modal dialog  
that is shown to completely block the normal start-up of the app  
until it completes.


Right now I show the dialog using [NSApp runModalForWindow:] and I  
call that from the app delegate's appWillFinishLaunching method. The  
problem is the normal start-up of the app, including creating an  
untitled doc, etc. continues behind the dialog.


I do something similar, but I do the runModalForWindow: in the app  
delegate's awakeFromNib.  If I move it to  
applicationWillFinishLaunching: I get the same problem you do.  On the  
other hand, my app doesn't open documents, so this may not solve your  
problem.


--Andy


___

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

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

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

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


Re: CoreData, SyncServices & NSURL ...

2009-03-05 Thread Kyle Sluder
Do you even need to write your own transformer?  If you are targeting
Leopard and later, you could just use a transformable attribute and
leave it all up to the default NSKeyedArchiver transformer.

--Kyle Sluder
___

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

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

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

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


Re: More user agent questions

2009-03-05 Thread Kyle Sluder
On Thu, Mar 5, 2009 at 9:58 PM, Rick Mann  wrote:
> Our product (on the network) periodically updates its own software, and that
> update may include a new version of the Mac software. When the agent checks
> in and sees there's a new version, we'd like it to update ASAP,
> transparently (no user intervention required).

Is this a custom app?  If it's a commercial app, then I'd be very
upset to find my app updating itself without my permission.

> Can any running instance (even if it's not for an admin user) shut down and
> relaunch other instances? Can it update launchd configuration as necessary
> for the other users?

Maybe and no, respectively.  To get the shutdown behavior, your agents
would need to check in with each other and whichever performs the
update needs to tell the others to shut down.  A regular user can't
update another user's launchd settings, though.

> If the UI is running, it will present a Sparkle-like dialog to warn the user
> that a new version is available. It may time out after a period of time and
> force the update. Basically, if our product updates its software, it's
> important that the Mac software update as well, otherwise things might break
> (we have no backward-compatibility requirement).

I'm having a hard time figuring out under what circumstances you would
need to force the update.  Since you talk about administrative users,
I'm inclined to think that this is not a custom app, but a commercial
one.  I can imagine the seething rage exploding after the first time
the app forces its own update.

Also, what is this "Mac software" -- actual system software, or your
own software?  Are you saying that you would forcibly restart the
machine after applying the update?  This is a very bad idea.

> How do people deal with their agents running when there are multiple users
> logged in?

IPC.  Maybe have instances check the local port nameserver for other
instances to communicate with.  It's your problem to solve.

--Kyle Sluder
___

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

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

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

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


Re: NSTask - Notification and Threads

2009-03-05 Thread Seth Willits

On Mar 5, 2009, at 2:45 PM, Ken Thomases wrote:

Yeah.  You can provide feedback for the documentation to ask for  
clarification.


Done. :-)


So, it's not even sufficient that the launch thread continues to  
exist, it must run its run loop.


Good point.


By the way, you don't necessarily need to use a condition lock to  
learn when the task has been launched.  If you have the secondary  
thread tell the main thread to launch the task using - 
performSelectorOnMainThread:withObject:waitUntilDone: and pass YES  
for the wait parameter, you get that synchronization pretty simply.


Yes, you're right. Though since I've been bitten by the  
waitUntilDone:YES behavior before (entirely my fault), I was trying to  
think of a new way to avoid it and still achieve a similar result.




Alrighty, thanks Ken. Just looking to see that I had my head on  
straight. Looks like I did. :)



Cheerio,

--
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: Thread usage : Main thread interrupting secondary thread

2009-03-05 Thread Miles
Sorry to bump this but it's driving me nuts. Even knowing if this sounds
expected or unexpected would be really helpful at this point, so I can
figure out where to go from here to solve this problem.
Thanks again, in advance.


On Thu, Mar 5, 2009 at 12:43 PM, Miles  wrote:

>
> I'm new to using threads and hitting an unexpected issue.
>
> *There is an object moving across the screen on a separate thread started
> like this:*
>
> [NSThread detachNewThreadSelector:@selector( startObjectsAnimation: )
> toTarget:animationHelper withObject:nil];
>
> * Then in animationHelper:*
>
> NSAutoreleasePool *autoreleasepool = [[NSAutoreleasePool alloc] init];
> animationTimer = [NSTimer scheduledTimerWithTimeInterval:0.02 target:self
> selector:@selector(doAnimation: ) userInfo:nil repeats:YES];
> [[NSRunLoop currentRunLoop] addTimer:animationTimer
> forMode:NSDefaultRunLoopMode];
> [[NSRunLoop currentRunLoop] run];
> [autoreleasepool release];
>
>
> *Then I have another object that when touched, gets a fade animation
> applied to it (on the main thread):*
>
> CAAnimationGroup *anim = [AnimationCreatorUtil
> createAnimationsForOnWayOut];
> anim.delegate= tv;
> [[tv.mview layer] addAnimation:anim forKey:@"fade"];
> [tv.mview setAlpha:0];
>
> This is happening on the main thread. However, when this fade animation is
> applied on the main thread, the animation of the other object on the
> secondary thread pauses for a really brief moment. Since they are happening
> on different threads I'd expect neither of them to affect one another. What
> could be causing this?
>
> 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: Thread usage : Main thread interrupting secondary thread

2009-03-05 Thread Kyle Sluder
You bumped a 10-hour old message.  You might want to have a bit of patience.

Have you considered that the threads are vying for a lock?  Why are
you using threads anyway?  Core Animation runs its own threads for
you, and you're working with the runloop, which provides some measure
of asynchronicity without resorting to multithreading.

Perhaps you might consider learning more about threading before
attempting to use it.  It is a very, *very* difficult concurrency
technique.

--Kyle Sluder
___

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

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

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

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


Re: [Q] NSObject's poseAsClass - Replacement?

2009-03-05 Thread Quincey Morris

On Mar 5, 2009, at 21:17, John C. Randolph wrote:


On Mar 5, 2009, at 12:00 PM, Eric Gorr wrote:



On Mar 5, 2009, at 2:47 PM, Benjamin Stiglitz wrote:

Although, this bug is not quite confirmed yet, but I suspect I know  
what the problem is.


I am working on a Carbon -> Cocoa conversion. In the carbon part,  
the cursor is being set to a 64x64 cursor constantly - via NSCursor  
set. The problem comes when I move the cursor over a cocoa view  
which I believe, by default, changing the cursor to what it wants -  
which I believe is a 32x32 cursor.


So, in the constantly fighting over what the cursor should be,  
there is some weird cursor behavior...it flickers - moves quickly  
to a nearby location and then back again.


That's a band-aid, not a solution.  Figure out why the carbon code  
is constantly trying to change the cursor, and fix it.


Or, go back one more step and try to figure out why it flickers.

FWIW, I ran into a bug (this was in an earlier version of Leopard, and  
I haven't tried to check whether it still exists) where setting a  
custom image via [NSCursor set] caused the cursor to jump around and  
display some trash pixels (in a flickery sort of way) when the custom  
image had blocks of transparent pixels at its edges. (For example, if  
the actual cursor was 24 x 24 placed within a transparent 32 x 32  
image.) The workaround was to trim the transparent pixels from the  
image (make it 24 x 24, for example).


So, it may be that the flickering has nothing to do with how often the  
cursor is being set. If the 64 x 64 cursor in this case is a custom  
image, and if the actual, non-transparent pixel bounds are smaller  
than 64 x 64, and if the bug is still there, you may avoid the problem  
by using a smaller image.


As I said, FWIW.


___

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

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

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

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


Re: Thread usage : Main thread interrupting secondary thread

2009-03-05 Thread Miles
Thanks for the response, Kyle-

I'm trying to wrap my head around threading and this is my first experiment
with it. I've been doing lots of reading on it but it'll take awhile to sink
in.

I'm trying to use threads because I sometimes animate lots of objects every
0.02 seconds and it bogs things down.

-M




On Thu, Mar 5, 2009 at 11:00 PM, Kyle Sluder  wrote:

> You bumped a 10-hour old message.  You might want to have a bit of
> patience.
>
> Have you considered that the threads are vying for a lock?  Why are
> you using threads anyway?  Core Animation runs its own threads for
> you, and you're working with the runloop, which provides some measure
> of asynchronicity without resorting to multithreading.
>
> Perhaps you might consider learning more about threading before
> attempting to use it.  It is a very, *very* difficult concurrency
> technique.
>
> --Kyle Sluder
>
___

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

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

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

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