Re: File name issue with German umlauts

2010-12-17 Thread Adam R. Maxwell
On Dec 17, 2010, at 12:08 , Lee Ann Rucker wrote: > We do this to check whether two URLs really refer to the same file (you can > also hit issues when using NSString path manipulation to build paths and then > turn them into URLs): FWIW, we had this problem also. IIRC we were creating NSURLs

Re: Notifications on main thread

2010-05-20 Thread Adam R. Maxwell
On May 19, 2010, at 4:02 AM, Jonny Taylor wrote: > I've noticed a slight issue (with both NSInvocation and NSOpQ) when a menu is > pulled down and posting styles NSPostASAP or NSPostWhenIdle are used. While > the menu is visible, the notifications are posted ok (on the main thread), > but obje

Re: EPS image in NSScrollView

2010-05-20 Thread Adam R. Maxwell
On May 20, 2010, at 1:43 PM, jyoun...@kc.rr.com wrote: > One other quick question. What I'm really trying to achieve is something > similar to how the pdfkit works. I like how the image/text enlarges within > the scrollview when the window is resized. The code is pretty simple as well: > >

Re: Image from WebView is sometimes blank

2010-05-14 Thread Adam R. Maxwell
On May 11, 2010, at 2:33 PM, Duncan Oliver wrote: > I have a WebView that I use to capture a thumbnail of a loaded webpage > using cacheDisplayInRect:. The WebView object is created > programmatically and not attached to a window. About half the time, > the image it grabs is blank. I can't seem t

Re: Finder file label from cocoa?

2010-04-28 Thread Adam R. Maxwell
On Apr 27, 2010, at 5:14 PM, Rainer Standke wrote: > Hello, > > is there a way to get to the finder label of a file from Cocoa? I'd like to > be able to get & set them. In addition to Uli's solution, I have a class that specifically deals with Finder labels, and works at least back to 10.4:

Re: Drawing glitches in NSTableView with variable row hight (just like Console.app)

2010-04-20 Thread Adam R. Maxwell
On Apr 19, 2010, at 8:56 AM, Marco Masser wrote: > I'm trying to implement a logging facility for an app that should behave > quite the same as OS X's Console.app in terms of displaying the log, i.e. an > NSTableView with varying row heights. I got it working so far, but there are > major draw

Re: "Toll free" bridge from NSAttributedString * to CFAttributedStringRef

2010-04-08 Thread Adam R. Maxwell
On Apr 8, 2010, at 5:02 AM, vincent habchi wrote: > I've been fiddling with NSAttributedString lately, and the way to display > them through Core Text. In the docs, I've read that NSAttributedString and > CFAttributedStringRef were supposed to be "toll free" bridged; I assumed that > meant tha

Re: Problems with repetetive execution of netstat using NSTask and NSTimer

2010-04-06 Thread Adam R. Maxwell
On Apr 6, 2010, at 12:08 PM, Kazior Fukacz wrote: > Thanks for your answers! > >>> By the way, are you using garbage collection? If not, then you're leaking >>> several objects (those pointed to by 'netstat', 'pipe', and 'string'). >> >> Yeah, I suspect that the pipes (and corresponding NSFil

Re: Problems with repetetive execution of netstat using NSTask and NSTimer

2010-04-05 Thread Adam R. Maxwell
On Apr 5, 2010, at 3:02 PM, Ken Thomases wrote: > On Apr 5, 2010, at 4:05 PM, Kazior Fukacz wrote: > >> When I run it, it keeps working perfectly fine for a few minutes, then stops >> refreshing the IP and prints: >> >> IPShowX[14917] *** NSTimer discarding exception '*** -[NSCFDictionary >>

Re: Creating WebView in code

2010-04-02 Thread Adam R. Maxwell
On Apr 2, 2010, at 2:08 PM, Nick Zitzmann wrote: > > On Apr 2, 2010, at 2:19 PM, Jenny M wrote: > >> D'oh, you told me that before and I completely forgot. So I tried >> that, but the page still appears blank. I don't want the page to be >> visible so I didn't set makeKeyOrderFront. FWIW, I'm

Re: Memory Problems

2010-02-05 Thread Adam R. Maxwell
On Feb 5, 2010, at 5:49 PM, Greg Robertson wrote: > I am trying to parse a large CSV (5MB) file using some code I found here: > http://www.macresearch.org/cocoa-scientists-part-xxvi-parsing-csv-data > > but I am getting what I think is an out of memory error part way through, the > error is: >

Re: How to draw text to bitmap (array) with pre 10.5 libs

2009-11-30 Thread Adam R. Maxwell
On Nov 29, 2009, at 10:01 PM, John Horigan wrote: > > On Nov 29, 2009, at 9:09 PM, Graham Cox wrote: > >> >> On 30/11/2009, at 2:44 PM, Glenn McCord wrote: >> >>> What I'm expecting is the drawAtPoint method to draw nsString inside >>> the bitmapRep of the NSContext at which point I can retri

