Re: CoreData, SyncServices NSURL ...

2009-03-06 Thread Mic Pringle
One of the reasons I use a transformer is so that I can bind the
resulting string to a column in a tableview. How would I go about
doing this if I didn't use a transformer, as you suggest ?

Also, I think I may have got somewhere with this. I was under the
impression that it was the stored managed object that was pushed to
sync services, but it turns out that it's not. It's a dictionary
containing keys and values/objects that represent that managed object.
So if I implement the following method in my delegate

persistentStoreCoordinator:willPushRecord:forManagedObject:inSyncSession:

It gives me access to that dictionary before it's pushed, which means
that I should be able to remove the URL string that's currently being
passed and replace it with an instance of NSURL.

All this is just theory though as I've not yet had time to test it out.

-Mic

2009/3/6 Kyle Sluder kyle.slu...@gmail.com:
 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


Extract components from PDF page

2009-03-06 Thread malcom
Hello guys
Is possible to get the components of a PDFPage? I should to take
images and text from the page and put each of these inside a file.
Any suggestion?
___

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

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

Help/Unsubscribe/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-06 Thread matt . gough


On 5 Mar 2009, at 21:00, 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.




and then you said:
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.



Well, if you are worried about 64-bit then your Carbon UI code won't  
work anyway so you'd have to be all Cocoa, at which point the normal  
NSCursor handling should suffice. The fact that it is deprecated in  
10.5 is just a heads-up to not use it if possible, but if you still do  
need to use it in your Carbon-Cocoa hybrid, then use it. I imagine  
that 32-built Carbon UI will disappear from the OS before 32-bit Cocoa  
support.


Matt
___

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

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

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

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


NSToolbar EXC_BAD_ACCESS after configuration (leopard)

2009-03-06 Thread John Boydon

Hello everybody,

I have a problem with NSToolbar in leopard. May be I am using it in a  
wrong way.


In order to mutually enable/disable two toolbar items, I created a  
boolean variable in the delegate class and bound the toolbar items to  
it using Enabled entry in the Interface Builder Inspector.


The two toolbar items are then bound to selectors where the state of  
the boolean variable is modified. In this way when one item is enabled  
the other one is disabled. Something similar to Play and Pause in a  
media player.


The toolbar items are enabled/disabled according with the variable  
value and their behavior is correct. But after a toolbar customization  
(just display the customization panel is enough) any operation on  
toolbar that involves a modification of the boolean variable produces  
a EXC_BAD_ACCESS.


Any idea about this?

I created a simple test that can be downloaded from: 
http://www.savefile.com/files/2029001
(this file will be deleted in 30 days).

regards
john
--
John Boydon

___

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

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

Help/Unsubscribe/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-06 Thread Eric Gorr


On Mar 6, 2009, at 12:03 AM, Michael Ash wrote:

On Thu, Mar 5, 2009 at 3:00 PM, Eric Gorr mail...@ericgorr.net  
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.


Ultimately, yes. At the moment, it may actually be possible...still  
looking into it.


But, I am still curious what alternatives there are to poseAsClass: ...

___

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

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

Help/Unsubscribe/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-06 Thread Eric Gorr


On Mar 6, 2009, at 2:05 AM, Quincey Morris wrote:


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.


It flickers because of the switch between using a standard NSCursor  
and a cursor based on a 64x64 NSImage. I believe this is a known bug  
or at least behavior that has been seen before by others. In any case,  
it is fairly easy to reproduce and I do plan to write a simple test  
app and submit a bug report.


___

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

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

Help/Unsubscribe/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-06 Thread Eric Gorr


On Mar 6, 2009, at 12:01 AM, Graham Cox wrote:



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.


I believe there is a technique where by your write a separate  
application which does nothing but show your dialog and then launches  
your real application. Of course, you would have to find a way to  
forward document open AppleEvents and perhaps other things, but it  
should work.


Unfortunately, I don't have the link to this kind of technique in  
front of me at the moment...


___

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

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

Help/Unsubscribe/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-06 Thread haresh vavdiya
Problem is solved now its giving all the mp3 files which are stored in my
machine.

But another problem is also there. Like, i have stored my favorites songs on
desktop and then i transferred these songs to iTunes, so all these songs are
also available on iTunes music, So when i search then it gives me same songs
twiceThen i thought that i will separate based on songs name.

But when i downloaded songs that time the name of song is 4onetwothree.mp3
means strating from moview name, but when i moved to iTunes it has stored
name based on orignal name, so name also differenet, so i cant check that
this is same or not?

is there any solution for that?



On Fri, Mar 6, 2009 at 11:11 AM, haresh vavdiya vavdiyahar...@gmail.comwrote:

 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 kyle.slu...@gmail.comwrote:

 On Thu, Mar 5, 2009 at 4:41 AM, haresh vavdiya vavdiyahar...@gmail.com
 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: NSStatusItem when clicked shows custom view

2009-03-06 Thread Clint Shryock
Matt Gemmell has MAAttachedWindow, a sub class of NSWindow listed here:
http://mattgemmell.com/source

it comes with a sample project that shows it working with an NSStatusItem.
 See if that will suit your needs

+Clint


On Thu, Mar 5, 2009 at 1:03 PM, Chris Purcell haroldthehun...@mac.comwrote:

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

 This email sent to cts...@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: A question about NSPredicateEditor and NSPredicateEditorRowTemplate

2009-03-06 Thread David Hoerl

[following up to a Jan 08 thread]

  is it possible to modify the width of the NSTextField representing 

 a Number in a NSPredicateEditorRowTemplate ?


Yes, but not yet in Interface Builder.  To do so programatically, get 
the row template, get the text field as the last member of the row 
template's templateViews array, and set its frame to the size you want.


I hope that helps,
-Peter



Peter, I tried to do as you suggest - set the frames to what I want, 
but it has no effect. Any other suggestions?


David

PS: code

-applicationDidFinishLaunching
...
int i = 0;
NSArray *temps = [predicateEditor rowTemplates];
for(NSPredicateEditorRowTemplate *temp in temps) {
NSArray *views = [temp templateViews];
int j = 0;
int x = 0;
for(NSControl *view in views) { // I know, view is not a good 
name for this :-)
NSLog(@temp=%@ view=%@ frame: %@, temp, view, 
NSStringFromRect([view frame])); // verify all is connected

if(i==0) continue; // don't touch first one
NSRect r = [view frame];
r.origin.x = 0; // just for testing impact...
[view setFrame:r];
NSLog(@ mod frame=%@, NSStringFromRect([view frame])); 
// yes, it took

++j;
}
++i;
}
___

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

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

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

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


Newbie query re notifications

2009-03-06 Thread McLaughlin, Michael P.
I have been using notifications in a simple document app that processes data
from a datafile.  This app has a document window and an appDelegate, both of
which appear in IB with the proper connections.  The document can
successfully send notifications to the appDelegate and the latter can send
notifications to itself. All of this is OK.

Today, I realized that I should have a separate class for some of the data
processing.  This separate class, SatManager, has no GUI elements and does
not appear in IB in any way.  Its implementation includes

- (id)init
{
   self = [super init];
   if (self) {
  NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
  [nc addObserver:self selector:@selector(getGPS) name:@fetchGPS
object:nil];
   }
   return self;
}

The appDelegate includes

- (void)initCase
{
...
  [[NSNotificationQueue defaultQueue] enqueueNotification: [NSNotification
notificationWithName:@fetchGPS
object:nil] postingStyle:NSPostWhenIdle];
}

This enqueueing worked fine when getGPS() was a method of appDelegate but
not now when getGPS() is a method of SatManager.  Now, the notification does
not reach getGPS() even though the SatManager addObserver() call gave no
errors.

Am I oversimplifying something?  Do I need to do more to pass notifications
around -- like add something in IB, perhaps?

TIA.

-- 
Mike McLaughlin

___

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

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

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

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


Supported platforms?

2009-03-06 Thread Bill Cheeseman
I will try to tread carefully around NDA boundaries with this remark.  
Perhaps someone in authority can e-mail me privately with the  
information I need -- or at least make sure that future announcements  
to qualified NDA signatories like me are revised to contain the  
information.


Here goes: The seed notes for a certain rumored system software  
upgrade that we're all interested in do not specify -- and they never  
have specified, in my memory -- the minimum supported platform,  
namely, PPC vs. Intel. I don't yet own an Intel machine. So the only  
way I can find out if it will be worth my while to download the 6 Gig  
file, burn it to a dual-layer DVD and install it is, well, to download  
the 6 Gig file, burn it to a dual-layer DVD and install it. The answer  
to my question will be conveyed by the presence or absence of an error  
message after I've done all that.


That isn't a very user-friendly way to convey the information I need.  
Since the seed notes are available via a tiny RTF file, it would be  
helpful to people like me and harmless to Apple if the seed notes were  
to contain this information. (I am aware that the rumor sites like to  
treat this question as a hot issue. If Apple sees this as a problem,  
the seed note could deal with the rumor sites by including a  
disclaimer warning that the ability or inability to install the seed  
release on a PPC machine implies nothing about the final release.)


--

Bill Cheeseman
b...@cheeseman.name

___

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

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

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

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


interpretKeyEvents not handling HOME and END keys?

2009-03-06 Thread Eric Gorr

I found this old thread:

http://lists.apple.com/archives/cocoa-dev/2004/Sep/msg00161.html

which discusses the same problem I am currently experiencing.

As near as I can tell, interpretKeyEvents: does not call any method to  
handle these key presses.


Has something changed that I am unaware of or should I just go off and  
file what I am sure is a duplicate bug report?



___

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

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

Help/Unsubscribe/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-06 Thread Eric Gorr


On Mar 5, 2009, at 9:32 AM, Eric Gorr wrote:



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.



This ended up being the solution...

I make a duplicate of the string I am about to draw, remove characters  
from it and insert an ellipsis at the end of the string until the  
string fits into a container which is the same size as the view I am  
drawing into.



I am still curious why drawing the string line by line wasn't working  
as expected. Is it is bug?


