Re: ARC and autorelease pools

2014-02-17 Thread Marcel Weiher
On Feb 17, 2014, at 2:08 , Clark Smith Cox III clark@apple.com 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

Re: Fast hash of NSData?

2013-12-02 Thread Marcel Weiher
On Dec 1, 2013, at 15:36 , Graham Cox graham@bigpond.com 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

Re: Fast hash of NSData?

2013-12-02 Thread Marcel Weiher
On Dec 2, 2013, at 15:16 , Scott Ribe scott_r...@elevated-dev.com wrote: On Dec 2, 2013, at 7:57 AM, Marcel Weiher marcel.wei...@gmail.com 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

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

Re: why isn't idMyCellDelegate an id?

2013-10-04 Thread Marcel Weiher
On Oct 4, 2013, at 20:30 , Tom Davie tom.da...@gmail.com 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

Re: iOS Calendar Question

2013-10-02 Thread Marcel Weiher
On Oct 2, 2013, at 19:44 , Dave d...@looktowindward.com wrote: On 1 Oct 2013, at 18:26, Marcel Weiher marcel.wei...@gmail.com 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

Re: iOS Calendar Question

2013-10-01 Thread Marcel Weiher
On Oct 1, 2013, at 13:02 , Dave d...@looktowindward.com 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

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 ms_li...@shiftoption.com 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

Re: Progress for archiving/dearchiving

2013-09-18 Thread Marcel Weiher
On Sep 17, 2013, at 17:35 , Fritz Anderson fri...@manoverboard.org wrote: On Sep 16, 2013, at 18:51 , Jeffrey Oleander jgo...@yahoo.com 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

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
On Sep 16, 2013, at 18:51 , Jeffrey Oleander jgo...@yahoo.com 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

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
Hi Graham! On Sep 16, 2013, at 20:26 , Graham Cox graham@bigpond.com 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

Re: Progress for archiving/dearchiving

2013-09-17 Thread Marcel Weiher
On Sep 17, 2013, at 10:03 , Graham Cox graham@bigpond.com 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

Re: RunLoop in Helper Tool

2013-09-16 Thread Marcel Weiher
: On Sep 15, 2013, at 16:30 , Marcel Weiher marcel.wei...@gmail.com 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

Re: RunLoop in Helper Tool

2013-09-15 Thread Marcel Weiher
On Sep 15, 2013, at 10:32 , Gerriet M. Denkmann gerr...@mdenkmann.de 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: RunLoop in Helper Tool

2013-09-15 Thread Marcel Weiher
On Sep 15, 2013, at 17:04 , Kevin Meaney k...@yvs.eu.com wrote: On 15 Sep 2013, at 15:30, Marcel Weiher marcel.wei...@gmail.com 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

Re: 64-bit iOS

2013-09-15 Thread Marcel Weiher
On Sep 14, 2013, at 16:58 , David Duncan david.dun...@apple.com wrote: On Sep 14, 2013, at 7:37 AM, vipgs99 vipg...@gmail.com 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

Re: 64-bit iOS

2013-09-15 Thread Marcel Weiher
On Sep 10, 2013, at 23:47 , Tom Davie tom.da...@gmail.com 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

Re: ARC vs Manual Reference Counting

2013-09-13 Thread Marcel Weiher
On Sep 11, 2013, at 10:38 , John McCall rjmcc...@apple.com 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

Re: Analyser reports memory leak… where?

2013-09-12 Thread Marcel Weiher
Hi Bill, On Sep 12, 2013, at 18:57 , Bill Cheeseman wjcheese...@gmail.com 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

Re: ARC vs Manual Reference Counting

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

Re: ARC vs Manual Reference Counting

2013-09-10 Thread Marcel Weiher
On Sep 10, 2013, at 21:52 , Ken Thomases k...@codeweavers.com 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: [self setTemp:newObject

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 9:44 , Kyle Sluder k...@ksluder.com 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),

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 11:33 , Tom Davie tom.da...@gmail.com wrote: On 9 Sep 2013, at 10:18, Jean-Daniel Dupas devli...@shadowlab.org 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

(Pre)mature optimization and small efficiencies