Re: vImage Help

2009-11-14 Thread Adam R. Maxwell
On Nov 14, 2009, at 1:01 PM, R T wrote: > I'm using... vImage_Error err = vImageContrastStretch_Planar8 (&src, &dest, > flags ); > > and getting a scrambled image from the code? Each pixel returned is at the > right height but offset left 3 pixels. Anyone wanting to you to look the > images

Re: Callback when OS delivers console msg for my process?

2009-11-13 Thread Adam R. Maxwell
On Nov 13, 2009, at 1:31 PM, Kyle Sluder wrote: > 2009/11/13 Trygve Inda : >> How can I use an observer/exception handler or other notification to detect >> such messages as NSImage accepts this image as valid when it is not. > > Break on NSLog (or perhaps CFLog). Or maybe CGPostError or some o

Re: Compile error using @synchronized on methods that return values

2009-11-08 Thread Adam R. Maxwell
On Nov 8, 2009, at 3:03 AM, Ken Tozier wrote: > "Control reaches end of non-void function" > > I Googled for "Objective-C accessors and @synchrinized" which seemed to > indicate that the following was the correct way to handle it > > - (id) someMethod > { > @synchronized(self) > {

Re: Commandline Tool Help - NSDistantObject and NSConnection

2009-11-03 Thread Adam R. Maxwell
On Nov 2, 2009, at 10:04 PM, Jens Alfke wrote: > This misfeature has confused a lot of people over the years, including me. My > solution, once I found out what was going on, was to never send NSURLs over > DO — I converted them to NSStrings on the sending side and back to NSURLs on > the rece

Re: EndianU32_NtoB

2009-10-30 Thread Adam R. Maxwell
On Oct 30, 2009, at 1:46 PM, Jens Alfke wrote: > On Oct 30, 2009, at 10:31 AM, Sean McBride wrote: > >> I don't get why for ints they have host<->big, host<->little, >> etc. for the floats they don't. Instead they have those weird host<- >>> >> swapped. And though they take floats, they return

Re: How to run a panel that customizes a new NSDocument

2009-10-21 Thread Adam R. Maxwell
On Oct 21, 2009, at 6:38 PM, Ben Haller wrote: > On 21-Oct-09, at 7:23 PM, Quincey Morris wrote: > >> On Oct 21, 2009, at 15:55, Ben Haller wrote: >> >>> Clicking cancel in my "choose a model" window returns a nil string to my >>> NSDocumentController subclass -openUntitledDocumentAndDisplay:e

Re: using QLPreviewPanel and supporting 10.5

2009-10-10 Thread Adam R. Maxwell
On Oct 10, 2009, at 9:31 AM, Adam R. Maxwell wrote: > > On Oct 10, 2009, at 9:18 AM, Kyle Sluder wrote: > >> 2) The API is different between 10.5 and 10.6; you can't just drop in >> NSClassFromString and continue on as normal. > > It works fine for me. I beli

Re: using QLPreviewPanel and supporting 10.5

2009-10-10 Thread Adam R. Maxwell
On Oct 10, 2009, at 9:18 AM, Kyle Sluder wrote: > 2) The API is different between 10.5 and 10.6; you can't just drop in > NSClassFromString and continue on as normal. It works fine for me. I believe this comment only applies if you were foolish enough to link against the private framework in

Re: Suggest reasons for this crash?

2009-10-06 Thread Adam R. Maxwell
On Oct 6, 2009, at 8:46 PM, Adam R. Maxwell wrote: > However, if I have a master-detail view with a non-editable textview, or am > updating a text view with live output from an NSTask, I don't care if the > delegate gets notified of changes (so have never seen a

Re: Suggest reasons for this crash?

2009-10-06 Thread Adam R. Maxwell
On Oct 6, 2009, at 8:21 PM, Kyle Sluder wrote: > On Tue, Oct 6, 2009 at 7:54 PM, Adam R. Maxwell wrote: >> If this is really necessary, hopefully it'll be documented, or one of the >> text system guys can step in and clarify...I'd really like to know since >>

Re: Suggest reasons for this crash?

2009-10-06 Thread Adam R. Maxwell
On Oct 6, 2009, at 6:14 PM, Graham Cox wrote: > Thanks Kyle - that's really helpful. > > I hadn't read the subclassing notes because I'm not subclassing. My model > stores attributed strings (pity there's not a -setAttributedString: method on > NSTextView that would deal with all the kinks nec

Re: Working with an Unsupported Character Encoding (ANSEL)

