Re: Getting a bezier path for a character

2010-04-29 Thread Ken Ferry
On Thu, Apr 29, 2010 at 11:46 PM, Ken Ferry wrote: > On Thu, Apr 29, 2010 at 10:28 PM, Graham Cox wrote: > >> >> On 30/04/2010, at 2:21 PM, danchik wrote: >> >> > mine did not, >> >> Did not what? >> >> >> > so I think I might have used context incorrectly: >> > >> > I had a different context to

Re: Getting a bezier path for a character

2010-04-29 Thread Ken Ferry
On Thu, Apr 29, 2010 at 10:28 PM, Graham Cox wrote: > > On 30/04/2010, at 2:21 PM, danchik wrote: > > > mine did not, > > Did not what? > > > > so I think I might have used context incorrectly: > > > > I had a different context to draw into so the code was : > > > > [NSGraphicsContext saveGraphic

Re: Getting a bezier path for a character

2010-04-29 Thread danchik
did not get restored without inverting and concating the transform (not until adding another save/restore after loading new context) - Original Message - From: "Graham Cox" To: "danchik" Cc: "Cocoa-Dev List" Sent: Thursday, April 29, 2010 10:28 PM Subject: Re: Getting a bezier path

How to get tapped text from UITextView

2010-04-29 Thread Sasikumar JP
Hi, I am working on a iPhone Application. I want to implement the following feature in my app, but i don't know how to implement it. I want to display the read-only text content in UITextView, where user can tap any word in the text. It should take the user to next screen to disp

Re: Getting a bezier path for a character

2010-04-29 Thread Graham Cox
On 30/04/2010, at 2:21 PM, danchik wrote: > mine did not, Did not what? > so I think I might have used context incorrectly: > > I had a different context to draw into so the code was : > > [NSGraphicsContext saveGraphicsState]; > [NSGraphicsContext setCurrentContext:MyActualContext]; > > //

Re: Getting a bezier path for a character

2010-04-29 Thread danchik
mine did not, so I think I might have used context incorrectly: I had a different context to draw into so the code was : [NSGraphicsContext saveGraphicsState]; [NSGraphicsContext setCurrentContext:MyActualContext]; // do the text draw/rotate [NSGraphicsContext restoreGraphicsState]; I was und

Re: Getting a bezier path for a character

2010-04-29 Thread Graham Cox
On 30/04/2010, at 1:18 PM, danchik wrote: > by 'reverse' i meant : > [transform invert]; > [transform concat]; > > since i'd have to first > [transform transformXBy:yBy]; > [transform rotateByDegrees:]; > [transform concat]; > [myAttrString drawWithRect:options:] An alternative is to bracket t

Re: Getting a bezier path for a character

2010-04-29 Thread danchik
by 'reverse' i meant : [transform invert]; [transform concat]; since i'd have to first [transform transformXBy:yBy]; [transform rotateByDegrees:]; [transform concat]; [myAttrString drawWithRect:options:] - Original Message - From: "Graham Cox" To: "danchik" Cc: "Cocoa-Dev List" Sen

Re: va_end() & [NSString initWithFormat:arguments:]

2010-04-29 Thread Patrick M. Rutkowski
Ah, that's pretty clear cut then. Got it, thanks :-) On Thu, Apr 29, 2010 at 10:49 PM, Ken Thomases wrote: > On Apr 29, 2010, at 9:44 PM, Patrick M. Rutkowski wrote: > >> Do I have to do a va_end() after using -[NSString initWithFormat:arguments:]? > > If you call va_start(), you need to call va_

test if folder contains file based on NSURLs

2010-04-29 Thread Rainer Standke
Hello, I have a bunch of NSURLs for existing files on the system, and a smaller number of NSRURLs for their enclosing folders. I am looking to determine if a given file is within a given folder, based on their URLs. Right now I am thinking that I'll have to create the enclosing folder's URL by

Re: NSTask objectalloc problem

2010-04-29 Thread Shawn Erickson
On Thu, Apr 29, 2010 at 6:04 PM, Tom Foutz wrote: > Worked like a charm.  I used waitUntilExit, and the number of living > objects dropped immediately.  Thanks! Note calling waitUntilExit without also draining stdout/err of the running process _could_ cause you problems. If the process you run ou

Re: Getting a bezier path for a character

2010-04-29 Thread Graham Cox
On 30/04/2010, at 12:43 PM, danchik wrote: > do I have to explicitly transform the context with [transform concat] then > draw the string and reverse it? Yes, just set up the transform to orient the text how you want it. The layout of the text is independent of this, and there is no way to sp

Re: va_end() & [NSString initWithFormat:arguments:]

2010-04-29 Thread Ken Thomases
On Apr 29, 2010, at 9:44 PM, Patrick M. Rutkowski wrote: > Do I have to do a va_end() after using -[NSString initWithFormat:arguments:]? If you call va_start(), you need to call va_end(). From the stdarg(3) man page: "Note that each call to va_start() must be matched by a call to va_end(), from

va_end() & [NSString initWithFormat:arguments:]

2010-04-29 Thread Patrick M. Rutkowski
Do I have to do a va_end() after using -[NSString initWithFormat:arguments:]? The docs don't seem to say: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Classes/NSString_Class/Reference/NSString.html#//apple_ref/doc/uid/2154-initWithFormat_arguments_ -Patrick

Re: Getting a bezier path for a character

2010-04-29 Thread danchik
Thank You also (now unrelated to the paths) when drawing strings into context using NSAttributedStrings is there a way to specify that the text is to be drawn vertically with the Font attribute or some attribute on NSAttributedString directly? or do I have to explicitly transform the context

Re: NSTask objectalloc problem

2010-04-29 Thread Tom Foutz
Worked like a charm. I used waitUntilExit, and the number of living objects dropped immediately. Thanks! -- Tom ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the mod

Re: Help with text input

2010-04-29 Thread Douglas Davidson
On Apr 29, 2010, at 5:26 PM, Charles Srstka wrote: > On Apr 29, 2010, at 5:38 PM, Jens Alfke wrote: > >> - (void) keyDown: (NSEvent*)event { >> event.characters; >> event.isARepeat; >> } > > I don’t think that will do the special characters that you can type via the > Option key. Wha

Re: Help with text input

2010-04-29 Thread Charles Srstka
On Apr 29, 2010, at 5:38 PM, Jens Alfke wrote: > - (void) keyDown: (NSEvent*)event { > event.characters; > event.isARepeat; > } I don’t think that will do the special characters that you can type via the Option key. What you want to do is to make your text view conform to the NSText

Re: Seeking a graceful way to end a program

2010-04-29 Thread Jens Alfke
On Apr 29, 2010, at 3:53 PM, Paul Johnson wrote: When I used the latter and ran the program from Xcode, the program terminated but Xcode was not informed of that fact. (I had to click on the red stop sign in Xcode to tell it the program had ended. Maybe this is a bug -- looks like that to me at

Re: NSKeyedArchiver and NSPoints

2010-04-29 Thread Michael Ash
On Thu, Apr 29, 2010 at 12:55 AM, Quincey Morris wrote: > On Apr 28, 2010, at 20:49, Michael Ash wrote: > >> Actually, while there are finite decimal numbers with no finite binary >> representation, the reverse is not true. Every binary number can be >> represented by a finite number of decimal di

Re: NSTask objectalloc problem

2010-04-29 Thread Michael Ash
On Wed, Apr 28, 2010 at 2:16 PM, Tom Foutz wrote: > I am trying to run a back-up type of unix script whenever a file > changes in the directory.  However, my implementation, when viewed in > "Instruments" with "ObjectAlloc", demonstrates an ever-increasing > number of living objects. > > A problem

Re: Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
Thanks, Jens, that was what I needed. I did use "exit(0)" instead of "exit(1)" though. When I used the latter and ran the program from Xcode, the program terminated but Xcode was not informed of that fact. (I had to click on the red stop sign in Xcode to tell it the program had ended. Maybe this is

Re: Help with text input

2010-04-29 Thread Jens Alfke
On Apr 29, 2010, at 3:06 PM, Bill Appleton wrote: i have been looking in NSResponder and see some of this, but how do i get the higher level messages like the unicode string and key repeats ? - (void) keyDown: (NSEvent*)event { event.characters; event.isARepeat; } —Jens

Re: Help with threads and queues

2010-04-29 Thread Paul Franz
Thanks. That looks like what I am looking for. Note: I didn't know that about NSOperationQueue. Paul Franz On Thu, Apr 29, 2010 at 6:00 PM, Dave DeLong wrote: > If you're worried about cross-platform compatibility, then use > NSOperationQueue and NSOperations.  The fundamental idea is identica

Help with text input

2010-04-29 Thread Bill Appleton
hi all, under carbon events i had text messages like: kEventClassTextInput, with kEventTextInputUnicodeForKeyEvent --> this let me get entire unicode strings that were the result of multiple key presses kEventClassKeyboard with kEventRawKeyModifiersChanged: kEventRawKeyDown: kEventRawKeyUp:

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
If you're worried about cross-platform compatibility, then use NSOperationQueue and NSOperations. The fundamental idea is identical (dispatch_queue = NSOperationQueue, dispatch_block = NSOperation), and on the platforms that have it, they've been re-written to use Grand Central Dispatch. The o

Re: Help with threads and queues

2010-04-29 Thread David Duncan
On Apr 29, 2010, at 2:41 PM, Paul Franz wrote: > Do you know if it is available on the iPad? I think it is because according > the Mac Rumors website says so. I would recommend against reading rumor sites for determining supported API :). GCD and Blocks are not available on iPhone OS 3.2. -- Da

Re: Help with threads and queues

2010-04-29 Thread Paul Franz
Do you know if it is available on the iPad? I think it is because according the Mac Rumors website says so. This is a back end code for a online board game and I am trying to port it over to the iPad. I figured the back end is the best place to start (i.e. avoid UI at the moment which will be a to

Re: Seeking a graceful way to end a program

2010-04-29 Thread Jens Alfke
On Apr 29, 2010, at 12:56 PM, Paul Johnson wrote: I found one possible tip in "Cocoa Design Patterns" (p. 253.) The sample code uses NSRunAlertPanel(). I'd like to display an alert and then perform an exit(1). (Somewhere I need to handle a click on a "Quit" button in the Alert.) Sure. Just ca

Re: Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
In my applicationDidFinishLaunching: I am creating the Application Support directory and I want to handle the case where the directory can't be created. (I am working on an application for my MacBook Pro.) I found one possible tip in "Cocoa Design Patterns" (p. 253.) The sample code uses NSRunAler

Re: Scripting Bridge for GUI scripting?

2010-04-29 Thread has
Louis-Philippe wrote: > I am looking around and I can't find docs about GUI scripting from the > Scripting Bridge... it seems like NSAppleScript would do it, but I would > like it better if I could do it with objective-c logic. Anybody has worked > around something like that? Given that GUI scr

Re: Getting filename in NSDocument readFromData

2010-04-29 Thread Pascal Harris
Sometimes, I find, I get so fixated on one particular solution that I can't see the wood for the trees. Thanks for your response though - it did, at least get me thinking. So, if anyone else has the same (slightly numpty) query, the answer is to forget NSData - remember that we're talking

Re: Strange NSScroller sizing behaviour

2010-04-29 Thread Bill Appleton
hi Jo, i am also working with NSScroller directly i have two types of windows in one type, the vertical bar appears and the horizontal bar is missing in the other type, the opposite situation occurs i am sure they are set to the right bounds, etc. and visible have you looked at NSControl cal

Re: Seeking a graceful way to end a program

2010-04-29 Thread Abhinay Kartik Reddyreddy
On Apr 29, 2010, at 2:31 PM, Paul Johnson wrote: > I would like to have some guidance on the proper way to 'gracefully' > terminate a program that cannot proceed, for example, when some > critical resource can't be created or doesn't exist. > I guess if you cannot create a critical resource you

Re: Seeking a graceful way to end a program

2010-04-29 Thread Sherm Pendley
On Thu, Apr 29, 2010 at 2:46 PM, Markus Spoettl wrote: > On Apr 29, 2010, at 2:31 PM, Paul Johnson wrote: >> I would like to have some guidance on the proper way to 'gracefully' >> terminate a program that cannot proceed, for example, when some >> critical resource can't be created or doesn't exis

Re: Seeking a graceful way to end a program

2010-04-29 Thread Fritz Anderson
On 29 Apr 2010, at 1:31 PM, Paul Johnson wrote: > I would like to have some guidance on the proper way to 'gracefully' > terminate a program that cannot proceed, for example, when some > critical resource can't be created or doesn't exist. > > I've look through all my reference books and searched

Re: Seeking a graceful way to end a program

2010-04-29 Thread Markus Spoettl
On Apr 29, 2010, at 2:31 PM, Paul Johnson wrote: > I would like to have some guidance on the proper way to 'gracefully' > terminate a program that cannot proceed, for example, when some > critical resource can't be created or doesn't exist. > > I've look through all my reference books and searched

Seeking a graceful way to end a program

2010-04-29 Thread Paul Johnson
I would like to have some guidance on the proper way to 'gracefully' terminate a program that cannot proceed, for example, when some critical resource can't be created or doesn't exist. I've look through all my reference books and searched the internet for sample code but have come up empty handed

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
Whoops, that should've been dispatch_async and not dispatch_queue_async. Silly typing code in an email window... Dave On Apr 29, 2010, at 10:26 AM, Dave DeLong wrote: > #import > > //somewhere reasonably accessible to your producer: > dispatch_queue_t mySerialQueue = > dispatch_queue_create(

Re: Help with threads and queues

2010-04-29 Thread Thomas Clement
See the man pages and the Concurrency Programming Guide. man dispatch_queue_create man dispatch_async http://developer.apple.com/mac/library/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html On Apr 29, 2010, at 6:19 PM, Paul Franz wrote: Where can I

Re: Cocoa Newbie & MySQL

2010-04-29 Thread Dru Satori
Yes, Marko's BaseTen is excellent, and the PostgreSQL support for the Mac as a platform is quite good. The only downside really, is that there is an outstanding issue with regards to collation in certain locales on BSD based systems, of which OS X is one, so long as you are us_EN and UTF-8, you

Re: Cocoa Newbie & MySQL

2010-04-29 Thread Joshua Tidsbury
Flavio, > Well... That's a good enough reason. Driving that Sun stuff through exec() > and command-line utilities should be extremely painful and hard to maintain > in the future. > Indeed, I did consider that for about 5 seconds, then smacked myself in the forehead... > Do you really need to u

Re: Help with threads and queues

2010-04-29 Thread Jens Alfke
On Apr 29, 2010, at 5:26 AM, Paul Franz wrote: I am trying to convert my Java code to Objective-C code and I have run into a problem. I have thread, that currently has a socket open and it sits there and send packets of information through the socket. If you want to port existing code with th

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
#import //somewhere reasonably accessible to your producer: dispatch_queue_t mySerialQueue = dispatch_queue_create("franz.p.paul.myserialqueue", NULL); //in your producer: id newResource = ; // the thing you want to notifyAll() about dispatch_queue_async(mySerialQueue, ^{ /** do somet

Re: Help with threads and queues

2010-04-29 Thread Paul Franz
Where xan I find an example of a serial dispatch queue? Sent from my iPhone On Apr 29, 2010, at 11:35 AM, Thomas Clement wrote: Just use a serial dispatch queue (or if you need to run pre-10.6 use an NSOperationQueue with a max concurrent count set to 1) and dispatch operations to the queu

Re: NSTask objectalloc problem

2010-04-29 Thread Jens Alfke
On Apr 28, 2010, at 11:16 AM, Tom Foutz wrote: I am trying to run a back-up type of unix script whenever a file changes in the directory. However, my implementation, when viewed in "Instruments" with "ObjectAlloc", demonstrates an ever-increasing number of living objects. Isn't that because

Re: Help with threads and queues

2010-04-29 Thread Thomas Clement
Just use a serial dispatch queue (or if you need to run pre-10.6 use an NSOperationQueue with a max concurrent count set to 1) and dispatch operations to the queue whenever you want. The operation passed to the queue should write some data to the socket. Thomas On Apr 29, 2010, at 2:26 PM, P

Re: Scripting Bridge for GUI scripting?

2010-04-29 Thread Bill Cheeseman
On Apr 28, 2010, at 3:14 PM, Louis-Philippe wrote: > I am looking around and I can't find docs about GUI scripting from the > Scripting Bridge... it seems like NSAppleScript would do it, but I would > like it better if I could do it with objective-c logic. Anybody has worked > around something

Re: Scripting Bridge for GUI scripting?

2010-04-29 Thread Uli Kusterer
On Apr 28, 2010, at 9:14 PM, Louis-Philippe wrote: > I am looking around and I can't find docs about GUI scripting from the > Scripting Bridge... it seems like NSAppleScript would do it, but I would > like it better if I could do it with objective-c logic. Anybody has worked > around something li

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
You'll basically be writing a custom object to wrap an NSArray in an object with a semaphore to make it threadsafe. Arrays are not threadsafe by default. Cocoa doesn't have a semaphore object beyond the NSLock mutex. However, you can find an implementation of a semaphore here: http://cocoahead

Help with threads and queues

2010-04-29 Thread Paul Franz
I am trying to convert my Java code to Objective-C code and I have run into a problem. I have thread, that currently has a socket open and it sits there and send packets of information through the socket. Currently my queue code uses the wait/notifyAll methods in Java to put the thread into a wait

Scripting Bridge for GUI scripting?

2010-04-29 Thread Louis-Philippe
Hi, I am looking around and I can't find docs about GUI scripting from the Scripting Bridge... it seems like NSAppleScript would do it, but I would like it better if I could do it with objective-c logic. Anybody has worked around something like that? _

NSTask objectalloc problem

2010-04-29 Thread Tom Foutz
I am trying to run a back-up type of unix script whenever a file changes in the directory.  However, my implementation, when viewed in "Instruments" with "ObjectAlloc", demonstrates an ever-increasing number of living objects. A problematic dummy version: ##

Re: Cocoa Newbie & MySQL

2010-04-29 Thread Flavio Donadio
Josh, > Unfortunately, the other key piece of information I have left out is that I > also need to tie into some C based APIs in order to drive some large Sun > robotic tape libraries. I also wish to achieve as high a degree of > concurrency as possible in the file moving/compression processes

Re: Cocoa Newbie & MySQL

2010-04-29 Thread Joshua Tidsbury
Flavio, > > The application is essentially a server side app that will manage various > > background file moving/archiving processes and store metadata about the > > files in a database. The heavy lifting in terms of file analysis and > > moving the materials around and storing the metadata in

Re: advancementForGlyph problem

2010-04-29 Thread David F.
Chris - Thanks for replying. I too wondered if the advancement was being calculated from the glyph's origin instead of (0,0) but there are two strikes against that theory. 1) The docs clearly state that the advancement starts from (0,0) not the glyph's origin. 2) I'm seeing problems even with

Re: advancementForGlyph problem

2010-04-29 Thread Chris Backas
Having never worked with fonts at that level, nor seen these APIs before, my guess may be completely off the wall. You are forewarned ;) I noticed that the 'bounds x' you supply is a negative value. If you add the 'advance w' to the 'bounds x' value, you get approx 23.4, which is pretty clos

Re: Cocoa Newbie & MySQL

2010-04-29 Thread Flavio Donadio
Josh, On Apr 28, 2010, at 10:57 AM, Joshua Tidsbury wrote: > The application is essentially a server side app that will manage various > background file moving/archiving processes and store metadata about the files > in a database. The heavy lifting in terms of file analysis and moving the >

Strange NSScroller sizing behaviour

2010-04-29 Thread Jo Meder
Hi, I'm using NSScrollers directly, e.g. not in an NSScrollView. Using 10.6.3 (haven't checked anything else mind you) I'm seeing some strange behaviour when I try and resize them. I have code similar to the autosizing stuff in Cocoa/IB which, for example, resizes controls as a window resizes.

