Re: How to check whether a application is launch or not...?

2009-06-02 Thread Ken Thomases
On Jun 2, 2009, at 5:05 AM, Anshul jain wrote: I have figured it out how to get the root processes and its information. My only concern is how i will get a notification when a process is launched. I think there should be a way to get it. Because i think Activity Monitor does this. I dou

Re: How determine if file is in Trash, given Path or Alias

2009-06-02 Thread Ken Thomases
On Jun 2, 2009, at 9:21 PM, Michael Ash wrote: The NSString methods are unlikely to be problematic here. NSData is troublesome because it's returning an internal pointer. In other words, it's a pointer to some memory that it already holds on to in the normal course of things, and it gives you th

Re: Referring to file by Alias ^or^ path

2009-06-02 Thread Ken Thomases
On Jun 2, 2009, at 9:35 PM, Kyle Sluder wrote: On Tue, Jun 2, 2009 at 7:22 PM, Michael Ash wrote: This step is unnecessary and pointless (although it was useful on really old OS X versions where the kernel's normalization routines didn't always handle everything correctly) but it is there las

Re: KVO and master-detail NSTableViews

2009-06-04 Thread Ken Thomases
On Jun 4, 2009, at 5:24 AM, Stefan Reitshamer wrote: I'm getting flaky behavior from my KVO code and I'm wondering what I'm doing wrong. I can't find any similar examples. I have a pop-up button and 2 NSTableViews. The pop-up button selection controls the content of the left NSTableView. T

Re: Wich one is faster, compare or isEqualToString? (NSString methods)

2009-06-05 Thread Ken Thomases
On Jun 5, 2009, at 9:22 AM, Bill Cheeseman wrote: On Jun 5, 2009, at 9:51 AM, Michael Ash wrote: On Fri, Jun 5, 2009 at 8:20 AM, Ignacio Enriquez wrote: Hi there; Suppose I have NSString *char = [[NSString alloc] initWithString:@"a"]; So, I wonder which is faster? if([char isEqual:@"a"])

Re: NSArray vs. NSMutableArray ... "distinct objective-c type"

2009-06-06 Thread Ken Thomases
On Jun 6, 2009, at 7:14 AM, Martin Batholdy wrote: I have created a method that do something with an NSArray. Now when I use the method and give it an NSMutableArray instead of an NSArray, I get a warning; "passing argument x of "method" from distinct objective-c type" Now, the result is

Re: Using non-id sender in IBAction methods

2009-06-07 Thread Ken Thomases
On Jun 7, 2009, at 10:45 AM, Marc Liyanage wrote: With the new dot notation I sometimes use explicit types in my IBAction methods: - (IBAction)doSomething:(UIButton *)button ... instead of - (IBAction)doSomething:(id)sender ... so I don't have to downcast "sender" to be able to use the dot

Re: NSOpenPanel : Resolving the file paths for symbolic links

2009-06-08 Thread Ken Thomases
On Jun 8, 2009, at 5:41 AM, Arun wrote: I have an application in which i use NSOpenPanel to select the files. If i login as a root user (System Administrator) and then choose the desktop in NSOpenPanel of my application, then i will get /var/root/Desktop. I need a way that will help me in res

Re: How to get a NSButton (check box) state

2009-06-08 Thread Ken Thomases
On Jun 8, 2009, at 5:48 PM, Martin Batholdy wrote: You are right ... there is something wrong with the connection. What I have done is the following; IBOutlet NSButton *launchOption; I have connected this Outlet with the NSButton by ctrl+dragging from the NSObject to the CheckBox in the win

Re: finding bundle identifiers

2009-06-10 Thread Ken Thomases
On Jun 10, 2009, at 4:27 AM, Rick C. wrote: to be more specific on what i'm trying to do i would like to be able to review the files in a preferences folder and find the related app on the system. so i was trying to come up with a list of identifiers for comparison. but it seems that some

Re: finding bundle identifiers

2009-06-10 Thread Ken Thomases
On Jun 10, 2009, at 5:08 AM, Jean-Daniel Dupas wrote: Le 10 juin 09 à 11:51, Ken Thomases a écrit : On Jun 10, 2009, at 4:27 AM, Rick C. wrote: to be more specific on what i'm trying to do i would like to be able to review the files in a preferences folder and find the related app o

Re: Doc kind from extension

2009-06-11 Thread Ken Thomases
On Jun 11, 2009, at 10:47 AM, Micha Fuhrmann wrote: Unfortunately all I can feed it with is the file extension Any other idea? Isn't there a mapping plist between extension and Kind that exists somewhere? I missed the earlier part of this discussion, but does LSCopyKindStringForTypeIn

