Re: why isn't id an id?

2013-10-04 Thread Tom Davie
h the fact that ids come up all the time, and show some support for wanting a language where the compiler can make more proofs for us. Thanks Tom Davie * prove is a loaded term when it comes to objective-c, as the runtime can mess up your compile time proo

Re: Analyser reports memory leak… where?

2013-09-12 Thread Tom Davie
EventTypes retain] autorelease]; > } It’s not a hard and fast rule, and in fact collection access does not do this, so it’s entirely possible to do things like: id a = x[5]; [x removeObjectAtIndex:5]; [a crashMyProgram]; Tom Davie ___ Cocoa-dev maili

Re: 64-bit iOS

2013-09-10 Thread Tom Davie
; Maybe, maybe not. The flip side is that pointers are twice as large, so half > as many fit in cache. And off when you do need to hit RAM you need to fetch more data. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: 64-bit iOS

2013-09-10 Thread Tom Davie
ow-down due to the increase of instruction and > pointer size. Note, this was actually more significant on x86, where most of the mess caused by CISC (like having bugger all registers) got sorted out. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lis

Re: 30x faster JSON date parsing

2013-09-09 Thread Tom Davie
er to parse. > > Yes. It's ridiculous that a lot of JSON APIs send ISO 8601-formatted (or > other human-readable format) dates. Yes, it absolutely is, when no human is going to read them. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@l

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Tom Davie
On 9 Sep 2013, at 11:49, Jean-Daniel Dupas wrote: > > Le 9 sept. 2013 à 11:33, Tom Davie a écrit : > >> >> On 9 Sep 2013, at 10:18, Jean-Daniel Dupas wrote: >> >>> >>> Le 9 sept. 2013 à 09:58, Tom Davie a écrit : >>>

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Tom Davie
On 9 Sep 2013, at 10:18, Jean-Daniel Dupas wrote: > > Le 9 sept. 2013 à 09:58, Tom Davie a écrit : > >> >> On 9 Sep 2013, at 09:44, Kyle Sluder wrote: >> >>> Thirded. I thought I wouldn't like it. As soon as I didn't have to manage >

Re: ARC vs Manual Reference Counting

2013-09-09 Thread Tom Davie
r converting to ARC, I have seen numbers between 30% and 100% slowdown with ARC. The average is probably around 50%. I have never seen performance improve when using ARC. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: Unicode chars in string

2013-09-09 Thread Tom Davie
urancesOfString:@“→” withString:@“⤜”]. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscr

Re: Threadsafe copy of objective c object

2013-09-03 Thread Tom Davie
What I’m surprised no on has mentioned here is the trivial… Remove the mutation methods. Make your object immutable, the referential transparency will give you “free” parallelism. If you want a mutated version of the object, create a new object. Tom Davie

Re: How to fix warning?

2013-08-28 Thread Tom Davie
unsigned, as is the bigger issue in this case), you must cast them either explicitly (by adding the casts in this expression), or implicitly, by assigning the littorals to a variable of the desired type. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@l

Re: "Introducing ioscomponents.com"

2013-08-28 Thread Tom Davie
to select the export type, and a UIPicker to select the export format. That said, don’t get disheartened – a good, high quality data table is something that would be very useful on iOS – just try to polish it up more! Tom Davie On 27 Aug 2013, at 04:56, Jason Gibbs wrote: > Also one m

Re: NSLog object = nil?

2013-08-20 Thread Tom Davie
anagement. Instead, whatever is holding strong references to the item store needs to release those references. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the lis

Re: IB autolayout is impossible

