Re: Cocoa bug? release/removeObserver from inside observeValueForKeyPath

2008-05-30 Thread Kai
able to handle the extra observeValueForKeyPath: (My guess is that when A receives observeValueForKeyPath:, it is already too late to still remove B from the list of objects which will be notified. Most likely some kind of copy is made of the list of objects to notify internally by Cocoa.) Kai if

Re: Problems with a Layer backed NSView in a NSScrollView

2008-06-20 Thread Kai
the max size of OpenGL textures. Besides being tiled, CATiledLayer updates its contents lazily and in some background thread, if I remember correctly. In any case, it is different. Best Kai On 19.6.2008, at 19:54, Moray Taylor wrote: Thanks for the reply... I've tried [[[self pageScrol

Re: PDFKit guidance

2008-06-20 Thread Kai
checked (Tiger, I think), but I would be surprised if Quartz became perfect in this respect in the meantime. Depending on your application, this may be between no problem and inacceptable. Greetings Kai ___ Cocoa-dev mailing list (Cocoa-dev@li

Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-24 Thread Kai
ween using NSData and the direct copy. But since you potentially access non existing bytes or data, that may be coincidence. Best Kai Hi folks,I'm a newbie to Cocoa. Recently, I'm working on a project relating to Resource Management. In my project, there's a part that I'm read

Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-25 Thread Kai
On 25.6.2008, at 10:42, Tran Kim Bach wrote: Thanks Ken and Kai for your very very quick responses This is my first post in the list, I'm sorry for not clarifying my problem. Actually, the program stopped at the mentioned line. In console, it said something like: objc[2144]: FRE

Re: Newbie question: error in creating a NSData object using handle (Resource Management)

2008-06-27 Thread Kai
D intValue] is pretty unnecessary - unless you are going to use resID with some Cocoa message which expects an NSNumber. Another tip: Handle locking (HLockHi, HUnlock) is a no op under Mac OS X and can be skipped. Best Kai (I mean if I can use these C structs in Objective-C?, don't ha

Re: Calculating accurate bounds of stroked paths

2008-07-08 Thread Kai
Hi, have you checked CGContextReplacePathWithStrokedPath (CGContextRef c) ? This together with CGRect CGContextGetPathBoundingBox (CGContextRef c) might do the trick for you. Best, Kai On 8.7.2008, at 14:16, Graham Cox wrote: I need to know a rect within which all pixels will be painted

Re: Any good advice for naming parameters of init methods?

2008-07-11 Thread Kai
no longer work. KVC knows about the _ivar convention (because it is used by Apple ;-) ) and matches an _ivar to the key "ivar". It won’t for ivar_. But than again it is better anyway to have explicit accessors, I’d say. Kai PS and OT: _ivar is not (any more) considered portable

Re: Cleaning up my Data Model

2008-07-25 Thread Kai
Yes, there is: IB 3.1 (coming with Xcode 3.1) lists all "Referencing Bindings" pointing to an object under the "Connections" tab. Hope this helps. Kai On 25.7.2008, at 18:06, Richard Gutierrez wrote: Thanks for the response... Ultimately what I am trying to do is det

Re: Design Question: Pro & Cons of KVC/KVO

2008-08-21 Thread Kai
se changes. Done consistently, this works simply beautiful. And I wouldn’t restrict Core Data to database+forms apps. You can certainly use it for a drawing application. Whether it is the best solution for this kind of application depends - as always - on many details. Hope this helps a

Re: Strange Strange Bug

2008-09-05 Thread Kai
of the method). (Note that this style may be only possible with certain C dialects. I use Objective C+ +, therefore I’m not sure). Hope this helps. Kai On 5.9.2008, at 09:04, Steve Cronin wrote: Folks; OK this behavior has me a little spooked... This behavior occurs the first time through

Re: Strange Strange Bug

