isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Philip Vallone
Hello, I am passing different types of data to NSData (NSString, NSArray, UIImage). I am trying to find out what kind of data t is so I know how to handle the NSData when I receive it. The below code is an example of how I am trying to do this but its always returning null. What am I doing w

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Alexander Spohr
Am 27.05.2010 um 11:21 schrieb Philip Vallone: > > Hello, > > I am passing different types of data to NSData (NSString, NSArray, UIImage). > I am trying to find out what kind of data t is so I know how to handle the > NSData when I receive it. The below code is an example of how I am trying

Problem getting correct file URL in NSTask process

2010-05-27 Thread Antonio Nunes
Hi, I have a daemon that spawns NSTasks on request. A task is passed a number of paths to process. These paths are pased correctly to the task, and in the task I can correctly extract the path string from optarg. When I try to turn the path into a file url however, the resulting URL is not corr

Re: Get controller from nib

2010-05-27 Thread Reinhard Segeler
Hi James, today I read your mail: I ran into a problem with the reference some time ago. I have solved it by posting/observing a notification with the reference as the only object in the userInfo dict.. That works fine and assures, that the reference can be determined exactly. The only pro

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 4:21 AM, Philip Vallone wrote: > I am passing different types of data to NSData (NSString, NSArray, UIImage). > I am trying to find out what kind of data t is so I know how to handle the > NSData when I receive it. NSData is just a byte sequence. It doesn't have any knowle

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 4:33 AM, Antonio Nunes wrote: > I have a daemon that spawns NSTasks on request. A task is passed a number of > paths to process. These paths are pased correctly to the task, and in the > task I can correctly extract the path string from optarg. No, they aren't and no you can

Re: subclass overwriting superclass ivar

2010-05-27 Thread jonat...@mugginsoft.com
On 26 May 2010, at 20:00, Greg Parker wrote: >> > > Mac or iPhone? > iPhone device or iPhone simulator? > 32-bit Mac or 64-bit Mac? > Sorry for the vagueness. 32 bit mac. > My guess is that (1) you're running on iPhone Simulator or 32-bit Mac, and > (2) you recently added an ivar to MGS_A bu

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Antonio Nunes
On 27 May 2010, at 11:52, Ken Thomases wrote: >> I have a daemon that spawns NSTasks on request. A task is passed a number of >> paths to process. These paths are pased correctly to the task, and in the >> task I can correctly extract the path string from optarg. > > No, they aren't and no you

Logging in ad-hoc builds

2010-05-27 Thread Nava Carmon
Hi, I have a problem with NSURLConnection in my ad-hoc build and I'd like to log the problematic url. In debug version i can just output it to console. The question is how do i track it in ad-hoc? It's not about crashing, so crash logs will not help. Any ideas? Thanks in advance Nava Carmo

Re: Logging in ad-hoc builds

2010-05-27 Thread Roland King
Ad hoc. Are you talking about iPhone development? If so then log it to the console and grab the console logs afterwards through Xcode. Remember to take all that stuff out at the end, no point carrying all that log in your phone. On 27-May-2010, at 19:57, Nava Carmon wrote: Hi, I have

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Ken Thomases
On May 27, 2010, at 6:55 AM, Antonio Nunes wrote: > Thanks so much for the elaborate and pertinent answer Ken. You are right. I > was not passing the arguments correctly to the task. You're welcome. Glad I could help. > I was creating the arguments like this: > >[args addObject:[NSString

Re: Problem getting correct file URL in NSTask process