2013-09-09 Thread Marcel Weiher
On Sep 3, 2013, at 16:54 , Fritz Anderson anderson.fr...@gmail.com wrote: On 2 Sep 2013, at 12:47 AM, Marcel Weiher marcel.wei...@gmail.com 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 j...@mooseyard.com wrote: [..] [fg160,160,160;16:34:40.488| [fg0,128,0;[;NSDateFormatter took 26.97 µsec [fg160,160,160;16:34:48.649|

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:05 , Jean-Daniel Dupas devli...@shadowlab.org wrote: Le 9 sept. 2013 à 18:11, Jens Alfke j...@mooseyard.com 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

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:20 , Tito Ciuro tci...@mac.com wrote: On Sep 9, 2013, at 10:14 AM, Marcel Weiher marcel.wei...@gmail.com wrote: Premature optimization is the root of all evil! What's premature about it? Nothing: Er, I misspelled: “very cool, nice job!” :-) Marcel

Re: 30x faster JSON date parsing

2013-09-09 Thread Marcel Weiher
On Sep 9, 2013, at 19:35 , Jens Alfke j...@mooseyard.com wrote: On Sep 9, 2013, at 10:14 AM, Marcel Weiher marcel.wei...@gmail.com 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

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 j...@mooseyard.com wrote: On Sep 9, 2013, at 10:48 AM, Jeffrey Oleander jgo...@yahoo.com wrote: [..] Some do, but the dread of customer rebellion is strong, and they want to enter them in the slap-dash, hurried, harried ways

Re: Threadsafe copy of objective c object

2013-09-05 Thread Marcel Weiher
On Sep 3, 2013, at 12:52 , Jonathan Taylor jonathan.tay...@glasgow.ac.uk 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

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 k...@ksluder.com 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

Re: Threadsafe copy of objective c object

2013-09-04 Thread Marcel Weiher
On Sep 4, 2013, at 10:56 , Jonathan Taylor jonathan.tay...@glasgow.ac.uk wrote: On 3 Sep 2013, at 19:49, Marcel Weiher marcel.wei...@gmail.com 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

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 graham@bigpond.com wrote: On 31/08/2013, at 6:48 PM, Marcel Weiher marcel.wei...@gmail.com wrote: So you’ve had good practical experience with forward/backward compatible designs

Re: Experience with keyed archiving forward/backwards compatibility?

2013-09-01 Thread Marcel Weiher
On Sep 1, 2013, at 18:26 , Uli Kusterer witness.of.teacht...@gmx.net 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

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 witness.of.teacht...@gmx.net wrote: On Aug 28, 2013, at 4:53 PM, Marcel Weiher marcel.wei...@gmail.com wrote: does anyone have practical experience with the forward/backward compatibility aspect of keyed

Re: Creating CGFont from PDF Tf operator

2013-08-29 Thread Marcel Weiher
On Aug 28, 2013, at 16:02 , Graham Cox graham@bigpond.com 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.

Re: Creating CGFont from PDF Tf operator

2013-08-28 Thread Marcel Weiher
On Aug 27, 2013, at 14:46 , Graham Cox graham@bigpond.com 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

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: Retina / non retina : Drawing icons

2013-08-26 Thread Marcel Weiher
On Aug 21, 2013, at 18:18 , Erwin Namal erwin.na...@gmail.com 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

Re: NSValue valueWithBytes:objCType:

2013-08-25 Thread Marcel Weiher
On Aug 24, 2013, at 22:09 , Andreas Grosam agro...@onlinehome.de 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

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 diede...@tenhorses.com 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

Re: Fastest way to replace characters in string

2013-08-22 Thread Marcel Weiher
On Aug 22, 2013, at 19:43 , Steve Mills smi...@makemusic.com wrote: On Aug 22, 2013, at 12:31:55, Thomas Wetmore t...@verizon.net 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

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

2013-08-21 Thread Marcel Weiher
On Aug 20, 2013, at 18:02 , Uli Kusterer witness.of.teacht...@gmx.net wrote: On Aug 20, 2013, at 12:36 PM, Gerriet M. Denkmann gerr...@mdenkmann.de 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

Re: NSMethodSignature throws an exception encoding GLKMatrix4

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

Re: predefined macro iOS vs OS X

2013-08-18 Thread Marcel Weiher
On Aug 17, 2013, at 19:01 , Jean-Daniel Dupas devli...@shadowlab.org wrote: Le 17 août 2013 à 17:55, Marcel Weiher marcel.wei...@gmail.com 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

Re: predefined macro iOS vs OS X

2013-08-18 Thread Marcel Weiher
On Aug 18, 2013, at 15:06 , Kyle Sluder k...@ksluder.com wrote: On Aug 18, 2013, at 6:28 AM, Marcel Weiher marcel.wei...@gmail.com wrote: On Aug 17, 2013, at 19:01 , Jean-Daniel Dupas devli...@shadowlab.org wrote: You don't have to add explicit dependency to anything as NSGeometry.h

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 gerr...@mdenkmann.de 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

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 16, 2013, at 19:04 , Kyle Sluder k...@ksluder.com wrote: On Aug 16, 2013, at 12:41 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 16 Aug 2013, at 22:59, Kyle Sluder k...@ksluder.com wrote: Xcode does know this. But if you're building for 32-bit OS X, it will correctly

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 16, 2013, at 19:04 , Kyle Sluder k...@ksluder.com wrote: On Aug 16, 2013, at 12:41 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote: On 16 Aug 2013, at 22:59, Kyle Sluder k...@ksluder.com wrote: Xcode does know this. But if you're building for 32-bit OS X, it will correctly

Re: predefined macro iOS vs OS X

2013-08-17 Thread Marcel Weiher
On Aug 17, 2013, at 18:03 , Maxthon Chan xcvi...@me.com wrote: On Aug 17, 2013, at 23:52, Marcel Weiher marcel.wei...@gmail.com wrote: On Aug 16, 2013, at 19:04 , Kyle Sluder k...@ksluder.com wrote: Stop using NSRect in your method prototypes and just use CGRect. This is certainly

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 j...@mooseyard.com wrote: On Jul 7, 2013, at 1:37 PM, Frederick Bartram bartr...@acm.org 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

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 j...@mooseyard.com wrote: On Apr 25, 2013, at 1:20 AM, Oleg Krupnov oleg.krup...@gmail.com wrote: This breaks encapsulation of objects with block properties (e.g. MyAnimation.completionBlock) I understand the problem you're describing (and

Re: ARC Help

2013-03-22 Thread Marcel Weiher
On Mar 22, 2013, at 23:27 , Quincey Morris quinceymor...@rivergatesoftware.com 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,

Re: Understanding user defaults

2013-03-19 Thread Marcel Weiher
On Mar 19, 2013, at 1:19 , Jens Alfke j...@mooseyard.com wrote: On Mar 18, 2013, at 5:14 PM, Rick Mann rm...@latencyzero.com 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.

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

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

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 cocoa...@charlessoft.com wrote: On Sep 10, 2012, at 9:23 PM, Quincey Morris quinceymor...@rivergatesoftware.com wrote: It doesn't need all the extra scaffolding. KVC will peer quite happily into your instance variables by default. What you

[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 true: in general you should avoid specific model - view

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 marcel.wei...@gmail.com 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 manage to change

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 when

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: xml version=1.0 encoding=UTF-8? users user name=Eric Dolecki playlist name=Iron Maiden source=Spotify/ playlist name=Kate Bush source=Pandora/ /user /users Don't know much about TBXML, but

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

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 the

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

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

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

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

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

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

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

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

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 marcel.wei...@gmail.com 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

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-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 what you need

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 robe...@autowc.com wrote: Too little resource, too little experience, too little return. The first two are because this is a skunk works type corporate

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

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.

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 performSelector

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 marcel.wei...@gmail.com 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

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

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

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)

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

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

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

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 erg_consult...@yahoo.com 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

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

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

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

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

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 jrca...@gmail.com 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

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

2009-04-15 Thread Marcel Weiher
On Apr 14, 2009, at 11:12 , Miles wrote: I'm trying to find the best way to load in a 2MB text file of dictionary words and be able to do quick searches. Simply loading the uncompressed txt file takes about 0.5 seconds which I can handle. What do you do to load the txt file? 0.5

Re: The efficiency of swapping endianness on an iPhone?

2009-04-15 Thread Marcel Weiher
On Apr 14, 2009, at 17:22 , Harry G wrote: Hi, I'm currently writing an app for iphone that downloads large tables of text and images , and my server outputs big endian. Hmm...I would generally expect both text and images to be endian- neutral, are you sure byte-order is an issue? How

Re: Best way to pass large objects between tasks?

2009-04-15 Thread Marcel Weiher
On Apr 12, 2009, at 23:26 , Oleg Krupnov wrote: I haven't tried either of the methods I mentioned so far (because I'm lazy, sorry:), but what I have tried is I created NSData from the large object by using NSKeyedArchiver. It has taken forever, so that I had to force-quit the process. Yes,

  1   2   >