Re: window does not seem to respond to orderOut:
Never mind ... silly newbie mistake .. didn't have the window outlet set in IB. rjo On Jun 2, 2009, at 8:15 PM, Robert Olivier wrote: I'm implementing a shared inspector and following the guidance at http://borkware.com/rants/inspectors/ I have a method in my NSWindowController subclass: - (void) toggle { if(!visible) { visible = true; [self setDocument: [[NSDocumentController sharedDocumentController] currentDocument]]; [self showWindow: self]; NSLog(@show inspector window); } else { visible = false; [[self window] orderOut: self]; NSLog(@hide inspector panel); } } That should toggle visibility of the window without closing/ releasing it. However, when this method is invoked with visible=true, the window does not go away in response to the orderOut: message. Any clue as to why this would be? rjo ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rjolivier%40mac.com This email sent to rjoliv...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDictionary dictionaryWithContentsOfURL problem
Could be one of many network programs like LittleSnitch or NetBarrier. Could also be he's using a proxy. On Jun 2, 2009, at 9:37 PM, Mr. Gecko wrote: Hello. For some reason, one of my customers is having a problem which I determined to be NSDictionary dictionaryWithContentsOfURL can't connect to my server for some odd reason. I can't determine what reason because it works for all my other customers and so it's just this one guy. He can go to my website in Safari which makes it even more weird. Any Ideas? I'll try and screen share with him tomorrow to run tests and see what it out puts in terminal. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Scheduling an application
hi, I want to launch my application using a time based scheduling. I have created a plist by setting the keys: Label, onDemand, ProgramArguments and startCalenderInterval. And I placed the plist in /Library/LaunchDaemons. Then i loaded the plist manually using the terminal. It works fine on the specified time. I want the plist to be loaded automatically on the specified time and launch my application. How can be it done? Is there any thing to be set additionally? Is LaunchDaemons the correct folder to place the plist? thankyou in advance ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Change font and text color of label which is a static NSTextField
Hi, I want to change the color and font of a label. I used the below method. I get no errors but it is not updating the Label with the required changes, - (NSAttributedString *)setLabelFont:(NSString *)str { NSColor *txtColor = [NSColor redColor]; NSFont *txtFont = [NSFont boldSystemFontOfSize:12]; NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:txtFont, NSFontAttributeName, txtColor, NSForegroundColorAttributeName, nil]; NSAttributedString *atted = [[[NSAttributedString alloc] initWithString:str attributes:dict] autorelease]; return atted; } [labelStr setAttributedStringValue:[self setLabelFont:@Checking for updates]]; -- Regards, Shraddha Karwan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Change font and text color of label which is a static NSTextField
IBOutlet NSTextField *labelStr; I have linked this labelStr with the Label I created in my Interface Builder. I am able to change its attributes using [labelStr setTextColor:[NSColor redColor]]; [labelStr setFont:[NSFont labelFontOfSize:10]]; But the setAttributedStringValue doesn't seem to work. What is labelStr, and how are you expecting changing it to affect your label? Also, as a point of style, the set prefix should be limited to setters. A more appropriate name for this method would be something like stringWithLabelAttributes. -- Regards, Shraddha Karwan Success usually comes to those who are too busy to be looking for it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Change font and text color of label which is a static NSTextField
did you try checking the Allows Rich Text field in Interface Builder for labelStr ? On Jun 3, 2009, at 1:13 PM, Shraddha Karwan wrote: IBOutlet NSTextField *labelStr; I have linked this labelStr with the Label I created in my Interface Builder. I am able to change its attributes using [labelStr setTextColor:[NSColor redColor]]; [labelStr setFont:[NSFont labelFontOfSize:10]]; But the setAttributedStringValue doesn't seem to work. What is labelStr, and how are you expecting changing it to affect your label? Also, as a point of style, the set prefix should be limited to setters. A more appropriate name for this method would be something like stringWithLabelAttributes. -- Regards, Shraddha Karwan Success usually comes to those who are too busy to be looking for it. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rajesh%40vangennep.nl This email sent to raj...@vangennep.nl ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Change font and text color of label which is a static NSTextField
Yes, Checking / Unchecking this field doesn't make any change. I can still use the setColor and setFont methods even if the Rich Text field is disabled. On Wed, Jun 3, 2009 at 5:16 PM, rajesh raj...@vangennep.nl wrote: did you try checking the Allows Rich Text field in Interface Builder for labelStr ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Change font and text color of label which is a static NSTextField
On Jun 3, 2009, at 6:25 AM, Shraddha Karwan wrote: [labelStr setAttributedStringValue:[self setLabelFont:@Checking for updates]]; I suspect labelStr is nil. When are you executing this line? If labelStr is an outlet and you are doing it in an init method, that is too early -- labelStr has not been connected yet. Try moving this line to awakeFromNib. http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSNibAwaking_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/awakeFromNib In general, when a line of code doesn't seem to be having any effect: * Make sure the line is actually being executed, using a breakpoint or NSLog. * Make sure the receiver isn't nil, using the debugger or NSLog. * If the receiver is an outlet, make sure you aren't messaging it before the outlet has been connected. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Change font and text color of label which is a static NSTextField
Thank You Andy. That was the cause. Changed the location of the statement from init to awakeFromnib and its working. On Wed, Jun 3, 2009 at 6:22 PM, Andy Lee ag...@mac.com wrote: On Jun 3, 2009, at 6:25 AM, Shraddha Karwan wrote: [labelStr setAttributedStringValue:[self setLabelFont:@Checking for updates]]; I suspect labelStr is nil. When are you executing this line? If labelStr is an outlet and you are doing it in an init method, that is too early -- labelStr has not been connected yet. Try moving this line to awakeFromNib. http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Protocols/NSNibAwaking_Protocol/Reference/Reference.html#//apple_ref/occ/instm/NSObject/awakeFromNib In general, when a line of code doesn't seem to be having any effect: * Make sure the line is actually being executed, using a breakpoint or NSLog. * Make sure the receiver isn't nil, using the debugger or NSLog. * If the receiver is an outlet, make sure you aren't messaging it before the outlet has been connected. --Andy -- Regards, Shraddha Karwan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Image (or view ?) not scaling with window
Hi Folks, I've run into a case where an image I am creating does not scale with its parent window. Some background - I am trying to create and application to process data stored within a file - much like any image data with a header. However, I am not opening anything with a standard image format. I have a selector panel than selected the kind of data I am reading, and lets me select the file. Based on the header information in that file, I create a window, view, image, image representation with the appropriate parameters, and I can already create the window and draw the contents of my file to it. It does this initial drawing properly. The problem is, when I grab the edge of the window to resize it, the image that's drawn to it does not reisze with the parent window. It maintains its original size, and stays centered in the window view. My initialization code for the GUI elements of that window is below. Is there a flag I am missing somewhere in this, or do I need to handle view and image resize updates in another routine ? Thanks all. vinai -- NSRect tempRect = NSMakeRect (90.0, 90.0, [self imageSize].width, [self imageSize].height); if (destImageRep == nil) { #ifdef DEBUG GeneralMessage (getting image representation); #endif destImageRep = [[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **) onScreenDataPointer pixelsWide:[self imageWidth] pixelsHigh:[self imageHeight] bitsPerSample:(8 * sizeof (DisplayDataType)) samplesPerPixel:1 hasAlpha:NO isPlanar:NO colorSpaceName:NSCalibratedWhiteColorSpace bytesPerRow:([self imageWidth] * sizeof (DisplayDataType)) bitsPerPixel:(8 * sizeof (DisplayDataType))] autorelease]; } myView = [[NSImageView alloc] initWithFrame: tempRect]; [myView setAutoresizesSubviews: YES]; [myView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable]; myImage = [[[NSImage alloc] initWithSize:[myView bounds].size] autorelease]; [myImage setScalesWhenResized: YES]; [myImage setSize: [myView bounds].size]; [myImage addRepresentation: destImageRep]; [myView setImage: myImage]; /* Create a window */ if ( myWindow == nil ) /* if not already created */ { #ifdef DEBUG GeneralMessage (Creating window ...); #endif myWindow = [[NSWindow alloc] initWithContentRect:tempRect styleMask:NSClosableWindowMask | NSTitledWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask | NSTexturedBackgroundWindowMask backing:NSBackingStoreBuffered defer:false]; } [myWindow setContentAspectRatio: [self imageSize]]; [myWindow setContentMinSize: [self imageSize]]; [myWindow setContentView: myView]; [myWindow setContentSize: [self imageSize]]; [myWindow makeKeyAndOrderFront: nil]; ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Internationalizing Bundle Icon
Its not possible to do.. Its recommended that you don't put text on your application and document icons. Scott On Jun 2, 2009, at 7:27 PM, Richard Holliday wrote: Hi, The new icon icns file for my cocoa application (10.4 +) has text on it which needs to change based on the machine locale. I have localized the rest of the application (strings, nibs) etc. but I’m trying to see if it’s possible to have the finder present a different bundle icon based on the locale. I have two icns files, one in English.lproj and one in en_GB.lproj. It always displays the first one. I suspect this is not possible and am prepared have our designer come up with a new icon design. Any ideas would be appreciated. Thanks, Richard -- Richard Holliday, Senior Software Developer Renaissance Learning - 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/scottandrew%40roadrunner.com This email sent to scottand...@roadrunner.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How determine if file is in Trash, given Path or Alias
On 6/2/09 10:17 PM, Michael Ash said: The description of [NSString UTF8String] says that the returned C string is automatically freed just as a returned object would be released, which implies (to me) that the returned pointer is to GC-controlled memory. Then shouldn't its return value be __strong? (It's not.) Not really. __strong has no meaning when applied to function/method return values (or arguments or local variables). It doesn't break anything, but it also doesn't do anything. __strong only changes how things work when applied to heap memory, such as instance variables, or structs that you've malloced memory for. I see. It would be sensible to use __strong as a decorator for non-object pointer return values to indicate that they are GC-allocated memory, purely out of convention, but as far as I know such a convention is not established in the API as of 10.5. NSAllocateCollectable() for example returns void *__strong; UTF8String and fileSystemRepresentation (and others) do not. This discrepancy is either a) an indication that the returned memory may not be GC- controlled b) an error in the declarations. I don't know for sure. The docs sure could use some love in this area. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 10:36 AM, Arnab Ganguly agangul...@gmail.com wrote: I would like to add volume control for my App.In the .nib file how can I add that ?Please help. Please read: http://catb.org/esr/faqs/smart-questions.html You have not provided a shred of information necessary to answer your very broad question. Aside from drag a slider into your window and connect it to some volume-setting action, there's little else anybody could guess to tell you. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Image (or view ?) not scaling with window
On Jun 3, 2009, at 7:45 AM, vinai wrote: I've run into a case where an image I am creating does not scale with its parent window. Some background - I am trying to create and application to process data stored within a file - much like any image data with a header. However, I am not opening anything with a standard image format. I have a selector panel than selected the kind of data I am reading, and lets me select the file. Based on the header information in that file, I create a window, view, image, image representation with the appropriate parameters, and I can already create the window and draw the contents of my file to it. It does this initial drawing properly. The problem is, when I grab the edge of the window to resize it, the image that's drawn to it does not reisze with the parent window. It maintains its original size, and stays centered in the window view. My initialization code for the GUI elements of that window is below. Is there a flag I am missing somewhere in this, or do I need to handle view and image resize updates in another routine ? What happens when you set image scaling for the NSImageView? Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How determine if file is in Trash, given Path or Alias
On Wed, Jun 3, 2009 at 12:41 AM, Ken Thomases k...@codeweavers.com wrote: On Jun 2, 2009, at 9:21 PM, Michael Ash wrote: The NSString methods are unlikely to be problematic here. NSData is troublesome because it's returning an internal pointer. In other words, it's a pointer to some memory that it already holds on to in the normal course of things, and it gives you that pointer. Since it manages this memory explicitly, its lifetime is linked to the lifetime of the NSData object. The NSString case is quite different. It's (probably?) not an internal pointer at all. Instead, it's newly allocated memory being returned to you. The NSString (probably?) does not hold a pointer to this memory, and thus its lifetime is not linked to the lifetime of the NSString object that it came from. When you ask an NSString for its UTF8String, it (probably?) has to create that from scratch by converting its internal storage, unlike NSData which just returns its internal storage directly. I put all of those probably things up there because it is at least conceivable to have an NSString where this *is* an internal pointer, so you might not want to count on this being true. However I'd judge it to be pretty unlikely. Wouldn't hurt to make your code safe against it even so. I'm not so sure about unlikely and probably, as opposed to merely possibly. The thing is, it might very well be internal to some object, even if that object is not the string specifically. In the non-GC case, the most likely way for NSString to return a C string that has a lifetime of the autorelease context is for NSString to create an autoreleased NSData to hold the properly encoded bytes, and then return the -bytes of that data object. Even if that's not the exact way NSString does it, in the non-GC case there's really no way to implement an autoreleased buffer that doesn't involve an interior pointer of something. Something has to manage the lifetime of that buffer, after all, and it's probably an object in the autorelease pool. Apple may have changed the implementation as it implemented GC, so that NSString allocates the data buffer from the collector, but it may have just left the implementation alone. The non-GC approach still works in a GC environment, except for the interior pointer issue. Apple would have to have different implementations for the GC and non-GC case here. If the pointer isn't interior to the NSString then it *can't* be interior to some other object, because you'd have no way to keep the thing alive. The NSString is the only thing that the caller is guaranteed to hold a strong reference to, so it's the only thing you could reasonable base the lifetime of the storage on. The RR method of creating an NSData and returning its interior pointer simply won't work in the GC world, so they would need different code no matter what. There is no solution to this problem which works in both worlds. The good news is that it's pretty easy to write code that allocates memory from an autoreleased NSMutableData in RR and which uses NSAllocateCollectable in GC. Mike ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
Oh I am really sorry about that.I have a player application.Created the Nib file.I have the stop and start button and it is working correctly.Would like to add a volume control mechanism for my player.So can you help me on this?What would be the NSButton type should be taken from the IB to meet the criteria.Any help would be very much appreciated. Thanks in advance. -Arnab On Wed, Jun 3, 2009 at 8:17 PM, I. Savant idiotsavant2...@gmail.com wrote: On Wed, Jun 3, 2009 at 10:36 AM, Arnab Ganguly agangul...@gmail.com wrote: I would like to add volume control for my App.In the .nib file how can I add that ?Please help. Please read: http://catb.org/esr/faqs/smart-questions.html You have not provided a shred of information necessary to answer your very broad question. Aside from drag a slider into your window and connect it to some volume-setting action, there's little else anybody could guess to tell you. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 11:05 AM, Arnab Ganguly agangul...@gmail.com wrote: Oh I am really sorry about that.I have a player application.Created the Nib file.I have the stop and start button and it is working correctly.Would like to add a volume control mechanism for my player.So can you help me on this?What would be the NSButton type should be taken from the IB to meet the criteria.Any help would be very much appreciated. I would think a slider (NSSlider) would be the best control to use ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
Thanks for the update.I am a newbie so queries are very basic. How do I bring the mic photo.Is it going to be a seperate image.Do we have anything similar in the IB. -Arnab On Wed, Jun 3, 2009 at 8:38 PM, I. Savant idiotsavant2...@gmail.com wrote: On Wed, Jun 3, 2009 at 11:05 AM, Arnab Ganguly agangul...@gmail.com wrote: Oh I am really sorry about that.I have a player application.Created the Nib file.I have the stop and start button and it is working correctly.Would like to add a volume control mechanism for my player.So can you help me on this?What would be the NSButton type should be taken from the IB to meet the criteria.Any help would be very much appreciated. I would think a slider (NSSlider) would be the best control to use ... -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Cocoa-dev Digest, Vol 6, Issue 825
I'll be sure to look at that when I get on his system to debug. On Jun 3, 2009, at 2:54:38 AM, Michael Vannorsdel wrote: Could be one of many network programs like LittleSnitch or NetBarrier. Could also be he's using a proxy. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 11:13 AM, Arnab Ganguly agangul...@gmail.com wrote: Thanks for the update.I am a newbie so queries are very basic. How do I bring the mic photo.Is it going to be a seperate image.Do we have anything similar in the IB. This list isn't the hand-holding type. You're expected to do your research and it doesn't look like you've done so. Familiarize yourself with the documentation and *search* before posting. Google is your friend, the documentation is searchable, etc. etc. That said, since what you're looking for is some standard image, and the Cocoa class that deals with images is NSImage, I'd suggest that this is where you should start reading (the NSImage class reference and the companion guide linked therein). As for the overall approach, I don't know of a mic photo, but in the Mac OS, icons to either side of a slider are usually a small speaker with no sound waves to the left and one with several (I think usually three or so) sound waves to the right. There are no standard icons (called templates) for this either. You have to roll your own or borrow someone else's (*with permission* lest you be sued). As for not knowing what kind of controls to use, you're just going to have to explore what IB offers, as well as explore some of the most prominent applications that do what you're doing for clues as to what is standard. Also read the HIG: http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html I'd also recommend picking up a good book on Cocoa programming (there's one by that very name - Cocoa Programming for Mac OS X - that is very good and highly recommended). Good luck. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 11:13 AM, Arnab Ganguly agangul...@gmail.com wrote: Is it going to be a seperate image.Do we have anything similar in the IB. ... and yes, if you want to display icons / images, you'll use an image view. The slider control does not provide for images to either side. This is immediately apparent if you investigate the control for yourself. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Image (or view ?) not scaling with window
--- On Wed, 6/3/09, Keary Suska cocoa-...@esoteritech.com wrote: From: Keary Suska cocoa-...@esoteritech.com Subject: Re: Image (or view ?) not scaling with window To: Cocoa-Dev (Apple) Cocoa-dev@lists.apple.com Date: Wednesday, June 3, 2009, 9:50 AM On Jun 3, 2009, at 7:45 AM, vinai wrote: I've run into a case where an image I am creating does not scale with its parent window. Some background - I am trying to create and application to process data stored within a file - much like any image data with a header. However, I am not opening anything with a standard image format. ... The problem is, when I grab the edge of the window to resize it, the image that's drawn to it does not reisze with the parent window. It maintains its original size, and stays centered in the window view. What happens when you set image scaling for the NSImageView? Keary Suska Esoteritech, Inc. Demystifying technology for your home or business That works! Setting [myView setImageScaling: NSScaleToFit] works perfectly. I have the document pages for NSWindow, NSImage, NSImageView, NSImageRep all open in front of me. Talk about not seeing the forest for the trees ... Thanks Keary! vinai ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
Thanks again for all help and your time. Regards Arnab On Wed, Jun 3, 2009 at 8:55 PM, I. Savant idiotsavant2...@gmail.com wrote: On Wed, Jun 3, 2009 at 11:13 AM, Arnab Ganguly agangul...@gmail.com wrote: Is it going to be a seperate image.Do we have anything similar in the IB. ... and yes, if you want to display icons / images, you'll use an image view. The slider control does not provide for images to either side. This is immediately apparent if you investigate the control for yourself. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
Brandon's BWToolkit has a textured slider that has the speaker images incorporated in it. Be aware, though, that it's the sort of control that looks best on a textured/metal background: http://brandonwalkin.com/bwtoolkit/ HTH, Dave On Jun 3, 2009, at 9:25 AM, I. Savant wrote: On Wed, Jun 3, 2009 at 11:13 AM, Arnab Ganguly agangul...@gmail.com wrote: Is it going to be a seperate image.Do we have anything similar in the IB. ... and yes, if you want to display icons / images, you'll use an image view. The slider control does not provide for images to either side. This is immediately apparent if you investigate the control for yourself. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 11:31 AM, Dave DeLong davedel...@me.com wrote: Brandon's BWToolkit has a textured slider that has the speaker images incorporated in it. Be aware, though, that it's the sort of control that looks best on a textured/metal background: http://brandonwalkin.com/bwtoolkit/ Good catch. I took a look at it when it was released and it's great, but I quickly ran into some UI bugs using the controls in Interface Builder that made me give up on it. I keep checking for updates but have seen no activity these last few months since 1.0.2. It's a *great* kit with great potential (very nice work, Brandon), but I think he's been too busy to update it lately. Maybe if we cheer him on, Brandon will invest more time in it. :-) -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: How heavy is NSLayoutManager?
On Jun 2, 2009, at 6:17 PM, Graham Cox wrote: You don't say what you think might be a problem - speed, memory use? I find that speed for my purposes is entirely adequate - I can interactively adjust objects that cause text re-layout and it keeps up with that no problem, even when the text is wrapping into an arbitrary-shaped path. Actual rendering speed of many, many text objects is also fine, and is dominated by the underlying glyph rendering as expected. Since that's the case I haven't been tempted to allocate one layout manager per object to gain the benefits of caching the layout - it doesn't figure prominently in the profile. Ultimately, this is something that has to be answered by measurement based on the usage of the individual application. I would not usually worry about allocating dozens of layout managers in a typical application, as long as you are not expecting to scale that number up by several orders of magnitude in the future. However, every application's usage pattern is different. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Scheduling an application
On Jun 3, 2009, at 3:52 AM, rethish wrote: I want the plist to be loaded automatically on the specified time and launch my application. How can be it done? Automatic plist loading only happens on reboot (if it's in the system library) or login (if it's in the user's library). You'll have to load it manually if you don't want to inconvenience the user. Is LaunchDaemons the correct folder to place the plist? That depends on what your application does. See http://developer.apple.com/technotes/tn2005/tn2083.html and read about the difference between agents and daemons. Nick Zitzmann http://www.chronosnet.com/ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On 6/3/09 11:38 AM, I. Savant said: Good catch. I took a look at it when it was released and it's great, but I quickly ran into some UI bugs using the controls in Interface Builder that made me give up on it. I keep checking for updates but have seen no activity these last few months since 1.0.2. The newest version is clearly 1.1: http://www.brandonwalkin.com/blog/ -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 11:53 AM, Sean McBride s...@rogue-research.com wrote: The newest version is clearly 1.1: Bah, you're right. I was going on memory and got it wrong. :-) Still, that was released in February. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On 3 Jun 2009, at 16:23:20, I. Savant wrote: As for the overall approach, I don't know of a mic photo, but in the Mac OS, icons to either side of a slider are usually a small speaker with no sound waves to the left and one with several (I think usually three or so) sound waves to the right. There are no standard icons (called templates) for this either. It may be worth noting that these do exist in the Apple Symbols font, although relying on that could be very shaky ground. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Wed, Jun 3, 2009 at 2:49 PM, Benjamin Dobson importedfromsp...@googlemail.com wrote: It may be worth noting that these do exist in the Apple Symbols font, although relying on that could be very shaky ground. Hmm ... I can't seem to find the speaker symbols anywhere in that font, nor in the character palette (under all characters, for each symbol subcategory). Can you point me to it? In any case, if such a symbol exists in a system font, I'd say it's no more shaky than relying on a built-in template image. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Disc recording framework estimatedLength
Where can I ask a question about the Disc Recording Framework? In particular, how can I figure out how much will fit onto a data disc as I populate a track? I've tried to guess how much space it will consume based on the size of files, but the actual amount reported by [Track estimateLength] varies wildly with overhead from a few hundred to 20 thousand blocks or more. How can I figure this out as I create the track without having to invoke the estimateLength which can consume 30 seconds or more on each invocation? Could forks be causing me an issue? How do you find out the size of forks? Are they supposed in the disc recording framework? Thanks ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On 3 Jun 2009, at 19:57:53, I. Savant wrote: On Wed, Jun 3, 2009 at 2:49 PM, Benjamin Dobson importedfromsp...@googlemail.com wrote: It may be worth noting that these do exist in the Apple Symbols font, although relying on that could be very shaky ground. Hmm ... I can't seem to find the speaker symbols anywhere in that font, nor in the character palette (under all characters, for each symbol subcategory). Can you point me to it? Switch the view to Glyph. Set the font to Apple Symbols. Look under 4909-4911. http://www.quicksnapper.com/sabrelight/image/apple-symbols ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSBrowser Core Data?
Hello, I am writing a program that needs to load hierarchical data from an XML document (that I have loaded into a NSXMLDocument), into a NSBrowser... I tried modifying the SimpleBrowser? example code to suit my needs, but then I started wondering if Core Data would be able to do it... I looked up some information about NSTreeController, but I'm still confused as to how it would actually work. Any suggestions as to how to approach this problem would be greatly appreciated. Thanks, Keita ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
launchd detecting when an application is running
How do I configure a launchd .plist file to detect when an application running. Thanks Tom ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: launchd detecting when an application is running
Your question is unclear and doesn't make much sense. Please give lots of clarification, and consider posting your question on a list where it's more on-topic, such as darwin-dev or launchd-dev (over at macosforge). David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help on adding volume control
On Jun 3, 2009, at 4:55 PM, Benjamin Dobson wrote: Switch the view to Glyph. Set the font to Apple Symbols. Look under 4909-4911. http://www.quicksnapper.com/sabrelight/image/apple-symbols Awesome. Thanks for the tip. -- I.S. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Detecting when fetch: finishes
I have an NSArrayController that, at the request of the user, can be given a new fetch predicate. To do that I use the setFetchPredicate: method. How can I detect when this predicate has been applied and the appropriate fetching is done? I have not come across any delegate method for it. I suspect that this is made tricky because of the following quote from the docs under the fetch: method of NSObjectController (which by the way is a superclass of NSArrayController): Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet. So the problem is that it finishes somewhere in the next runloop iteration, making it harder to do some custom things after it finishes. Thanks, U. _ Invite your mail contacts to join your friends list with Windows Live Spaces. It's easy! http://spaces.live.com/spacesapi.aspx?wx_action=createwx_url=/friends.aspxmkt=en-us___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting when fetch: finishes
On Jun 3, 2009, at 5:12 PM, Ulai Beekam wrote: I have an NSArrayController that, at the request of the user, can be given a new fetch predicate. To do that I use the setFetchPredicate: method. How can I detect when this predicate has been applied and the appropriate fetching is done? I have not come across any delegate method for it. I suspect that this is made tricky because of the following quote from the docs under the fetch: method of NSObjectController (which by the way is a superclass of NSArrayController): Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet. So the problem is that it finishes somewhere in the next runloop iteration, making it harder to do some custom things after it finishes. There isn't any way that I know that is more work than it is worth. Better to do the fetch yourself. Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
RE: Detecting when fetch: finishes
What do you mean do the fetch myself? Do you mean I should not use an NSArrayController? That would sound overkill as NSArrayController plus its fetch predicate gives me a lot of functionality for free, e.g. updating dynamically when underlying objects are added/removed. Can you elaborate? From: cocoa-...@esoteritech.com To: cocoa-dev@lists.apple.com Date: Wed, 3 Jun 2009 17:31:32 -0600 Subject: Re: Detecting when fetch: finishes On Jun 3, 2009, at 5:12 PM, Ulai Beekam wrote: I have an NSArrayController that, at the request of the user, can be given a new fetch predicate. To do that I use the setFetchPredicate: method. How can I detect when this predicate has been applied and the appropriate fetching is done? I have not come across any delegate method for it. I suspect that this is made tricky because of the following quote from the docs under the fetch: method of NSObjectController (which by the way is a superclass of NSArrayController): Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet. So the problem is that it finishes somewhere in the next runloop iteration, making it harder to do some custom things after it finishes. There isn't any way that I know that is more work than it is worth. Better to do the fetch yourself. Keary Suska Esoteritech, Inc. Demystifying technology for your home or business _ Windows Live™: Keep your life in sync. Check it out! http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_allup_explore_012009___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting when fetch: finishes
On Jun 3, 2009, at 6:19 PM, Ulai Beekam wrote: What do you mean do the fetch myself? Do you mean I should not use an NSArrayController? That would sound overkill as NSArrayController plus its fetch predicate gives me a lot of functionality for free, e.g. updating dynamically when underlying objects are added/removed. Can you elaborate? No, you can use the array controller, just have an object that provides the controllers content instead of having the array controller fetch it itself. Bind the NSArrayController's contentArray to the array managed by the object, and turn off prepares content. You will still get all the free functionality as long as you always add/ delete through the array controller or through KVO-compliant means. If you need to watch for insertions/deletions that are performed outside of the array controller and it is not practical to route them through the object managing the content, you can have it simply observe theObjectsDidChange notification. See the docs for how to access the changed objects. I think that is all that the controllers do anyway. I suppose you could call -performSelector:afterDelay: for your followup function, playing with delay values until you find one that seems to reliably occur after the fetch. I don't know whether this approach is deterministic, or how you would handle an error situation. Seems altogether better to me to just handle fetching yourself. I wonder if you can make an NSArrayController subclass, override - fetchWithRequest:merge:error: to just call super, and after the call (which should be synchronous), call your special post-processing method. Just a stab in the dark, but might work. From: cocoa-...@esoteritech.com To: cocoa-dev@lists.apple.com Date: Wed, 3 Jun 2009 17:31:32 -0600 Subject: Re: Detecting when fetch: finishes On Jun 3, 2009, at 5:12 PM, Ulai Beekam wrote: I have an NSArrayController that, at the request of the user, can be given a new fetch predicate. To do that I use the setFetchPredicate: method. How can I detect when this predicate has been applied and the appropriate fetching is done? I have not come across any delegate method for it. I suspect that this is made tricky because of the following quote from the docs under the fetch: method of NSObjectController (which by the way is a superclass of NSArrayController): Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet. So the problem is that it finishes somewhere in the next runloop iteration, making it harder to do some custom things after it finishes. There isn't any way that I know that is more work than it is worth. Better to do the fetch yourself. Keary Suska Esoteritech, Inc. Demystifying technology for your home or business ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Scheduling an application
On 2009 Jun 03, at 08:48, Nick Zitzmann wrote: On Jun 3, 2009, at 3:52 AM, rethish wrote: I want the plist to be loaded automatically on the specified time and launch my application. Automatic plist loading only happens on reboot (if it's in the system library) or login (if it's in the user's library). You'll have to load it manually if you don't want to inconvenience the user. It's a shame that there seems to be no library function equivalent to the command /bin/launchctl/. After I installing a new launchd task, I load it using /bin/launchctl/ via an NSTask. I presume this is what Nick means by You ... load it manually. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Referring to file by Alias ^or^ path
On 2009 Jun 03, at 17:26, Bill Monk wrote: Given that your category depends on FSNewAliasFromPath, which is 10.5-only, both blocks of #if MAC_OS_X_VERSION_MIN_REQUIRED = MAC_OS_X_VERSION_10_4 can be dispensed with. Hehe. Well, like I said, my code had been cobbled together over time from various sources. But I believe we need the modern block, Size size = GetAliasSize(aliasHandle) ; AliasPtr aliasPtr = *aliasHandle ; data = [NSData dataWithBytes:aliasPtr length:size] ; Might just as well say: data = [NSData dataWithBytes:*aliasHandle length:size] ; Yup. AliasRecord aliasHeader = *((AliasPtr)[self bytes]) ; #if MAC_OS_X_VERSION_MIN_REQUIRED = MAC_OS_X_VERSION_10_4 AliasPtr ap = aliasHeader ; AliasHandle ah = ap ; That sort of machination used to be known as creating a fake handle - as distinguished from a real Handle, a pointer to a pointer to relocatable block allocated by the Memory Manager . Doing that would cause various havoc and crashes. You can get away with it now because NewHandle ends up as a malloc call, and memory blocks are no longer relocatable. Still, it just looks wrong to my eye. Worse, in recent memory, fake handles could still cause trouble in OS X in certain circumstances. (When I tried to google it, I found my own post from 2005: http://www.cocoabuilder.com/archive/message/cocoa/2005/8/16/144407) But anyway, easier to sidestep it with GetAliasSizeFromPtr. A one- liner replaces seven lines: nBytesAliasRecord = GetAliasSizeFromPtr( (AliasPtr)[self bytes] ); Yes, looks good. But to get seven lines you need to count the comments and unnecessary #ifdefs ;) // The full path returned by FSRefMakePath will NOT have a trailing slash UNLESS // the path is the root, i.e. @/. In that case it will. Thus, in order to return // a standard result to which /Filename.ext should be appended, we remove that: if ([path length] == 1) path = @ ; How come? Don't ask me. I believe I pasted in that comment (and the accompanying section of code) from some Apple Sample Code. If the caller is correctly using stringByAppendingPathComponent:, and not stringByAppendingString, this shouldn't be a problem. The correct path for the root is @/ and I'd think needing to return anything else here implies a problem elsewhere. Well, you can have a convention to add trailing slashes or not add trailing slashes. Personally, I think that trailing slashes are more conventional, but apparently whoever specified FSRefMakePath() does not. NSLog(@*** Tests which should fail ***) ;... ... ... TestPath(@/) ; That test only fails because you force it to fail, by taking steps to return @ for the root. Yes, if something is documented to fail, you should test that it fails :)) AliasManager returns the correct path; I'd rather see it return that, and let callers either use stringByAppendingPathComponent, or let it be their problem if they have special reasons for not using it. But maybe that's just me... Actually, my present purpose is only regarding files, not directories. So I just tried to document what others had done, even if it's odd. Thanks for the comments. This code keeps looking better, and shorter! Jerry Here's the modified .m. The .h should have documentation added to note that it requires Mac OS 10.5. #import NSData+FileAlias.h @implementation NSData (FileAlias) + (NSData*)aliasRecordFromPath:(NSString*)path { if ([path length] == 0) { return nil ; } const char* pathC = [path fileSystemRepresentation] ; OSErr osErr ; AliasHandle aliasHandle = NULL ; osErr = FSNewAliasFromPath ( NULL, pathC, 0, aliasHandle, NULL ) ; NSData* data = nil ; if ( (osErr == noErr) // ... File exists and we have a full alias || ((osErr == fnfErr) (aliasHandle != NULL)) // ... File does not exist and we have a minimal alias ) { Size size = GetAliasSize(aliasHandle) ; data = [NSData dataWithBytes:*aliasHandle length:size] ; } return data ; } - (NSString*)pathFromAliasRecord { unsigned short nBytesAliasRecord ; /* In Aliases.h, note that the AliasRecord struct is opaque if MAC_OS_X_MIN_VERSION_REQUIRED = MAC_OS_X_VERSION_10_4. In other words, if the Mac OS X Deployment Target setting for your project is 10.4 or later, the AliasRecord struct is opaque. That's because AliasRecords, as you've noticed, get written to disk but are also referenced in data, which means that they often have to be big-endian even on little-endian systems. Rather
QTCaptureSession class reference
I cannot find this documentation. Searching the Mac Dev Center gives over 60 references to the class but no documentation of it's properties and methods. Hope that this is an appropriate list for this question. There doesn't seem to be an Apple sponsored QT list. John kergunyah...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSAppleScript's compileAndReturnError always succeeds
Given that NSAppleScript objects are always supposed to run on the main thread, I created a small proxy object to use: @interface AppleScriptProxy : NSObject { NSAppleScript *m_script; NSDictionary *m_errorDict; } - (id) init; - (void) compileScript: (NSString*)script; - (void) dealloc; - (NSDictionary*) errorDict; - (BOOL) failed; - (void) runScript: (id)notUsed; @end @implementation AppleScriptProxy - (id) init { self = [super init]; m_errorDict = nil; m_script = nil; return self; } - (void) dealloc { //[m_errorDict release]; [m_script release]; [super dealloc]; } - (void) compileScript: (NSString*)source { m_script = [[NSAppleScript alloc] initWithSource:source]; if ( m_script ) if ( [m_script compileAndReturnError:m_errorDict] ) { cerr compiled endl; [m_script retain]; } else { cerr not compiled endl; m_script = nil; } } - (NSDictionary*) errorDict { return m_errorDict; } - (BOOL) failed { return !m_script || m_errorDict; } - (void) runScript: (id)notUsed { [m_script executeAndReturnError:nil]; } @end Then, to compile and execute an AppleScript: NSString *const script = /* some script */; [proxy performSelectorOnMainThread:@selector(compileScript:) withObject:script waitUntilDone:YES]; if ( [proxy failed] ) { NSString const *const errorMsg = errorDict ? [errorDict objectForKey:NSAppleScriptErrorMessage] : @NSAppleScript initWithSource failed; cerr [errorMsg UTF8String] endl; return 1; } [proxy retain]; [proxy performSelectorOnMainThread:@selector(runScript:) withObject:nil waitUntilDone:NO]; [proxy autorelease]; If I compile a valid script, it works as expected; however, if I compile a gibberish script, e.g., foo, compileAndReturnError doesn't fail, i.e., it returns YES and errorDict is still nil. Why? - Paul ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: QTCaptureSession class reference
Check out http://developer.apple.com/documentation/QuickTime/Conceptual/ QTKitCaptureProgrammingGuide/Introduction/Introduction.html On Jun 3, 2009, at 5:56 PM, Cain John wrote: I cannot find this documentation. Searching the Mac Dev Center gives over 60 references to the class but no documentation of it's properties and methods. Hope that this is an appropriate list for this question. There doesn't seem to be an Apple sponsored QT list. John kergunyah...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/toothpic%40fastq.com This email sent to tooth...@fastq.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting when fetch: finishes
On Wed, Jun 3, 2009 at 6:21 PM, Keary Suska cocoa-...@esoteritech.com wrote: I wonder if you can make an NSArrayController subclass, override -fetchWithRequest:merge:error: to just call super, and after the call (which should be synchronous), call your special post-processing method. Just a stab in the dark, but might work. This won't work; NSArrayController doesn't run the runloop, it schedules a selector for the next iteration. So your code will execute right after super's implementation calls -performSelector:afterDelay:, just like it would had you never overridden -fetch: in the first place. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: QTCaptureSession class reference
On 3 Jun 2009, at 7:56 PM, Cain John wrote: I cannot find this documentation. Searching the Mac Dev Center gives over 60 references to the class but no documentation of it's properties and methods. Hope that this is an appropriate list for this question. There doesn't seem to be an Apple sponsored QT list. Look for the quicktime-api mailing list, http://lists.apple.com/mailman/listinfo/quicktime-api . It and three other QuickTime lists are right there on the lists.apple.com site. I'm surprised they didn't turn up when you looked there. As has been pointed out, there is a lot of reference _to_ the class, and open -h QTCaptureSession.h opens the header. But there ought to be a Class Reference for it. Google even turns up a page for it, but the link is broken. Links to the class in the current docset have been pulled (that is, unlike other QTKit classes, QTCaptureSession isn't shown in as a link). It doesn't look like a large or complex API, and you can infer most of how it works from the supporting documentation, but jeez... Ask on the mailing list, and consider filing a bug on bugreport.apple.com. — F ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: launchd detecting when an application is running
On Jun 3, 2009, at 5:23 PM, Dave Keck wrote: Sorry, that question really was bad. I have written an application that I would like to launch whenever a certain app is launched. I have used LaunchAgents in the past to detect events such as USB insertion and volume mounting to perform certain actions. I was wondering if there was a launchd.plist key that allowed for launchd to detect an application startup. Tom Your question is unclear and doesn't make much sense. Please give lots of clarification, and consider posting your question on a list where it's more on-topic, such as darwin-dev or launchd-dev (over at macosforge). David ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: QTCaptureSession class reference
Thanks - I had already seen that and it only mentions 3 methods startRunning addInput addOutput Is that it? no stopRunning or removeInput/Output or anything else. Perhaps thats why there is nothing more specific elsewhere ie there *IS *nothing more. 2009/6/4 M Pulis tooth...@fastq.com Check out http://developer.apple.com/documentation/QuickTime/Conceptual/ QTKitCaptureProgrammingGuide/Introduction/Introduction.html On Jun 3, 2009, at 5:56 PM, Cain John wrote: I cannot find this documentation. Searching the Mac Dev Center gives over 60 references to the class but no documentation of it's properties and methods. Hope that this is an appropriate list for this question. There doesn't seem to be an Apple sponsored QT list. John kergunyah...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/toothpic%40fastq.com This email sent to tooth...@fastq.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: QTCaptureSession class reference
On Jun 3, 2009, at 11:41 PM, Fritz Anderson wrote: On 3 Jun 2009, at 7:56 PM, Cain John wrote: I cannot find this documentation. Searching the Mac Dev Center gives over 60 references to the class but no documentation of it's properties and methods. Hope that this is an appropriate list for this question. There doesn't seem to be an Apple sponsored QT list. Look for the quicktime-api mailing list, http://lists.apple.com/mailman/listinfo/quicktime-api . It and three other QuickTime lists are right there on the lists.apple.com site. I'm surprised they didn't turn up when you looked there. As has been pointed out, there is a lot of reference _to_ the class, and open -h QTCaptureSession.h opens the header. But there ought to be a Class Reference for it. Google even turns up a page for it, but the link is broken. If you mean the first result for QTCaptureSession site:developer.apple.com, which is a link to a PDF, you can still view it by clicking the View as HTML link. Links to the class in the current docset have been pulled (that is, unlike other QTKit classes, QTCaptureSession isn't shown in as a link). It doesn't look like a large or complex API, and you can infer most of how it works from the supporting documentation, but jeez... Ask on the mailing list, and consider filing a bug on bugreport.apple.com. I second both suggestions. --Andy ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: launchd detecting when an application is running
On Wed, Jun 3, 2009 at 8:44 PM, Tom Hohensee tom...@mac.com wrote: I was wondering if there was a launchd.plist key that allowed for launchd to detect an application startup. launchd is explicitly designed not to have this functionality. All inter-application dependencies must be carried out through some IPC mechanism. Taken from launchd.plist(5): Unlike many bootstrapping daemons, launchd has no explicit dependency model. Interdependencies are expected to be solved through the use of IPC. It is therefore in the best interest of a job developer who expects dependents to define all of the sockets in the configuration file. This has the added benefit of making it possible to start the job based on demand instead of immediately. --Kyle Sluder ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Detecting when fetch: finishes
On Jun 3, 2009, at 4:12 PM, Ulai Beekam wrote: I have an NSArrayController that, at the request of the user, can be given a new fetch predicate. To do that I use the setFetchPredicate: method. How can I detect when this predicate has been applied and the appropriate fetching is done? I have not come across any delegate method for it. What are you trying to achieve? See http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBindings.html#//apple_ref/doc/uid/TP40004194-SW3 mmal ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com