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: ARC and autorelease pools

2014-02-17 Thread Marcel Weiher
On Feb 17, 2014, at 2:08 , Clark Smith Cox III wrote: >> I didn't say take them out. I said why do they need to return an >> autoreleased object. > > Because they always have, and their semantics cannot be changed without > breaking decades worth of non-ARC code. Sort of like the way GC did,

Re: Fast hash of NSData?

2013-12-02 Thread Marcel Weiher
On Dec 2, 2013, at 15:16 , Scott Ribe wrote: > On Dec 2, 2013, at 7:57 AM, Marcel Weiher wrote: > >> Then you can twiddle the hash to get you a good compromise of speed vs. >> collisions. > > You want to optimize the hash further? Only hash the first 1MB. Yup, th

Re: Fast hash of NSData?

2013-12-02 Thread Marcel Weiher
On Dec 1, 2013, at 15:36 , Graham Cox wrote: > Scanning my entire hard drive (excluding hidden files), which took several > hours, sure I had plenty of collisions - but absolutely no false ones - they > all turned out to be genuine duplicates of existing files. This is using the > FNV-1a 64-b

Re: Preferences caching?

2013-11-29 Thread Marcel Weiher
Hmm…I’ve had cases where the preferences were corrupted (presumably by Apple, I was only using the APIs) and prevented the app from launching. In terms of overall problems I think this was second to “I lost my license, can you help me”. Marcel On Nov 27, 2013, at 19:38 , Alex Kac wrote: > Wh

Re: why isn't id an id?

2013-10-04 Thread Marcel Weiher
On Oct 4, 2013, at 20:30 , Tom Davie wrote: > Right, really the confusion stems from the fact that objective-c has a > strange behaviour when dealing with the type “id”. Actually, “id” is not “strange” at all. It just uses the very simple Smalltalk semantics: an object *always* responds to

Re: iOS Calendar Question

2013-10-02 Thread Marcel Weiher
On Oct 2, 2013, at 19:44 , Dave wrote: > On 1 Oct 2013, at 18:26, Marcel Weiher wrote: >>> http://m.gunwharf-quays.com/whats-on/policing-through-ages >> >> As far as I can tell, that link delivers an ics file, “event.ics”, which is >> then opened automatically

Re: iOS Calendar Question

2013-10-01 Thread Marcel Weiher
On Oct 1, 2013, at 13:02 , Dave wrote: > > http://m.gunwharf-quays.com/whats-on/policing-through-ages > > If you open the above link on an iPhone and then click the Add to Calendar > button, you will that it appears to add an event to the calendar WITHOUT > asking the user for permission! Ho

Re: How to properly flip a UIView's coordinate system

2013-09-23 Thread Marcel Weiher
On Sep 21, 2013, at 22:38 , Markus Spoettl wrote: > I have a UIView on iOS that shares (a lot of) code with an NSView I have on > OSX. That code relies on a LLO (lower left origin) coordinate system and it's > not an option to change that. What’s the code? Mostly drawing? > So I transform

Re: Progress for archiving/dearchiving

2013-09-18 Thread Marcel Weiher
On Sep 17, 2013, at 17:35 , Fritz Anderson wrote: >> On Sep 16, 2013, at 18:51 , Jeffrey Oleander wrote: >> >>> If you want to know the total number of objects to be archived, then you >>> need to count them, at some time or another. To count them, you need to >>> walk the object tree before

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
On Sep 17, 2013, at 10:03 , Graham Cox wrote: > This is very much a worst-case. The file contains a 400MB embedded TIFF > image, which is the bottleneck. The archive probably only has a thousand > objects in it. Ahh, so the ‘other' case: rather than large numbers of objects, a few really l

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
Hi Graham! On Sep 16, 2013, at 20:26 , Graham Cox wrote: > Documents get saved in the background, so in some ways it doesn't matter how > long they take, but when waiting for a very big file to open, there can be a > noticeable delay (maybe 10-15 seconds) between the Open dialog going away and

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
On Sep 16, 2013, at 18:51 , Jeffrey Oleander wrote: > If you want to know the total number of objects to be archived, then you > need to count them, at some time or another. To count them, you need to walk > the object tree before you start actually archiving... which may take a > signifi

Re: RunLoop in Helper Tool

2013-09-16 Thread Marcel Weiher
. For example: On Sep 15, 2013, at 16:30 , Marcel Weiher wrote: > Do all the cleanup you want to do and then exit(0) ? > But yeah, NSApplicationMain doesn’t return, and that silly autorelease pool > most people put in main() these days never gets released, just accumulating > any o