___

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

Please do not post admin requests or moderator comments to the 

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

2009-03-06 Thread Michael Ash
On Fri, Mar 6, 2009 at 9:21 AM, haresh vavdiya vavdiyahar...@gmail.com wrote:
 Problem is solved now its giving all the mp3 files which are stored in my
 machine.

 But another problem is also there. Like, i have stored my favorites songs on
 desktop and then i transferred these songs to iTunes, so all these songs are
 also available on iTunes music, So when i search then it gives me same songs
 twiceThen i thought that i will separate based on songs name.

 But when i downloaded songs that time the name of song is 4onetwothree.mp3
 means strating from moview name, but when i moved to iTunes it has stored
 name based on orignal name, so name also differenet, so i cant check that
 this is same or not?

 is there any solution for that?

1) Figure out what definition of same you want to use.

2) Write code that implements a check for your definition of same.

3) Place that code in your app to filter out files that match your
definition of same.

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: Newbie query re notifications

2009-03-06 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 11:18 AM, McLaughlin, Michael P. mp...@mitre.org wrote:
 Today, I realized that I should have a separate class for some of the data
 processing.  This separate class, SatManager, has no GUI elements and does
 not appear in IB in any way.  Its implementation includes

Classes whose names end in Manager are often signs of bad
architecture.  Be careful how you approach this factorization.

 This enqueueing worked fine when getGPS() was a method of appDelegate but
 not now when getGPS() is a method of SatManager.  Now, the notification does
 not reach getGPS() even though the SatManager addObserver() call gave no
 errors.

From your use of parentheses, it looks like you're more familiar with
Java or C# or other such languages.  In Objective-C, you can send any
message you want to any object you want.  I could send an instance of
your SatManager class a method called -jumpOffABridge if I wanted to.

Are you sure you've defined -[SatManager getGPS]?  Check the run
console for messages about unrecognized selectors.

--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: EXC_BAD_ACCESS in _class_changeInfo

2009-03-06 Thread Dave DeLong
After some rather indepth testing, I found out that I hadn't declared  
the static arrays correctly (sigh...).  Fixing the declarations fixed  
the crashing problem, but led to other ones (unrelated, I think).  I  
was eventually able to fix it.


Dave

On Mar 3, 2009, at 9:04 AM, Greg Parker wrote:

Most likely, you've sent a message to an invalid object, or to a  
valid object that was mangled by a memory error elsewhere. Usually  
that will crash inside objc_msgSend() itself, but if your bogus  
object happens to include dereferenceable pointers in the right  
places then the Objective-C runtime will happily traverse the  
object and isa and method cache and class info and finally  
fall over somewhere like the +initialize machinery as seen here.


Debug it as if it had crashed in objc_msgSend() itself. Make sure  
the memory management of the receiver is good, and if it is then  
look for other memory errors that might have clobbered it. NSZombie  
and Guard Malloc are probably your new best friends.

___

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

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

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

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


Re: NSStatusItem when clicked shows custom view

2009-03-06 Thread Chris Purcell

Thanks Clint and Ben,

MAAttachedWindow is exactly what I needed!

--Chris

On Mar 6, 2009, at 6:21 AM, Clint Shryock wrote:

Matt Gemmell has MAAttachedWindow, a sub class of NSWindow listed  
here:

http://mattgemmell.com/source

it comes with a sample project that shows it working with an  
NSStatusItem.  See if that will suit your needs


+Clint


On Thu, Mar 5, 2009 at 1:03 PM, Chris Purcell  
haroldthehun...@mac.com wrote:
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/cts3e1%40gmail.com

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


Determine colorlist/-name after NSColorPanel

2009-03-06 Thread Matthias Arndt

Hi!

I think of redesigning the way colors can be selected in one of my  
apps: Currently I use NSPopupButtons an entry for every color and I'd  
like to move to NSColorWalls / NSColorPanel with predefined lists.  
These lists should represent color palettes, here threads of different  
vendors or different materials.


Is there any way to determine if a selected color was picked from a  
list? If so, can I identify the list and the color's key (or index)  
within this list?


For the user e. g. Red from list A is not the same as Red from list B,  
so I need this information ...


Today I tested a bit with catalogNameComponent and  
colorNameComponent, but always received an exception. I tried to  
convert the selected color into NSNamedColorSpace, but didn't get it  
work. Has anybody got an example or a hint?


Any help is appreciated, Mattes 
  
___


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

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

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

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


Re: Newbie query re notifications -- SOLVED

2009-03-06 Thread McLaughlin, Michael P.
Error was of the typo variety.  Too embarrassing to describe further :-(
 
-- 
Mike McLaughlin

___

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

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

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

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


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

2009-03-06 Thread Sean McBride
On 3/6/09 4:01 PM, Graham Cox said:

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.

I actually used a DTS incident on this very issue.  As you say, it is
hard to get exactly right (if you want finesse).  In the end, I got
about 90% of the way to perfect.

I ended up doing the following:

- subclassing NSDocumentController
- giving it 2 modes: normal and queuing
- in normal mode it works like super
- in queuing mode, I queue any kAEPrintDocuments and kAEOpenDocuments
that I receive
- I set it to queue mode in applicationWillFinishLaunching (which is
before any kAEPrintDocuments/kAEOpenDocuments arrive)
- in applicationDidFinishLaunching I show my splash screen
- at this point the user may try to open or print documents, but I don't
want them to appear, but nor do I want them to be lost
- when OK is clicked in the splash screen, I end queuing mode and
process items in the queue
- if there are no items in the queue I call [self
openUntitledDocumentAndDisplay:error:]
- if there are items in the queue I call [super
openDocumentWithContentsOfURL:display:error:]
- also I implement applicationShouldOpenUntitledFile to return yes if
I'm in normal mode, and no if I'm in queuing mode.

This all works well for kAEOpenDocuments, but not so well for
kAEPrintDocuments.  The problem is that in
openDocumentWithContentsOfURL:display:error: (where I conditionally add
to the queue) I have no way to know if its an kAEPrintDocuments or a
kAEOpenDocuments.  My app doesn't actually print, so I gave up at that point.

Would be nice if NSApplication had a delegate message like
applicationWillFinishLaunching that gives you a chance to show a modal
ok/cancel dialog at launch.  Please create a dupe. :)

--

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: interpretKeyEvents not handling HOME and END keys?

2009-03-06 Thread Sean McBride
On 3/6/09 11:46 AM, Eric Gorr said:

I found this old thread:

http://lists.apple.com/archives/cocoa-dev/2004/Sep/msg00161.html

which discusses the same problem I am currently experiencing.

On 10.5?  I don't know when it started, but the home and end keys 'do
the right thing' with NSTableView for me in 10.5 (they didn't used to).

--

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


Dynamic getting of a property of BOOL type

2009-03-06 Thread Brad O'Hearne
I am dynamically retrieving properties from an NSObject, in order to  
convert the types to string values and store them in XML. I am using  
the following line of code to send a message to the object to  
retrieve  the property's value:


id value = objc_msgSend(object, propSelector);
BOOL booleanValue = (BOOL)value;

The problem I am having is that I'm getting a warning on the second  
line. I've tried a number of variations, including:


BOOL booleanValue = value;

both of which give the following warning:

warning:  cast from pointer to integer of different size

How can I properly convert this id returned from the dynamic  
invocation of the property getter to the BOOL value that it actually is?


Thanks,

Brad
___

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

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

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

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


Re: interpretKeyEvents not handling HOME and END keys?

2009-03-06 Thread Eric Gorr


On Mar 6, 2009, at 1:29 PM, Sean McBride wrote:


On 3/6/09 11:46 AM, Eric Gorr said:


I found this old thread:

http://lists.apple.com/archives/cocoa-dev/2004/Sep/msg00161.html

which discusses the same problem I am currently experiencing.


On 10.5=3F  I don't know when it started, but the home and end keys  
'do
the right thing' with NSTableView for me in 10.5 (they didn't used  
to).


Unfortunately, I have my own custom table view, not based on  
NSTableView, and would like to be able to do the right thing as well.


Now, I can, of course, test for NSHomeFunctionKey  NSEndFunctionKey,  
but as was mentioned in the thread, this isn't guaranteed to always do  
the right thing.


If it is a bug that NSResponder does not have a  
scrollToBeginningOfDocument or scrollToEndOfDocument, I can file a bug  
report.


___

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

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

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

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


Moving a window offscreen

2009-03-06 Thread Jonathan Dann

Hi All,

In my application I want to create an image of a document window as a  
preview prior to displaying the window to the user. To obtain the  
CGImage of a displayed window is simple enough using the CGWindow API  
as shown below:


- (CGImageRef)CGImage;
{
	return CGWindowListCreateImage(CGRectNull,  
kCGWindowListOptionIncludingWindow, [self windowNumber],  
kCGWindowImageDefault);

}

The problem comes when trying to display the window initially at a far- 
off position so I can create the image and the move the window onto  
the screen.


Setting the origin of the window to a point with large +ve or -ve  
ordinates causes the window to appear at the edge of the main screen,  
partly shown.


Has anybody any experience with either a) rendering an entire window  
into a bitmap instead of to the screen, or b) moving the window  
offscreen completely? If b) is possible, would the above code work for  
such a window?


Thanks for your help,

Jonathan

http://espresso-served-here.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: Dynamic getting of a property of BOOL type

2009-03-06 Thread Nick Zitzmann


On Mar 6, 2009, at 11:35 AM, Brad O'Hearne wrote:

How can I properly convert this id returned from the dynamic  
invocation of the property getter to the BOOL value that it actually  
is?



You need to do this to get it to work correctly:

BOOL boolValue = ((BOOL (*)(id, SEL))objc_msgSend)(anObject, aSelector);

Nick Zitzmann
http://www.chronosnet.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: Dynamic getting of a property of BOOL type

2009-03-06 Thread Paul Sanders
 id value = objc_msgSend(object, propSelector);
 BOOL booleanValue = (BOOL)value;

 How can I properly convert this id returned from the dynamic  
 invocation of the property getter to the BOOL value that it actually is?

