capture console output

2010-04-22 Thread Billy Flatman
Hi all, I'd like to be able to capture the output from console after running a command. My Googling investigations have lead me to using 'popen'. FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. I know there are other

Re: capture console output

2010-04-22 Thread Dave Keck
FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. What exactly isn't working? Maybe this helps: NSString *fullPathToDatabase = @/Users/dave/test.db; NSTask *sqliteTask = [[NSTask alloc] init]; NSPipe

Re: capture console output

2010-04-22 Thread Billy Flatman
Hi Dave, Thanks for that, just what I was looking for. Cheers, Billy. On 22 Apr 2010, at 11:04, Dave Keck wrote: FILE *file = popen(sqlite3 test.db .tables,r); However, I've not been able to read the information from the returned file. What exactly isn't working? Maybe this helps:

Re: Determining preferred localizations

2010-04-22 Thread Rainer Brockerhoff
At 12:02 -0700 21/04/10, cocoa-dev-requ...@lists.apple.com wrote: From: Gregory Weston gwes...@mac.com Date: Wed, 21 Apr 2010 09:59:48 -0400 Message-ID: a977463a-b8f0-4b24-9284-03012bee3...@mac.com I'm trying to display a localized list of attached displays, and getting unexpected results in

Re: Determining preferred localizations

2010-04-22 Thread Gregory Weston
On Apr 22, 2010, at 7:50 AM, Rainer Brockerhoff wrote: At 12:02 -0700 21/04/10, cocoa-dev-requ...@lists.apple.com wrote: From: Gregory Weston gwes...@mac.com Date: Wed, 21 Apr 2010 09:59:48 -0400 Message-ID: a977463a-b8f0-4b24-9284-03012bee3...@mac.com I'm trying to display a localized

Re: NaN Problem Adding Numbers from NSTableView

2010-04-22 Thread Keary Suska
On Apr 21, 2010, at 7:24 PM, Graham Cox wrote: On 22/04/2010, at 12:53 AM, Philip Juel Borges wrote: But some times I need to leave a tableview cell blank and then it writes NaN in the label. If I type in 0 (zero) it adds up the numbers nicely. But I'd rather just leave the selection

Re: NaN Problem Adding Numbers from NSTableView

2010-04-22 Thread Graham Cox
On 23/04/2010, at 12:47 AM, Keary Suska wrote: I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understan...@sum is choking on NaN... Yep, I was thinking that by setting the NaN symbol it would prevent the cell

NSURLConnection Crashes : Mac OS 10.6.3 Edition! (Was: Async NSURLConnection...)

2010-04-22 Thread Jerry Krinock
On 2010 Apr 19, at 21:55, Jeff Johnson wrote: I don't know about the FTP crash, but I believe that the other two crashes are due to a 10.6.3 regression. I've filed rdar://problem/7816615 I can definitely reproduce Jeff's crashes, and tried to isolate factors and relate to my apps, but

App is in Landscape Mode, but main UIWindow still th inks it’s portrait.

2010-04-22 Thread Joshua Garnham
My App runs in landscape mode and I have been converting a CGPoint to the main UIWindow's co-ordinate system. I decided to check this was working all correctly by adding a couple of NSLog's to return the Co-Ordinates before and after it was converted and what I noticed was that before it was

Simple question

2010-04-22 Thread Arnold Nefkens
Hello list, Im quite new, and probably missing something. I want to do a calculation of three fields inside of a entity in CoreData. Below is the code, what is wrong? NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber

Re: Simple question