Re: Missing something about initialization

2009-06-12 Thread Ken Thomases
On Jun 12, 2009, at 4:54 AM, Alfonso Ortega wrote: I'm trying to parse a bit of html and use it to initialize an object. I have very little background in objective-c, everything parses correctly, I just can't seem to get the object initialized. What am I doing wrong? You're not invoking s

Re: Missing something about initialization

2009-06-12 Thread Ken Thomases
On Jun 12, 2009, at 1:27 PM, Scott Andrew wrote: You are not retaining your values after retrieved (slot, svn, prn, clock, block). These are auto released and will be released the the next time the pool is cleaned up. slot, svn, and prn are apparently integers. They are scalar values, no

Re: Correct MVC code placement

2009-06-14 Thread Ken Thomases
On Jun 14, 2009, at 2:34 PM, Chris Tracewell wrote: On Jun 14, 2009, at 11:27 AM, Kyle Sluder wrote: NSDocument is what's known as a "model-controller" object. Your actual model is the pipe-separated values; NSDocument allows you to perform operations on that model. As such, I'd probably exp

Re: get ref to instance from IB

2009-06-15 Thread Ken Thomases
On Jun 15, 2009, at 11:28 PM, Graham Cox wrote: On 16/06/2009, at 1:55 PM, Paul M wrote: Also: do I need to track and clean up all these wrapper instanes? I'm assuming I dont - I hope I dont otherwise it'll be a complete nightmare. You need to follow normal, standard memory management and

Re: Notification/callback of successful CGEventPost?

2009-06-16 Thread Ken Thomases
On Jun 16, 2009, at 8:22 PM, Dave DeLong wrote: I want to take a snapshot of the NSPasteboard, put my own information on it, programmatically invoke a paste operation, and then restore the pasteboard to its original state. I have this mostly working, but it's not a satisfactory solution.

Re: Manually updating a data bound value of a bound text field

2009-06-18 Thread Ken Thomases
On Jun 18, 2009, at 9:49 AM, Ramakrishna Vavilala wrote: I have a window (displayed as a sheet) with a text field and some other controls. I can not set the binding mode to continuous so I use non continuous binding. Everything works fine as long as I press tab and switch to a different control.

Re: Manually updating a data bound value of a bound text field

2009-06-18 Thread Ken Thomases
On Jun 18, 2009, at 11:17 AM, Ramakrishna Vavilala wrote: Unfortunately, I used incorrect design by binding text field to properties of the file's owner (which happens to be a NWindowController) which does not respond to commitEditing message. Any other ideas? Fix the design? It should be rel

Re: NSDate scope

2009-06-21 Thread Ken Thomases
On Jun 20, 2009, at 6:52 PM, John Baldwin wrote: I declared a (NSDate *) in my .h file. NSDate *originalDate; The above is unclear. You mean you declared an instance variable in some class with type NSDate*? Then in my init method, I initialized it to the current date. I tried various

Re: Just implementing -isEqual:, never invoked, causes crash

2009-06-21 Thread Ken Thomases
On Jun 20, 2009, at 7:26 PM, Jerry Krinock wrote: Oh, I also figured out how to enter a command in the gdb console -- You have to hit the 'enter' key instead of 'return' after entering a command. I've never used 'enter' in a console-type-thing. I suppose this may be to allow multi-line co

Re: Weird dyld loader crash

2009-06-21 Thread Ken Thomases
On Jun 20, 2009, at 10:44 PM, Andrew Farmer wrote: On 20 Jun 2009, at 20:27, Erg Consultant wrote: I suddenly started getting a weird loader crash when launching my app. Has anyone seen any errors similar to this one: Exception Type: EXC_BAD_ACCESS (SIGBUS) Exception Codes: KERN_PROTECTION_

Re: Approaches for this Matching Problem?

2009-06-21 Thread Ken Thomases
On Jun 21, 2009, at 11:02 PM, Jerry Krinock wrote: Given the numbers in your post, "3-5", "250" and "several", I'd say you should just split the phrase into words, write an outer loop for(words in phraseWords), an inner loop for(tag in tags), and inside it all compare using -isEqualToString

Re: Approaches for this Matching Problem?

2009-06-22 Thread Ken Thomases
On Jun 22, 2009, at 3:10 AM, Steve Cronin wrote: So I've been pondering and testing... 1) Why would I have to bust up/loop on thePhrase? BUT in my case I don't care where, what word or how often - I just want to know IF a tag occurs in thePhrase!! Then you shouldn't refer to "words". If