Try BOOL booleanValue = (BOOL) (long) value;

I believe this should also work on 64 bit.

___

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

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

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

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


Re: Dynamic getting of a property of BOOL type

2009-03-06 Thread Paul Sanders
 id value = objc_msgSend(object, propSelector);
 BOOL booleanValue = (BOOL)value;

 How can I properly convert this id returned from the dynamic  
 invocation of the property getter to the BOOL value that it actually is?

Try BOOL booleanValue = (BOOL) (long) value;

I believe this should also work on 64 bit. ++ (As would Nick's solution)
___

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

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

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

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


Re: Newbie query re notifications

2009-03-06 Thread Matt Neuburg
On Fri, 6 Mar 2009 11:18:56 -0500, McLaughlin, Michael P.
mp...@mitre.org said:
  [nc addObserver:self selector:@selector(getGPS) name:@fetchGPS
object:nil];

Well, that's never going to work. There are two possibilities here:

(1) Maybe you've defined

- (void) getGPS: (NSNotification*) n

But in that case it will never be called because its name is getGPS:, and
you said getGPS which is not the same thing.

(2) Maybe you've defined

- (void) getGPS

But in that case it will never be called because that is not the format of
an eligible notification callback.

As the docs say, The method the selector specifies must have one and only
one argument.

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
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: interpretKeyEvents not handling HOME and END keys?

2009-03-06 Thread Sean McBride
On 3/6/09 1:37 PM, Eric Gorr said:

If it is a bug that NSResponder does not have a
scrollToBeginningOfDocument or scrollToEndOfDocument, I can file a bug
report.

IMNSHO yes.  Note that /System/Library/Frameworks/AppKit.framework/
Resources/StandardKeyBinding.dict contains items with those names.
Also, if you class-dump AppKit you'll see scrollToEndOfDocument in
NSTableView and NSTextView.  Mention rdar://3799975 in your bug.

--

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: interpretKeyEvents not handling HOME and END keys?

2009-03-06 Thread Eric Gorr


On Mar 6, 2009, at 2:04 PM, Sean McBride wrote:


On 3/6/09 1:37 PM, Eric Gorr said:


If it is a bug that NSResponder does not have a
scrollToBeginningOfDocument or scrollToEndOfDocument, I can file a  
bug

report.


IMNSHO yes.  Note that /System/Library/Frameworks/AppKit.framework/
Resources/StandardKeyBinding.dict contains items with those names.
Also, if you class-dump AppKit you'll see scrollToEndOfDocument in
NSTableView and NSTextView.  Mention rdar://3799975 in your bug.


bug report added:  rdar://6654819

___

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

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

Help/Unsubscribe/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-06 Thread Rick Mann

Thanks for the suggestions.

On Mar 5, 2009, at 22:49:34, Kyle Sluder wrote:

On Thu, Mar 5, 2009 at 9:58 PM, Rick Mann rm...@latencyzero.com  
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.


I have voiced my opposition internally to automatic updates, and been  
ignored. However, in this context, it's not as bad as your typical  
commercial app. I really can't say more about it just now.


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.


I'm not sure about the distinction you're making between custom and  
commercial. Our product is a stand-alone consumer electronics system  
that happens to have software you can optionally install on Windows  
(ew) or Mac OS X (yay). The difficulty we face is that the main  
product can update itself at any time (typically in the middle of the  
night), and with that might come an incompatibility with the Mac (or  
Windoze) software.



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.


It is our own software. We would never restart the machine. Only our  
software.


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.


I honestly think it's a problem for Apple to solve, and here's why:  
They provide a mechanism by which per-user software can be made to  
run, and they provide a multi-user environment. What happens if three  
users are logged in, and two of them are running iTunes, and the  
current user gets a software update for iTunes? Obviously one user  
doesn't care (not running iTunes). Is the current user able to update  
iTunes, given that another instance is running? What if the non- 
current user is in the middle of burning a CD?


If iTunes solves the problem, what does Pages do? Do they also solve  
it, perhaps with slightly different behavior? This is a system-wide  
problem that affects almost any app, background or not. It would be  
nice to have support and guidance from Apple.


Anyway, thanks for the suggestions, we'll add them to our  
considerations.



--
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: Newbie query re notifications

2009-03-06 Thread Paul Sanders
 But in that case it will never be called because its name is getGPS:, and
 you said @selector(getGPS) which is not the same thing.

Yes, that one gets me every time.  Why, when you do 
@selector(oops_i_forgot_the_colon) does the compiler not flag it as an error 
(or at least a warning).  Can you put any old thing in the brackets there? 

___

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

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

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

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


NSImage/NSBitmapImageRep color shifts when creating scaled copy

2009-03-06 Thread Steve Christensen
I'm trying to create a scaled-down copy of a large NSBitmapImageRep  
(i.e., 3200x2400 - 320x240). The smaller image eventually gets  
passed to OpenGL for drawing. What I'm finding is that the copy has  
color shifted. When I draw the copy, it appears to be darker and more  
saturated than the original.


I have tried several ways to get a copy that has the same color  
characteristics as the original but no success so far. My simplest  
version looks like this:


NSRect resizedBounds = {NSZeroPoint, desiredBitmapSize};
NSImage* resizedImage = [[[NSImage alloc]  
initWithSize:resizedBounds.size] autorelease];


[resizedImage lockFocus];
[[NSGraphicsContext currentContext]  
setImageInterpolation:NSImageInterpolationHigh];
[image drawInRect:resizedBounds fromRect:NSZeroRect  
operation:NSCompositeCopy fraction:1.0];

[resizedImage unlockFocus];

bitmapImage = [NSBitmapImageRep imageRepWithData:[resizedImage  
TIFFRepresentation]];



Am I missing something or is this just how Quartz works? Is there  
another way to get there? I'm not wedded to NSImage and friends if a  
better solution exists elsewhere. This needs to run on 10.4 or later.


Thanks,
steve

___

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

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

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

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


NSDrawNinePartImage draws slowly in CALayer

2009-03-06 Thread Sebastian Morsch

Hello,

I wrote a delegate that draws a bezel inside a CALayer using  
NSDrawNinePartImage. The drawing happens inside the  
drawLayer:inContext: method and it works well. The only problem is  
that it redraws really slow when the layers frame is resized by the  
user.


The layer is simply attached to a custom view for testing the whole  
thing. This view is the only view of a window, and when I resize that  
window, my layer is resized too. But it feels very clunky.


I was wondering if I'm doing something really stupid here... Does  
anybody know if there's a better way to tackle this?


Thank you!
Sebastian




There's no other code than these two methods in my custom view:

- (void)awakeFromNib {

CALayer *rootLayer = [CALayer layer];
rootLayer.delegate = self;
rootLayer.needsDisplayOnBoundsChange = YES;

[self setLayer:rootLayer];
[self setWantsLayer:YES];

[rootLayer setNeedsDisplay];
}

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {

CGRect boundsRect = CGContextGetClipBoundingBox(ctx);

// Draw colored interior
CGRect bgRect = CGRectInset(boundsRect, 1.0, 1.0);
CGColorRef color = CGColorCreateGenericRGB(0.0, 0.0, 1.0, 0.2);
CGContextSetFillColorWithColor(ctx, color);
CGContextFillRect(ctx, bgRect);

// Draw bezel
NSDrawNinePartImage(
NSRectFromCGRect(boundsRect),
[NSImage 
imageNamed:@ClipFrame-N-TL],
[NSImage 
imageNamed:@ClipFrame-N-T],
[NSImage 
imageNamed:@ClipFrame-N-TR],
[NSImage 
imageNamed:@ClipFrame-N-L],
[NSImage 
imageNamed:@ClipFrame-N-C],
[NSImage 
imageNamed:@ClipFrame-N-R],
[NSImage 
imageNamed:@ClipFrame-N-BL],
[NSImage 
imageNamed:@ClipFrame-N-B],
[NSImage 
imageNamed:@ClipFrame-N-BR],
NSCompositeSourceOver,
1.0,
NO);
}

___

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

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

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

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


Re: Dynamic getting of a property of BOOL type

2009-03-06 Thread Clark Cox
On Fri, Mar 6, 2009 at 10:53 AM, Paul Sanders p.sand...@dsl.pipex.com wrote:
 id value = objc_msgSend(object, propSelector);
 BOOL booleanValue = (BOOL)value;

 How can I properly convert this id returned from the dynamic
 invocation of the property getter to the BOOL value that it actually is?

 Try BOOL booleanValue = (BOOL) (long) value;

 I believe this should also work on 64 bit. ++ (As would Nick's solution)

To put it bluntly, Nick's solution is the correct way to do this. Just
casting the return value may work for now, but there are no
guarantees.

-- 
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: NSDrawNinePartImage draws slowly in CALayer

2009-03-06 Thread Jean-Daniel Dupas


Le 6 mars 09 à 20:33, Sebastian Morsch a écrit :


Hello,

I wrote a delegate that draws a bezel inside a CALayer using  
NSDrawNinePartImage. The drawing happens inside the  
drawLayer:inContext: method and it works well. The only problem is  
that it redraws really slow when the layers frame is resized by the  
user.


The layer is simply attached to a custom view for testing the whole  
thing. This view is the only view of a window, and when I resize  
that window, my layer is resized too. But it feels very clunky.


I was wondering if I'm doing something really stupid here... Does  
anybody know if there's a better way to tackle this?


Thank you!
Sebastian




There's no other code than these two methods in my custom view:

- (void)awakeFromNib {

CALayer *rootLayer = [CALayer layer];
rootLayer.delegate = self;
rootLayer.needsDisplayOnBoundsChange = YES;

[self setLayer:rootLayer];
[self setWantsLayer:YES];

[rootLayer setNeedsDisplay];
}

- (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {

CGRect boundsRect = CGContextGetClipBoundingBox(ctx);

// Draw colored interior
CGRect bgRect = CGRectInset(boundsRect, 1.0, 1.0);
CGColorRef color = CGColorCreateGenericRGB(0.0, 0.0, 1.0, 0.2);
CGContextSetFillColorWithColor(ctx, color);
CGContextFillRect(ctx, bgRect);

// Draw bezel
NSDrawNinePartImage(
NSRectFromCGRect(boundsRect),
[NSImage 
imageNamed:@ClipFrame-N-TL],
[NSImage 
imageNamed:@ClipFrame-N-T],
[NSImage 
imageNamed:@ClipFrame-N-TR],
[NSImage 
imageNamed:@ClipFrame-N-L],
[NSImage 
imageNamed:@ClipFrame-N-C],
[NSImage 
imageNamed:@ClipFrame-N-R],
[NSImage 
imageNamed:@ClipFrame-N-BL],
[NSImage 
imageNamed:@ClipFrame-N-B],
[NSImage 
imageNamed:@ClipFrame-N-BR],
NSCompositeSourceOver,
1.0,
NO);
}



If you want to know why your code is slow, use the Xcode Debug Menu   
Launch Using Performance Tool  Shark.


Shark will give you better and more accurate answer.

My guess is that you are creating the images at each call, which  
require to read them from disk, and decode them and is very slow.


Just an other details, instead of creating the color at each call, you  
can use CGContextSetRGBFillColor(ctx, 0, 0, 1, .2).




___

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

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

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

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


Performance degrades dramatically in [NSManagedObjectContext executeFetchRequest:error:]

2009-03-06 Thread Oleksiy Gorelov
Hello Al!  
Summary: It looks like [NSManagedObjectContext 
executeFetchRequest:error:] starts to evaluate a predicate ([NSPredicate 
evaluateWithObject:]) with objects that was not requested and was not fetched 
from a database.  
Our application makes prefetching of CoreData 
entities with relationships like  

NSFetchRequest* requestRelatedTags = [[[  NSFetchRequest   
alloc]   init]   autorelease];
[requestRelatedTags setEntity: [NSEntityDescription 
entityForName: kFSIValueElementA inManagedObjectContext 
   : [ md managedObjectContext]] ];[requestRelatedTags  
   setFetchLimit: 100 ];NSPredicate * predicate = [ 
   NSPredicate predicateWithFormat: @(self IN %@),[items  
   valueForKey:@objectID]];[requestRelatedTags 
setPredicate:predicate];
[requestRelatedTags setRelationshipKeyPathsForPrefetching: [
NSArray arrayWithObjects:@tags,nil
]];[requestRelatedTags setReturnsObjectsAsFaults:
true];items0_ = [[md managedObjectC
ontext] executeFetchRequest: requestRelatedTags error:  
   nil];

where items is an array of 100 NSManagedObjects, tags is 
to-many relationship of the kFSIValueElementA entity with inverse to-one 
relationship.  
At start this code works quickly and takes fixed amount of time 
(0.03-0.04 sec) every time. But at some point it starts to work very slowly 
taking more and more time. Instruments shows that it fetches 100 objects every 
time from a database. But Shark shows that it uses [NSPredicate 
evaluateWithObject:] more and more times. To be precise, it invokes 
[NSPredicate evaluateWithObject:] 100 times more every time. [NSPredicate 
evaluateWithObject:] is invoked every time from [NSManagedObjectContext 
executeFetchRequest: error:].  
We added logging to [NSPredicate evaluateWithObject:] and we see 
that it is evaluated on objets that was not requested by the fetch request and 
was not fetched from the SQLite database. Thus this is a bug in 
[NSManagedObjectContext executeFetchRequest:error:]. It should not filter 
objects that was not.  

Does anybody have any ideas how to solve this problem?  
Best Regards,  Oleksiy Gorelov  
___

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

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

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

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


Re: Newbie query re notifications

2009-03-06 Thread Joar Wingfors


On Mar 6, 2009, at 11:21 AM, Paul Sanders wrote:


Yes, that one gets me every time.  Why, when you do
@selector(oops_i_forgot_the_colon) does the compiler not flag it as  
an error
(or at least a warning).  Can you put any old thing in the brackets  
there?



I'd suggest using:

-Wundeclared-selector

j o a r


___

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

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

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

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


Performance degrades dramatically in [NSManagedObjectContext executeFetchRequest:error:]

2009-03-06 Thread Oleksiy Gorelov
Hello All!                                     Summary: It looks like 
[NSManagedObjectContext executeFetchRequest:error:] starts to evaluate a 
predicate ([NSPredicate evaluateWithObject:]) with objects that was not 
requested and was not fetched from a database.                              
       Our application makes prefetching of CoreData entities with 
relationships like                                    NSFetchRequest* 
requestRelatedTags = [[[NSFetchRequest alloc] init] autorelease];      
[requestRelatedTags setEntity:[NSEntityDescription entityForName : 
kFSIValueElementA inManagedObjectContext : [md managedObjectContext ]] ];       
 [requestRelatedTags setFetchLimit: 100 ];                
NSPredicate * predicate = [ NSPredicate predicateWithFormat: @(self IN 
%@),[items valueForKey: @objectID]];        [requestRelatedTags 
setPredicate:predicate];            [requestRelatedTags 
setRelationshipKeyPathsForPrefetching : [ N
SArray arrayWithObjects: @tags, nil]];[requestRelatedTags 
setReturnsObjectsAsFaults: true];                items0_ = [[md 
managedObjectContext] executeFetchRequest : requestRelatedTags error: nil];     
                 
where items is an array of 100 NSManagedObjects, tags is to-many 
relationship of the kFSIValueElementA entity with inverse to-one relationship.  
              
At start this code works quickly and takes fixed amount of time 
(0.03-0.04 sec) every time. But at some point it starts to work very slowly 
taking more and more time. Instruments shows that it fetches 100 objects every 
time from a database. But Shark shows that it uses [NSPredicate 
evaluateWithObject:] more and more times. To be precise, it invokes 
[NSPredicate evaluateWithObject:] 100 times more every time. [NSPredicate 
evaluateWithObject:] is invoked every time from [NSManagedObjectContext 
executeFetchRequest: error:].                         We added logging 
to [NSPredicate evaluateWithObject:] and we see that it is evaluated on objets 
that was not requested by the fetch request and was not fetched from the SQLite 
database. Thus this is a bug in [NSManagedObjectContext 
executeFetchRequest:error:]. It should not filter objects that was not.         
       
Does anybody have any ideas how to solve this problem?              
Best Regards,Oleksiy Gorelov        
___

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

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

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

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


Performance degrades dramatically in [NSManagedObjectContext executeFetchRequest:error:]

2009-03-06 Thread Oleksiy Gorelov
Hello All!

(this is the same in plain text)  
   
Summary: It looks like [NSManagedObjectContext executeFetchRequest:error:] 
starts to evaluate a predicate ([NSPredicate evaluateWithObject:]) with objects 
that was not requested and was not fetched from 
a database.  
   
Our application makes prefetching of CoreData entities with relationships like  

  
NSFetchRequest* requestRelatedTags = [[[NSFetchRequest alloc] init] 
autorelease];  
[requestRelatedTags setEntity:[NSEntityDescription entityForName : 
kFSIValueElementA inManagedObjectContext : [md managedObjectContext ]] ];   
 
[requestRelatedTags setFetchLimit: 100 ];
NSPredicate * predicate = [ NSPredicate predicateWithFormat: @(self IN 
%@),[items valueForKey: @objectID]];
[requestRelatedTags setPredicate:predicate];
[requestRelatedTags setRelationshipKeyPathsForPrefetching : [ NSArray 
arrayWithObjects: @tags, nil]];
[requestRelatedTags setReturnsObjectsAsFaults: true];
items0_ = [[md managedObjectContext] executeFetchRequest : requestRelatedTags 
error: nil];

where items is an array of 100 NSManagedObjects, tags is to-many 
relationship of the kFSIValueElementA entity with inverse to-one relationship.  


At start this code works quickly and takes fixed amount of time (0.03-0.04 sec) 
every time. But at some point it starts to work very slowly taking more and 
more time. Instruments shows that it fetches 100 objects 
every time from a database. But Shark shows that it uses [NSPredicate 
evaluateWithObject:] more and more times. To be precise, it invokes 
[NSPredicate evaluateWithObject:] 100 times more every time. 
[NSPredicate evaluateWithObject:] is invoked every time from 
[NSManagedObjectContext executeFetchRequest: error:].  
   
We added logging to [NSPredicate evaluateWithObject:] and we see that it is 
evaluated on objets that was not requested by the fetch request and was not 
fetched from the SQLite database. Thus this is a bug 
in [NSManagedObjectContext executeFetchRequest:error:]. It should not filter 
objects that was not.  

Does anybody have any ideas how to solve this problem?  

Best Regards,
Oleksiy Gorelov  
___

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

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

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

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


Re: A question about NSPredicateEditor and NSPredicateEditorRowTemplate

2009-03-06 Thread Peter Ammon


On Mar 6, 2009, at 6:42 AM, David Hoerl wrote:


[following up to a Jan 08 thread]


 is it possible to modify the width of the NSTextField representing

a Number in a NSPredicateEditorRowTemplate ?


Yes, but not yet in Interface Builder.  To do so programatically,  
get the row template, get the text field as the last member of the  
row template's templateViews array, and set its frame to the size  
you want.


I hope that helps,
-Peter



Peter, I tried to do as you suggest - set the frames to what I want,  
but it has no effect. Any other suggestions?


David

PS: code

-applicationDidFinishLaunching
...
   int i = 0;
   NSArray *temps = [predicateEditor rowTemplates];
   for(NSPredicateEditorRowTemplate *temp in temps) {
   NSArray *views = [temp templateViews];
   int j = 0;
   int x = 0;
   for(NSControl *view in views) { // I know, view is not a good  
name for this :-)
   NSLog(@temp=%@ view=%@ frame: %@, temp, view,  
NSStringFromRect([view frame])); // verify all is connected

   if(i==0) continue; // don't touch first one
   NSRect r = [view frame];
   r.origin.x = 0; // just for testing impact...
   [view setFrame:r];
   NSLog(@ mod frame=%@, NSStringFromRect([view  
frame])); // yes, it took

   ++j;
   }
   ++i;
   }


David, the above code changes the frame origin, but not the frame  
width.  Changing the frame origin will have no effect (the origins are  
controlled by NSPredicateEditor).  But changing the width should have  
an effect.


-Peter


___

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

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

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

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


Re: NSDrawNinePartImage draws slowly in CALayer

2009-03-06 Thread Jean-Daniel Dupas


Le 6 mars 09 à 20:42, Jean-Daniel Dupas a écrit :



Le 6 mars 09 à 20:33, Sebastian Morsch a écrit :


Hello,

I wrote a delegate that draws a bezel inside a CALayer using  
NSDrawNinePartImage. The drawing happens inside the  
drawLayer:inContext: method and it works well. The only problem is  
that it redraws really slow when the layers frame is resized by the  
user.


The layer is simply attached to a custom view for testing the whole  
thing. This view is the only view of a window, and when I resize  
that window, my layer is resized too. But it feels very clunky.


I was wondering if I'm doing something really stupid here... Does  
anybody know if there's a better way to tackle this?


Thank you!
Sebastian





If you want to know why your code is slow, use the Xcode Debug Menu  
 Launch Using Performance Tool  Shark.




To be exact, this is the Menu

Run  Start With Performance Tool  Shark


Shark will give you better and more accurate answer.

My guess is that you are creating the images at each call, which  
require to read them from disk, and decode them and is very slow.


Just an other details, instead of creating the color at each call,  
you can use CGContextSetRGBFillColor(ctx, 0, 0, 1, .2).


___

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

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

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

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


Re: Newbie query re notifications

2009-03-06 Thread Jean-Daniel Dupas


Le 6 mars 09 à 20:47, Joar Wingfors a écrit :



On Mar 6, 2009, at 11:21 AM, Paul Sanders wrote:


Yes, that one gets me every time.  Why, when you do
@selector(oops_i_forgot_the_colon) does the compiler not flag it as  
an error
(or at least a warning).  Can you put any old thing in the brackets  
there?




Of course you can put anything. Else how would you be able to create a  
method and a selector at runtime ?




I'd suggest using:

-Wundeclared-selector

j o a r


___

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

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

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

This email sent to devli...@shadowlab.org



___

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

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

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

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


Re: EXC_BAD_ACCESS in _class_changeInfo

2009-03-06 Thread Eric Gorr


On Mar 3, 2009, at 11:04 AM, Greg Parker wrote:


NSZombie and Guard Malloc are probably your new best friends.


Information on NSZombie and other cool stuff can be found here:

Technical Note TN2124
Mac OS X Debugging Magic
http://developer.apple.com/technotes/tn2004/tn2124.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: Newbie query re notifications

2009-03-06 Thread Paul Sanders
 I'd suggest using:
 -Wundeclared-selector

 j o a r

Excellent.  Thank you.

 Of course you can put anything. Else how would you be able to create a
 method and a selector at runtime ?

So how does the compiler map any old string to a SEL (which is just a 
number)?  Is it some kind of hash (in which case how can you be sure it is 
unique) or is it something else?  Inquiring minds want to know. 

___

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

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

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

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


Re: Dynamic getting of a property of BOOL type

2009-03-06 Thread Paul Sanders
From Clark S. Cox III.  This answers a question that has kindof been in my 
mind for a while and I felt it was useful enough to post back to the list.

PS: be as blunt as you like :)

--

objc_msgSend and friends are special. They expect to be called *as if*
they were defined with the same parameters and return type as the
method being called. In the case of BOOL, it is unlikely that id and
BOOL would be returned in different ways, butnits best to always do
the right thing whenever possible.

Sent from my iPhone

On Mar 6, 2009, at 12:22, Paul Sanders wrote:

 To put it bluntly, Nick's solution is the correct way to do this.
 Just
 casting the return value may work for now, but there are no
 guarantees.

 Why not?  It seems to me that the two approaches are equivalent.  Both
 assume that objc_msgSend will return something that can be cast to a
 BOOL.
 The difference is purely one of style.

 Nick's solution has the advantage that one does not need to assume
 that
 sizeof (long) == sizeof (id) in both 32 and 64 bit mode.  Our
 messages - his
 and mine - crossed in the post.

 PS: You could cast via an NSInteger, which I believe is meant to
 represent
 the native word length of the machine, but that is only defined in
 the 10.5
 SDK and later.

___

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

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

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

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


Using NSExceptionHandler causes a linker error

2009-03-06 Thread Paul Sanders
I am trying to make use of the services of NSExceptionHandler in my code, but 
when I do so I get a linker error.  Perhaps someone can help.  Code:

#import ExceptionHandling/NSExceptionHandler.h
...
NSExceptionHandler *nseh = [NSExceptionHandler defaultExceptionHandler];

The linker error is an undefined symbol: .objc_class_name_NSExceptionHandler

I get the same error with both the 10.4 and 10.5 SDK's and I can't find any 
obvious solution.  The framework appears to exist OK (in 
/Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks, and also in the 
MacOSX10.5.sdk).  If it were windows, I would be looking for a .lib to link 
against but things seem a little different in Mac world...

TIA - Paul Sanders.
___

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

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

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

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


Why is my UIColor white actually gray?

2009-03-06 Thread James Cicenia

Hello -

I have a table view with dynamic subclassed cells :

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString *)identifier
{
if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];


		UIImageView *imageView = [[UIImageView alloc] initWithImage:  
produceImage];

