NSDateFormatter behavior
I have a date formatter applied to a formcell: 'MM/dd/’. Upon entering the year, the field ‘completes' so that when I enter 01/01/2 it converts it to 01/01/0002, inserting the zeros. How do I stop the 'completion' behavior? I have looked at:[aTextView setAutomaticQuoteSubstitutionEnabled:NO]; and [aTextView setAutomaticTextReplacementEnabled:NO]; but can’t figure out how to get the textfield textview from the NSFormCell. This of course assumes that this is the correct direction to take. Any ideas? Best regards, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
AppleEvents: Send port for process has no send right, port=( port:37207/0x9157 rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526)
Anyone have an idea of what is causing this message in the log file? AppleEvents: Send port for process has no send right, port=( port:37207/0x9157 rcv:1,send:0,d:0 limit:5) (findOrCreate()/AEMachUtils.cp #526) I am using scripting bridge for several Apple program interfaces. Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Bindings and Editing in a row
Actually, I did put in the NSLOG’s in the shouldEditTableColumn and it never “fired” no matter what I did, hence my question about the need and where documented. I did find in the docs the statement to the effect that setObjectValue, as a datasource method, can run without the other datasource methods and with bindings. The other I cannot find in the docs. You would think that these intertwined relationships would be set out in the docs in a tidy fashion. On Feb 17, 2015, at 3:51 PM, Quincey Morris wrote: > On Feb 17, 2015, at 12:35 , John MacMullin wrote: >> >> So it appears that I don’t need shouldEditTableColumn because of the >> bindings. Where is this in the docs? (rather than random cocoa sources). > > I’m not sure it’s got anything to do with bindings. Configuring table views > is just a bit messy, probably because they’ve evolved so much over the years. > > If the delegate method is absent, then I’d expect the “Editable” checkbox on > the table column in IB to control the behavior. It’s certainly possible that > some bindings options may further restrict editability, and if you have a > NSArrayController between the table and its data model, it may also have > settings that affect editability. > > The delegate method is likely intended to cover cases where the editability > is determined per-row, or by some other factor that isn’t easy to express in > IB, array controllers or bindings. > >> If I take out the following: >> >> - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row >> { >>if (tableView) { >>if (row >=0) { >>return YES; >>} >>} >>return YES; >> } >> >> I can’t select any row. So it would appear that some of the table view >> methods operate independently of the bindings. Where is this documented? > > It shouldn’t be necessary to have this method just to enable selection, and > it’s got nothing to do (intrinsically) with bindings. You’ve got some other > problem that’s interfering. > > For example, if you have the table’s “selected row indexes” binding bound to > a property that doesn’t actually save the selection persistently, it’ll seem > like selection doesn’t work (though in such a hypothetical scenario, it is > working, but just getting cleared later, before you notice). > > Tracking down misbehaviors in table views can be painful, because there are > lots of places to check, and no clear indication of what to look for. > Generally, you just need to persevere, perhaps with some judicious NSLogging > to check your assumptions about what’s happening and when. Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Bindings and Editing in a row
Ok with programmatic bindings, I have: 1. on the interface. 2. In set up: NSButtonCell *recCell11 = [NSButtonCell new]; [recCell11 setButtonType:NSSwitchButton]; [recCell11 setTitle:NULL_STRING]; [recCell11 setImagePosition:NSImageOnly]; [recCell11 setEditable:YES]; [[transTableView tableColumnWithIdentifier:@"11"]setDataCell:recCell11]; [[transTableView tableColumnWithIdentifier:@"11"]setEditable:YES]; Plus my bindings in all columns. 3. Also, in set up: [transTableView setDelegate:self]; [transTableView setDataSource:self]; 4. Later in the code: - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row { if (tableView) { if (row >=0) { return YES; } } return YES; } 5. Commented Out in the code: /* - (BOOL)tableView:(NSTableView *)tableView shouldEditTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row { NSLog(@"shouldEditTableColumn"); if ([tableView tag] == 10 ) { if (([tableColumn identifier] == @"11") && (row >= 0)) { return YES; } else { return NO; } } return NO; } */ and 6. My: - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row which works just fine. So it appears that I don’t need shouldEditTableColumn because of the bindings. Where is this in the docs? (rather than random cocoa sources). If I take out the following: - (BOOL)tableView:(NSTableView *)tableView shouldSelectRow:(NSInteger)row { if (tableView) { if (row >=0) { return YES; } } return YES; } I can’t select any row. So it would appear that some of the table view methods operate independently of the bindings. Where is this documented? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Address Book question
I occasionally am getting the following message when I use the address book api to add a record to my sharedAddressBook, which then causes the add to fail: is being ignored because main executable (/System/Library/Frameworks/AddressBook.framework/Resources/AddressBookSync.app/Contents/MacOS/AddressBookSync) is code signed with entitlements What's causing this and how do I resolve the issue? Best regards, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Skype API
As it appears that the entire Skype API will disappear in December, does anyone have any ideas on how to detect an incoming Skype call? John Developer of T_Accounting ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CA_DEBUG_TRANSACTIONS=1
More or less. It appears that since the documentation in NSBundle does not state that its thread safe, it isn't. >From Core Animation tho, it would appear that executing a CATransaction flush >may have resolved my original message, but perhaps not the problem. If I read this correctly, this updates the layers, which wouldn't otherwise be updated on a background thread. It would seem that if I call a non-thread safe function in a background thread, i.e., from an NSOperationQueue, that a compile or other error should result. On Sep 5, 2012, at 5:48 PM, Kyle Sluder wrote: > On Sep 5, 2012, at 5:13 PM, John MacMullin wrote: > >> Ok, that was it. I loaded [NSBundle loadNibNamed:XXX] in a background >> thread. >> >> Fixing that problem resolved the message. > > Did the process of fixing it also illuminate other areas you seem to be hazy > on, such as how Core Animation works, why loading nibs on background threads > is always incorrect, and how the debugger fits into the Xcode > edit/compile/debug cycle? > > --Kyle Sluder Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CA_DEBUG_TRANSACTIONS=1
Ok, that was it. I loaded [NSBundle loadNibNamed:XXX] in a background thread. Fixing that problem resolved the message. Thanks. On Sep 5, 2012, at 4:13 PM, Kyle Sluder wrote: > On Sep 5, 2012, at 4:12 PM, John MacMullin wrote: > >> Ok, I went to the scheme in Xcode and added the variable. Running again >> produced the following backtrace. >> >> 0 QuartzCore 0x7fff8a736b95 >> _ZN2CA11Transaction4pushEv + 219 >> 1 QuartzCore 0x7fff8a73676d >> _ZN2CA11Transaction15ensure_implicitEv + 273 >> 2 QuartzCore 0x7fff8a73660a >> _ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40 >> 3 QuartzCore 0x7fff8a73659e +[CATransaction >> setDisableActions:] + 38 >> 4 AppKit 0x7fff8e3ef8ae -[NSScrollerImp >> _updateLayerGeometry] + 67 >> 5 AppKit 0x7fff8e3eee8d >> -[NSScroller(NSInternal2) _replaceScrollerImp] + 368 >> 6 AppKit 0x7fff8e486ff8 -[NSScroller >> initWithCoder:] + 305 >> 7 Foundation 0x7fff8b763c39 >> _decodeObjectBinary + 2741 >> 8 Foundation 0x7fff8b764a16 >> -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189 >> 9 Foundation 0x7fff8b764f88 >> -[NSArray(NSArray) initWithCoder:] + 538 >> 10 Foundation 0x7fff8b763c39 >> _decodeObjectBinary + 2741 >> 11 Foundation 0x7fff8b762fe4 _decodeObject + >> 226 >> 12 AppKit 0x7fff8e309061 -[NSView >> initWithCoder:] + 976 >> 13 AppKit 0x7fff8e484597 -[NSScrollView >> initWithCoder:] + 335 >> 14 Foundation 0x7fff8b763c39 >> _decodeObjectBinary + 2741 >> 15 Foundation 0x7fff8b762fe4 _decodeObject + >> 226 >> >> Is is possible to attach the debugger to this so that I can see the problem >> in my code? > > You should already be running in the debugger. > > Are you perhaps decoding a nib on a background thread? > >> >> Or can/should this be resolved with Atos? >> >> And back to the beginning, what is an uncommitted CATransaction? > > Re-read the Core Animation Programming Guide. Core Animation uses a > per-thread transaction model. > > --Kyle Sluder Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: CA_DEBUG_TRANSACTIONS=1
Ok, I went to the scheme in Xcode and added the variable. Running again produced the following backtrace. 0 QuartzCore 0x7fff8a736b95 _ZN2CA11Transaction4pushEv + 219 1 QuartzCore 0x7fff8a73676d _ZN2CA11Transaction15ensure_implicitEv + 273 2 QuartzCore 0x7fff8a73660a _ZN2CA11Transaction9set_valueEj12_CAValueTypePKv + 40 3 QuartzCore 0x7fff8a73659e +[CATransaction setDisableActions:] + 38 4 AppKit 0x7fff8e3ef8ae -[NSScrollerImp _updateLayerGeometry] + 67 5 AppKit 0x7fff8e3eee8d -[NSScroller(NSInternal2) _replaceScrollerImp] + 368 6 AppKit 0x7fff8e486ff8 -[NSScroller initWithCoder:] + 305 7 Foundation 0x7fff8b763c39 _decodeObjectBinary + 2741 8 Foundation 0x7fff8b764a16 -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] + 1189 9 Foundation 0x7fff8b764f88 -[NSArray(NSArray) initWithCoder:] + 538 10 Foundation 0x7fff8b763c39 _decodeObjectBinary + 2741 11 Foundation 0x7fff8b762fe4 _decodeObject + 226 12 AppKit 0x7fff8e309061 -[NSView initWithCoder:] + 976 13 AppKit 0x7fff8e484597 -[NSScrollView initWithCoder:] + 335 14 Foundation 0x7fff8b763c39 _decodeObjectBinary + 2741 15 Foundation 0x7fff8b762fe4 _decodeObject + 226 Is is possible to attach the debugger to this so that I can see the problem in my code? Or can/should this be resolved with Atos? And back to the beginning, what is an uncommitted CATransaction? On Sep 5, 2012, at 3:41 PM, Kyle Sluder wrote: > On Wed, Sep 5, 2012, at 03:35 PM, John MacMullin wrote: >> I am getting the following message: CoreAnimation: warning, deleted >> thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in >> environment to log backtraces. >> >> What in general would be causing this? > > In general, it would be caused by deleting a thread with an uncommitted > CATransaction. ;-) > >> >> How do I set CA_DEBUG_TRANSACTIONS=1? > > It's an environment variable. Set it in the Environment Variables > section of the Arguments tab in the settings for the Run action of your > scheme. > > --Kyle Sluder Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CA_DEBUG_TRANSACTIONS=1
I am getting the following message: CoreAnimation: warning, deleted thread with uncommitted CATransaction; set CA_DEBUG_TRANSACTIONS=1 in environment to log backtraces. What in general would be causing this? How do I set CA_DEBUG_TRANSACTIONS=1? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
CGXDisableUpdate?
It appears that my program hangs after the following console log events: 8/17/12 3:15:11.555 PM WindowServer[104]: CGXDisableUpdate: UI updates were forcibly disabled by application "X" for over 1.00 seconds. Server has re-enabled them. 8/17/12 3:15:25.556 PM WindowServer[104]: disable_update_likely_unbalanced: UI updates still disabled by application "X" after 15.00 seconds (server forcibly re-enabled them after 1.00 seconds). Likely an unbalanced disableUpdate call. I am not directly calling CGXDisableUpdate anywhere in my code. Any ideas what causes this? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Hang detection
My app hangs due to what appears to be two competing operations. Appears because other possible reasons may exist. How do I snapshot, debug or otherwise detect and obtain a stack trace of the code causing the hang? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Problem with Converting NSApplescript to Scripting Bridge
The following is the old NSApplescript, which works to create array of mailbox paths. NSAppleScript *theScript = [[[NSAppleScript alloc]initWithSource:@"tell application \"Mail\"\n set localMailboxes to every mailbox\n end tell\n"]autorelease]; NSDictionary *theError; NSAppleEventDescriptor *theScriptDescriptor = [theScript executeAndReturnError: &theError]; if (theScriptDescriptor == nil) { } else { NSString *descriptorString; int i, u = [theScriptDescriptor numberOfItems]; for (i = 1; i<=u; i++) { descriptorString = [[[theScriptDescriptor descriptorAtIndex:i]paramDescriptorForKeyword:(AEKeyword)'seld']stringValue]; if (descriptorString == NULL) { } else { [mailboxes_File addObject:descriptorString]; } } } I am trying to substitute Scripting Bridge code with some difficulty. Iterating through containers, see the following, is slow by comparison to the foregoing NSApplescript. The container hierarchy involved goes down 6 levels. -(MailMailbox *)returnTheContainer:(MailMailbox *)incoming_Container { MailMailbox *returnedContainer = [incoming_Container container]; return returnedContainer; } SBElementArray *allMailboxes = [mailApp mailboxes]; int countOfAllMailboxes = [allMailboxes count]; int i; for (i = 0; i < countOfAllMailboxes; i++) { NSString *mailboxName = [[allMailboxes objectAtIndex:i]name]; MailMailbox *returnedContainer = [[allMailboxes objectAtIndex:i]container]; BOOL allContainersFound = NO; NSMutableString *returnedPathName = [NSMutableString string]; [returnedPathName appendString:mailboxName]; if ([returnedContainer name] == NULL) { allContainersFound = YES; } else { [returnedPathName insertString:@"/" atIndex:0]; [returnedPathName insertString:[returnedContainer name] atIndex:0]; } while (allContainersFound == NO) { returnedContainer = [self returnTheContainer:(MailMailbox *)returnedContainer]; if ([returnedContainer name] == NULL) { allContainersFound = YES; } else { NSString *returnedName = [returnedContainer name]; [returnedPathName insertString:@"/" atIndex:0]; [returnedPathName insertString:returnedName atIndex:0]; } } [mailboxes_File addObject:returnedPathName]; } I have looked at the SBOject class and tried the the following with 'seld', which returns null (I could be using it wrong also): - (SBObject *) propertyWithCode:(AEKeyword)code; Anyone have any experience in returning the full path directly from the MailMailbox or a way of speeding this up? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Fwd: SBSendMail
Ok, so I am answering my own questions. First, I added the following to the MailOutgoingMessage interface in the Mail.h file: "@property (copy) MailRichText *content; // Contents of an email message". This I copied from the MailMessage interface, but removed the read only. Now both of the following work and I have no warning messages: [[[emailMessage content] paragraphs] addObject:theAttachment]; [[emailMessage.content attachments] addObject: theAttachment]; It would seem that the generation of the Mail.h file in implementing Scripting Bridge may have an issue? Begin forwarded message: > From: John MacMullin > Subject: SBSendMail > Date: June 19, 2012 9:02:17 PM MST > To: cocoa-dev@lists.apple.com > > SBSendMail, from Apple's Scripting Bridge example, gives an error on: > > [[emailMessage.content attachments] addObject: theAttachment]; > > The header file, Mail.h, does not have "content" for a new outgoing message, > which doesn't make any sense, since the example sets the property "content" > at the outset. > > I used instead: [[[emailMessage content] attachments] addObject: > theAttachment]; > > But get a warning error that says "MailOutgoingMessage may not respond to > content". > > However, it does respond and the attachment is attached to the email. > > It would seem that I shouldn't get an error message? > > BTW I used: [NSURL fileURLWithPath:attachmentFilePath isDirectory:(BOOL)NO] > instead of the example code. > > Best regards, > > John MacMullin Best regards, John MacMullin Attorney at Law 9634 North 7th Avenue Phoenix, AZ 85021 1-602-904-5426 1-800-924-8548 Email:john.macmul...@cox.net Skype: john_macmullin www.macmullin.info CONFIDENTIALITY - The information contained in this email is confidential information, may be legally privileged, and is intended only for the use of the individuals or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone or by reply letter and delete or destroy the message in its entirety. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
SBSendMail
SBSendMail, from Apple's Scripting Bridge example, gives an error on: [[emailMessage.content attachments] addObject: theAttachment]; The header file, Mail.h, does not have "content" for a new outgoing message, which doesn't make any sense, since the example sets the property "content" at the outset. I used instead: [[[emailMessage content] attachments] addObject: theAttachment]; But get a warning error that says "MailOutgoingMessage may not respond to content". However, it does respond and the attachment is attached to the email. It would seem that I shouldn't get an error message? BTW I used: [NSURL fileURLWithPath:attachmentFilePath isDirectory:(BOOL)NO] instead of the example code. Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
kCGErrorIllegalArgument: _CGSFindSharedWindow: WID -1
I am getting the above message in the Console referencing both the dock and my program. I am running Lion, Xcode 4.3. The same program under Snow Leopard is error free. Any ideas? Best regards, John MacMullin Attorney at Law 9634 North 7th Avenue Phoenix, AZ 85021 1-602-904-5426 1-800-924-8548 Email:john.macmul...@cox.net Skype: john_macmullin www.macmullin.info CONFIDENTIALITY - The information contained in this email is confidential information, may be legally privileged, and is intended only for the use of the individuals or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone or by reply letter and delete or destroy the message in its entirety. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Tabs Not Blue Under Lion
I have an application using tabs, which appear 'aqua' blue under Snow Leopard, but are grey under Lion. Have tried setting the tint, but it doesn't cure the problem. Any ideas? Best regards, John MacMullin Developer T_Accounting___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
1. Creating a TCP server? (Rick Mann)
really what I want, I think. >>>> >>>> And to verify: is NSNetServices what I need to publish the Bonjour name? >>>> >>>> Thanks. >>>> >>>> -- >>>> Rick >> ___ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> http://lists.apple.com/mailman/options/cocoa-dev/tciuro%40mac.com >> >> This email sent to tci...@mac.com > > > > -- > > Message: 12 > Date: Tue, 26 Jul 2011 17:37:54 -0400 > From: Eric Gorr > Subject: Re: Creating a TCP server? > To: Rick Mann > Cc: Cocoa Developer > Message-ID: <37113290-6495-443e-bfe5-7885f6b9b...@ericgorr.net> > Content-Type: text/plain; charset=us-ascii > > What, I think distinguishes the SSD example from others is that it uses the > two most modern methods to get the job done - launchd and GCD. > > > > On Jul 26, 2011, at 4:31 PM, Rick Mann wrote: > >> Thanks, I saw those messages going by. I'll take a look. >> >> -- >> Rick >> >> On Jul 26, 2011, at 12:23 , Eric Gorr wrote: >> >>> I would suggest checking out the SSD sample project from WWDC 2010. There >>> are a couple of problems in the source which are covered in this thread: >>> >>> http://lists.apple.com/archives/Macnetworkprog/2011/Jul/msg5.html >>> >>> But the basics of what you want to do I believe are there... >>> >>> >>> On Jul 26, 2011, at 3:17 PM, Rick Mann wrote: >>> >>>> Hi. I need to build a little serial port-to-TCP server (so that clients >>>> can connect to my Mac to interact with a serial port). Among other things, >>>> I want to advertise this using Bonjour. >>>> >>>> How do I create a TCP server in Cocoa? It seems like CF networking is my >>>> best bet, but I thought TCP should be easy via Cocoa. I briefly looked at >>>> NSSocket and NSStream, but they're not really what I want, I think. >>>> >>>> And to verify: is NSNetServices what I need to publish the Bonjour name? >>>> >>>> Thanks. >>>> >>>> -- >>>> Rick >>>> >>>> ___ >>>> >>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>>> >>>> Please do not post admin requests or moderator comments to the list. >>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>> >>>> Help/Unsubscribe/Update your Subscription: >>>> http://lists.apple.com/mailman/options/cocoa-dev/mailist%40ericgorr.net >>>> >>>> This email sent to mail...@ericgorr.net >> >>> > > > -- > > Message: 13 > Date: Tue, 26 Jul 2011 17:38:32 -0400 > From: Gregory Weston > Subject: Re: Dialog Command Keys > To: cocoa-dev@lists.apple.com > Message-ID: <719b3fd4-45f9-4353-9f27-5ff2759c7...@mac.com> > Content-Type: text/plain; CHARSET=US-ASCII > > Bill Appleton wrote: > >> Based on my app, the dialog boxes have to be created dynamically, so i can't >> use Interface Builder, so they are assembled out of cocoa controls as >> needed. >> >> My dialogs beep when i control-x to cut some selected text >> >> What is the simple way for my dialog window to pass these command keys >> events down to the text views? >> >> Thanks in advance > > Not to be impertinent but through this thread I'm wondering if the OP is > putting himself through this pain unnecessarily. There *are* certainly > legitimate reasons to be building parts of your UI at runtime but in my > experience it's vanishingly rare, especially for the entire application. Is > this one of those scenarios where the most beneficial answer to "How do I do > X" is "Don't?" > > So to Bill: What's the situation for your app that you've decided requires > you to build everything at runtime? *Why* can't you use IB? > > Greg > > > -- > > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins (at) lists.apple.com > > http://lists.apple.com/mailman/listinfo/cocoa-dev > > > End of Cocoa-dev Digest, Vol 8, Issue 570 > * > Best regards, John MacMullin Attorney at Law Developer T_Accounting Skype: john_macmullin www.macmullin.info ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Leak
Environment: 'reference' rather than 'garbage collection'. Instruments tells me that I have a Foundation leak: Leaked Object,# Address SizeResponsible Library Responsible Frame Malloc 176 Bytes, 0x86e290176 Foundation -[NSNotificationCenter removeObserver:name:object:] 0 libSystem.B.dylib calloc 1 CoreFoundation __addHandler2 2 Foundation +[__NSObserver isAnObserver:] 3 Foundation -[NSNotificationCenter removeObserver:name:object:] 4 Foundation -[NSNotificationCenter removeObserver:] 5 Foundation -[NSRunLoop(NSRunLoop) dealloc] 6 CoreFoundation CFRelease 7 CoreFoundation __CFFinalizeRunLoop 8 libSystem.B.dylib _pthread_tsd_cleanup 9 libSystem.B.dylib _pthread_exit 10 libSystem.B.dylib start_wqthread I appears to be related to the use of NSNotification, which I use frequently. As you can see no source code is referenced. How do I get to the offending code? Best regards, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Aquatic Prime
See the updated Aquatic Prime at: https://github.com/bdrister/AquaticPrime Best regards, John MacMullin Email:john.macmul...@cox.net Skype: john_macmullin www.macmullin.info ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: 1. NSStream Questions (Jon Loeliger)
Create a dictionary with the stream as the key, access and maintain the dictionary and stream stuff with the key, (NSValue key), lock or synchronize access to the dictionary. Applies to every pass through handleEvent (and everywhere else), ie., any broadcast code. That's what I do and it works just fine. On Jul 16, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote: > 1. NSStream Questions (Jon Loeliger) > > -- > > Message: 1 > Date: Fri, 16 Jul 2010 10:15:49 -0500 > From: Jon Loeliger > Subject: NSStream Questions > To: cocoa-dev@lists.apple.com > Message-ID: > > Folks, > > I'm a bit new to Cocoa/iPhone programming, so I apologize > if this is Ye Olde Question Again. Googling hasn't quite > anwered my quesion yet... > > I'm writing a network server that needs to accept many > simultaneous client connections and keep track of them. > I've written the base server parts, roughly in the style > of the Apple Examples (SimpleNetworkStreamsExample). These > examples, however, only allow one connected client. I need > to manage several full duplex NSStream in/out pairs. > > I can arrange to have a Connected Clients table that contains > both the inStream and outStreams created for the accepted fd > (CFSocketNativeHandle) using some class that glues the inStream, > outStream and clientNumber together in a table. > > My problem originates at the point when the stream event > handling delegate is called: > >- (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode > > At this point I have the active stream, aStream, in hand, but > I don't know which client it belongs to. Ultimately, this means > I can't reply to the client for lack of deriving its matching > outStream or clientNumber in my table. > > Is there a (void *) data that I can associate with a NSStream > at the time I create it and later retrieve it at stream:handleEvent: > time? Or do I have to search my client table for a matching > stream handle on every read/write event? > > What am I missing? > > Thanks, > jdl > > Best regards, John MacMullin Attorney at Law 1-602-943-5240 1-602-904-5426 1-800-924-8548 Email:john.macmul...@cox.net Skype: john_macmullin www.macmullin.info CONFIDENTIALITY - The information contained in this email is confidential information, may be legally privileged, and is intended only for the use of the individuals or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any disclosure, dissemination, distribution, or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by telephone or by reply letter and delete or destroy the message in its entirety. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
NSArchiverArchiveInconsistency
I have been using NSStreams and the delegate with TCPServer quite successfully in the past to transmit data between a client and a server. In other words, the code was working on 10.5 before. Then I upgraded to 10.6 SDK with a deployment of 10.5. Everything runs fine between the 10.6 server and 10.6 client. However, under 10.5 running on an iBook, the client is now failing with an NSArchiverArchiveInconsistency error when I unarchive the data read from the server. When counting bytes transferred, the 10.5 client is reading almost twice as much data as the server writes. Has anyone seen anything like this where client-server code once working on 10.5 fails on 10.5 with an NSArchiverArchiveInconsistency error or appears to "double-read" the buffer after upgrading to 10.6? I realize that this is a pretty general question and without code is a fishing expedition. But even pan fry would help. So, if you've seen something like this, please give me an idea of what you did to correct it. Any ideas would be welcome. Really frustrated at the moment, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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
Windows-Friendly Attachments
I have the following NSAppleScript code that works as part of a loop that goes through an array to send emails with an attachment: [emailStriptString setString:[NSString stringWithFormat:@"tell application \"Mail\"\n set newMessage to make new outgoing message with properties {subject:\"[EMAIL PROTECTED]", content:\"[EMAIL PROTECTED]" & return}\n tell newMessage\n set visible to true\n make new attachment with properties {file name:\"[EMAIL PROTECTED]"} at after last paragraph\n make new to recipient at end of to recipients with properties {name:\"\", address:\"[EMAIL PROTECTED]"}\n end tell\n end tell\n", subject_String, body_String, [[email_Array objectAtIndex:i]objectAtIndex:email_PathTo_Attachment], recipient_String]]; First question: After Mail starts and creates the emails, I cannot determine from the email itself if the attachment is "windows- friendly". That option is checked in the mail program under the Edit- Attachments menu. However, can one tell from looking at the email that it is "windows-friendly"? Second, is there an attachment property that I can add to the above code to ensure that the attachment is "windows-friendly"? Thanks, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Button and Matrix problems
My application started in 10.2.8 and has progressed to the current state of affairs with 10.5.5 and XCode 3.1.1. I am now experiencing two problems with the current stuff. First, when I send setEnabled:No to a new popup that I just added, the popup does not dim. All of the old stuff does. Second, I added an additional row (radio button) to an existing NSMatrix of radio buttons. Now when sending the setTitle to the buttons sometimes it works and sometimes it doesn't leaving me with plain untitled radio buttons. I have tried adding a 'display', but that doesn't cure the problem either. Both of these are very odd. Any help would be greatly appreciated. John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: Windows
I am using the standard, default Window menu. John On Sep 12, 2008, at 4:04 PM, Peter Ammon wrote: On Sep 12, 2008, at 2:26 PM, John MacMullin wrote: Does the standard Windows menu manage and show all application windows? If so, under what conditions do windows not get listed in the pull down? On the other hand, it is up to the programmer to manage the list and enable and disable windows as they become key and front? Thanks, How are you creating the Windows menu? You need to either use the default one that comes with the MainMenu.nib (creating a different menu and calling it Windows won't cut it). If you are making one programmatically, use -[NSApp setWindowsMenu:] to bless it as the Windows menu. -Peter ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [EMAIL PROTECTED]
Re: Windows
Ok, thanks. However, as it stands nothing is being added to the Window menu. The following code also fails. IBOutlet NSWindow *testWindowOutlet; This code is in the awakeFromNib [testWindowOutlet setTitle:[[NSBundle mainBundle] localizedStringForKey:@"Test Stuff" value:nil table:nil]]; [NSApp addWindowsItem:testWindowOutlet title:[testWindowOutlet title] filename:(BOOL)NO]; [testWindowOutlet setExcludedFromWindowsMenu:(BOOL)NO]; After the nib is loaded, I do a makekeyandorderfront on the window, which appears with the 'Test Stuff' title, but the window does not appear in the Window menu. As to the NIB, the visible at launch is not checked. Any further suggestions would be greatly appreciated. John On Sep 12, 2008, at 3:13 PM, Charles Steinman wrote: --- On Fri, 9/12/08, John MacMullin <[EMAIL PROTECTED]> wrote: Does the standard Windows menu manage and show all application windows? If so, under what conditions do windows not get listed in the pull down? From the horse's mouth: http://developer.apple.com/documentation/Cocoa/Conceptual/WinPanel/Tasks/UsingWindowsMenu.html#/ /apple_ref/doc/uid/2231-BCIBJBDA Cheers, Chuck ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Windows
Does the standard Windows menu manage and show all application windows? If so, under what conditions do windows not get listed in the pull down? On the other hand, it is up to the programmer to manage the list and enable and disable windows as they become key and front? Thanks, John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]
Flicker from NSResponder Chain?
I read in the archives of a method to implement Tiger's approach to tabbing through a table in Leopard. While my approach works as to the tabbing, it is slightly different than the approach discussed in the archives. It also results in a problem that is discussed below. I have two tables in the tabview. One is a transaction table, which I tab through. The other is a static table from which I develop transactions for the transaction table. The code for tabbing is in three parts: I have an observer for the NSTextDidEndEditingNotification with the selector being "localTextEditingDidEnd", which follows. This is different from the subclass approach but works nonetheless. There is a second observer for the select_EditedTableColumAndRow notification. -(void)localTextEditingDidEnd:(NSNotification *)notification { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; NSDictionary *userInfo = [notification userInfo]; int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue]; if ([transactionTableView selectedRow] >= 0) { int selectedRowOfTable = [transactionTableView selectedRow]; if ((lastColumnEdited == (int)columnOne) || (lastColumnEdited == (int)columnTwo)) { int numberOfEntries = 0; if (local_Tran_Array) { numberOfEntries = [local_Tran_Array count]; } BOOL lastRow = NO; int indexOfLastRow = numberOfEntries - 1; if (indexOfLastRow == selectedRowOfTable) { lastRow = YES; } int nextColumn = 0; int nextRow = 0; if ((textMovement == NSTabTextMovement) || (textMovement == NSReturnTextMovement)) { switch (lastColumnEdited) { case columnOne: nextColumn = columnTwo; nextRow = selectedRowOfTable; break; case columnTwo: if (lastRow) { nextRow = 0; } else { nextRow = selectedRowOfTable + 1; }; nextColumn = columnOne; break; default: break; } NSNumber *next_column = [NSNumber numberWithInt:nextColumn]; NSNumber *next_row = [NSNumber numberWithInt:nextRow]; NSMutableDictionary *userInfo = [[[NSMutableDictionary alloc]init]autorelease]; [userInfo setObject: next_column forKey:@"next_column"]; [userInfo setObject: next_row forKey:@"next_row"]; [[NSNotificationQueue defaultQueue] enqueueNotification: [NSNotification notificationWithName:@"select_EditedTableColumAndRow" object:nil userInfo:[NSDictionary dictionaryWithDictionary:userInfo]] postingStyle: NSPostWhenIdle coalesceMask:NSNotificationNoCoalescing forModes:nil]; } } } else { lastColumnEdited = -1; } [pool release]; } 3. The common editcolum routine is also used by the tableview selectionDidChange delegate hence the notification approach. -(void)select_EditedTableColumAndRow:(NSNotification *)aNotification { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; NSDictionary *userInfo = [aNotification userInfo]; NSNumber *next_column = (NSNumber *)[userInfo objectForKey:@"next_column"]; NSNumber *next_row = (NSNumber *)[userInfo objectForKey:@"next_row"]; [myWindowOutlet makeFirstResponder:[[[transactionTableView tableColumnWithIdentifier:[next_column stringValue]] dataCellForRow: [next_row intValue]] controlView]]; [transactionTableView scrollRowToVisible:(int)[next_row intValue]]; [transactionTableView selectRow:[next_row intValue] byExtendingSelection:NO]; [transactionTableView editColumn:[next_column intValue] row:[next_row intValue] withEvent:nil select:(BOOL)YES]; lastColumnEdited = [transactionTableView editedColumn]; [pool release]; } This code works. The problem however is that the static table "flickers" upon tabbing from one row to another row in the transaction table. I suspect that this
Flicker from NSResponder Chain?
I read in the archives of a method to implement Tiger's approach to tabbing through a table in Leopard. While my approach works as to the tabbing, it is slightly different than the approach discussed in the archives. It also results in a problem that is discussed below. I have two tables in the tabview. One is a transaction table, which I tab through. The other is a static table from which I develop transactions for the transaction table. The code for tabbing is in three parts: 1. Set up a: [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localTextEditingDidEnd:) name:NSTextDidEndEditingNotification object:nil]; This is different from the subclass approach but works nonetheless. There is a second observer for the select_EditedTableColumAndRow notification. 2. Add the selector. -(void)localTextEditingDidEnd:(NSNotification *)notification { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; NSDictionary *userInfo = [notification userInfo]; int textMovement = [[userInfo valueForKey:@"NSTextMovement"] intValue]; if ([transactionTableView selectedRow] >= 0) { int selectedRowOfTable = [transactionTableView selectedRow]; if ((lastColumnEdited == (int)columnOne) || (lastColumnEdited == (int)columnTwo)) { int numberOfEntries = 0; if (local_Tran_Array) { numberOfEntries = [local_Tran_Array count]; } BOOL lastRow = NO; int indexOfLastRow = numberOfEntries - 1; if (indexOfLastRow == selectedRowOfTable) { lastRow = YES; } int nextColumn = 0; int nextRow = 0; if ((textMovement == NSTabTextMovement) || (textMovement == NSReturnTextMovement)) { switch (lastColumnEdited) { case columnOne: nextColumn = columnTwo; nextRow = selectedRowOfTable; break; case columnTwo: if (lastRow) { nextRow = 0; } else { nextRow = selectedRowOfTable + 1; }; nextColumn = columnOne; break; default: break; } NSNumber *next_column = [NSNumber numberWithInt:nextColumn]; NSNumber *next_row = [NSNumber numberWithInt:nextRow]; NSMutableDictionary *userInfo = [[[NSMutableDictionary alloc]init]autorelease]; [userInfo setObject: next_column forKey:@"next_column"]; [userInfo setObject: next_row forKey:@"next_row"]; [[NSNotificationQueue defaultQueue] enqueueNotification: [NSNotification notificationWithName:@"select_EditedTableColumAndRow" object:nil userInfo:[NSDictionary dictionaryWithDictionary:userInfo]] postingStyle: NSPostWhenIdle coalesceMask:NSNotificationNoCoalescing forModes:nil]; } } } else { lastColumnEdited = -1; } [pool release]; } 3. The common editcolum routine is also used by the tableview selectionDidChange delegate hence the notification approach. -(void)select_EditedTableColumAndRow:(NSNotification *)aNotification { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; NSDictionary *userInfo = [aNotification userInfo]; NSNumber *next_column = (NSNumber *)[userInfo objectForKey:@"next_column"]; NSNumber *next_row = (NSNumber *)[userInfo objectForKey:@"next_row"]; [myWindowOutlet makeFirstResponder:[[[transactionTableView tableColumnWithIdentifier:[next_column stringValue]] dataCellForRow: [next_row intValue]] controlView]]; [transactionTableView scrollRowToVisible:(int)[next_row intValue]]; [transactionTableView selectRow:[next_row intValue] byExtendingSelection:NO]; [transactionTableView editColumn:[next_column intValue] row:[next_row intValue] withEvent:nil select:(BOOL)YES]; lastColumnEdited = [transactionTableView editedColumn]; [pool release]; } This code works. The problem however is that the static table "flickers" upon tabbing from one
PDF printing now blurry
I have an application that under Tiger assembled print images, scaled them with NSImage, and printed a PDF to a file ([[printInfo dictionary] setObject:filePathString forKey:NSPrintSavePath];). The print images were always clear under Tiger. Under Leopard, 10.5.3, the last page of a multipage document is blurry; if the document is one page, it is blurry. Anyone seen this before or have any suggestions? John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSStream, NSInputStream, NSOutputStream
Ah, thank you. John On May 19, 2008, at 6:32 PM, Ken Thomases wrote: On May 19, 2008, at 8:07 PM, John MacMullin wrote: The error returned is: [ostream streamError]: NSError "POSIX error: Broken pipe" Domain=NSPOSIXErrorDomain Code=32 I have looked at the stream error docs in NSStream and this error is not even reference. Any ideas on what this means and how I fix it would be greatly appreciated. One of the BSD/POSIX routines used by the NSOutputStream implementation is returning EPIPE. It's documented in the man pages for the BSD routine in question (write, send, or similar), and also in one central list: http:// developer.apple.com/documentation/Darwin/Reference/ManPages/man2/ intro.2.html It means that the would-be recipient of the data you're writing has closed their end of the connection. So, you should look at the implementation of the client to figure out why it's closing the connection. 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 [EMAIL PROTECTED]
NSStream, NSInputStream, NSOutputStream
Continuing on my efforts re: my modified Echo Server, the following code is crashing. - (void)startStreamWrite:(NSOutputStream *)ostream { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc]init]; while ([ostream hasSpaceAvailable]) { if (remainingToWrite > 0) { actuallyWritten = 0; actuallyWritten = [ostream write:marker maxLength:1]; if ((actuallyWritten == -1) || (actuallyWritten == -1)) { NSLog(@"[ostream streamError]:[EMAIL PROTECTED]", [ostream streamError]); NSLog(@"remainingToWrite:\n%u\n", remainingToWrite); NSLog(@"ostream:[EMAIL PROTECTED]", ostream); } else { remainingToWrite -= actuallyWritten; marker += actuallyWritten; NSLog(@"remainingToWrite:\n%u\n", remainingToWrite); } } } [pool release]; } The error returned is: [ostream streamError]: NSError "POSIX error: Broken pipe" Domain=NSPOSIXErrorDomain Code=32 I have looked at the stream error docs in NSStream and this error is not even reference. Any ideas on what this means and how I fix it would be greatly appreciated. John ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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: NSStream, NSInputStream, NSOutputStream
Jens and Ken: Thank you for your responses. I believe I now understand in part as to what is happening as to the streams. Let me take the output "trigger" first. The Stream Programming Guide states: "if the delegate receives an NSStreamEventHasSpaceAvailable event and does not write anything to the stream, it does not receive further space- available events from the run loop until the NSOutputStream object receives more bytes." This may answer the question of the "trigger", which is I now believe is simply the write statement. That means that instead of doing a polling loop outside of the delegate, (or doing writes inside the NSStreamEventHasBytesAvailable section of the delegate during reads) I think that all one needs to do is to write one byte in the "external" function, then handle the rest of the writes through the delegate NSStreamEventHasSpaceAvailable event. That should be a lot easier than doing a custom polling loop and trying to resolve the space available issues outside of the delegate. In other words, it seems that the delegate should do it for you after doing a one byte write. I'll let you know how it works out. And I will address the other questions after I have tested this issue. Best regards, John On May 18, 2008, at 11:10 AM, Jens Alfke wrote: On 18 May '08, at 8:50 AM, John MacMullin wrote: I modified slightly the Echo Server code sample from Apple with the following results. One, I couldn't stream a large file from a polling routine. More than likely it would cancel because of a Sigterm 15. Whenever you report a crash, a backtrace is very helpful. Or at least tell us what function/method the crash was in. This shouldn't crash, so the problem is probably in something in your code. It appears from reading the docs that the user cannot detect the end of a stream and that the NSStreamEventEndEncountered only detects a close. "End of stream" and "close" are the same thing: a TCP input stream ends when the other side closes the connection (or crashes...) Two, when unarchiving a file in a client input stream delegate method, if the stream terminated from the server because it was too large, the client terminates on an unarchiver error because it didn't get the whole stream. A stream won't ever terminate due to length. You can send gigabyte after gigabyte over a TCP stream, as many happy BitTorrent users can attest ;-) But yes, if the incoming stream closed before sending all the data the reader needed, then I would expect the reader to report an error. This shouldn't cause a crash, though; it sounds like your code isn't handling the error gracefully. Third, the output stream methods shown in Echo Server are polling methods, not delegate methods. The CocoaEcho sample? I just looked at it, and you're right. The writing code is badly designed. The client will block in a 'while' loop until all the data is sent, and the server code will simply drop response data on the floor if there isn't room to send it. I just filed feedback on the web page for the sample. 1. How do I stream a large file between connections or is NSStream the wrong tool? Can the stream size be modified? Most of the CocoaEcho code is reasonable as a base for doing this. Rip out the server-side code that echoes the data back, and instead write the data to a file. On the client/sender side, it's best to use the 'spaceAvailable' delegate call, as you said. In response to that call, read some data from the file into a buffer, then write it to the stream. Something like 4k will do. Pay attention to the return value of the write, which tells you how many bytes actually got written, and advance a file-position instance variable by that amount. That'll tell you the position to read from in the input file next time. 2. What is the largest stream size? There isn't one. TCP was designed to handle arbitrary length streams. There are internal byte counters but they just wrap around harmlessly after 4GB. 3. Is it possible to detect a valid archive before I unarchive it, or do I simply have to intercept the exception? No. If you have data in archive format, you have to just hand it to NSUnarchiver and wrap the call in @try/@catch. But you said you were sending a file? In that case you should just send it as a stream of bytes. If you're reading the entire file into an NSData and then sending that with NSArchiver, that's a huge amount of overhead for no gain. 4. How does one trigger and make available a file an output stream so that the delegate methods can be used? I don't understand that question. Can you give more detail? (Or perhaps I answered it above under #1.) —Jens ___
NSStream, NSInputStream, NSOutputStream
I modified slightly the Echo Server code sample from Apple with the following results. One, I couldn't stream a large file from a polling routine. More than likely it would cancel because of a Sigterm 15. It appears from reading the docs that the user cannot detect the end of a stream and that the NSStreamEventEndEncountered only detects a close. Two, when unarchiving a file in a client input stream delegate method, if the stream terminated from the server because it was too large, the client terminates on an unarchiver error because it didn't get the whole stream. Third, the output stream methods shown in Echo Server are polling methods, not delegate methods. So: 1. How do I stream a large file between connections or is NSStream the wrong tool? Can the stream size be modified? 2. What is the largest stream size? 3. Is it possible to detect a valid archive before I unarchive it, or do I simply have to intercept the exception? 4. How does one trigger and make available a file an output stream so that the delegate methods can be used? Thank, John MacMullin ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)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]