2009-10-03 Thread Adam R. Maxwell
On Oct 3, 2009, at 8:11 AM, Thomas Wetmore wrote: While scanning the file I look for the attribute that specifies what the file should be, but I also do other checks. For example I check whether any of the upper half bytes are illegal ANSEL. And I check for UTF-8 multi-byte encodings. At t

Re: reading (parsing) CSV (or Excel) data

2009-10-02 Thread Adam R. Maxwell
On Oct 2, 2009, at 6:10 AM, I. Savant wrote: On Oct 2, 2009, at 7:42 AM, Mike Abdullah wrote: While using this code in an experimental project I found the app was routinely using 500+ MB of RAM. When measured with Instruments I realised that every time you use a character set for string

Re: [Enigmatic semi-solution] Re: Cannot get pixel color from NSBitmapImageRep

2009-10-01 Thread Adam R. Maxwell
On Oct 1, 2009, at 11:19 AM, Ken Ferry wrote: Hi David, Oh, yes, you're right. In the bitmapData, the first row is the top row. -getPixelAtX:y:, -setPixelAtX:y:, -getColorAtX:y: and setColorAtX:y: are the same. The first row is the top. Sorry that's confusing. It might be nice if this

Re: Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-10-01 Thread Adam R. Maxwell
On Oct 1, 2009, at 8:42 AM, Jens Alfke wrote: On Sep 30, 2009, at 7:37 PM, Adam R. Maxwell wrote: Does the Cocoa memory management documentation cover functions? It specifically refers to "...a method whose name begins with...". I wonder if something like the CF "Creat

Re: NSDocumentController didCloseAllSelector

2009-10-01 Thread Adam R. Maxwell
On Sep 30, 2009, at 9:47 PM, Michael Ash wrote: On Wed, Sep 30, 2009 at 9:39 PM, Adam R. Maxwell wrote: On Sep 30, 2009, at 7:15 PM, Graham Cox wrote: On 01/10/2009, at 12:06 PM, Adam R. Maxwell wrote: That should bring you to a helpful discussion titled "Advice for Override

Re: NSDocumentController didCloseAllSelector

2009-09-30 Thread Adam R. Maxwell
On Sep 30, 2009, at 7:15 PM, Graham Cox wrote: On 01/10/2009, at 12:06 PM, Adam R. Maxwell wrote: That should bring you to a helpful discussion titled "Advice for Overriders of Methods that Follow the delegate:didSomethingSelector:contextInfo: Pattern." Wow. I thou

Re: Releasing NSSearchPathForDirectoriesInDomain causes crash

2009-09-30 Thread Adam R. Maxwell
Does the Cocoa memory management documentation cover functions? It specifically refers to "...a method whose name begins with...". I wonder if something like the CF "Create" rule applies to Foundation? Of the following "Create" functions NSCreateMapTable NSCreateZone NSCreateHashTable NS

Re: NSDocumentController didCloseAllSelector

2009-09-30 Thread Adam R. Maxwell
On Sep 30, 2009, at 6:42 PM, Graham Cox wrote: I can't actually see an easy way to invoke the callback selector with the signature as given - you need to pass it the document (self), a BOOL and the contextInfo. You can invoke the method directly on the delegate easily enough, but since you

Re: Spotlight: obtain active query on app launch

2009-09-25 Thread Adam R. Maxwell
On Sep 25, 2009, at 7:29 PM, David Melgar wrote: Hello, If a spotlight query finds data in an application specific file, selecting that file will launch the unique application. How can the application determine the query that was in effect when it was launched? As a concrete example whe

Re: NSTask is "Thread Unsafe". What does that mean?

2009-09-14 Thread Adam R. Maxwell
On Sep 14, 2009, at 7:07 AM, Jerry Krinock wrote: According to the Threading Programming Guide [1], NSTask is listed under "Thread Unsafe Classes", which is explained as: "The following classes and functions are generally not thread-safe. In most cases, you can use these classes from any

Re: NSTask flaky about posting terminate notification, in 10.6

2009-09-02 Thread Adam R. Maxwell
On Sep 2, 2009, at 3:39 PM, Jens Alfke wrote: On Sep 2, 2009, at 3:25 PM, Dave Keck wrote: o Recently I've found myself rolling my own solutions to problems such as yours, in order to guarantee its level of robustness. I've been resisting giving up on NSTask, but it might be necessary.

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

2009-08-30 Thread Adam R. Maxwell
On Aug 30, 2009, at 12:12 PM, Ken Thomases wrote: 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

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