[self.contentView addSubview:imageView];
[imageView release];

CGRect frame = CGRectMake(60, 0, 140, 60);
produceName = [[UILabel alloc] initWithFrame:frame];
produceName.backgroundColor = [UIColor clearColor];
produceName.opaque = YES;
produceName.textAlignment = UITextAlignmentLeft;
produceName.textColor = [UIColor whiteColor];
produceName.font = [UIFont boldSystemFontOfSize:16];
[self.contentView addSubview:produceName];
[produceName release];

}

return self;
}


BUT The font is hard to read and actually gray and not white?

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: Why is my UIColor white actually gray?

2009-03-06 Thread Alex Kac

Could it be anti-aliased?

On Mar 6, 2009, at 2:57 PM, James Cicenia wrote:


Hello -

I have a table view with dynamic subclassed cells :

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString  
*)identifier

{
if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];


		UIImageView *imageView = [[UIImageView alloc] initWithImage:  
produceImage];

[self.contentView addSubview:imageView];
[imageView release];

CGRect frame = CGRectMake(60, 0, 140, 60);
produceName = [[UILabel alloc] initWithFrame:frame];
produceName.backgroundColor = [UIColor clearColor];
produceName.opaque = YES;
produceName.textAlignment = UITextAlignmentLeft;
produceName.textColor = [UIColor whiteColor];
produceName.font = [UIFont boldSystemFontOfSize:16];
[self.contentView addSubview:produceName];
[produceName release];

   }

   return self;
}


