Re: NSTableView updating checkboxes
On 21 Mar 09, at 04:04, Jo Phils wrote: I have taken some time to work on your suggestions...unfortunately I still can't figure out how to uncheck/recheck the checkboxes by clicking on them. :-( I understand what you're telling me about keeping 2 lists and ultimately I will get to the point where I have to do something with the items being displayed in my table. But for now I'm still stuck on the checkboxes... Right now, the method you've got coded: - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { if ([[aTableColumn identifier] isEqualToString:@column2]) { return [NSNumber numberWithInt:NSOnState]; //initializes checkbox column with boxes all checked } return [filenames objectAtIndex:rowIndex]; tells the table that every row is always checked. This method doesn't initialize the table - the table doesn't keep track of anything itself, it just asks your data source what to display. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MacRoman - UTF8 [solved]
Just for the record, this was an issue with my HTTP content type settings and the charset that the input was encoded in, not any issue with NSString. -Ben -- Ben Lachman Acacia Tree Software http://acaciatreesoftware.com email: blach...@mac.com twitter: @benlachman mobile: 740.590.0009 On Mar 21, 2009, at 9:57 PM, Clark Cox wrote: On Sat, Mar 21, 2009 at 3:50 PM, Ben Lachman blach...@mac.com wrote: On Mar 21, 2009, at 5:38 PM, Clark Cox wrote: On Sat, Mar 21, 2009 at 2:31 PM, Ben Lachman blach...@mac.com wrote: My software uses UTF8 almost exclusively. However, for some odd reason, arguments passed from a perl cgi script to one of my command line helper apps are encoded as MacRoman. Where is the CGI script getting the text, and what encoding does it start off in? UTF-8. See the last bit of my post, seemingly they're being converted somewhere in the internals of the exec command. Trust me, there's nothing inside of exec that would do this. That's not a problem since I can just use [NSString stringWithCString:argv[i] encoding:NSMacOSRomanStringEncoding]. However it seems that one can't convert MacRoman - UTF8 after you get it into a NSString. I don't know what you mean by convert MacRoman - UTF8 after you get it into a NSString. After you get text into an NSString it is, by definition, no longer MacRoman. Thats what I thought. However, say I start by reading bén as I noted above, then I call printf(%s, [myStringReadFromMacRoman UTF8String]) and it prints bÈn. However if I call printf(%s, [myStringReadFromMacRoman cStringUsingEncoding:NSMacOSRomanStringEncoding]) is prints out correctly. Now I'm thoroughly confused and am not sure what's happening. Any more thoughts? What is the encoding of your terminal set to? -- 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
Memory leak when setting CALayer name
Hello, Im having a leak, (showed up by instruments), I was able to detect that its appearing when doing this: [dLayer setName:[[shipaux class]description]]; and I have 4 more layers where Im doing that procedure. After doing a drag and drop Im just removing the CALayer from the superlayer, but I dunno then how to release it, if I created them as following: dLayer = [CALayer layer]; cLayer = [CALayer layer]; sLayer = [CALayer layer]; fLayer = [CALayer layer]; aLayer = [CALayer layer]; if I call release on any of them, the program crash. how can I solve this situation.. its like the leak its not big, its a NSString x 5, 32Bytes each, but I like my program to be leaks free. Thanks a lot. Gustavo Pizano ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Memory leak when setting CALayer name
If you create a layer with a factory method, then the layer will be released automatically by an NSAutoreleasePool. I suggest you read the rules on Memory Management for Objective-C. I think that the cause of your leak is also in the trend of not knowing the MemoryManagement rules/ not applying them correctly. Filip van der Meeren fi...@code2develop.com http://sourceforge.net/projects/xlinterpreter On 22 Mar 2009, at 10:57, Gustavo Pizano wrote: Hello, Im having a leak, (showed up by instruments), I was able to detect that its appearing when doing this: [dLayer setName:[[shipaux class]description]]; and I have 4 more layers where Im doing that procedure. After doing a drag and drop Im just removing the CALayer from the superlayer, but I dunno then how to release it, if I created them as following: dLayer = [CALayer layer]; cLayer = [CALayer layer]; sLayer = [CALayer layer]; fLayer = [CALayer layer]; aLayer = [CALayer layer]; if I call release on any of them, the program crash. how can I solve this situation.. its like the leak its not big, its a NSString x 5, 32Bytes each, but I like my program to be leaks free. Thanks a lot. Gustavo Pizano ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/filip%40code2develop.com This email sent to fi...@code2develop.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Memory leak when setting CALayer name
I have been trying to follow the rules by the book, but somehow all the time there is something that applies in a different way. All the time Im thinking myself if I own the object, who should released, is this a copy, etc, so I can decided if its on me to release it or no. I see the property name of CALayer is a @property(copy), so this will create a new instance and retain it, as far as I understood. So its not on me To release it, directly, as you said the AutoReleasepool will release it when the CALayer will be released also. now, im getting the name of the class by using the [[Object class] description] method, Im not allocating anything, so I don't need to release it. So how come Im applying the M.M rules wrongly, what am I missing? :(. thanks Gustavo May be I should post this on the OBj-C list, not here, but as far as it has something to do with the CALayer, I will keep it here, what you think? On 22.3.2009, at 11:50, Filip van der Meeren wrote: If you create a layer with a factory method, then the layer will be released automatically by an NSAutoreleasePool. I suggest you read the rules on Memory Management for Objective-C. I think that the cause of your leak is also in the trend of not knowing the MemoryManagement rules/ not applying them correctly. Filip van der Meeren fi...@code2develop.com http://sourceforge.net/projects/xlinterpreter On 22 Mar 2009, at 10:57, Gustavo Pizano wrote: Hello, Im having a leak, (showed up by instruments), I was able to detect that its appearing when doing this: [dLayer setName:[[shipaux class]description]]; and I have 4 more layers where Im doing that procedure. After doing a drag and drop Im just removing the CALayer from the superlayer, but I dunno then how to release it, if I created them as following: dLayer = [CALayer layer]; cLayer = [CALayer layer]; sLayer = [CALayer layer]; fLayer = [CALayer layer]; aLayer = [CALayer layer]; if I call release on any of them, the program crash. how can I solve this situation.. its like the leak its not big, its a NSString x 5, 32Bytes each, but I like my program to be leaks free. Thanks a lot. Gustavo Pizano ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/filip%40code2develop.com This email sent to fi...@code2develop.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How can main thread be blocked in mach_msg_trap?
On Sat, Mar 21, 2009 at 11:54 PM, Jerry Krinock je...@ieee.org wrote: NSLogs tell me that, when one of my secondary threads executes a performSelectorOnMainThread::: at a certain point, the requested method never begins. So I conclude that the main thread ^is^ blocked. But if I Pause the debugger at this point and examine the call stack for Thread-1, I see: #0 0x9540b1c6 in mach_msg_trap #1 0x954129bc in mach_msg #2 0x9495f0ae in CFRunLoopRunSpecific #3 0x9495fcd8 in CFRunLoopRunInMode #4 0x929ced75 in -[NSRunLoop(NSRunLoop) runMode:beforeDate:] #5 0x929dae94 in -[NSRunLoop(NSRunLoop) run] #6 0x2a3f in main at Worker-Main.m:112 I always thought that mach_msg_trap means that a thread is sitting at the top of a run loop waiting for an input source, such as performSelectorOnMainThread:::, to wake it. Therefore it is ^not^ blocked. My understanding thus ends in a paradox. How can this be explained? (Notice that this is a background agent in which I have explicitly invoked -[NSRunLoop run]) Several possibilities: 1) You've never actually made the call to performSelectorOnMainThread:..., you just think you have. 2) The call worked, and the target executed, and finished before you paused in the debugger. 3) You're sending it to nil. 4) You're running the runloop in a mode that the perform... call isn't looking for. 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: MacRoman - UTF8 [solved]
On Sun, Mar 22, 2009 at 3:48 AM, Ben Lachman blach...@mac.com wrote: Just for the record, this was an issue with my HTTP content type settings and the charset that the input was encoded in, not any issue with NSString. Just a general request for the list here: could we not add [solved] to the topic when the problem is solved? It breaks threading and causes confusion. Just stick it into the original thread. The act of having solved the problem is not so significant that it needs to be made evident the moment we read the subject 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: asl_search abysmally slow
Same here. Even been to the WWDC 2008 Labs. No dice. According to the Apple engineers the code was OK. Wondering whether the Console.app uses some private API. On Fri, Mar 20, 2009 at 17:22, Luke the Hiesterman luket...@apple.com wrote: I fought with ASL slowness in trying to develop my app last year. That project currently sits on the backburner largely because of performance problems I also encountered with ASL. I did fine reading once, but as soon as I started reading every second or couple of seconds, syslogd cpu usage went through the roof and life became awful. I wish I had a solution for you, but instead I simply say, I feel your pain. Luke On Mar 20, 2009, at 2:08 AM, Gerriet M. Denkmann wrote: I am trying to access the Apple System Log facility. char *lastMessageId = 765123; aslmsg q = asl_new(ASL_TYPE_QUERY); asl_set_query(q, kAslMessageId, lastMessageId, ASL_QUERY_OP_GREATER | ASL_QUERY_OP_NUMERIC ); aslresponse r = asl_search( NULL, q); // r will contain all messages after 765123 Works fine, if the asl database is small. But with about 200 000 messages in asl, asl_search() will take about a dozen seconds. 1. question: is there any faster method to get a list of asl messages? 2. question: is there a way to make Xcode 3.1.1 print NSLog() messages ONLY into it's own Console and NOT also into the asl-console (like the good old Xcode 2.x did)? Kind regards, Gerriet. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com This email sent to luket...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tcurdt%40vafer.org This email sent to tcu...@vafer.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: MacRoman - UTF8 [solved]
On 22.03.2009, at 12:22, Michael Ash wrote: On Sun, Mar 22, 2009 at 3:48 AM, Ben Lachman blach...@mac.com wrote: Just for the record, this was an issue with my HTTP content type settings and the charset that the input was encoded in, not any issue with NSString. Just a general request for the list here: could we not add [solved] to the topic when the problem is solved? It breaks threading and causes confusion. Just stick it into the original thread. The act of having solved the problem is not so significant that it needs to be made evident the moment we read the subject What mail app are you using? Apple Mail shows it just fine as part of the thread it was in. So do most other mail apps. There's a header in RFC822-style mail messages that indicates the thread, the subject doesn't even begin to figure into the equation. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
global UIColor
I'm setting up my constants in my app, and have come across a problem. I wish to have a standard UIColor to use for all titles in my app but I get the error error: initializer element is not constant and for obvious reasons , but my question is: How am I 'supposed' to implement a single global UIColor? #import XXConstants.h @implementation XXConstants const NSString *const1 = @MyString; const int const2 = 111; UIColor * const3 = [UIColor colorWithRed:.11 green:.11 blue:.11 alpha: 1]; //the offender @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: global UIColor
While it might be considered overkill, the way I would do this is to make a UIColor category: @interface UIColor (MyColor) + (UIColor *) myColor; @end @implementation UIColor (MyColor) + (UIColor *) myColor { return [UIColor colorWithRed:0.11 green:0.11 blue:0.11 alpha:1.0]; } @end Make sure the @interface bit is #imported wherever you need it, and now you can get your color by doing: UIColor * myColor = [UIColor myColor]; Categories are one of the reasons I fell in love with this language. =) HTH, Dave On Mar 22, 2009, at 8:38 AM, Harry G wrote: I'm setting up my constants in my app, and have come across a problem. I wish to have a standard UIColor to use for all titles in my app but I get the error error: initializer element is not constant and for obvious reasons , but my question is: How am I 'supposed' to implement a single global UIColor? #import XXConstants.h @implementation XXConstants const NSString *const1 = @MyString; const int const2 = 111; UIColor * const3 = [UIColor colorWithRed:.11 green:.11 blue:.11 alpha:1]; //the offender @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSLevelIndicator Bindings Crash
On Mar 21, 2009, at 3:41PM, Walker Argendeli wrote: I'm using Core Data, and I have an entity; we'll call it Item. It has an attribute called priority. In the xib, I have an NSLevelIndicator and NSStepper. I have a NSTableView full of Items. Depending on which item is selected in the table view, I want the level indicator and stepper to display the right values, and for me to be able to set them to a certain value for each item. There are 2 problems: If I bind the value of either one to Item.arrangedObjects.priority, the app throws an exception, whereas if I bind to Item.selection.priority, the controls don't set each item's priority individually. What should I bind to? Secondly, an NSLevelIndicator wants a float for its value, whereas an NSStepper wants a double for its value. Which should I set it to in the core data model? Cocoa Programming for Mac OS X Third Edition by Arron Hillegass Chapter 11, Basic Core Data, pages 171-182 has a NSLevelIndicator. This chapter might shed some light on your problem. Richard ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: global UIColor
This is almost exactly what I'd do. But for a performance boost, amend to: + (UIColor *)myColor { static UIColor *result; if (!result) { result = [[UIColor colorWithRed:0.11 green:0.11 blue:0.11 alpha:1.0] retain]; } return result; } On 22 Mar 2009, at 14:43, Dave DeLong wrote: While it might be considered overkill, the way I would do this is to make a UIColor category: @interface UIColor (MyColor) + (UIColor *) myColor; @end @implementation UIColor (MyColor) + (UIColor *) myColor { return [UIColor colorWithRed:0.11 green:0.11 blue:0.11 alpha:1.0]; } @end Make sure the @interface bit is #imported wherever you need it, and now you can get your color by doing: UIColor * myColor = [UIColor myColor]; Categories are one of the reasons I fell in love with this language. =) HTH, Dave On Mar 22, 2009, at 8:38 AM, Harry G wrote: I'm setting up my constants in my app, and have come across a problem. I wish to have a standard UIColor to use for all titles in my app but I get the error error: initializer element is not constant and for obvious reasons , but my question is: How am I 'supposed' to implement a single global UIColor? #import XXConstants.h @implementation XXConstants const NSString *const1 = @MyString; const int const2 = 111; UIColor * const3 = [UIColor colorWithRed:.11 green:.11 blue:.11 alpha:1]; //the offender @end ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Extending NSCollectionView
Hi, I'm attempting to recreate something kind of like iPhoto's mechanism for refining face autodetection, like here: http://news.cnet.com/i/bto/20090130/nicoleleeconfirm_610x381.png In my situation, I'd like to have two NSCollectionView instances. One on top, one on the bottom. The entries on top are the ones which my batch processor will act on, and the ones on the bottom are the entries which my algorithm has decided aren't candidates for the image processing. The idea is that the user can pick entries from the bottom and override the automatic detection and thus move them to the top. And visa versa. The trouble is, to do this I need to take the NSCollectionViews out of their enclosing scroll views and put them both into one scroll view -- and I'd write code that queries how tall they want to be and would lay the two of them out one over the other. That would be fine if I could find a way to determine how tall the NSCollectionView wants to be to display its contents. Trouble is that all the internal properties of NSCollectionView appear to be private. There doesn't seem to be any way to ask an NSCollectionView how tall it wants to be, or how many rows its showing, etc etc. Obviously, in the end I'm willing to just write a custom view that does this manually but NSCollectionView is pretty nice in that I can perform my bindings in IB and I get animation for free... shamyl zakariya - squamous and rugose ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Programmatically Change Icon
Hi everyone: I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Thanks for any help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAppleScript - what is going on here?
On Sat, 21 Mar 2009 12:38:11 -0500, Steve Cronin steve_cro...@mac.com said: Folks; I'm trying to get a string value back from a simple AppleScript in Cocoa: NSDictionary *errorDict= nil; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; [appleScriptObject release]; if (([eventDescriptor descriptorType]) (errorDict==nil)) { return [self stringFromAppleEventDescriptor:eventDescriptor]; //my own method that checks descriptorType and returns stringValue } else { NSLog(@%@,[errorDict objectForKey:@NSAppleScriptErrorMessage]); return nil; } The 'theScript' is a valid script that executes flawlessly in 'Script Editor': tell application Finder try comment of file (/Users/steve/ as POSIX file) on error return Error end try end tell The problem is that the above errors out @ [appleScriptObject executeAndReturnError: errorDict]; The stack is shown below. That's hard to answer because you're so obviously lying. You are not reporting what you're really doing. What is theScript really? A string? Show us the string. And clearly you are not really saying /Users/steve/, so show us what you *are* saying. Let me show you how to answer. Here is a *complete* valid chunk of *real* Objective-C code: NSString* theScript = @tell application \Finder\\n @try\n @set pp to \/Users/mattneub/Desktop/BrahmsHandel2.mus\\n @comment of file (pp as POSIX file)\n @on error\n @return \Error\\n @end try\n @end tell\n; NSDictionary *errorDict= nil; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; [appleScriptObject release]; if (([eventDescriptor descriptorType]) (errorDict==nil)) { NSLog(@%@, [eventDescriptor stringValue]); } else { NSLog(@%@,[errorDict objectForKey:@NSAppleScriptErrorMessage]); } I actually ran that code and it actually works (the finder comment from the specified file appears in the log). Okay, now it's your turn. :) 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: NSAppleScript - what is going on here?
Matt; I really take offense at your tone. I was not lying. I merely clipped out my personal details in order not to provide them to the world. The 'theScript' IS a string - constructed in ObjC differently than you show but a string nonetheless. Turns out the error was that an SDEF file had been renamed. As Samuel Jackson said in Black Snake Moan -- Collar that dog!, Steve On Mar 22, 2009, at 12:05 PM, Matt Neuburg wrote: On Sat, 21 Mar 2009 12:38:11 -0500, Steve Cronin steve_cro...@mac.com said: Folks; I'm trying to get a string value back from a simple AppleScript in Cocoa: NSDictionary *errorDict= nil; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; [appleScriptObject release]; if (([eventDescriptor descriptorType]) (errorDict==nil)) { return [self stringFromAppleEventDescriptor:eventDescriptor]; //my own method that checks descriptorType and returns stringValue } else { NSLog(@%@,[errorDict objectForKey:@NSAppleScriptErrorMessage]); return nil; } The 'theScript' is a valid script that executes flawlessly in 'Script Editor': tell application Finder try comment of file (/Users/steve/ as POSIX file) on error return Error end try end tell The problem is that the above errors out @ [appleScriptObject executeAndReturnError: errorDict]; The stack is shown below. That's hard to answer because you're so obviously lying. You are not reporting what you're really doing. What is theScript really? A string? Show us the string. And clearly you are not really saying /Users/ steve/, so show us what you *are* saying. Let me show you how to answer. Here is a *complete* valid chunk of *real* Objective-C code: NSString* theScript = @tell application \Finder\\n @try\n @set pp to \/Users/mattneub/Desktop/BrahmsHandel2.mus\\n @comment of file (pp as POSIX file)\n @on error\n @return \Error\\n @end try\n @end tell\n; NSDictionary *errorDict= nil; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; [appleScriptObject release]; if (([eventDescriptor descriptorType]) (errorDict==nil)) { NSLog(@%@, [eventDescriptor stringValue]); } else { NSLog(@%@,[errorDict objectForKey:@NSAppleScriptErrorMessage]); } I actually ran that code and it actually works (the finder comment from the specified file appears in the log). Okay, now it's your turn. :) 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: NSAppleScript - what is going on here?
On Mar 21, 2009, at 10:38 AM, Steve Cronin wrote: The 'theScript' is a valid script that executes flawlessly in 'Script Editor': tell application Finder try comment of file (/Users/steve/ as POSIX file) on error return Error end try end tell It sounds like you've solved your problem, but I'd just note that if you're only getting Finder comments, MDItem is faster and simpler: - (NSString *)commentForURL:(NSURL *)fileURL; { NSParameterAssert([fileURL isFileURL]); MDItemRef mdItem = NULL; CFStringRef path = (CFStringRef)[fileURL path]; NSString *theComment = nil; if (path (mdItem = MDItemCreate(CFGetAllocator(path), path))) { theComment = (NSString *)MDItemCopyAttribute(mdItem, kMDItemFinderComment); CFRelease(mdItem); [theComment autorelease]; } return theComment; } smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAppleScript - what is going on here?
Adam; I'm an ObjC guy -- I generally avoid the C stuff if possible - 'cause I have to support my own code. But your method seems like it will work not only as a replacement but actually a doorway to the full gamut of common metadata attributes - very nice!! I know I should lose the resistance but there are only so many mountains one guy can climb... Thanks for the very helpful note! Steve On Mar 22, 2009, at 12:43 PM, Adam R. Maxwell wrote: On Mar 21, 2009, at 10:38 AM, Steve Cronin wrote: The 'theScript' is a valid script that executes flawlessly in 'Script Editor': tell application Finder try comment of file (/Users/steve/ as POSIX file) on error return Error end try end tell It sounds like you've solved your problem, but I'd just note that if you're only getting Finder comments, MDItem is faster and simpler: - (NSString *)commentForURL:(NSURL *)fileURL; { NSParameterAssert([fileURL isFileURL]); MDItemRef mdItem = NULL; CFStringRef path = (CFStringRef)[fileURL path]; NSString *theComment = nil; if (path (mdItem = MDItemCreate(CFGetAllocator(path), path))) { theComment = (NSString *)MDItemCopyAttribute(mdItem, kMDItemFinderComment); CFRelease(mdItem); [theComment autorelease]; } return theComment; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On Mar 22, 2009, at 12:27 PM, Pierce Freeman wrote: I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Problems: 1 - Not all users are administrators of their computer, and so a user- space application may not be able to modify the application bundles in question. You'll need to authenticate/authorize the user to perform this change if the application is in the /Applications folder, or the user has no write permissions for the app bundles otherwise. 2 - Some applications may be digitally signed, in which case modifying the application bundles in question may at least cause disconcerting warnings for the user launching the modified applications, and at worst break the application(s). 3 - This may be technically in violation of the EULA of the applications in question. IANAL, but I certainly would look into this before trying it, especially with the very loosely-defined DMCA laws. 4 - All the above aside, make sure you have your users' express permission to perform this action ... it is a pretty big deal and I would personally not use any application that does this, and you can count on others feeling the same way, so make sure you ask in very clear, plain language. That said, to get the application's icon, you can do what the Finder does and use the app bundle's Info.plist and ask for the value for the CFBundleIconFile key. Then ask the application bundle for the resource with the returned name. See the documentation for the permissions issue and for how to work with the icon file format. -- 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
How to get events in PDE auxiliary window?
Hello, I have implemented cocoa PDE plugin. Auxiliary window appears when user clicks button on this PDE. I can interact with all controls on this auxiliary window in all applications except Adobe Acrobat Reader. When I select Print then open my cocoa PDE and click button then auxiliary window appears behind print dialog, and when I try to interact with controls on this window, I get only beeps. How this can be fixed? How can I place auxiliary window above print dialog? And how I can forward events to controls on this window? BR, Alexander ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
how to say app using only my plug-in?
I finished project, which use Flash player plug-in. But if user has same plug-in (but old version), my application load his. I wanna that app use just my plug-ins from my folder (myapp.app/Contents/PlugIns/Flash Player.plugin) and doesn't use system's plug-in. how to do so? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On 22.03.2009, at 17:27, Pierce Freeman wrote: The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Sure you can retrieve NSImages for application icons. Look at NSWorkspace's iconForFile: method and similar ones. Now, changing them, that's a different matter. This used to be able with Carbon's Icon Services APIs, though. There you were able to override an icon with one you provided, e.g. to animate the progress bar on a downloaded file icon. Might want to look into those. Last time I did that was on OS 9 though, so no guarantee whether that's still system- wide these days. I am wondering if there is some way to change another applications icon programmatically. What are you trying to do that you need to do this? Are you trying to change the dock icons of running applications, or what? For that, it might be a better idea to use Accessibility APIs or AppleScript (or maybe even CGWindow APIs work?) to determine the rectangle of the requisite dock tile, and then show your own, transparent window on top? Have you considered the repercussions of your changes on the developers of the other applications? Consider that, not only would you break any code signing on those apps, and any other checksums they may be using to make sure patches or incremental updates work, you could also trigger other sorts of tamper alerts, or through a bug damage the application whose icon you wanted to change. Trouble is, the user might not notice until they next launch that other app. And the people who would then have to deal with what your app caused are likely the ones who developed your 'victim' app. After all, many users won't understand that just changing an icon can damage an application, not to mention that some might have forgotten they used your application to change the icon. We used to get lots of bug reports from people who had used third- party tools to strip Intel code from their universal binary applications to save disk space. They'd done that a while ago, and when they used the migration assistant to move their apps to their new Intel Mac months later, some of them refused to work, and many of them were dog-slow because of issues with Rosetta they wouldn't even have had if they had just run the intel-native code we put in there. I'm not saying you shouldn't do that, but I just thought I'd make you aware of the backlash that applications that patch others in whatever way can cause. Talk to the guys from Unsanity if you want to know how even people who did a very good job of writing a robust patching engine got hissed at, I'm sure they have a few stories to tell... Oh, one more thing: If you really just want to change the icon, you may want to look into how Finder applies custom icons to folders. You'd still have to authenticate, but at least you'd be doing a modification that the user can do using the Finder, so it's something application developers can expect. I believe how it's basically done is creating a file with the name Icon\r (\r is 0x0D, i.e. a return character, not a newline as in \n or 0x0A) at the top level of the application package, next to the Contents folder, and set the kHasCustomIcon flag on the folder. The Icon\r-file contains an 'icns' resource with ID -16455 containing the contents of a .icns file. Cheers, -- Uli Kusterer The Witnesses of TeachText are everywhere... http://www.zathras.de ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAppleScript - what is going on here?
On Sun, Mar 22, 2009 at 1:53 PM, Steve Cronin steve_cro...@mac.com wrote: I'm an ObjC guy -- I generally avoid the C stuff if possible - 'cause I have to support my own code. You cannot reasonably expect to avoid C... there's a lot of functionality Cocoa doesn't provide. Launch Services for example. You're only doing yourself a disservice by avoiding C APIs, which are just as much part of Objective-C as the OO stuff -- ObjC is a strict superset after all. I bet that by avoiding C you actually create more work for yourself than if you just went with C when appropriate. --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: Programmatically Change Icon
Well, that's what I get for typing this when I was still half asleep. I meant to simply view instead of changing the icon. Would there be any problems (legally or otherwise) with doing this? You seem to know about these issues a lot better them myself... I definitely agree with all the problems you outlined, and never wanted to cause problems. If you would mind saying, though, how would changing the Application's icon involve legal issues? Since the users of the computers do it all the time. Also I agree that using an application that would change them without the user's permission would be very disconcerting and I would probably trash that application right away. Thanks for your help. On 3/22/09 10:55 AM, I. Savant idiotsavant2...@gmail.com wrote: On Mar 22, 2009, at 12:27 PM, Pierce Freeman wrote: I am wondering if there is some way to change another applications icon programmatically. The problem that I see if that every application's icon name is different and I haven't found a way to read that application's icon location or will just return a NSImage that is the icon. Problems: 1 - Not all users are administrators of their computer, and so a user- space application may not be able to modify the application bundles in question. You'll need to authenticate/authorize the user to perform this change if the application is in the /Applications folder, or the user has no write permissions for the app bundles otherwise. 2 - Some applications may be digitally signed, in which case modifying the application bundles in question may at least cause disconcerting warnings for the user launching the modified applications, and at worst break the application(s). 3 - This may be technically in violation of the EULA of the applications in question. IANAL, but I certainly would look into this before trying it, especially with the very loosely-defined DMCA laws. 4 - All the above aside, make sure you have your users' express permission to perform this action ... it is a pretty big deal and I would personally not use any application that does this, and you can count on others feeling the same way, so make sure you ask in very clear, plain language. That said, to get the application's icon, you can do what the Finder does and use the app bundle's Info.plist and ask for the value for the CFBundleIconFile key. Then ask the application bundle for the resource with the returned name. See the documentation for the permissions issue and for how to work with the icon file format. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: how to say app using only my plug-in?
On 22 Mar 2009, at 18:34:46, Carlo Gulliani wrote: I finished project, which use Flash player plug-in. But if user has same plug-in (but old version), my application load his. I wanna that app use just my plug-ins from my folder (myapp.app/Contents/ PlugIns/Flash Player.plugin) and doesn't use system's plug-in. how to do so? I think you just install it in the user domain. Nothing wrong with helping users avoid up-to-date software. But please, warn them you're doing this. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On Mar 22, 2009, at 3:45 PM, Pierce Freeman wrote: Well, that's what I get for typing this when I was still half asleep. I meant to simply view instead of changing the icon. Heh - ... some way to change another applications icon ... Changing has all those issues attached. Viewing on the other hand is easy. As Uli mentioned, NSWorkspace should be all you need simply to get a copy of the icon. The bundle stuff is only necessary if you want to get at the file itself (say, to modify it :-)). Would there be any problems (legally or otherwise) with doing this? You seem to know about these issues a lot better them myself... Best answer: I don't know for sure. Note the use of IANAL (I Am Not A Lawyer) and might be. :-) In the US, distributing software that modifies third-party software is uncomfortably close to the fence of a number of copyright laws and regulations. It's something any independent software business owner should be aware of. Again, this is from the perspective of a US citizen; it may be a non-issue for you, but you should definitely consult a lawyer before distributing such an application. That's all I meant to say. This discussion, however, is off-topic for cocoa-dev, so I'll leave it at that. I suggest the macsb group on Yahoo Groups. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
Heh - ... some way to change another applications icon ... Changing has all those issues attached. Viewing on the other hand is easy. My point exactly. ;) As Uli mentioned, NSWorkspace should be all you need simply to get a copy of the icon. The bundle stuff is only necessary if you want to get at the file itself (say, to modify it :-)). Would NSWorkspace also work if the app was not running, or only if it is? Best answer: I don't know for sure. Note the use of IANAL (I Am Not A Lawyer) and might be. :-) In the US, distributing software that modifies third-party software is uncomfortably close to the fence of a number of copyright laws and regulations. It's something any independent software business owner should be aware of. Again, this is from the perspective of a US citizen; it may be a non-issue for you, but you should definitely consult a lawyer before distributing such an application. That's all I meant to say. While it doesn't have to do with me, it's good advice to know. However, as you said, I assume these problems aren't true with just showing the icon (versus changing it). This discussion, however, is off-topic for cocoa-dev, so I'll leave it at that. I suggest the macsb group on Yahoo Groups. True, I'll look there if I have any more questions. Thanks for all your help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On Mar 22, 2009, at 5:29 PM, Pierce Freeman wrote: Would NSWorkspace also work if the app was not running, or only if it is? Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. While it doesn't have to do with me, it's good advice to know. However, as you said, I assume these problems aren't true with just showing the icon (versus changing it). I would assume this as well ... there'd be a number of software companies in hot water otherwise. Especially OS vendors like Apple and Microsoft, since Finder and Windows Explorer both show other applications' icons. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
Hello David, your garbage collection approach is a bit naive, but not everything is wrong, you can make a google search, it will point you good resources anyway, @implementation AppDelegate - (void)sendSharedMessage:(NSString *)msg { return [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; } @end @implementation MyObject - (void)aMathod { id sharedController = [[NSApplication sharedApplication] delegate]; if ([[sharedController class] instancesRespondToSelector:@selector(sendSharedMessage:)]) { NSString aMsg = [[NSString alloc] initWithString:@hello]; [sharedController performSelector:@selector(sendSharedMessage:) withObject:aMsg]; [aMsg release]; } } @end (sorry if there is synthax errors this is a live code) this model will apply with/or without garbage collection, release autorelease will be ignored in garbage collection env, avoid as far is possible circular refs by a proper design. On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner b...@mac.com wrote: On Mar 21, 2009, at 9:11 PM, David wrote: Is there any issue issuing explicit release when using garbage collection with Leopard and Obj-c 2.0? -release is ignored entirely. CFRelease() work as it always does, and balances CFRetain() nicely. But that isn't the issue. I've become aware that I have lots of memory not being freed within my application. I presume this is because its a tree structure with parent child pointers between the objects. If I drop the last reference to the tree, I presume the tree does not get garbage collected because each object has circular pointers between them, ie parent has references to children and each child has a reference to its parent. In this case, it seem that the appropriate course of action would be to call a specific method to forcibly release each node in the tree. Is this the proper approach? Should garbage collection somehow work anyway? That would be an incorrect presumption. The garbage collector handles complexly connected, but not rooted, graphs just fine. Your sub-graphs -- trees -- of objects that are no longer referenced by your rooted object graphs should be reaped without a problem. So, something else is going on. Have you used 'info gc-roots' to see what is causing the items within your tree to stick around? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to openspec...@gmail.com -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. Lol, just wanted to make sure. I would assume this as well ... there'd be a number of software companies in hot water otherwise. Especially OS vendors like Apple and Microsoft, since Finder and Windows Explorer both show other applications' icons. :-) Yeah, this is more or less what I figured... Application icons are more or less made to be viewed. ;) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
I changed my mind, when I was writting this - (void)sendSharedMessage:(NSString *)msg { NSString *print = [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; NSLog(@ %@, print); } anyway it doesn't change the background On Sun, Mar 22, 2009 at 2:47 PM, mm w openspec...@gmail.com wrote: Hello David, your garbage collection approach is a bit naive, but not everything is wrong, you can make a google search, it will point you good resources anyway, @implementation AppDelegate - (void)sendSharedMessage:(NSString *)msg { return [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; } @end @implementation MyObject - (void)aMathod { id sharedController = [[NSApplication sharedApplication] delegate]; if ([[sharedController class] instancesRespondToSelector:@selector(sendSharedMessage:)]) { NSString aMsg = [[NSString alloc] initWithString:@hello]; [sharedController performSelector:@selector(sendSharedMessage:) withObject:aMsg]; [aMsg release]; } } @end (sorry if there is synthax errors this is a live code) this model will apply with/or without garbage collection, release autorelease will be ignored in garbage collection env, avoid as far is possible circular refs by a proper design. On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner b...@mac.com wrote: On Mar 21, 2009, at 9:11 PM, David wrote: Is there any issue issuing explicit release when using garbage collection with Leopard and Obj-c 2.0? -release is ignored entirely. CFRelease() work as it always does, and balances CFRetain() nicely. But that isn't the issue. I've become aware that I have lots of memory not being freed within my application. I presume this is because its a tree structure with parent child pointers between the objects. If I drop the last reference to the tree, I presume the tree does not get garbage collected because each object has circular pointers between them, ie parent has references to children and each child has a reference to its parent. In this case, it seem that the appropriate course of action would be to call a specific method to forcibly release each node in the tree. Is this the proper approach? Should garbage collection somehow work anyway? That would be an incorrect presumption. The garbage collector handles complexly connected, but not rooted, graphs just fine. Your sub-graphs -- trees -- of objects that are no longer referenced by your rooted object graphs should be reaped without a problem. So, something else is going on. Have you used 'info gc-roots' to see what is causing the items within your tree to stick around? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to openspec...@gmail.com -- -mmw -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. Just tried it, and it works great... Thanks! Just two questions so far: 1. How can I get different sizes of the icon, or are they just linked to the size of the outlet? 2. If you link to a non-existent application, it still returns an image - Is there some way to set it to return an error if this happens? Thanks for all your help. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On Mar 22, 2009, at 6:09 PM, Pierce Freeman wrote: Slightly-challenging-answer: Try it and see. Non-smarmy-answer: Yes. So would the other, more complicated approach. Just tried it, and it works great... Thanks! Just two questions so far: 1. How can I get different sizes of the icon, or are they just linked to the size of the outlet? I suggest some reading: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/nsimage_Class/Reference/Reference.html http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Images/Images.html http://developer.apple.com/documentation/Cocoa/Conceptual/ImageView/ImageView.html 2. If you link to a non-existent application, it still returns an image - Is there some way to set it to return an error if this happens? This is what I'd expect ... if an application has no custom icon, it gets the standard, generic application icon. In this case, you'd probably want to go with the get the app icon file name, then ask the app bundle for the resource of that name route. This way, if there's nothing set for the app icon key, you'll know there's no custom icon. If so, you can just use the NSWorkspace call to get that custom icon. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
I'm confused. Bill said that the garbage collection will correctly handle releasing these types of objects despite the circular references. Therefore it appears that no additional actions are required since I am using garbage collection. What is your approach trying to solve? I certainly don't follow your reply. Google for what? Naive in what way? Avoid circular refs by a proper design? Ok... what is proper? Generally your message alludes to many things yet provides little information. On Mar 22, 2009, at 5:53 PM, mm w wrote: I changed my mind, when I was writting this - (void)sendSharedMessage:(NSString *)msg { NSString *print = [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; NSLog(@ %@, print); } anyway it doesn't change the background On Sun, Mar 22, 2009 at 2:47 PM, mm w openspec...@gmail.com wrote: Hello David, your garbage collection approach is a bit naive, but not everything is wrong, you can make a google search, it will point you good resources anyway, @implementation AppDelegate - (void)sendSharedMessage:(NSString *)msg { return [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; } @end @implementation MyObject - (void)aMathod { id sharedController = [[NSApplication sharedApplication] delegate]; if ([[sharedController class] instancesRespondToSelector:@selector(sendSharedMessage:)]) { NSString aMsg = [[NSString alloc] initWithString:@hello]; [sharedController performSelector:@selector(sendSharedMessage:) withObject:aMsg]; [aMsg release]; } } @end (sorry if there is synthax errors this is a live code) this model will apply with/or without garbage collection, release autorelease will be ignored in garbage collection env, avoid as far is possible circular refs by a proper design. On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner b...@mac.com wrote: On Mar 21, 2009, at 9:11 PM, David wrote: Is there any issue issuing explicit release when using garbage collection with Leopard and Obj-c 2.0? -release is ignored entirely. CFRelease() work as it always does, and balances CFRetain() nicely. But that isn't the issue. I've become aware that I have lots of memory not being freed within my application. I presume this is because its a tree structure with parent child pointers between the objects. If I drop the last reference to the tree, I presume the tree does not get garbage collected because each object has circular pointers between them, ie parent has references to children and each child has a reference to its parent. In this case, it seem that the appropriate course of action would be to call a specific method to forcibly release each node in the tree. Is this the proper approach? Should garbage collection somehow work anyway? That would be an incorrect presumption. The garbage collector handles complexly connected, but not rooted, graphs just fine. Your sub- graphs -- trees -- of objects that are no longer referenced by your rooted object graphs should be reaped without a problem. So, something else is going on. Have you used 'info gc-roots' to see what is causing the items within your tree to stick around? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to openspec...@gmail.com -- -mmw -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
I suggest some reading: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classe s/nsimage_Class/Reference/Reference.html http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Im ages/Images.html http://developer.apple.com/documentation/Cocoa/Conceptual/ImageView/ImageView. html Thanks for the links, I'll look them over when I get a chance. This is what I'd expect ... if an application has no custom icon, it gets the standard, generic application icon. In this case, you'd probably want to go with the get the app icon file name, then ask the app bundle for the resource of that name route. This way, if there's nothing set for the app icon key, you'll know there's no custom icon. If so, you can just use the NSWorkspace call to get that custom icon. I think I may just go this route, especially if it doesn't break any copyright/patent/etc. Laws. ;) But the odd thing is, if I set the path to a file that I know doesn't exist (ex. /Applications/soidaoidaiodsaoidiasoadsoidoiaadiosoaidiodaoidasoidaoidasoiado iasdoidaoidadasoidiaosasidoosdiaiodsiodsa.app) it will still return some weird page icon. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, by refactoring his work, taking a pen and a white paper... and think Cheers! On Sun, Mar 22, 2009 at 3:21 PM, David Melgar enki1...@gmail.com wrote: I'm confused. Bill said that the garbage collection will correctly handle releasing these types of objects despite the circular references. Therefore it appears that no additional actions are required since I am using garbage collection. What is your approach trying to solve? I certainly don't follow your reply. Google for what? Naive in what way? Avoid circular refs by a proper design? Ok... what is proper? Generally your message alludes to many things yet provides little information. On Mar 22, 2009, at 5:53 PM, mm w wrote: I changed my mind, when I was writting this - (void)sendSharedMessage:(NSString *)msg { NSString *print = [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; NSLog(@ %@, print); } anyway it doesn't change the background On Sun, Mar 22, 2009 at 2:47 PM, mm w openspec...@gmail.com wrote: Hello David, your garbage collection approach is a bit naive, but not everything is wrong, you can make a google search, it will point you good resources anyway, @implementation AppDelegate - (void)sendSharedMessage:(NSString *)msg { return [[[NSString alloc] initWithFormat:@ %@,msg] autorelease]; } @end @implementation MyObject - (void)aMathod { id sharedController = [[NSApplication sharedApplication] delegate]; if ([[sharedController class] instancesRespondToSelector:@selector(sendSharedMessage:)]) { NSString aMsg = [[NSString alloc] initWithString:@hello]; [sharedController performSelector:@selector(sendSharedMessage:) withObject:aMsg]; [aMsg release]; } } @end (sorry if there is synthax errors this is a live code) this model will apply with/or without garbage collection, release autorelease will be ignored in garbage collection env, avoid as far is possible circular refs by a proper design. On Sat, Mar 21, 2009 at 9:16 PM, Bill Bumgarner b...@mac.com wrote: On Mar 21, 2009, at 9:11 PM, David wrote: Is there any issue issuing explicit release when using garbage collection with Leopard and Obj-c 2.0? -release is ignored entirely. CFRelease() work as it always does, and balances CFRetain() nicely. But that isn't the issue. I've become aware that I have lots of memory not being freed within my application. I presume this is because its a tree structure with parent child pointers between the objects. If I drop the last reference to the tree, I presume the tree does not get garbage collected because each object has circular pointers between them, ie parent has references to children and each child has a reference to its parent. In this case, it seem that the appropriate course of action would be to call a specific method to forcibly release each node in the tree. Is this the proper approach? Should garbage collection somehow work anyway? That would be an incorrect presumption. The garbage collector handles complexly connected, but not rooted, graphs just fine. Your sub-graphs -- trees -- of objects that are no longer referenced by your rooted object graphs should be reaped without a problem. So, something else is going on. Have you used 'info gc-roots' to see what is causing the items within your tree to stick around? b.bum ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/openspecies%40gmail.com This email sent to openspec...@gmail.com -- -mmw -- -mmw -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAppleScript - what is going on here?
On Mar 22, 2009, at 1:53 PM, Steve Cronin wrote: I'm an ObjC guy -- I generally avoid the C stuff if possible - 'cause I have to support my own code. Objective-C is a superset of C. Avoiding the C stuff isn't really possible - it is a core part of the language. As far as choice of API, I tend to be a pragmatist, choosing an appropriate tool for the task at hand, without artificial restrictions. JIm ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Programmatically Change Icon
On Mar 22, 2009, at 6:29 PM, Pierce Freeman wrote: But the odd thing is, if I set the path to a file that I know doesn't exist (ex. /Applications/ soidaoidaiodsaoidiasoadsoidoiaadiosoaidiodaoidasoidaoidasoiado iasdoidaoidadasoidiaosasidoosdiaiodsiodsa.app) it will still return some weird page icon. Come to think of it, it's strange that you get an icon for a non- existent file, but if it *does* exist, I'd always expect some sort of icon. I've never run into this situation personally. Which specific method are you using? There are: – iconForFile: – iconForFileType: – iconForFiles: Just curious. In your case, though, if you're going after applications, you'd presumably already have a list of app bundle paths, so it shouldn't be a problem, right? -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
Le 22 mars 09 à 23:37, mm w a écrit : Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, by refactoring his work, taking a pen and a white paper... and think I don't understand your point here. Circular references have not to be avoid. They are not an error. As previously mention, the garbage collector tracks root objects, and so it should properly deal with circular references. In a reference counted world, they are valid too, as long as the who retain who policy is properly designed. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- 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: Programmatically Change Icon
Come to think of it, it's strange that you get an icon for a non- existent file, but if it *does* exist, I'd always expect some sort of icon. I've never run into this situation personally. Which specific method are you using? There are: iconForFile: iconForFileType: iconForFiles: I kind of figured that it was a bit odd. I am using iconForFile and then the path. In your case, though, if you're going after applications, you'd presumably already have a list of app bundle paths, so it shouldn't be a problem, right? Presumably, but if the user deleted the application it would be nice to alert the user saying something instead of just showing some empty page icon. ;) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
On Sun, Mar 22, 2009 at 3:54 PM, Jean-Daniel Dupas devli...@shadowlab.org wrote: Le 22 mars 09 à 23:37, mm w a écrit : Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, by refactoring his work, taking a pen and a white paper... and think I don't understand your point here. Circular references have not to be avoid. They are not an error. yes that's true As previously mention, the garbage collector tracks root objects, and so it should properly deal with circular references. yep right, my point was circular refs are bad In a reference counted world, they are valid too, as long as the who retain who policy is properly designed. yep right, my point was circular refs are bad -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- 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: MacRoman - UTF8 [solved]
On Mar 22, 2009, at 5:22 AM, Uli Kusterer wrote: On 22.03.2009, at 12:22, Michael Ash wrote: Just a general request for the list here: could we not add [solved] to the topic when the problem is solved? It breaks threading and causes confusion. Just stick it into the original thread. The act of having solved the problem is not so significant that it needs to be made evident the moment we read the subject What mail app are you using? Apple Mail shows it just fine as part of the thread it was in. So do most other mail apps. There's a header in RFC822-style mail messages that indicates the thread, the subject doesn't even begin to figure into the equation. It doesn't matter what email client someone _might_ be using. The fact that not ALL email clients can deal with it is sufficient cause for concern. Of particular note is Apple's own mail archive for the mailing list. Maybe they've fixed it recently, but a couple of years ago when I first started with Cocoa, I got very frustrated trying to read threads in the archive only to find that the one email message in which the solution was to be found, was not grouped with the rest of the thread (this is especially problematic when solved is prepended to the subject, as is so often the case). The experience was much as if someone had torn the last page out of a gripping suspense novel. I've gotten enough grief already for not being willing to play along with community philosophy here, so I've kept my mouth shut on this particular issue. But I think Michael's a frequent enough contributor and has a high enough reputation that if he makes a suggestion, people ought to consider it seriously. I will happily state my agreement with his suggestion, given that it's been a source of frustration to me since I started following this mailing list. Please. Stop mucking with the subject. There really is very little benefit to adding the word solved to the subject, but there is definitely a significant drawback. I have followed various community/ online electronic forums for nearly thirty years, and this is the only one I've run across in which there is this habit of adding solved to the subject. No doubt it's not the only place where the behavior can be seen, but there's ample evidence that it's not helpful enough to gain traction as a widespread convention. I'd just as soon see it disappear here too. And my apologies to Michael if my statement of support for his request only hurts the chances of it being honored. :) Pete ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
Some people do that to try and impress. I'm not impressed. No useful information. On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- 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: Explicit release when using garbage collection with circular references
No but this point is on left-side of this subject, anyway, here we can see one side effect at code design-level: here we have some symptoms: - a lack of visibility - when you can be the owner : be the owner and control what is happening direct effect you are screwing up the garbage collection system a last comment: when someone is hill, do you try to fix the symptoms or the reasons? one rule: there is no circular refs in your design, it's the same for people who are designing circuits: there is no bridge, there is no circular refs allowed if you start with those constraints in mind I can ensure you that you won't fall in this kind of trap, and always be able to increase the possibility of your application, circular refs are against every oop design logic, when you face it, that's the result and the consequence of a previous mistake, sure sometimes for various reasons you will use a circular ref it's not 100% rule, sometimes it's good to be evil! Cheers! On Sun, Mar 22, 2009 at 4:22 PM, Clark Cox clarkc...@gmail.com wrote: It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- Clark S. Cox III clarkc...@gmail.com -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
On Sun, Mar 22, 2009 at 4:32 PM, David Melgar enki1...@gmail.com wrote: Some people do that to try and impress. I'm not impressed. No useful information. it's not my point, i don't understand your feeling here, I am not trying to impress anyone, I'm only give some points On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- Clark S. Cox III clarkc...@gmail.com -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
ref my previous email, anyway there are other aspects and side effects due to the circular refs, and one this is a memory issue, GC is now almost clever to detect that's ObjectB reference is hold by a previous ObjectA ref to Object0 our first reference, but it wasn't true at the beginning, and I am pretty sure there are still some undiscovered effects by adopting a proper design you will avoid this, here you can see a bunch of unsolvable requests due to this kind of mistake, sure people find patch on patch on patch and finish with a ton of lines to try to correct the reasons, see my previous comment on symptoms and consequences Cheers! On Sun, Mar 22, 2009 at 4:53 PM, mm w openspec...@gmail.com wrote: On Sun, Mar 22, 2009 at 4:32 PM, David Melgar enki1...@gmail.com wrote: Some people do that to try and impress. I'm not impressed. No useful information. it's not my point, i don't understand your feeling here, I am not trying to impress anyone, I'm only give some points On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Explicit release when using garbage collection with circular references
and to close this: I will open the discussion: in a cpp program I will use a type-recasting behaviour on a circular ref ? Cheers! On Sun, Mar 22, 2009 at 5:26 PM, mm w openspec...@gmail.com wrote: ref my previous email, anyway there are other aspects and side effects due to the circular refs, and one this is a memory issue, GC is now almost clever to detect that's ObjectB reference is hold by a previous ObjectA ref to Object0 our first reference, but it wasn't true at the beginning, and I am pretty sure there are still some undiscovered effects by adopting a proper design you will avoid this, here you can see a bunch of unsolvable requests due to this kind of mistake, sure people find patch on patch on patch and finish with a ton of lines to try to correct the reasons, see my previous comment on symptoms and consequences Cheers! On Sun, Mar 22, 2009 at 4:53 PM, mm w openspec...@gmail.com wrote: On Sun, Mar 22, 2009 at 4:32 PM, David Melgar enki1...@gmail.com wrote: Some people do that to try and impress. I'm not impressed. No useful information. it's not my point, i don't understand your feeling here, I am not trying to impress anyone, I'm only give some points On Mar 22, 2009, at 7:22 PM, Clark Cox wrote: It's not very conducive to conversation to make claims, and then refuse to back them up, and leave it at I let you discover it. On Sun, Mar 22, 2009 at 4:19 PM, mm w openspec...@gmail.com wrote: maybe in your world, anyway there are a bunch of reasons to avoid circular refs I let you discover it Cheers! On Sun, Mar 22, 2009 at 3:58 PM, Clark Cox clarkc...@gmail.com wrote: On Sun, Mar 22, 2009 at 3:37 PM, mm w openspec...@gmail.com wrote: Because I am like this I won't do the job for you, I will only point you directions, that's it Google garbage collection, it's naive to think that's a linear tree. What Bill told you is right, and my comment is following his thought Avoiding circular refs: in 95% of cases it can be avoided, They can be avoided, but why? They are not an error under garbage collection, and there is no reason to avoid them. -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- Clark S. Cox III clarkc...@gmail.com -- -mmw -- -mmw -- -mmw ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[moderator] Re: Explicit release when using garbage collection with circular references
I'm not entirely sure what the purpose of the last half of this thread has been. I do know that it isn't cocoa related, and has gone on long enough. stop this thread now. Do not start the next one. Lest more than one player be moderated. On 22-Mar-09, at 8:34 PM, mm w wrote: and to close this: I will open the discussion: in a cpp program I will use a type-recasting behaviour on a circular ref ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSTableView updating checkboxes
Thank you Andrew (and Graham), I think i'm finally realizing that! :-) Thank you very much. Ok I still don't have it yet but it's back to work for me and hopefully the next time I post back I'll finally have it... :-) Thanks again, Rick From: Andrew Farmer andf...@gmail.com To: Jo Phils jo_p...@yahoo.com Cc: Graham Cox graham@bigpond.com; cocoa-dev@lists.apple.com Sent: Sunday, March 22, 2009 3:45:12 PM Subject: Re: NSTableView updating checkboxes On 21 Mar 09, at 04:04, Jo Phils wrote: I have taken some time to work on your suggestions...unfortunately I still can't figure out how to uncheck/recheck the checkboxes by clicking on them. :-( I understand what you're telling me about keeping 2 lists and ultimately I will get to the point where I have to do something with the items being displayed in my table. But for now I'm still stuck on the checkboxes... Right now, the method you've got coded: - (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(NSInteger)rowIndex { if ([[aTableColumn identifier] isEqualToString:@column2]) { return [NSNumber numberWithInt:NSOnState]; //initializes checkbox column with boxes all checked } return [filenames objectAtIndex:rowIndex]; tells the table that every row is always checked. This method doesn't initialize the table - the table doesn't keep track of anything itself, it just asks your data source what to display. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to get a scroll view to recognize overflow on a custom view?
Hi I have a custom view inside a scroll view and all works nicely except when the custom view's contents exceeds the depth of the scroll view. The scroll bars don't appear. I created the scroll view in IB from a standard widget and did nothing more than set the class of default content view to my custom class. I read the NSScrollView docs and the companion Scroll View Programming Guide for Cocoa and notice that neither the contentView nor the documentView are available from inside IB. I looked at the different IB data views with scroll bars, checking what their outlets are and tried setting mine up the same, but they must be doing something behind the scenes. What do I need to do to get the scroll view to notice when my custom view exceeds it's depth? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSAppleScript - what is going on here?
On Mar 22, 2009, at 8:54 PM, Michael Ash wrote: On Sun, Mar 22, 2009 at 1:53 PM, Steve Cronin steve_cro...@mac.com wrote: Adam; I'm an ObjC guy -- I generally avoid the C stuff if possible - 'cause I have to support my own code. In addition to what the others have said, avoiding the C stuff if possible but being perfectly happy to use *AppleScript*, of all languages, is completely bizarre. C may be somewhat tedious and unforgiving, but it doesn't come anywhere remotely close to the utter horribleness that is AppleScript. Indeed. Let me add that the MDItem code I posted was the 3rd iteration of that method. The first used NSAppleScript, but it took 0.5s to execute and caused a noticeable hiccup in the app. My second attempt used raw Apple events and executed in 0.01s, but would cause Finder to stall when it was called during a drag-and-drop targeting Finder (ISTR Finder's event loop was trying to process the Apple event and the drop event at the same time). Using the MDItem C API had none of the AppleScript/Apple event problems, and was a small fraction of the code. Once you get used to working with CF, it's really no harder than Obj-C, and gives you more tools to choose from. -- Adam smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a scroll view to recognize overflow on a custom view?
On 23/03/2009, at 3:12 PM, Ken Tozier wrote: Hi I have a custom view inside a scroll view and all works nicely except when the custom view's contents exceeds the depth of the scroll view. The scroll bars don't appear. I created the scroll view in IB from a standard widget and did nothing more than set the class of default content view to my custom class. I read the NSScrollView docs and the companion Scroll View Programming Guide for Cocoa and notice that neither the contentView nor the documentView are available from inside IB. I looked at the different IB data views with scroll bars, checking what their outlets are and tried setting mine up the same, but they must be doing something behind the scenes. What do I need to do to get the scroll view to notice when my custom view exceeds it's depth? Hi Ken, I may be wrong, but I came across similar scrollview behaviour in Tiger. IIRC, I asked about it here on cocoa-dev and got back that it was a known bug. As I say, not sure if this is still the case. My workaround was to uncheck the 'has scroll bar' in IB, then, in my case: id scrollview = [[tableView superview] superview]; [scrollview setHasVerticalScroller:YES]; [scrollview display]; The behaviour I was getting in my table view was that if you/the user selected a visible row, then arrow keyed down, it would continue past the bottom of the window but no (vertical) scroll bar would show and you couldn't see what was actually selected. HTH, Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a scroll view to recognize overflow on a custom view?
I think my issue is slightly different. The scroll bars never appear, no matter how much overflow there might be. I generally don't have a problem using table views as they seem to have some built-in mechanism for notifying the scroll view that they are deeper than it is. I'm trying to make my custom view do what table views are doing. I was hoping to do it all in IB but it's looking like I'll have to do the notifications programatically. On Mar 23, 2009, at 1:06 AM, Ron Fleckner wrote: I may be wrong, but I came across similar scrollview behaviour in Tiger. IIRC, I asked about it here on cocoa-dev and got back that it was a known bug. As I say, not sure if this is still the case. My workaround was to uncheck the 'has scroll bar' in IB, then, in my case: id scrollview = [[tableView superview] superview]; [scrollview setHasVerticalScroller:YES]; [scrollview display]; The behaviour I was getting in my table view was that if you/the user selected a visible row, then arrow keyed down, it would continue past the bottom of the window but no (vertical) scroll bar would show and you couldn't see what was actually selected. HTH, Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a scroll view to recognize overflow on a custom view?
Yes, the scroll bars never appeared in my case as well. That's why I resorted to the workaround. Good luck. On 23/03/2009, at 4:17 PM, Ken Tozier wrote: I think my issue is slightly different. The scroll bars never appear, no matter how much overflow there might be. I generally don't have a problem using table views as they seem to have some built-in mechanism for notifying the scroll view that they are deeper than it is. I'm trying to make my custom view do what table views are doing. I was hoping to do it all in IB but it's looking like I'll have to do the notifications programatically. On Mar 23, 2009, at 1:06 AM, Ron Fleckner wrote: I may be wrong, but I came across similar scrollview behaviour in Tiger. IIRC, I asked about it here on cocoa-dev and got back that it was a known bug. As I say, not sure if this is still the case. My workaround was to uncheck the 'has scroll bar' in IB, then, in my case: id scrollview = [[tableView superview] superview]; [scrollview setHasVerticalScroller:YES]; [scrollview display]; The behaviour I was getting in my table view was that if you/the user selected a visible row, then arrow keyed down, it would continue past the bottom of the window but no (vertical) scroll bar would show and you couldn't see what was actually selected. HTH, Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How to get a scroll view to recognize overflow on a custom view?
On Mar 22, 2009, at 21:12, Ken Tozier wrote: Hi I have a custom view inside a scroll view and all works nicely except when the custom view's contents exceeds the depth of the scroll view. The scroll bars don't appear. I created the scroll view in IB from a standard widget and did nothing more than set the class of default content view to my custom class. I read the NSScrollView docs and the companion Scroll View Programming Guide for Cocoa and notice that neither the contentView nor the documentView are available from inside IB. I looked at the different IB data views with scroll bars, checking what their outlets are and tried setting mine up the same, but they must be doing something behind the scenes. What do I need to do to get the scroll view to notice when my custom view exceeds it's depth? The document view *is* available from inside IB. It's the same thing as what you called the default content view. IB only suppresses explicit display of the clip view. If scroll bars don't appear, there are 2 likely causes: -- You are failing to set your custom view's depth properly. The depth is determined by your custom view's frame. Make sure you're setting the frame to the correct height (and not, for example, setting just the bounds to the desired height). -- The autoresize flags for your custom view are causing it to be resized because the enclosing scroll view is being resized as part of the window setup. If you want to control the view frame height yourself, make sure the vertical autoresize widget for the custom view in IB is not set to change the view height. You may want to also turn off the scroll view's resizes subviews automatically, unless you want the width of your view to match the scroll view automatically. Note that the non-appearance of the scroll bar most likely results from the above in combination with the hides scroll bars automatically option for the scroll view in IB. If you uncheck that, you should see the scroll bar, but the scroll bar would then be inactive if you don't maintain the view height correctly. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Creating UI for as of Get Info Panel
Hi All, I have to develop an application on which I have to draw a Get Info panel, displaying all the information of the file but I am not able to prepare the UI for this Panel. Is there any API for the Get Info Panel? Or can any one help me is finding the controls that can be used to develop it. Please help me in solving this query. Any pointers would be appreciated. Thanks and Regards, Ankur Singhal DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com