Re: NSSocketPort initRemoteWithTCPPort is never valid
On Jul 14, 2009, at 1:40 AM, Christopher J Kemsley wrote: This is just a quick question for anyone who may know (or, at least I hope it's quick) If I declare a port: port = [ [NSSocketPort alloc] initRemoteWithTCPPort:portNumber host:hostName ] ; And use it with an NSConnection, it works. If I use that same port in any other way (such as NSFileHandle) it doesn't work. The error it gives is: [NSConcreteFileHandle writeData:]: Bad file descriptor (when I use initWithFileDescriptor:port.socket ) An NSSocketPort is intended for use with Distributed Objects and NSConnection or, at least, to communicate with another NSSocketPort at the other end. You would use the NSPortMessage class for sending data in the latter case. I don't think it's suitable for creating an arbitrary socket connection to a remote port. The particular problem you're encountering is probably due to this sentence in the documentation of -initRemoteWithTCPPort:host: A connection is not opened to the remote host until data is sent. It's quite possible that the socket file descriptor isn't even allocated until then, either. Even if the file descriptor has been created, connect() hasn't been called at the point where you're trying to init your NSFileHandle object with it. And since you're trying to use the file descriptor rather than the NSSocketPort object from that point on, there's no opportunity for NSSocketPort to establish the connection. It can't very well hook into the system calls and magically connect the socket when something tries to write through the file descriptor. In other words, what you're trying to do isn't a supported usage pattern. Ideally, I'd like to be able to use NSFileHandle (or something very similar) on both ends of the connection. Any thoughts/suggestions? Look into using streams (NSStream and friends). In particular, + [NSStream getStreamsToHost:port:inputStream:outputStream:]. http://developer.apple.com/documentation/Cocoa/Conceptual/Streams/ Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Under OS 3.0 CoreGraphics.framework is not available
Hi; Under OS 3.0 I am unable to compile this simple code, but it works under OS 2.2.1 Under OS 3.0 CoreGraphics.framework is not available _CGContextFillRect, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextSaveGState, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextRestoreGState, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextSetFillColor, referenced from: - (void)drawRect:(CGRect)rect { CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSaveGState(context); CGRect viewRect = [self bounds]; float RedColor[] = {1.0f,0.0f,0.0f,1.0f}; CGContextSetFillColor(context,RedColor); CGContextFillRect(context, viewRect); CGContextRestoreGState(context); } Any idea? Best regards -Agha ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Integrating with another app
What's the best way to include an external app's source into and Xcode project? The app I'm using is cross platform, open source, programmed in C and uses a makefile to build. Any suggestions? Anthony smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Integrating with another app
On 15/07/2009, at 5:41 PM, Anthony Smith wrote: What's the best way to include an external app's source into and Xcode project? The app I'm using is cross platform, open source, programmed in C and uses a makefile to build. Any suggestions? There's probably no one best way, but you have several choices. Bear in mind that 'app' really refers to the packaging of code, rather than the code itself. You'll need to repackage it to use as part of another app. Typical ways would be as a statically linked library or as a dynamically linked library or framework. I'd build the external app in a separate Xcode project so that you can work out the kinks of doing so in isolation. Then, when it's building cleanly, add the entire project to your derivative project and set up dependencies so that the first gets built, generates its products which are then included in the second, which then builds, linking to the library the first one built. This sounds a bit convoluted but it's quite straightforward. Alternatively if the source is just a few files this might be overkill - you could just add the files directly to your source. However most open source projects I've come across seem to have extended chains of dependencies which make this approach unattractive, as you'll end up dragging in hundreds of other files just to get it to compile. Doing that in a separate project makes managing that part of the code a lot easier, I've found. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
iPhone cannot compile 2.2 SDK application for 3.0 SDK
Hi, I have an application which builds successfully for 2.0 and 2.2 SDK but gives me following errors for 3.0 In file included from /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.0.sdk/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h:31, error: syntax error before 'AT_NAME' token error: syntax error before '}' token fatal error: method definition not in @implementation context I googled out for this problem and tried adding a Build Setting Condition for Simulator 3.0 and Device 3.0 for Compiler Version making it GCC 4.2 for the target build setting. But still the error prevails. Any ideas what can be going wrong? -- Regards, Shraddha Karwan ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: testing your app on a virtual machine?
but it sill requires me to reboot my development machine to boot it again from another partition/external drive in order to test my app. I guess apple does not want people to run OSX on a virtual machine even if it is for developers to test their applications in different scenarios Paul Franz wrote: IIRC, you need to be running an OS X Server to run OS X in a VM (i.e. it is a license issue). But why can't you buy a FireWire external drive to install a different version OS X on? Paul Franz On Wed, Jul 15, 2009 at 4:37 AM, Gevik mac...@xs4all.nl mailto:mac...@xs4all.nl wrote: Hi, Is there anyway one can install an OSX system on a virtual machine for testing purposes? It is not really practical to purchase extra hardware in order to test your app on a different version of OSX. Any thoughts? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com mailto:Cocoa-dev@lists.apple.com) Please 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 Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/paulfranz%40email.com This email sent to paulfr...@email.com mailto:paulfr...@email.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: iPhone cannot compile 2.2 SDK application for 3.0 SDK
On 15/07/2009, at 7:18 PM, Shraddha Karwan wrote: error: syntax error before 'AT_NAME' token error: syntax error before '}' token fatal error: method definition not in @implementation context This looks like you're missing the @end from the bottom of a class definition somewhere. Maybe you accidentally edited UIKit.h? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSError in NSDocument readFromURL
Am 13.07.2009 um 00:50 schrieb Konrad Windszus: If I set an NSError in the method readFromURL of my NSDocument, I am not able to overwrite the NSLocalizedDescriptionKey. If have the following code in that method: I guess for the desired (expected?) effect the code should look like: - (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError { NSArray *objArray = [NSArray arrayWithObjects:@Description, @FailureReason, @RecoverySuggestion, nil]; NSArray *keyArray = [NSArray arrayWithObjects:NSLocalizedDescriptionKey, NSLocalizedFailureReasonErrorKey, NSLocalizedRecoverySuggestionErrorKey, nil]; NSDictionary *eDict = [NSDictionary dictionaryWithObjects:objArray forKeys:keyArray]; [self presentError:[NSError errorWithDomain:@myDomain code:1 userInfo:eDict]]; // fill outError *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:NSUserCancelledError userInfo:nil]; return NO; } ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: iPhone cannot compile 2.2 SDK application for 3.0 SDK
It seems to be a bug with GCC 4.0. Set the compiler to GCC 4.2 for SDK 3.0 or higher. Devon On 2009-07-15, at 7:07 AM, Graham Cox wrote: On 15/07/2009, at 7:18 PM, Shraddha Karwan wrote: error: syntax error before 'AT_NAME' token error: syntax error before '}' token fatal error: method definition not in @implementation context This looks like you're missing the @end from the bottom of a class definition somewhere. Maybe you accidentally edited UIKit.h? --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dferns%40devonferns.com This email sent to dfe...@devonferns.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
10.4 vs 10.5 SDK - some problems in compilation
Hi, All, I'm rather new in XCode and Cocoa, so maybe it's my misunderstanding. Am I correct in my understanding, that I need to select 10.4 SDK in XCode project menu to create an application, compatible with both Tiger and Leo? I've got few errors in compilation when I choose 10.4 SDK. Some of these errors, like NSUInteger and CGFloat missing, I've fixed by appropriate basic types substituting. Nevertheless I still have one uresolved problem - kVK_ constants are not found in 10.4 SDK, though they're OK with 10.5. I've tried to search in Google, but the only I've found was some FAQ, where it was suggested to use absolute path to the header file. I've tried it, but without luck. Though I use #import/System/Library/.../Events.h (what is shown in Get Info for that header in Finder) I still get the same error. What is strange for me, all works OK even without this #import clause when I'm using 10.5 SDK. Any help would be appreciated. Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Removing an NSOpenGLView causes default background to be drawn.
Hi, When I remove and NSOpenGLView or when I close a window that has an NSOpenGLView that area is drawn over with his default background color (in my case this is Black). This only happens depending on how long it takes to replace or close that window. I can see it in my app when I quit because that takes a while. I have a few ideas on how I can get rid of this visual effect. But I wanted to poke around if other people have seen it and solved it. The effect that I see can be easily tested with any simple NSOpenGLView application. I tested an standard cocoa sample app: http://www.mataderu.com/xphere/info/cocoa_tut01/index.html Cocoa Appkit is calling CGLClearDrawable on the opengl context before it is getting removed then later on it removes the context and calls CGSRemoveSurface this last call when that is finished calling causes the black (or white depending your setting) area to appear. To simulate the slow quiting/replacing i can demonstrate it with Debugger trick: I run it with the debugger and put a breakpoint at CGSRemoveSurface. I quit the application, then it hits that breakpoint, and the window still looks normal. Then when I step out of this method it becomes white. Which is like the NSOpenGLView standard background color. Here is the stack trace: #0 0x954711ad in -[NSSurface _disposeSurface] #1 0x9679e53c in _nsnote_callback #2 0x912d764a in __CFXNotificationPost #3 0x912d7923 in _CFXNotificationPostNotification #4 0x9679b690 in -[NSNotificationCenter postNotificationName:object:userInfo:] #5 0x967a4ee8 in -[NSNotificationCenter postNotificationName:object:] #6 0x9553c710 in -[NSWindow _close] #7 0x91364be5 in -[NSArray makeObjectsPerformSelector:] #8 0x955dab93 in -[NSApplication _deallocHardCore:] #9 0x955d98b1 in -[NSApplication terminate:] #10 0x954fa4cb in -[NSApplication sendAction:to:from:] #11 0x955a9108 in -[NSMenu performActionForItemAtIndex:] #12 0x955a8e0d in -[NSCarbonMenuImpl performActionWithHighlightingForItemAtIndex:] #13 0x955a8a93 in -[NSMenu performKeyEquivalent:] #14 0x955a7338 in -[NSApplication _handleKeyEquivalent:] #15 0x954c40fb in -[NSApplication sendEvent:] #16 0x9542162f in -[NSApplication run] #17 0x953ee834 in NSApplicationMain #18 0x1b64 in main at main.m:13 Any ideas on how I can get rid of this last minute view clearing?. marc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: 10.4 vs 10.5 SDK - some problems in compilation
On Jul 15, 2009, at 5:10 AM, Alexander Bokovikov wrote: I'm rather new in XCode and Cocoa, so maybe it's my misunderstanding. Am I correct in my understanding, that I need to select 10.4 SDK in XCode project menu to create an application, compatible with both Tiger and Leo? I've got few errors in compilation when I choose 10.4 SDK. For your case you'll need to set the SDK to 10.5 so that you can use Leopard-specific APIs. You'll also need to set the deployment target to 10.4 so that Xcode knows to build code that will also run on 10.4. Some of these errors, like NSUInteger and CGFloat missing, I've fixed by appropriate basic types substituting. Nevertheless I still have one uresolved problem - kVK_ constants are not found in 10.4 SDK, though they're OK with 10.5. I've tried to search in Google, but the only I've found was some FAQ, where it was suggested to use absolute path to the header file. I've tried it, but without luck. Though I use #import/System/Library/.../ Events.h (what is shown in Get Info for that header in Finder) I still get the same error. NSUInteger and CGFloat are only defined in the 10.5 SDK, even though they're perfectly fine data types on a 10.4 system. Any 10.5 C-style functions or constants will be weak linked so you'll need to check for their existence at runtime. Likewise you'll need to check for the existence of 10.5-only Cocoa methods using -respondsToSelector:. What is strange for me, all works OK even without this #import clause when I'm using 10.5 SDK. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: testing your app on a virtual machine?
Is there anyway one can install an OSX system on a virtual machine for testing purposes? Check the EULA for Mac OS X Server. I think you can run that under a VM, and I think VMWare has support for it in either the current or future version. Todd ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: NSSocketPort initRemoteWithTCPPort is never valid
An NSSocketPort is intended for use with Distributed Objects and NSConnection or, at least, to communicate with another NSSocketPort at the other end. The documentation used to state this, possibly erroneously. It no longer does so: NSSocketPort is a subclass of NSPort that represents a BSD socket. An NSSocketPort object can be used as an endpoint for distributed object connections NSSocketPort is quite usable as an abstraction of a BSD socket. I have written code that communicates with Winsock sockets using NSSocketPort. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
QuickLook
Thanks to all for help with my QuickLook generator! The generator works when installed in ~/Library/QuickLook but not in /Library/QuickLook Do I need to do something else to install in Library/QuickLook and have it work? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: QuickLook
On 7/15/09 10:53 AM, David Blanton said: Thanks to all for help with my QuickLook generator! The generator works when installed in ~/Library/QuickLook but not in /Library/QuickLook Do I need to do something else to install in Library/QuickLook and have it work? Did you know there is a Quick Look list: http://lists.apple.com/mailman/listinfo/quicklook-dev its archives are also searchable. -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IKImageBrowserView only horizontal scrolling
Hi, This tip looks simple enough, and it works to a certain extent. But moving the scaling-slider or resizing the window, results in very buggy display for me. This is both the case with my own prototype app, as with apple's Image Browser example code (set to use NSViewWidthSizable). Two screenshots: - normal, seems to work: http://arri.pulsecode.org/dump/IKImageBrowserView1.png - after moving the scale-slider or window resizing: http://arri.pulsecode.org/dump/IKImageBrowserView2.png Am i doing something wrong? or is this a bug? thanks, arri On Mon, Oct 27, 2008 at 4:41 PM, Ralph Mannsr.ma...@gmail.com wrote: Hello Thomas, thanks you, works great. The documentation says setContentResizingMask determines how the receiver resize its content when zooming... Thanks, Ralph. 2008/10/27 Thomas Goossens tgooss...@mac.com Hi Ralph, Use setContentResizingMask: with NSViewWidthSizable so that the IKImageBrowserView resizes its content horizontally when zooming/resizing... -- Thomas On Oct 27, 2008, at 2:06 PM, Ralph Manns wrote: Hello, is there a away to limit the number of rows to 1, so that IKImageBrowserView scrolls only horizontal ? Ralph ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/arritjeparretjenof%40gmail.com This email sent to arritjeparretje...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: IKImageBrowserView only horizontal scrolling
Hi Arri, This is a bug (fixed on SnowLeopard). On Leopard, when the content resizing mask is set to NSViewWidthSizable (for banners typically) only layouts with a single row are supported. -- Thomas On Jul 15, 2009, at 7:05 PM, arri wrote: Hi, This tip looks simple enough, and it works to a certain extent. But moving the scaling-slider or resizing the window, results in very buggy display for me. This is both the case with my own prototype app, as with apple's Image Browser example code (set to use NSViewWidthSizable). Two screenshots: - normal, seems to work: http://arri.pulsecode.org/dump/IKImageBrowserView1.png - after moving the scale-slider or window resizing: http://arri.pulsecode.org/dump/IKImageBrowserView2.png Am i doing something wrong? or is this a bug? thanks, arri On Mon, Oct 27, 2008 at 4:41 PM, Ralph Mannsr.ma...@gmail.com wrote: Hello Thomas, thanks you, works great. The documentation says setContentResizingMask determines how the receiver resize its content when zooming... Thanks, Ralph. 2008/10/27 Thomas Goossens tgooss...@mac.com Hi Ralph, Use setContentResizingMask: with NSViewWidthSizable so that the IKImageBrowserView resizes its content horizontally when zooming/ resizing... -- Thomas On Oct 27, 2008, at 2:06 PM, Ralph Manns wrote: Hello, is there a away to limit the number of rows to 1, so that IKImageBrowserView scrolls only horizontal ? Ralph ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/arritjeparretjenof%40gmail.com This email sent to arritjeparretje...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Dictionary interface
I've been searching the Cocoa documentation pages on extending and interfacing with Apple applications, hoping to find notes related to the Dictionary application. An API that finds words using a soundex-type function would be nice. That, plus a plugin method to add a UI item similar to Dictionary and Thesaurus would be ideal. Should I assume that's not possible, or did I miss something? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Under OS 3.0 CoreGraphics.framework is not available
You need to add the CoreGraphics.framework to your project. On Jul 15, 2009, at 12:02 AM, Agha Khan wrote: Under OS 3.0 I am unable to compile this simple code, but it works under OS 2.2.1 Under OS 3.0 CoreGraphics.framework is not available _CGContextFillRect, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextSaveGState, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextRestoreGState, referenced from: -[FlipsideView drawRect:] in FlipsideView.o _CGContextSetFillColor, referenced from: -- David Duncan Apple DTS Animation and Printing ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSocketPort initRemoteWithTCPPort is never valid
On Jul 15, 2009, at 11:49 AM, Kirk Kerekes wrote: An NSSocketPort is intended for use with Distributed Objects and NSConnection or, at least, to communicate with another NSSocketPort at the other end. The documentation used to state this, possibly erroneously. It no longer does so: NSSocketPort is a subclass of NSPort that represents a BSD socket. An NSSocketPort object can be used as an endpoint for distributed object connections NSSocketPort is quite usable as an abstraction of a BSD socket. I have written code that communicates with Winsock sockets using NSSocketPort. How did you force it to connect? What methods did you use to send and receive data? Or did you just pluck out the socket fd and use that? Regards, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dictionary interface
- Message from glgue...@amug.org - You might want to explain exactly what you tried. Sure. http://developer.apple.com/reference/Cocoa/idxAppleApplications-date.html Since I'm not really interested in spell checking, but rather another Dictionary-based service it seemed like a page that describes how developers can have their applications interact with and extend these Apple applications might be a reasonable starting point. Thanks for the other reference, though. I'm not sure it's related, but I'll have a look. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: IKImageBrowserView only horizontal scrolling
Thomas, Thanks for the fast respons! Saves a lot of headaches. .arri On Wed, Jul 15, 2009 at 7:23 PM, Thomas Goossenstgooss...@mac.com wrote: Hi Arri, This is a bug (fixed on SnowLeopard). On Leopard, when the content resizing mask is set to NSViewWidthSizable (for banners typically) only layouts with a single row are supported. -- Thomas On Jul 15, 2009, at 7:05 PM, arri wrote: Hi, This tip looks simple enough, and it works to a certain extent. But moving the scaling-slider or resizing the window, results in very buggy display for me. This is both the case with my own prototype app, as with apple's Image Browser example code (set to use NSViewWidthSizable). Two screenshots: - normal, seems to work: http://arri.pulsecode.org/dump/IKImageBrowserView1.png - after moving the scale-slider or window resizing: http://arri.pulsecode.org/dump/IKImageBrowserView2.png Am i doing something wrong? or is this a bug? thanks, arri On Mon, Oct 27, 2008 at 4:41 PM, Ralph Mannsr.ma...@gmail.com wrote: Hello Thomas, thanks you, works great. The documentation says setContentResizingMask determines how the receiver resize its content when zooming... Thanks, Ralph. 2008/10/27 Thomas Goossens tgooss...@mac.com Hi Ralph, Use setContentResizingMask: with NSViewWidthSizable so that the IKImageBrowserView resizes its content horizontally when zooming/resizing... -- Thomas On Oct 27, 2008, at 2:06 PM, Ralph Manns wrote: Hello, is there a away to limit the number of rows to 1, so that IKImageBrowserView scrolls only horizontal ? Ralph ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/arritjeparretjenof%40gmail.com This email sent to arritjeparretje...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/tgoossens%40mac.com This email sent to tgooss...@mac.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Dictionary interface
Phillip Mills wrote: Sure. http://developer.apple.com/reference/Cocoa/ idxAppleApplications-date.html Since I'm not really interested in spell checking, but rather another Dictionary-based service it seemed like a page that describes how developers can have their applications interact with and extend these Apple applications might be a reasonable starting point. You should submit feedback to that effect on the bottom of the referenced page. I used ADC search with these terms: dictionary service which didn't show much in the first 10 hits. Probably too generic, since both terms are commonly used in programming. Second try: dictionary definition service and this came up: http://developer.apple.com/documentation/UserExperience/Reference/ DictionaryServicesRef/Reference/reference.html Dictionary Services Programming Guide http://developer.apple.com/documentation/UserExperience/Conceptual/ DictionaryServicesProgGuide/Introduction/Introduction.html This also looks like a page worth bookmarking: http://developer.apple.com/documentation/UserExperience/index-date.html -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: testing your app on a virtual machine?
The current version of VMware Fusion has at least experimental support for OS X Server. Sent from my iPhone On Jul 15, 2009, at 12:18 PM, Todd Heberlein todd_heberl...@mac.com wrote: Is there anyway one can install an OSX system on a virtual machine for testing purposes? Check the EULA for Mac OS X Server. I think you can run that under a VM, and I think VMWare has support for it in either the current or future version. Todd ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/anthony%40sticksnleaves.com This email sent to anth...@sticksnleaves.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: Integrating with another app
Thanks for the advice. I currently have the external app added to my project as an external target which works well with the makefile. Is it possible to use a makefile with a dynamic or static library or will I have to translate the makefile into something else? On Jul 15, 2009, at 4:01 AM, Graham Cox wrote: On 15/07/2009, at 5:41 PM, Anthony Smith wrote: What's the best way to include an external app's source into and Xcode project? The app I'm using is cross platform, open source, programmed in C and uses a makefile to build. Any suggestions? There's probably no one best way, but you have several choices. Bear in mind that 'app' really refers to the packaging of code, rather than the code itself. You'll need to repackage it to use as part of another app. Typical ways would be as a statically linked library or as a dynamically linked library or framework. I'd build the external app in a separate Xcode project so that you can work out the kinks of doing so in isolation. Then, when it's building cleanly, add the entire project to your derivative project and set up dependencies so that the first gets built, generates its products which are then included in the second, which then builds, linking to the library the first one built. This sounds a bit convoluted but it's quite straightforward. Alternatively if the source is just a few files this might be overkill - you could just add the files directly to your source. However most open source projects I've come across seem to have extended chains of dependencies which make this approach unattractive, as you'll end up dragging in hundreds of other files just to get it to compile. Doing that in a separate project makes managing that part of the code a lot easier, I've found. --Graham smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Efficiency of loading Localizable.strings and NSUserDefaults
This is not a help, the code doesn't work question, but more a general question to help one write better Cocoa code. Imagine my program requires a large amount of localizable strings. In many cases (ex. error codes), I have a string associated with an integer value. For some of these, I could create an array of strings, and when I need a specific String #18, I would go to the 18th element of the array. For the sake of this discussion, I am using C array structure, not NSArray objects. I could just pre-load all the strings in at startup, so they are always there. This takes a bit more memory and startup time, but has the advantage that the strings are always there. Or I could set the elements to the array to nil, and the first time I need a specific string, I load that string from the Localizable.strings file, use it, while setting the element of the array to the string for future use. Thus once I use a string, it is available for quicker access a second time. Assume for this argument, that I am using writing some user interface where I actually need the strings fast. Going to disk ever time is not an option. Either of these approaches can work, but they are based on the premise that retrieving the string from the Localizable.strings file causes no buffer of it's own? Is this true? When I invoke -localizedStringForKey:value:table: (or the other variations of NSLocalizedString), is the entire Localizable.strings file read into memory? Is it thrown away at the end of the call? Or is the localized version of all the strings kept in memory for use? Is the entire file read into memory, or If it is kept in memory, it makes no sense for me to store the strings in an array. Disk access is slow, but extracting a specific string from a block of data already in memory is fairly fast. In fact, when I load in 10 strings from the Localizable.strings file, am I reading the entire file in 10 times? I can not image this is the case, there must be some buffering happening. Anyone has some comments or ideas about this? Possibly someone with some inner understanding of how localized strings are read? Related to this idea, is the similar case of reading strings from and to the NSUserDefaults object (preferences). Should I read all my preferences (Strings, integers, boolean) in at startup? Or should I read them when I need, assuming that Cocoa is keeping them in memory? Apple has been recommending that applications save the preferences to the NSUserDefaults object when the preferences get changed, and not as shut down. This prevents loss of preferences due to crashes or forced quits. Another reason was explained to me at WWDC. For the iPhone, you do not want to take up any time, when your applications switches out to another. Save the preferences when the user changes them, you have the time then. Again, anyone has thoughts or comments about the inner working of NSUserDefaults? Thank you! Steve Sheets ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Plain Text Kind
I posted to QuickLook list but it does not seem very active so indulge me please .. When my files are show in Finder their Kind is Plain Text. I have set a Description in my UTI declarations which the docs sat is user visible. Do I need to something more? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Efficiency of loading Localizable.strings and NSUserDefaults
On Jul 15, 2009, at 1:45 PM, Development wrote: Is this true? When I invoke -localizedStringForKey:value:table: (or the other variations of NSLocalizedString), is the entire Localizable.strings file read into memory? Is it thrown away at the end of the call? Or is the localized version of all the strings kept in memory for use? Is the entire file read into memory, or If it is kept in memory, it makes no sense for me to store the strings in an array. Disk access is slow, but extracting a specific string from a block of data already in memory is fairly fast. In fact, when I load in 10 strings from the Localizable.strings file, am I reading the entire file in 10 times? I can not image this is the case, there must be some buffering happening. The current behavior is that strings read in from a .strings file are cached. I won't guarantee that they will always all be cached indefinitely, but in general you can expect that subsequent requests for the same string after the first will be fast. Douglas Davidson ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Reference Count Underflow when Writing PDF
I have a PDF that I've loaded, combined with another PDF, and now I'm ready to save the result as a new file. My program is using garbage collection, but I understand that PDFKit is not garbage collected. The problem is that I get reference count underflow error when writing the PDF. Here is some code that is shorter, but creates the same problem I'm having: // Get PDF from disc NSData *savedData = [[NSData alloc] initWithContentsOfFile:@oldfile.pdf options:0 error:error]; PDFDocument *savedDoc = [[PDFDocument alloc] initWithData:savedData]; // Write saveDoc to file [savedDoc writeToFile:@newfile.pdf]; Actually, there is no problem when writing the file: newfile.pdf is intact after the operation. But I get the following error in the console: malloc: reference count underflow for 0x13464c0, break on auto_refcount_underflow_error to debug. And when I break on auto_refcount_underflow, I get the following stack: #0 0x94721a40 in auto_refcount_underflow_error #1 0x9472d8e4 in Auto::Zone::dec_refcount_small_medium #2 0x9472d9b0 in Auto::Zone::block_decrement_refcount #3 0x931da50c in CFRelease #4 0x904bfe4c in -[PDFDocument(PDFDocumentInternal) writeToConsumer:withOptions:] #5 0x904bd9fc in -[PDFDocument writeToURL:withOptions:] #6 0x904bd97c in -[PDFDocument writeToFile:withOptions:] #7 0x6b60 in -[MyDocument openPanelDidEnd:returnCode:contextInfo:] at MyDocument.m:495 Now, #3 suggests there is a release going on that shouldn't be; or at least there should be an extra retain in my code. But when I add CFRetain(savedDoc); before writing the file, the error still persists. I've read the Semantics section of Using Core Foundation with Garbage Collection, but I don't see a solution to this problem there (I'm not saying it's not there, just that I don't quite see it). Any help would be greatly appreciated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Plain Text Kind
On 7/15/09 2:49 PM, David Blanton said: I posted to QuickLook list but it does not seem very active so indulge me please .. You've only waited 50 minutes! Even paid support is not usually that fast. Also, you're message's subject is not very descriptive. May I politely suggest you read: http://www.mikeash.com/getting_answers.html -- Sean McBride, B. Eng s...@rogue-research.com Rogue Researchwww.rogue-research.com Mac Software Developer Montréal, Québec, Canada ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Japanese Language
Ok, I lucked out and got a great chance at releasing a bit of software in japan. The problem is that it is 50/50 client to web. My primary concerns are string translation from iPhoneOS to data being stored in a mysql database. I have spent quite a bit of time googling and am still not sure but is the japanese data that will be sent from my application to my server utf-8? Or is it utf-16 as I for some reason thought. Everything sent to the server is pre encoded for transport, stored and then unencoded by the app so I feel at least a level of confidence that if I encode with the correct string encoding my server side will just accept and store the data. I dunno. Maybe I'm completely confused. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Use Cocoa in QL Generator
Sorry, I thought I remember reading in the Quick Look documentation the steps required to write code with and link it against the Cocoa framework. Starting with a Quick Look Plugin Template in Xcode, - Choose from the menu bar Project Add to Project... and add the framework /System/Library/Frameworks/Cocoa.framework. - Replace the .c extensions for every file using the Objective-C code to .m. - #import Cocoa/Cocoa.h in your .m files. Hope this helps, Kiel On 16/07/2009, at 12:16 AM, David Blanton wrote: I have already read that. Do I just need to include the Cocoa Framework and include Cocoa.h ? On Jul 14, 2009, at 6:48 PM, Kiel Gillard wrote: Read the documentation: http://devworld.apple.com/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html The samples there use Cocoa as well as CoreFoundation. On 15/07/2009, at 10:34 AM, David Blanton wrote: I want to use Cocoa calls in my GenerateThumbnailForURL what do I ahve to do to use Cocoa ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: NSSocketPort initRemoteWithTCPPort is never valid
On Jul 15, 2009, at 11:19 AM, Ken Thomases wrote: On Jul 15, 2009, at 11:49 AM, Kirk Kerekes wrote: An NSSocketPort is intended for use with Distributed Objects and NSConnection or, at least, to communicate with another NSSocketPort at the other end. The documentation used to state this, possibly erroneously. It no longer does so: NSSocketPort is a subclass of NSPort that represents a BSD socket. An NSSocketPort object can be used as an endpoint for distributed object connections NSSocketPort is quite usable as an abstraction of a BSD socket. I have written code that communicates with Winsock sockets using NSSocketPort. How did you force it to connect? What methods did you use to send and receive data? Or did you just pluck out the socket fd and use that? Most likely he's just using the fd, based on his post in this thread: http://www.cocoabuilder.com/archive/message/cocoa/2008/12/5/224509 There is just no reason to use NSSocketPort for anything other than DO. Douglas Davidson has a good summary in that same thread: http://www.cocoabuilder.com/archive/message/cocoa/2008/12/5/224544 The OP mentioned working with runloops and NSFileHandle, so CFSocket sounds like a more useful abstraction. -- Adam smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Use Cocoa in QL Generator
Yep, that's it ... and since I am using c++ as well my files are .mm On Jul 15, 2009, at 4:57 PM, Kiel Gillard wrote: Sorry, I thought I remember reading in the Quick Look documentation the steps required to write code with and link it against the Cocoa framework. Starting with a Quick Look Plugin Template in Xcode, - Choose from the menu bar Project Add to Project... and add the framework /System/Library/Frameworks/Cocoa.framework. - Replace the .c extensions for every file using the Objective-C code to .m. - #import Cocoa/Cocoa.h in your .m files. Hope this helps, Kiel On 16/07/2009, at 12:16 AM, David Blanton wrote: I have already read that. Do I just need to include the Cocoa Framework and include Cocoa.h ? On Jul 14, 2009, at 6:48 PM, Kiel Gillard wrote: Read the documentation: http://devworld.apple.com/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/Introduction/Introduction.html The samples there use Cocoa as well as CoreFoundation. On 15/07/2009, at 10:34 AM, David Blanton wrote: I want to use Cocoa calls in my GenerateThumbnailForURL what do I ahve to do to use Cocoa ? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/kiel.gillard%40gmail.com This email sent to kiel.gill...@gmail.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Core Data debugging
Hello, On 14 Jul 2009, at 10:01 PM, Fritz Anderson wrote: On 14 Jul 2009, at 5:14 PM, Tim Mowlem wrote: BOOL result = [moc save: err]; .. The problem is that every time I call this method the result is NO implying a failure when saving. .. The issue for this post is that when I try to examine the NSError object it is invalid. The NSError is being created as the debugger shows an address for the object but its field are not set. Specifically the _code field had a variable value implying it was not specifically set, and the?_domain field was Invalid. Inspecting the instance variables of an NSError (or any other Cocoa object, for that matter) won't likely get you very far. Using the debugger, step past the save:, then type po err at the debugger console. That will get you a human-readable summary of the error, but not enough detail. However, that summary will include the address of the NSError's userInfo dictionary. Say the address is 0x123456; type po (id)0x123456 into the console. You will be presented with a dump of the dictionary, from which you can (probably) glean the details of what went wrong. Thank you for your reply Fritz. I am sorry but I did not make myself clear in my original post. If you try and print object using po it throws an exception. The console output from gdb was: 2009-07-15 23:47:19.684 BookmarkManager[298:5ab3] ### saveBookmarkData called [Switching to process 298 thread 0x5ab3] [Switching to process 298 thread 0x5ab3] (gdb) po err Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_PROTECTION_FAILURE at address: 0x 0x922e668c in objc_msgSend () The program being debugged was signaled while in a function called from GDB. GDB has restored the context to what it was before the call. To change this behavior use set unwindonsignal off Evaluation of the expression containing the function (_NSPrintForDebugger) will be abandoned. (gdb)? I agree that printing the objects on the console via the gdb prompt is the best bet, but when debugging it is often quicker to move the cursor over a variable and read the tooltip that appears at least for strings and numbers. When the tooltip appears a menu is available the first item of which is Print Description which seems to do the same job as po although I would be happy to know if that is true or whether po is better. So the problem is that trying to po the NSError leads to a failure, which is why I surmised that the error was not? properly initialized. The userInfo dictionary instance is nil for example in the NSError which may be what is causing the problem. Anyway my original question still remains - how is one to debug this problem given the lack of info from the system? (You might have a look into your mail client; it's inserting a distracting amount of extraneous white space.) Yes unfortunately I only have access to webmail during the week and the client seems to adds lots of whitespace. Thank you, Tim Mowlem ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Japanese Language
On Jul 15, 2009, at 5:36 PM, Development wrote: Ok, I lucked out and got a great chance at releasing a bit of software in japan. The problem is that it is 50/50 client to web. My primary concerns are string translation from iPhoneOS to data being stored in a mysql database. I have spent quite a bit of time googling and am still not sure but is the japanese data that will be sent from my application to my server utf-8? Or is it utf-16 as I for some reason thought. Everything sent to the server is pre encoded for transport, stored and then unencoded by the app so I feel at least a level of confidence that if I encode with the correct string encoding my server side will just accept and store the data. I dunno. Maybe I'm completely confused. You'll want to first understand the encoding of your endpoints and then pick an appropriate transport encoding. In terms of MySQL, you can define the encoding of a column to be something like this: varchar(100) character set UTF8 Or, pick whatever encoding you deem appropriate (perhaps UTF-16?) On the iPhone, all textual data in memory (e.g. NSString) will be UTF-16. If you store data in files on the iPhone, you'll want to store them in some well-known encoding. This will typically be UTF-16 especially if you simply archive NSString objects. As for the transport, I would highly recommend UTF-8 as no byteswapping is needed. For most Latin-based data, the number of bytes taken up in UTF-8 will be less than what is used by UTF-16. For Japanese (and many other languages), the number of bytes of UTF-8 will be more than UTF-16. Just wanted to point that out in case you have insanely strict bandwidth requirements. Then, it's just a matter of calling the correct APIs at each endpoint to ensure you don't mangle the text. ___ Ricky A. Sharp mailto:rsh...@instantinteractive.com Instant Interactive(tm) http://www.instantinteractive.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Reference Count Underflow when Writing PDF
In an effort to get out of this problem, I also thought I might just take a data representation of the PDFDocument object, and write the data to a file. I get the same problem. Here is what I tried, substituting for [savedDoc writeToFile:@newFile.pdf] below: NSData *myData = [savedDoc dataRepresentation]; [myData writeToFile:@newfile.pdf options:0 error:error]; The malloc error is triggered on the -dataRepresentation line. So, three questions: (1) Contrary to my first message, it appears to me now that PDFDocument inherits from NSObject. So, i shouldn't have to do any special memory management, right? (2) The malloc error doesn't seem to stop the program, and everything is written to the appropriate file. Can I just leave the code as it is and ignore the error, or will it eventually catch up with me? (3) Is there another way to do what I've tried to do, I guess not using PDFDocument (if that is indeed the culprit, and not my own code)? Thanks, Darcy On 15-Jul-09, at 2:00 PM, K.Darcy Otto wrote: I have a PDF that I've loaded, combined with another PDF, and now I'm ready to save the result as a new file. My program is using garbage collection, but I understand that PDFKit is not garbage collected. The problem is that I get reference count underflow error when writing the PDF. Here is some code that is shorter, but creates the same problem I'm having: // Get PDF from disc NSData *savedData = [[NSData alloc] initWithContentsOfFile:@oldfile.pdf options:0 error:error]; PDFDocument *savedDoc = [[PDFDocument alloc] initWithData:savedData]; // Write saveDoc to file [savedDoc writeToFile:@newfile.pdf]; Actually, there is no problem when writing the file: newfile.pdf is intact after the operation. But I get the following error in the console: malloc: reference count underflow for 0x13464c0, break on auto_refcount_underflow_error to debug. And when I break on auto_refcount_underflow, I get the following stack: #0 0x94721a40 in auto_refcount_underflow_error #1 0x9472d8e4 in Auto::Zone::dec_refcount_small_medium #2 0x9472d9b0 in Auto::Zone::block_decrement_refcount #3 0x931da50c in CFRelease #4 0x904bfe4c in -[PDFDocument(PDFDocumentInternal) writeToConsumer:withOptions:] #5 0x904bd9fc in -[PDFDocument writeToURL:withOptions:] #6 0x904bd97c in -[PDFDocument writeToFile:withOptions:] #7 0x6b60 in -[MyDocument openPanelDidEnd:returnCode:contextInfo:] at MyDocument.m:495 Now, #3 suggests there is a release going on that shouldn't be; or at least there should be an extra retain in my code. But when I add CFRetain(savedDoc); before writing the file, the error still persists. I've read the Semantics section of Using Core Foundation with Garbage Collection, but I don't see a solution to this problem there (I'm not saying it's not there, just that I don't quite see it). Any help would be greatly appreciated. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/dotto%40csusb.edu This email sent to do...@csusb.edu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Dictionary interface
On 16/07/2009, at 3:26 AM, Phillip Mills wrote: I've been searching the Cocoa documentation pages on extending and interfacing with Apple applications, hoping to find notes related to the Dictionary application. An API that finds words using a soundex- type function would be nice. That, plus a plugin method to add a UI item similar to Dictionary and Thesaurus would be ideal. It's off at a tangent to your question, but I have written a nice NSString category for matching strings based on Soundex and Jaro- Winkler distances that works quite nicely. It only compares single strings rather than search against a list of words, but it's a step in the right direction. If you're interested in it I can post it. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Efficiency of loading Localizable.strings and NSUserDefaults
On 16/07/2009, at 6:45 AM, Development wrote: Anyone has some comments or ideas about this? Possibly someone with some inner understanding of how localized strings are read? Optimise later. You are fretting about the speed of loading strings to the point where you are considering your own look-up scheme - a problem that Cocoa has already solved for you. And all without doing any measurement (presumably - you don't mention any profiling figures). Here's a fact - *drawing* a string takes aeons compared to the time needed to get that string in place ready to be drawn. So no matter how fast you load the strings, your performance will be graphics/drawing time bound. You mention these being error strings - I find it hard to imagine why performance here matters. Are you wishing to display errors at hundreds of frames per second? How is the user expected to read them? Keep your code simple - use the NSLocalizedString macro or one of the localised string loading methods and worry about performance later if it proves (by actual measurement) necessary. Again, anyone has thoughts or comments about the inner working of NSUserDefaults? Same thing. Read from the defaults as needed. As far as I can tell, NSUserDefaults is basically a disk-backed dictionary, and is kept in memory. Access can be assumed to be fast, or at least fast enough, unless actual measurement shows otherwise. As for flushing to disk every time in case of a crash, I'd say don't even if that is Apple's apparent advice [citation needed]. Your app should not crash - concentrate on fixing it if it has a tendency to, rather than introduce performance bottlenecks that could affect your whole app all the time, just in case. Two wrongs don't make a right. Don't sweat the details - code simply. Measure. Optimise *if necessary*. I bet you'll find it won't be, and you've saved yourself a ton of work (and sweat). --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
[iPhone] Encrypting data of an iPhone Application / Converting J2ME App functionality
Hi, I am still learning iPhone application development and I want to convert a J2ME trading client application to an iPhone SDK application. I have already developed an iPhone application that did not have any encryption published at Apple AppStore. I have good knowledge with J2ME so I could understand what is happening within it. But I have an issue when I am thinking about converting that to iPhone one. J2ME application uses BouncyCastle http://www.bouncycastle.org/J2ME crypto API to encrypt strings. The client sends this to J2EE server. I haven't got much idea about encryption stuff. And I found that iPhone has CommonCrypto called library to encrypt information. Could anyone kindly tell that could I use this for my purpose. I mean will it work with the Java Server. I do not have much idea about Server part as well. But I could understand the J2ME client. I would be glad if any of you kindly point out some places or method to do encryption I need for my application. Will it work with Common Crypto ? Kind Regards, Tharindu ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Printing a View [solved]
Thanks Matt, for the advice. I followed your links, and found the best way, for me at least, to print what I wanted was to create a view in IB, populate a custom view with text fields and tables, and then resize that view for printing. For those who are working on a similar problem, I created new view controller object from -printOperationWithSettings:, and that view object in turn creates the view that I want to print. That view implements various other subviews, but I was still having problems breaking pages at appropriate points. The subviews, however, can say where they should be broken by using -adjustPageHeightNew:. In my NSTableView subclass, which was the main element in the view, I implemented that method as follows: -(void)adjustPageHeightNew:(CGFloat *)newBottom top:(CGFloat)top bottom:(CGFloat)proposedBottom limit:(CGFloat)bottomLimit { *newBottom = proposedBottom; NSInteger indexCount = [deduction lineCount]-1; for (NSInteger i = indexCount; i0; i--) { NSRect rowRect = [self frameOfCellAtColumn:[self columnWithIdentifier:@MyColumn] row:i]; float bottomOfRow = rowRect.origin.y + rowRect.size.height; if (bottomOfRow proposedBottom) { *newBottom = bottomOfRow + 1.0; break; } } } So, the for loop just goes through the table and adjusts *newBottom so that it breaks at appropriate places. There is probably some more efficient way to check where the page should be broken, but the above implementation works just fine. On 13-Jul-09, at 5:16 PM, Matt Neuburg wrote: On Mon, 13 Jul 2009 10:07:17 -0700, K. Darcy Otto do...@csusb.edu said: Now, this should simply print a line of integers down the left side of the page. It does this for two pages - works perfectly - with lines 0 to 50 on the first page, and 51 to 100 on the second page, divided correctly so there is no splitting of lines and so on. But the rest of the pages are blank, and I can't figure out why. The NSLog from - Again, you're not providing enough information, but here are some questions to ask yourself. * What's printing is a view. How tall is that view? Is it tall enough to contain 500 lines? * Also: In drawRect:(NSRect)rect, what is rect? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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: Printing a View [solved]
On 16/07/2009, at 2:23 PM, K. Darcy Otto wrote: There is probably some more efficient way to check where the page should be broken, but the above implementation works just fine. Working code is always worth much more than theoretical code, but if your table has a constant height per row, you can simply take the proposed page height modulo the row height to find the amount over, then subtract it to get the new page height that will fit an exact whole number of lines. It will be much faster than looping if you have many lines. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Japanese Language
Ricky Sharp wrote: As for the transport, I would highly recommend UTF-8 as no byteswapping is needed. For most Latin-based data, the number of bytes taken up in UTF-8 will be less than what is used by UTF-16. For Japanese (and many other languages), the number of bytes of UTF-8 will be more than UTF-16. Just wanted to point that out in case you have insanely strict bandwidth requirements. Depending on what the server and client are using as the transport protocol, it may support a compressed encoding. For example, HTTP 1.1 has a gzip option for content encoding (also compress and deflate, but in my experience gzip is more often seen). See sec. 3.5 Content Codings of RCC2616. http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html In general, a client states its supported encodings and the server chooses, or the two participants negotiate. Again, this depends on what the transport protocol is: not all of them support compression. -- GG ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. 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
Creating methods with variable length arguments terminated by nil
Hi all, I want to add the following category method to NSString: - (BOOL) isEqualToAnyStringIn:(NSString*) firstString, ... NS_REQUIRES_NIL_TERMINATION; I've used some of Cocoa's headers for examples of how to declare this, as above, but I'm not sure how the actual implementation should go. I want to use the method like this: match = [str isEqualToAnyStringIn:@CAT, @DOG, @BIRD, nil]; --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Creating methods with variable length arguments terminated by nil
On Thu, Jul 16, 2009 at 12:36 AM, Graham Coxgraham@bigpond.com wrote: I want to add the following category method to NSString: - (BOOL) isEqualToAnyStringIn:(NSString*) firstString, ... NS_REQUIRES_NIL_TERMINATION; I've used some of Cocoa's headers for examples of how to declare this, as above, but I'm not sure how the actual implementation should go. I want to use the method like this: match = [str isEqualToAnyStringIn:@CAT, @DOG, @BIRD, nil]; Nothing hard about it! http://developer.apple.com/qa/qa2005/qa1405.html ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Creating methods with variable length arguments terminated by nil
On 16/07/2009, at 3:42 PM, Stephen J. Butler wrote: On Thu, Jul 16, 2009 at 12:36 AM, Graham Coxgraham@bigpond.com wrote: I want to add the following category method to NSString: - (BOOL) isEqualToAnyStringIn:(NSString*) firstString, ... NS_REQUIRES_NIL_TERMINATION; I've used some of Cocoa's headers for examples of how to declare this, as above, but I'm not sure how the actual implementation should go. I want to use the method like this: match = [str isEqualToAnyStringIn:@CAT, @DOG, @BIRD, nil]; Nothing hard about it! http://developer.apple.com/qa/qa2005/qa1405.html Excellent! - thank you. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com