Re: Approaches for this Matching Problem?

2009-06-22 Thread Ken Thomases
On Jun 22, 2009, at 1:25 PM, Steve Cronin wrote: Thanks as always for a thought-provoking and thorough response! Sure. :) 2) I don't see how looping on the 'words' in thePhrase would change the 'ham' issue you raise - it would still match either on the word or the phrase. Am I missing

Re: Beginner Question Re: Memory Management

2009-06-22 Thread Ken Thomases
On Jun 22, 2009, at 3:39 PM, Daniel Torrey wrote: I'm looking at some sample iPhone code, and in the app delegate's applicationDidFinishLaunching method, I see // Set up the view controller MyViewController *aViewController = [[MyViewController alloc] initWithNibName:@"HelloWorld"

Re: about NSThread crash

2009-06-23 Thread Ken Thomases
On Jun 24, 2009, at 1:12 AM, Chris(吴潮江) wrote: I have some problems when to using thread. As we all know, there is a method to create a thread, + (void)detachNewThreadSelector:(SEL)aSelector toTarget:(id)aTarget withObject:(id)anArgument. - (void)aSelector:(id)anArgument { NSAutoreleasePo

Re: about NSThread crash

2009-06-24 Thread Ken Thomases
On Jun 24, 2009, at 1:49 AM, Chris(吴潮江) wrote: On Jun 24, 2009, at 2:28 AM, Ken Thomases wrote: You probably don't need to use a background thread to do FTP. You can do it using asynchronous methods on the main thread. Since you can, you probably should. It's almost always

Re: Unexpected NSWorkspaceDidMountNotification

2009-06-26 Thread Ken Thomases
On Jun 26, 2009, at 1:45 PM, Buddy Kurz wrote: Does anyone have any idea why an application would receive a NSWorkspaceDidMountNotification notification for a volume that was already mounted when the application started? I believe this is intentional. I could swear I read about it in the

Re: Detecting that a process has ended?

2009-06-27 Thread Ken Thomases
On Jun 27, 2009, at 4:11 AM, Rick Mann wrote: I'm starting a process via NSTask and launchctl. I can use launchctl list to get the process' PID. Is there a way i can get notified if the process exits (or dies) without polling launchctl list? http://developer.apple.com/technotes/tn/tn2050.ht

Re: NSUrl: Which method to use

2009-06-27 Thread Ken Thomases
On Jun 27, 2009, at 7:24 AM, M.S. Hrishikesh wrote: To create an NSUrl from a file which would be the preferred way NSString *myFile = @"myFile.xml"; Method A: NSUrl *myUrl = [NSUrl fileURLWithPath:myFile] Method B: NSUrl *myURL = [[NSUrl alloc] initFileURLWithPath:myFile]; Using method B I

Re: NSComparisonResult and equality

2009-07-01 Thread Ken Thomases
On Jul 1, 2009, at 6:32 AM, Patrick Mau wrote: Since NSComparisonResult is an ordered enum typedef, I'd like to know if it's safe to write the following code to test for 'greater or equal to': // This would cover both NSOrderAscending and NSOrderSame if ([obj1 compare:obj2] < NSOrderDescendin

Re: warning:assignment from distinct Objective-C type

2009-07-01 Thread Ken Thomases
On Jul 1, 2009, at 11:26 AM, David Blanton wrote: in .h file NSMutableArray *m_sources; [...] m_sources = [volumes stringsByAppendingPaths:[defaultManager directoryContentsAtPath:volumes]]; -stringsByAppendingPaths: returns an NSArray*. That is not an NSMutabl

Re: Changing content of object inside NSMutableArray

2009-07-03 Thread Ken Thomases
On Jul 2, 2009, at 5:36 PM, Agha Khan wrote: I have saved some objects inside GameArray (type NSMutableArray) and I would like to change of content of an object inside that array. GameObj is type of UIView so it has a frame. GameObj* p = [GameArray objectAtIndex:0]; p.frame = frame; This wo

Re: Convenience initialisers

2009-07-05 Thread Ken Thomases
On Jul 5, 2009, at 12:40 PM, DKJ wrote: I'm trying to write one of those convenient class initialisers for one of my objects. On my still-incomplete understanding of these matters, this is what I need to have: Header: + (MyObject *)myObject; Implementation: + (MyObject *)myObject {

Re: Retain cycles with NIB instantiations, bindings

2009-07-12 Thread Ken Thomases
On Jul 10, 2009, at 2:19 AM, Half Activist wrote: I'm loading a NIB file at runtime and use a new instance of a class as its owner each time. Everything works fine, until I wish to delete an object. In my software, i'm using several instances of objects that have their own

Re: NSSocketPort initRemoteWithTCPPort is never valid

2009-07-14 Thread Ken Thomases
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 work

Re: NSSocketPort initRemoteWithTCPPort is never valid

2009-07-15 Thread Ken Thomases
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: "NSS

Re: Finder Kind Entry

2009-07-17 Thread Ken Thomases
On Jul 16, 2009, at 1:13 PM, David Blanton wrote: I have searched the list archives and Google to no avail in trying to determine how the Kind value shown in the Finder is set. My initial thought was that the UTTypeDescription entry under UTExportedTypesDeclarations in the info.plist for a

Re: How do I track down an OSStatus error code?

2009-07-20 Thread Ken Thomases
On Jul 20, 2009, at 3:04 PM, Benjamin Stiglitz wrote: Looking for the meaning behind the value -43. Try MacErrors.h in CarbonCore. Or just type "macerror -43" at a command shell. Cheers, Ken ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-23 Thread Ken Thomases
On Jul 23, 2009, at 6:44 PM, Jerry Krinock wrote: I'd often like to block the main thread First question is: why? Blocking the main thread is usually bad and to be avoided. What are you actually trying to achieve? Can you give an example of when that would be desirable? while another

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Ken Thomases
On Jul 24, 2009, at 5:10 PM, Dave Keck wrote: The notifications don't cross threads; they are delivered in the thread where they are posted. Yes, I understand that. There must be some quirk that allows it to work when doing an NSTask Just a tidbit - I don't think there's any quirks inv

Re: Challenge: Block Main Thread while Work is done, with Timeout

2009-07-24 Thread Ken Thomases
On Jul 24, 2009, at 4:50 PM, Jerry Krinock wrote: On 2009 Jul 23, at 17:44, Ken Thomases wrote: On Jul 23, 2009, at 6:44 PM, Jerry Krinock wrote: I'd often like to block the main thread First question is: why? Blocking the main thread is usually bad and to be avoided. What ar

Re: Dictionary with enum keys?

2009-07-27 Thread Ken Thomases
On Jul 27, 2009, at 3:52 AM, Jean-Daniel Dupas wrote: Le 27 juil. 09 à 10:48, Debajit Adhikary a écrit : I need to create a dictionary/hashmap where the - Keys are enums - Values are some subclass of NSObject NSDictionary won't work here (enums don't conform to NSCopying). I could perhap

