NSAppleScript returns wrong result on multiple Safari windows, applescript editor work
Hello, Still working on this problem. I need to get Safari most current URL. NSAppleScript does not work since it returns the wrong result, or it needs to activate Safari which isn't a solution. I'm now trying osascript called via an NSTask. This works in Terminal : /usr/bin/osascript -e 'tell application Safari to get URL of current tab of window 1' However calling this within my program results in : 33:36: execution error: Safari got an error: Can’t get current tab of window 1. (-1728) Why ? Calling with this : __ NSTask *task = [[[NSTask alloc] init] autorelease]; [task setLaunchPath: @/usr/bin/osascript]; NSString *command = @tell application \Safari\ to get URL of current tab of window 1; NSArray *arguments = [NSArray arrayWithObjects: @-e, command, nil]; [task setArguments: arguments]; NSPipe *pipe = [NSPipe pipe]; [task setStandardOutput: pipe]; NSFileHandle *file = [pipe fileHandleForReading]; [task launch]; NSData *data = [file readDataToEndOfFile]; NSString *string = [[NSString alloc] initWithData: data encoding: NSUTF8StringEncoding]; NSLog (@got\n%@, string); __ 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: Recording video from a QCView to .mov
Does using QTKit mean that everything in my quartz composition will be recorded, or only the input from the camera? 8 jan 2009 kl. 18.48 skrev David Duncan: On Jan 8, 2009, at 1:47 AM, Jonathan Selander wrote: I'm trying to record video form a webcam input to a .mov file. I've made a simple quartz composition and loaded it in a QCView. I tried using code from the QCTV example bundled with XCode, but there are things I'm not really sure about there. For instance, do i need to use OpenGL for rendering frames to a file, or can i use something else, perhaps something a little easier to use? You would probably do better by investigating QTKit Capture rather than using a QCView like this. The best place to ask about that would be the Quicktime-API mailing list. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Hyperlinks
Thank you both for this. Much appreciated. On 9 Jan 2009, at 03:15, Sean McBride wrote: Matthew Morton (mattmor...@me.com) on 2009-01-08 7:02 AM said: have bound the value of the NSTextField to an NSAttributedString in a custom class and set attributes for NSLinkAtributeName, NSForegroundColorAtributeName, and NSUnderlineStyleAttributeName. If you're interested, you can get the correct 'blue' colour for the hyperlink like this: ICAttr attr; RGBColorrgbColour; size = sizeof(RGBColor); err = ICGetPref (icInstance, kICWebUnreadColor, attr, rgbColour, size); (Old API, but still the best way AFAIK. Even works in 64bit.) Sean ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSDistributedNotificationCenter and Launchd
I have a background process that when started manually talks correctly with the GUI app using NSDistributedNotificationCenter. However, once I use launchd to start it as a LaunchDaemon I get no receiving of notifications from either the daemon or the GUI app. Is there a way to get the notifications to come through or is it near impossible? Cheers, Aaron -- Aaron Scott Director Maza Digital email: mazadigi...@mac.com website: www.mazadigital.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
Maybe this can be a good starting point: http://www.catb.org/~esr/faqs/smart-questions.html Le 9 janv. 09 à 03:11, Parker Logan a écrit : I am new to all this so if any one can help please do. Thank you From: LIL PLO ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to devli...@shadowlab.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSDistributedNotificationCenter and Launchd
On Fri, Jan 9, 2009 at 3:58 AM, Aaron Scott mi...@mac.com wrote: However, once I use launchd to start it as a LaunchDaemon I get no receiving of notifications from either the daemon or the GUI app. Is there a way to get the notifications to come through or is it near impossible? Have you read TN2083, Daemons and Agents? http://developer.apple.com/technotes/tn2005/tn2083.html Looking at the Supporting Fast User Switching section of the Multiple User Environments guide, it seems to be implied that NSDistributedNotificationCenter only works on GUI login sessions. I'd look into configuring your launchd plist to open up a UNIX domain socket with which to communicate with other processes. --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: NSDecimalNumber seen as NSCFNumber; a bug? (not solved)
Upon this suggestion, I investigated further with the debugger. Now I am more than sure than the value is not released, not in the passages I describe here. This is the scenario. I have a UITableViewController. Rows is selected. willSelect or didSelect methods (I tried both) do this LineItemDataPickerViewController *controller = [[[LineItemDataPickerViewController alloc] initWithNibName:@LineItemDataPickerView bundle:nil] autorelease]; controller.lineItem = lineItem; [self.navigationController pushViewController:controller animated:YES]; I put a breakpoint on this last line; here, controller.lineItem.adjustedUnitaryPrice is a NSDecimalNumber. All good so far. Then the LineItemDataPickerViewController's viewWillApper:animated method is invoked. Here's the relevant code: - (void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [typePicker reloadAllComponents]; NSLog(@%@, lineItem.unitaryPrice); //etc... I put a breakpoint here, to check on the types and values of lineItem properties. adjustedUnitaryPrice is now a NSCFNumber (rounded with 2 decimals after the comma), but that's not all; lineItem.name, supposedly a NSString is a NSCFString. Similarly, a NSArray property figures now as NSCFArray. Now, I know these are the abstract equivalent between NS classes, but I wonder why the debugger correctly shows the NSClasses in the UITableViewController and the NSCF classes in the LineItemDataPickerViewController. More importantly, because of this class mismatch, during the runtime method calls like decimalNumberByRoundingAccordingToBehavior are not recognized. Note that the controller.lineItem property is correctly set (@property (nonatomic, retain) LineItem *lineItem; ) and synthesized; the LineItem.h file is imported in both controllers. So, something happens between the first controller willSelect:animated invoke and the second controller willAppear, that changes my object classes. What do you suggest? Davide Il giorno 09/gen/09, alle ore 01:27, Quincey Morris ha scritto: On Jan 8, 2009, at 08:49, Davide Benini wrote: And here the application terminates and I get this error message *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[NSCFNumber decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector sent to instance 0x10755e0' By far the most common cause of an error like this (the class of the object is not what you expect) is a memory management bug in your code. That is, the NSDecimalNumber object (to which something is holding a pointer) has actually been improperly released and deallocated. By chance, the same block of memory has since been reused for a completely unrelated object (a NSNumber object, in this case). Check to see that you've followed memory management rules everywhere. (Look for a missing retain or an extra release.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoa%40davidebenini.it This email sent to co...@davidebenini.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
NSTextView bindings; value path
Hi all, The documentation concerning the valuePath at http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTextView.html says An NSString that specifies the full path of the content to display in the NSTextView. What should be at the path referred to by the NSString? Thanks, Matt ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help
here's a tread on starter books: http://www.cocoabuilder.com/archive/message/cocoa/2003/7/9/76391 not sure if any of the following books are listed, as i didn't read the tread, but you could start with these from amazon (amazon has very affordable prices!) 1. Absolute Beginner's Guide To C 2. Programming In Objective C / Programming In Objective C 2.0 3. Cocoa Programming For Mac OS X good luck! On Fri, Jan 9, 2009 at 4:00 AM, Jean-Daniel Dupas devli...@shadowlab.org wrote: Maybe this can be a good starting point: http://www.catb.org/~esr/faqs/smart-questions.html Le 9 janv. 09 à 03:11, Parker Logan a écrit : I am new to all this so if any one can help please do. Thank you From: LIL PLO ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org This email sent to devli...@shadowlab.org ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/chunk1978%40gmail.com This email sent to chunk1...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Custom tracking in a NSTextFieldCell
On 8 Jan 2009, at 21:19, Eric Gorr wrote: Well, I was finally able to spot the delegate method: -outlineView:shouldTrackCell:forTableColumn:item: and simply return YES. This caused trackMouse startTrackingAt to be called, but this isn't useful until stopTracking is called. For some reason, it isn't. I would be interested in learning why this might not be the case and what I can do about it. Mouse tracking can be a little frustrating sometimes, because whether the NSCell methods work as advertised depends somewhat on the implementation of the NSCell in question, and also on the NSView that is hosting it. For instance, sometimes people code cells with their own mouse tracking loop in -trackMouse:inRect:ofView:untilMouseUp: --- something like this, for instance: - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp: (BOOL)untilMouseUp { if ([theEvent type] == NSLeftMouseDown) { NSWindow *window = [controlView window]; NSEvent *myEvent; while ((myEvent = [window nextEventMatchingMask: (NSLeftMouseDragged | NSLeftMouseUp)])) { NSPoint pos = [controlView convertPoint:[theEvent locationInWindow] fromView:nil]; // Mouse is at location in pos. Do whatever is needed. if ([myEvent type] == NSLeftMouseUp) { // Finished tracking return YES; } } } return [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp]; } in which case you won't see either -startTrackingAt:inView: or - stopTracking:at:inView:mouseIsUp: if the user presses the left button in that cell. Also, similar things can happen in the view layer instead, so someone might run a tracking loop not dissimilar to that above from - mouseDown:, and in that case it may be that your cell won't see the messages for that reason. The most frustrating part, I've always found, is that some of the framework's controls do these kinds of things, and exactly what they do in each case doesn't appear to be documented anywhere. Kind regards, Alastair. -- http://alastairs-place.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Problem with setting fonts in NSTextView
Hi all, In my sample application I use a textview and popupbutton(in which all the available fonts a shown at runtime). For this, i use the code: NSArray *path=[[NSFontManager alloc] availableFonts]; [popup addItemsWithTitles:path]; We can set the font in the textview Using: [textview setFont:fontobj]; Where fontobj is an object of nsfont. But the problem is ,if we select any item from the popupbutton ,the entire text's font is changed from the textview. I really want to set font whenever we select an item i e., If I first select Arial font, the text entered should be in that font after that ,if I select Impactfont , the text entered from the current position should be in that font--(AS IN TEXTEDIT). Please help.. Thankyou. regards ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: CALayer not displaying masked CGImage properly
Hi, I took a .png image with alpha channel that I found on the web, loaded it as an CGImageRef in my app, and then passed it to both the normal NSView and the layer-backed view. This one gets displayed as I expected in both cases, ie. I see the View's background colour through the transparant area of the image. This would mean I am not creating my own masked image correctly. I guess I am unclear about how an image mask should work with alpha channel. I'll experiment some more. thanks anyway, Rob On Jan 8, 2009, at 9:56 AM, Rob Boellaard wrote: Hi everybody, I am trying to learn CoreGraphics and CoreAnimation, things were going well, but now I seem to be stuck. I have an image mask (CGImageRef) that displays nicely when I draw it directly in an NSView. But when I add the same image mask to a CALayer which I then add to a the super layer of a layer-backed NSView, the area that is supposed to be transparant is coloured black, no tranparancy there. Also the lines of the masked area are more jagged than when I draw it directly into an NSViews graphics context. here's the code from the normal NSView: - (void)setImageRef:(CGImageRef)ref { CGImageRelease(imageRef); CGImageRetain(ref); imageRef = ref; } - (void)drawRect:(NSRect)rect { CGRect viewRect = [CGAStructUtil convertNSRect:rect]; [[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh]; CGContextRef cxt = [[NSGraphicsContext currentContext] graphicsPort]; //CGContextSetShouldAntialias(cxt, YES); CGContextSetRGBFillColor(cxt, 0.1, 1.0, 0.1, 1.0); //green CGContextFillRect(cxt, viewRect); CGContextDrawImage(cxt, viewRect, imageRef); } the setImageRef is called by the Controller during awakeFromNib. here's the code from the layer-backed view: - (void)setImageRef:(CGImageRef)ref { [self setWantsLayer:YES]; CALayer *rootLayer = self.layer; rootLayer.frame = [CGAStructUtil convertNSRect:[self frame]]; CALayer *contentLayer = [CALayer layer]; contentLayer.contents = (id)ref; contentLayer.frame = CGRectMake(0, 0, 100, 130); //contentLayer.opaque = NO; [rootLayer addSublayer:contentLayer]; } If you need to see more code, like how I create the mask or something, please let me know. thanks a lot, Rob ps: I hoped the opaque property of CALayer would make a difference, but it doesn't. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/rboell%40tuparev.com This email sent to rbo...@tuparev.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: Problem with setting fonts in NSTextView
On 9 Jan 2009, at 10:07 pm, rethish wrote: NSArray *path=[[NSFontManager alloc] availableFonts]; I take it this is merely a typo; you surely mean: [[NSFontManager sharedFontManager] availableFonts]; Using: [textview setFont:fontobj]; Where fontobj is an object of nsfont. But the problem is ,if we select any item from the popupbutton ,the entire text's font is changed from the textview. I really want to set font whenever we select an item This is exactly what the documentation says it will do. Instead try: [myTextView setFont:fontObj range:[myTextView rangeForUserCharacterAttributeChange]]; Bear in mind the comments in the docs for that method regarding undo. Also, you might need to use: -setTypingAttributes: to seta font ready for typing when the text or selection range is empty. hth, Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
PDF Problem
Hello everyone, Sorry about the double post, but the link to the images did not make it. I have developed an application that converts a PDF to a bitmap image. The program creates an image in which all of the pages in the PDF are stacked - one on top of the other. But I have a problem. When the program is run on a PowerPC running Tiger, the quality is much worse than when I do the same thing from an Intel based machine running leopard. I think that maybe the Tiger api is not antialiasing, but I tried explicitly telling it to do so with no effect. The code is below: NSRect viewBounds = [[pdfDoc pageAtIndex:0] boundsForBox:kPDFDisplayBoxMediaBox]; int height = (int)(viewBounds.size.height * 1.25) * [pdfDoc pageCount]; int pageHeight = (int)(viewBounds.size.height * 1.25); NSRect rect = { 0,height-pageHeight, 990, pageHeight }; NSSize size = NSMakeSize(990, height); NSImage * compositeImage; compositeImage = [[NSImage alloc] initWithSize:size]; [compositeImage lockFocus]; [[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh]; [[NSGraphicsContext currentContext] setShouldAntialias:YES]; NSData* theData = [pdfDoc dataRepresentation]; NSPDFImageRep* pdfRep = [NSPDFImageRep imageRepWithData:theData]; NSImage* pdfImage; int i; for(i=0;i[pdfDoc pageCount];i++){ [pdfRep setCurrentPage:i]; NSRect pageW = [[pdfDoc pageAtIndex:i] boundsForBox:kPDFDisplayBoxMediaBox]; pdfImage = [[NSImage alloc] initWithSize: pageW.size]; NSSize fullSize = NSMakeSize(pageW.size.width*1.25, pageHeight); [pdfImage setScalesWhenResized:YES]; [pdfImage setSize:fullSize]; [pdfImage addRepresentation:pdfRep]; NSRect r = { 0, rect.origin.y, pageW.size.width*1.25, pageHeight }; [pdfImage drawInRect: r fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; [pdfImage release]; pdfImage = nil; rect.origin.y -= pageHeight; } [compositeImage unlockFocus]; NSData *imageData = [compositeImage TIFFRepresentation]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData]; NSDictionary *imageProps = [NSDictionary dictionaryWithObject: [NSNumber numberWithFloat:0.9] forKey:NSImageInterlaced]; imageData = [imageRep representationUsingType:NSJPEGFileType properties:imageProps]; [imageData writeToFile:@/Users/devon/Desktop/out.jpg atomically:YES]; You can view images of the results at http://our-voice.info/results.html Any help would be fantastic! Devon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[XCode] Generating method stubs
Hi all, Coming from a .NET/Visual Studio environment, I got used to some conveniences that I do not find in XCode. For example, when you define a class that should conform to a certain protocol, isn't there a way to generate stubs for all the methods defined in that protocol? Thanks, -- martijn van exel -+- mve...@gmail.com -+- http://www.schaaltreinen.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: [XCode] Generating method stubs
On 9 Jan 2009, at 12:10, Martijn van Exel wrote: Coming from a .NET/Visual Studio environment, I got used to some conveniences that I do not find in XCode. For example, when you define a class that should conform to a certain protocol, isn't there a way to generate stubs for all the methods defined in that protocol? 1. It's Xcode, not XCode, xCode, XCODE or any other variation. 2. You want the xcode-users mailing list. A clue that this was the wrong list was the fact that you thought it necessary to prefix your subject line with [XCode]... 3. In answer to your question, not as far as I know. There are some similar things (e.g. the Place Accessor Defs on Clipboard script, which you can find under the script menu in Xcode), and you could write something similar to do what you're talking about here I'm sure. FWIW, my guess is that this is an area that will improve in future versions of Xcode, not least because of the direction things are headed with LLVM. Kind regards, Alastair. -- http://alastairs-place.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Help
First, you should install XCode (either from your System Installation DVD or by downloading it from connect.apple.com - you'd need to register as a developer then). When installed, you should get familiar with XCode, copy one of the example-projects to your desktop from /Developer/Examples (on your startup disk), open the project by double-clicking the .xcodeproj file. Click the Build and Go button, and try the program. Here's a few suggestions for examples to try first - they are both quite small: /Developer/Examples/AppKit/DotView /Developer/Examples/AppKit/CircleView When you've loaded the DotView and tried it, try changing some values, for instance change: dotRect.size.width = 2 * radius; to... dotRect.size.width = 0.7 * radius; Click Build and Go again, and see the difference from last time. Try also changing bezierPathWithOvalInRect to bezierPathWithRect, Build and Go, to see what happes. Explore and learn. At some point, you will get compile-errors, and the program will not run. You will learn later, how to deal with compile- errors; fortunately, XCode helps you to see what's wrong, usually by showing you the line that fails to compile. When you've at some point get tired or ruined the application (don't worry, you still have the original), go and take this tutorial: http://developer.apple.com/documentation/Cocoa/Conceptual/ObjCTutorial/01Introduction/chapter_1_section_1.html Note: If something worked, but won't compile anymore, and you don't remember how it looked like, you can try and press Command+Z to undo your changes. Save the file and try building it again. Love, Jens On Jan 9, 2009, at 03:11, Parker Logan wrote: I am new to all this so if any one can help please do. 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 arch...@mail-archive.com
Re: PDF Problem
Hi Devon, Perhaps you're looking in the wrong direction. Try checking if the image type on Leopard is the same as the image type on Tiger. If the image type on Tiger is 8 bit (or monochrome), and the image type on Leopard is 24-bit color, it might be the image itself, which forces your output to look like it's not antialiased. -To me, it looks like Tiger is trying to antialias the PDF, but it doesn't succeed, due to the number of colors are limited in the image. Try opening the two saved pictures in Preview, and then click Tools : Inspector to see details about the images. Love, Jens On Jan 9, 2009, at 13:04, Devon Govett wrote: Hello everyone, Sorry about the double post, but the link to the images did not make it. I have developed an application that converts a PDF to a bitmap image. The program creates an image in which all of the pages in the PDF are stacked - one on top of the other. But I have a problem. When the program is run on a PowerPC running Tiger, the quality is much worse than when I do the same thing from an Intel based machine running leopard. I think that maybe the Tiger api is not antialiasing, but I tried explicitly telling it to do so with no effect. The code is below: NSRect viewBounds = [[pdfDoc pageAtIndex:0] boundsForBox:kPDFDisplayBoxMediaBox]; int height = (int)(viewBounds.size.height * 1.25) * [pdfDoc pageCount]; int pageHeight = (int)(viewBounds.size.height * 1.25); NSRect rect = { 0,height-pageHeight, 990, pageHeight }; NSSize size = NSMakeSize(990, height); NSImage * compositeImage; compositeImage = [[NSImage alloc] initWithSize:size]; [compositeImage lockFocus]; [[NSGraphicsContext currentContext] setImageInterpolation: NSImageInterpolationHigh]; [[NSGraphicsContext currentContext] setShouldAntialias:YES]; NSData* theData = [pdfDoc dataRepresentation]; NSPDFImageRep* pdfRep = [NSPDFImageRep imageRepWithData:theData]; NSImage* pdfImage; int i; for(i=0;i[pdfDoc pageCount];i++){ [pdfRep setCurrentPage:i]; NSRect pageW = [[pdfDoc pageAtIndex:i] boundsForBox:kPDFDisplayBoxMediaBox]; pdfImage = [[NSImage alloc] initWithSize: pageW.size]; NSSize fullSize = NSMakeSize(pageW.size.width*1.25, pageHeight); [pdfImage setScalesWhenResized:YES]; [pdfImage setSize:fullSize]; [pdfImage addRepresentation:pdfRep]; NSRect r = { 0, rect.origin.y, pageW.size.width*1.25, pageHeight }; [pdfImage drawInRect: r fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0]; [pdfImage release]; pdfImage = nil; rect.origin.y -= pageHeight; } [compositeImage unlockFocus]; NSData *imageData = [compositeImage TIFFRepresentation]; NSBitmapImageRep *imageRep = [NSBitmapImageRep imageRepWithData:imageData]; NSDictionary *imageProps = [NSDictionary dictionaryWithObject: [NSNumber numberWithFloat:0.9] forKey:NSImageInterlaced]; imageData = [imageRep representationUsingType:NSJPEGFileType properties:imageProps]; [imageData writeToFile:@/Users/devon/Desktop/out.jpg atomically:YES]; You can view images of the results at http://our-voice.info/results.html Any help would be fantastic! Devon ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jensbauer%40christian.net This email sent to jensba...@christian.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: [XCode] Generating method stubs
On 9 Jan 2009, at 11:10 pm, Martijn van Exel wrote: Hi all, Coming from a .NET/Visual Studio environment, I got used to some conveniences that I do not find in XCode. For example, when you define a class that should conform to a certain protocol, isn't there a way to generate stubs for all the methods defined in that protocol? One easy way I use is just cut and paste the method definitions from the .h to the .m file, then find and replace ';' with an empty body. You might be able to write a script that can do this but it's simple enough without. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NSOperation and NSOperationQueue cancellation and ordering questions
I am currently using NSOperation (actually, NSInvocationOperation) and NSOperationQueue to decouple my GUI from some long running operations. Some operations are dependent on one another, in a purely linear fashion, so I've been treating them in the same way I'd treat a singly linked list, keeping track of the last operation pushed into the queue. The problem is that the documentation states that we must not modify an operation that is already in the queue; I don't know if calling addDependency is going to do something to an operation in the queue or not. I also don't know if my locking trick for the delegate guaranteed to work or not (I want to make sure that after I check to see that the delegate responds to a particular selector, the delegate isn't changed for another delegate before I have a chance to call the selector). Finally, I'm not sure that my dealloc method is 100% kosher. Here is some sample code to try to make this more clear (all of this banged out in Outlook, there may be typos). I've inlined questions in the comments in the code: --- MyOperationInvoker.h --- @protocol delegateProtocol @optional // IMPORTANT! - (oneway void) foo:(int) result; // Single process; do I need oneway? - (oneway void) bar:(int) result; // Single process; do I need oneway? @end @interface MyOperationInvoker : NSObject { NSOperationQueue *myQueue; NSOperation *lastOperation; id delegate; NSLock *delegateLock; } @property(retain, readwrite) id delegate; - (void) independentOperation:(id) thing; - (void) dependentOperation:(id) thing; @end --- End of MyOperationInvoker.h --- --- MyOperationInvoker.m --- @interface MyOperationInvoker() @property(retain, readwrite) NSOperationQueue *myQueue; @property(retain, readwrite) NSOperation *lastOperation; @property(retain, readwrite) NSLock *delegateLock; - (void) invokedIndependentOp:(id)thing; - (void) invokedDependentOp:(id) thing; @end @implementation MyOperationInvoker @synthesize myQueue; @synthesize lastOperation; @synthesize delegateLock; @dynamic delegate; - (id) delegate { return [[delegate retain] autorelease]; } /* Note the use of the delegateLock; by using the lock I'm hoping to ensure that the delegate can't be changed during a critical section within the invoked*() methods below. */ - (void) setDelegate:(id) value { if (value != delegate) { [self.delegateLock lock]; [value retain]; [delegate release]; delegate = value; [self.delegateLock unlock]; } } - (id) init { self = [super init]; if (self != nil) { self.delegateLock = [[NSLock alloc] init]; self.delegate = nil; self.myQueue = [[NSOperationQueue alloc] init]; self.lastOperation = nil; } return self; } - (void) dealloc { self.delegate = nil;// locks the lock while doing this [self.myQueue cancelAllOperations]; // delegate == nil, therefore no callbacks // OK, the $64,000 question is, will the dealloc method of NSOperationQueue // run on the current thread, or will it run on one of the threads that it // spawned to run the various operations? Basically, are the following 3 calls // guaranteed to be executed in-order? self.myQueue = nil; self.delegateLock = nil; [super dealloc]; } - (void) independentOperation:(id) thing { NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(invokedIndependentOp:) object:thing]; [self.myQueue addOperation:operation]; [operation release]; } /* Am I able to add the dependencies in the order that I'm doing them in? Am I allowed to add a dependency when one of the operations is already in the run queue? What happens if self.lastOperation has already completed before operation is added to the queue? What happens if self.lastOperation is cancelled before operation has a chance to run? Does operation ever run? */ - (void) dependentOperation:(id) thing { NSInvocationOperation *operation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(invokedIndependentOp:) object:thing]; [operation addDependency:self.lastOperation]; [self.myQueue addOperation:operation]; self.lastOperation = operation; [operation release]; } /* Do the locks here prevent the delegate from being changed while I'm in each critical section? I know that they should, I just want to double check that my logic is right...
NSImage resizing
hi in my application i need to resize a .jpg image through a command line my code is NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:filePath]; // get icon from the file at filePath destination NSSize imageSize; imageSize.width = 384.0; // in points (384 pts = 512 px ) imageSize.height = 384.0; [icon setSize:imageSize]; // set image size NSData * tiffData = [icon TIFFRepresentation]; bitmapImageRep = [NSBitmapImageRep imageRepWithData:tiffData]; [[bitmapImageRep representationUsingType:NSJPEGFileType properties:dict] writeToFile:destPath atomically:YES]; // write it to a file path stored in destPath this code is not altering the size at all i cant create a NSView as its a command line app any suggestions ??? how to resize it?? Advance Thanx -Parimal -- -- Warm Regards, Parimal Das ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
A Question on estimating +arrayWithCapacity
Folks; Under some circumstances I'm not sure how big a mutable object might need be. So is there any guidance on coming up with a value for capacity? Assume for these cases that reasonable guesses range from say 2 - 5000... I assume it's wasteful to just do a land grab with +arrayWithCapacity: 5000 but I also assume that it's unnecessarily burdensome to do +arrayWithCapacity:2. So is the 'best' +arrayWithCapacity:2500? It feels a little like premature optimization, but I do have to provide a value in the code Thanks for any feedback! Steve ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Best way to handle this
On Jan 8, 2009, at 11:58 PM, Ken Thomases wrote: On Jan 8, 2009, at 7:49 PM, Nathan Kinsinger wrote: On Jan 8, 2009, at 4:20 PM, development2 wrote: I am hoping someone can help me figure out the best way to handle this, I am sure someone out there has some experience with this. I have some code that sends a command to an external hardware device and waits to get the response back with the info that was requested of the device. Now what I want to do is animate on screen the graphic of the device, showing that it is working. What I tried to do at first was setup an NSTimer that would be called every 1 second say, then call my method to call the device and wait for the device to respond. But basically my call blocks the NSTimer because it takes some time (actually what I am calling from my code is a command line tool that we created that will return a result file to us). So what I want to do is call my method to get the device info and while waiting for the response animate this graphic of the device in operation. What is the best way to do this? 1) Should I use an NSThread for this? 2) IS there some other Cocoa functionality that might help me here? Thanks in advance for any help. The short answer, yes you need to use threads. I disagree. The OP is invoking an external program to do the communication, but is unnecessarily blocking while waiting for that program to complete. I suggest using NSTask if that's not already what you're doing. Then use the asynchronous notifications of when it completes, and the asynchronous methods of NSFileHandle to do the communication, so that you don't block while waiting for it. Thanks, But I am curious about something. I am using NSTask to actually handle the external program, so what asynchronous notifications are you talking about then? Using NSTimer for the animation will then work. You will also be able to implement something like a Cancel button. That is, by not blocking, your UI can remain responsive. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Question on estimating +arrayWithCapacity
On 10 Jan 2009, at 1:07 am, Steve Cronin wrote: Folks; Under some circumstances I'm not sure how big a mutable object might need be. So is there any guidance on coming up with a value for capacity? Assume for these cases that reasonable guesses range from say 2 - 5000... I assume it's wasteful to just do a land grab with +arrayWithCapacity:5000 but I also assume that it's unnecessarily burdensome to do +arrayWithCapacity:2. So is the 'best' +arrayWithCapacity:2500? It feels a little like premature optimization, but I do have to provide a value in the code Thanks for any feedback! Steve This came up a while back and the consensus was: don't bother at all. Just use [NSMutableArray array]; Odds are you'll never notice any performance difference and you'll not be using more memory than you need. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
A Data Object in Cocoa
I am trying to define a pure data object in Cocoa. This object doesn't do anything, it should just act as a container for three strings. This is generally a good design pattern, at least in Java. In Cocoa, I am running into a lot of resistance. The constructor is rather complicated. And the compiler complains about this: - (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: (NSString *)seed { if (self = [super init]) { self.label = label; ///--- compiler complains self.pin = pin; self.seed = seed; } return self; } I get three warnings that say local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable. What's the Cocoa way of doing this? Do I really have to name the parameters pLabel, pSeed, and pPin? Or would it be better to just keep that stuff in a Dictionary object? Thanks for any help, Nik ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Custom tracking in a NSTextFieldCell
On Jan 9, 2009, at 5:59 AM, Alastair Houghton wrote: On 8 Jan 2009, at 21:19, Eric Gorr wrote: Well, I was finally able to spot the delegate method: -outlineView:shouldTrackCell:forTableColumn:item: and simply return YES. This caused trackMouse startTrackingAt to be called, but this isn't useful until stopTracking is called. For some reason, it isn't. I would be interested in learning why this might not be the case and what I can do about it. Mouse tracking can be a little frustrating sometimes, because whether the NSCell methods work as advertised depends somewhat on the implementation of the NSCell in question, and also on the NSView that is hosting it. For instance, sometimes people code cells with their own mouse tracking loop in -trackMouse:inRect:ofView:untilMouseUp: --- something like this, for instance: - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp: (BOOL)untilMouseUp { if ([theEvent type] == NSLeftMouseDown) { NSWindow *window = [controlView window]; NSEvent *myEvent; while ((myEvent = [window nextEventMatchingMask: (NSLeftMouseDragged | NSLeftMouseUp)])) { NSPoint pos = [controlView convertPoint:[theEvent locationInWindow] fromView:nil]; // Mouse is at location in pos. Do whatever is needed. if ([myEvent type] == NSLeftMouseUp) { // Finished tracking return YES; } } } return [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp]; } in which case you won't see either -startTrackingAt:inView: or - stopTracking:at:inView:mouseIsUp: if the user presses the left button in that cell. Also, similar things can happen in the view layer instead, so someone might run a tracking loop not dissimilar to that above from - mouseDown:, and in that case it may be that your cell won't see the messages for that reason. The most frustrating part, I've always found, is that some of the framework's controls do these kinds of things, and exactly what they do in each case doesn't appear to be documented anywhere. Thanks for the information and confirmation of what I was seeing as well. I've entered a bug report against this: rdar://6483967 Hopefully someday someone will make the effort to clean this mess up. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Best way to handle this
On 10 Jan 2009, at 1:08 am, development2 wrote: But I am curious about something. I am using NSTask to actually handle the external program, so what asynchronous notifications are you talking about then? I'm guessing it would be NSTaskDidTerminateNotification, as it's the only one it defines. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: SetWindowModality Replacement
I think, for the modaless, you need simply invoke [NSWindow makeKeyAndOrderFront:]. On Mac OS X, SystemModal and AppModal are the same and it should work with runModalForWindow. I'm not sure the behavior of kWindowModalityWindowModal. 2009/1/8 Russ matchmo...@yahoo.com: I'm still looking for a Cocoa replacement for SetWindowModality --- need to be able to change a dialog window modeless or modal for good reasons (this is a big tricky app, not a toy text editor). I tried calling [NSApp run] as a nested run loop to turn modeless, but NSApp stop:0 killed the dialog box's modal loop (runModalForWindow) as well. I am thinking of skipping the runModalForWindow altogether for dialog boxes, and implementing my own event filtering that I can turn off and on as needed. It seems I should be able to do the filtering very easily based on each event's window, anything else needed? Other kludge would be to destroy the dialog box outright and recreate it with the alternative mode to switch modes. Suggestions welcome. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/middle.fengdong%40gmail.com This email sent to middle.fengd...@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
QCView to fullscreen
Hi, I've loaded a QC into a QCView and i want to make it go full screen. Googling told me to do something like: - (void) awakeFromNib { if (![self loadCompositionFromFile:[[NSBundle mainBundle] pathForResource:@Introduction ofType:@qtz]]) { NSLog(@Could not load composition); } hasClicked = NO; } - (void)enterFullScreen:(id)sender { // toggle fullscreen mode if (self.isInFullScreenMode) [self exitFullScreenModeWithOptions:nil]; else [self enterFullScreenMode:[NSScreen self] withOptions:nil]; } This seems to switch to fullscreen mode, but the monitor turns completely black, and the QC never shows, so I have to quit the app. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
Hi Nik, self is a pointer, so you might want to change self. into self- I usually prefix arguments with an 'a' (a for Argument): - (id)initWithLabel:(NSString *)aLabel pin:(NSString *)aPin seed: (NSString *)aSeed { self = [super init]; if(self) { label = aLabel; pin = aPin; seed = aSeed; } return(self); } However, if you do the above, you'll most likely run into problems regarding autoreleased objects. Instead, you should... label = [aLabel retain]; pin = [aPin retain]; seed = [aSeed retain]; And your -dealloc method: - (void)dealloc { [seed release]; [pin release]; [label release]; [super dealloc]; } You may prefer having setters and getters: - (void)setLabel:(NSString *)aLabel { [aLabel retain]; [label release]; label = aLabel; } - (NSString *)label { return(label); } Then you could simply use the much more 'in order': - (id)initWithLabel:(NSString *)aLabel pin:(NSString *)aPin seed: (NSString *)aSeed { self = [super init]; if(self) { [self setLabel:aLabel]; [self setPin:aPin]; [self setSeed:aSeed]; } return(self); } - (void)dealloc { [self setSeed:NULL]; [self setPin:NULL]; [self setLabel:NULL]; [super dealloc]; } Love, Jens On Jan 9, 2009, at 08:49, nik heger wrote: I am trying to define a pure data object in Cocoa. This object doesn't do anything, it should just act as a container for three strings. This is generally a good design pattern, at least in Java. In Cocoa, I am running into a lot of resistance. The constructor is rather complicated. And the compiler complains about this: - (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: (NSString *)seed { if (self = [super init]) { self.label = label; ///--- compiler complains self.pin = pin; self.seed = seed; } return self; } I get three warnings that say local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable. What's the Cocoa way of doing this? Do I really have to name the parameters pLabel, pSeed, and pPin? Or would it be better to just keep that stuff in a Dictionary object? Thanks for any help, Nik ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/jensbauer%40christian.net This email sent to jensba...@christian.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
the compiler is complaining just because they all have the same name and he is confused about witch to choose to resolve the issue, just rename the parameters of your procedure. IE: - (id)initWithLabel:(NSString *)initLabel pin:(NSString *)initPin seed:(NSString *)initSeed { or whatever name that makes them different than your classe's definition. Sandro Noel.. On 9-Jan-09, at 2:49 AM, nik heger wrote: I am trying to define a pure data object in Cocoa. This object doesn't do anything, it should just act as a container for three strings. This is generally a good design pattern, at least in Java. In Cocoa, I am running into a lot of resistance. The constructor is rather complicated. And the compiler complains about this: - (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: (NSString *)seed { if (self = [super init]) { self.label = label; ///--- compiler complains self.pin = pin; self.seed = seed; } return self; } I get three warnings that say local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable. What's the Cocoa way of doing this? Do I really have to name the parameters pLabel, pSeed, and pPin? Or would it be better to just keep that stuff in a Dictionary object? Thanks for any help, Nik ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/sandro.noel%40mac.com This email sent to sandro.n...@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: QCView to fullscreen
On 1/9/09 3:45 PM, Jonathan Selander said: - (void)enterFullScreen:(id)sender { // toggle fullscreen mode if (self.isInFullScreenMode) [self exitFullScreenModeWithOptions:nil]; else [self enterFullScreenMode:[NSScreen self] withOptions:nil]; } You want [NSScreen mainScreen], not [NSScreen self]. Also, you might want to search the archives for some limitations with the enterFullScreenMode:withOptions: API. -- 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: A Data Object in Cocoa
On 9 Jan 2009, at 15:53, Jens Bauer wrote: Hi Nik, self is a pointer, so you might want to change self. into self- No need to do that – assuming that label, pin and seed are declared as properties, which, this being a container class I guess they are. This also destroys the need to play with retaining that you were talking about (assuming the property is set up correctly to generate code that retains values). Bob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On 9 Jan 2009, at 16:13, Andy Lee wrote: I haven't checked, but I suspect the compiler chooses the right thing, since this is only a warning. Maybe someone knows a way to disable the warning? In Java, I wouldn't be surprised if there were a way to enable a similar warning. The compiler will chose the name binding from the inner-most scope, so in this case, label will refer to the argument. In practice though, it's a bad idea to name the two the same – I tend to use initPropertyName in my init functions, and newPropertyName in my setters (if I'm using @dynamic). But then this is coming from the point of view of someone who uses -Wall -Werror. Bob___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Problem sending notification from C callback function
Ken thank you. the problem was elsewhere in a dictionary key name... thank you for your help!!! Sandro Noel. On 9-Jan-09, at 2:09 AM, Ken Thomases wrote: On Jan 8, 2009, at 7:57 PM, Sandro Noel wrote: I have this callback from DiskArbritation framework and I would like to send a notification to my app. but it does not seem to work. Does not seem to work in what way? Are you getting compiler errors or warnings? Crashes at runtime? What? the callback is defined like this. void DiskDisappearedCallback(DADiskRef disk, void *context){ CFDictionaryRef diskDescription = DADiskCopyDescription(disk); NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription; NSString *name = [nsDiskDescription valueForKey:@DAVolumeName]; NSString *type = [nsDiskDescription valueForKey:@DAVolumeKind]; NSString *path = [nsDiskDescription valueForKey:@DAVolumePath]; [[NSNotificationCenter defaultCenter] postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil]; } Obviously, default center does not exist in the callback, Actually, I don't know what you mean here, so it's far from obvious. The default notification center is a singleton. It always exists in the sense that you can always retrieve it using [NSNotificationCenter defaultCenter], just as you have. but i cant seem to typecast the context to my object type and retrieve the notification center from the object. i just do not know how to do it. Well, since the default notification center is a singleton, it is effectively globally available. You don't need to stash a reference to it in your object and retrieve it from there. With regard to the general question of how you can message the object passed in context: given that the context is an object pointer, you can just cast it: id myObject = (id)context; [myObject someMethod:someArgument]; If you have a more specific type than id, go ahead and use that. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Jan 9, 2009, at 9:13 AM, Andy Lee wrote: I haven't checked, but I suspect the compiler chooses the right thing, since this is only a warning. Maybe someone knows a way to disable the warning? In Java, I wouldn't be surprised if there were a way to enable a similar warning. --Andy Don't do that - compiler warning exist for reasons: to help prevent you from writing buggy code. In this case the warning isn't that the compiler is going to do the wrong thing (since it basically gets to define what is right and wrong - and it is right), it's that your code (or somebody else's code who has to later maintain this code) is potentially going to make a mistake and use label when they mean the instance variable, and not label the parameter (and then things will break). Compiler warning are basically its way of saying I'm going to do something that you told me to, but it may not be what you meant, since what you wrote could be ambiguous or have undefined results. Fix the warning, don't disable it. Glenn Andreas gandr...@gandreas.com http://www.gandreas.com/ wicked fun! JSXObjC | the easy way to unite JavaScript and Objective C ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
You're right, it's not needed, and furthermore, I just checked, the warnings won't disappear. Everyone, disregard what I wrote about self- I believe that prefixing the parameters is most likely the best way (and as a good example for us, the guys at Apple does it as well). Love, Jens On Jan 9, 2009, at 16:09, Thomas Davie wrote: self is a pointer, so you might want to change self. into self- No need to do that – assuming that label, pin and seed are declared as properties, which, this being a container class I guess they are. This also destroys the need to play with retaining that you were talking about (assuming the property is set up correctly to generate code that retains values). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Jan 9, 2009, at 10:20 AM, glenn andreas wrote: On Jan 9, 2009, at 9:13 AM, Andy Lee wrote: I haven't checked, but I suspect the compiler chooses the right thing, since this is only a warning. Maybe someone knows a way to disable the warning? In Java, I wouldn't be surprised if there were a way to enable a similar warning. --Andy Don't do that - compiler warning exist for reasons: to help prevent you from writing buggy code. In this case the warning isn't that the compiler is going to do the wrong thing (since it basically gets to define what is right and wrong - and it is right), it's that your code (or somebody else's code who has to later maintain this code) is potentially going to make a mistake and use label when they mean the instance variable, and not label the parameter (and then things will break). Compiler warning are basically its way of saying I'm going to do something that you told me to, but it may not be what you meant, since what you wrote could be ambiguous or have undefined results. Fix the warning, don't disable it. True. Even if a way does exist to disable it, you should really avoid it in the first place. --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: NSImage resizing
Try having a play with -[NSImage setScalesWhenResized:] On 9 Jan 2009, at 13:50, Parimal Das wrote: hi in my application i need to resize a .jpg image through a command line my code is NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:filePath]; // get icon from the file at filePath destination NSSize imageSize; imageSize.width = 384.0; // in points (384 pts = 512 px ) imageSize.height = 384.0; [icon setSize:imageSize]; // set image size NSData * tiffData = [icon TIFFRepresentation]; bitmapImageRep = [NSBitmapImageRep imageRepWithData:tiffData]; [[bitmapImageRep representationUsingType:NSJPEGFileType properties:dict] writeToFile:destPath atomically:YES]; // write it to a file path stored in destPath this code is not altering the size at all i cant create a NSView as its a command line app any suggestions ??? how to resize it?? Advance Thanx -Parimal -- -- Warm Regards, Parimal Das ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net This email sent to cocoa...@mikeabdullah.net ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Weird problem: Application terminates unexpectedly after closing NSOpenPanel sheet
On Jan 8, 2009, at 11:54 PM, Oleg Krupnov wrote: Here is my code: //- - (IBAction)scanFolder:(id)sender { NSOpenPanel* openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseDirectories:YES]; [openPanel setCanChooseFiles:NO]; [openPanel setAllowsMultipleSelection:NO]; [openPanel beginSheetForDirectory:nil file:nil modalForWindow:[sourceView window] modalDelegate:self didEndSelector:@selector (openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; } //- - (void)openPanelDidEnd:(NSOpenPanel*)panel returnCode:(int)returnCode contextInfo:(void*)contextInfo { if (returnCode == NSOKButton) { [self activatePath:[[panel filenames] objectAtIndex:0]]; } } It puzzles me that the application is terminated unexpectedly without any error messages in the console after the stack is unwinded up from the openPanelDidEnd function. What might I be doing wrong? ___ It's hard to say. Use the debugger and add a breakpoint on objc_exception_throw. Then, look at the bt when the crash occurs (on Leopard). 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 arch...@mail-archive.com
Re: [RESOLVED] Weird problem: Application terminates unexpectedly after closing NSOpenPanel sheet
I have found that the cause of the problem was that my XIB main window was of class NSPanel, not NSWindow. When the main window is an NSPanel, the application indeed attempts to quit and calls its NSApp delegate -applicationShouldTerminateAfterLastWindowClosed: message when the sheet gets closed. If the delegate returns NO or does not exist, the application does not quit (it was YES in my case). It seems that when the sheet gets closed, the application somehow decides that it's been the last window, and attempts to quit. I have noticed the same behavior when I simply double-click on the title of the main window, without any sheets, and it gets minimized to the Dock. Also in this case the -applicationShouldTerminateAfterLastWindowClosed: is called and if returned YES, the application quits. The Release on close option of the main window in the XIB does not affect anything in this regard. I guess it's an undocumented bugofeature of Cocoa :) Thanks! On Fri, Jan 9, 2009 at 6:18 PM, Corbin Dunn corb...@apple.com wrote: On Jan 8, 2009, at 11:54 PM, Oleg Krupnov wrote: Here is my code: //- - (IBAction)scanFolder:(id)sender { NSOpenPanel* openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseDirectories:YES]; [openPanel setCanChooseFiles:NO]; [openPanel setAllowsMultipleSelection:NO]; [openPanel beginSheetForDirectory:nil file:nil modalForWindow:[sourceView window] modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL]; } //- - (void)openPanelDidEnd:(NSOpenPanel*)panel returnCode:(int)returnCode contextInfo:(void*)contextInfo { if (returnCode == NSOKButton) { [self activatePath:[[panel filenames] objectAtIndex:0]]; } } It puzzles me that the application is terminated unexpectedly without any error messages in the console after the stack is unwinded up from the openPanelDidEnd function. What might I be doing wrong? ___ It's hard to say. Use the debugger and add a breakpoint on objc_exception_throw. Then, look at the bt when the crash occurs (on Leopard). 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 arch...@mail-archive.com
Re: NSImage resizing
For a bitmap image, -setSize: effectively alters the DPI of the pixels but doesn't actually create a new bitmap of a different size. So for a 72dpi image, the NSBitmapImageRep's -width and -height methods should give you the same values as for the image's -size method. But for a 300dpi image, for example, you'd expect the -width and -height values to be about 4x larger than the -size value. Maybe something like this would do what you want? NSImage* originalIcon = [[NSWorkspace sharedWorkspace] iconForFile:filePath]; NSRect resizedBounds = NSMakeRect(0, 0, 384, 384); NSImage* resizedIcon = [[[NSImage alloc] resizedBounds.size] autorelease]; [resizedIcon lockFocus]; [originalIcon drawInRect:resizedBounds fromRect:NSZeroRect operation:NSCompositeCopy fraction:1.0]; [resizedIcon unlockFocus]; NSBitmapImageRep* bitmapImage = [[resizedIcon representations] objectAtIndex:0]; [[bitmapImage representationUsingType:NSJPEGFileType properties:dict] writeToFile:destPath atomically:YES]; Probably safer to iterate the representation(s) and actually add a check to see that bitmapImage really is one before actually using it, just in case another representation is created. steve On Jan 9, 2009, at 5:50 AM, Parimal Das wrote: hi in my application i need to resize a .jpg image through a command line my code is NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:filePath]; // get icon from the file at filePath destination NSSize imageSize; imageSize.width = 384.0; // in points (384 pts = 512 px ) imageSize.height = 384.0; [icon setSize:imageSize]; // set image size NSData * tiffData = [icon TIFFRepresentation]; bitmapImageRep = [NSBitmapImageRep imageRepWithData:tiffData]; [[bitmapImageRep representationUsingType:NSJPEGFileType properties:dict] writeToFile:destPath atomically:YES]; // write it to a file path stored in destPath this code is not altering the size at all i cant create a NSView as its a command line app any suggestions ??? how to resize 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: A custom cell in a NSOutlineView
Thanks for the information. It was quite useful. p.s. you have my permission to slap whomever is preventing the mention of the PhotoSearch sample code at: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSOutlineView_Class/Reference/Reference.html in the Related Sample Code section. On Jan 8, 2009, at 4:50 PM, Corbin Dunn wrote: My second idea is that I could just dynamically add and remove columns rows, but the problem is that in order to display the group titles, the column they are displayed in needs to be wide...when I added multiple columns, the column of the group title was never wide enough - they would always get clipped. If I had continued down this line, I suspect I would have had trouble dynamically adding and removing columns as the user was resizing the NSPanel. RE: group rows. Take a look at the DragNDropOutlineView example in Leopard, and this delegate method (return something for the nil column): /* Optional - Different cells for each row A different data cell can be returned for any particular tableColumn and item, or a cell that will be used for the entire row (a full width cell). The returned cell should properly implement copyWithZone:, since the cell may be copied by NSTableView. If the tableColumn is non-nil, you should return a cell, and generally you will want to default to returning the result from [tableColumn dataCellForRow:row]. When each row (identified by the item) is being drawn, this method will first be called with a nil tableColumn. At this time, you can return a cell that will be used to draw the entire row, acting like a group. If you do return a cell for the 'nil' tableColumn, be prepared to have the other corresponding datasource and delegate methods to be called with a 'nil' tableColumn value. If don't return a cell, the method will be called once for each tableColumn in the tableView, as usual. */ - (NSCell *)outlineView:(NSOutlineView *)outlineView dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER; The third idea was to subclass NSTextFieldCell and do all of the drawing myself. Each group (Gradients, Hatches, Images, etc.) contains just a single row with a single subclass of a NSTextFieldCell. It is this implementation that is pictured above. As you can see it mostly works and I can dynamically alter the row height so each item fits and moves to different rows as needed. I've seen this done both ways; with/without columns, or with a single cell. Multiple Columns might be easier, especially with group rows, but it might also be difficult, as you have to dynamically add/ remove them as the window resizes. So, a single cell that draws multiple pieces might be easier -- you could use subcells to do the actual work. The PhotoSearch example (easy to find on the developer site) is a good example to start from. It also shows group rows. The problem I am having with this is that I cannot seem to get any help with tracking the mouse (see the thread http://tinyurl.com/9y8to9) . The PhotoSearch example shows how to do this. Instead of doing the tracking in the cell, you can forward the tracking to a sub-cell. The final idea is to dump NSTextFieldCell, since it seems to be eating all mouseUp and mouse tracking information, and go with a completely custom cell. I understand this may be a lot of work, but I cannot see a way around it at the moment. You could have a main cell that subclasses NSCell, and sub-cells in it that subclass NSTextFieldCell for drawing the text. corbin I am hoping that someone else might have some alternate ideas or a pointer to some sample code of a subclass of NSCell which was written to work with a NSTableView. One alternative that had been suggested is to simulate a NSOutlineView with a NSCollectionView. However, it is unclear how well this would actually work. Would it support the editing of the names of the items? Would it support rows of different heights? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Recording video from a QCView to .mov
On Jan 9, 2009, at 12:45 AM, Jonathan Selander wrote: Does using QTKit mean that everything in my quartz composition will be recorded, or only the input from the camera? Just the camera (which was my impression of what you were recording previously!). If you want to record the entire presentation, then you will have to render it via OpenGL, readback the contents of every frame, then add that to a movie. You might be able to adapt the OpenGLCaptureToMovie sample http://developer.apple.com/samplecode/OpenGLScreenCapture/index.html to do what you want. -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[commentary] The value of warnings [was: Re: A Data Object in Cocoa]
From time to time I see questions arise and comments made about disabling warnings. I am reposting commentary made very recently since I believe it is a powerfully stated argument in favor of having the compiler generate warnings (-Wall, etc.), and for writing code that doesn't cause the compiler to emit them. [My apologies for being redundant, but thought this perspective might be missed by those not following the OPs thread on parameter naming.] On Jan 9, 2009, at 5:28 AM, glenn andreas wrote: On Jan 9, 2009, at 9:13 AM, Andy Lee wrote: I haven't checked, but I suspect the compiler chooses the right thing, since this is only a warning. Maybe someone knows a way to disable the warning? In Java, I wouldn't be surprised if there were a way to enable a similar warning. --Andy Don't do that - compiler warning exist for reasons: to help prevent you from writing buggy code. In this case the warning isn't that the compiler is going to do the wrong thing (since it basically gets to define what is right and wrong - and it is right), it's that your code (or somebody else's code who has to later maintain this code) is potentially going to make a mistake and use label when they mean the instance variable, and not label the parameter (and then things will break). Compiler warning are basically its way of saying I'm going to do something that you told me to, but it may not be what you meant, since what you wrote could be ambiguous or have undefined results. Fix the warning, don't disable it. My small addition: I consider that warnings are less about what one is doing in the very moment of composing code, but about interpreting code in the future, because when when writing code so much unstated context is alive in our head, but later all that (valuable) additional context is (often) gone, and the code must stand plainly on its own. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Pasting into another app
I need my app to put data on the clipboard, then cause another app to paste it. The other app is not scriptable. Suggestions? Does this require sending a cmd-v key event to the other app, and how to do this (CGEventTap?), or is there a better way? -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Pasting into another app
Word of caution: When posting a paste key event like that, be warned that it does not translate to international keyboard layouts, where paste can have a different shortcut (such as command-k). That being said, I don't know of another way to invoke paste in another application. Dave On Jan 9, 2009, at 11:17 AM, Scott Ribe wrote: I need my app to put data on the clipboard, then cause another app to paste it. The other app is not scriptable. Suggestions? Does this require sending a cmd-v key event to the other app, and how to do this (CGEventTap?), or is there a better way? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Resetting the TableView
Hi, Thanks. I did miss the animated part. It works now. But as far as my log goes, i can only see ViewDidAppear and ViewWillAppear gets called. ViewDidDisappear and ViewDidAppear never gets called. Yes, i have animated for all four of them. I can remove all my objects and reloadData in ViewWillAppear and it seems to work now. Note sure why Disappear is not getting called at all.. thanks mohan On Thu, Jan 8, 2009 at 11:55 PM, Davide Benini co...@davidebenini.itwrote: Hi, note that viewDidLoad gets called only the first time the view is loaded (thence its use or setting the hierarchy, things that don't change). Also, note the implementation of viewWillAppear:animated: -(void)viewWillAppear:(BOOL)animated { [super viewWillAppear:animated]; [tableView reloadData]; // other customizations here } Do not forget the :animated part, otherwise the compiler won't recognise your method, and it won't get called. I hope this helps. Davide Hi, I tried all four entry points, they are not getting called. My ViewController is initialized using initWithNibName. First time, viewDidLoad gets called. After that, neither viewDidLoad nor the ones you mention gets called. Do i need to do anything special ? thanks mohan On Thu, Jan 8, 2009 at 4:28 PM, Wyatt Webb ww...@inspiration.com wrote: Have a look at viewWillAppear/viewDidAppear and viewWillDisappear/viewDidDisappear on the UIViewController class You could clear out the table data on the disappear step (so you aren't holding data you don't need) or wait for the appear phase to set up your data before it's shown. These get called as you push and pop the controllers. The viewdidLoad is just like it sounds. It only gets called when the view is created or loaded from the NIB (which may happen more than once if you have a low memory situation as, I believe, the UIViewController can release it's view if it's not in use). In your normal case, the view is loaded the first time and then kept around as you move it on and off the navigation stack. HTH, Wyatt On Jan 8, 2009, at 4:16 PM, Mohan Parthasarathy wrote: Yes, but where will call this when the ViewController is being made active. The new view was filled with data previously and i need a chance to reset it. Could you explain in little bit more detail ? thanks mohan On Thu, Jan 8, 2009 at 4:04 PM, sanchezm sanchez...@gmail.com wrote: UITableView has a reloadData method - Miguel On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote: Hi, I try to reuse UIViewControllers in didSelectatRowIndexPath. The new View has a table which is filled with data eventually. Later the view gets popped and when reusing the same ViewController the table shows old data. Is there a way to clear the data while still reusing ViewControllers (as recommended). I tried in viewdidLoad etc. but it seems to get called only once the first time the View was created. thanks mohan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/sanchezm95%40gmail.com This email sent to sanchez...@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/wwebb%40inspiration.com This email sent to ww...@inspiration.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/cocoa%40davidebenini.it This email sent to co...@davidebenini.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/suruti94%40gmail.com This email sent to surut...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Pasting into another app
When posting a paste key event like that, be warned that it does not translate to international keyboard layouts, where paste can have a different shortcut (such as command-k). That being said, I don't know of another way to invoke paste in another application. Thanks. Fortunately, this will only be used on 4 computers in 1 corner of 1 office in the U.S. ;-) (10.4 10.5 only...) -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bonjour server with multiple clients
Hi everyone, I'm writing a simple voting app, where one instance of the app creates a poll and then publishes it over Bonjour. Other instances of the app on the same local network then find the publish poll, get the list of voting options, and then allow users at each computer to start submitting votes. The votes are sent back over the Bonjour connection, fed into a thread-safe queue, and the poll owner retrieves them at his leisure. I've gotten this setup to work with one client. I have one instance of my app publishing an NSNetService, and another using an NSNetServiceBrowser to find it and connect to it. They can then successfully pass information back and forth (it was very exciting to get this working!). I've tried having multiple clients connect, but the server doesn't ever receive any of their messages. So I guess my question is this: Does my server need to publish a new NSNetService for each connection? (ie, every time it accepts a connection, publish a new version of the netservice for someone else to connect to) If not, how should I be going about this? Any pointers would be greatly appreciated. The sample code I've found seems to all be a single server-client pair. Thanks! Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Please help
Any more sites From: LIL PLO On Jan 9, 2009, at 4:22 AM, Parker Logan parkl...@yahoo.com wrote: Please can any one teach me about code I just started and I want to learn. Thanks for your time Begin forwarded message: From: Parker Logan parkl...@yahoo.com Date: January 9, 2009 4:11:52 AM GMT+02:00 To: Cocoa Developers cocoa-dev@lists.apple.com Subject: Help I am new to all this so if any one can help please do. Thank you From: LIL PLO ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Please help
http://cocoaheads.byu.edu has a very large resources section. Dave On Jan 9, 2009, at 1:30 PM, Parker Logan wrote: Any more sites ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Please help
On Fri, Jan 9, 2009 at 3:30 PM, Parker Logan parkl...@yahoo.com wrote: Any more sites Seriously? http://www.google.com/ You've been handed a number of excellent resources, any one of which should keep you reading and learning for days if not months. There have been a lot of very helpful replies which are great and all, but you *must* do your homework if you're going to make any progress. If you have specific questions, post them. Otherwise, you're doing yourself (and the list) no favors by ignoring a tool as basic as Google. -- 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
Thanks
From: LIL PLO ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Pasting into another app
Checkout CGEventCreateKeyboardEvent and CGEventPost to synthesize keyboard events. You have to make and post an event for the key down and then the key up. So: command key down, V key down, V key up, command key up. There's also CGPostKeyboardEvent which is easier to use but not recommended for all cases. On Jan 9, 2009, at 11:55 AM, Scott Ribe wrote: Thanks. Fortunately, this will only be used on 4 computers in 1 corner of 1 office in the U.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: Pasting into another app
With the CGEvents, you don't have to post four. You can post two: One for V down and one for V up. You can use the modifierFlags on the CGEvent to specify that Command should be down on V down. Dave On Jan 9, 2009, at 2:34 PM, Michael Vannorsdel wrote: Checkout CGEventCreateKeyboardEvent and CGEventPost to synthesize keyboard events. You have to make and post an event for the key down and then the key up. So: command key down, V key down, V key up, command key up. There's also CGPostKeyboardEvent which is easier to use but not recommended for all cases. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: Bonjour server with multiple clients
On Jan 9, 2009, at 2:47 PM, Dave DeLong wrote: I'm writing a simple voting app, where one instance of the app creates a poll and then publishes it over Bonjour. Other instances of the app on the same local network then find the publish poll, get the list of voting options, and then allow users at each computer to start submitting votes. The votes are sent back over the Bonjour connection, fed into a thread-safe queue, and the poll owner retrieves them at his leisure. Bonjour is for advertising and discovering services. The votes are sent back over the Bonjour connection doesn't make sense. There is no such thing as a Bonjour connection. The client and server communicate by whatever means they would have communicated without zeroconf. I've gotten this setup to work with one client. I have one instance of my app publishing an NSNetService, and another using an NSNetServiceBrowser to find it and connect to it. They can then successfully pass information back and forth (it was very exciting to get this working!). I've tried having multiple clients connect, but the server doesn't ever receive any of their messages. So I guess my question is this: Does my server need to publish a new NSNetService for each connection? No. If you have one service which allows multiple connections on the advertised port, you only advertise your service once. The specific details about how you accept multiple connections are going to depend on how your server is implemented. If not, how should I be going about this? Any pointers would be greatly appreciated. The sample code I've found seems to all be a single server-client pair. The internet is full of servers which accept multiple connections. Many of these servers are open source :-) If you are looking for a simple example to get started with, the Picture Sharing example shows a simple server implementation which accepts multiple connections. Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[moderator] Re: Thanks
Please consider this over. He's unsubscribed, and I'll be more vigilant about approvals again in the future. scott ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NSTextView bindings; value path
On Jan 9, 2009, at 4:11 AM, Matthew Morton wrote: The documentation concerning the valuePath at http://developer.apple.com/documentation/Cocoa/Reference/CocoaBindingsRef/BindingsText/NSTextView.html says An NSString that specifies the full path of the content to display in the NSTextView. What should be at the path referred to by the NSString? I'm assuming the path should refer to a file in one of the formats supported by NSAttributedString, as with the - initWithPath:documentAttributes: method. NSTextStorage is a subclass of NSAttributedString. You'll want to look at the docs for the AppKit additions to the NSAttributedString class: http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/ You can use +[NSAttributedStrings textTypes] to get a list of the types, although you shouldn't need to reference that for your actual binding. I would think that would be mostly interesting for development/debugging information. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Pasting into another app
Michael said: Checkout CGEventCreateKeyboardEvent and CGEventPost That's what I found, and got it working. So: command key down, V key down, V key up, command key up. FYI, although that's what the docs say, it doesn't work. You have to set the command key flag on the V key down event, then V key up--no command key down up events. I targeted a couple of different apps, same thing with both. Dave said: ...you don't have to post four. Not just don't have to--that doesn't even work. (The example in the docs puts in a lower-case z, not upper-case.) -- Scott Ribe scott_r...@killerbytes.com http://www.killerbytes.com/ (303) 722-0567 voice ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: [commentary] The value of warnings [was: Re: A Data Object in Cocoa]
On Jan 9, 2009, at 1:01 PM, Stuart Malin wrote: My small addition: I consider that warnings are less about what one is doing in the very moment of composing code, but about interpreting code in the future, because when when writing code so much unstated context is alive in our head, but later all that (valuable) additional context is (often) gone, and the code must stand plainly on its own. I believe comments and documentation are the best way to handle context (so it's not unstated :-) ), but I admit that not only have I not thought about this as an argument for -Wall et al, but I find I agree 100%. Well said. I'll add one of my own favorite statement: A computer is just like an under-socialized geek - it takes everything *way* too literally. Do you really want to trust that it gets 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: A Question on estimating +arrayWithCapacity
On Jan 9, 2009, at 8:11 AM, Graham Cox wrote: On 10 Jan 2009, at 1:07 am, Steve Cronin wrote: Under some circumstances I'm not sure how big a mutable object might need be. So is there any guidance on coming up with a value for capacity? [...] It feels a little like premature optimization, but I do have to provide a value in the code Thanks for any feedback! Steve This came up a while back and the consensus was: don't bother at all. Just use [NSMutableArray array]; And the reason many people don't realize they can do this is that they overlook the superclass methods when considering a subclass. A lot of people don't even know that they can send +array to NSMutableArray! Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Jan 9, 2009, at 1:49 AM, nik heger wrote: - (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed: (NSString *)seed { if (self = [super init]) { self.label = label; ///--- compiler complains self.pin = pin; self.seed = seed; } return self; } I get three warnings that say local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable. The ambiguity isn't on the left side of the assignment. That is clear enough with the dot syntax. The problem is on the right side, where a plain, unadorned label could be an attempt to reference the parameter or the instance variable. Dot syntax is one way of accessing your properties, but not the only way. The lack of dot syntax doesn't make an identifier fail to match an instance variable. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
I've noticed a pattern in some Apple code where the instance variables are all prefixed with an underscore, but the property name, and therefore the accessors, are what you'd expect. This leaves you free to use the same name for arguments. To make the property point to the right variable, use an = after the synthesize statement: @interface MyObj { int _foo; } @property (readwrite, assign) int foo; @end @implementation MyObj @synthesize foo = _foo; - (id)initWithInt:(int)foo { if (![super init]) return nil; [self setFoo:foo]; return self; } @end Cheers, Adam On Fri, Jan 9, 2009 at 6:47 PM, Ken Thomases k...@codeweavers.com wrote: On Jan 9, 2009, at 1:49 AM, nik heger wrote: - (id)initWithLabel:(NSString *)label pin:(NSString *)pin seed:(NSString *)seed { if (self = [super init]) { self.label = label; ///--- compiler complains self.pin = pin; self.seed = seed; } return self; } I get three warnings that say local declaration of x overrides instance variables. I thought I could differentiate between the parameters and the instance variables using self.variable vs just variable. The ambiguity isn't on the left side of the assignment. That is clear enough with the dot syntax. The problem is on the right side, where a plain, unadorned label could be an attempt to reference the parameter or the instance variable. Dot syntax is one way of accessing your properties, but not the only way. The lack of dot syntax doesn't make an identifier fail to match an instance variable. Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/acfoltzer%40gmail.com This email sent to acfolt...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Fri, Jan 9, 2009 at 7:11 PM, Adam Foltzer acfolt...@gmail.com wrote: - (id)initWithInt:(int)foo { if (![super init]) return nil; [self setFoo:foo]; return self; } Do not use getters and setters in -init. You should be accessing the ivars directly. --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: Bonjour server with multiple clients
On Jan 9, 2009, at 1:49 PM, Jim Correia wrote: I'm writing a simple voting app, where one instance of the app creates a poll and then publishes it over Bonjour. Other instances of the app on the same local network then find the publish poll, get the list of voting options, and then allow users at each computer to start submitting votes. The votes are sent back over the Bonjour connection, fed into a thread-safe queue, and the poll owner retrieves them at his leisure. Bonjour is for advertising and discovering services. The votes are sent back over the Bonjour connection doesn't make sense. There is no such thing as a Bonjour connection. The client and server communicate by whatever means they would have communicated without zeroconf. Apple's bonjour example (Picture Sharing http://developer.apple.com/samplecode/PictureSharing/index.html) seems to be demoing exactly what you say it doesn't do. Whether or not it's called bonjour connection or something else doesn't really matter. Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Question on estimating +arrayWithCapacity
On Fri, Jan 9, 2009 at 6:39 PM, Ken Thomases k...@codeweavers.com wrote: And the reason many people don't realize they can do this is that they overlook the superclass methods when considering a subclass. A lot of people don't even know that they can send +array to NSMutableArray! Part of the problem that was addressed in the previous thread was that +array is not documented to actually give you a mutable instance. While in practice it works fine, there's no guarantee. --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: Bonjour server with multiple clients
On Fri, Jan 9, 2009 at 8:22 PM, Markus Spoettl msappleli...@toolsfactory.com wrote: Apple's bonjour example (Picture Sharing http://developer.apple.com/samplecode/PictureSharing/index.html) seems to be demoing exactly what you say it doesn't do. Whether or not it's called bonjour connection or something else doesn't really matter. The first thing you see when you open up PicSharingController.m in that example is the following: - - (IBAction)toggleSharing:(id)sender { uint16_t chosenPort; if(!listeningSocket) { // Here, create the socket from traditional BSD socket calls, and then set up an NSFileHandle with //that to listen for incoming connections. - So the actual communication between clients has nothing to do with Bonjour. Bonjour just advertises to other machines hey I'm listening for picture sharing on this socket! As Jim said, the notion of a Bonjour connection is flawed because of how the protocol works. --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: A Question on estimating +arrayWithCapacity
On 10 Jan 2009, at 12:27 pm, Kyle Sluder wrote: Part of the problem that was addressed in the previous thread was that +array is not documented to actually give you a mutable instance. While in practice it works fine, there's no guarantee. Isn't guaranteed by the semantics of inheritance? I've specified the class: [NSMutableArray ... and what I want it to give me... array]; And the fact that NSMutableArray inherits NSArray ensures that anything that array can do, NSMutableArray can do. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Question on estimating +arrayWithCapacity
On Fri, Jan 9, 2009 at 8:40 PM, Graham Cox graham@bigpond.com wrote: Isn't guaranteed by the semantics of inheritance? I've specified the class: [NSMutableArray ... and what I want it to give me... array]; And the fact that NSMutableArray inherits NSArray ensures that anything that array can do, NSMutableArray can do. No, it means that NSMutableArray responds to everything NSArray responds to; there's no semantic guarantee. What if the subclass needs a different designated initializer, maybe one with more arguments? It would make sense for it to override the superclass's designated initializer to throw an exception. But without overriding the convenience constructor, this will blow up. --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: A Question on estimating +arrayWithCapacity
On Jan 9, 2009, at 5:40 PM, Graham Cox wrote: On 10 Jan 2009, at 12:27 pm, Kyle Sluder wrote: Part of the problem that was addressed in the previous thread was that +array is not documented to actually give you a mutable instance. While in practice it works fine, there's no guarantee. Isn't guaranteed by the semantics of inheritance? I've specified the class: [NSMutableArray ... and what I want it to give me... array]; And the fact that NSMutableArray inherits NSArray ensures that anything that array can do, NSMutableArray can do. The return type of an initializer method should be id. The reason for this is that id gives an indication that the class is purposefully not considered—that the class is unspecified and subject to change, depending on context of invocation. For example, NSString provides a method initWithFormat:. When sent to an instance of NSMutableString (a subclass of NSString), however, the message returns an instance ofNSMutableString, not NSString. http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_4.html#//apple_ref/doc/uid/TP30001163-CH22-SW4 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 arch...@mail-archive.com
Re: A Question on estimating +arrayWithCapacity
+[NSMutableArray array] returns a mutable array. That's the reason the return type is + (id) and not + (NSArray *). When implementing connivence initializers, you should invoke [self alloc], not [ASpecificClass alloc]. Cocoa uses this pattern frequently, and you can safely depend on it. Objective-c classes are first class objects. That's a difference from many other languages. Once you get uses to classes being first class objects, and the fact that classes can have dynamic messages, this becomes a lot more natural. Good Luck - Jon Hess On Jan 9, 2009, at 5:45 PM, Kyle Sluder wrote: On Fri, Jan 9, 2009 at 8:40 PM, Graham Cox graham@bigpond.com wrote: Isn't guaranteed by the semantics of inheritance? I've specified the class: [NSMutableArray ... and what I want it to give me... array]; And the fact that NSMutableArray inherits NSArray ensures that anything that array can do, NSMutableArray can do. No, it means that NSMutableArray responds to everything NSArray responds to; there's no semantic guarantee. What if the subclass needs a different designated initializer, maybe one with more arguments? It would make sense for it to override the superclass's designated initializer to throw an exception. But without overriding the convenience constructor, this will blow up. --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/jhess%40apple.com This email sent to jh...@apple.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bonjour server with multiple clients
On Jan 9, 2009, at 5:38 PM, Kyle Sluder wrote: The first thing you see when you open up PicSharingController.m in that example is the following: - - (IBAction)toggleSharing:(id)sender { uint16_t chosenPort; if(!listeningSocket) { // Here, create the socket from traditional BSD socket calls, and then set up an NSFileHandle with //that to listen for incoming connections. - So the actual communication between clients has nothing to do with Bonjour. Bonjour just advertises to other machines hey I'm listening for picture sharing on this socket! As Jim said, the notion of a Bonjour connection is flawed because of how the protocol works. Of course that's all true but you will also notice that in fact you have to provide a port for NSNetService that you get via a sequence of calls that produce your listeningSocket further down the same method: chosenPort = ntohs(serverAddress.sin_port); listeningSocket = [[NSFileHandle alloc] initWithFileDescriptor:fdForListening closeOnDealloc:YES]; and netService = [[NSNetService alloc] initWithDomain:@ type:@_wwdcpic._tcp. name:[serviceNameField stringValue] port:chosenPort]; You need to create the listeningSocket to read data, the port alone will not help you (in that example). I don't argue with that with the terminology issues but: The real question the OP had (I think) was not addressed. And I'd like to know it too: How does one go about advertising a service via bonjour like in the Picture Sharing example AND allow multiple connections instead of just one? Is it as simple as creating multiple listeningSockets? Or create a new listening socket each time you get a connection to the existing one? Regards Markus -- __ Markus Spoettl smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bonjour server with multiple clients
On 09 Jan 09, at 17:57, Markus Spoettl wrote: How does one go about advertising a service via bonjour like in the Picture Sharing example AND allow multiple connections instead of just one? Is it as simple as creating multiple listeningSockets? Or create a new listening socket each time you get a connection to the existing one? Reading a tutorial on network programming may prove helpful here. Here's one: http://beej.us/guide/bgnet/output/html/multipage/index.html The short answer is that a single listening socket is sufficient; a new socket representing a connection is created when each client connects. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
I stand corrected; I've seen this many times before, and have never had problems. I'm guessing it's one of those patterns that causes problems under specific circumstances? Cheers, Adam On Fri, Jan 9, 2009 at 7:40 PM, Kyle Sluder kyle.slu...@gmail.com wrote: On Fri, Jan 9, 2009 at 7:11 PM, Adam Foltzer acfolt...@gmail.com wrote: - (id)initWithInt:(int)foo { if (![super init]) return nil; [self setFoo:foo]; return self; } Do not use getters and setters in -init. You should be accessing the ivars directly. --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: NSDistributedNotificationCenter and Launchd
On Jan 9, 2009, at 12:58 AM, Aaron Scott wrote: I have a background process that when started manually talks correctly with the GUI app using NSDistributedNotificationCenter. However, once I use launchd to start it as a LaunchDaemon I get no receiving of notifications from either the daemon or the GUI app. Is there a way to get the notifications to come through or is it near impossible? You can send distributed notifications from the daemon to the GUI app if you use the flag to send the notification to all user sessions. But it will not work the other way. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Jan 9, 2009, at 8:28 PM, Adam Foltzer wrote: I stand corrected; I've seen this many times before, and have never had problems. I'm guessing it's one of those patterns that causes problems under specific circumstances? Yes, only under certain situations. I've been personally calling accessors from both init and dealloc in shipping apps over the past 5 years. However, in my specific case, I'm the sole author so have complete control over how the code is called. I do have a todo in my eventual list of tasks to refactor the code. On Fri, Jan 9, 2009 at 7:40 PM, Kyle Sluder kyle.slu...@gmail.com wrote: On Fri, Jan 9, 2009 at 7:11 PM, Adam Foltzer acfolt...@gmail.com wrote: - (id)initWithInt:(int)foo { if (![super init]) return nil; [self setFoo:foo]; return self; } Do not use getters and setters in -init. You should be accessing the ivars directly. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
Adam Foltzer (acfolt...@gmail.com) on 2009-01-09 9:28 PM said: I stand corrected; I've seen this many times before, and have never had problems. I'm guessing it's one of those patterns that causes problems under specific circumstances? See this thread: http://www.cocoabuilder.com/archive/message/cocoa/2008/10/8/219728 Basically, in init and dealloc, you should message ivars directly instead of using setters. Sean ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: A Data Object in Cocoa
On Jan 9, 2009, at 6:47 PM, Sean McBride wrote: See this thread: http://www.cocoabuilder.com/archive/message/cocoa/2008/10/8/219728 Basically, in init and dealloc, you should message ivars directly instead of using setters. http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_4_section_4.html 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 arch...@mail-archive.com
Re: A Question on estimating +arrayWithCapacity
This should apply to NSNumber and NSDecimalNumber too right? Yet the NSNumber +numberWith... methods are declared to return (NSNumber *) and when called on NSDecimalNumber they return NSDecimalNumber objects which then have to be typecast. __ Ashley On Jan 9, 2009, at 7:45 PM, mmalc Crawford mmalc_li...@me.com wrote: On Jan 9, 2009, at 5:40 PM, Graham Cox wrote: On 10 Jan 2009, at 12:27 pm, Kyle Sluder wrote: Part of the problem that was addressed in the previous thread was that +array is not documented to actually give you a mutable instance. While in practice it works fine, there's no guarantee. Isn't guaranteed by the semantics of inheritance? I've specified the class: [NSMutableArray ... and what I want it to give me... array]; And the fact that NSMutableArray inherits NSArray ensures that anything that array can do, NSMutableArray can do. The return type of an initializer method should be id. The reason for this is that id gives an indication that the class is purposefully not considered―that the class is unspecified and subjec t to change, depending on context of invocation. For example, NSStri ng provides a method initWithFormat:. When sent to an instance of NS MutableString (a subclass of NSString), however, the message returns an instance ofNSMutableString, not NSString. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Hey
Thanks for all the help. From: LIL PLO ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.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
changeKeyPath method documentation
Hi. I'm completely new to the list and this is my first question. I'm working through Aaron Hillegass' Cocoa Programming For Mac OS X (3rd Ed) and I'm near the end of chapter 9 (pg 148) where it is shown to make use of the changeKeyPath method. I'm in the habit of right clicking on method names and choosing Find selected text in API reference/in documenation. When I do this for changeKeyPath, nothing comes up on my machine? Can anyone enlighten me as to where changeKeyPath is documented? I'm neurotic in that, I don't like seeing something said in a language and not knowing how/where I can reference the docs myself. Thanks in advance to any kind knowledgeable person out there who will shed some light on this for me. :-) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CALayer removeFromSupeLayer crashes
I attach a base layer to a custom view as follows: [view setWantsLayer:YES]; then I add several layers with: CALayer *layer = [CALayer layer]; layer.name = @test; [view.layer addSublayer:layer]; the view draws and each layer draws thru the designated drawRect and drawLayer methods, and all this looks fine. However, I have an action that removes all layers but this crashes on removeFromSuperlayer: NSArray *theLayers = [[self layer] sublayers]; for(CALayer *layer in sublayers) { [layer removeFromSuperlayer]; I'm new to CALayer and at a loss as to what could be wrong with this. Any suggestions would be appreciated. (I've read through most of Dudney's Core Animation book but nothing jumps out at me.) Dennis Christopher ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
accessing ivars in - (id)init
Hi, I read with interest the guidance in a recent thread regarding accessing ivars in -init methods. In a subclass of NSWindow I call [self setBackgroundColor:someColor] even though I don't override that method. This has worked in the wild for about two years, but I wanted to conform to best practice. I tried accessing backgroundColor directly, but the compiler won't let me because that ivar doesn't exist in my subclass. Calling the method on super works, but when I quit my app the debugger started (but failed to load the program after about a minute!). How should I set the background colour in this situation? Should I override -backgroundColor and -setBackgroundColor: or should I just keep using [self setBackgroundColor:aColor] in my -init? For your information, -backgroundColor and -setBackgroundColor: are declared in NSWindow.h Confused. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bonjour server with multiple clients
On Jan 9, 2009, at 8:22 PM, Markus Spoettl wrote: Apple's bonjour example (Picture Sharing http://developer.apple.com/samplecode/PictureSharing/index.html) seems to be demoing exactly what you say it doesn't do. Whether or not it's called bonjour connection or something else doesn't really matter. Bonjour is for advertising and discovering services. If you remove all the Bonjour code from that sample and connect directly, it still works. How does one go about advertising a service via bonjour like in the Picture Sharing example AND allow multiple connections instead of just one? Is it as simple as creating multiple listeningSockets? Or create a new listening socket each time you get a connection to the existing one? The Picture Sharing sample does support multiple connections. (But as written, the connections are short lived - just long enough to send the picture data back to the client.) Jim ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: accessing ivars in - (id)init
On 10/01/2009, at 3:49 PM, Michael Ash wrote: On Fri, Jan 9, 2009 at 11:07 PM, Ron Fleckner ronfleck...@ozemail.com.au wrote: Hi, I read with interest the guidance in a recent thread regarding accessing ivars in -init methods. In a subclass of NSWindow I call [self setBackgroundColor:someColor] even though I don't override that method. This has worked in the wild for about two years, but I wanted to conform to best practice. I tried accessing backgroundColor directly, but the compiler won't let me because that ivar doesn't exist in my subclass. Calling the method on super works, but when I quit my app the debugger started (but failed to load the program after about a minute!). How should I set the background colour in this situation? Should I override -backgroundColor and -setBackgroundColor: or should I just keep using [self setBackgroundColor:aColor] in my -init? For your information, -backgroundColor and -setBackgroundColor: are declared in NSWindow.h IMO the advice to avoid setters in -init and -dealloc is greatly overblown in general. If you override your superclass's methods you had better well expect that it might call them when it's setting up or shutting down! Taking things to their logical conclusion, you shouldn't call *any* public methods on yourself in either place, and I doubt anyone follows that. However even if you do take this advice to be useful, this is still going way too far. Accessing your superclass's ivars directly is *far* worse than calling a setter. The setter exists for this reason, use it. Note that the problems, such as they are, with calling setters only show up if your class is subclassed and the subclass does something weird that doesn't like being called when the rest of the subclass isn't initialized. If you're not subclassing your own class (or you are but you aren't doing anything weird like this in it) then you are perfectly safe. Mike Thanks, Mike. Ron ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: accessing ivars in - (id)init
This discussion can backwards and forwards on the issue of ivars vs accessors, but it won't get anywhere definitive, because there is no answer that covers all cases. All we've got is that Apple's currently recommended practice is to avoid accessors in initializers. Clear, but not absolute. On Jan 9, 2009, at 21:09, Kyle Sluder wrote: So what happens if Apple changes your superclass to observe itself? All of a sudden you start firing KVO notifications off when you didn't mean to. It seems to me that would be a bug in the superclass. An object can't safely start observing itself in its initializer, because until the *original* initializer returns (i.e. the bottom-most subclass initializer), the address of 'self' is not irrevocably determined (any intermediate initializer can theoretically return a different object). ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
NKE Kernel extension
Hi, Anyone here ever done any Network kernel extensions? I am trying to start by doing something simple as monitoring network traffic, but the apple documentation isn't getting me very far? Anyone know any useful websites or tutorials in this area? Best regards, Jacob ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
How to show small button-style images to NSOutlineView?
Hi! I created 10.5 Source View using NSOutlineView and want to know how to show small button-style images in cells when you select or hover them (like in Mail.app round arrow image when you select RSS entry and so on)? A code sample would be appreciate. Donnie. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/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: NKE Kernel extension
On 09 Jan 09, at 23:01, Jacob Rhoden wrote: Anyone here ever done any Network kernel extensions? I am trying to start by doing something simple as monitoring network traffic, but the apple documentation isn't getting me very far? Anyone know any useful websites or tutorials in this area? No need for a kernel extension if all you're after is passive monitoring. Look up libpcap. (It's already installed.) ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com