Re: 64-bit iOS

2013-09-15 Thread Marcel Weiher
On Sep 10, 2013, at 23:47 , Tom Davie wrote: > Note, this was actually more significant on x86, where most of the mess > caused by CISC (like having bugger all registers) got sorted out. ? VAX had 16, M68K had 16, hmm, NS32032 only had 8. I’d say this was a an Intel ’86 problem, not a CISC

Re: 64-bit iOS

2013-09-15 Thread Marcel Weiher
On Sep 14, 2013, at 16:58 , David Duncan wrote: > On Sep 14, 2013, at 7:37 AM, vipgs99 wrote: >> So do I need replace all int to NSInteger? > > Technically no, but generally you do need to evaluate every usage of data > types of a specific width and ensure that in 64-bit mode you won’t exceed

Re: RunLoop in Helper Tool

2013-09-15 Thread Marcel Weiher
On Sep 15, 2013, at 17:04 , Kevin Meaney wrote: > On 15 Sep 2013, at 15:30, Marcel Weiher wrote: >> Do all the cleanup you want to do and then exit(0) ? > > I was doing exit(0) but after reading this discussion I thought it would be > cleaner to do the CFRunLoopStop on t

Re: RunLoop in Helper Tool

2013-09-15 Thread Marcel Weiher
On Sep 15, 2013, at 10:32 , Gerriet M. Denkmann wrote: > I have a Helper Tool, running as root, started via SMJobBless and > communicating vie Xpc. > > Works fine, but: > 1. it cannot stop (CFRunLoopStop), Do all the cleanup you want to do and then exit(0) ? Marcel

Re: ARC vs Manual Reference Counting

2013-09-13 Thread Marcel Weiher
On Sep 11, 2013, at 10:38 , John McCall wrote: >> [reduced need for Café Macs dinner tickets] > > Fortunately. :) But you do know where to get them anyway…? ;-) >> [inline reference counts] > > > Right. ARC doesn’t replace the benefit of having an inline reference count. > I think if we c

Re: Analyser reports memory leak… where?

2013-09-12 Thread Marcel Weiher
Hi Bill, On Sep 12, 2013, at 18:57 , Bill Cheeseman wrote: > As I recall, [Ali’s technote] stated that the "return [[x retain] > autorelease]" pattern is preferred for getters and gave many reasons for > preferring it. I understand that @synchronize generates getters that comply > with this p

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: 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: 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: 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
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: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
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