2010-04-22 Thread Graham Cox
On 23/04/2010, at 1:36 AM, Arnold Nefkens wrote: NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; if (fieldTwo 0) { NSNumber *answer = ((fieldTwo - fieldOne) +

Re: Simple question

2010-04-22 Thread koko
Try this: NSNumber *fieldOne = [managedObject valueForKey:@key1]; NSNumber *fieldTwo = [managedObject valueForKey:@key2]; NSNumber *fieldThree = [managedObject valueForKey:@key3]; NSNumber *answer; if (fieldTwo 0) { answer = ((fieldTwo - fieldOne) + fieldThree);

Re: [NSWindow title] isn't the title

2010-04-22 Thread Reinhard Segeler
Hi, you can use lastPathComponent on the string you received by title and use that as the title for the other window. Am 22.04.2010 um 07:05 schrieb Quincey Morris: This is more of a curiosity than anything else, but ... I have a (non-document) window whose title is set with

Re: Simple question

2010-04-22 Thread Graham Cox
On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me. The problem is that NSNumbers are not NUMBERS. --Graham ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: App is in Landscape Mode, but main UIWi ndow still thinks it’s portrait.

2010-04-22 Thread David Duncan
On Apr 22, 2010, at 8:35 AM, Joshua Garnham wrote: My App runs in landscape mode and I have been converting a CGPoint to the main UIWindow's co-ordinate system. Why? There should generally be no need to convert to the window's coordinate system. UIWindow's co-ordinate system the

Re: Simple question

2010-04-22 Thread koko
Ok. I was just putting answer in a broader scope as the OP indicated that was the problem. I see I must look into NSNumber ... Thx ! -koko On Apr 22, 2010, at 10:11 AM, Graham Cox wrote: On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me.

Re: Problem with CoreAnimation and OpenGL drawing from a safari plugin

2010-04-22 Thread David Duncan
On Apr 22, 2010, at 4:46 AM, varaha murthy wrote: I have a Safari out of process plugin which draws some 3d content using CAOpenGLLayer provided by Sfari by overriding darwInCglContext(). Inside darwInCglContext(), I draw content using opengl and call 'glFlush'(tried CGLFlushDrawable too)

Re: NaN Problem Adding Numbers from NSTableView

2010-04-22 Thread Keary Suska
On Apr 22, 2010, at 9:06 AM, Graham Cox wrote: On 23/04/2010, at 12:47 AM, Keary Suska wrote: I wouldn't think that the formatter would effect the calculation of a key path operator, which is the OP's main issue as I understan...@sum is choking on NaN... Yep, I was thinking that by

Re: Simple question

2010-04-22 Thread Reinhard Segeler
Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this: NSInteger fieldOne = [ [ managedObject valueForKey:@key1] intValue]; // if it's an integer NSInteger fieldTwo = [ [

Re: Determining preferred localizations

2010-04-22 Thread Stephane Madrau
Le 22 avr. 2010 à 18:19, cocoa-dev-requ...@lists.apple.com a écrit : Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code: io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber); CFDictionaryRef theInfo =

Re: App is in Landscape Mode, but main UIWindow st ill thinks it’s portrait.

2010-04-22 Thread Joshua Garnham
The reason I have been doing it is because of a problem I have been having with moving a View. Maybe you could help me with that? The View is supposed to move as my touch moves but the view seems to flicker between to places, as you can see here. And this is the code I have been using. -- Joshua

Re: NSURLConnection Crashes : Mac OS 10.6.3 Edition! (Was: Async NSURLConnection...)

2010-04-22 Thread Gary L. Wade
Instruments adds some extra safeguarding to some of their tools, so you should whittle down your functionality until you know this-or-that code will cause or not cause the crash, depending on inclusion. It's possible what you're seeing is a side-effect that is set up elsewhere and dies in a

Re: NSTableView delete row with key?

2010-04-22 Thread Sean McBride
On Wed, 21 Apr 2010 00:15:44 -0700, Chris Idou said: What would be the appropriate way to have an NSTableView notice that you hit the delete key and delete the current row? My preferred solution is the following: - subclass NSTableView - add the following outlet: IBOutlet NSControl*

Re: Simple question

2010-04-22 Thread jonat...@mugginsoft.com
On 22 Apr 2010, at 17:09, Graham Cox wrote: On 23/04/2010, at 1:59 AM, k...@highrolls.net wrote: Try this: Looks equally incorrect to me. The problem is that NSNumbers are not NUMBERS. If the OP has prior experience with c++ and operator overloading then their confusion might be

Re: Simple question

2010-04-22 Thread Arnold Nefkens
Hi Thanks Yeah the keys are ints and this helps a lot. Thanks again... On 22 apr 2010, at 18:31, Reinhard Segeler wrote: Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You have to calculate it like this:

Re: Simple question

2010-04-22 Thread banane
This is an interesting exercise! I would extract the values of the fields, manipulate them, then assign the contents of Field4 with the answer: int val1 = [managedObject valueForKey:@key1] // etc. for each user entry field1-3 int val4 = val1 + etc. // equation with final assignment to value4

Re: Simple question

2010-04-22 Thread James Montgomerie
You should really use 'integerValue' rather than 'intValue' if you're otherwise using NSIntegers. 'integerValue' will return an NSInteger (which may be 32 or 64 bits wide depending on your platform), but 'intValue' will return a C 'int' (which is always 32 bit on the Mac and iPhone, regardless

Re: Simple question

2010-04-22 Thread Quincey Morris
On Apr 22, 2010, at 10:21, Arnold Nefkens wrote: Yeah the keys are ints and this helps a lot. Thanks again... On 22 apr 2010, at 18:31, Reinhard Segeler wrote: Hi, correct me if I'm wrong, but what you're doing is a calculation with the pointers ( * of NSNumber) not the values. You

Re: NSOperation and WebView

2010-04-22 Thread Hao Lü
On Tue, Apr 20, 2010 at 10:14 AM, Nick Zitzmann n...@chronosnet.com wrote: On Apr 18, 2010, at 4:36 PM, Hao Lü wrote: I am doing some analyzing work on a WebView (going through the DOM, checking links and texts). Since, sometimes this blocks the GUI, I am experimenting using

Re: NSOperation and WebView

2010-04-22 Thread Nick Zitzmann
On Apr 22, 2010, at 12:09 PM, Hao Lü wrote: Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each access. But it did not make a difference. I feel that if it was caused by things related

Re: NSOperation and WebView

2010-04-22 Thread Kyle Sluder
On Thu, Apr 22, 2010 at 11:09 AM, Hao Lü ryan@gmail.com wrote: I did not see such exceptions been thrown, nor any crash Those are two possible responses the code could have. It could also just abort the thread, or perhaps act errantly because data it expects is not the data it has, by

Re: NSOperation and WebView

2010-04-22 Thread Hao L?
That's true. - Hao On Apr 22, 2010, at 11:11 AM, Nick Zitzmann n...@chronosnet.com wrote: On Apr 22, 2010, at 12:09 PM, Hao Lü wrote: Doubt it. I am using a secondary hidden webView dedicated to the background thread. I was not sure if @synchronized would help, so I added anyway upon each

Can't set a cursor on a programmatically created window

2010-04-22 Thread David Preece
Hi, So, I'm programmatically creating a subwindow: self=[super initWithContentRect:rect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:NO]; attaching a view... MyView* cView=[[[PlayBarView alloc] initWithFrame:NSMakeRect(0, 0, 0, 0)] autorelease];

using grand central dispatch and c++ for inter-thread communication

2010-04-22 Thread Joel Reymont
Here's my write-up on using GCD with C++ for inter-thread communication: http://wagerlabs.com/grand-central-dispatch-c-and-inter-thread-com I wrote a user land USB driver, put in a framework and made the framework start the driver thread upon initialization. I then proceeded to use Grand

NSApplicationMain question

2010-04-22 Thread Bill Appleton
hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events and upon quit i need to call some shutdown code are there some docs on this issue? examples? advice? thanks, bill appleton

Filling edges of NSView-customized NSMenu

2010-04-22 Thread Yuriy Shevyrov
Hi all, Does exist any way to fill top and bottom edges of pop-up NSMenu in a specified color? I perform porting of one carbon application to cocoa, to be 64-bit compatible. The problem is that the old application has dark-background menus, and when I tried to do the same thing under

Problem with CoreAnimation and OpenGL drawing from a safari plugin

2010-04-22 Thread varaha murthy
Hi All, I hope I am in the right mailing list. Please point me to the correct one if not. I have a Safari out of process plugin which draws some 3d content using CAOpenGLLayer provided by Sfari by overriding darwInCglContext(). Inside darwInCglContext(), I draw content using opengl and call

Re: UIResponder Woes

2010-04-22 Thread Dylan Copeland
I have a UIView subclass that overrides UIResponder's touchesMoved: message. I've noticed that when I swipe my finger very quickly across the UIView, my touchesMoved: message only gets called every so often and not constantly getting messaged. Any ideas? Thanks. On Apr 21, 2010, at 3:03

Re: NSApplicationMain question

2010-04-22 Thread Kyle Sluder
On Wed, Apr 21, 2010 at 3:50 PM, Bill Appleton billapple...@dreamfactory.com wrote: with NSApplicationMain i need to know how to call some startup code before receiving events and upon quit i need to call some shutdown code Can't you do it in main before/after calling NSApplicationMain? --Kyle

Re: NSApplicationMain question

2010-04-22 Thread Abhinay Kartik Reddyreddy
Try the NSApplicationDelegate . On Apr 21, 2010, at 6:50 PM, Bill Appleton wrote: hi all, i am converting from carbon to cocoa with NSApplicationMain i need to know how to call some startup code before receiving events use -applicationWillFinishLaunching and upon quit i need to

Re: Filling edges of NSView-customized NSMenu

2010-04-22 Thread Peter Ammon
On Apr 22, 2010, at 3:33 AM, Yuriy Shevyrov wrote: Hi all, Does exist any way to fill top and bottom edges of pop-up NSMenu in a specified color? I perform porting of one carbon application to cocoa, to be 64-bit compatible. The problem is that the old application has

setValue:forKey: and to-many relationships

2010-04-22 Thread Dave DeLong
Hi everyone, I'm working with some NSManagedObjects and relationships between them. When my code runs, I generate the appropriate key based on the data that I'm parsing. For non-relationship attributes, I can simply do: [myManagedObject setValue:aValue forKey:key]; My question is about

Re: NSApplicationMain question

2010-04-22 Thread Bill Appleton
hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on the event model thanks, bill On Thu, Apr 22, 2010 at 12:39 PM, Abhinay

Re: NSApplicationMain question

2010-04-22 Thread Abhinay Kartik Reddyreddy
What evets are you looking for...?? all events in the event loop...?? or soem specific events?? you get key and mouse events inside NSView. If you are looking to capture events at NSWindow or NSApp level override sendevent method - (void) sendEvent:(NSEvent *)cocoaEvent On Apr 22,

Re: setValue:forKey: and to-many relationships

2010-04-22 Thread Keary Suska
On Apr 22, 2010, at 2:28 PM, Dave DeLong wrote: I'm working with some NSManagedObjects and relationships between them. When my code runs, I generate the appropriate key based on the data that I'm parsing. For non-relationship attributes, I can simply do: [myManagedObject setValue:aValue

Re: Can't set a cursor on a programmatically created window

2010-04-22 Thread Sean McBride
On Wed, 21 Apr 2010 12:12:06 +1200, David Preece said: And was expecting my implementation of resetCursorRects to be called on MyView but it's not. I've called 'areCursorRectsEnabled' on the subwindow and it returns YES. I also have lots of very similar code running in other views for the parent

Re: NSApplicationMain question

2010-04-22 Thread Bill Appleton
when you say *you get key and mouse events inside NSView* that is only by subclassing? or can you use a delegate? thx bill On Thu, Apr 22, 2010 at 1:39 PM, Abhinay Kartik Reddyreddy karthikredd...@gmail.com wrote: What evets are you looking for...?? all events in the event loop...??

Re: NSApplicationMain question

2010-04-22 Thread Kyle Sluder
On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: do i have to subclass NSWindow to get events, or can I use delegates? Subclassing NSWindow is very rare. i'm still a bit confused on the event model Rather than trying to shoehorn your Carbon event model into

Forcing plist preferences file to be saved as text?

2010-04-22 Thread Laurent Daudelin
Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. Thanks! -Laurent. -- Laurent Daudelin AIM/iChat/Skype:LaurentDaudelin

Re: Forcing plist preferences file to be saved as text?

2010-04-22 Thread Jean-Daniel Dupas
Le 22 avr. 2010 à 23:36, Laurent Daudelin a écrit : Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. I don't think so. NSUserDefault

Re: Forcing plist preferences file to be saved as text?

2010-04-22 Thread Dave Keck
Out of curiosity, why would you use the less efficient and larger XML format ? Human-readability I would imagine. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the

Re: NSApplicationMain question

2010-04-22 Thread Shawn Erickson
On Thu, Apr 22, 2010 at 1:34 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the feedback i wrote a subclass for NSWindow but now i am wondering how usefull that was do i have to subclass NSWindow to get events, or can I use delegates? i'm still a bit confused on

Re: Forcing plist preferences file to be saved as text?

2010-04-22 Thread Shawn Erickson
On Thu, Apr 22, 2010 at 2:36 PM, Laurent Daudelin laurent.daude...@gmail.com wrote: Is there any way to force the NSUserDefaults instances to save preferences of an application as a text-only plist file in 10.5 as it does on 10.6? For some reason, that seems to be happening only on 10.5. /me

Re: NSApplicationMain question

2010-04-22 Thread Bill Appleton
hi all, thanks for the great advice for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is to replace WindowRef

Re: NSApplicationMain question

2010-04-22 Thread Jack Carbaugh
Before you go any further, i highly recommend purchasing a book as suggested previously. I recommend the book by Hillegass Work through a few samples from the book and you will better understand apples documentation. I'm working the other side ... writing windows code with a mac

Re: Strange autoreleased with no pool in place message

2010-04-22 Thread Scott Ribe
FYI, your crash was not because you had no autorelease pool in place. That would just cause some objects to never be reclaimed, which for a debug-only build is not necessarily anything to worry about. Your crash would have been because you were using [NSString stringWithFormat...] before the

Wave form graph through Core Audio?

2010-04-22 Thread Izak van Langevelde
I'm working on generating a wave form for a sound bite, but I'm stuck in Core Audio, which seems to be not over-documented, so to speak. All I need for now is an array of integers, based on some sample rate, for a given sound file, but most of Core Audio seems to target more complex

Re: Wave form graph through Core Audio?

2010-04-22 Thread Kyle Sluder
On Thu, Apr 22, 2010 at 4:37 PM, Izak van Langevelde eezac...@xs4all.nl wrote: I'm working on generating a wave form for a sound bite, but I'm stuck in Core Audio, which seems to be not over-documented, so to speak. This question is more appropriate for the coreaudio-api list. --Kyle Sluder

Re: Forcing plist preferences file to be saved as text?

2010-04-22 Thread Jens Alfke
On Apr 22, 2010, at 3:15 PM, Dave Keck wrote: Out of curiosity, why would you use the less efficient and larger XML format ? Human-readability I would imagine. 'defaults read' or 'plutil' will do for that. The files are stored in binary because it's more efficient. This was a

Re: NSApplicationMain question

2010-04-22 Thread Jens Alfke
On Apr 22, 2010, at 3:45 PM, Bill Appleton wrote: for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big changes to the overall structure of the program so like step one is

Re: Determining preferred localizations

2010-04-22 Thread Gregory Weston
On Apr 22, 2010, at 12:45 PM, Stephane Madrau wrote: Le 22 avr. 2010 à 18:19, cocoa-dev-requ...@lists.apple.com a écrit : Thanks, but no. What I'm passing in is the keys for the dictionary I get as a result of this code: io_connect_t thePort = CGDisplayIOServicePort(theScreenNumber);

Re: UIResponder Woes

2010-04-22 Thread Fritz Anderson
On 22 Apr 2010, at 8:18 AM, Dylan Copeland wrote: I have a UIView subclass that overrides UIResponder's touchesMoved: message. I've noticed that when I swipe my finger very quickly across the UIView, my touchesMoved: message only gets called every so often and not constantly getting

Re: NSApplicationMain question

2010-04-22 Thread Graham Cox
On 23/04/2010, at 8:45 AM, Bill Appleton wrote: so like step one is to replace WindowRef with NSWindow and watch the carnage ensue Which it certainly will, so why bother wasting your time? I came from a Carbon (in fact classic toolbox before that) background and have been doing Cocoa now

Re: NSApplicationMain question

2010-04-22 Thread Michael Ash
On Thu, Apr 22, 2010 at 6:45 PM, Bill Appleton billapple...@dreamfactory.com wrote: hi all, thanks for the great advice for better or worse i am porting a large piece of enterprise software from carbon/windows to cocoa/windows most of the code is platform independent, but i can't make big