2013-08-20 Thread Tom Davie
is doing very wrong here :D Tom Davie On 20 Aug 2013, at 09:55, Rick Mann wrote: > I have filed literally hundreds of bug reports. I get the spirit of what > you're saying, but I'm so stressed from this project (and IB's hand in it), > and so demoralized from hav

Re: IB autolayout is impossible

2013-08-20 Thread Tom Davie
extra view. Tom Davie On 20 Aug 2013, at 01:48, dangerwillrobinsondan...@gmail.com wrote: > In general in 4.x add your constraints that will make a satisfiable layout, > then remove the ones you don't want. > The next one does less trying without asking but this one is not that ba

Re: How to detect a Retina Mac

2013-08-18 Thread Tom Davie
apRep release]; No need for the complex cocoa to CG manoeuvrings there, this will do fine: NSSize size = …; CGColorSpaceRef rgbColorSpace = CGColorSpaceCreateDeviceRGB(); CGContextRef ctx = CGBitmapContextCreate(NULL, size.width, size.height, 8, 8 * 4 * size.width, rgbColorS

Re: How to detect a Retina Mac

2013-08-18 Thread Tom Davie
On 18 Aug 2013, at 15:56, Gerriet M. Denkmann wrote: > > On 18 Aug 2013, at 20:09, Tom Davie wrote: > >> >> On 18 Aug 2013, at 15:03, Gerriet M. Denkmann wrote: >> >>> I just noticed that the program I use to create Png files creates files >>

Re: How to detect a Retina Mac

2013-08-18 Thread Tom Davie
suggested, it’s just unnecessary here. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscr

Re: reverse scanner

2013-08-10 Thread Tom Davie
On 10 Aug 2013, at 22:44, Keary Suska wrote: > On Aug 10, 2013, at 12:17 PM, Tom Davie wrote: > >> Heh, I’d actually argue that NSScanner is a much much better API to use here >> (and in fact nearly everywhere). Regular expressions constrain you only to >> regul

Re: reverse scanner

2013-08-10 Thread Tom Davie
turing complete program. About the only use for regular expressions I can think of is asking NSScanner to scan something that it doesn’t by default know about. Tom Davie On 10 Aug 2013, at 19:53, Jerry Krinock wrote: > > On 2013 Aug 10, at 10:07, Boyd Collier wrote: > >> but

Re: How to convert an NSString to

2013-08-07 Thread Tom Davie
> different kinds of whitespace. This is incorrect. %20 is specifically for representing the 0x20th Unicode character – that is “space”. It is not for representing other whitespace characters like tab (%09) etc. Tom Davie ___ Cocoa-dev mailin

Re: Synchronous Serial Port Protocol messaging With NSOperationQueue/GCD

2013-08-07 Thread Tom Davie
hould be checked and set to stop any other operations proceeding until the semaphore is unset. When the device responds, the semaphore should be unset. You can then make your operation queue a concurrent queue, rather than a serial one, so that you can send messages to more than one device at t

Re: Mixing Obj-C and C "methods"

2013-08-07 Thread Tom Davie
t reason – making everything effectively a global is just terrible design. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(a

Re: when __bridge isn't required

2013-07-27 Thread Tom Davie
The first gives me the following error: Implicit conversion of Objective-C pointer type 'NSString *' to C pointer type 'CFStringRef' (aka 'const struct __CFString *') requires a bridged cast Tom Davie On Jul 27, 2013, at 8:31 PM, Matt Neuburg wrote: > I feel

Re: LATIN SMALL LETTER U WITH DIAERESIS

2013-07-18 Thread Tom Davie
A workaround would be to use +[NSFileHandle fileHandleForWritingAtURL: error:] and -[NSFileHandle fileDescriptor] to get you a FD to use in C land. Tom Davie On Jul 17, 2013, at 11:26 PM, koko wrote: > With this character: > > LATIN SMALL LETTER U WITH DIAERESIS > Unicode: U+00F

Re: NSViewController subclass return type

2013-07-11 Thread Tom Davie
e the superclass implementation. Except that view is a read/write property, and this is a type error, because of this situation: UIVCSubclass *s = [[UIVCSubclass alloc] init...]; UIViewController *vc = s; [vc setView:[[[UIView alloc] init] autorelease]; Tom Davie _

Re: Isolated process for each NSDocument of my app

2013-06-13 Thread Tom Davie
On 13 Jun 2013, at 20:29, Daniele Margutti wrote: > > On 13 Jun 2013, at 20:05, Tom Davie wrote: > >> The best way is to write an application that's stable. The only reason >> browsers started doing this was because they had to deal with 3rd party code >> (

Re: Isolated process for each NSDocument of my app

2013-06-13 Thread Tom Davie
The best way is to write an application that's stable. The only reason browsers started doing this was because they had to deal with 3rd party code (e.g. flash) that was giving them a terrible reputation for instability. If you're controlling the entire app, you have no reasonable reason to do th

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Tom Davie
up the request in the first place. I would consider that a much much much higher penalty than having to a bit careful about retain cycles. Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Tom Davie
y time soon, nice as it > might be. Luckily, if you grab Landon Fuller's PLWeakCompatibility (and possibly Mike Ash's MAZeroingWeakRef too), you'll be able to use __weak in your non-arc code too. Thanks Tom Davie ___ Cocoa-dev mailing

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Tom Davie
he compiler *is* detecting some simple cases, as I suggested! Note – this does not make throwing blocks around without paying attention to retain cycles inherently safe though, the compiler can not statically infer all potential cycles. Thanks Tom Davie

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Tom Davie
ng possible to detect a lot of cycles with a static analyser. Obviously you couldn't detect all of them, but this would probably get a good way to stomping on the "you used an ivar here, and self retains the block, that's bad m'kay" bugs. Thanks Tom Davie _

Re: ^Block statement considered harmful for callbacks?

2013-04-25 Thread Tom Davie
to other objects. It's not blocks that are doing any of the above, it's reference counting. And we know that the issues are there – we just choose to have them because the issues with the less leaky solutions are even more severe (especially in C like languages). Thanks Tom Davie _

Re: Followup - Re: Is there a pattern for creating an object with global scope?

2013-04-15 Thread Tom Davie
st certainly be using dependancy injection instead, or some other method of avoiding it. Note also – simply using your app delegate as a store for things that aren't singletons, but only one of them is pointed at by your app delegate is also horrific – you're just substituting one sing

Re: Is there a pattern for creating an object with global scope?

2013-04-13 Thread Tom Davie
lass = [[MyClass alloc] init]; }); return _sharedMyClass; } This makes the access to the singleton thread safe when it's first created. Of course, you then get into the nightmare of trying to maintain thread safety when you have a chunk of global state lying around, but that's

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
;s a subview of another view that's retained. The issue isn't quite as simple as "never retain IBOutlets". Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderat

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
1) yes you could use the code you outlined to access the property 2) @property (assign, nonatomic) IBOutlet NSWindow *iWindow; Note though to be careful about the assign tag there – you may well want that to be a retain. Thanks Tom Davie On 5 Apr 2013, at 15:06, Pax <45rpmli...@googlemail.