2008-09-06 Thread Kai
On 6.9.2008, at 02:10, Steve Cronin wrote: Kai; OK That seems reasonable but: why do I not see this behavior anywhere else? Yes, it surprised me a little, too, that I had never seen something like this. Now if I am right, this occurs only if such a variable happens to be at a location

NSXMLParser and character entities?

2008-09-12 Thread Kai
ed to resolve all these character entities myself? And if so, what should the NSData object returned by parser:resolveExternalEntityName:systemID: contain? Unicode? Which Unicode encoding? But this can’t be, can it? I must be missing something simple. Thanks for

Re: NSXMLParser and character entities?

2008-09-15 Thread Kai
On 14.9.2008, at 10:45, Nathan Kinsinger wrote: On Sep 12, 2008, at 3:56 PM, Kai wrote: When NSXMLParser hits a character entity like ä (-> German umlaut 'ä'), it sends parser:resolveExternalEntityName:systemID: to its delegate and if this is not implemented o

Re: NSXMLParser and character entities?

2008-09-16 Thread Kai
On 15.9.2008, at 22:24, Nathan Kinsinger wrote: On Sep 15, 2008, at 1:45 PM, Kai wrote: Of course if the content really is XHTML you should really be using an HTML parser and not an XML one. No, it isn’t. Just needs some way to encode all German characters. I’ll have to investigate

Core Animation Caching Resolution

2008-04-29 Thread Kai
this? What I want is to have the cache at screen resolution to keep memory usage controlled. Thanks for any hints Kai ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact

Re: Which language to get started with cocoa development?

2009-01-05 Thread Kai
ich may be introduced by bridiging to other languages. Have fun! Kai On 31.12.2008, at 09:22, Achim Domma wrote: Hi, I develop software for a living and want to get started with cocoa development just for fun. I'm good at python, C, C++ and C# and have some Ruby knowledge. Now I'm

Re: Problems when putting a window between desktop and desktop icons

2008-10-28 Thread Kai
use a low level event tap to catch those mouse events you are interested in. Best luck! Kai Time to come up with an entirely different solution then. -- Markus Amalthea Magnuson http://konstochvanligasaker.se http://nattlek.se "Life... is like a grapefruit. It's orange and squi

Re: Question about NSThread?

2008-11-19 Thread Kai
once when it is started, thus avoiding any shared data. NSOperation and NSOperationQueue might be of help here. You would create a sub class of NSOperation which knows all the info your worker thread needs and off you go. Best luck Kai On 19.11.2008, at 22:37, Jean-Nicolas Jolivet wrote

Re: Magnify anything on the screen?

2008-11-23 Thread Kai
might work. Kai On 23.11.2008, at 17:03, Tim Andersson wrote: Hi guys. I'm currently working on my own custom color picker, and it's all going well. However, I need to replicate the magnifying function found in a NSColorPanel. I think I've figured out how to capture

Re: Adding an associated reference is memory expensive (was: Adding an observer is memory expensive)

2009-09-12 Thread Kai Brüning
e case of a single association. Especially if the OP is right with his observation that this memory is scanned by the collector, which adds time overhead to the space overhead. Kai On Sep 11, 2009, at 2:25 PM, Ken Ferry wrote: Hi Torsten, Please file as a bug if you haven't alrea

Re: Undo architecture advice needed

2009-10-09 Thread Kai Brüning
are your model. If this is correct, the changes do go through your code: when they arrive at the phase object (typically in a setter). And this is the place to record the information needed for undoing the change. Hope this makes any sense Kai On 9.10.2009, at 19:53, David Hirsch wrote

Re: Snow Leopard: unsupported PointerFunctions configuration was requested

