Re: I need an entry point for live video grabbing
Hi, we developed similar apps in-house and we moved away from the sequence grabber stuff to use libdc1394 to have complete control over 1394 devices and to AVStuff for supporting other less technical cameras. if you are centered upon IIDC cameras, libdc1394 is the way to go. On 2013-12-02, at 05:58 , Motti Shneor wrote: > Thanks Kyle. This seems indeed to be the modern Apple API I was looking for. > Indeed bigger than an elephant :) > > However, I could not find any statement about AVFoundation's video-device > support, and so I don't know if it will work reasonably with the types of > IIDC/DCAM camera's I must work with. > > In addition, these devices usually have features and controls beyond the > generic standard once supported by QuickTime's native IIDC Driver. I found no > word from Apple about extending the generic IIDC support for more accurate > control over specific devices. > > Last, I have found several open source projects (libdc1394, OpenCV, > OpenFrameworks) that provide means to capture and control many IIDC cameras, > but they are all so far in design from a Cocoa-App, I hesitate to invest in > them. > > Do you have knowledge (google doesn't...) about these matters? > > On 25 בנוב 2013, at 20:17, Kyle Sluder wrote: > >> You want AVCaptureSession. >> >> --Kyle Sluder >> >>> On Nov 25, 2013, at 9:53 AM, Motti Shneor wrote: >>> >>> Hello everyone. >>> >>> This seems a novice question, but I have scanned Apple Mac-Dev-Center site >>> and I dived into all kinds of documentation, to no avail. >>> It seems that some basic functionality that was once beautifully covered by >>> the grand "QuickTime" API-set has split into so many parts of the system I >>> can't figure out how to do it anymore. >>> I'm re-writing an application I did 12 years ago, on MacOS 9, QuickTime >>> Sequence-Grabber APIs and the first versions of Carbon. >>> >>> My task: >>> - >>> I need to continuously grab frames from an IIDC/DCam camera connected to >>> the Mac via FireWire (iEEE1394), and display them on the application >>> window, scaled, somewhat enhanced (contrast, edges), with a grid overlay >>> drawn on them. Further, I need to allow a user to draw geometrical objects >>> on the live image, and measure distances and curves clicking over the live >>> video view. >>> - >>> >>> I neither need to record video to disk nor to compress the incoming video. >>> Just display it at the best quality and frame-rate I can. The camera is >>> mounted on a Microscope, and the need for live-image is for the operator to >>> be able to focus the microscope with on-screen feedback, or move the >>> objective to search for some microscopic object. >>> >>> The original implementation did this without problems on 1999 Macs, using >>> QuickTime SG (Sequence-Grabber) APIs for grabbing video, QuickDraw for >>> drawing over the actual GWorld's. I also converted the color spaces by >>> hand, and optimized here and there, until I was able to reach 15fps with a >>> 2mega-pixel camera, on a PPC G3 iMac of that time. >>> >>> Now --- not only I can't find any API set that will allow me to grab video >>> from camera, I find so many frameworks involved in Video that I can't find >>> the connection points between them. Embarrassingly complicated and >>> incomplete APIs. >>> >>> I know I'll need Quartz to draw over the image. I know CoreGraphics will be >>> involved in the layering and CoreImage for image-enhancements. I don't know >>> If I need CoreVideo, although it is about manipulating video as it is >>> displayed. I don't know If I need QTKit or AVFoundation, or something else, >>> and where does OpenGL get in the middle. >>> >>> There is NO SAMPLE PROGRAM now, in in the whole of Apple's developer site >>> to simply grab frames from the iSight (internal camera of the Mac) and >>> display them! The last thing I have (BrideOfMungGrab) does not compile >>> anymore with MacOS 10.7 SDK. In the past, the same API was used for >>> grabbing from iSight, DCAM/IIDCS cameras, and DV-Cam --- today I don't know. >>> >>> I absolutely need a pointer, or I'm missing something big as an elephant. >>> > > Motti Shneor > > Ceterum censeo Microsoftinem delendam esse >
Re: NSWindowController
I recently ot bit by this. it seems that the window will only be allocated when you call showWindow. Just reorder you sequence. On 2011-02-26, at 01:58 , koko wrote: > I have a xib in which is defined a NSPanel > > In code I do > > m_designViewerController = [[[NSWindowController alloc] > initWithWindowNibName:@"DesignViewer"] retain]; at this point the controller has been created but not the window. > NSWindow *window = [m_designViewerController window]; > [window setDelegate:self]; > [m_designViewerController showWindow:self]; now it's been allocated, but you already set you window variable ... > > > The NSPanel shows BUT window is 0x0 ... how can this be? > > -koko > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > http://lists.apple.com/mailman/options/cocoa-dev/louisdemers%40mac.com > > This email sent to louisdem...@mac.com Louis Demers eng. www.obzerv.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: [myWindowController window] returns null !
On 2011-02-24, at 00:22 , Kyle Sluder wrote: > On Wed, Feb 23, 2011 at 8:55 PM, Louis Demers wrote: >> I temporarily set the File's Owner type to a NSWindowController class and >> connected the window to it. Got the same null value > > Rather than trash at the answer, it would be more helpful to learn the > meaning behind your actions. > > If you set the File's Owner class to NSWindowController, but didn't > change the owner you passed to -initWithWindowNibName:owner:, then of > course it wouldn't work. In the whirlwind of things I tried, I indeed forgot to to pass a different more appropriate parameter. > The Class Identity of the File's Owner proxy > in the nib is strictly informative; the actual class of File's Owner > is the class of whatever you pass in as the owner. > > There's very little reason to use -initWithWindowNibName:owner:. It's > much more typical to subclass NSWindowController and use > -initWithWindowNibName: instead. My app architecture may be unusual. It's the first time I use windowcontrollers and such. My object is already subclassing something else and forcing it to subclass at some point NSWindowController would be awkward. > But if you're going to use > -initWithWindowNibName:owner:, you'll need some outlet on the owner > object to which you connect your window. Then you can do something > like this: > > @interface MyFilesOwner : NSObject > @property(assign) IBOutlet NSWindow *windowOutlet; // Hooked up to window in > nib > @end > // -=-=-=- > > MyFilesOwner *owner = [[MyFilesOwner alloc] init]; > NSWindowController *windowController = [[NSWindowController alloc] > initWithWindowNibName:@"NibFile" owner:owner]; > [windowController setWindow:[owner windowOutlet]]; > > //END After Stephen's initial comment, I tried this approach (although not as well articulated) It did not work for a small detail: after the initWithWindowNibName call, the xib file may be read and processed but unless showWindow is called, the window still null so the working sequence I have is: @interface PurgeSystem : NSObject @property(assign) IBOutlet NSWindow *window; // Hooked up to window in nib @end windowControllerPurge_1 = [[NSWindowController alloc] initWithWindowNibName:@"PurgeSystem" owner: purgeSystem_1 ]; [windowControllerPurge_1 showWindow:purgeSystem_1]; // Commenting this line causes purgeSystem_1.window to be null. [windowControllerPurge_1 setWindow: purgeSystem_1.window]; > > But again, there's rarely any reason to prefer this to than merely > subclassing NSWindowController and letting it be the File's Owner, > which is the default behavior when you call -initWithWindowNibName:. Thanks for pointing me in the right direction. I'll reflect on the app's structure to see how to apply that approach. > > --Kyle Sluder Louis Demers eng. www.obzerv.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: [myWindowController window] returns null !
On 2011-02-23, at 23:50 , Stephen J. Butler wrote: > On Wed, Feb 23, 2011 at 10:45 PM, Louis Demers wrote: >> No, in my xib, the File's Owner type is set to a custom Object which has >> some IBOutlet that I connect the gui elements to! >> Then, when I call >> >> myWindowController = [[NSWindowController alloc] >> initWithWindowNibName:@"myWindowXIB" owner: someObject ]; >> >> I pass that object along as the owner. >> >> Do you mean I can only set the File's Owner type to a NSWindowController >> class ? > > Ohhh, I missed that. Someone more experienced then I is going to have > to answer. Mostly I create a subclass of NSWindowController when I > need more outlets and make that my File's Owner. I temporarily set the File's Owner type to a NSWindowController class and connected the window to it. Got the same null value Thanks for the leads to investigate... Louis Demers eng. www.obzerv.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: [myWindowController window] returns null !
On 2011-02-23, at 23:36 , Stephen J. Butler wrote: > On Wed, Feb 23, 2011 at 10:26 PM, Louis Demers wrote: >> I instantiate a NSWindowController with the nib file name and call >> showWindow on it. >> >> myWindowController = [[NSWindowController alloc] >> initWithWindowNibName:@"myWindowXIB" owner: someObject ]; >> >> My window and its content show up but when I ask the windowController for >> the window pointer it returns null. So I can't do anything else with the >> window. I'm not using an NSDocument stuff... Any clues ? > > In IB, is File's Owner class NSWindowController? Did you wire your > window to the File's Owner _window outlet? It doesn't happen > automatically (plus, a nib could contain more than one window if you > wanted). No, in my xib, the File's Owner type is set to a custom Object which has some IBOutlet that I connect the gui elements to! Then, when I call myWindowController = [[NSWindowController alloc] initWithWindowNibName:@"myWindowXIB" owner: someObject ]; I pass that object along as the owner. Do you mean I can only set the File's Owner type to a NSWindowController class ? Louis Demers eng. www.obzerv.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
[myWindowController window] returns null !
Hi, I instantiate a NSWindowController with the nib file name and call showWindow on it. myWindowController = [[NSWindowController alloc] initWithWindowNibName:@"myWindowXIB" owner: someObject ]; My window and its content show up but when I ask the windowController for the window pointer it returns null. So I can't do anything else with the window. I'm not using an NSDocument stuff... Any clues ? Thanks Louis Demers eng. www.obzerv.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
is NSDictionaryController the solution to my problem ?
Hi, my app has a NSMutableDictionary to which I had/remove/modify keys/ value pairs. The value is a custom NSObject class. I need to display the key/value into a NSTableView , one key per line, four columns because my custom object/value has four values I need to display. I use (for the first time) a NSDictionaryController and bindings. My app has an instance of NSDictionaryController and my NSMutabledictionary. I set the content of the NSDictionaryController to the NSMutabledictionary (through IB) when I do NSLog(@"projectsController content = %@",[ [self projectsController] content]); I see the controller has the key/value pairs setup correctly I set the columns in the table view to the instance of the projectsController.arrangedObjects.value.hours my custom value object has setter/getter, is KVC compliant for hours (as far as I can tell). Problem, is, the tableView does not display any data. any clues ? I've googled and reviewed http://developer.apple.com/samplecode/DictionaryController/index.html without success. PS: In a similar applications, I succeeded to display an array of values, but this time, I really need to stick with a mutable dictionary. Louis Demers eng. www.obzerv.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: serialPortSample... hang on "read" function
On 17-Feb-09, at 12:56 , Sean McBride wrote: On 2/17/09 6:52 PM, Boris Prohaska said: Hi Guys... i hope someone can help me out here. In the serialPortSample.h on line 517 in the InitializeModem(); function there is this classic "read" command. But when no modem is here or the cable is unplugged, it hangs there for an infinite amount on time. My question is rather simple: Is there a way to find out if the cable is connected or the other way... to define a timeout, that it will return with an error? here is code I dug out. I, myself, found it browsing on the web and adapted it. Provided without warranty. //--- int OpenMySerialPort( char * path, int timeout) { struct termios options; //struct termiosgOriginalTTYAttrs; int serialDescriptor; serialDescriptor = open( path, O_RDWR | O_NOCTTY | O_NDELAY ); serialDescriptor = open( path, O_RDWR | O_NOCTTY ); ///NSLog( @"Opening Serial Port %s.\n", path ); if ( serialDescriptor == -1 ) { ///NSLog( @"Error %d opening serial port %s.\n", errno, path ); return (-1); } do { ///NSLog( @"No Problem opening serial port.\n" ); if (fcntl( serialDescriptor, F_SETFL, 0 ) == -1) { ///NSLog( @"Error clearing O_NDELAY %s - %s(%d).\n", path , strerror(errno), errno); break; } // Get the current options and save them for later reset if (tcgetattr(serialDescriptor, &gOriginalTTYAttrs) == -1) { ///NSLog( @"Error getting tty attributes %s - %s(%d). \n", path , strerror(errno), errno); break; } // Set raw input, one second timeout // These options are documented in the man page for termios // (in Terminal enter: man termios) options = gOriginalTTYAttrs; options.c_cflag |= (CLOCAL | CREAD); options.c_lflag &= ~(ICANON | ECHO | ECHOE | ISIG); options.c_oflag &= ~OPOST; options.c_cc[ VMIN ] = 0; options.c_cc[ VTIME ] = timeout; options.c_ispeed = B115200; options.c_ospeed = B115200; // Set the options if (tcsetattr(serialDescriptor, TCSANOW, &options) == -1) { ///NSLog( @"Error setting tty attributes %s - %s(%d). \n", path , strerror(errno), errno); break; } return serialDescriptor; } while (0); // Failure path close (serialDescriptor); return -1; } // end of OpenModemPort Have you seen the AMSerialPort class? <http://www.harmless.de/cocoa-code.php> I think it will make your life much easier. -- 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/louisdemers%40mac.com This email sent to louisdem...@mac.com Louis Demers eng. www.obzerv.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: Application Architecture or approach
On 11-Feb-09, at 23:39 , Michael Ash wrote: Your window controller for the palette should then observe NSWindowDidBecomeMainNotification and update the NSObjectController's content pointer to point to the document corresponding to whatever window is currently the main window. Change that one pointer, all your bindings re-point, everything is rosy. Ok, that sounds promising, but, when one of the element on the path changes like the document, will all the gui element of the palette be triggered to refresh the displayed value to newly selected document value ? Louis Demers eng. www.obzerv.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: Application Architecture or approach
On 11-Feb-09, at 23:11 , Graham Cox wrote: On 12 Feb 2009, at 3:04 pm, Louis Demers wrote: I do not care about sticking with that paradigm of one window per camera, but I'm conformable with that approach. But how to I get all the sliders and gui elements of my palettes to now bind to the object/camera that is selected. In my current app, in the bindings inspector of the gui element, I select my instantiated object in the bind to popup and enters the model key path to the key of my object I want to control/display. That works because the instantiated object in unique and in my MainMenu.xib. But in the above scenarios, how do I configure my binding ? the key is the same all over, but the bound object will be swapped by whatever selection process I end up using. Or do I have hit a limit of the binding mechanism. I doubt it, more likely a limit of my own understanding of bindings 8-) OK, I understand your question. I'm not in a good position to answer it definitively as I haven't used bindings myself - I still tend to do things using KVO directly since my current project predates bindings. However, in general, I think what you need to is to have a single controller object that you bind your controls to, and swap the connection to the data model object that represents the selected camera. Then when the camera is switched you are changing just that one object reference, not all the individual bindings. I believe that generic controllers such as NSArrayController will handle that pretty much for you - you just bind to 'selection.whatever' (bondage experts please correct any misinformation here). So the controller manages to reconnect the bindings to the selected objects. ! That would make sense. All that's left if to figure out the implementation details and coerce IB to do what I want. I'll try building a small test app. That could also permit you to have a multiple selection of cameras and control several simultaneously if that makes sense for you. that would definitively be a plus. The app is designed for calibrating and measuring performance of our cameras. Sending the same settings to multiple cameras would be an interesting capability during quality control. Thanks for the cue, I'll keep investigating. Louis Demers eng. www.obzerv.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: Application Architecture or approach
On 11-Feb-09, at 21:30 , Graham Cox wrote: On 12 Feb 2009, at 12:27 pm, Louis Demers wrote: I Had not thought about plugins because all the devices are identical in capabilities. The devices are complex cameras. I wanted to have each cameras have it document window to display the specific video feed, but a single palette to control the brightness/ zoom of the frontmost window/camera. This is an over simplification because in reality, each camera has lots of controls and status. If each camera/device has its own exclusive gui element, the screen will be cluttered beyond acceptable. I was modeling my solution around something like Photoshop or Illustrator where multiple documents use the same set of palettes. What you're saying is that you have many cameras, but want to control one at a time. You are using the active window (or document) as a selection mechanism to choose which camera to control. Seems to me that if you want one camera per window, you'd want the controls for that camera in that window, though I see what you're saying about having too many controls. Maybe it's the selection mechanism that needs more thought? You could have a single window with a list of cameras and you select one to control. I considered that and I'm still interested in that solution. Then it becomes more like a master-detail interface which would be probably more manageable. If you do want to stick to one window per camera and have the controls apply to the from window, you can use notifications to listen for window activate/deactivate notifications and track down the related camera via the window's controller, which would be a class you developed. I do not care about sticking with that paradigm of one window per camera, but I'm conformable with that approach. But how to I get all the sliders and gui elements of my palettes to now bind to the object/ camera that is selected. In my current app, in the bindings inspector of the gui element, I select my instantiated object in the bind to popup and enters the model key path to the key of my object I want to control/display. That works because the instantiated object in unique and in my MainMenu.xib. But in the above scenarios, how do I configure my binding ? the key is the same all over, but the bound object will be swapped by whatever selection process I end up using. Or do I have hit a limit of the binding mechanism. I doubt it, more likely a limit of my own understanding of bindings 8-) --Graham Louis Demers eng. www.obzerv.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: Application Architecture or approach
On 11-Feb-09, at 21:16 , Kyle Sluder wrote: Nothing about this requires you to use the NSDocument architecture. You would implement the palettes the same way as you would for a document-based app. and fundamentally, that is the part I do not know how and asked in a clumsy way 8-( I'm just wondering if it is appropriate for what you're trying to do. indeed, I'm not bent on using a document based app, I just tought it mit offer the mechanism or support to help rederriect my palettes' bindings to the proper object. Louis Demers eng. www.obzerv.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: Application Architecture or approach
On 11-Feb-09, at 20:20 , Kyle Sluder wrote: On Wed, Feb 11, 2009 at 8:07 PM, Louis Demers wrote: Now, I need to rewrite the app so that it can talk to multiple devices. I want to use bindings and write as little code as possible 8-) I'm considering an NSDocument based Applications and using panels/ palettes to display status and controls (100's) Each device will be represented by a different document. If the concept is to control lots of devices at a time, then I would hesitate to use the NSDocument architecture. Instead, I'd use a plugin architecture, where each device's code and interface is stored in a separate bundle inside your bundle's PlugIns folder. You can then enumerate these for choosing to display certain interfaces. I Had not thought about plugins because all the devices are identical in capabilities. The devices are complex cameras. I wanted to have each cameras have it document window to display the specific video feed, but a single palette to control the brightness/zoom of the frontmost window/camera. This is an over simplification because in reality, each camera has lots of controls and status. If each camera/ device has its own exclusive gui element, the screen will be cluttered beyond acceptable. I was modeling my solution around something like Photoshop or Illustrator where multiple documents use the same set of palettes. Louis Demers eng. www.obzerv.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
Application Architecture or approach
Hi, I currently have an application that talks to a single device over TCP/ IP. My user interface has lots of parameters and status variables. I use bindings all over the place. The device is represented a custom NSObject instantiated in my MainMenu.xib. The various GUI elements are using bindings to the instantiated custom Object from the ManMenu.xib. Now, I need to rewrite the app so that it can talk to multiple devices. I want to use bindings and write as little code as possible 8-) I'm considering an NSDocument based Applications and using panels/ palettes to display status and controls (100's) Each device will be represented by a different document. My question, is : when I select a different device, by making its window the frontmost, how do I get the panels/palettes to display the values related to the frontmost window/document and therefore, newly selected device. I would hate to have to setup 100 of observers ... or manually refresh 100's sliders/textfields/... Hopefully, what I'm trying to do was explained clearly enough so that the collective wisdom of the list can point me toward the optimal approach. thx in advance. Louis Demers eng. www.obzerv.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: Need help to make this method prettier
On 1-Nov-08, at 13:56 , Andre Masse wrote: The version I did get the job done but its not pretty :-) Any more good looking solutions? if (first < 10) { str0 = [NSString stringWithFormat:@"00%d", first]; } else if (first < 100){ str0 = [NSString stringWithFormat:@"0%d", first]; } else { str0 = [NSString stringWithFormat:@"%d", first]; } if (second < 10) { str1 = [NSString stringWithFormat:@"00%d", second]; } else if (second < 100){ str1 = [NSString stringWithFormat:@"0%d", second]; } else { str1 = [NSString stringWithFormat:@"%d", second]; } if (third < 10) { str2 = [NSString stringWithFormat:@"00%d", third]; } else if (third < 100){ str2 = [NSString stringWithFormat:@"0%d", third]; } else { str2 = [NSString stringWithFormat:@"%d", third]; } all the lines above can be replaced by str0 = [NSString stringWithFormat:@"%03d", first]; str1 = [NSString stringWithFormat:@"%03d", second]; str2 = [NSString stringWithFormat:@"%03d", third]; check the printf formatting codes for better understanding of the %03d the 3 specifies to allways use 3 columns and the 0 specifies to use 0 instead of spaces to fill in the 3 columns Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Targetting 10.4
On 14-Oct-08, at 21:20 , James Walker wrote: Louis Demers wrote: I developed (on 10.5.5 with the latest tools) a small app that runs well on 10.5 and cleaned it up for 10.4. I configured my project with Base SDK to 10.4 as below, cleaned all and built a release binary. When you said "I configured my project" I wondered whether you made the change at the project level. Have you checked whether your target has different settings than the project? I checked everywhere I can think of. When I click on my Target as well on my Project (in all configurations debug mad release), I have Base SDK10.4 Deployment Target 10.4 -- James W. Walker, Innoventive Software LLC <http://www.frameforge3d.com/> Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Targetting 10.4
Hi, I developed (on 10.5.5 with the latest tools) a small app that runs well on 10.5 and cleaned it up for 10.4. I configured my project with Base SDK to 10.4 as below, cleaned all and built a release binary. <> Yet when I run it on 10.4.11, I get = Tuesday, October 14, 2008 9:04:33 PM America/Montreal = dyld: Symbol not found: _NSDefaultRunLoopMode Referenced from: /Obzerv Dev Apps/ICCD Bench.app/Contents/MacOS/ ICCD Bench Expected in: /System/Library/Frameworks/CoreFoundation.framework/ Versions/A/CoreFoundation Oct 14 21:04:38 obzervs-powerbook-g4 crashdump[182]: ICCD Bench crashed Oct 14 21:04:38 obzervs-powerbook-g4 crashdump[182]: crash report written to: /Users/obzerv/Library/Logs/CrashReporter/ICCD Bench.crash.log Any clues how tofix. Never had problems before compiling for both OS versions and both architectures. Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How a Controller in MainMenu.xib can send actions to a document object
I'm working on a Document Based app My app has in its MainMenu.xib a controller that monitors a usb devices. I want this controller to send actions to the front most document. I tried many thing in the archives, including 1) in my controller in the MainMenu.xib [[NSApplication sharedApplication] sendAction:@selector(usbEvent:) to: (id)nil from:nil]; // From nil because this is just a c procedure but nothing happens. 2) in my controller in the MainMenu.xib [[NSDocumentController sharedDocumentController] currentDocument]; but that always return null That must be a really frequent occurrence with an easy cocoaish way to do it. any advise ? Thanks in adavance. Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
How to locate error that occurs while the nib is loading
Hi, I want to modify an application I developed for 10.4 with an IB plugin I created to do Hex number formatting. Since 10.5, that IB plugin no longer works so I tried to remove all formatters from my NIB file. However , now when I start the app, it crashes while loading the nib. The nib (a single one) has lots of views, windows and obviously NSTextFields. Any clues how to debug such a crash Any help would be greatly appreciated. 2008-09-10 23:10:26.244 ATV-2400 OSX[3245:10b] Starting... 2008-09-10 23:10:26.543 ATV-2400 OSX[3245:10b] *** -[NSTextField copyWithZone:]: unrecognized selector sent to instance 0x134b50 2008-09-10 23:10:26.547 ATV-2400 OSX[3245:10b] An uncaught exception was raised 2008-09-10 23:10:26.547 ATV-2400 OSX[3245:10b] *** -[NSTextField copyWithZone:]: unrecognized selector sent to instance 0x134b50 2008-09-10 23:10:26.548 ATV-2400 OSX[3245:10b] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** - [NSTextField copyWithZone:]: unrecognized selector sent to instance 0x134b50' 2008-09-10 23:10:26.551 ATV-2400 OSX[3245:10b] Stack: ( 2502508875, 2460483835, 2502538058, 2502531404, 2502531602, 2518687460, 2518770442, 2518770179, 2520194219, 2521592482, 2520924807, 2520923526, 2520922448, 2520928305, 2520702583, 2520670440, 2520917790, 2518653604, 2518613522, 2518611828, 2518610871, 2518610677, 2518609828, 11932, 10226, 10009 ) #0 0x95293ff4 in ___TERMINATING_DUE_TO_UNCAUGHT_EXCEPTION___ #1 0x92a800fb in objc_exception_throw #2 0x9529b34a in -[NSObject doesNotRecognizeSelector:] #3 0x9529994c in ___forwarding___ #4 0x95299a12 in __forwarding_prep_0___ #5 0x96201ee4 in -[NSCell _setContents:] #6 0x9621630a in -[NSCell setObjectValue:] #7 0x96216203 in -[NSActionCell setObjectValue:] #8 0x96371cab in -[NSControl setObjectValue:] #9 0x964c72a2 in -[_NSPlaceholderTextFieldPlugin showValue:inObject:] #10 0x96424287 in -[NSValueBinder showValue:inObject:] #11 0x96423d86 in -[NSValueBinder _adjustObject:mode:observedController:observedKeyPath:context:editableState:adjustState :] #12 0x96423950 in -[NSValueBinder _observeValueForKeyPath:ofObject:context:] #13 0x96425031 in -[NSTextValueBinder _observeValueForKeyPath:ofObject:context:] #14 0x963ede77 in -[NSBinder _performConnectionEstablishedRefresh] #15 0x963e60e8 in -[NSObject(NSKeyValueBindingCreation) bind:toObject:withKeyPath:options:] #16 0x9642271e in -[NSNibBindingConnector establishConnection] #17 0x961f9aa4 in -[NSIBObjectData nibInstantiateWithOwner:topLevelObjects:] #18 0x961efe12 in loadNib #19 0x961ef774 in +[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:] #20 0x961ef3b7 in +[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] #21 0x961ef2f5 in +[NSBundle(NSNibLoading) loadNibNamed:owner:] #22 0x961eefa4 in NSApplicationMain #23 0x2e9c in main at main.m:25 Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSArraycontroller, Bindings nad NSTableview
Well, as a reply to my own message . I seem to have gotten it to work very nicely ! I recreated a fresh project and let my NSArrayController instance create and manage the storage for me. In addition to possible misconfiguration, It seems I was caught by the fact that NSArrayController does not add the object immediately upon creation, since I was checking the count immediately after sending the "add" message. From the doc - add: Creates and adds a new object to the receiver’s content and arranged objects. ... Special Considerations Beginning with Mac OS X v10.4 the result of this method is deferred until the next iteration of the runloop so that the error presentation mechanism can provide feedback as a sheet. - Cheers. On 17-Jul-08, at 11:52 , Louis Demers wrote: Hi, I've programmed for a while in Cocoa, with bindings... But for the first time I need a NSTableView and I would like to use NSArrayController with bindings to do as much work as possible and with the minimum amount of code. But I've had nothing but failure, even after inspecting many examples and tutorials on google. Initially I believed that NSArrayController would store the array itself but I now resorted to having my own NSMutableArray (with getter and setters) in my model. A button bound to the "add" or the "insert" method of the NSArrayController just does nothing. To debug things, I created a subclass of NSArrayController to intercept the "add" method and confirm that it does get called but it does not create and insert any object. The NSControllerArray instance is configured to generate object of class toto (with editable chedked and preapres content uncheked). and it's binding is pointing to where my NSMutableArray is located Controller Content bind to myController instance controller Key is empty Model Key Path is set to the accessor of my array In my subclass of the NSArrayController array, if I create a toto object and use addObject, it works ! Even the NSTableView gets updated ! - (void)add:(id)sender; { [super add:sender]; // Does not work NSLog(@"count %d" , [[super content] count]); [super addObject:[[toto alloc] init]]; // Works NSLog(@"count %d" , [[super content] count]); } Any clues why the "add" method does not work ? If anybody as such a trivial sample/tutorial, I'd be very grateful, (after a third nights of banging my head against this problem) Thanks. PS: Xcode 3.1 Component versions Xcode IDE: 1099.0 Xcode Core: 1100.0 ToolSupport: 1086.0 IB Version 3.1 (670) Louis Demers eng. www.obzerv.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/louisdemers%40mac.com This email sent to [EMAIL PROTECTED] Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSArraycontroller, Bindings nad NSTableview
On 17-Jul-08, at 12:10 , Sean McBride wrote: On 7/17/08 11:52 AM, Louis Demers said: I've programmed for a while in Cocoa, with bindings... But for the first time I need a NSTableView and I would like to use NSArrayController with bindings to do as much work as possible and with the minimum amount of code. But I've had nothing but failure, even after inspecting many examples and tutorials on google. Initially I believed that NSArrayController would store the array itself but I now resorted to having my own NSMutableArray (with getter and setters) in my model. A button bound to the "add" or the "insert" method of the NSArrayController just does nothing. add: and insert: are IBAction methods of NSArrayController. Are you just confusing terminology here? probably. I control-dragged from my button to my instance of the nsarraycontroller. You should control-drag in IB to connect your button's action to the arraycontroller's add: method. No bindings there. my reference to the bindings was in relation to the nsarraycontroller configuration. -- Sean McBride, B. Eng [EMAIL PROTECTED] Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: NSArraycontroller, Bindings nad NSTableview
On 17-Jul-08, at 12:31 , mmalc crawford wrote: On Jul 17, 2008, at 8:52 AM, Louis Demers wrote: A button bound to the "add" or the "insert" method of the NSArrayController just does nothing. Do you mean "bound" or "connected using target action"? control dragged from my button to the nsarraycontroller instance. class toto Please follow Cocoa naming conventions -- class names begin with capital letters. totally agreee, I usually do but i've done so much throw-away code to isolate this issue until the little hours of the morning that a few slipped in because of frustration. (which is always a good sign to go to bed and attack the problem with a fresh mind). - (void)add:(id)sender; { [super add:sender]; // Does not work NSLog(@"count %d" , [[super content] count]); [super addObject:[[toto alloc] init]]; // Works NSLog(@"count %d" , [[super content] count]); } Any clues why the "add" method does not work ? Have you spelled the Class Name correctly in Interface Builder? yes, toto. Are there any error messages in the log? e.g. "Cannot find object class with name Toto" I added " -NSBindingDebugLogLevel 1" to the launch arguments of the executable and I get no error message in the console. mmalc Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
NSArraycontroller, Bindings nad NSTableview
Hi, I've programmed for a while in Cocoa, with bindings... But for the first time I need a NSTableView and I would like to use NSArrayController with bindings to do as much work as possible and with the minimum amount of code. But I've had nothing but failure, even after inspecting many examples and tutorials on google. Initially I believed that NSArrayController would store the array itself but I now resorted to having my own NSMutableArray (with getter and setters) in my model. A button bound to the "add" or the "insert" method of the NSArrayController just does nothing. To debug things, I created a subclass of NSArrayController to intercept the "add" method and confirm that it does get called but it does not create and insert any object. The NSControllerArray instance is configured to generate object of class toto (with editable chedked and preapres content uncheked). and it's binding is pointing to where my NSMutableArray is located Controller Content bind to myController instance controller Key is empty Model Key Path is set to the accessor of my array In my subclass of the NSArrayController array, if I create a toto object and use addObject, it works ! Even the NSTableView gets updated ! - (void)add:(id)sender; { [super add:sender]; // Does not work NSLog(@"count %d" , [[super content] count]); [super addObject:[[toto alloc] init]]; // Works NSLog(@"count %d" , [[super content] count]); } Any clues why the "add" method does not work ? If anybody as such a trivial sample/tutorial, I'd be very grateful, (after a third nights of banging my head against this problem) Thanks. PS: Xcode 3.1 Component versions Xcode IDE: 1099.0 Xcode Core: 1100.0 ToolSupport: 1086.0 IB Version 3.1 (670) Louis Demers eng. www.obzerv.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]