BUT The font is hard to read and actually gray and not white?

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/alex%40webis.net

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible  
worlds; and the pessimist fears this is true.

-- James Clabell




___

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

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

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

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


Re: Using NSExceptionHandler causes a linker error

2009-03-06 Thread Joar Wingfors

Paul,

You need to add the ExceptionHandling.framework to your project, and  
set it to be part of your target. That's how you tell Xcode to make  
the target link to it.


* Right-click in the Groups  Files pane
* Select Add  Existing Frameworks...

j o a r



On Mar 6, 2009, at 12:56 PM, Paul Sanders wrote:

I am trying to make use of the services of NSExceptionHandler in my  
code, but when I do so I get a linker error.  Perhaps someone can  
help.  Code:


#import ExceptionHandling/NSExceptionHandler.h
...
NSExceptionHandler *nseh = [NSExceptionHandler  
defaultExceptionHandler];


The linker error is an undefined  
symbol: .objc_class_name_NSExceptionHandler


I get the same error with both the 10.4 and 10.5 SDK's and I can't  
find any obvious solution.  The framework appears to exist OK (in / 
Developer/SDKs/MacOSX10.4u.sdk/System/Library/Frameworks, and also  
in the MacOSX10.5.sdk).  If it were windows, I would be looking for  
a .lib to link against but things seem a little different in Mac  
world...


___

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

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

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

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


Re: Newbie query re notifications

2009-03-06 Thread Jean-Daniel Dupas


Le 6 mars 09 à 21:25, Paul Sanders a écrit :


I'd suggest using:
-Wundeclared-selector



j o a r


Excellent.  Thank you.

Of course you can put anything. Else how would you be able to  
create a

method and a selector at runtime ?


So how does the compiler map any old string to a SEL (which is just a
number)?  Is it some kind of hash (in which case how can you be sure  
it is

unique) or is it something else?  Inquiring minds want to know.


Conceptually:

It defined a selector reference:

SEL * _arbitrary_string_selector;

and then @selector(my_arbitrary_string) is replaced by   
*_arbitrary_string_selector;


It also generates some data in the __OBJC segment of the binary to  
tell the objc runtime to initialize the selector pointed by the  
reference at load time.


@selector() is not considered as a constant value. You cannot use it  
in static initialization for example (the compiler will report an  
error).



___

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

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

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

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


Re: NSImage/NSBitmapImageRep color shifts when creating scaled copy

2009-03-06 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 2:21 PM, Steve Christensen puns...@mac.com wrote:
 I'm trying to create a scaled-down copy of a large NSBitmapImageRep (i.e.,
 3200x2400 - 320x240). The smaller image eventually gets passed to OpenGL
 for drawing. What I'm finding is that the copy has color shifted. When I
 draw the copy, it appears to be darker and more saturated than the original.

Sounds like you're falling victim to this problem:
http://www.4p8.com/eric.brasseur/gamma.html

--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: Why is my UIColor white actually gray?

2009-03-06 Thread James Cicenia