2009-08-30 Thread Adam R. Maxwell
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. (Please correct me if I'm wrong!) As Adam Maxwel

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

2009-08-30 Thread Adam R. Maxwell
On Aug 30, 2009, at 8:29 AM, Steven Degutis wrote: So, the idea here was basically to create an NSOperation subclass that could deal with dependencies, and fit inside an NSOperationQueue (for plenty of reasons), which used the async methods for getting HTTP data. However, either removing NS

Re: NSOperationQueue emptying

2009-08-27 Thread Adam R. Maxwell
On Aug 27, 2009, at 8:18 AM, McLaughlin, Michael P. wrote: I'm wondering about the timing of NSOperationQueue emptying. In my Objective-C++ (Leopard) app, I have one opQueue of operations and the very last thing each operation does is enqueue the results of a computation back to the main

Re: readInBackgroundAndNotify not working?

2009-08-24 Thread Adam R. Maxwell
On Aug 24, 2009, at 3:45 AM, Greg Parker wrote: On Aug 23, 2009, at 8:12 PM, Adam R. Maxwell wrote: On Aug 23, 2009, at 8:01 PM, Kyle Sluder wrote: On Aug 23, 2009, at 7:42 PM, PCWiz wrote: name:@"NSFileHandleReadCompletionNotification" NSFileHandleReadCompletionNotif

Re: Need NSOperation replacement for Tiger (10.4)

2009-08-24 Thread Adam R. Maxwell
On Aug 24, 2009, at 5:47 AM, Rob Keniger wrote: On 24/08/2009, at 10:25 PM, Michael A. Crawford wrote: I have written an application that uses the NSOperation and NSOperationQueue classes. My customer now wants me to make it run on Tiger. Before I try to write my own limited version of

Re: readInBackgroundAndNotify not working?

2009-08-23 Thread Adam R. Maxwell
On Aug 23, 2009, at 8:01 PM, Kyle Sluder wrote: On Aug 23, 2009, at 7:42 PM, PCWiz wrote: name:@"NSFileHandleReadCompletionNotification" NSFileHandleReadCompletionNotification is the name of a constant, not necessarily its value. Right, and that was my first thought, too! I've

Re: NSTableView and OutineView resizing bugs

2009-08-22 Thread Adam R. Maxwell
On Aug 21, 2009, at 1:45 PM, Ernesto Giannotta wrote: After a lot of tests I've noticed that this bug is greatly reduced if drawsBackground is set to false, but I still can see a white line and a ghost right image while enlarging. Have you seen this? http://www.cocoabuilder.com/archive/me

Re: When do I need to override hash?

2009-08-20 Thread Adam R. Maxwell
On Aug 20, 2009, at 9:44 PM, Quincey Morris wrote: The keys in a dictionary (or other keyed collection, like a map table) need to be immutable objects, but that's unrelated to the hash. Mutability in the keys would be bad, hash or no hash. What do you mean by immutable? You can put a "mut

Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image

2009-08-20 Thread Adam R. Maxwell
On Aug 20, 2009, at 2:31 PM, Ben Lachman wrote: This works pretty well, although I do seem to get a white area where there would have been a scroller on the right hand side. Interesting; I hadn't noticed that because of the white border I use. Drawing the WebView itself seems to fix that

Re: alias link to libcrypto not working across different OS X versions

2009-08-20 Thread Adam R. Maxwell
On Aug 19, 2009, at 5:52 PM, Steve Mykytyn wrote: The older machine does not have /usr/lib/libcrypto.0.9.x.dylib, it has /usr/lib/libcrypto.0.9.y.dylib, which is where the alias resolves, but somehow the app does not get it right. Note that it's a symlink, not an alias... I have everythin

Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image

2009-08-19 Thread Adam R. Maxwell
On Aug 19, 2009, at 8:39 PM, Ben Lachman wrote: On Aug 19, 2009, at 8:45 PM, Adam R. Maxwell wrote: On Aug 19, 2009, at 2:50 PM, Ben Lachman wrote: I have an offscreen window containing a WebView that I'm using to generate web previews. My current code works beautifully and looks

Re: When do I need to override hash?

2009-08-19 Thread Adam R. Maxwell
On Aug 19, 2009, at 6:17 PM, Gideon King wrote: In other cases where I make few changes but do lots of comparisons, I might use the string hash idea and cache the return value in the object, triggering an update whenever the relevant data changes. This would be easy for me because the obje

Re: When do I need to override hash?

2009-08-19 Thread Adam R. Maxwell
On Aug 19, 2009, at 6:19 PM, Seth Willits wrote: On Aug 19, 2009, at 4:28 PM, Gideon King wrote: So do I need to override hash too? If so, are there any recommendations as to how to determine the hash easily? I probably shouldn't admit this, but I've yet to override hash and have yet to

Re: - [NSBitmapImageRep cacheDisplayInRect:toBitmapImageRep:] produces empty image

2009-08-19 Thread Adam R. Maxwell
On Aug 19, 2009, at 2:50 PM, Ben Lachman wrote: I have an offscreen window containing a WebView that I'm using to generate web previews. My current code works beautifully and looks like this: NSView *view = previewWebView.mainFrame.frameView.documentView; I do something similar,

Re: Heartbeat thread is blocked? -- With Code and Movie

2009-08-19 Thread Adam R. Maxwell
On Aug 19, 2009, at 5:05 PM, Seth Willits wrote: I've completely stripped this project down to the absolute bare bones and it shows this bug. Simply launch the app. You'll see that the default button in the window is NOT plusating like it should be, and if you click it, you'll see that the

Re: Read last x bytes of a text file?

2009-08-17 Thread Adam R. Maxwell
On Aug 17, 2009, at 7:57 PM, Alex Kac wrote: I'm sure there is a great way to do this, but I seem to not find it. I have a potentially large text file that I wish to only show the last 32k worth - it could be 200MB. So I was looking at NSInputStream, but perhaps I'm being dense or its the

Re: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Adam R. Maxwell
On Aug 17, 2009, at 11:54 AM, Quincey Morris wrote: On Aug 17, 2009, at 11:14, I. Savant wrote: I'm not sure what you mean here, but I'm fairly sure I disagree. :-D This is one step in the right direction. One. At least, insofar as "we heard a very common request and, in the interests of

Re: How to manage NSArray, NSDictionary, ... description encoding for non ascii characters?

2009-08-17 Thread Adam R. Maxwell
On Aug 17, 2009, at 9:46 AM, Gernot A.Pohl wrote: NSString *halo = @"Hello, Wörld!"; NSArray *array = [NSArray arrayWithObject:halo]; NSDictionary *dictionary = [NSDictionary dictionaryWithObject:halo forKey:@"halo"]; NSLog(@"%...@\narray=%@\ndictionary=%@", halo, arr

Re: converting unicode text representation to unichar

2009-08-11 Thread Adam R. Maxwell
On Aug 11, 2009, at 7:40 AM, Daniel Child wrote: Unihan.txt provides text files showing characters in the format U +. If I scan these in, naturally I can obtain the NSString representation . But I need to convert this text to genuine unichars OR NSStrings (the actual characters repr

Re: Using NSTimer and CGEventPost causes problems

2009-08-05 Thread Adam R. Maxwell
On Aug 5, 2009, at 10:24 PM, Quincey Morris wrote: The problem is that it's perfectly legal for something (e.g. a NSButton responding to a mouse-down) to use a local, modal event loop -- a "while" loop, not a NSRunLoop -- using nextEventMatchingMask:untilDate:inMode:dequeue: to get the eve

Re: AGRegex (was: NSString and regular expressions)

2009-08-03 Thread Adam R. Maxwell
On Aug 3, 2009, at 8:15 PM, BareFeet wrote: Has anyone got procedure for getting AGRegex to work in their project? I've used AGRegex.framework in a number of projects, but it's been so long that I've no idea what steps I went through to set it up. The copy here https://tcobrowser.svn.s

Re: NSOpenPanel Exception/Bug

2009-07-29 Thread Adam R. Maxwell
On Jul 28, 2009, at 11:24 PM, Kyle Sluder wrote: On Jul 28, 2009, at 11:12 PM, Seth Willits wrote: Yes. It just fires off a task. Is there a particular reason you're doing this instead of using UTIs? LaunchServices only look at certain tags to determine a UTI, and the extension trump

Re: When is an NSTextField editor created?

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 9:05 PM, Jean-Nicolas Jolivet wrote: I'm working on an NSTextField subclass and I'm trying to find out when an NSTextField's editor (i.e. its "currentEditor") is created so I can set its caret color using the following:[[self currentEditor] setInsertionPointColor:]; Pr

Re: NSString -componentsSeparatedByString: line break

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 7:11 PM, Greg Guerin wrote: Chase Meadors wrote: If the length of this mystery string is 1 and it's not a space, what is it??? Use -characterAtIndex:0 and print the returned unichar using the "%x" format. Another sometimes-handy trick is to create a mutable copy and

Re: Display csv in a tableView with bindings

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 3:04 PM, Kyle Sluder wrote: On Jul 26, 2009, at 2:52 PM, "Adam R. Maxwell" wrote: "CFString objects perform other “tricks” to conserve memory, such as incrementing the reference count when a CFString is copied." Not every NSString is necessarily

Re: Display csv in a tableView with bindings

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 2:53 PM, gumbo...@mac.com wrote: Can you go into a bit more detail with regard to the setting up the bindings? do I bind the tableView column to an arrayController which handles the rows? what model key path? Personally, I recommend that you avoid bindings like the plagu

Re: Display csv in a tableView with bindings

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 2:58 PM, I. Savant wrote: We have an application that keeps an array of bibliographic references, where each is an NSMutableDictionary with other properties. The largest file I recall throwing at it is ~20K items, and the main problem at that point was a beachball when

Re: Display csv in a tableView with bindings

2009-07-26 Thread Adam R. Maxwell
On Jul 26, 2009, at 2:38 PM, I. Savant wrote: On Jul 26, 2009, at 3:52 PM, Aaron Burghardt wrote: Not necessarily. If the keys are NSStrings, then they are copied when added to the dictionary, but a copy of an immutable string is optimized to just retain it, so the data isn't duplicated (

Re: [iPhone] Why can't a UITextField be its own delegate?

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 5:35 PM, WT wrote: First, since I don't know how to get the name of a method (as a string) from its selector, Did you miss NSStringFromSelector() and sel_getName()? smime.p7s Description: S/MIME cryptographic signature ___ C

Re: [iPhone] Why can't a UITextField be its own delegate?

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 5:02 PM, Luke the Hiesterman wrote: On Jul 25, 2009, at 3:41 PM, Adam R. Maxwell wrote: On Jul 25, 2009, at 3:23 PM, Kyle Sluder wrote: Internally, UITextField is going to use self.delegate to get its delegate, following the correct accessor behavior. You've gon

Re: I need a milder application badge (solution)

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 4:04 PM, Jay Reynolds Freeman wrote: On Jul 25, 2009, at 3:14 PM, Kyle Sluder provided a variety of extremely helpful and pertinent comments: > I'm also pretty sure you don't want to use - setApplicationIconImage:. > That will cause all occasions of your app icon, includin

Re: [iPhone] Why can't a UITextField be its own delegate?

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 3:23 PM, Kyle Sluder wrote: Internally, UITextField is going to use self.delegate to get its delegate, following the correct accessor behavior. You've gone and replaced -delegate to return self. But the delegate pattern says that messages which this object does not underst

Re: How to use NSTimer correctly?

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 10:04 AM, Alexander Bokovikov wrote: On 25.07.2009, at 21:29, Adam R. Maxwell wrote: Your original post said you're trying to do this at quit, but you can't rely on any object being sent -dealloc at application quit time. Do your cleanup in applicationWil

Re: How to use NSTimer correctly?

2009-07-25 Thread Adam R. Maxwell
On Jul 25, 2009, at 7:35 AM, Alexander Bokovikov wrote: On 25.07.2009, at 19:56, Scott Ribe wrote: If so, then where should I "dealloc" everything, I created in the awakeFromNib? I believed that dealloc will be called when my AppController will be released. But you say it is never released.

Re: Why do CFType instances respond to NSObject messages?

2009-07-16 Thread Adam R. Maxwell
On Jul 16, 2009, at 5:24 AM, Wilson Chen wrote: Since a CGLayer is not a subclass of NSObject, its instances shouldn't respond to retain/release messages. Yet the code works. The toll-free bridging documentation isn't very clear on this, unless it's changed recently. At least for retain/re

Re: NSSocketPort initRemoteWithTCPPort is never valid

2009-07-15 Thread Adam R. Maxwell
On Jul 15, 2009, at 11:19 AM, Ken Thomases wrote: On Jul 15, 2009, at 11:49 AM, Kirk Kerekes wrote: An NSSocketPort is intended for use with Distributed Objects and NSConnection or, at least, to communicate with another NSSocketPort at the other end. The documentation used to state this,

Re: Best 'Cocoa' File Preview

2009-07-13 Thread Adam R. Maxwell
On Jul 13, 2009, at 6:34 PM, David Blanton wrote: Maybe I should reformulate my question. I want the Finder to call my QLGenerator whenever it sees a file of type '.pes'. Can someone show me the required info.plist entries? You need to do two things: 1) declare your type to map .pes f

Re: Best 'Cocoa' File Preview

2009-07-13 Thread Adam R. Maxwell
On Jul 13, 2009, at 1:02 PM, David Blanton wrote: Here is my info.plist I am trying to get a callback for files ending in .pes UTExportedTypeDeclarations UTTypeIdentifier com.britonleap.pes

Re: setting a CGContextRef to the current Context

2009-07-08 Thread Adam R. Maxwell
On Jul 8, 2009, at 4:03 PM, David Alter wrote: I have CGContextRef that I use for some quartz calls. It is a bitmap context. I would like to set it as the current context so that I can use NSString drawAtPoint: withAttributes:. I do not see how to do this. NSGraphicContext setCurrentContext:

Re: Waiting on NSTableView to finish changing selection

2009-07-08 Thread Adam R. Maxwell
On Jul 8, 2009, at 10:15 AM, Kyle Sluder wrote: On Wed, Jul 8, 2009 at 8:33 AM, Allan Donald wrote: I've got an NSTableView that triggers some relatively expensive stuff when its selection changes. If the user is holding down one of the arrow keys to move through the list, I'd like to wait unt

Re: NSData. add 6 bytes to NSData

2009-07-04 Thread Adam R. Maxwell
On Jul 4, 2009, at 10:56 AM, Scott Andrew wrote: In all honesty the easiest way is to do it in C. Add a 4 byte variable to the top of your packet header.. When building the packet set it to 0.. That solves your problem of getting data into the packet. But if you want to add something to

Re: Determining OS at Runtime

2009-07-03 Thread Adam R. Maxwell
On Jul 3, 2009, at 10:06 AM, Steve Christensen wrote: For the case of a function, if you're deploying on 10.4 but using a 10.5 function, that function will be weak-linked so doing a runtime check is both faster and more accurate in determining whether a function exists or not. For a Cocoa

Re: Private copy not working correctly

2009-07-02 Thread Adam R. Maxwell
On Jul 2, 2009, at 12:05 PM, Joe Turner wrote: I'm trying to create a private copy of an object, but yet when the original changes, my copy changes too. I have an array of dictionaries called spacesData. Then, when I do: NSDictionary *backup = [[spacesData objectAtIndex:index] copy]; every

Re: Dynamically loading a part of a Window in Cocoa

2009-07-01 Thread Adam R. Maxwell
On Jul 1, 2009, at 8:18 PM, Marco S Hyman wrote: On Jul 1, 2009, at 6:50 PM, Adam R. Maxwell wrote: Well, I generally avoid bindings, since I can't comment nib/xib files, and it takes too long to reverse engineer my own (or worse, someone else's) bindings when I'm doing m

Re: Drawing the background of a single row in NSTableView

2009-07-01 Thread Adam R. Maxwell
On Jul 1, 2009, at 6:40 PM, Graham Cox wrote: On 02/07/2009, at 10:09 AM, Peter Zegelin wrote: Problem with this is there is no obvious concordance ( that I can see) between a row and its rectangle. Wouldn't scrolling affect all this? I wonder if the delegate method: - (void)tableView:

Re: Dynamically loading a part of a Window in Cocoa

2009-07-01 Thread Adam R. Maxwell
On Jul 1, 2009, at 10:26 AM, Quincey Morris wrote: On Jul 1, 2009, at 08:54, Adam R. Maxwell wrote: I'm curious as to why people recommend a tabless NSTabView for this. I've always found tabview subviews to be a pain to set up in IB; the alignment and sizing seem really fid

Re: Dynamically loading a part of a Window in Cocoa

2009-07-01 Thread Adam R. Maxwell
On Jul 1, 2009, at 12:54 AM, Quincey Morris wrote: On Jul 1, 2009, at 00:28, Thomas Davie wrote: On 1 Jul 2009, at 09:21, Debajit Adhikary wrote: (Is it enough to place a generic NSView there and add a subview each time? I'm fairly new to Cocoa, so any pointers are welcome) Yes -- at le

Re: GC pros and cons

2009-06-25 Thread Adam R. Maxwell
On Jun 25, 2009, at 8:19 PM, Chris Idou wrote: I still use XCode in one location where I work on a core-solo Mini. Performance is good. No problems at all, no pauses. Interesting. I found the Xcode editor to be unusably slow on a PowerBook G4 when Leopard was released; in fact, contrary t

Re: Problem: how to get glyph descent and ascent

2009-06-23 Thread Adam R. Maxwell
On Jun 23, 2009, at 6:20 PM, WT wrote: On 24/06/2009, at 4:02 AM, Anders Lassen wrote: The font descent is the maximum descent for all characters in that font, so it will not help me to position the character correct. You know, I have no clue if this is going to help or not, because I

Re: API for fetching the computer name in cocoa

2009-06-12 Thread Adam R. Maxwell
On Jun 12, 2009, at 12:37 AM, Gerriet M. Denkmann wrote: Amazing how many ways to get a hostname do exist! There is also NSHost, which has -name and -names. smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Coco

Re: Is it possible to open a URL in a specific browser rather than the default one ???

2009-06-02 Thread Adam R. Maxwell
On Jun 2, 2009, at 6:15 AM, Graham Cox wrote: On Tue, Jun 2, 2009 at 8:56 AM, Parimal Das wrote: Is it possible to open a URL in specific browser ?? Launch Services methods such as LSCopyApplicationURLsForURL would probably allow you to do that. I'd use -[NSWorkspace openURLs:with

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

2009-05-27 Thread Adam R. Maxwell
On May 27, 2009, at 8:05 PM, Jerry Krinock wrote: How can I determine if a given file path, or a file alias (I have both), refers to an item which is in the Trash? The obvious answer, using -[NSString hasPrefix:] on the path with NSHomeDirectory()/.Trash, doesn't look very pretty. Check t

Re: Displaying Application name

2009-05-13 Thread Adam R. Maxwell
On May 13, 2009, at 7:42 AM, Arun wrote: How can i get application name like we see in finder from a .app directory? Try LSCopyDisplayNameForURL or -[NSFileManager displayNameAtPath:] smime.p7s Description: S/MIME cryptographic signature ___ C

Re: quick and dirty NSData implosion

2009-05-11 Thread Adam R. Maxwell
On May 11, 2009, at 6:11 PM, Graham Cox wrote: On 12/05/2009, at 6:20 AM, jon wrote: - (id)initWithCoder:(NSCoder *)c { [super init]; You do not and should not call [super init] here. In this case it's harmless as it happens, but in the general case it's not. The only thing in

Re: Creating NSAttributedString objects using WebKit in secondary thread

2009-05-11 Thread Adam R. Maxwell
On May 11, 2009, at 2:56 PM, Dragan Milić wrote: On pon 11. 05. 2009., at 20:07, Douglas Davidson wrote: On May 11, 2009, at 10:53 AM, Dragan Milić wrote: Is there any way to initialise and use WebKit out of the main thread? No, there isn't. This is a fundamental restriction on the use

Re: catching whitespace with scanner

2009-05-06 Thread Adam R. Maxwell
On May 6, 2009, at 10:05 PM, Daniel Child wrote: I'm trying to catch whitespace between words with a scanner. For some reason, the white space is not being recognized. Am I missing something obvious or is there a bug here? Thanks. NSScanner skips whitespace and newlines by default. Use s

Re: File Reading Problems

2009-04-28 Thread Adam R. Maxwell
On Apr 28, 2009, at 7:50 PM, Pierce Freeman wrote: Thanks for your help. I don't get those strange errors anymore, however no if I try to save the NSDIctionary to a file (NSDictionary's writeToFile), You're releasing a variable that you don't own (testing). See the Cocoa memory ownersh

Re: figuring out which TableView I am?

2009-04-27 Thread Adam R. Maxwell
On Apr 27, 2009, at 2:10 AM, WT wrote: On Apr 25, 2009, at 6:47 PM, David Scheidt wrote: I've got a sub-class of NSTableView. I have windows that have more than one instance of this TableView in them, which need to behave slightly differently, based on which one they are. The way I unde

Re: MDItemCopyAttribute and kMDItemFinderComment

2009-04-21 Thread Adam R. Maxwell
On Apr 21, 2009, at 8:30 PM, Jeremy W. Sherman wrote: getxattr(2) will directly access the current on-disk attribute value. Why not just use it as Alastair suggested? Can you point to any official documentation for the Finder comment xattr name? The storage for it has changed before, so

Re: How do you get the font used in a menu item?

2009-04-21 Thread Adam R. Maxwell
On Apr 21, 2009, at 5:36 PM, Jerry Krinock wrote: I get a default menu from a newly-created popup button cell by sending -[NSPopUpButtonCell menu] How can I find out the font used in this menu? (It's an NSMenu.) I don't see any 'font' accessors, and -[NSMenuItem attributedTitle] return

Re: NSSavePanel and file formats

2009-04-20 Thread Adam R. Maxwell
On Apr 20, 2009, at 12:51 AM, Quincey Morris wrote: On Apr 20, 2009, at 00:16, Graham Cox wrote: The save dialog shows the format pop-up automatically if you declare in your info.pList that you export multiple types. Presumably it also takes care of everything else too - you just need to

Re: Using CFStringTransform with Attributed strings or runs, maintaining the styling of the Attributes in transformed results.

2009-04-19 Thread Adam R. Maxwell
On Apr 19, 2009, at 1:42 PM, John Joyce wrote: Currently, I'm using CFStringTransform to convert Java-based strings files (JBoss .properties files) to something human-readable for verification. Works brilliantly. Luckily, these files are short and this function is super fast. This enables m

Re: Converting String Representations at Runtime

2009-04-12 Thread Adam R. Maxwell
On Apr 12, 2009, at 3:01 PM, John Joyce wrote: Is there an easy way to take input (user or file based) at runtime and convert unicode strings such as \u8D64 (UTF8 character) or a whole series of these to the human-readable characters they represent? I imagine I should be using NSScanner, but

Re: Path from NSFileHandle?

2009-04-08 Thread Adam R. Maxwell
On Apr 8, 2009, at 8:54 PM, Michael Ash wrote: On Wed, Apr 8, 2009 at 11:00 PM, Erg Consultant wrote: Is there a way to get the path of a file opened by an NSFileHandle from the file handle itself? I have a method that takes only an NSFileHandle to an open file but I don't know the file's

Re: SQLite and Unicode

2009-04-07 Thread Adam R. Maxwell
On Apr 7, 2009, at 11:54 AM, Тимофей Даньшин wrote: I will now have to find another "unicode-safe" way to split the string into sentences. Others have addressed your Unicode issues, but for splitting a string into sentences (or other units), I'd use CFStringTokenizer with kCFStringTokeni

  1   2   3   >