2009-10-11 Thread Kai Brüning
place NSPointerFunctionsIntegerPersonality by NSPointerFunctionsIntegerPersonality | NSPointerFunctionsOpaqueMemory. Best Kai + (void)load { RKAtomicMemoryBarrier(); // Extra cautious if(RKCacheLoadInitialized== 1) { return; } if(RKAtomicCompareAndSwapInt(0, 1, &RKCacheLoadInitialized)

Re: Appropriate dealloc and finalize actions

2009-10-11 Thread Kai Brüning
that GC has support for this: weak references. Simply declare the connection ivar as weak: __weak MyClass* connection. GC does the rest. No dealloc, no finalizer, no dangling pointer. And it’s even thread safe. Best Kai On 12.10.2009, at 04:44, Karolis Ramanauskas wrote: If you want to do

Re: Appropriate dealloc and finalize actions

2009-10-12 Thread Kai Brüning
On 12.10.2009, at 13:42, Roland King wrote: On 12-Oct-2009, at 7:26 PM, Karolis Ramanauskas wrote: Thanks, Kai, Greg, Jens, It's generally a bad idea to have two objects each retain the other. It produces a reference loop, which means neither object can be deallocated without man

Re: GC and atomic getters/setters

2009-10-17 Thread Kai Brüning
s thread safety feature of GC is another big reason to use GC over managed memory besides the automatic memory management. Kai ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the li

Re: how to make cocoa application run as a command line tool?

2009-10-20 Thread Kai Brüning
application faceless. Good luck Kai On 20.10.2009, at 11:58, XiaoGang Li wrote: Greetings, I have created an document-based cocoa application, now I need to provide a command line interface for my users. for example, users input this into the terminal: ./myApplication.app/Contents

Re: xml object memory issue

2009-10-30 Thread Kai Brüning
nless you must support Tiger or iPhone. Kai XiaoGang Li wrote: The piece of code I want to discuss is followed: #import int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; for(int i=0;i<5000;i++) { NSURL *inAbs

Re: Should I learn CoreData for this project?

2009-11-03 Thread Kai Brüning
u use Core Data or not. Good luck! Kai On 4.11.2009, at 05:22, David Hirsch wrote: So, I'm hearing folks sing the praises of CoreData, which I have not yet learned. It seems like a long uphill climb, but if life will be spectacular afterwards, I'll do it. I am a semi-casual pro

Re: Should I learn CoreData for this project?

2009-11-04 Thread Kai Brüning
our data set fits in memory and you don't mind loading it all at once, stay away from core data. my two cents Ruotger On 04.11.2009, at 08:54, Kai Brüning wrote: Hi David, this question is most definitely on topic :-) So, lets see, what would Core Data give you: - Scalabilit

-[NSDateFormatter dateFormatFromTemplate:options:locale:] does not work as expected

2010-03-29 Thread Kai Brüning
r German locale. This is completely wrong, expected would be "EE, d.M.". I filed a bug under rdar://7803429. Does anybody have similar experiences with this method? Any work around to make it work? - Kai - Test code: The following code: NSLocale* u

How to parse multipart/form-data?

2012-01-28 Thread Kai Cao
ondering wether there's a sophisticated library/framework for this. Any help would be appreciated. Thanks in advance. Best regards, Kai nonamel...@me.com sent from Mobile Me ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: My try/catch block isn't catching exceptions on 10.6

2009-11-30 Thread Kai Brüning
; e) { > // C++ failed dynamic cast to reference type > } @catch (...) { > // Other C++ exception > // or non-ObjC non-C++ foreign exception > } No - there’s a syntactically subtle but important difference above between @try/@catch and try/catch, the fur

Re: Migrating changed objects between contexts

2009-12-02 Thread Kai Brüning
main thread was paused > since my worker thread had the lock on the context. And blamo. > Deadlock. > > Solution? Disturbingly easy to see now 12 hours into trying to fix it. > Just do the rearrangeObjects on the main thread as before, but set > waitUntilDone

Re: App works when launched from Xcode, not from Finder

2009-12-17 Thread Kai Brüning
Great you found this issue. But according to the log output, it seems that you do have a serious threading-related problem. I wouldn’t ignore this, it may raise its head any time in the future and bite you badly. Good luck Kai On 18.12.2009, at 03:26, PCWiz wrote: > Thanks, will do. >

Re: App works when launched from Xcode, not from Finder

2009-12-18 Thread Kai Brüning
ried to break on [NSRecursiveLock alloc]? Or on one of the init methods? Kai > > Independent Cocoa Developer, Macatomy Software > http://macatomy.com > > > On 2009-12-18, at 12:07 AM, Kai Brüning wrote: > >> Great you found this issue. >> >> But accord

Re: Program not working under Snow Leopard

2009-12-28 Thread Kai Brüning
gt; 2. It never showed up under Leopard by pure luck. Since you switched computers together with the OS, there’s another possibility: is your old computer by chance single-core? And do you have any threading in your code? If so, threading bugs tend to be much worse under multi-core because

Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Kai Brüning
On 4.1.2010, at 13:44, Charles Jenkins wrote: > Thank you to all who offered your expertise! > > Whatta dumb mistake! I thought all objects were retained once when created, > not auto-released. Gah! > > I've been programming for 20+ years--mostly with C++ and C#. Cocoa-ObjC has > the steepest

Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Kai Brüning
that happen, I immediately > save, close, and reopen the window, and everything is fine. Sounds scary, i’ve never seen this. > > Mac software is usually first class, stable, and beautiful. How do folks > write such great software when they're stuck with such a sub-par IDE? :-)

Re: Use NSDocument as a variable of another NSDocument

2010-01-19 Thread Kai Brüning
heir own right or whether the "save onto the disk as text for further usage" is an export. In the later case you would have a single document which is able to export tables as text files (or Excel or Numbers or HTML, you name it). Hope this helps a little Kai > > Thanks! >

-[NSBundle preferredLocalizations]

2010-02-10 Thread Kai Brüning
user's language preferences". Could somebody with insight confirm whether this is a documentation bug? (Sure, I could check the actual order. But if the documentation is correct, the result would be meaningless for the future.) Thanks Kai __

Re: -[NSBundle preferredLocalizations]

2010-02-11 Thread Kai Brüning
Done: rdar://7637393 Kai > > On Feb 10, 2010, at 5:52 AM, Kai Brüning wrote: > >> Could somebody with insight confirm whether this is a documentation bug? > > This is indeed an error in the documentation. Please file a bug against the > documentation with the infor

Re: #define and if statements

2010-02-27 Thread Kai Brüning
A tip for the next time you have problems with macros: use Xcode’s Preprocess command (in the Build menu) to see your macros resolved. Helps a lot in such cases. Kai On 27.2.2010, at 07:37, Adam Gerson wrote: > Thanks! I can't believe I missed that. Its 1:35am here and its been a lon

Re: Short-circuit evaluation

2009-06-23 Thread Kai Brüning
[baz quux]; return a || b; Or, different style: BOOL a = NO; if ([foo bar]) a = YES; if ([baz quux]) a = YES; return a; Kai ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments

Re: How to share Cocoa classes?

2009-07-06 Thread Kai Brüning
ource trees in Xcode preferences (that is, per machine), and then use these definitions to set paths in projects relative to a defined source tree. This frees you from the need to have the exact same directory setup on each computer which uses the project. Kai __

NSView.alphaValue without Core Animation Layer?

2010-11-05 Thread Kai Brüning
layer even works just fine. Is this a feature of Snow Leopard we can dependent upon? We were not able to find it documented, not even in the AppKit release notes for 10.6. Thanks Kai ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please d

Re: image transition while dragging

2009-04-23 Thread Kai Brüning
Apple might break your code with any update etc. Best success Kai On 23.4.2009, at 13:23, rajesh wrote: Hi All, I am working on dragging table row (not for re-ordering or deleting) onto a NSView I am returning an processed image (for dragImage) in - (NSImage

Re: Drawing 1 pixel line with zoom change

2009-05-12 Thread Kai Brüning
coordinates first, to the correct rounding, convert the result back and then draw. The 10.5-only NSView methods convertPointToBase: and friends are quite helpful for this. For more details see Apples "Resolution Independence Guidelines". Kai --Graham __