Hmm,
What do you mean?

Thanks
James

On Mar 6, 2009, at 3:00 PM, Alex Kac wrote:


Could it be anti-aliased?

On Mar 6, 2009, at 2:57 PM, James Cicenia wrote:


Hello -

I have a table view with dynamic subclassed cells :

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString  
*)identifier

{
if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];


		UIImageView *imageView = [[UIImageView alloc] initWithImage:  
produceImage];

[self.contentView addSubview:imageView];
[imageView release];

CGRect frame = CGRectMake(60, 0, 140, 60);
produceName = [[UILabel alloc] initWithFrame:frame];
produceName.backgroundColor = [UIColor clearColor];
produceName.opaque = YES;
produceName.textAlignment = UITextAlignmentLeft;
produceName.textColor = [UIColor whiteColor];
produceName.font = [UIFont boldSystemFontOfSize:16];
[self.contentView addSubview:produceName];
[produceName release];

  }

  return self;
}


BUT The font is hard to read and actually gray and not white?

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/alex%40webis.net

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible  
worlds; and the pessimist fears this is true.

-- James Clabell






___

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

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

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

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


Re: Why is my UIColor white actually gray?

2009-03-06 Thread Alex Kac
Well if the text is anti-aliased (which it is by default in a  
UILabel), then the center of the text would be white, but the edges  
are gray to help make it smooth. If the font is small enough, it can  
look gray and not pure white.


On Mar 6, 2009, at 3:17 PM, James Cicenia wrote:


Hmm,
What do you mean?

Thanks
James

On Mar 6, 2009, at 3:00 PM, Alex Kac wrote:


Could it be anti-aliased?

On Mar 6, 2009, at 2:57 PM, James Cicenia wrote:


Hello -

I have a table view with dynamic subclassed cells :

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString  
*)identifier

{
if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];


		UIImageView *imageView = [[UIImageView alloc] initWithImage:  
produceImage];

[self.contentView addSubview:imageView];
[imageView release];

CGRect frame = CGRectMake(60, 0, 140, 60);
produceName = [[UILabel alloc] initWithFrame:frame];
produceName.backgroundColor = [UIColor clearColor];
produceName.opaque = YES;
produceName.textAlignment = UITextAlignmentLeft;
produceName.textColor = [UIColor whiteColor];
produceName.font = [UIFont boldSystemFontOfSize:16];
[self.contentView addSubview:produceName];
[produceName release];

 }

 return self;
}


BUT The font is hard to read and actually gray and not white?

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/alex%40webis.net

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible  
worlds; and the pessimist fears this is true.

-- James Clabell








Alex Kac - President and Founder
Web Information Solutions, Inc.

I am not young enough to know everything.
--Oscar Wilde




___

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

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

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

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


window wont close with command-w

2009-03-06 Thread Aaron Wallis

Hi there,

I've created a preference window for an app i'm working on, and for  
some reason it won't close when i press command-w?

is there something in particular I need to setup for that to happen?

Cheers
___

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

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

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

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


Re: window wont close with command-w

2009-03-06 Thread Nick Zitzmann


On Mar 6, 2009, at 2:27 PM, Aaron Wallis wrote:

I've created a preference window for an app i'm working on, and for  
some reason it won't close when i press command-w?

is there something in particular I need to setup for that to happen?



Are you sure you have a close menu item, and that it is hooked up  
correctly in IB, and it is also being validated correctly?


Nick Zitzmann
http://www.chronosnet.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: Why is my UIColor white actually gray?

2009-03-06 Thread James Cicenia

I don't see any property for antialiasing on or off.

How do I turn it off to see?

On Mar 6, 2009, at 3:21 PM, Alex Kac wrote:

Well if the text is anti-aliased (which it is by default in a  
UILabel), then the center of the text would be white, but the edges  
are gray to help make it smooth. If the font is small enough, it can  
look gray and not pure white.


On Mar 6, 2009, at 3:17 PM, James Cicenia wrote:


Hmm,
What do you mean?

Thanks
James

On Mar 6, 2009, at 3:00 PM, Alex Kac wrote:


Could it be anti-aliased?

On Mar 6, 2009, at 2:57 PM, James Cicenia wrote:


Hello -

I have a table view with dynamic subclassed cells :

- (id)initWithFrame:(CGRect)aRect reuseIdentifier:(NSString  
*)identifier

{
if (self = [super initWithFrame:aRect reuseIdentifier:identifier])
{
self.selectionStyle = UITableViewCellSelectionStyleNone;
		[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];


		UIImageView *imageView = [[UIImageView alloc] initWithImage:  
produceImage];

[self.contentView addSubview:imageView];
[imageView release];

CGRect frame = CGRectMake(60, 0, 140, 60);
produceName = [[UILabel alloc] initWithFrame:frame];
produceName.backgroundColor = [UIColor clearColor];
produceName.opaque = YES;
produceName.textAlignment = UITextAlignmentLeft;
produceName.textColor = [UIColor whiteColor];
produceName.font = [UIFont boldSystemFontOfSize:16];
[self.contentView addSubview:produceName];
[produceName release];

}

return self;
}


BUT The font is hard to read and actually gray and not white?

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/alex%40webis.net

This email sent to a...@webis.net


Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible  
worlds; and the pessimist fears this is true.

-- James Clabell








Alex Kac - President and Founder
Web Information Solutions, Inc.

I am not young enough to know everything.
--Oscar Wilde






___

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

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

Help/Unsubscribe/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 change the Installer.app path of files in a XCode project

2009-03-06 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 3:46 PM, learnfromforum learnfromforum
learnfromfo...@yahoo.com wrote:
 But in the Get Info window, there is only Choose button for changing the 
 path of this file. And Installer.app is not a directory so that I can not go 
 to its sub directories.

Installer.app is just as much of a directory on 10.5 as it was on
10.4.  Application bundles *are* directories.

--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: Why is my UIColor white actually gray?

2009-03-06 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 4:37 PM, James Cicenia ja...@jimijon.com wrote:
 I don't see any property for antialiasing on or off.

 How do I turn it off to see?

You don't.  Aliased text is more commonly known as the jaggies and
can be particularly hard to read.

--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: Why is my UIColor white actually gray?

2009-03-06 Thread David Duncan

On Mar 6, 2009, at 12:57 PM, James Cicenia wrote:

[self setImage:[[UIImage imageNamed:@WF-MyLocBu- 
DistBack.png]autorelease]];



Unrelated, but don't do this. You don't have ownership to the results  
of +imageNamed:, so you should not be releasing or autoreleasing it.

--
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: NSImage/NSBitmapImageRep color shifts when creating scaled copy

2009-03-06 Thread Steve Christensen

On Mar 6, 2009, at 1:15 PM, Kyle Sluder wrote:

On Fri, Mar 6, 2009 at 2:21 PM, Steve Christensen puns...@mac.com  
wrote:
I'm trying to create a scaled-down copy of a large  
NSBitmapImageRep (i.e.,
3200x2400 - 320x240). The smaller image eventually gets passed to  
OpenGL
for drawing. What I'm finding is that the copy has color shifted.  
When I
draw the copy, it appears to be darker and more saturated than the  
original.


Sounds like you're falling victim to this problem:
http://www.4p8.com/eric.brasseur/gamma.html


In this case what I found out was running into a difference of  
opinion between the ColorSync profile attached to the  
NSBitmapImageRep in the source image and the default one (or lack of  
one) for a newly-created NSBitmapImageRep in the resized image.


I ended up rewriting my code to create a new NSBitmapImageRep with  
the destination size, then copy what I thought were relevant  
properties (NSImageRGBColorTable, NSImageColorSyncProfileData,  
NSImageGamma) from the source NSBitmapImageRep if they exist. Then  
create a context using +[NSGraphicsContext  
graphicsContextWithBitmapImageRep:] using the destination  
NSBitmapImageRep and draw into that.


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: How to change the Installer.app path of files in a XCode project

2009-03-06 Thread I. Savant
On Fri, Mar 6, 2009 at 3:46 PM, learnfromforum learnfromforum
learnfromfo...@yahoo.com wrote:

 In the Resources directory of an open source XCode project (developed under 
 Mac 10.4), there are some image files:
...
 Now, I want to change the directory path of these three .tif filesfrom 
 /Applications/Utilities/Installer.app/Contents/Resources/DotBlue.tif to  
 /System/Library/CoreServices/Installer.app/Contents/Resources/DotBlue.tif

  This belongs on the xcode-users list, not cocoa-dev ... it has
nothing at all to do with Cocoa. Please use the appropriate list for
your questions.

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


loading agent with launchd gets Bus Error

2009-03-06 Thread Rick Mann
If I let launchd launch my user agent, (via .plist file in ~/Library/ 
LaunchAgents), I get a Bus Error, even if all I do is call NSLog()  
from main and then return.


Also, load or load -w result in nothing to load from launchctl.

If I launch my agent from the command line or from Xcode, it seems to  
run fine. It has LSUIElement set to true in it's Info.plist.


Any ideas what I'm doing wrong? TIA!

My plist looks like this (after launchctl unformatted it):

?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
keyKeepAlive/key
true/
keyLabel/key
stringcom.test.test/string
keyLimitLoadToSessionType/key
stringAqua/string
keyProgram/key
	string/Users/rmann/Desktop/TestAgents/build/Debug/TestAgents.app/ 
Contents/Resources/Agent.app/Contents/MacOS/Agent/string

/dict
/plist

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


When to release an NSThread instance

2009-03-06 Thread Stuart Malin
I have a main thread method that allocates an NSThread object and  
inits with initWithTarget:selector:object.  I then invoke the NSTask  
instance with -start.


The specified selector is invoked, and there performs a background  
task that takes some time. When it is done, that method invokes a  
callback using performSelectorOnMainThread:withObject:waitUntilDone.   
That callback selector updates the applications U/I to reflect the  
outcome of the background task.