Re: Surprise: -[NSInvocation retainArguments] also Autoreleases them

2009-08-01 Thread Ken Thomases
On Aug 1, 2009, at 1:42 AM, Jerry Krinock wrote: So I decided to -retainArguments, and presumed that this meant I was supposed to release the target and arguments when I was done with them. As you've discovered, no, you're not supposed to do that. You have not retained the target and arg

Re: Main Event queue

2009-08-05 Thread Ken Thomases
On Aug 4, 2009, at 7:10 PM, Sandro Noel wrote: Is there a cocoa or carbon framework that would allow my software to hook onto the system main event queue, like in windows? or to hook into the window manager. I would like to peek at every message that traverse the main queue. Do you mean jus

Re: Generating random numbers

2009-08-05 Thread Ken Thomases
On Aug 5, 2009, at 5:44 AM, Mahaboob wrote: I need to produce 15 random numbers between 1 to 16 without repeating any number. I used the code like int i,j; for(i=0;i<15;i++){ j =random() % 15 +1; NSLog(@"No: %d => %d \n",i,j); srandom(time(NULL)+i); } But some nu

Re: Main Event queue

2009-08-05 Thread Ken Thomases
On Aug 5, 2009, at 9:50 AM, Sandro Noel wrote: what I would like to do is broad range, get information about every action for every application in my current desktop session. Window movement, hide, show, activate, deactivate, open, close, mouse movement, drag and drop operations, contextual

Re: Design Question

2009-08-06 Thread Ken Thomases
On Aug 6, 2009, at 12:29 PM, Quincey Morris wrote: Finally, the question of whether 'projectInstall' sometimes returns nil is irrelevant. That has nothing to do with the compliance of the Project object. Except, check out "Bug Fix in KVO's Dependency Mechanism" in the Leopard Foundation R

Re: Disabling Exposé in SystemUIMode