Re: Accessing members from NSDictionary

2013-04-05 Thread Tom Davie
bility, you would be replacing someObject->someIvar = 56.9f; with someObject.someProperty = 56.9f; and { float someIvar; } with @property (assign, nonatomic) float someProperty; So neither is really true. Thanks Tom Davie ___ Cocoa-dev mail

Re: cocoa bindings performance

2013-02-17 Thread Tom Davie
to steer well clear of bindings (along with a couple of other techs that supposedly make life easier, like CoreData and Storyboards). Thanks Tom Davie On 15 Feb 2013, at 19:42, Maximilian Marcoll wrote: > > Hi everyone! > > I have a problem with bindings, or so it seems. > &g

Re: faster deep copies?

2013-02-14 Thread Tom Davie
re selective. But I'd appreciate any thoughts in > the meantime. One possible approach to this (though not one that's going to be as fast as a custom deepCopy method), would be to implement your own NSCoder subclass. I have in the past made keyed archivers which are sub

Re: How to avoid warning?

2013-01-21 Thread Tom Davie
On 21 Jan 2013, at 18:14, Dave wrote: > Hi All, > > I have the following code: > > if (class_RespondsToSelector(myClass,@selector(initWithManager:) == NO) > myObj = [[myClass alloc] init]; > else > myObj = [[myClass alloc] initWithManager:sel]]; > > > I get a warning on the initWi

Re: NSOpenPanel runModal on a dispatch

2012-12-17 Thread Tom Davie
t there, doing nothing, with no significant windows open, yet in an inconsistent state, and requiring modal interaction to sort it out? If that's your assertion, then I'd suggest you have a deeper seated design bug. Thanks Tom Davie ___ Cocoa-dev

Re: NSOpenPanel runModal on a dispatch

2012-12-17 Thread Tom Davie
quot; can change when an open panel > is opened. Wouldn't the correct thing in this state be to create a new project window associated with the project document, and then fire of an open sheet for that window so that it's only modal for the window? Thanks Tom Davie _

Re: NSOpenPanel runModal on a dispatch

2012-12-17 Thread Tom Davie
go "oh crap, I forgot to start that fade", and start it, with the open panel for the next video open? Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list.

Re: NSOpenPanel runModal on a dispatch

2012-12-17 Thread Tom Davie
interact > the app while an open panel displaying. But why? What's the issue with the user pausing a video while an open panel happens to be open? Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tom Davie
inish executing until the open dialog is closed. If the openDialog methods dispatch to the main queue, their dispatches will not occur until the main queue is able to run another block, which won't happen until your block finishes. You are very much blocking the main queue. Thanks Tom Da

Re: NSOpenPanel runModal on a dispatch

2012-12-16 Thread Tom Davie
ay. 1) You know exactly how big the array's going to be – 1 object, so why hint that it's going to contain 0 objects? 2) Why use insertObject: atIndex:0 rather than addObject: 3) Why use a mutable array at all? You could just use a constant array – NSArray *filetype = [NSArray

Re: How To Safely Invoke a Block

2012-11-21 Thread Tom Davie
spatch_once(&onceToken, ^ { dispatchQueue = dispatch_queue_create("RXProgressQueue", DISPATCH_QUEUE_SERIAL); }); dispatch_sync(dispatchQueue, ^() { ProgressHandler handler = [self progressHandler]; handler(…); }); … } Tom Davie