2010-05-27 Thread Antonio Nunes
On 27 May 2010, at 13:15, Ken Thomases wrote: > If, in a shell, you were to invoke a command like: > > /path/to/some/command -f /path/to/file > > Then the program would receive "-f" and "/path/to/file" as separate > arguments. To achieve the same thing with NSTask, you'd pass @"-f" and > @"/p

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Philip Vallone
Ken & Alexander, Thank you so much for your help. Your explanations are extremely helpful. Best regards, Phil On May 27, 2010, at 6:36 AM, Ken Thomases wrote: > On May 27, 2010, at 4:21 AM, Philip Vallone wrote: > >> I am passing different types of data to NSData (NSString, NSArray, UIImag

Activating application raises windows meant to be invisible

2010-05-27 Thread David Reitter
How can I keep invisible windows invisible when my application is raised? My application can end up with only one NSWindow "A" that is invisible ([NSWindow orderOut]). This window is the key window. The application may also have other windows ("B") that are iconified. I find that when switchi

Re: subclass overwriting superclass ivar

2010-05-27 Thread Mike Abdullah
On 27 May 2010, at 12:53, jonat...@mugginsoft.com wrote: >> >> iPhone device and 64-bit Mac should not have this problem. The compiler and >> runtime cooperate to allow the runtime to move the subclass's ivars out of >> the way if the superclass grows. >> http://sealiesoftware.com/blog/archive

behavior of -copy

2010-05-27 Thread Ariel Feinerman
Hi, if i understand, -copy message implement via -retain for true immutable objects like NSNumber, via -alloc, -init thus make true copy for mutable objects like NSMutableArray, my question is: what does -copy for immutable variant of immutable/mutable objects, for instance NSArray *arrayCopy = [a

Re: behavior of -copy

2010-05-27 Thread Mike Abdullah
On 27 May 2010, at 13:59, Ariel Feinerman wrote: > Hi, > > if i understand, -copy message implement via -retain for true immutable > objects like NSNumber, via -alloc, -init thus make true copy for mutable > objects like NSMutableArray, my question is: what does -copy for immutable > variant of

Re: subclass overwriting superclass ivar

2010-05-27 Thread Jean-Daniel Dupas
Le 27 mai 2010 à 13:53, jonat...@mugginsoft.com a écrit : > > > On 26 May 2010, at 20:00, Greg Parker wrote: >>> >> >> Mac or iPhone? >> iPhone device or iPhone simulator? >> 32-bit Mac or 64-bit Mac? >> > Sorry for the vagueness. 32 bit mac. > >> My guess is that (1) you're running on iPho

Re: subclass overwriting superclass ivar

2010-05-27 Thread jonat...@mugginsoft.com
On 27 May 2010, at 14:42, Jean-Daniel Dupas wrote: >> >> >> Is there no build support to help with these sorts of class dependencies? >> Or have I borked my build settings somewhere? > > > If MGS_B is a subclass of MGS_A , it must import the MGS_A header file (else > the compiler will complai

How to filter the NSOpenPanel with "Recommended Applications"

2010-05-27 Thread appleBoy chen
Hi All, I want to show the Panel like Finder's "Choose Application" to let user slect one application to open with the file. Follow is my code: NSOpenPanel *openPanel = [NSOpenPanel openPanel]; [openPanel setCanChooseDirectories:NO]; [openPanel setCanChooseFiles:YES]; [openPanel setAllowsMultipl

Re: behavior of -copy

2010-05-27 Thread Quincey Morris
On May 27, 2010, at 05:59, Ariel Feinerman wrote: > my question is: what does -copy for immutable > variant of immutable/mutable objects, for instance NSArray *arrayCopy = > [array copy]; returns true copy or retains one? The class of the variable 'arrayCopy' is irrelevant. If the instance being

Re: How to filter the NSOpenPanel with "Recommended Applications"

2010-05-27 Thread Quincey Morris
On May 26, 2010, at 19:55, appleBoy chen wrote: > if([openPanel runModalForTypes:[NSArray arrayWithObjects:@"app",nil]] == > NSOKButton) > { > ... > } > > And, I want to only show the supported application for the associated file. > Like Finder's "Choose Application" Panel, it can set Eanble to "

Re: How to filter the NSOpenPanel with "Recommended Applications"

2010-05-27 Thread Sean McBride
On Thu, 27 May 2010 10:55:51 +0800, appleBoy chen said: >I want to show the Panel like Finder's "Choose Application" to let user >slect one application to open with the file. >Follow is my code: > >NSOpenPanel *openPanel = [NSOpenPanel openPanel]; >[openPanel setCanChooseDirectories:NO]; >[openPa

Re: selecting a row of a UITableView programatically

2010-05-27 Thread Alejandro Marcos Aragón
Thanks for answering to my message Luke. I'll try selecting the row in the viewDidLoad method. Regards, aa On May 26, 2010, at 7:34 PM, Luke the Hiesterman wrote: > Since nibs are loaded lazily, controller.unitTableView is probably nil when > you call selectRowAtIndexPath:. > > Luke > > On M

PMSessionGetCurrentPrinter issue

2010-05-27 Thread Shilpi Aggarwal
On Mac printing, I am facing an issue with getting the current printer name for the session. The recommended call to do the same is PMSessionGetCurrentPrinter

Re: Suppressing visibility in the Dock

2010-05-27 Thread Michael Diehr
On May 24, 2010, at 9:19 AM, Ben Haller wrote: > On 24-May-10, at 12:30 AM, Ben Haller wrote: > >> On 24-May-10, at 12:12 AM, Ken Thomases wrote: >> >>> I think you can also get away with using LSBackgroundOnly or LSUIElement >>> and then, when you want it to be a foreground GUI app, use >>>

removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS

2010-05-27 Thread Tony Romano
Below is some code that handles mount and unmount notifications for volumes. During an unmount, I want to remove the item from the NSTreeController's arrangedObjects list. The mount sections works fine, it appends to the tree any new volumes added. When I want to unmount it, I go through the

Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS

2010-05-27 Thread Nick Zitzmann
On May 27, 2010, at 2:58 PM, Tony Romano wrote: > Below is some code that handles mount and unmount notifications for volumes. > During an unmount, I want to remove the item from the NSTreeController's > arrangedObjects list. The mount sections works fine, it appends to the tree > any new vo

Exit( ) necessary? (oalTouch sample project)

2010-05-27 Thread Philip Mobley
I have a question about the oalTouch example project. Specifically the sample code uses the exit( ) function after encountering an error such as in the sample code below. I looked up the OpenAL documentation for alGetError( ) and no where does the OpenAL documentation for alGetError( ) mentio

Re: Exit( ) necessary? (oalTouch sample project)

2010-05-27 Thread Luke the Hiesterman
That is most likely there for simplicity of the code example. Since Touch is in the name, I'm assuming this example is for iPhoneOS? If so, please remember that exit() should never be called in an iPhone program. Only the user should exit your program. Luke On May 27, 2010, at 2:37 PM, Philip

Re: Exit( ) necessary? (oalTouch sample project)

2010-05-27 Thread Philip Mobley
On May 27, 2010, at 2:40 PM, Luke the Hiesterman wrote: > That is most likely there for simplicity of the code example. Since Touch is > in the name, I'm assuming this example is for iPhoneOS? If so, please > remember that exit() should never be called in an iPhone program. Only the > user shou

Re: removeObjectAtArrangedObjectIndexPath EXC_BAD_ACCESS

2010-05-27 Thread Tony Romano
Thanks Nick. On May 27, 2010, at 2:21 PM, Nick Zitzmann wrote: > > On May 27, 2010, at 2:58 PM, Tony Romano wrote: > >> Below is some code that handles mount and unmount notifications for volumes. >> During an unmount, I want to remove the item from the NSTreeController's >> arrangedObjects l

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Graham Cox
On 27/05/2010, at 8:36 PM, Ken Thomases wrote: > if ([obj isKindOfClass:[NSString class]]) > // ... use 'obj' as a string > else if ([obj isKindOfClass:[NSArray class]]) > // ... use 'obj' as an array > // ... etc. ... It might also be worth pointin

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Philip Vallone
Hi Graham, I think Ken's response was exactly what I was looking for. The code snippet I posted was just a small example to illustrate my question and ken's was as well. > Perhaps you just need to archive a data structure at a higher level so that > what pops out when you dearchive is fully for

Re: isKindofClass with NSData and NSKeyUnarchiver

2010-05-27 Thread Graham Cox
On 28/05/2010, at 10:25 AM, Philip Vallone wrote: > The sender can send any type of information (NSString, UIImage etc...). The > receiver needs to know how to handle this data. If there is a better way... > Then how? If there is an object that already is able to handle the data in whatever f

Re: How to filter the NSOpenPanel with "Recommended Applications"

2010-05-27 Thread Tony Romano
Adding to what others have said. 1. Determine a list of applications that can work with the file type. Use Launch Services (LSGetApplicationURLs for URLs). 2. In the your open panel delegate, implement: shouldEnableURL and return YES if the application is on the list 3. You may also have an ap

Generating PDF images

2010-05-27 Thread Graham Cox
What's the current recommended practice for generating a pdf image without reference to any view or existing context? (Has to work on 10.5+) The situation is that I have an object that can return a preview image of itself which it currently does by rendering into a bitmap graphics context assoc

Re: Generating PDF images

2010-05-27 Thread Kyle Sluder
On May 27, 2010, at 6:20 PM, Graham Cox wrote: Can I not create a PDF context, associate that with a NSPDFImageRep instead? It appears I'm forced to use NSPrintOperation to do this which is slightly weird as this has nothing to do with printing, nor do I have a view readily available to at

Re: Generating PDF images (+followup question)

2010-05-27 Thread Graham Cox
Thanks Kyle, that seems to look like a fruitful approach. I'm doing the following, which appears to be enough, i.e. it works. But should I be doing anything else? NSSize size = [self bounds].size; NSRect destRect = NSZeroRect; destRect.size = size;

Re: Activating application raises windows meant to be invisible

2010-05-27 Thread Peter Ammon
If a window is ordered out, AppKit will not order it back in when the app is activated. Is it possible that a different window is created, or that the window was not ordered out to begin with? I'm confused when you say that an ordered-out window is the key window. That should not be possible.

Re: Generating PDF images (+followup question)

2010-05-27 Thread Ken Ferry
On Thu, May 27, 2010 at 8:40 PM, Graham Cox wrote: > Thanks Kyle, that seems to look like a fruitful approach. I'm doing the > following, which appears to be enough, i.e. it works. But should I be doing > anything else? > > >NSSize size = [self bounds].size; >NSRect destRect = NSZ

Stealing settings from Mail.app

2010-05-27 Thread Chris Idou
I've got an app that needs to send out emails. I'm trying to import mail settings from Mail.app. For some reason my keychain has passwords for smtp.gmail.com, but not for smtp.me.com. Does anyone know where Mail.app stores other passwords? Or why my keychain has smtp.gmail.com passwords, but n

Re: Generating PDF images (+followup question)

2010-05-27 Thread Graham Cox
Thanks for the link Ken, though confusion still persists. Seems to be saying don't use -setFlipped: unless you really know what you're doing. That concurs with your own advice about not using setFlipped unless you're locking focus on the image to get a flipped context for drawing. I'm not, sinc

Re: Generating PDF images (+followup question)

2010-05-27 Thread Ken Ferry
Did you read the explanation of flipped contexts vs flipped images, and how to draw an image right side up into a flipped context? Flipped contexts are not deprecated. Do you have or can you obtain access to the 2007 WWDC videos? :-) -Ken On Thu, May 27, 2010 at 11:11 PM, Graham Cox wrote: >

Re: Generating PDF images (+followup question)

2010-05-27 Thread Ken Ferry
(Also, again for others following along, on 10.6 you just pass YES for respectFlipped in -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]. The implementation is quite similar to the method Paul gives in the post.) On Thu, May 27, 2010 at 11:17 PM, Ken Ferry wrote: > Did y

six things I wasn't able to do with Cocoa

2010-05-27 Thread Bill Appleton
hi all, I just ported a huge code base to Cocoa, Core Graphics, Core Audio, and QuickTime. Basically I had a good experience, but there were some things i noticed that i couldn't do easily in Cocoa or any other 64 bit OSX API. So just in case anyone knows a way to do the things listed below plea

Re: Generating PDF images (+followup question)

2010-05-27 Thread Graham Cox
On 28/05/2010, at 4:17 PM, Ken Ferry wrote: > Did you read the explanation of flipped contexts vs flipped images, and how > to draw an image right side up into a flipped context? > > Flipped contexts are not deprecated. I understand that contexts can (still) be flipped. Let's break this down

Where is zlib located?

2010-05-27 Thread Tito Ciuro
Hello, I'm trying to incorporate zip-framework (http://code.google.com/p/zip-framework/) in my project. When I compile the sources in Xcode I see this error: > "inflate", referenced from: > -readFromEntry:buffer:length: in ZipArchive.o > > "inflateInit2", referenced from: -entryNamed: in ZipAr

Re: Where is zlib located?

2010-05-27 Thread Roland King
libz.dylib it's the last thing listed in the list if I go 'add framework' -> 'existing frameworks'. On 28-May-2010, at 2:40 PM, Tito Ciuro wrote: > Hello, > > I'm trying to incorporate zip-framework > (http://code.google.com/p/zip-framework/) in my project. When I compile the > sources in