After invoking the callback, the background task method cleans up,  
releases its autorelease pool, and then control reaches the end of the  
method.  I am under the impression that having the method reach the  
end is sufficient to have the thread end. Is that correct? or do I  
need to invoke the thread instance with -exit ?


Big question: how do I release the memory associated with the  
allocated task instance?  I have two notions:


1) have the main thread callback autorelease the thread instance

2) have the thread autorelease itself at the end of the background  
task method after it invokes the callback (which is invokes  
with ...waitUntilDone:YES).


I know I am treading in dangerous waters with threads... but the  
background activity can take many seconds, and I want the U/I  
responsive while the background activity is being performed.



___

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

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

Help/Unsubscribe/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-06 Thread Graham Cox


On 07/03/2009, at 4:41 AM, Sean McBride wrote:


I actually used a DTS incident on this very issue.  As you say, it is
hard to get exactly right (if you want finesse).  In the end, I got
about 90% of the way to perfect.

I ended up doing the following:

- subclassing NSDocumentController
- giving it 2 modes: normal and queuing
- in normal mode it works like super
- in queuing mode, I queue any kAEPrintDocuments and kAEOpenDocuments
that I receive
- I set it to queue mode in applicationWillFinishLaunching (which is
before any kAEPrintDocuments/kAEOpenDocuments arrive)
- in applicationDidFinishLaunching I show my splash screen
- at this point the user may try to open or print documents, but I  
don't

want them to appear, but nor do I want them to be lost
- when OK is clicked in the splash screen, I end queuing mode and
process items in the queue
- if there are no items in the queue I call [self
openUntitledDocumentAndDisplay:error:]
- if there are items in the queue I call [super
openDocumentWithContentsOfURL:display:error:]
- also I implement applicationShouldOpenUntitledFile to return yes if
I'm in normal mode, and no if I'm in queuing mode.

This all works well for kAEOpenDocuments, but not so well for
kAEPrintDocuments.  The problem is that in
openDocumentWithContentsOfURL:display:error: (where I conditionally  
add

to the queue) I have no way to know if its an kAEPrintDocuments or a
kAEOpenDocuments.  My app doesn't actually print, so I gave up at  
that point.


Would be nice if NSApplication had a delegate message like
applicationWillFinishLaunching that gives you a chance to show a modal
ok/cancel dialog at launch.  Please create a dupe. :)



Wow, that does seem involved... It was the seeds of a solution like  
this bubbling up in my head that had me in a bit of a panic, given my  
time constraints. I did file an enhancement request, #6653022


I tried Jeff Laing's suggestion of just handling the dialog in  
response to both -applicationShouldOpenUntitledFile and  
application:openFile: and as far as I can see that is sufficient - it  
defers the opening of both new and file documents until the dialog is  
dismissed. I haven't tried it for the print documents case - I will  
make sure I test that, as I do print.


Using -awakeFromNib also ought to work as Andy Lee suggested, though I  
haven't tried it since Jeff's is working so far.


Thanks to everyone for their help,

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


archiving NSPrintInfo created via initWithDictionary crashes

2009-03-06 Thread kvic...@pobox.com

on 10.5.6 the following code snippet:

NSPrintInfo* sp = [NSPrintInfo sharedPrintInfo];
NSDictionary* dict = [sp dictionary];
NSPrintInfo* pi = [[NSPrintInfo alloc] initWithDictionary: dict];
NSData* piData = [NSKeyedArchiver archivedDataWithRootObject: pi];

will crash with the following:

*** Terminating app due to uncaught exception 
'NSInvalidArgumentException', reason: '*** -[NSKeyedArchiver 
encodeValueOfObjCType:at:]: this archiver cannot encode structs'



with the call stack:

#0  0x96772fb4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___
#1  0x96051e3b in objc_exception_throw
#2  0x96772eeb in +[NSException raise:format:arguments:]
#3  0x96772f2a in +[NSException raise:format:]
#4  0x9689935e in -[NSKeyedArchiver encodeValueOfObjCType:at:]
#5  0x96969a71 in -[NSValue encodeWithCoder:]
#6  0x967e6d2d in _encodeObject
#7  0x9685742d in -[NSKeyedArchiver _encodeArrayOfObjects:forKey:]
#8  0x96806146 in -[NSDictionary(NSDictionary) encodeWithCoder:]
#9  0x967e6d2d in _encodeObject
#10 0x946caa14 in -[NSPrintInfo encodeWithCoder:]
#11 0x967e6d2d in _encodeObject
#12 0x967e64a8 in +[NSKeyedArchiver archivedDataWithRootObject:]
#13 0x1f3e in main at main.m:19

however, the following doesn't crash:

NSPrintInfo* sp = [NSPrintInfo sharedPrintInfo];
NSDictionary* dict = [sp dictionary];
NSPrintInfo* pi = [[NSPrintInfo alloc] initWithDictionary: dict];
[pi description];
NSData* piData = [NSKeyedArchiver archivedDataWithRootObject: pi];

filed as radar #:  6656704
___

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

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

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

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


Extreme Crashing from QT Movie Layers in Core Animation

2009-03-06 Thread Seth Willits


I really really really hate to cross-post this, but I'm not sure which  
list to send this to.


I have an extremely simple application playing three QuickTime movies  
in three QTMovieLayers. When the movie ends I simply restart it from  
within the notification callback. That and fading the opacity of the  
layers is the only remotely tricky thing I'm doing in the entire  
application, but a client is report *weird* crashes on the final  
machine the app will run on. (On my own, and other machines here and  
there it works just fine).


The crash reports are at: 
http://www.sethwillits.com/temp/QTCoreAnimationCrashes.zip

One of the weird things is that there are hundreds of threads in each  
report:


Thread 43:
0   libSystem.B.dylib   0x919b04e2 semaphore_wait_trap + 10
1   QuickTimeH264.scalar  	0x2831a6eb JVTCompEncodeFrame +  
3088012

2   ??? 0x262762e0 0 + 640115424


The actual crashed thread and stack are different in almost every one  
of the 8 crashes I have. There's no pattern to it. One the stack  
traces for the *entire* crashed thread is:


Thread 0 Crashed:
0   QuickTimeH264.scalar  	0x28c55796 JVTCompEncodeFrame +  
3284791



And it's thread 0 for crying out loud!

I'd bet the farm that it's not my fault, so really the only thing I  
can think of is a crazy memory smashing bug somewhere in QT or Core  
Animation.





Could anyone look at some of these and see if anything stands out?

I really have no idea what to do. ;'-(


--
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: When to release an NSThread instance

2009-03-06 Thread Roland King
if you don't need to reference the thread again you can just release  
it (and the target object used in initWithTarget:selector:object) as  
soon as you've called -(void)start on it. You are correct that the  
thread will exit when the method you are calling finishes and you  
don't need to call exit. When an NSThread is started it retains its  
target object and argument and the thread itself is retained  
presumably by some subsystem which manages threads. When the task is  
complete the target object and argument are released and the NSThread  
is released automatically too. So


MyTargetObject  *target = [ [ MyTargetObject alloc ] init ];
MyArgObject *arg  = [ [ MyArgObject alloc ] init ];

NSThread *t = [ [ NSThread alloc ] initWithTarget:target  
selector:@selector( someMethod: ) object:arg ];

[ t start ];

// in any order you like
[ target release ];
[ arg release ];
[ t release ];

should work fine.


On Mar 7, 2009, at 7:55 AM, Stuart Malin wrote:

I have a main thread method that allocates an NSThread object and  
inits with initWithTarget:selector:object.  I then invoke the NSTask  
instance with -start.


The specified selector is invoked, and there performs a background  
task that takes some time. When it is done, that method invokes a  
callback using  
performSelectorOnMainThread:withObject:waitUntilDone.  That callback  
selector updates the applications U/I to reflect the outcome of the  
background task.


After invoking the callback, the background task method cleans up,  
releases its autorelease pool, and then control reaches the end of  
the method.  I am under the impression that having the method reach  
the end is sufficient to have the thread end. Is that correct? or do  
I need to invoke the thread instance with -exit ?


Big question: how do I release the memory associated with the  
allocated task instance?  I have two notions:


1) have the main thread callback autorelease the thread instance

2) have the thread autorelease itself at the end of the background  
task method after it invokes the callback (which is invokes  
with ...waitUntilDone:YES).


I know I am treading in dangerous waters with threads... but the  
background activity can take many seconds, and I want the U/I  
responsive while the background activity is being performed.



___

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

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

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

This email sent to r...@rols.org


___

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

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

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

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


Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Graham Cox
I'm implementing a plug-in scheme based on Rainer Brockerhoff's design  
at http://cocoadevcentral.com/articles/68.php


So far it's working fine, but I decided I wanted to use a particular  
extension for my plug-in files. When I do that, the bundles revert to  
looking like ordinary folders in the Finder, and can be simply opened  
like any folder.


How can I set the 'package' setting when I build my bundle project so  
that it's treated as a single package? I can't see a build setting for  
doing this in the project, and simply adding 'LSTypeIsPackage' to my  
bundle's info.plist has no effect.


--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: Extreme Crashing from QT Movie Layers in Core Animation

2009-03-06 Thread Sean McBride
Seth Willits (sli...@araelium.com) on 2009-03-06 8:28 PM said:

I'd bet the farm that it's not my fault, so really the only thing I
can think of is a crazy memory smashing bug somewhere in QT or Core
Animation.

I assume you've tried with guard malloc, etc. then?...  Try the hardware
test cd for that Mac... maybe try a memory testing app?

Sean


___

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

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

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

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


Re: Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Michael Vannorsdel
Use FSSetCatalogInfo and set the finderInfo (interpreted as a  
FolderInfo struct) and add the kHasBundle bit to the finderFlags of  
the FolderInfo.



On Mar 6, 2009, at 8:31 PM, Graham Cox wrote:

'm implementing a plug-in scheme based on Rainer Brockerhoff's  
design at http://cocoadevcentral.com/articles/68.php


So far it's working fine, but I decided I wanted to use a particular  
extension for my plug-in files. When I do that, the bundles revert  
to looking like ordinary folders in the Finder, and can be simply  
opened like any folder.


