Re: -windowDidLoad not getting called
On Apr 21, 2008, at 5:34 PM, Rick Mann wrote: That's all a rather unfortunate inconsistency (and part of why I sit here learning Cocoa and thinking, I thought Cocoa was supposed to be this great thing). I basically want my controller to go do some stuff after it and the window are loaded. -setWindow seems like an ugly place to do this, and -init is probably too early. Is there a better place? It's not so inconsistent, really. A window controller is intended to be File's Owner for the nib containing a window, not be a separate top- level object in some other nib. If you do that, then the window controller will load the nib itself, and thus load the window within it too and send itself -windowDidLoad at the end. Since your window controller isn't what loaded the nib containing the window, its - windowDidLoad won't be invoked. You could refactor your nib so that your window and its owning window controller are in their own nib, with the window controller as File's Owner; check out Decompose Interface in Interface Builder 3 for an easy tool that will get you partway there. (You'll have to switch from using a separate object to using File's Owner as an instance of your NSWindowController subclass yourself.) NSWindowController isn't the only class in Cocoa that works this way; NSViewController also does, for similar reasons. It's a great substrate on which to build reusable component views. -- Chris ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[Ann] DMG Canvas
Greetings Cocoa Heads, Off topic, I admit, but y'all being fellow Cocoa developers, and having specifically written the app for us, I thought it fitting to post here. http://www.araelium.com/dmgcanvas/ Short and sweet, -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
problem getting main bundle inside initWithCoder:
hi, here's my initWithCoder: method:- This method is for a class other then AppController. - (id)initWithCoder:(NSCoder *)coder { if ((self = [super init]) != nil) { [self setPath:[coder decodeObjectForKey:@path]]; [self setModel:[coder decodeObjectForKey:@model]]; [self setSerial:[coder decodeObjectForKey:@serial]]; [self setRevision:[coder decodeObjectForKey:@revision]]; [self setSizeInSect:[coder decodeObjectForKey:@sizeInSect]]; // BAS related OSStatusjunk; // Create the AuthorizationRef that we'll use through this application. We ignore // any error from this. A failure from AuthorizationCreate is very unusual, and if it // happens there's no way to recover; Authorization Services just won't work. junk = AuthorizationCreate(NULL, NULL, kAuthorizationFlagDefaults, gAuth); assert(junk == noErr); assert( (junk == noErr) == (gAuth != NULL) ); // For each of our commands, check to see if a right specification exists and, if not, // create it. // // The last parameter is the name of a .strings file that contains the localised prompts // for any custom rights that we use. CFStringRef bundleID = CFBundleGetIdentifier(CFBundleGetMainBundle()); //*** I'm getting correct bundleID here //*** but the following code fails and bundle is nil after this CFBundleRef bundle = CFBundleGetBundleWithIdentifier(bundleID);// fails // more code here } return self; } what could be wrong? any help would be greatly appreciated. Thanks, Nick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
On Apr 22, 2008, at 3:00 AM, Seth Willits wrote: Greetings Cocoa Heads, Off topic, I admit, but y'all being fellow Cocoa developers, and having specifically written the app for us, I thought it fitting to post here. http://www.araelium.com/dmgcanvas/ Definitely _not_ off topic. Applications for use by developers is most certainly on-topic for this list. As are frameworks and libraries for Cocoa developers to use. Scott [Moderator] I only wish most apps like this also gave the option of dragging to a user application folder too. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Callbacks from IOKit
Rick Mann wrote: I'm doing some stuff with USB, and the example code I'm using uses IOServiceAddMatchingNotification() to add a pointer to a C callback to get notified when things happen on the USB bus. In C++, one typically uses the refcon parameter in these APIs to pass a pointer to the C++ object responsible for handling the callback, and a pointer to a static C++ member function that massages the call into a method dispatch. You will do the same in Cocoa, and in your callback function, use the refcon as your object id and call a method of your object. Just make sure that the object in question is not autoreleased, otherwise you'll have some weird and difficult to debug issues. Florent ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Programmatically placing an item in the dock
Quite simply there is no public API to control the dock. The closest (and hacky) solution is to modify the dock's plist and restart it. Mike. On 22 Apr 2008, at 07:02, Oliver Wagner wrote: Hi everyone, I would like to add and remove an item in the dock (preferably with a nice poof when removed) programmatically without restarting the dock. I can't find a way to do this in 10.5. Do any of you know if this is possible? Thanks, Ollie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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 [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSCollectionView and CoreData question
What I currently have is a core data store that holds information I want to display in an NSCollectionView. What I'm wondering is whether there is a way to get this accomplished and if so how? Yes, as described in the NSCollectionView documentation and the Leopard release notes. Hint: bindings. -- 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 [EMAIL PROTECTED]
Using OSMemoryBarrier() with KVO
Hi, I'm trying to implement a basic promise variable and I'm not sure if OSMemoryBarrier() is enough to make it correct. If anyone is familiar with the memory model, I'd appreciate a quick look-over. It's basically like this: { BOOL done; id result; NSError* error; NSException* exception; } Users ask for KVO notifications on 'done' and don't attempt to access any other ivars until done == YES. Then whatever thread or NSOperation or whatever that is responsible for delivering the result calls: -(void)completeWithResult:(id)res { result = res; [self willChangeValueForKey:@done]; done = YES; OSMemoryBarrier(); [self didChangeValueForKey:@done]; } Is this enough? Or will I need to use a full blown lock? Thanks, pt. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Carriage returns and NSXMLParser
Hi, Have there been any recent changes to NSXMLParser with respect to carriage returns? I haven't noticed it previously, but I'm suddenly seeing a lot of cases where carriage returns embedded in data are returned as spaces by the parser. That is: record id=429 data=A sample\nrecord / Is read in as if it were: record id=429 data=A sample record / I know that whitespace is technically ignored in XML, but I didn't think it was necessarily discarded either. Is that the way it's supposed to be? Is there an option I can set to change that? Thanks!! Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSCollectionView and CoreData question
On 22/04/2008, at 9:13 PM, I. Savant wrote: What I currently have is a core data store that holds information I want to display in an NSCollectionView. What I'm wondering is whether there is a way to get this accomplished and if so how? Yes, as described in the NSCollectionView documentation and the Leopard release notes. Hint: bindings. Having set the 'content' binding to the arrangedObjects key in IB didn't produce a result though doing it programmatically has. Not sure why this would be. Further, with the NSView, is there a way of knowing which of the objects that are contained in the NSCollectionView is being drawn and further being able to get the data for that specific object? Thanks, Matthew Delves ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
properties implementation
Hi, Is there a way to know how the compiler synthesized a property? For example, property(copy) NSSttring *str; AND @synthesize str; Will produce -(NSString) str{ return str; } OR -(NSString) str{ return [[str retain] autorelease]; } ? These two can change the behavior of the program str1 =aObject.str; aObject.str = str3; Is str1 still valid? The assignment will trigger a release of old value, right? I want to know the actual implementation of all different attributes if possible. Thank you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: properties implementation
I believe if you use the nonatomic attribute it will be the first example, for atomic it's the second. Atomic is the default if not specified. On Apr 22, 2008, at 6:49 AM, Optical Ali wrote: Hi, Is there a way to know how the compiler synthesized a property? For example, property(copy) NSSttring *str; AND @synthesize str; Will produce -(NSString) str{ return str; } OR -(NSString) str{ return [[str retain] autorelease]; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSCollectionView and CoreData question
Having set the 'content' binding to the arrangedObjects key in IB didn't produce a result though doing it programmatically has. Not sure why this would be. It depends. Since you have provided neither the exact bindings settings you're using nor the code you used to establish the binding manually, it's impossible to say. Further, with the NSView, is there a way of knowing which of the objects that are contained in the NSCollectionView is being drawn and further being able to get the data for that specific object? Not to sound like a broken record, but, have you *read* the documentation? Sure, the NSCollectionView / NSCollectionViewItem mechanism is a bit more challenging than your standard button or table, but not by much and it is fairly well-documented. See NSCollectionViewItem's documentation, paying particular attention to the phrase represented object. Regarding when it's drawing, the answer is 'when a view's -drawRect: is called'. If you don't have an NSView subclass that does its own drawing, however, the time it's drawn is none of your business by design. Frankly, if you're relying on that for anything other than drawing within the custom view, you're doing it wrong. Very very wrong. This all boils down to one vital question: What (as in 'the end result') are you trying to accomplish, *exactly*? ... okay, two. TWO vital questions. The second being: What *exactly* have you tried (be specific about code, bindings parameters, etc.)? -- 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 [EMAIL PROTECTED]
[NSMoveHelper _doAnimation] causes beachball of death
Hi, first I have to apologise that my information is very vague, but the crash happens in an Application and till today I was not able to create an demo-app to show this crash. The Application hangs when an Animation in a NSWindow happens. For Example NSWindow - (void)setFrame:(NSRect)windowFrame display:(BOOL)displayViews animate:(BOOL)performAnimation if animate:YES or NSApp - (void)beginSheet:(NSWindow *)sheet modalForWindow:(NSWindow *)docWindow modalDelegate:(id)modalDelegate didEndSelector: (SEL)didEndSelector contextInfo:(void *)contextInfo in both cases, the highest entry after the CFRunLoopInMode is [NSMoveHelper _doAnimation]. Maybe this is a known bug and someone can help out. Again sorry for the vague information and thank you very much in advance for any help. Best regards, matthias Schonder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Truncated Table Headers
On 21 Apr '08, at 9:14 PM, Jason Barker wrote: When I test the interface in Interface Builder as well as building and running the project in Xcode, I notice that the column names get cut off towards the end by about 15 pixels for single-word column names or just the last word is removed for two-word column names. It's leaving room for the up/down pointing arrow that indicates sort order. You'll need to make the columns about 15 pixels wider to avoid truncation. —Jens 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 [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
This looks very cool! But for the benefit of those of us who hate the use of DMGs for software downloads*, would it be possible to add an option to create a ZIP file instead? —Jens * Because the user then has to unmount the disk image after copying the app; and because way too many naive users don't understand what a disk image is, and run the app right from the DMG, which works fine until the next time they reboot or log in ... and then suddenly OMG all the apps I downloaded are gone!! I've known people to keep re- downloading apps over and over because of this. 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 [EMAIL PROTECTED]
Font-related crash in drawing method on PowerPC machines
Hi, I'm running into an odd crasher on PowerPC machines. I have a custom NSView called TYCurrentDayView that draws an nsmutableattributedstring on top of a gradient. On a few instances, I will receive the following crash: Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_FAILURE at 0x001f Crashed Thread: 0 Application Specific Information: objc[24283]: garbage collection is ON Thread 0 Crashed: 0 libobjc.A.dylib 0xfffeff18 objc_msgSend_rtp + 24 1 com.apple.AppKit0x93d33c3c -[NSATSGlyphStorage setGlyphRange:characterRange:] + 2424 2 com.apple.AppKit0x93d331b4 -[NSATSTypesetter _ctTypesetter] + 276 3 com.apple.AppKit0x93d324f0 -[NSATSLineFragment layoutForStartingGlyphAtIndex:characterIndex:minPosition:maxPosition:lineFragmentRect:] + 92 4 com.apple.AppKit0x93d316d0 -[NSATSTypesetter _layoutLineFragmentStartingWithGlyphAtIndex:characterIndex:atPoint:renderingContext:] + 1916 5 com.apple.AppKit0x93d30b18 -[NSSingleLineTypesetter createRenderingContextForCharacterRange:typesetterBehavior:usesScreenFonts:hasStrongRight:maximumWidth:] + 388 6 com.apple.AppKit0x93d81b38 __NSCreateRenderingContextForAttributedString + 288 7 com.apple.AppKit0x93d25680 -[NSAttributedString(NSExtendedStringDrawing) boundingRectWithSize:options:] + 1052 8 com.apple.AppKit0x93df067c -[NSAttributedString(NSStringDrawing) size] + 52 9 com.secondgear.today0x8054 -[TYCurrentDayView drawRect:] + 900 10 com.apple.AppKit0x93dad044 -[NSView _drawRect:clip:] + 2908 11 com.apple.AppKit0x93dac02c -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 844 12 com.apple.AppKit0x93dac2d0 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1520 (Full Trace at http://secondgearllc.com/attachments/42208crasher.txt) The code itself that looks to be causing the issue is: NSMutableAttributedString *todaysDate = [[NSMutableAttributedString alloc] init]; NSMutableAttributedString *datePrefix = [[NSMutableAttributedString alloc] initWithString:NSLocalizedString(@Today is , @Today Is String)]; NSMutableAttributedString *actualDate = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@%@, [dateFormatter stringFromDate:self.currentDay]]]; [todaysDate appendAttributedString:datePrefix]; [todaysDate appendAttributedString:actualDate]; NSRange fullDateRange = NSMakeRange(0, todaysDate.length); NSRange dateOnlyRange = NSMakeRange(9, todaysDate.length-datePrefix.length); // The amount of chars in Today is [todaysDate beginEditing]; [todaysDate addAttribute:NSFontAttributeName value:[NSFont fontWithName:@Lucida Grande size:16.0] range:fullDateRange]; [todaysDate addAttribute:NSFontAttributeName value:[NSFont fontWithName:@Lucida Grande Bold size:16.0] range:dateOnlyRange]; [todaysDate addAttribute:NSForegroundColorAttributeName value:[NSColor whiteColor] range:fullDateRange]; [todaysDate addAttribute:NSKernAttributeName value:[NSNumber numberWithFloat:0.5] range:fullDateRange]; [todaysDate endEditing]; I've never been able to reproduce it on any Intel machines, but it happens about 10-20% of the time on PowerPC Macs. Any help would be appreciated. - Justin Williams [EMAIL PROTECTED] http://secondgearllc.com/ - Check out Today: iCal's new best friend http://secondgearllc.com/today/- ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: properties implementation
On 22 Apr '08, at 6:38 AM, Michael Vannorsdel wrote: I believe if you use the nonatomic attribute it will be the first example, for atomic it's the second. Atomic is the default if not specified. And atomic setters are even more complicated, as they incorporate a lock, to avoid race conditions when two threads try to set the property at the same time. The sad thing is that this makes synthesized property accessors much more expensive than is generally necessary, unless you manually add the nonatomic attribute to each one. (I say generally because most Cocoa application code isn't multithreaded, and even thread-safe code requires synchronization to be done at a level higher than individual property values, so it probably has its own synchronization code as well.) —Jens 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 [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
* Because the user then has to unmount the disk image after copying the app; and because way too many naive users don't understand what a disk image is, and run the app right from the DMG, which works fine until the next time they reboot or log in ... and then suddenly OMG all the apps I downloaded are gone!! I've known people to keep re-downloading apps over and over because of this. That's a debate that's probably more appropriate for another list, but it's the first thing I thought of. I already use another tool that automates this process (FileStorm) but I've been on the fence for awhile about the use of disk images because of the regular user support problems it sets up. I say that only to impart anecdotal goodness: I've been accused of deleting someone's application after they rebooted as an underhanded tactic. They apologized (albeit bitterly) when they realized they didn't follow the installation instructions and the application's disk image had simply been unmounted upon reboot. Because of course my goal is to screw the users for no apparent reason, giving them fuel for their blogs ... Anyway, Seth: this looks like a well-polished utility from the screenshots alone. Congrats and thanks! I'll download it and give it a closer look when I have more time. -- 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 [EMAIL PROTECTED]
Re: Font-related crash in drawing method on PowerPC machines
I'm running into an odd crasher on PowerPC machines. I have a custom NSView called TYCurrentDayView that draws an nsmutableattributedstring on top of a gradient. On a few instances, I will receive the following crash: I haven't looked at this in detail and don't know if this has anything to do with your problem, but how are you handling the case where the user has disabled or otherwise modified their fonts? Even system fonts can be screwed with and if the font is not available, assuming it always will be is probably Not a Good Idea™. -- 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 [EMAIL PROTECTED]
Calling NSNumber class methods on NSDecimalNumber
After some testing, it appears that calling NSDecimalNumber with class methods of it's NSNumber parent class return the expected NSDecimalNumber object. For example, [[NSDecimalNumber numberWithDouble:1.1] isKindOfClass:[NSDecimalNumber class]] returns YES (and the resulting object has the correct value) The problem is that I get the warning initialization from distinct Objective-C type when I do this, because the NSNumber class methods return a specific type instead of id. My question is: is this a bug in the NSNumber headers that I should report, or is this unsafe code and I shouldn't be doing this? Thanks, Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
First off: The app looks great from your screenshots! Well done! On Apr 22, 2008, at 8:05 AM, Jens Alfke wrote: * Because the user then has to unmount the disk image after copying the app; and because way too many naive users don't understand what a disk image is, and run the app right from the DMG, which works fine until the next time they reboot or log in ... and then suddenly OMG all the apps I downloaded are gone!! I've known people to keep re-downloading apps over and over because of this. If you create an Internet Enabled disk image the contents is unpacked, and the disk image itself moved to the trash, for you automatically . This obviously negates most of the neat userinterfacery that you get out of using this app in the first place though... I'm not sure if you can both have your cake and eat it when it comes to software distribution. Either you use something like a Zip file, or an Internet Enabled DMG - In which case you don't get the nice disk image backgrounds that we all love (and click through licences that we all hate), OR you get background, but also all the overhead and usability problems of DMGs. Technically I guess that the backgrounds and stuff is just Finder folder configuration, but for it to work the folder would have to automatically open, and I don't think you can make Safari (or the other browsers) do that for you when it comes to folders inside Zip files or Internet Enabled DMGs. I could be wrong though. j o a r ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: properties implementation
On Apr 22, 2008, at 5:49 AM, Optical Ali wrote: Is there a way to know how the compiler synthesized a property? http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW2 mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSButton reveals keyboard shortuct
Hi! I love how the buttons in some save before closing sheets reveal themselves by being added to the button name when the command key is held for a while. The one example I can think of is AppleWorks 6. Wish all apps / buttons had that. Is this a Carbon thing? How would I go about to implement this? Seeing that the button in question is not in the responder chain, I guess the implementation ought to be moved to the window or window controller. This doesn't strike me as the best place. I'd rather have a reusable NSButton subclass. Such buttons also may have multiple shortcuts. E.g. the default save button is triggered by both Enter and cmd-S. This does not seem to be possible with NSButton. Again I wonder if I should override keyDown: in my window controller. BTW, how are keyboard shortcuts on NSButtons implemented? Do they somehow register with the window for events or does the window walk the subcomponents to find one which may respond? Best, Pierre --- Pierre Bernard http://www.bernard-web.com/pierre http://www.houdah.com smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTableView -editColumn:row:withEvent:select: question
On Apr 21, 2008, at 10:43 AM, John Stiles wrote: Corbin Dunn wrote: On Apr 18, 2008, at 3:37 PM, John Stiles wrote: Ben Lachman wrote: Well, you should be able to just override the drawing code, since thats really your problem. Going directly against the docs, while it may work fine now, is playing with fire in my opinion. Yeah… that's why I posted :) I was hoping to get a oh yeah, that only applies if [...], file a radar on the docs or something. I decided that, no matter what, the docs are definitely not right, because they claim that an exception will be thrown even though that clearly does not happen. So I filed a radar; we'll see if anything comes back. rdar://5875017 [Docs] -editColumn:row:withEvent:select: needs clarification The docs are wrong. The row doesn't have to be selected before you call editColumn:. The row has to be selected before NSTableView will call editColumn:. If you are calling it yourself at the appropriate time, then that is a-okay. In effect, another way to get what you want is to override selection drawing and to not draw selection. So, tableview still has a selected row, but it just doesn't show up selected. Excellent. Thanks for the clarification, it's much appreciated!! (How do you override selection drawing? Reimplement - highlightSelectionInClipRect:? Not that I think I need to, I'm just curious.) That, and subclass the cell, and return nil from: - (NSColor *)highlightColorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView; ..I know, it is sort of strange, and I am working on making that easier. corbin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Consistent Contextual Menu in NSTableview
And to elaborate further, the DragNDropOutlineView demo app on Leopard has sample code for how to do it. corbin On Apr 21, 2008, at 1:37 PM, Nate Weaver wrote: I would probably override -menuForEvent: instead of -rightMouseDown: . Leopard also has a bit nicer contextual menu handing for table/ outline views: If you right-click a row that's not currently selected it highlights just an outline and doesn't change the selection (you can use -clickedRow to get that row from within your action method(s)). On Apr 21, 2008, at 11:59 AM, Steve Cronin wrote: Folks; I'm having some difficulty getting consistent contextual menu behavior in NSTableView. In the Finder and iTunes (what I feel most users are familiar with) if a row is selected but the user causes a contextual menu on a different row then row selection changes. (I don't want to start a UI flame about 'correctness') I'm only interested in consistency!! NOTE: the contextual menu can appear by a right mouse click, a two- fingered tap, and a control-click which appear to be detected as different events (see below) The base NSTableView class does NOT change the selection when a contextual click occurs on a row If I sub-class and add: - (void)rightMouseDown:(NSEvent *)theEvent { [self selectRow:[self rowAtPoint:[self convertPoint:[theEvent locationInWindow] fromView:nil]] byExtendingSelection:NO]; [super rightMouseDown:theEvent]; } I get half-way home. Now the right mouse click and the two- fingered tap will alter the selection. BUT the control-click does not. The Cocoa adage, if you are working too hard, you probably are keeps rummaging around my brain What is the preferred means to efficiently make consistent contextual menu behavior like Finder and iTunes? Thanks, Steve ___ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
SOLVED: Truncated Table Headers
Thanks for that explanation. The smaller columns where this truncating behavior is exhibited do not need to have sort descriptors created so I just unchecked the Creates Sort Descriptor option. Thanks again for your help! Jason On Tue, Apr 22, 2008 at 9:00 AM, Jens Alfke [EMAIL PROTECTED] wrote: On 21 Apr '08, at 9:14 PM, Jason Barker wrote: When I test the interface in Interface Builder as well as building and running the project in Xcode, I notice that the column names get cut off towards the end by about 15 pixels for single-word column names or just the last word is removed for two-word column names. It's leaving room for the up/down pointing arrow that indicates sort order. You'll need to make the columns about 15 pixels wider to avoid truncation. —Jens ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
AppleScript - occasional crashes on Leopard
Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@some valid dynamic script text NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
On Apr 22, 2008, at 11:47 AM, Steve Cronin wrote: will OCCASIONALLY crash at the NSAppleEventDescriptor specification: Are you using NSAppleScript in the main thread? The only time I've ever seen compiling a script crash was when it was not running in the main thread. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
Is there a way using this tool or even programmatically, to have disk images mount without having the collapsed toolbar? The biggest user confusion I see is that they do not even recognize it to be a window since most users don't even know what that capsule shaped button does. There is definitely a big gulf of knowledge that all of us should be working to educate users about, albeit in subtle ways. We should all be making subtle efforts to convince users that they want to and need to learn more. This reduces support costs. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
Sounds like you're using NSAppleScript from a non-main thread, which will result in random crashes like that. NSAppleScript is only designed to work from the main thread. -- m-s On 22 Apr, 2008, at 13:47, Steve Cronin wrote: Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@some valid dynamic script text NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san %40bungie.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
NO threading involved here. Just straight up Cocoa code... Do you know enough about AS internals to read the stack trace and KNOW that the error is during compilation? If so, why is the error not being propagated back thru errorDict? And the biggest mystery (to me anyway) why only sometimes? Steve On Apr 22, 2008, at 1:10 PM, Nick Zitzmann wrote: On Apr 22, 2008, at 11:47 AM, Steve Cronin wrote: will OCCASIONALLY crash at the NSAppleEventDescriptor specification: Are you using NSAppleScript in the main thread? The only time I've ever seen compiling a script crash was when it was not running in the main thread. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
On Apr 22, 2008, at 8:23 AM, j o a r wrote: Technically I guess that the backgrounds and stuff is just Finder folder configuration, but for it to work the folder would have to automatically open, and I don't think you can make Safari (or the other browsers) do that for you when it comes to folders inside Zip files or Internet Enabled DMGs. I could be wrong though. Somehow Finder obliterates the settings for an unzipped folder, even if I use StuffIt and tell it to put the .DS_Stores in the archive. It just doesn't work the same somehow. (Plus you can't have license agreements in there.) Fighting Finder to script the appearance of the disk image is a headache on it's own; I'd rather skip the nonsense to try to force Finder into something it doesn't want to do at all. Thanks for all of the responses on and off list. -- Seth Willits ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
On 4/22/08 12:00 AM, Seth Willits said: Off topic, I admit, but y'all being fellow Cocoa developers, and having specifically written the app for us, I thought it fitting to post here. http://www.araelium.com/dmgcanvas/ Looks nice. Care to comment why a FileStorm user might want to switch? :) -- Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
For reference, you're not supposed to pass a pointer to a valid NSDictionary object in -executeAndReturnError:, you're supposed to pass a pointer to an NSDictionary pointer variable. On return, if there were errors encountered, errorDict will be a valid NSDictionary object. -- m-s On 22 Apr, 2008, at 13:47, Steve Cronin wrote: NSString *theScript =@some valid dynamic script text NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
on 2008-04-22 2:31 PM, Steve Cronin at [EMAIL PROTECTED] wrote: NO threading involved here. Just straight up Cocoa code... Bear in mind that running a script via NSAppleScript (or the corresponding method in OSAKit) on a machine that has Unsanity's Application Enhancer (APE) installed automatically causes the script to be run in a secondary thread. At least, this was true a couple of years ago when I first encountered the problem. I ran into this problem with APE in one of my own applications that uses NSAppleScript to run a script. I worked closely with Unsanity at that time to figure out how to deal with the problem. As a result, I now always force my scripts to run on the main thread by calling -performOnMainThread (I forget exactly what the method is called). This seems to work around the problem on machines that have APE installed. Unfortunately, it is difficult to support customers/users running APE. Folks with haxies installed rarely know that they should mention it when they submit problem reports. I've gotten in the habit of asking that question up front in response to almost all support calls. -- Bill Cheeseman - [EMAIL PROTECTED] Quechee Software, Quechee, Vermont, USA www.quecheesoftware.com PreFab Software - www.prefabsoftware.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 [EMAIL PROTECTED]
Re: [Ann] DMG Canvas
On 22-Apr-08, at 12:03 PM, [EMAIL PROTECTED] wrote: Looks nice. Care to comment why a FileStorm user might want to switch? :) Because I keep running into annoying bugs in FileStorm's AppleScript implementation, and the dmgcanvas command line tool might integrate into my workflow better? -- Alex Curylo -- [EMAIL PROTECTED] -- http://www.alexcurylo.com/ Optimists see the glass half full. Pessimists see the glass half empty. Engineers see that the glass is twice as big as it needs to be. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
GUI Time Field
I am trying to put a automatic date and time field into my GUI. I have a text field connected to a variable called theDateTime in my controller class. If I set the variable manually the text field works just fine. But I want it to update automatically. My code is attached. Thank you Justin Giboney #import Controller.h @implementation Controller - (id) init { [super init]; [NSThread detachNewThreadSelector:@selector(runClock) toTarget: self withObject: nil]; return self; } - (void) setDateTime { NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; theDateTime = [NSDate date]; [tempPool release]; } - (void) runClock { bool keepRunning = true; do { // sleep the specified time usleep(500); [self setDateTime]; } while (keepRunning == true); } @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 [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
Mark, So GC + NSAppleScript == avoid for now? -- m-s On 22 Apr, 2008, at 15:53, Mark Piccirelli wrote: Is this a garbage-collected app? If so the crash is a known bug. -- Mark On Apr 22, 2008, at 10:47 AM, Steve Cronin wrote: Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@some valid dynamic script text NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/markp%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san %40bungie.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: AppleScript - occasional crashes on Leopard
Yes. But we intend to fix it in a software update. (And I can't say anything more specific than that. A fix isn't a fix until it's shipped.) -- Mark On Apr 22, 2008, at 1:01 PM, Michael Watson wrote: Mark, So GC + NSAppleScript == avoid for now? -- m-s On 22 Apr, 2008, at 15:53, Mark Piccirelli wrote: Is this a garbage-collected app? If so the crash is a known bug. -- Mark On Apr 22, 2008, at 10:47 AM, Steve Cronin wrote: Folks; I've seen some inconsistent behavior on AppleScript running under Leopard. Here's an example: ... NSString *theScript =@some valid dynamic script text NSDictionary *errorDict = [NSDictionary dictionary]; NSAppleScript *appleScriptObject = [[NSAppleScript alloc] initWithSource:theScript]; NSAppleEventDescriptor *eventDescriptor = [appleScriptObject executeAndReturnError: errorDict]; ... will OCCASIONALLY crash at the NSAppleEventDescriptor specification: #0 0x932c3d5c in getDescDataType #1 0x932c7ab7 in aeCoerceDescInternal #2 0x932cc055 in AECoerceDesc #3 0x1d4a8150 in ComponentCoerceDesc #4 0x1d48cbec in ASCompile #5 0x903bacb8 in CallComponentFunction #6 0x1d487ae2 in AppleScriptComponent #7 0x1d4a3927 in AGenericManager::HandleOSACall #8 0x903755cd in CallComponentDispatch #9 0x953fc513 in OSACompile #10 0x93e6edaf in -[NSAppleScript compileAndReturnError:] #11 0x93e6f096 in -[NSAppleScript(NSPrivate) _executeWithMode:andReturnError:] #12 0x93e6ee51 in -[NSAppleScript executeAndReturnError:] Is there a new/better means in Leopard of accomplishing the execution of dynamic scripts? NO the crash is NOT related to the validity of the script, of this I am absolutely certain! (It only crashes sometimes using the same resulting script!!) Is a dual processor Intel creating a risk here? Is there something better I can do to handle the error? Why should I have to use a @try block here? I thought that was what the executeAndReturnError parameter was for!! But I don't get a chance to examine the errorDict. It will crash only every so often My hunch is that crashes are more likely when machine is under load and memory swapping might be involved. This is running on a 4G MacBook... Any wisdom appreciated! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/markp%40apple.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san%40bungie.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: GUI Time Field
On Tue, Apr 22, 2008 at 12:34 PM, Justin Giboney [EMAIL PROTECTED] wrote: I am trying to put a automatic date and time field into my GUI. I have a text field connected to a variable called theDateTime in my controller class. If I set the variable manually the text field works just fine. But I want it to update automatically. My code is attached. Thank you Justin Giboney #import Controller.h @implementation Controller - (id) init { [super init]; [NSThread detachNewThreadSelector:@selector(runClock) toTarget: self withObject: nil]; return self; } - (void) setDateTime { NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; theDateTime = [NSDate date]; [tempPool release]; } Sorry hit send by mistake on my prior email... In the above you don't retain the object you assign to theDateTime so it goes away when the current thread pool is drained. Also it isn't clear how you expect the above simple setting of an ivar to trigger your UI to update (you have it bound?). If so you shouldn't update UI in this way from a secondary thread (especially if bindings are used). You should use a proper setter (e.g. -setDateTime:(NSDate*)date) that does the proper memory management and have your thread function create the date object and call the setter. If you want to use a secondary thread use performSelectorOnMainThread to get the update to take place from the context of the main thread. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Problems with [NSArray count]
Hi, I'm returning to Cocoa after quite a long break, and it seems that I'm a little rusty... All I want to do is find out the number of items in an NSArray and store that as a variable, which I can then find the square root of. The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. a simple int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? Thanks, Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Tue, Apr 22, 2008 at 2:03 PM, Peter Browne [EMAIL PROTECTED] wrote: Hi, I'm returning to Cocoa after quite a long break, and it seems that I'm a little rusty... All I want to do is find out the number of items in an NSArray and store that as a variable, which I can then find the square root of. The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. a simple int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? NSUInteger is either unsigned int in the 32 bit runtime or unsigned long in the 64 bit runtime. Review: http://developer.apple.com/documentation/Cocoa/Conceptual/Cocoa64BitGuide/64BitChangesCocoa/chapter_3_section_2.html The crash is unrelated the use of int in the above... Can you outline more information about the crash you are seeing? -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Apr 22, 2008, at 2:03 PM, Peter Browne wrote: I'm returning to Cocoa after quite a long break, and it seems that I'm a little rusty... All I want to do is find out the number of items in an NSArray and store that as a variable, which I can then find the square root of. The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. An NSUInteger is just an integer that is 32-bits or 64-bits depending on if your application is compiled for 32-bit or 64-bit. a simple int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? Are you getting an exception? perhaps myArray isn't really an NSArray at the time that you are sending it the -count message? -- David Duncan Apple DTS Animation and Printing [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Tue, Apr 22, 2008 at 2:10 PM, Shawn Erickson [EMAIL PROTECTED] wrote: On Tue, Apr 22, 2008 at 2:03 PM, Peter Browne [EMAIL PROTECTED] wrote: Hi, I'm returning to Cocoa after quite a long break, and it seems that I'm a little rusty... All I want to do is find out the number of items in an NSArray and store that as a variable, which I can then find the square root of. The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. a simple int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? NSUInteger is either unsigned int in the 32 bit runtime or unsigned long in the 64 bit runtime. Also when in doubt about what a type is defined as command double click the type name in source to bring up the definition (or right-click jump to definition). -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Apr 22, 2008, at 5:03 PM, Peter Browne wrote: The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. You could do a search using the built-in documentation browser in Xcode (it's in the Help menu). Alternatively, Google would seem an obvious thing to try -- it turns up a number of relevant documents. int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? My first guess would be that myArray was not properly retained and was deallocated before you sent the count message. You may want to review the memory management rules, especially if you're quite rusty: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html . Also, are you sure that's the line you're crashing on? Do any error messages get written to the console? --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextfields and keyboard equivalents - am I missing something?
On Mon, Apr 21, 2008 at 7:05 PM, John Stiles [EMAIL PROTECTED] wrote: In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against the menus before passing it through the responder chain. Is this really the case? The control actually gets the chance to respond to the event in the performKeyEquivalent: according to debugger - before_ the menu item gets the event. And after re-reading #1 again, I really can't see that holding down the command key should bypass the ordinary chain? A key equivalent is a key or key combination (usually a key modified by the Command key) that is bound typically to some menu item or control object in the application. Pressing the key combination simulates the action of clicking the control or choosing the menu item. The application object handles key equivalents by going down the view hierarchy in the key window, sending each object a performKeyEquivalent: message until an object returns YES. If the message isn't handled by an object in the view hierarchy, NSApp then sends it to the menus in the menu bar. Some Cocoa classes, such as NSButton, NSMenu, NSMatrix, and NSSavePanel provide default implementations. Am I missing something here, or what do you base your claim on? :) I think your best bet is to dim your menu item or remove its key equivalent when a text field gains first responder, and then restore it when the text field loses first responder. I thought about that, but that really isn't a clean solution; if the user so wants, the menu item action should still be able to be performed by the user choosing the item in the menu - even if the text field has focus (and in this case, I'd say it would be reasonable if the menu item's target would get the action message). What do you think? Mattias Arrelid wrote: I have a simple test application with a few custom menu items. Let's assume that _none_ of these items has a key equivalent of COMMAND + (right arrow) for now. When the first responder of the application is an NSTextField, and the user produces COMMAND + (right arrow), the insertion point is being placed right after the last character in the text field. This is true as long as the text field stays the first responder. As mentioned earler, I _don't_ have a menu item with such a key equivalent at this point. If I add a menu item that _has_ a key equivalent of COMMAND + (righ arrow), what happens is that this item's action is performed when I press the above key combo - even if the text field is the first responder. Is this supposed to happen? When reading the Cocoa Event-Handling documentation, I stumbled upon this: http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/1060i-CH3-SW10 Inspired by that, I enabled some breakpoints in my project. From these, I can see that the text field doesn't seem to care about saying yes, I do respond to COMMAND + (right arrow) when its performKeyEquivalent: is called, which explains why the menu item gets the action eventually. Is this correct? To sum things up: I want the text field to respond to all standard key equivalents (move cursor to front, end, move word forward/backward etc.), even if I have a menu item with such a key equivalent. There are applications that behave like this, e.g. iTunes, and I do think that this is the correct behavior. Could anyone point me in the right direction here? Regards Mattias ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jstiles%40blizzard.com This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Saving NSTextView data to CoreData without ending editing
I have an application that periodically needs to save content contained in an NSTextView. The text view is bound to a Core Data managed object. Currently, I am ending editing on the text view to force it to save its contents into the store. However, since I'm doing it automatically on a time interval, the view goes out of focus which is annoying if you're typing into it. Is there a way to save the text view's contents without ending editing on it? Thanks, 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 [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On 22 Apr 2008, at 22:15, David Duncan wrote: On Apr 22, 2008, at 2:03 PM, Peter Browne wrote: I'm returning to Cocoa after quite a long break, and it seems that I'm a little rusty... All I want to do is find out the number of items in an NSArray and store that as a variable, which I can then find the square root of. The docs tell me that [NSArray count] returns an NSUInteger, but exactly WHAT one of these is, or how I use it is baffling me. An NSUInteger is just an integer that is 32-bits or 64-bits depending on if your application is compiled for 32-bit or 64-bit. a simple int i = [myArray count]; crashes out, and I've tried various other types of variable to no avail. Any thoughts? Am I missing something blindingly obvious here? Are you getting an exception? perhaps myArray isn't really an NSArray at the time that you are sending it the -count message? I'm getting an EXC_BAD_ACCESS error. I've since managed to solve the problem by inserting a [myArray retain]; but I'm not entirely sure WHY this fixed it... The process followed is: 1) the myController object acquires data from a text file, using NSString's -stringWithContentsOfFile:encoding:error 2) myArray then grabs this data (a bunch of numbers) using NSArray's - componentsSeparatedByString: 3) myController then passes the myArray object to myView (for later graph drawing) using my - (void)displayData:(NSArray *)theArray method 4) myView then calls [theArray count] 5) EXC_BAD_ACCESS inserting a [myArray retain] just before passing the data to the view fixed the problem. Why should this be the case? As far as I'm aware the object isn't being released at that point, so what's the need for a -retain message? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSTextfields and keyboard equivalents - am I missing something?
Mattias Arrelid wrote: On Mon, Apr 21, 2008 at 7:05 PM, John Stiles [EMAIL PROTECTED] wrote: In The Path Of Key Events in the URL you posted, the #1 item in the list is key equivalents. AppKit checks keyDown events to see if command is held; if it is, it tries to match it against the menus before passing it through the responder chain. Is this really the case? The control actually gets the chance to respond to the event in the performKeyEquivalent: according to debugger - before_ the menu item gets the event. And after re-reading #1 again, I really can't see that holding down the command key should bypass the ordinary chain? A key equivalent is a key or key combination (usually a key modified by the Command key) that is bound typically to some menu item or control object in the application. Pressing the key combination simulates the action of clicking the control or choosing the menu item. The application object handles key equivalents by going down the view hierarchy in the key window, sending each object a performKeyEquivalent: message until an object returns YES. If the message isn't handled by an object in the view hierarchy, NSApp then sends it to the menus in the menu bar. Some Cocoa classes, such as NSButton, NSMenu, NSMatrix, and NSSavePanel provide default implementations. Am I missing something here, or what do you base your claim on? :) In practice, I have found that if the command key is held, menus will get the event before the view hierarchy gets a shot at it, but if command is not held, the view hierarchy gets first crack at it. For instance, if you have a custom view that has first-responder, it will get a key-down for the space bar even if you have a menu item with its key equivalent set to the space bar—but it will not get a key-down for command-C, the Copy menu item will get that first. I've got a radar open on this behavior because I think it's unintuitive that some menu equivalents are treated differently than others. But in Leopard (and I think Tiger), that's how it is. I think your best bet is to dim your menu item or remove its key equivalent when a text field gains first responder, and then restore it when the text field loses first responder. I thought about that, but that really isn't a clean solution; if the user so wants, the menu item action should still be able to be performed by the user choosing the item in the menu - even if the text field has focus (and in this case, I'd say it would be reasonable if the menu item's target would get the action message). What do you think? Remove the key equivalent from the menu item when your text field has focus, and restore it when the text field loses focus. Or in the action method for command+arrow, see if a text field has focus, and if so, send an appropriate message to the text field (-moveToEndOfLine: perhaps) and then return immediately. I don't think it is going to get much more beautiful than that, unfortunately. Mattias Arrelid wrote: I have a simple test application with a few custom menu items. Let's assume that _none_ of these items has a key equivalent of COMMAND + (right arrow) for now. When the first responder of the application is an NSTextField, and the user produces COMMAND + (right arrow), the insertion point is being placed right after the last character in the text field. This is true as long as the text field stays the first responder. As mentioned earler, I _don't_ have a menu item with such a key equivalent at this point. If I add a menu item that _has_ a key equivalent of COMMAND + (righ arrow), what happens is that this item's action is performed when I press the above key combo - even if the text field is the first responder. Is this supposed to happen? When reading the Cocoa Event-Handling documentation, I stumbled upon this: http://developer.apple.com/documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/chapter_2_section_3.html#//apple_ref/doc/uid/1060i-CH3-SW10 Inspired by that, I enabled some breakpoints in my project. From these, I can see that the text field doesn't seem to care about saying yes, I do respond to COMMAND + (right arrow) when its performKeyEquivalent: is called, which explains why the menu item gets the action eventually. Is this correct? To sum things up: I want the text field to respond to all standard key equivalents (move cursor to front, end, move word forward/backward etc.), even if I have a menu item with such a key equivalent. There are applications that behave like this, e.g. iTunes, and I do think that this is the correct behavior. Could anyone point me in the right direction here? Regards Mattias ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription:
Re: Problems with [NSArray count]
On Tue, Apr 22, 2008 at 11:45 PM, Peter Browne [EMAIL PROTECTED] wrote: The process followed is: ... 2) myArray then grabs this data (a bunch of numbers) using NSArray's -componentsSeparatedByString: You haven't told us where myArray comes from in the first place... Hamish ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Tue, Apr 22, 2008 at 2:45 PM, Peter Browne [EMAIL PROTECTED] wrote: I'm getting an EXC_BAD_ACCESS error. I've since managed to solve the problem by inserting a [myArray retain]; but I'm not entirely sure WHY this fixed it... The process followed is: 1) the myController object acquires data from a text file, using NSString's -stringWithContentsOfFile:encoding:error 2) myArray then grabs this data (a bunch of numbers) using NSArray's -componentsSeparatedByString: 3) myController then passes the myArray object to myView (for later graph drawing) using my - (void)displayData:(NSArray *)theArray method 4) myView then calls [theArray count] 5) EXC_BAD_ACCESS inserting a [myArray retain] just before passing the data to the view fixed the problem. Why should this be the case? As far as I'm aware the object isn't being released at that point, so what's the need for a -retain message? Read the following carefully (in particular for the issue biting you look for any discussion on convenience methods/constructors and the use of proper accessors)... http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/index.html -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using OSMemoryBarrier() with KVO
On Tue, Apr 22, 2008 at 4:37 AM, Paul Thomas [EMAIL PROTECTED] wrote: Is this enough? Or will I need to use a full blown lock? Yes and no... 1) KVO and multiple thread gets ugly quick, 2) using NSCondition/Lock may make more sense, 3) using just a volatile BOOL could be enough depending on how lazy the detection of the ivar can be, 4) look at using OSAtomicXxxx functions [1]. Note OSMemoryBarrier is just an ordering construct (only really applicable to PowerPC at this time) not an atomic operation or locking construct. -Shawn [1] http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/chapter_5_section_6.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSString memory management question
I wrote a routine that creates a CFStringRef from some USB calls. I use it like this: NSString* s = (NSString*) createStringDescriptor(dev, stringIndex); [mSerialNumberDisplay setStringValue: [s lowercaseString]]; [s release]; Two main questions: am I right to release the bridged NSString* s? and, what happens in -lowercaseString? How does that get released? TIA, -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: GUI Time Field
Thank you for response, I hope I have improved my code. I am binding my text field to the variable theDateTime. I know this works because if I uncomment the commented line, I can see the date and time. The problem is that the UI isn't updating. Thanks again. Justin Giboney #import Controller.h @implementation Controller - (id) init { [super init]; //[self setDateTime: [NSDate date]]; [NSTimer scheduledTimerWithTimeInterval: 1 target: self selector: @selector(runClock:) userInfo: nil repeats: YES]; return self; } - (void) setDateTime: (NSDate *) theDate { theDateTime = theDate; NSLog(@setting the date %@, [theDateTime description]); } - (void) runClock: (NSTimer *) theTimer { [self setDateTime: [NSDate date]]; } @end On Apr 22, 2008, at 2:41 PM, Shawn Erickson wrote: On Tue, Apr 22, 2008 at 12:34 PM, Justin Giboney [EMAIL PROTECTED] wrote: I am trying to put a automatic date and time field into my GUI. I have a text field connected to a variable called theDateTime in my controller class. If I set the variable manually the text field works just fine. But I want it to update automatically. My code is attached. Thank you Justin Giboney #import Controller.h @implementation Controller - (id) init { [super init]; [NSThread detachNewThreadSelector:@selector(runClock) toTarget: self withObject: nil]; return self; } - (void) setDateTime { NSAutoreleasePool *tempPool = [[NSAutoreleasePool alloc] init]; theDateTime = [NSDate date]; [tempPool release]; } Sorry hit send by mistake on my prior email... In the above you don't retain the object you assign to theDateTime so it goes away when the current thread pool is drained. Also it isn't clear how you expect the above simple setting of an ivar to trigger your UI to update (you have it bound?). If so you shouldn't update UI in this way from a secondary thread (especially if bindings are used). You should use a proper setter (e.g. -setDateTime:(NSDate*)date) that does the proper memory management and have your thread function create the date object and call the setter. If you want to use a secondary thread use performSelectorOnMainThread to get the update to take place from the context of the main thread. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: GUI Time Field
On Tue, Apr 22, 2008 at 3:24 PM, Justin Giboney [EMAIL PROTECTED] wrote: Thank you for response, I hope I have improved my code. The setter isn't doing the proper memory management. Review the following... http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmPractical.html#//apple_ref/doc/uid/TP40004447-SW4 I am binding my text field to the variable theDateTime. I know this works because if I uncomment the commented line, I can see the date and time. The set in the init method gets things setup before awakeFromNib is called and before bound objects begin to pull their values from the objects they are bound to. In other words setting this value in init isn't proof that your UI objects are properly bound and/or your objects are properly sending KVO notifications when a property changes. The problem is that the UI isn't updating. See if retaining the date object as needed solves that... If not something additional is wrong. -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSString memory management question
On Tue, Apr 22, 2008 at 3:25 PM, Rick Mann [EMAIL PROTECTED] wrote: I wrote a routine that creates a CFStringRef from some USB calls. I use it like this: NSString* s = (NSString*) createStringDescriptor(dev, stringIndex); [mSerialNumberDisplay setStringValue: [s lowercaseString]]; [s release]; Two main questions: am I right to release the bridged NSString* s? and, We don't know how you created the CFStringRef so we cannot say. The answer depends on the create/get rule of the Core Foundation method you used. Additionally it depends on the contract you want to present to clients for the createStringDescriptor. what happens in -lowercaseString? How does that get released? Review... http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html -Shawn ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSString memory management question
On Apr 22, 2008, at 3:51 PM, Shawn Erickson wrote: We don't know how you created the CFStringRef so we cannot say. The answer depends on the create/get rule of the Core Foundation method you used. Additionally it depends on the contract you want to present to clients for the createStringDescriptor. Sorry, I thought saying created was clear. I actually call a CreateXXX function. what happens in -lowercaseString? How does that get released? Review... http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html Okay, I think from that, the string is automagically freed. Thanks! -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Problems with [NSArray count]
On Apr 22, 2008, at 2:45 PM, Peter Browne wrote: The process followed is: 1) the myController object acquires data from a text file, using NSString's -stringWithContentsOfFile:encoding:error 2) myArray then grabs this data (a bunch of numbers) using NSArray's -componentsSeparatedByString: 3) myController then passes the myArray object to myView (for later graph drawing) using my - (void)displayData:(NSArray *)theArray method 4) myView then calls [theArray count] 5) EXC_BAD_ACCESS inserting a [myArray retain] just before passing the data to the view fixed the problem. Why should this be the case? As far as I'm aware the object isn't being released at that point, so what's the need for a -retain message? First, read this: http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html Once you have, you will note that the array returned by - componentsSeparatedByString: doesn't belong to you unless you retain it. You are likely getting your bad access because the autorelease pool is being drained in between your call to -displayData and -count (and -displayData: probably should be named -setDisplayData: instead). -- David Duncan Apple DTS Animation and Printing [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
[ANN] TransactionKit, Lockless Multi-Reader, Multi-Writer Transaction Capable Hash Tables
All, I've recently released the first version of TransactionKit, which is made of two main components: The core library, and a Foundation compatibility API layer. Homepage: http://transactionkit.sourceforge.net/ Documentation: http://transactionkit.sourceforge.net/Documentation/index.html SVN trunk is available at: http://transactionkit.svn.sourceforge.net/svnroot/transactionkit/trunk TransactionKit is made available under a 3-clause BSD License. As an aside, and begging the karma gods for forgiveness, I'm currently looking for a job. I obviously would like to find work doing Cocoa programming, but I also have extensive experience in networking (ala sr. backbone engineer at a top tier 1 provider). Physically in the greater Toronto (CA) metro area, US citizen, legal to work in both CA and US. Working remotely has a certain appeal. :) The core library is mostly C based, with a bit of Objective-C in the appropriate places for Objective-C compatibility. The Objective-C parts in the core library are optional, and can be easily stripped away leaving just a C based core. The Foundation API compatibility layer replicates the C based (not the newer 10.5 Objective-C based) NSHashTable and NSMapTable, along with a subclass / re-implementation of NSDictionary and NSMutableDictionary. The development environment has been Mac OS X 10.5 on a G4 PPC system, though I expect it should work effortlessly on any 10.5 system. The only thing I can think of off the top of my head that would prevent 10.4 use is the fact that the Dictionary clones implement NSFastEnumeration, other than that I can't think of any 10.5 specific features it makes use of. 10.5 Garbage Collection is not supported nor are their plans to- I have simply not been able to get 10.5's GC system to work reliably under the grueling punishment of the synthetic stress tests that TransactionKit places on the proper accounting of resources by the memory allocation system. This has not been from a lack of trying, I've just found the 10.5 GC system to be buggy and unreliable. Examples include: compiler bugs that don't always insert write barriers (ala a typdefed struct assignment, such as MyExampleType = *initExampleType), or that the functions objc_atomicCompareAndSwapGlobalBarrier (and friends) were essentially no-ops until 10.5.2 (specifically, objc4-371.1). Personally, I've found the 10.5 GC system extremely non-intuitive and ultimately impossible to correctly use in practice. I think the section on The Costs of Precise Pointer Identification in http://www.hpl.hp.com/personal/Hans_Boehm/gc/conservative.html summarize many of the objections and problems I've encountered. Full disclosure: If you're not familiar with the implications of lockless and multithreading combined in the same sentence, you should know that this library attempts to deal with some notoriously difficult to get right problems. The common methodology in multithreading programming is to employ a mutual exclusion lock around a data structure to prevent simultaneous modifications by multiple threads at the same time. TransactionKit uses a novel, experimental means to allow lockless modifications by multiple threads concurrently. While some concurrent multiple writer data structures do exist, most are generally academic research grade problems / solutions. TransactionKit is definitely a prototype and experimental in nature at this time. - There are almost certainly bugs. - While certainly unintentional, I think its proper to set your expectations now. I think for most 'simple' things, things should be mostly bug free. Corner cases and the complicated nuances that crop up during multithreading concurrent use is where most of the bugs probably are, especially in dealing with the concept of when things happens relative to transaction start, commit, and rollback times. While the ultimate goal is to have a highly portable C core and an Objective-C layer built on top of that, for right now it realistically only works on Mac OS X. This is probably OK considering the audience :). At this point, the C library is largely undocumented, but it really isn't that complicated: create a table, free a table, insert, get, and remove a key, along with begin, commit, and rollback a transaction. Thats about it, really, and won't be further covered here. The rest of this is regarding the Objective-C portion. The Objective-C portion, specifically the Dictionary clones, are essentially straight, method for method, re-implementations of their foundation Dictionary counterparts. There are two classes, TKDictionary and TKMutableDictionary. TKDictionary is a subclass of NSDictionary, and TKMutableDictionary is a subclass of TKDictionary. They should be drop in replacements for their Foundation equivalents, and interoperate invisibly with each other. Where
Re: NSString memory management question
Am 23.04.2008 um 00:25 schrieb Rick Mann: I wrote a routine that creates a CFStringRef from some USB calls. I use it like this: NSString* s = (NSString*) createStringDescriptor(dev, stringIndex); [mSerialNumberDisplay setStringValue: [s lowercaseString]]; [s release]; Two main questions: am I right to release the bridged NSString* s? and, what happens in -lowercaseString? How does that get released? Calling release on a CFString follows the same rules as calling it on an NSString*, and is equivalent to calling CFRelease(). Be careful, though, if you get a CFString or OSString from IOKit ... someone there apparently wasn't told about the rules in the rest of CoreFoundation... they don't follow the Create/Copy naming scheme consistently, and instead have weird phrases in the docs about consuming a refcount and things like that. But apart from that, the rules in the CoreFoundation docs apply, so assuming you're using a CFStringCreateXXX call, yes, you should release this string. 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 [EMAIL PROTECTED]
Master-Detail binding in User Defaults
I'm trying to set up a Master-Detail binding with User Defaults under OS X 10.4.11. It is correctly reading values I manually put into the Preferences file. I can select different items in the table and the detail items display the correct information, but no changes are written to the file. If I add an item to the array (using a button connected to the NSArrayController's insert: action), an item is added to the table. I can edit the name of the item in the table and change its details and see those changes if I select another table item the select the new one again, but when I quit my program and look at the preferences file, an empty dictionary has been added to the array. I also have normal preference items in the same window that work fine. Is there something I'm doing wrong or is this just not a supported usage? Here's the setup in Interface Builder: NSArrayController: Name: Variables Object class Name: NSMutableDictionary contentArray bindings: Bind to: Shared User Defaults Controller Key: values Model Key Path: variables NSTableColumn value bindings: Bind to: Variables (NSArrayController) Controller Key: arrangedObjects Model Key Path: name NSPopUpButton selectedIndex bindings: Bind to: Variables (NSArrayController) Controller key: selection Model Key Path: lineWidth NSPopUpButton selectedIndex bindings: Bind to: Variables (NSArrayController) Controller key: selection Model Key Path: lineSymbol Relevant contents of Preferences file (the second array element is an empty dictionary that was inserted with the NSArrayController's insert: action): ?xml version=1.0 encoding=UTF-8? !DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http:// www.apple.com/DTDs/PropertyList-1.0.dtd plist version=1.0 dict keyvariables/key array dict keylineSymbol/key integer8/integer keylineWidth/key integer2/integer keyname/key stringR/string /dict dict/ dict keylineSymbol/key integer1/integer keylineWidth/key integer1/integer keyname/key stringPRES/string /dict dict keylineSymbol/key integer12/integer keylineWidth/key integer3/integer keyname/key stringRHO/string /dict /array /dict /plist ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSString memory management question
On Apr 22, 2008, at 5:46 PM, Uli Kusterer wrote: But apart from that, the rules in the CoreFoundation docs apply, so assuming you're using a CFStringCreateXXX call, yes, you should release this string. Yeah, I was fairly sure about that one, it was the NSString - lowercaseString I wasn't sure about. -- Rick ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Using OSMemoryBarrier() with KVO
On Apr 22, 2008, at 6:37 AM, Paul Thomas wrote: I'm trying to implement a basic promise variable and I'm not sure if OSMemoryBarrier() is enough to make it correct. If anyone is familiar with the memory model, I'd appreciate a quick look-over. It's basically like this: { BOOL done; id result; NSError* error; NSException* exception; } Users ask for KVO notifications on 'done' and don't attempt to access any other ivars until done == YES. Then whatever thread or NSOperation or whatever that is responsible for delivering the result calls: -(void)completeWithResult:(id)res { result = res; [self willChangeValueForKey:@done]; done = YES; OSMemoryBarrier(); [self didChangeValueForKey:@done]; } Is this enough? Or will I need to use a full blown lock? What is it that you fear going wrong, such that you think even OSMemoryBarrier is necessary? KVO notifications are delivered on the thread where will/ didChangeValueForKey: are called. There's no multi-threading issue inherent in the above code, even without OSMemoryBarrier. -Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Safe frameworks for privileged tools?
Hey all, I'm writing a privileged helper tool that at one point needs to determine if a given directory is a package. Normally, I'd use NSWorkspace, but that's part of AppKit, which is tied to Window Server. I don't link to AppKit in my privileged tool, so I don't get the oh-so-convenvient -isFilePackageAtPath: method. I would like to use LaunchServices for this, but wasn't sure if it was kosher to link to ApplicationServices.framework from a privileged tool. Are there guidelines as to which frameworks should and shouldn't be used in privileged tools? I know nothing can ever be safe, but some are surely more dangerous than others, and I'd love some guidance. -- m-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 [EMAIL PROTECTED]
NSArrayController vs NSImage sort indicator image
Has anyone noticed that the image NSArrayController puts in the header of a table column looks different than the one retrieved by [NSImage imageNamed: @NSAscendingSortIndicator] -- the NSArrayController image looks sharper and aligns vertically centered to the header. Greg ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Safe frameworks for privileged tools?
On Tue, Apr 22, 2008 at 10:52 PM, Michael Watson [EMAIL PROTECTED] wrote: I would like to use LaunchServices for this, but wasn't sure if it was kosher to link to ApplicationServices.framework from a privileged tool. Are there guidelines as to which frameworks should and shouldn't be used in privileged tools? I know nothing can ever be safe, but some are surely more dangerous than others, and I'd love some guidance. This is the definitive list of safe frameworks: http://developer.apple.com/technotes/tn2005/tn2083.html#SECFRAMEWORKCROSSREFERENCE Unfortunately, ApplicationServices is a no. However, this blog posts suggests some instances where it might be safe: http://unixjunkie.blogspot.com/2006/10/launchservices-from-root-daemon.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How to create shortcuts after installing the my package
Hi All, I'm porting a windows based application to Mac OS X. My application in windows will create desktop shortcut once we install. I really don't whether its mac standard to create desktop shortcut and dock icon once i install my cocoa application. Can any one suggest me whether its a standard procedure.or provide the necessary links/pointers. JanakiRam. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to create shortcuts after installing the my package
It's not standard practice on the Mac, and most will probably agree that it's not something your application should be doing. It's a presumptuous invasion of the user's desktop space, and most Mac users are very protective of that. -- m-s On 23 Apr, 2008, at 00:53, JanakiRam wrote: Hi All, I'm porting a windows based application to Mac OS X. My application in windows will create desktop shortcut once we install. I really don't whether its mac standard to create desktop shortcut and dock icon once i install my cocoa application. Can any one suggest me whether its a standard procedure.or provide the necessary links/pointers. JanakiRam. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/mikey-san %40bungie.org This email sent to [EMAIL PROTECTED] ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How to retain Previous content view in cocoa
___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to create shortcuts after installing the my package
Generally this goes against accepted Mac OS guidelines. But I understand you might not have a choice. What you can do is either use FSNewAlias to make an alias (shortcuts on Mac, will require you to learn how Carbon file management works), or use the ln command line tool to make a symbolic link (unix style shortcut). An alias is usually more reliable because it will work if the real file is moved (within the same disk) after the alias was made. Symlinks however will break if the real file is moved since they point at a specific path; aliases point at a specific file. On Apr 22, 2008, at 10:53 PM, JanakiRam wrote: Hi All, I'm porting a windows based application to Mac OS X. My application in windows will create desktop shortcut once we install. I really don't whether its mac standard to create desktop shortcut and dock icon once i install my cocoa application. Can any one suggest me whether its a standard procedure.or provide the necessary links/pointers. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: How to create shortcuts after installing the my package
On 22 Apr '08, at 9:53 PM, JanakiRam wrote: I'm porting a windows based application to Mac OS X. My application in windows will create desktop shortcut once we install. I really don't whether its mac standard to create desktop shortcut and dock icon once i install my cocoa application. Ideally it shouldn't have an installer at all: it should be self- contained. The user should just be able to download the app itself, double-click it and run it. —Jens 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 [EMAIL PROTECTED]
Re: How to create shortcuts after installing the my package
On 23/04/2008, at 2:53 PM, JanakiRam wrote: Hi All, I'm porting a windows based application to Mac OS X. My application in windows will create desktop shortcut once we install. I really don't whether its mac standard to create desktop shortcut and dock icon once i install my cocoa application. Can any one suggest me whether its a standard procedure.or provide the necessary links/pointers. JanakiRam. Use NSFileManager's -createSymbolicLinkAtPath:pathContent:. As others have said, it's not normal. At the least, you would ask the user if they'd like an alias on their Desktop first. 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 [EMAIL PROTECTED]
Re: Font-related crash in drawing method on PowerPC machines
On 23/04/2008, at 1:16 AM, I. Savant wrote: I haven't looked at this in detail and don't know if this has anything to do with your problem, but how are you handling the case where the user has disabled or otherwise modified their fonts? Even system fonts can be screwed with and if the font is not available, assuming it always will be is probably Not a Good Idea™. To be more specific, in this case you are asking for these fonts: [NSFont fontWithName:@Lucida Grande size:16.0] [NSFont fontWithName:@Lucida Grande Bold size:16.0] When you should probably be using: [NSFont systemFontOfSize:16.0]; [NSFont boldSystemFontOfSize:16.0]; I also don't think you need to call -beginEditing and -endEditing on a normal NSMutableAttributedString, this only makes sense if the string is an NSTextStorage or similar. That said, I can't see anything obvious that would cause a crash. -- Rob Keniger ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]