2009-08-06 Thread Ken Thomases
On Aug 6, 2009, at 7:18 PM, Pierce Freeman wrote: And is there any way to make reproduce the "display capture effect" without using this or SetSystemUIMode. I'm not quite clear on what you're saying here. When you say "without using this", do you mean without actually capturing the displa

Re: Cmd+key shortcuts not being sent to NSWindow on Tiger

2009-08-08 Thread Ken Thomases
On Aug 6, 2009, at 7:03 PM, Dimcho Balev wrote: I have a trouble with a piece of code which behaves differently on Tiger (Mactel) in comparison to Leopard. It is pretty simple case: our cocoa app is interested in cmd+key shortcuts and we have overriden the keyDown and keyUp methods in our NSWi

Re: [NSObject setValue:forUndefinedKey:] no longer requires explicit KVC notifications?

2009-08-09 Thread Ken Thomases
On Aug 8, 2009, at 6:24 PM, Gabriele de Simone wrote: On Aug 8, 2009, at 2:37 PM, Keary Suska wrote: It used to be that if you overrode -[NSObject setValue:forUndefinedKey:] your own subclass was responsible for calling -[NSObject will/didChangeValueForKey: so that bindings and observers would

Re: NSPushAutoreleasePool & NSPopAutoreleasePool?

2009-08-12 Thread Ken Thomases
On Aug 11, 2009, at 8:58 PM, DairyKnight wrote: I've been tracing an iPhone application, and found out the NSPush/PopAutoreleasePool pair being called every time before/after entering the event loop. I did some googling about these apis and they seem to be undocumented. They are not AP

Re: File's owner, outlets and methods

2009-08-13 Thread Ken Thomases
On Aug 13, 2009, at 4:24 PM, Michael de Haan wrote: [ **Very** briefly, the set up is as follows. AppController has an outlet (IBOutlet NSPanel *aboutWindow) and a method (-(IBAction) showPanel: (id) sender;) ] So, there are really 2 things happening here? One is that the About Window's

Re: Document file read, but -readFromData:(etc) has error.

2009-08-13 Thread Ken Thomases
On Aug 13, 2009, at 4:07 PM, John Velman wrote: - (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error:(NSError **)outError { NSLog(@"readFromData has been called, typeName is: %...@\n", typeName); if ( outError != NULL ) { NSLog(@"outError is not null");

Re: File's owner, outlets and methods

2009-08-13 Thread Ken Thomases
On Aug 13, 2009, at 9:32 PM, Michael de Haan wrote: On Aug 13, 2009, at 6:36 PM, Ken Thomases wrote: An outlet is a property of an object. It's often backed by an instance variable as its implementation. Once you connect an outlet to an object in the nib, this connection is record

Re: NSWindow and Spaces

2009-08-20 Thread Ken Thomases
On Aug 19, 2009, at 8:47 AM, MT wrote: I've got a problem with my app, some of the windows do not behave correctly with 'Spaces', I've narrowed it down to this... If the window is backed by an NSDocument, it behaves correctly, i.e. if this window is active within the application, when the u

Re: Authorization Question (Possibly a simple POSIX question?)

2009-08-21 Thread Ken Thomases
On Aug 21, 2009, at 1:33 AM, Seth Willits wrote: I'm looking at some code* in an app which uses a helper tool, in order to open and read the contents of a protected file. Normally the user does not have privileges to read this file, hence the authorization. Here's the process it goes throug

Re: Bindings & Reverting Properties

2009-08-21 Thread Ken Thomases
On Aug 21, 2009, at 11:31 AM, Quincey Morris wrote: On Aug 21, 2009, at 06:27, Dave Keck wrote: - (void)setHappy: (BOOL)newHappy { happy = newHappy; if (![self save]) self.happy = !happy; // Revert to the old value. Pretend the recursive call wouldn't attempt

Re: Binding exception on Tiger

2009-08-26 Thread Ken Thomases
On Aug 25, 2009, at 2:02 PM, James Walker wrote: When my app ran on Tiger, there was an NSInvalidArgumentException with the reason: "-observeValueForKeyPath:ofObject:change:context: only defined for abstract class. Define -[NSCFString observeValueForKeyPath:ofObject:change:context:]!"

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: I haven't tried it, but this should work: NSAttributedString* original = whatever; NSMutableAttributedString* normalized = [[original mutableCopy] autorelease]; CFMutableStringRef str = (CFMutableStringRef)[original mutableString];

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 10:43 AM, Michael Ash wrote: On Wed, Aug 26, 2009 at 5:42 AM, Ken Thomases wrote: On Aug 25, 2009, at 7:21 PM, Ross Carter wrote: I haven't tried it, but this should work: NSAttributedString* original = whatever; NSMutableAttributedString* norma

Re: Normalize an NSAttributedString

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 1:45 PM, Michael Ash wrote: On Wed, Aug 26, 2009 at 1:21 PM, Ken Thomases wrote: I'm well aware of what it means. The question is, which exact operations on the mutable string proxy does CFStringNormalize perform. If CFStringNormalize performs the minimal re

Re: Help viewer problem in Tiger Mac OS X

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 3:25 PM, Arun wrote: I am using .help files to provide help for my application. My application help is localised. In tiger when i switch the languages, always the help viewer launches the help in english. But in leopard as the language the help viewer displays the help

Re: Cross-user and cross-process shared settings

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 4:51 PM, Dave DeLong wrote: I have two processes - a user process and a root-level LaunchDaemon. I'd like both processes to have shared settings. [...] How can I effectively implement cross-process and cross-user shared settings? Have you considered using a client-ser

Re: Problem building for 10.4 on 10.6

2009-08-26 Thread Ken Thomases
On Aug 26, 2009, at 10:41 PM, Greg Hoover wrote: Has anyone seen an error in XCode like this: GCC 4.2 is not compatible with the Mac OS X 10.4 SDK (file NSString+extras.m) I remove the referenced file and another pops up. I can build using the 10.5 SDK, but attempting to build with 10.4 do

Re: Launching a document-based app with no document

2009-08-28 Thread Ken Thomases
On Aug 27, 2009, at 2:49 PM, Dylan McNamee wrote: Which hook should I use to detect that my document-based app has been launched without a document having been dropped on it (or double-clicked upon)? Right now my app just launches and shows its menu. What I'd like to do is catch this case,

Re: Normalize an NSAttributedString

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an attribute is {0, 2}. The string and its attribute are archived separately as xml data like this: ö NSF

Re: "Format not a string literal and no format arguments"

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 1:54 PM, Peter Duniho wrote: Am I reading the right documentation? On this page: http://developer.apple.com/mac/library/releasenotes/Cocoa/Foundation.html I see this text: Foundation APIs which take string format arguments (APIs such as initWithFormat:, NSLog(), etc)

Re: "Format not a string literal and no format arguments"

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 2:19 PM, Quincey Morris wrote: On Aug 29, 2009, at 11:54, Peter Duniho wrote: Or is it implied that the compiler is doing compile-time verification of the format string when a literal is provided? Sort of, but not exactly. Actually, yes exactly. So if you provide a st

Re: Testing localizations in 10.6

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 2:29 PM, Dylan McNamee wrote: Way back before Snow Leopard, I was able to test a localization by right-clicking on my application, and "un-checking" all of the languages except for the one I wanted to test. Today, however, I see that portion of the "Get Info" window is

Re: "Format not a string literal and no format arguments"

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 3:24 PM, Quincey Morris wrote: It's actually not clear (to me) whether the two warnings are controlled by the same compiler options. AFAIK -Wno-format (which used to be the default in the build setting) would turn off the type mismatch warning, but I don't know whether i

Re: Normalize an NSAttributedString

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 3:48 PM, Ross Carter wrote: On Aug 29, 2009, at 1:22 PM, Ken Thomases wrote: On Aug 29, 2009, at 11:46 AM, Ross Carter wrote: Suppose an NSAttributedString comprises the string o + umlaut in decomposed form, plus one attribute. Its length is 2, and the range of an

Re: virtual ivars

2009-08-29 Thread Ken Thomases
On Aug 29, 2009, at 3:49 PM, Todd Heberlein wrote: I've been playing with KVC and KVO with my own setters and getters (along with Controllers) to create virtual ivars. That is, there never is any storage created for the variable and its value is calculated on the fly when the getter is call

Re: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?

2009-08-30 Thread Ken Thomases
On Aug 30, 2009, at 9:09 AM, Steven Degutis wrote: Unfortunately, the code I wrote completely broke yesterday when I upgraded to Snow Leopard (fortunately I hadn't published it yet for that same reason) and it was narrowed down to the NSOperation subclass not getting any of NSURLConnection

Re: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?

2009-08-30 Thread Ken Thomases
On Aug 30, 2009, at 10:29 AM, Steven Degutis wrote: Thanks for your detailed response. You're welcome. Originally the plan for this class was to be an NSOperation on the advise of Steve Streza who mentioned that on Snow Leopard, NSOperationQueues take advantage of GCD, which would improve

Re: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?

2009-08-30 Thread Ken Thomases
On Aug 30, 2009, at 1:47 PM, Adam R. Maxwell wrote: On Aug 30, 2009, at 10:18 AM, Ken Thomases wrote: On Aug 30, 2009, at 10:29 AM, Steven Degutis wrote: I either would need to use NSURLConnection in a stand-alone class, or use it synchronously inside a non-concurrent NSOperation subclass

Re: Async NSURLConnection + Concurrent NSOperation = Not possible under Mac OS X 10.6?

2009-08-30 Thread Ken Thomases
On Aug 30, 2009, at 3:52 PM, Adam R. Maxwell wrote: On Aug 30, 2009, at 12:12 PM, Ken Thomases wrote: Well, that's polling and is generally discouraged. Yes, but Apple's runloop documentation recommends using a timeout: http://developer.apple.com/mac/library/documentation/Cocoa/

Re: Notification when display resolution changes?

2009-08-30 Thread Ken Thomases
On Aug 30, 2009, at 6:45 PM, Gabriel Zachmann wrote: Is there a way to have my Cocoa app get notified when the display resolution changes? The -applicationDidChangeScreenParameters: application delegate method or the NSApplicationDidChangeScreenParametersNotification notification. Cheers,

Re: print object by %@

2010-07-22 Thread Ken Thomases
On Jul 22, 2010, at 1:44 PM, Ariel Feinerman wrote: > you are right, I wish to get a function can use printf style, prints > Objective-C objects clearly and efficiently by %@, > > I do not understand, hm, why there is no such function (except NSLog()) in > Cocoa? You've been given all of the t

Re: Retrieving Uniform Type Identifiers

2010-07-26 Thread Ken Thomases
On Jul 26, 2010, at 5:20 PM, Dave DeLong wrote: > I have the string "com.apple.iwork.*", and I need to expand that into any > UTIs that match the string. In this case, it'd be: > > ( > "com.apple.iwork.pages.pages", > "com.apple.iwork.keynote.key", > "com.apple.iwork.numbers.numbers" > ) > > T

Re: Retrieving Uniform Type Identifiers

2010-07-26 Thread Ken Thomases
On Jul 26, 2010, at 5:59 PM, Dave DeLong wrote: > Yeah, I'm actually trying to expand Spotlight queries into a different format > so I can execute them on a SQLite database Huh? I can't figure out what you mean by that. You want to let Spotlight find things from within a database? Then you wa

Re: help with methods

2010-07-28 Thread Ken Thomases
On Jul 28, 2010, at 1:27 PM, Rounak Jain wrote: > I am comfortable with understanding method declarations like > - (void) someName: (NSString *) variableName; > where > void is return type > someName is name of the method Close. "someName:" _with the colon_ is the name of the method. There's a

Re: Search Kit memory management

2010-07-31 Thread Ken Thomases
On Jul 31, 2010, at 2:24 AM, Michael Thon wrote: > I am indexing a large set of files using Search Kit. I find that memory > usage (reported by Activity Monitor) keeps growing in my app, as it indexes > more documents. I don't find any memory leaks. In Instruments, I find that > there can so

Re: Search Kit memory management

2010-08-01 Thread Ken Thomases
On Aug 1, 2010, at 1:43 AM, Michael Thon wrote: > I am indexing possibly tens of thousands of documents. No matter what I > tried, I could not get search kit to release its memory, even after closing > the index. The only way I could prevent memory usage from growing too much is > to do the in

Re: Search Kit memory management

2010-08-01 Thread Ken Thomases
On Aug 1, 2010, at 11:10 AM, Michael Thon wrote: > I should probably just stick to my observations and state that "Real Mem" in > Activity Monitor is reduced by several hundred MB when the NSOperation > finishes indexing a few thousand documents. Yeah, using "Real Mem" in Activity Monitor is

Re: Detecting a remote volume

2010-08-02 Thread Ken Thomases
On Aug 2, 2010, at 2:26 PM, Knut Lorenzen wrote: > my app should copy a few files to a remote (afp://) volume, hence it notifies > the user if there is no connection, using NSFileManager's fileExistsAtPath: > method. > > However, if the user connects to the Server using Finder's "Connect As..."

Re: Getting a list of web browsers

2010-08-04 Thread Ken Thomases
On Aug 4, 2010, at 7:31 PM, Nick Zitzmann wrote: > On Aug 4, 2010, at 6:24 PM, Mike Manzano wrote: > >> How would one go about getting a list of web browsers on the system? I'd >> like to implement a pull down menu similar to Safari's "Default web >> browser:" field. > > I think you can get st

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 7:59 AM, Graham Cox wrote: > I have a Obj-C method that is highly recursive, and needs to run at maximum > performance. With this in mind, I am locally caching the method's own IMP to > avoid the message dispatch for the recursive calls. It seems to work and > gives a measura

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 8:47 AM, Jean-Daniel Dupas wrote: > As I pointed in my previous post, just define the function inside your class > body (between @implementation and @end), and you will be able to access > private ivars using pointer syntax. Yes. A function within an @implementation is a par

Re: Is this the correct way to cache an IMP?

2010-08-05 Thread Ken Thomases
> On 05/08/2010, at 11:12 PM, Jean-Daniel Dupas wrote: > >> Probably not faster, but cleaner IHMO: Actually, I suspect it is faster. All function invocations are direct rather than indirected through a pointer. This is faster in and of itself and also allows the compiler to recognize the recu

Re: NSRunLoop's -runMode:beforeDate: not exiting after an NSTask finishes

2010-08-05 Thread Ken Thomases
On Aug 5, 2010, at 12:10 PM, Jens Alfke wrote: > The wait code looks like: >while (_busy) { >if (![[NSRunLoop currentRunLoop] runMode: NSDefaultRunLoopMode > beforeDate: [NSDate distantFuture]]) >break; >} Since you're waiting on an NSTask to finish, is there a reason

Re: How to implement lazy loading with a proxied array

2010-08-07 Thread Ken Thomases
On Aug 7, 2010, at 12:04 PM, Kyle Sluder wrote: > On Aug 7, 2010, at 9:42 AM, Dave DeLong wrote: > >> Let's say that I have an object that encapsulates a Google search. I feed >> this object my query string, set some options, and then execute it. >> Ideally, I'd like to get back an NSArray o

Re: Recursive file remove

2010-08-15 Thread Ken Thomases
On Aug 14, 2010, at 11:36 PM, Michael Ash wrote: > First is the more obvious one, where you have the semantics of doing > an 'rm' on a directory without passing the -r flag. If the directory > is empty, it's deleted. If it's not, the command fails. Not to flog a dead horse, but 'rm' doesn't do th

Re: Losing my memory - a caching problem?

2010-08-17 Thread Ken Thomases
On Aug 17, 2010, at 7:26 PM, Shawn Erickson wrote: > When you say "free" I assume you mean the "free:" number listed in > activity viewer for the system as a whole? > If so then what you are seeing is an expected result of the "unified > buffer cache" maintained by the system (since you say priva

Re: Set the Cursor Position

2010-08-19 Thread Ken Thomases
On Aug 19, 2010, at 8:43 PM, Sherm Pendley wrote: > On Thu, Aug 19, 2010 at 9:32 PM, Murat Konar wrote: >> CGDisplayMoveCursorToPoint(CGDirectDisplayID display, CGPoint point); >> >> But heed the other's hints that, except for special classes of software >> (like a VNC app), software that warps

Re: 64KB limit in passed in text for a service using NSTask

2010-08-19 Thread Ken Thomases
On Aug 19, 2010, at 10:00 PM, Ron Fleckner wrote: > I'm developing a stand alone text service for changing/fixing case. For the > simple cases of uppercasing and lowercasing I've simply used NSString's built > in methods. But to correct sentence case, where the original text may have > lowerc

Re: Command line tool using NSImage?

2010-08-21 Thread Ken Thomases
On Aug 21, 2010, at 2:26 AM, Jaime Magiera wrote: > I've got a OSX command line tool that I wish to run in a shell and via a > WebObjects application. The binary tool is linked to a framework I wrote > which contains NSImage manipulations. It seems the [NSApplication > sharedApplication] trick

Re: Command line tool using NSImage?

2010-08-21 Thread Ken Thomases
On Aug 21, 2010, at 8:35 AM, Jaime Magiera wrote: > Has anyone heard of Apple coming up with a solution to this conundrum? Or is > it Bug Report time? There has to be some way to do it securely. What exactly are you trying to do? For some tasks, there may be a safe mechanism. For example, are

Re: app with quick-entry dialog

2010-08-22 Thread Ken Thomases
On Aug 22, 2010, at 2:37 AM, Martin Hewitson wrote: > Thanks for the clues. This almost does what I want - I can now jump back to > the original app the user was working in. Two problems remain: > > 1) There is an unpleasant visual jump for the user as the quick-entry app > jumps to the front

<    4   5   6   7   8   9   10   11   12   13   >