Re: Deleting an file that's been NSData memory mapped - safe?

2016-02-14 Thread Marcel Weiher
> On 11 Feb 2016, at 20:44, Dan Lau wrote: > > If a file has its contents mapped using NSData's > initWithContentsOfFile + NSDataReadingMappedIfSafe, > deleting it doesn't appear to affect reading it's mapped contents. Does > anyone know if NSData uses mmap(2) under the hood to ensure that this

Re: NSOperationQueue for NSXMLParser object

2009-11-05 Thread Marcel Weiher
Hi Chris, Let me start with what I'm trying to accomplish. I have an app that is constantly running an animation, which's attributes are determined after downloading and parsing some XML. How large are the XML files? Does each contain multiple animation steps or just one? The XML is

Re: NSXMLDocument and threads

2010-03-26 Thread Marcel Weiher
On Mar 2, 2010, at 10:18 PM, Jeff Johnson wrote: > My question is, how do I use NSXMLDocument safely on a non-main thread? I > need to do this for performance reasons, otherwise my app can pinwheel during > XML parsing. Maybe you need faster XML parsing? Marcel __

Re: NSPipe (NSFileHandle) writedata limit?

2010-04-12 Thread Marcel Weiher
On Apr 9, 2010, at 10:35 , McLaughlin, Michael P. wrote: > My main thread has an NSArray of Subtasks and sends data to each via > > Npending = numProcessors; > for (k = 0;k < numProcessors;k++) { > Subtask *aTask = [myTask objectAtIndex:k]; > [aTask sendData:&theData numBytes:sz ta

Re: Is slowing down bindings updates possible?

2012-01-14 Thread Marcel Weiher
Hi Andrew, On Jan 13, 2012, at 6:57 , Andrew wrote: > The result of this is that the UI updates really frequently and the > estimated time to complete and the download rate jump around a lot. I > would love it if I could tell cocoa to only update the UI once per > second instead of immediately wh

MAX parsing (Re: TBXML question)

2012-01-14 Thread Marcel Weiher
On Jan 13, 2012, at 15:23 , Eric E. Dolecki wrote: > I have XML like this: > > > > > > > > Don't know much about TBXML, but with MAX, the following code parses the file (including model classes and scaffolding): -- snip #import @interface User:NSObjec

Re: Is slowing down bindings updates possible?

2012-01-18 Thread Marcel Weiher
Hi Kyle, On Jan 14, 2012, at 18:37 , Kyle Sluder wrote: > On Jan 14, 2012, at 2:53 AM, Marcel Weiher wrote: >> You shouldn't push updates to the UI, the UI should query the model, and it >> should do it at "human speed", not at whatever speed the machine can

Re: Is slowing down bindings updates possible?

2012-02-05 Thread Marcel Weiher
On Jan 19, 2012, at 1:33 , Ken Thomases wrote: > On Jan 18, 2012, at 6:12 PM, Marcel Weiher wrote: >> On Jan 14, 2012, at 18:37 , Kyle Sluder wrote: >> >>> Breaking this pattern should be a conscious decision. >> >> I'd say that the opposite is tr

Re: Best practice example for a setup wizard?

2010-01-13 Thread Marcel Weiher
Hi Ian, well, in a sense the lack of examples *is* illustrating the best practices concerning setup wizards :-) Cheers, Marcel On Jan 13, 2010, at 9:54 , Ian Piper wrote: > For one of my applications I want to do a check at startup to see whether a > profile and password has been set for th

Re: GC pros and cons

2009-06-24 Thread Marcel Weiher
On Jun 24, 2009, at 11:00 , Bill Bumgarner wrote: On Jun 24, 2009, at 12:51 PM, Quincey Morris wrote: In a nutshell, for folks like me who regularly use CFCreate … CFRelease in loops, what are the benefits of GC? If CFCreate/CFRelease is precisely what you want to do, there are no benefit

Re: GC pros and cons

2009-06-25 Thread Marcel Weiher
On Jun 24, 2009, at 22:49 , Greg Titus wrote: ...whereas this part talks specifically about the collector. Is there a downside in SnowLeopard to CFRetain/CFRelease when not using the collector? There's no _new_ downside to CFRetain/CFRelease. It's just the existing downside (collected

Re: GC pros and cons

2009-06-25 Thread Marcel Weiher
On Jun 25, 2009, at 0:54 , Peter Duniho wrote: Furthermore, it is more typical that there _is_ space already available on the heap to satisfy an allocation request, and in a typical GC system allocations are much faster than for the alloc/ free paradigm. I admit, I don't know the specific

[ANN] MPWDrawingContext, pleasant Objective-C drawing context

2012-06-16 Thread Marcel Weiher
MPWDrawingContext is a light-weight Objective-C wrapper around CoreGraphics CGContextRef and corresponding functions. Code is on Github:https://github.com/mpw/MPWDrawingContext Infrequently Asked Questions: Why would anyone need an Objective-C drawing context? In short, while CoreGraphics

Re: maintaining alpha value for intersecting lines?

2012-09-13 Thread Marcel Weiher
More specifically, CGContextBeginTransparencyLayer() and CGContextEndTransparencyLayer() will do what you need, in case you can't use a single bezier path. You set the global alpha to the transparency you want, start the transparency layer, draw *without the alpha*, end the transparency layer.

Re: Arghh bindings

2012-09-13 Thread Marcel Weiher
On Sep 11, 2012, at 4:28 , Charles Srstka wrote: > On Sep 10, 2012, at 9:23 PM, Quincey Morris > wrote: > >> It doesn't need "all the extra scaffolding". KVC will peer quite happily >> into your instance variables by default. What you don't get for free, in >> that case, is KVO compliance

[ANN] v 0.3 of MPWDrawingContext, a pleasant Objective-C drawing context updated with blocks

2013-01-21 Thread Marcel Weiher
ng-context.html Hope this is useful. Marcel On Jun 16, 2012, at 21:37 , Marcel Weiher wrote: > MPWDrawingContext is a light-weight Objective-C wrapper around CoreGraphics > CGContextRef and corresponding functions. > > Code is on Github:https://github.com/mpw/MPWDrawingCont

Re: Understanding user defaults

2013-03-19 Thread Marcel Weiher
On Mar 19, 2013, at 1:19 , Jens Alfke wrote: > > On Mar 18, 2013, at 5:14 PM, Rick Mann wrote: > >> NSArchiver calls look like -setValue:forKey:, so it seems reasonable that >> the protocol could be usurped to write out fairly clean user defaults plists. > > There’s a lot of other gunk the

Re: ARC Help

2013-03-22 Thread Marcel Weiher
On Mar 22, 2013, at 23:27 , Quincey Morris wrote: > The reason for this is not much about performance. ('atomic' is slower, but > not by much.) On my machine, the difference is around 4x for the read accessor, 3 ns nonatomic vs. 13ns atomic. Cheers, Marcel ___

Re: Simple Vector Based Line Charts

2013-04-25 Thread Marcel Weiher
> So I was looking for a graphics library in the Developer Docs that serves > both Mac-Apps and iOS-Apps. > > I found references to polylines in a MapKit. > There is of course Quartz2D and OpenGL. > > So which of these libraries or perhaps there is another I have not heard of > yet is best at

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Marcel Weiher
Hi Jens, On Apr 25, 2013, at 18:10 , Jens Alfke wrote: > On Apr 25, 2013, at 1:20 AM, Oleg Krupnov wrote: > >> This breaks encapsulation of objects with block properties (e.g. >> MyAnimation.completionBlock) > > I understand the problem you're describing (and yes, I've had a couple of > memo

Re: The cost of using objects rather than plain C variables

2013-07-09 Thread Marcel Weiher
On Jul 8, 2013, at 18:04 , Jens Alfke wrote: > > On Jul 7, 2013, at 1:37 PM, Frederick Bartram wrote: > >> Have you tried using NSData to store C-arrays? > > Or alternatively use NSPointerValue to wrap a pointer to a malloc’ed C array > as an object. It seems to me that an array of float

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 16, 2013, at 19:04 , Kyle Sluder wrote: > On Aug 16, 2013, at 12:41 PM, "Gerriet M. Denkmann" > wrote: >> On 16 Aug 2013, at 22:59, Kyle Sluder wrote: >>> Xcode does know this. But if you're building for 32-bit OS X, it will >>> correctly complain. >> >> When I build for Mac OS X CGR

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 16, 2013, at 19:04 , Kyle Sluder wrote: > On Aug 16, 2013, at 12:41 PM, "Gerriet M. Denkmann" > wrote: >> On 16 Aug 2013, at 22:59, Kyle Sluder wrote: >>> Xcode does know this. But if you're building for 32-bit OS X, it will >>> correctly complain. >> >> When I build for Mac OS X CGR

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 17, 2013, at 18:03 , Maxthon Chan wrote: > On Aug 17, 2013, at 23:52, Marcel Weiher wrote: >> On Aug 16, 2013, at 19:04 , Kyle Sluder wrote: >> >>> Stop using NSRect in your method prototypes and just use CGRect. >> >> This is c

Re: predefined macro iOS vs OS X

2013-08-18 Thread Marcel Weiher
On Aug 17, 2013, at 19:01 , Jean-Daniel Dupas wrote: > Le 17 août 2013 à 17:55, Marcel Weiher a écrit : >> However…if you care as much about dependency management as I do (and chances >> are you don’t), and don’t have a direct dependency on CoreGraphics in that >> code (a

Re: predefined macro iOS vs OS X

2013-08-18 Thread Marcel Weiher
On Aug 18, 2013, at 15:06 , Kyle Sluder wrote: > On Aug 18, 2013, at 6:28 AM, Marcel Weiher wrote: >> On Aug 17, 2013, at 19:01 , Jean-Daniel Dupas wrote: >> >>> You don't have to add explicit dependency to anything as NSGeometry.h >>> already does that

Re: How to detect a Retina Mac

2013-08-18 Thread Marcel Weiher
Hi Gerriet, On Aug 18, 2013, at 17:16 , Gerriet M. Denkmann wrote: >> [Tom Davie] >> Uhh sorry, my bad, I meant CG*Bitmap*ContextCreate… >> >> http://developer.apple.com/library/ios/documentation/graphicsimaging/Reference/CGBitmapContext/Reference/reference.html > > Ah, now I found lots of inf

Image classes (Re: How to detect a Retina Mac)

2013-08-21 Thread Marcel Weiher
On Aug 20, 2013, at 18:02 , Uli Kusterer wrote: > On Aug 20, 2013, at 12:36 PM, Gerriet M. Denkmann > wrote: >> Well that much I know. And I also know that many NS/UI-things (which use >> Objective-C) often have a CF-counterpart, which uses plain C and often these >> are toll-free bridged. T

Re: NSMethodSignature throws an exception encoding GLKMatrix4

2013-08-21 Thread Marcel Weiher
On Aug 21, 2013, at 17:24 , Jeff Kelley wrote: > > *** Terminating app due to uncaught exception 'NSInvalidArgumentException', >> reason: '+[NSMethodSignature signatureWithObjCTypes:]: unsupported type >> encoding spec '(' in '(_GLKMatrix4={?=}[16f])8@12'' > > > I’m not too fa

Re: Fastest way to replace characters in string

2013-08-22 Thread Marcel Weiher
Hi Diederik, On Aug 22, 2013, at 1:44 , Diederik Meijer | Ten Horses wrote: > The content is quite large, about 1MB, it is the full text of a law. Hmm…that isn’t really that large, we have GHz computing buzz-saws! > The web service returns the list lightning fast, but in order to get the >

Re: Fastest way to replace characters in string

2013-08-22 Thread Marcel Weiher
On Aug 22, 2013, at 19:43 , Steve Mills wrote: > On Aug 22, 2013, at 12:31:55, Thomas Wetmore > wrote: > >> Pre-allocation doesn't really matter as long as the re-allocations, whenever >> they occur, respect the capacity argument. > > Sure they do. If you don't preallocate, but instead keep

Re: NSValue valueWithBytes:objCType:

2013-08-25 Thread Marcel Weiher
On Aug 24, 2013, at 22:09 , Andreas Grosam wrote: > What's the purpose of NSValue's class method > > + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; ? > > It seems, NSValue will simply memcpy the content of value, and "somehow" > determine the size in bytes from

Re: Retina / non retina : Drawing icons

2013-08-26 Thread Marcel Weiher
On Aug 21, 2013, at 18:18 , Erwin Namal wrote: > Hi, > > My app's menu extra icon should reflect meaningful information to the user. > However, there are too many cases to draw icons beforehand. It would be > easier to programatically prepare the icon on the fly. > What would be the best way

Re: Creating CGFont from PDF Tf operator

2013-08-28 Thread Marcel Weiher
On Aug 27, 2013, at 14:46 , Graham Cox wrote: > Parsing a PDF, I need to handle the Tf (set font) operator. The font > situation in PDF files is inordinately complicated, and reading the spec > alone is not really leading to the light-bulb moment. Yes, there are many dark tunnels ahead... >

Experience with keyed archiving forward/backwards compatibility?

2013-08-28 Thread Marcel Weiher
Hi folks, does anyone have practical experience with the forward/backward compatibility aspect of keyed archiving? That is define a file format using keyed archiving where backward and forward compatibility was both desirable and achieved? Thanks! Marcel

Re: Experience with keyed archiving forward/backwards compatibility?

2013-08-29 Thread Marcel Weiher
Hi Uli, thanks for your in-depth response! On Aug 28, 2013, at 20:38 , Uli Kusterer wrote: > On Aug 28, 2013, at 4:53 PM, Marcel Weiher wrote: >> does anyone have practical experience with the forward/backward >> compatibility aspect of keyed archiving? That is define a fi

Re: Creating CGFont from PDF Tf operator

2013-08-29 Thread Marcel Weiher
On Aug 28, 2013, at 16:02 , Graham Cox wrote: > It seems overall that I was right in that once you can get to a stream (font > file) or a name, you're home and dry. "Home and dry" might be overstating things a bit :-) You’re at the starting line. > CGFontCreateWithDataProvider obviously im

Re: Experience with keyed archiving forward/backwards compatibility?

2013-09-01 Thread Marcel Weiher
Hi Graham, thanks for sharing your experience, that’s really helpful! On Sep 1, 2013, at 11:54 , Graham Cox wrote: > On 31/08/2013, at 6:48 PM, Marcel Weiher wrote: >> So you’ve had good practical experience with forward/backward compatible >> designs? > > Yes. >

Re: Experience with keyed archiving forward/backwards compatibility?

2013-09-01 Thread Marcel Weiher
On Sep 1, 2013, at 18:26 , Uli Kusterer wrote: > Honestly, I wouldn’t use non-keyed archiving anymore these days. Either you > need performance so badly that you create your own file format (or use > something specialized for a particular need, like sqlite), or you use keyed > archiving. It’s

Re: Threadsafe copy of objective c object

2013-09-04 Thread Marcel Weiher
On Sep 4, 2013, at 10:56 , Jonathan Taylor wrote: > On 3 Sep 2013, at 19:49, Marcel Weiher wrote: >> Unless there is some dire reason not to do this, I would make a copy on the >> main thread every time the UI changes, and stash that copy somewhere the >> worker thread

Re: Threadsafe copy of objective c object

2013-09-05 Thread Marcel Weiher
On Sep 3, 2013, at 12:52 , Jonathan Taylor wrote: > I have an objective c object which contains a number of properties that serve > as parameters for an algorithm. They are bound to UI elements. I would like > to take a snapshot copy of the object that will be used for one whole run of > the

Re: Auto layout semantics?

2013-09-05 Thread Marcel Weiher
[this seems to have bounced earlier] Hi Kyle, Izak, On Aug 16, 2013, at 19:18 , Kyle Sluder wrote: > As Ken Ferry described in his Auto Layout session at WWDC 2011, the specific > solver used by Apple is based on the Cassowary constraint engine. Yes, the algorithm involved is a variant of the

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 9:44 , Kyle Sluder wrote: > Thirded. Countered. :-) > I thought I wouldn't like it. I thought I would LOVE it, and when I actually used it was “meh”. Not just the additional rules/complexity when dealing with the C side of things (which I do quite a bit), but more import

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 11:33 , Tom Davie wrote: >> On 9 Sep 2013, at 10:18, Jean-Daniel Dupas wrote: >> >> And does the profiler explicitly shows that ARC runtime code is the culprit >> ? > > Yes, it does. Isn’t it strange how when someone says “oh, and ARC is faster”, without measurements, t

(Pre)mature optimization and small efficiencies

2013-09-09 Thread Marcel Weiher
On Sep 3, 2013, at 16:54 , Fritz Anderson wrote: > On 2 Sep 2013, at 12:47 AM, Marcel Weiher wrote: > >> This gets (mis-)quoted out of context way too much (my emphasis): >> >> "We should forget about small efficiencies, say about 97% of the time: >>

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
Hi Jens, Premature optimization is the root of all evil! Er, I misspelled: “very cool, nice job!” On Sep 9, 2013, at 18:11 , Jens Alfke wrote: > [..] > [fg160,160,160;16:34:40.488| [fg0,128,0;[;NSDateFormatter took 26.97 µsec > [fg160,160,160;16:34:48.649| [fg0,128,0;[;CBLParseDate

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:05 , Jean-Daniel Dupas wrote: > > Le 9 sept. 2013 à 18:11, Jens Alfke a écrit : > >> [fg160,160,160;16:34:40.488| [fg0,128,0;[;NSDateFormatter took 26.97 >> µsec >> [fg160,160,160;16:34:48.649| [fg0,128,0;[;CBLParseDatetook 0.47 >> µsec (58x) > > Isn't

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:20 , Tito Ciuro wrote: >> On Sep 9, 2013, at 10:14 AM, Marcel Weiher wrote: >> Premature optimization is the root of all evil! > What's premature about it? Nothing: >> Er, I misspelled: “very coo

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:35 , Jens Alfke wrote: > > On Sep 9, 2013, at 10:14 AM, Marcel Weiher wrote: > >> Premature optimization is the root of all evil! > > I’m not sure if you meant that ironically, but it’s absolutely not premature. Absolutely! On both counts. It

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
Just to add a tiny wrinkle: On Sep 9, 2013, at 20:27 , Jens Alfke wrote: > On Sep 9, 2013, at 10:48 AM, Jeffrey Oleander wrote: >> [..] Some do, but the dread of customer rebellion is strong, and they want >> to enter them in the slap-dash, hurried, harried ways they're used to >> writing them

Re: ARC vs Manual Reference Counting

2013-09-10 Thread Marcel Weiher
On Sep 10, 2013, at 21:52 , Ken Thomases wrote: > On Sep 9, 2013, at 3:49 AM, Marcel Weiher wrote: > >> The pattern I adopted long ago to avoid that sort of situation is to have an >> instance variable for my temps, in which case the code becomes: >> >>

Re: ARC vs Manual Reference Counting

2013-09-11 Thread Marcel Weiher
Hi John! On Sep 10, 2013, at 19:26 , John McCall wrote: > On Sep 9, 2013, at 4:15 AM, Marcel Weiher wrote: >> [Optimizations in ARC are there to mitigate pessimizations] > > For what it’s worth, the autorelease optimization was planned; the > performance problem it so

Re: Automatically Call a Function

2008-06-15 Thread Marcel Weiher
On Jun 15, 2008, at 10:09 , Philip Lee Bridson wrote: Firstly I need a function to automatically run from a class used in MainMenu.nib when the main.m calls NSApplicationMain(); The NSApplication object provides this facility: http://developer.apple.com/documentation/Cocoa/Reference/Applica

Re: garbage collection and NSConnection

2008-07-10 Thread Marcel Weiher
Some minor factual corrections: On Jul 2, 2008, at 18:33 , Michael Ash wrote: In Cocoa you do lots of retaining and releasing. These operations aren't free. They involve a lookup into a global hash table and some sort of atomic increment/decrement operation. The hash table is only used by NS

Re: garbage collection and NSConnection

2008-07-10 Thread Marcel Weiher
On Jul 10, 2008, at 9:50 , Michael Ash wrote: On Thu, Jul 10, 2008 at 12:17 PM, Marcel Weiher <[EMAIL PROTECTED] > wrote: [hash tables not generally used + internal refcounts] Atomic updates are still a pretty big hit on a multiprocessor system (all of them, these days), Yes, t

Re: garbage collection and NSConnection

2008-07-11 Thread Marcel Weiher
There are several ways to share the implementation: 1. Do nothing, CF and Foundation already do it for most of their objects (and they share their implementation...probably unreasonably...) This, obviously, doesn't work for your own classes. But a lot of the objects you will use

Re: Setting DPI of image data

2008-07-11 Thread Marcel Weiher
On Jul 10, 2008, at 20:16 , Graham Cox wrote: I'm using NSBitMapImageRep's -representationUsingType:properties: method to convert data to JPEG, TIFF, etc. I'd like to be able to specify the DPI of the image. I can calculate the right number of pixels needed for a given DPI OK, but the imag

Re: garbage collection and NSConnection

2008-07-11 Thread Marcel Weiher
On Jul 11, 2008, at 8:59 , Michael Ash wrote: The cost of a single refcounting op is negligible compared to the cost of object allocation, so these two are quite irrelevant. A quick test of this claim would appear to disprove it. On my Mac Pro, an alloc/init/release cycle of NSObject costs

Re: garbage collection and NSConnection

2008-07-11 Thread Marcel Weiher
On Jul 11, 2008, at 12:53 , Michael Ash wrote: Seems that NSString and NSMutableString are just faster at everything. In all cases, the cost of an extra retain/release for them is still roughly 50% of the cost of an alloc/init/retain. Here are my raw numbers, times in nanoseconds: [timings sn

Re: garbage collection and NSConnection

2008-07-12 Thread Marcel Weiher
On Jul 12, 2008, at 8:25 AM, Michael Ash wrote: On Sat, Jul 12, 2008 at 2:25 AM, Marcel Weiher <[EMAIL PROTECTED] > wrote: So as I said: (a) object allocation slowest (b) out-of-band retain count slow (c) inline retain count much faster than either. Well that all makes sense,

Re: garbage collection and NSConnection

2008-07-13 Thread Marcel Weiher
On Jul 12, 2008, at 13:42 , Michael Ash wrote: http://www.opensource.apple.com/darwinsource/projects/apsl/CF-476.10/CFRuntime.h typedef struct __CFRuntimeBase { uintptr_t _cfisa; uint8_t _cfinfo[4]; #if __LP64__ uint32_t _rc; #endif } CFRuntimeBase; I guess this isn't the right one,

Re: Inverse Regex Library?

2008-07-18 Thread Marcel Weiher
On Jul 17, 2008, at 14:11 , Philip Mötteli wrote: What I'm asking is, if you can identify everything that is not a too-many relationship, find them via a process of elimination (if it's not something I can identify, then it must be a too-many). But I can't make this analysis every-time an

Re: tidying HTML up

2008-07-18 Thread Marcel Weiher
On Jul 18, 2008, at 14:22 , Ivan wrote: Since NSXMLDocument is no longer (or never had really been) part of the iPhone SDK, now I find my app can't be run on my iPhone. So, I wonder if is there any way I could take to keep on with my development. Just found tidylib at sourceforge, but don

Re: Dot Syntax docs missing?

2008-07-19 Thread Marcel Weiher
On Jul 19, 2008, at 18:34 , Ian Joyner wrote: On 19/07/2008, at 11:36 PM, Michael Ash wrote: The universe of programming languages extends far beyond this little island of ALGOL-lookalikes. Objective-C messaging syntax is utterly mundane compared to many common, useful syntaxes used in practi

Re: Avoiding mutual retain cycles

2008-07-21 Thread Marcel Weiher
On Jul 21, 2008, at 13:03 , Philippe Mougin wrote: Le 21 juil. 08 à 20:50, Markus Spoettl a écrit : I'm wondering if there is a general rule or mechanism that suggests what to do in such a case. For instance, how are delegates implemented in AppKit, are they retained? If so, when are they

Re: Garbage Collection Pre-Processor Flag

2008-07-22 Thread Marcel Weiher
On Jul 22, 2008, at 9:21 , Jonathon Mah wrote: Are Xcode build settings exposed as pre-processor variables? I know they're available when pre-processing Info.plists, but can't find a way to use them in source code files (.m). It's not Xcode build settings, but gcc does have predefined macr

Re: Avoiding mutual retain cycles

2008-07-22 Thread Marcel Weiher
On Jul 22, 2008, at 11:52 , Philippe Mougin wrote: Le 22 juil. 08 à 06:21, Marcel Weiher a écrit : http://portal.acm.org/citation.cfm?id=1035292.1028982 There are also interesting bits in their conclusion: "This explains why highly optimized tracing and reference counting collectors

Re: NSImage size vs. representations' sizes

2008-08-03 Thread Marcel Weiher
On Aug 2, 2008, at 14:19 , Jacob Bandes-Storch wrote: I'm trying to use my application icon (icns) in a custom view to be draw in the background of a window, like Installer.app does. I can do all this just fine, but when I draw the image using - drawInRect:fromRect:operation:fraction:, it c

Re: Properties and memory management

2008-08-05 Thread Marcel Weiher
On Aug 5, 2008, at 2:57 , Uli Kusterer wrote: You may fire off observer methods too, which is probably undesirable. Lucky then, that I adopted GNUstep-style ASSIGN() and DESTROY() macros for these purposes, and since most of my code still needs to be 10.4-compatible, I've mostly been usin

Re: Properties and memory management

2008-08-06 Thread Marcel Weiher
On Aug 5, 2008, at 15:28 , Uli Kusterer wrote: On 05.08.2008, at 22:24, Marcel Weiher wrote: On Aug 5, 2008, at 2:57 , Uli Kusterer wrote: Lucky then, that I adopted GNUstep-style ASSIGN() and DESTROY() macros for these purposes, and since most of my code still needs to be 10.4

Re: building a command-line tool as a bundle

2008-08-17 Thread Marcel Weiher
On Aug 17, 2008, at 4:41 , Roland King wrote: I started building a Cocoa app then decided that I wanted to build myself a little command-line tool to test the classes I'm writing. Perhaps it should be a Unit test but I thought perhaps I'd learn those another day. So I added a command-line

Re: !foo vs foo == nil

2008-08-20 Thread Marcel Weiher
On Aug 20, 2008, at 6:14 PM, John C. Randolph wrote: On Aug 20, 2008, at 5:04 PM, j o a r wrote: On Aug 20, 2008, at 4:56 PM, John C. Randolph wrote: Personally, I prefer "if (!foo)" over "if (foo == nil)", because the latter has the hazard of a typo that compiles. You can lose a fair bit

Re: Question about respondsToSelector

2008-08-20 Thread Marcel Weiher
On Aug 19, 2008, at 6:33 AM, Carmen Cerino Jr. wrote: if ([_delegate respondsToSelector: @selector(SGDecompDataProc:)]){ [_delegate SGDecompDataProc:pixelBuffer trackingFlags:decompressionTrackingFlags disp

Re: understanding conversions between CF and NS datatypes

2008-09-05 Thread Marcel Weiher
On Sep 5, 2008, at 4:52 , Michael Ash wrote: But at run time they are the same type. If you disagree, just create an NSArray and a CFArray (with the standard CFType callbacks) and try to tell the difference between them! This is true for NSArray, because it will create an NSCFArray under t

Re: File I/O

2008-09-22 Thread Marcel Weiher
On Sep 19, 2008, at 14:15 , Jordon Hirshon wrote: How can I read a file a line at a time (i.e. getline)? I'm trying to do this in a Cocoa Framework. You could just use the POSIX fgets() call... Marcel ___ Cocoa-dev mailing list (Cocoa-dev@lis

[ANN] Objective-XML 4.3

2008-12-18 Thread Marcel Weiher
Just a quick note that I have just released version 4.3 of Objective- XML, an efficient and convenient XML framework for Cocoa (Touch): http://www.metaobject.com/downloads/Objective-C/Objective-XML-4.3.tgz From the Readme: Objective-XML is an XML processing framework for Objective-C.

Re: Problem with NSData to NSString to NSData

2008-10-29 Thread Marcel Weiher
On Oct 29, 2008, at 1:46 PM, Joel Norvell wrote: First, I wanted to thank Aki Inoue and Rob Keniger for pointing out the problem with my NSData->NSString->NSData approach. As an alternative, would it be fruitful to use a Directory Wrapper to represent the data as two files; one the metada

Re: Performance problem with GC enabled

2009-03-13 Thread Marcel Weiher
On Mar 12, 2009, at 8:39 AM, Bill Bumgarner wrote: On Mar 12, 2009, at 6:04 AM, John Engelhart wrote: [ way too many words deleted ... please try to succinctly state issues in the future ] You have created a micro benchmark that demonstrates a significant bit of overhead from

Re: Performance problem with GC enabled

2009-03-13 Thread Marcel Weiher
On Mar 12, 2009, at 10:54 AM, Bill Bumgarner wrote: On Mar 12, 2009, at 10:29 AM, John Engelhart wrote: Actually, this isn't a "micro-benchmark". If you aren't displaying the results, responding to user events, keeping an application state up to date and otherwise doing all of the things

Re: Performance problem with GC enabled

2009-03-15 Thread Marcel Weiher
On Mar 14, 2009, at 3:29 , Paul Sanders wrote: How about perl instead? (I don't think egrep is a fair test, it doesn't have to 'do anything' with the results, like create a new string from them). This is a rough perl equivalent of my original problem: I guess that's the point I was trying to

Re: XMLParser

2009-03-28 Thread Marcel Weiher
On Mar 23, 2009, at 19:53 , Development wrote: I'm using an an NSXMLParser to parse a document. some of the elements are as follows: Some Thingelement> The problem is that I cannot seem to come up with the element's property. During the parse which callback is going to give me the property

Re: XMLParser

2009-03-28 Thread Marcel Weiher
On Mar 23, 2009, at 20:13 , Dave Geering wrote: On Tue, Mar 24, 2009 at 1:53 PM, Development wrote: I'm using an an NSXMLParser to parse a document. some of the elements are as follows: Some Thing The problem is that I cannot seem to come up with the element's property. During the parse w

Re: XMLParser

2009-04-01 Thread Marcel Weiher
If you like that type of higher-level, more Objective-C-like approach, you might want to have a look at Objective-XML, and more specifically the MAX parser ( MAX = Message oriented API for XML): http://www.metaobject.com/blog/2009/01/iphone-xml-performance.html http://www.met

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 1, 2009, at 21:44 , Michael Ash wrote: On Thu, Apr 2, 2009 at 12:33 AM, Ryan Joseph [distinguishing between NSArray and CFArray] The test cannot be performed, because the question does not make any sense. While this answer is mostly true for what the original poster is trying to ac

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 13:54 , Michael Ash wrote: On Thu, Apr 2, 2009 at 3:20 PM, Marcel Weiher wrote: On Apr 1, 2009, at 21:44 , Michael Ash wrote: On Thu, Apr 2, 2009 at 12:33 AM, Ryan Joseph [distinguishing between NSArray and CFArray] The test cannot be performed, because the question

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
NSArray / \ NSCFArrayMYNSArray From the Objective-C perspective, there is no such thing as NSArray; Sure there is. it is a class cluster, So apart from being a class cluster (which is also "something" and not "no thing") it is also an actual c

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
[On Apr 2, 2009, at 15:24 , Michael Ash wrote: yes/no/yes/no/yes/no...] Your answer is correct if and only if the NSArray in question is a NSCFArray. If the NSArray in question is not a NSCFArray, the question is valid (thought possibly not what the original author intended) and the tes

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 16:43 , Chris Suter wrote: On Fri, Apr 3, 2009 at 10:37 AM, Marcel Weiher > wrote: So the compiler also disagrees with you that these are the same type. You can *cast* them to be compatible, but they are not the same type. Right, but the original question was ab

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 17:06 , Marcel Weiher wrote: As I explained, it is trivially possible, because the only Objective- C class that is the same as its underlying CFType is NSCFArray. That is, of course, nonsense. All the other bridged class are as well, but NSArray itself or other direct

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 17:54 , Chris Suter wrote: On Fri, Apr 3, 2009 at 11:06 AM, Marcel Weiher > wrote: As I explained, Did you? Yes. it is trivially possible, because the only Objective-C class that is the same as its underlying CFType is NSCFArray. So a simple test would be [obj

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 18:44 , Michael Ash wrote: On Thu, Apr 2, 2009 at 7:37 PM, Marcel Weiher wrote: It can be distinguished from an array created using CFArrayCreate, just as it can be distinguished from an array created using [NSArray array], Glad that you agree that the test can be

Re: Toll-free bridge type at runtime

2009-04-02 Thread Marcel Weiher
On Apr 2, 2009, at 23:22 , Chris Suter wrote: Hi Marcel, [snip] However, that does not mean that they are the same. They are the effectively the same and I couldn't see anything in your e-mail that proves otherwise. I have said from the very beginning "while the anser is mostly true for

Re: Toll-free bridge type at runtime

2009-04-03 Thread Marcel Weiher
On Apr 3, 2009, at 9:06 , Michael Ash wrote: Of *course* I mean NSArray itself. What did you *think* I meant? Whenever I say NSArray I mean, hello, NSArray. That's what I thought, thanks for clarifying! I was getting worried there for a bit... And it is *not* pointless. Every instance o

Re: Need localization-proof method of transporting dates.

2009-04-04 Thread Marcel Weiher
On Apr 4, 2009, at 5:01 , Graham Cox wrote: One problem I've had occasional reports of is that the expiry is prematurely detected, and it seems to be on systems with system language set other than English. I need to store and check the dates in a way that is not sensitive to this. I though

Re: Reading cab into object

2009-04-04 Thread Marcel Weiher
On Apr 3, 2009, at 14:18 , Mark Bateman wrote: Hi I have a csv file I want to use as a source for a searchable list The csv has 16 fields. I have managed to read the csv line by line into an array You don't necessarily need to read the lines into an array, you can just process them one-b

Re: Obj-C equivalent to Python generator functions

2009-04-04 Thread Marcel Weiher
On Apr 1, 2009, at 19:04 , Sam Krishna wrote: Does anyone here know of any Obj-C functional equivalent to Python generator functions? These are *categorically* different that the Spotlight API generator functions. http://is.gd/qcYt There is no direct equivalent at the language level, beca

Re: NSXMLParser memory consumption

2009-04-05 Thread Marcel Weiher
On Apr 4, 2009, at 9:02 , George King wrote: I hit a stumbling block when passing large files (multi-GB) to NSXMLParser. Are you doing this in 64 bit? It appears that NSXMLParser's initWithContentsOfURL: method loads the contents of the entire file into memory, which is causing virtual

Re: Need localization-proof method of transporting dates.

2009-04-05 Thread Marcel Weiher
On Apr 5, 2009, at 8:15 , Michael Ash wrote: Note that, as far as I know, there is no guarantee that -hash will return the same value for the same object across runs of your program. And in fact this has changed in the past. Marcel ___ Cocoa-dev

Re: NSXMLParser memory consumption

2009-04-05 Thread Marcel Weiher
On Apr 5, 2009, at 9:35 , George King wrote: Yes, probably. Have you tried initializing it with a memory-mapped NSData instead of an NSURL? Thank you for the suggestion; I was unaware of initWithContentsOfMappedFile:. This worked to a certain extent, in that it kept memory consumption to

Re: Difference between SEL and const char* when sending a message?

2009-04-08 Thread Marcel Weiher
On Apr 7, 2009, at 20:34 , Daqi Pei wrote: Hi everyone. I'm new to Objective-C but I've been working with C++ for years. I'm trying to understand how the selector mechanism works. I think the best reference for that would be Brad Cox's original book on Objective-C. In short: selectors *a

  1   2   >