(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: 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

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: 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: 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: 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: 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: 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: 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-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

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: 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... >

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: 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: 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: 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: 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

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: 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

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: 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-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-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: 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: ^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: 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: 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: 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

[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: 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

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.

[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: 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: 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

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-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

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: 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: 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: 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: 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

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-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: singletons and autoreleased objects

2009-05-15 Thread Marcel Weiher
On May 13, 2009, at 8:30 , Karan, Cem (Civ, ARL/CISD) wrote: I have an object that I've turned into a singleton via the techniques described at: http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html#/ /apple_ref/doc/uid/TP40002974-CH4-SW3

Re: Creating an NSInvocation from an NSMethodSignature

2009-05-13 Thread Marcel Weiher
On May 13, 2009, at 11:27 , Mike Mangino wrote: I'm noticing something related that is causing my problems. I have mocking working for custom types. When I try to change the class of a string, however, I get a crash. -(void) testImplementationOnString { NSString *s = [NSString st

Re: How to solve the "command developer usr bin gcc-4.0 failed with exit code 1" mistake?

2009-05-09 Thread Marcel Weiher
On May 9, 2009, at 20:15 , Chris Hanson wrote: On May 9, 2009, at 7:39 PM, Bright wrote: when I open a Apple's samplecode of cocoa and run it, the mistake of “command developer usr bin gcc-4.0 failed with exit code 1" is occur. How to solve it? Are you just double-clicking the proj

Re: Hex to NSString or NSData

2009-05-09 Thread Marcel Weiher
Hi Andreas, that's an interesting way to do the conversion. On May 9, 2009, at 10:50 , Andreas Grosam wrote: int hexDigitToInt(char d) { int result; switch (d) { case '0': result = 0; break; case '1': result = 1; break; [snip] case 'E': result = 14; break; cas

Re: NSXMLParser frees itself on error?

2009-05-08 Thread Marcel Weiher
On May 8, 2009, at 6:50 , Michael Ash wrote: Begin forwarded message: From: Marcel Weiher Date: May 7, 2009 10:05:29 PDT And yes, the code that I use explicitly runs the runloop, and it is the code that runs the runloop that both allocates the NSURLConnection and then cleans up after

Re: Outrunning the Garbage Collector

2009-05-08 Thread Marcel Weiher
Hi Jeffrey, I have a multithreaded application with several NSOperationQueues and it appears as if under heavy load conditions I'm overwhelming the garbage collector so-to-speak. From what you describe, it looks like your analysis is spot on. I essentially have three queues which can be pr

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 7, 2009, at 21:12 , Michael Ash wrote: On Thu, May 7, 2009 at 11:53 PM, Marcel Weiher > wrote: On May 7, 2009, at 17:29 , Jeff Johnson wrote: On May 7, 2009, at 6:00 PM, Marcel Weiher wrote: That's not what I was talking about. I was talking about the possibility that th

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 7, 2009, at 17:29 , Jeff Johnson wrote: On May 7, 2009, at 6:00 PM, Marcel Weiher wrote: That's not what I was talking about. I was talking about the possibility that the 'owned' caller manually runs the run loop right after it calls the delegate callback, so any

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 7, 2009, at 10:39 , Jeff Johnson wrote: Actually, you were initially claiming that there was such a guarantee, and misquoting the docs to 'prove' your point. The memory management docs tell you what you should do, but nothing in Objective-C or Cocoa requires you to follow them. Wel

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 7, 2009, at 9:43 , Jeff Johnson wrote: You misunderstand my argument. I'm not claiming that autorelease provides some magical guarantee. Actually, you were initially claiming that there was such a guarantee, and misquoting the docs to 'prove' your point. I'm claiming that you oug

Re: Garbage collected and non-garbage collected

2009-05-07 Thread Marcel Weiher
[catching up with my cocoa-dev backlog] On Mar 10, 2009, at 20:36 , Michael Ash wrote: On Tue, Mar 10, 2009 at 2:47 PM, Robert Mullen wrote: Too little resource, too little experience, too little return. The first two are because this is a skunk works type corporate project that basically

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 7, 2009, at 8:37 , Jeff Johnson wrote: On May 7, 2009, at 2:38 AM, Marcel Weiher wrote: EXACTLY. Autorelease allows ownership transfer from called methods to occur without thrusting ownership on those that don't want it. That's one use, anyway. No. That is wha

Re: NSXMLParser frees itself on error?

2009-05-07 Thread Marcel Weiher
On May 6, 2009, at 23:56 , Jeff Johnson wrote: On May 7, 2009, at 12:27 AM, Marcel Weiher wrote: OK, quiz time: the reason for NSMutableString to relinquish ownership is to (a) release the object (b) allow someone else to take ownership? Answer: always (a), sometimes (b), and sometimes

Re: NSXMLParser frees itself on error?

2009-05-06 Thread Marcel Weiher
On May 6, 2009, at 21:34 , Jeff Johnson wrote: Ownership 'transfer' is rare. If you call +alloc or -copy, for example, ownership is transferred to the caller. Otherwise, there's no such thing. The fact that you think this is a testament to how well - autorelease works :-) How about +[N

Re: NSXMLParser frees itself on error?

2009-05-06 Thread Marcel Weiher
On May 6, 2009, at 18:45 , Jeff Johnson wrote: I think you misunderstand the problem that autorelease is trying to solve, which is to allow ownership transfer from a callee back to its caller, not to just simply delay a release until "later". Ownership 'transfer' is rare. If you call +al

Re: Problem Embedding Cocoa Framework

2009-05-06 Thread Marcel Weiher
On May 6, 2009, at 18:31 , George King wrote: Nick, thanks for the tip, you set me on the right track. Here is my new understanding of the problem. In my framework target settings, the Dynamic Library Install Name is set to: $(DYLIB_INSTALL_NAME_BASE:standardizepath)/$(EXECUTABLE_PATH) Th

Re: Integer as key in NSMutableDictionary

2009-05-06 Thread Marcel Weiher
Hi Greg, hope the runtime is being docile. :-) On May 4, 2009, at 23:24 , Greg Parker wrote: That's right. In some discussions of object-oriented programming, a distinction is made between "value objects" and "reference objects". Two value objects can be "equal" if they share the same "valu

Re: NSXMLParser frees itself on error?

2009-05-06 Thread Marcel Weiher
On May 6, 2009, at 15:49 , Jeff Johnson wrote: I still maintain that it's never safe to release/autorelease an object from inside one of it's delegate calls. If it works at all, you're implicitly relying on an implementation detail that's subject to change. I find this idea somewhat suspe

Re: Writable dir for non-admin user outside user's dir

2009-05-04 Thread Marcel Weiher
On May 4, 2009, at 13:37 , Michael Ash wrote: On Fri, May 1, 2009 at 3:28 AM, Erg Consultant > wrote: That's a pretty lame approach considering that Apple hides theirs. Seems like a poor example to me, given that the path to the iTunes DRM directory was posted right here in this very thread (

Re: Cocoa Drawing

2009-05-04 Thread Marcel Weiher
On May 1, 2009, at 3:20 , DairyKnight wrote: I'm trying to build a simple scribble program with Cocoa, and got some questions I couldn't solve. Hope someone here could help. 1. How can I perform a proper drawing in somewhere else rather than drawRect: ? Like the Win32 GetDC(HWND) and R

Re: TXT Records with NSImages

2009-04-30 Thread Marcel Weiher
Not sure this was solved. On 13.Mar, 2009, at 5:45 , Joe Turner wrote: NSImage *original = [NSImage imageNamed:NSImageNameComputer]; [original setSize:NSMakeSize(10.0f, 10.0f)]; -> this will not make your bitmap 10x10 pixels, but just change the DPI settings to make sure it

Re: NSXMLParser and NSDocument

2009-04-30 Thread Marcel Weiher
On Apr 30, 2009, at 12:36 , Jeffrey Oleander wrote: %S specifies a null-terminated array of 16-bit unicode characters. What you're passing is an NSString object. So the specifier should be the object specifier, %...@. Yes, that is what I had tried first. Still, the warning comes and goes.

Re: Why is NSString->FSRef so hard?

2009-04-30 Thread Marcel Weiher
On 29.Apr, 2009, at 21:02 , Charles Srstka wrote: On 29 Apr 09, at 06:15, Mark Douma wrote: Carbon and the Finder are displaying the filenames as is, as HFS allows slashes to be in a filename, and the colon is the separator. Cocoa and the BSD layer, on the other hand, do swap the slashes a

Re: Get the name of the method that called a method

2009-04-21 Thread Marcel Weiher
On Apr 20, 2009, at 23:09 , Alex Kac wrote: I am trying to log some specific error conditions in a fairly dynamic environment (of course Obj-C's forté), and would like to log some sort of backtrace of method calls that reached a specific method. What is the best way to get that info? This

Re: Reading in dictionary from txt file: options for speed

2009-04-16 Thread Marcel Weiher
On Apr 16, 2009, at 18:59 , Michael Ash wrote: On Thu, Apr 16, 2009 at 2:47 PM, WT wrote: since he'll be dealing with the string's raw bytes, won't Miles have to manually add a null byte to terminate the search string? The strnstr() function takes a length, and can thus be safely used on

Re: Reading in dictionary from txt file: options for speed

2009-04-16 Thread Marcel Weiher
On Apr 16, 2009, at 12:01 , Miles wrote: It looks like I have the search working like this, but I have to double-space the dictionary file to have a leading \n. No, you just need one initial extra newline at the start, the newline from the end of the last string matches up with the start

Re: Reading in dictionary from txt file: options for speed

2009-04-16 Thread Marcel Weiher
On Apr 16, 2009, at 10:10 , Miles wrote: Marcel, NOW we're talking. This has really been such an eye-opening thread. Now it's googling time to try to figure out how to search for a string in there. 1. Get the bytes out of your search string in the encoding that your dictionary is in 2.

Re: Reading in dictionary from txt file: options for speed

2009-04-16 Thread Marcel Weiher
ently. Learned something new with your message. On Apr 16, 2009, at 12:35 AM, Marcel Weiher wrote: I would do the following: 1. map the file into memory using -[NSData dataWithContentsOfMappedFile:] (or mmap() if you really want to) 2. Do not convert to individual objects for the words 3. ge

Re: static method to create CABasicAnimation: does this create a memory leak?

2009-04-15 Thread Marcel Weiher
On Apr 9, 2009, at 17:00 , Miles wrote: I have created a static method creating and returning an animation that I use in various places in my application. "Class method", please. Pretty please with sugar on top. :-) Nothing static about it... Cheers, Marcel

  1   2   >