Newbie question for Video Streaming

2010-04-29 Thread Gustavo Pizano
Hello, Im looking into the dark depths of the API, because I need to stream some video and audio over http, I was reading the HTTP Live Streaming Overview and there its says: "All devices running iPhone OS 3.0 and later include built-in client software." I was asking my friend google, and found

Re: NSKeyedArchiver and NSPoints

2010-04-29 Thread vincent habchi
Le 29 avr. 2010 à 05:49, Michael Ash a écrit : > Actually, while there are finite decimal numbers with no finite binary > representation, the reverse is not true. Every binary number can be > represented by a finite number of decimal digits. I believe this is > because 2 is a factor of 10. To prov

Re: How to clone a CALayer?

2010-04-29 Thread Kyle Sluder
On Thu, Apr 29, 2010 at 1:20 AM, Oleg Krupnov wrote: > Is there a way to clone a CALayer? I need two copies of the same > drawing, which takes a long time to calculate and draw, so I'd prefer > to simply copy the result. A brief look shows that CALayer does not > support -[NSObject copy]. Render

How to clone a CALayer?

2010-04-29 Thread Oleg Krupnov
Hi, Is there a way to clone a CALayer? I need two copies of the same drawing, which takes a long time to calculate and draw, so I'd prefer to simply copy the result. A brief look shows that CALayer does not support -[NSObject copy]. Thanks! ___ Cocoa-d

Re: white screen windows at first

2010-04-29 Thread vincent habchi
Le 28 avr. 2010 à 20:29, Bill Appleton a écrit : > this appears to only work from inside the drawRect routine, if i get here > from some other event it doesn't work > > so is it "legal" to draw on an NSWindow from some other event? > if not, what the heck does QDEndCGContext do that makes it wo