NSSearchField selecting after sending its action

2012-11-17 Thread Tom Davie
ected). Does anyone know what weird property I've ended up accidentally selecting (or not selecting) here? Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the lis

Re: Is ARC any smarter than Xcode's 'Analyze'?

2012-11-12 Thread Tom Davie
ill > crash. > > Am I correct? Yes, ARC is significantly smarter than analyse. ARC is guaranteed to get memory management right (modulo retain cycles and weak refs that shouldn't be weak). Meanwhile the analyser is trying to understand what *you* did to try and m

Re: How to implement readonly property

2012-11-12 Thread Tom Davie
ken is an ivar, unlike I did. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Up

Re: How to implement readonly property

2012-11-12 Thread Tom Davie
On 12 Nov 2012, at 13:39, Marco Tabini wrote: >> This is completely the wrong way to implement a property. The static >> variable will be shared between all instances. Here's how you should be >> doing a lazy loaded var: >> >> @implementation MyClass >> { >> NSDictionary *_someDictionary

Re: How to implement readonly property

2012-11-12 Thread Tom Davie
nce block, and then continue to execute (without touching the contents). Thus, both threads will receive the same dictionary (assuming it's the same instance it's called on), and it will be allocated only once. Tom Davie ___ Cocoa-

Re: a way to clear inactive RAM

2012-11-06 Thread Tom Davie
se "free" memory for things like disk caches if I currently do not need the RAM for applications. Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact th

Re: Cocoa equivalent for 'InstallApplicationEventHandler'

2010-02-20 Thread Tom Davie
You want NSEvent's + (id)addGlobalMonitorForEventsMatchingMask:(NSEventMask)*mask* handler:(void (^)(NSEvent*))*block* *and* * + (id)addLocalMonitorForEventsMatchingMask:(NSEventMask)mask handler:(NSEvent* (^)(NSEvent*))block Bob * On Sat, Feb 20, 2010 at 11:45 AM, Vikram Sethi wrote: > Hi, >

Open panel is permanently dead?

2010-02-19 Thread Tom Davie
modalDelegate:self didEndSelector:@selector(compressionSheetDidEnd:) contextInfo:nil]; [compressingProgress startAnimation:self]; } }];} Thanks Tom Davie ___

Overriding NSMenuItem's drawing

2010-02-17 Thread Tom Davie
I need an NSMenuItem that rather than drawing an NSImage in it's cell draws *part* of an NSImage, is it possible to override NSMenuItem's drawing in any way to achieve this? I don't see the relevant methods. Thanks Tom Davie ___ Co

Bizarre locking issue

2010-01-24 Thread Tom Davie
*)tableColumn byItem:(id)item { return @"Library"; // if (item == self.library) // { // return @"Library"; // } } Note that commenting out both lines that requests self.library cause the error to go away. Any help would be much appreciated. Thanks Tom Davie p.s. Here's a st

Re: UIImageView display as "multiply"?

2010-01-22 Thread Tom Davie
An image doesn't carry a blend mode, merely the image data. You *draw* the image in a given blend mode. Bob On Fri, Jan 22, 2010 at 3:52 PM, Eric E. Dolecki wrote: > I'm not combining two or more images, I merely would like a single uiimage > in a uiimageview to have a blend mode applied to it

Re: [iphone] Release Navigation View Controller Question

2010-01-17 Thread Tom Davie
Yes, that code is 100% fine. Here's the logic from purely your point of view. You allocate browserviewController and in doing so take ownership. You do some stuff with browserviewController. You are finished with browserviewController, and don't want to do anything else with it, so you resign own

Re: Encrypting Binary Strings

2009-12-30 Thread Tom Davie
Simple answer: no. If your application can still read the strings, so can a clever person, if by nothing else than sitting and patiently emulating a CPU with a piece of paper and a pencil. In order to actually secure something *you, or your recipient* have to be involved in decrypting it, by know

Removing the dragging image

2009-12-27 Thread Tom Davie
of it? Thanks Tom Davie ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription

Scanning

2009-11-17 Thread Tom Davie
I'm trying desperately to find where the API for scanning images is, I've found the Image Capture API on developer.apple.com, but I can't find a more recent version than one for 10.4, and none of the sample code compiles any more, worse the sample apps crash on launch. What should I be searching t

Changing the edit behaviour of a cell

2009-10-09 Thread Tom Davie
I've been busy reading the documentation all day, and can't for the life of me figure out how to change the editing behavior of an NSCell. I have a cell, which I'd like to pop up a window over when the user attempts to edit it (much like many websites do to present a date picker for example). I ha