How can I set the 'package' setting when I build my bundle project  
so that it's treated as a single package? I can't see a build  
setting for doing this in the project, and simply adding  
'LSTypeIsPackage' to my bundle's info.plist has no effect.


___

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

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

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

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


Re: Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Michael Vannorsdel
This is the manual way to do it I might add.  Not sure why the  
document type settings are not being used.  Sometimes you need to  
rebuild launch services database.



On Mar 6, 2009, at 9:02 PM, Michael Vannorsdel wrote:

Use FSSetCatalogInfo and set the finderInfo (interpreted as a  
FolderInfo struct) and add the kHasBundle bit to the finderFlags of  
the FolderInfo.


___

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

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

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

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


Re: Moving a window offscreen

2009-03-06 Thread Michael Ash
On Fri, Mar 6, 2009 at 1:38 PM, Jonathan Dann j.p.d...@gmail.com wrote:
 Hi All,

 In my application I want to create an image of a document window as a
 preview prior to displaying the window to the user. To obtain the CGImage of
 a displayed window is simple enough using the CGWindow API as shown below:

 - (CGImageRef)CGImage;
 {
        return CGWindowListCreateImage(CGRectNull,
 kCGWindowListOptionIncludingWindow, [self windowNumber],
 kCGWindowImageDefault);
 }

 The problem comes when trying to display the window initially at a far-off
 position so I can create the image and the move the window onto the screen.

 Setting the origin of the window to a point with large +ve or -ve ordinates
 causes the window to appear at the edge of the main screen, partly shown.

 Has anybody any experience with either a) rendering an entire window into a
 bitmap instead of to the screen, or b) moving the window offscreen
 completely? If b) is possible, would the above code work for such a window?

If you create the window with the defer flag set to NO, then the
NSWindow object will get a window server window even when it's not
actually ordered onto the screen. I *believe* that you will then be
able to capture it without ever displaying it so that it's visible to
the user, simply by not sending it an orderFront: or any similar
message.

As an alternative, use -dataWithPDFInsideRect: to generate an image.
This technique tends to be rather slow, though.

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: Setting 'is package' bit when building a plug-in bundle?

2009-03-06 Thread Kyle Sluder
On Fri, Mar 6, 2009 at 10:31 PM, Graham Cox graham@bigpond.com wrote:
 So far it's working fine, but I decided I wanted to use a particular
 extension for my plug-in files. When I do that, the bundles revert to
 looking like ordinary folders in the Finder, and can be simply opened like
 any folder.

Make sure that your plug-in UTI conforms to com.apple.package (or
com.apple.bundle if more appropriate).

If you need to manually inform the Finder of a directory's bundle
status, use SetFile(1).

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


Fwd: NSOperation and NSAutoreleasePool

2009-03-06 Thread Aaron Wallis

Hey all,

I've got a series of NSOperations which process some data for the user.
Each of them are created and supplied a large string.
In the operations start method the operation finds a suitable plugin  
(using a plugin manager) to help the data analsysis. Once the plugin  
is found, the string and delegate (which is the NSOperation instance)  
is supplied for processing.
The operation then waits for the plugin to call the complete  
delegate function, upon which time the operation saves the data and  
cleans up.


So that's how it should work...
The problem i've got is when I supply the plugin the delegate:
[tPlugin processDataInFile:tFilePath withDelegate:self];

the plugin see's the delegate parameter as an NSAutorelease object.
i.e. if I NSLog the delegate object:
- (void)processDataInFile:(NSString *)tFilePath withDelegate: 
(id)tDelegate {

self.delegate = [tDelegate retain];
NSLog(@Process data in %@ using delegate %@, tFilePath,  
self.delegate);


I get the output:
Process data in 090227/123.txt using delegate NSAutoreleasePool:  
0x187e10


when it should say something like:
Process data in 090227/123.txt using delegate  
TMPSTProcessDropOperation: 0x175930


Any ideas what I could be doing wrong?

___

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

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

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

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


Re: NSOperation and NSAutoreleasePool

2009-03-06 Thread Kyle Sluder
It sounds like you have some sort of memory issue.  Since you refer to
things like NSAutorelease objects (which don't exist) and are
apparently calling -retain on an object that you immediately assign to
a property, I suggest you go back and re-read the Memory Management
Guide.

--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: NSOperation and NSAutoreleasePool

2009-03-06 Thread Roland King
this isn't making sense. You need to get to the bottom of this and not  
just throw in random code which *seems* to work.


For a start how is delegate declared as a property? Show us the  
definition please, and are you synthesizing it or have you written  
code for the methods yourself? If you have declared it


@property( readwrite, retain ) ...

and synthesized it, then far from releasing it early that  
self.delegate = .. call will be retaining it, whereas your new  
assignment isn't.


Your original code,

self.delegate = [ tDelegate retain ]

seems probably wrong if delegate is a retained property, that will  
just extra-retain it. Your new code


delegate = tDelegate;

doesn't retain it at all, one of the following should be the right way  
to do it


	self.delegate = tDelegate;		// the property mutator does the retain  
for you
	delegate = [ tDelegate retain ];	// you do the retain and then assign  
it
	[ self setDelegate:tDelegate ];		// which is the same as the first of  
the three but clearer.


Have you tried NSLog earlier on tDelegate before you set it into  
self.delegate, what is it then? Have you looked at this in the  
debugger to see what's going on?


I'd have to agree with Kyle's suggestion to read the memory management  
documentation again. And single-step your way through those lines,  
look at the addreses of tDelegate and what ends up in self.delegate.


On Mar 7, 2009, at 1:44 PM, Aaron Wallis wrote:

I've actually found a workaround - it seems that if I use Obj-C 2.0  
style properties the objects somehow get released earlier than they  
should.


in my example I used the code:
self.delegate = tDelegate
where tDelegate is the delegate supplied through the method call.
However, if I just use:
delegate = tDelegate
the script runs fine without a hitch...

it must have something to do with the self.delegate property being  
set to retain or something?

maybe it's causing the nsautoreleasepool to release early?

On 07/03/2009, at 4:35 PM, Kyle Sluder wrote:

It sounds like you have some sort of memory issue.  Since you refer  
to

things like NSAutorelease objects (which don't exist) and are
apparently calling -retain on an object that you immediately assign  
to

a property, I suggest you go back and re-read the Memory Management
Guide.

--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/rols%40rols.org

This email sent to r...@rols.org


___

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

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

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

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


Re: NSOperation and NSAutoreleasePool

2009-03-06 Thread Graham Cox


On 07/03/2009, at 5:02 PM, Roland King wrote:

seems probably wrong if delegate is a retained property, that will  
just extra-retain it. Your new code


delegate = tDelegate;

doesn't retain it at all, one of the following should be the right  
way to do it



Bearing in mind that typically delegates are NOT retained:

http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/chapter_6_section_8.html#/ 
/apple_ref/doc/uid/TP40002974-CH7-SW16



--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: NSOperation and NSAutoreleasePool

2009-03-06 Thread Graham Cox


On 07/03/2009, at 5:18 PM, Aaron Wallis wrote:


[delegate release];
delegate = tDelegate;
[delegate retain];



What if tDelegate == delegate?

You release delegate, which *may* dealloc it. Then you assign  
tDelegate to it. If tDelegate == delegate (not uncommon that objects  
are the same) then you've assigned a stale pointer. The following - 
retain is too late.


The correct pattern is always retain before release, i.e.:

[tDelegate retain];
[delegate release];
delegate = tDelegate;

Not sure if it has a bearing on your problem, but make sure the  
obvious bugs are fixed first.


But in any case, you shouldn't be retaining your delegate. See the doc  
link I posted a second ago.


--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: NSOperation and NSAutoreleasePool

2009-03-06 Thread Stephen J. Butler
On Sat, Mar 7, 2009 at 12:18 AM, Aaron Wallis d2k...@gmail.com wrote:
 The property was assigned as:
 @property (retain) id delegate;

 when I walk through the code (and log pretty much everything out)
 I get the following:

 - (void)processString:(NSString *)tString withDelegate:(id)tDelegate {
 NSLog(@1. %@, tDelegate); // I get TMPSTProcessDropOperation:
 0x175930

 self.delegate = tDelegate;

 NSLog(@2. %@, self.delegate); // I get NSAutoreleasePool: 0x187e10

 [self.delegate doSomething];// I get -[NSAutoreleasePool
 doSomething]: unrecognized selector sent to instance 0x187e10

I'm going to guess that maybe self is pointing to a deallocated
instance. Turn on NSZombie checking and see what happens:

http://www.cocoadev.com/index.pl?NSZombieEnabled

Another couple things. The delegate pattern says you don't retain the
delegate, to avoid retain cycles (loops). Also, it's a little unusual
to pass the delegate around to various methods. Usually there's one
setDelegate: call (or an Obj-C 2.0 property) and all subsequent
methods use that delegate.
___

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

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

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

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


Re: NSOperation and NSAutoreleasePool

2009-03-06 Thread Aaron Wallis
Thanks for pointing that one out, but it wasn't the cause for my  
problem.
As for retaining the delegate, originally I wasn't, I just took the  
advice from Roland, but it doesn't break if I don't have it there :D


On 07/03/2009, at 5:27 PM, Graham Cox wrote:



On 07/03/2009, at 5:18 PM, Aaron Wallis wrote:


[delegate release];
delegate = tDelegate;
[delegate retain];



What if tDelegate == delegate?

You release delegate, which *may* dealloc it. Then you assign  
tDelegate to it. If tDelegate == delegate (not uncommon that objects  
are the same) then you've assigned a stale pointer. The following - 
retain is too late.


The correct pattern is always retain before release, i.e.:

[tDelegate retain];
[delegate release];
delegate = tDelegate;

Not sure if it has a bearing on your problem, but make sure the  
obvious bugs are fixed first.


But in any case, you shouldn't be retaining your delegate. See the  
doc link I posted a second ago.


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