RE: Code Sign verification on Leopard

2009-10-14 Thread Jeff Laing
> Actually, heck, you wouldn't even need that. All a virus would have to > do would be to move the binary somewhere else and put a binary in its > place that does something malicious and then launches the real binary, > and the user would never tell the difference. > > Unless, of course, the app c

RE: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Jeff Laing
> Not necessarily true. While you are free to specify a delegate as > NSObject , it is not standard convention. The convention > for delegates is: id. As I recall, sending variables of type id useful messages like retain and release generate a compiler warning, whereas NSObject are fine. I cou

RE: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Jeff Laing
> > I could be wrong on this, but I definitely recall thinking it was a > stupid compiler behavior. > > This is because you didn't declare your protocol as extending the > NSObject protocol. If you do something like this: > > @protocol MyProtocol > > Then you can call all the NSObject stuff with

RE: case-insensitive but case-ordered sort

2010-07-20 Thread Jeff Laing
> aAbBcCdDeEfF .. etc with everything outside the letter space sorting > 'naturally' and coming after the letters (I actually don't care too much about > the last bit honestly they can go where they like as long as it's outside the > alphabet range). > > so > > myClass comes before

RE: copyWithZone - if anyone could explain this to me ?

2009-11-30 Thread Jeff Laing
> In most cases, yes. However, copyWithZone: is special, the superclass' > implementation just blindly copies all of the raw bits in the source > object to the newly created one. If you were to use the normal > -setImage: call, that old value would be released one too many times. > Assigning to the

RE: copyWithZone - if anyone could explain this to me ?

2009-11-30 Thread Jeff Laing
> > Why would you not just do: > > > >[cell->image retain]; > > > > That makes it a lot clearer to me - since it was a bitwise copy, > > cell->image and image are identical values whereas the assignment > > looks like you are changing something. > > Because it may *not* have been a bitwise cop

RE: NSDictionary trouble

2010-01-19 Thread Jeff Laing
> > I think dictionaryWithCapacity should both alloc and init it, right? > > Yes, and it autoreleases it too. :-o That means it'll conveniently be > released later on, which is exactly what you're running into. If you > want to keep a reference to the dictionary, you should call alloc and > init y

RE: NSDictionary trouble

2010-01-19 Thread Jeff Laing
> >> Yes, and it autoreleases it too. :-o That means it'll conveniently be > >> released later on, which is exactly what you're running into. If you > >> want to keep a reference to the dictionary, you should call alloc and > >> init yourself. I wrote: > > No, you should just *retain* the result o

RE: Looking for info on anti-piracy and trial-mode techniques for my app . . .

2010-02-24 Thread Jeff Laing
> > Part of your response suggests that if there was an existing > framework that was openly available, it wouldn't do me any good because > the bad guys would have the source code. > > I disagree. If it's based on a tried and tested (and occasionally > formally verified) crypto system, knowing th

RE: Bison/Yacc with Objective-C ?

2010-03-09 Thread Jeff Laing
> I haven't tried it, so this might be nonsense, but I think that YACC > simply copies the emitted code from the source file to the final C > file. Yacc has to parse the emitted code enough to be able to replace references to $$, $1, etc with the corresponding tokens from the recognized grammar e

RE: [[Class alloc] init] preferable over [[Class instance] retain]?

2010-03-09 Thread Jeff Laing
> For example, is: > > NSMutableArray *anArray = [[NSMutableArray array] retain]; > > better than: > > NSMutableArray *anArray = [[NSMutableArray alloc] init]; I've been reamed, in the recent past, for expressing the opinion that the first was just as good as the second - apparently the answer

RE: Cocoa and email (SMTP/POP3)

2009-06-23 Thread Jeff Laing
Ok, I'll bite. How does the mail server that Mail.app is talking to distinguish between Mail.app and /usr/sbin/sendmail ? They both presumably just talk SMTP ? If the scriptable solution works, then roll-your-own-smtp should also work, provided you go the hard yards and implement everything it

RE: Cocoa and email (SMTP/POP3)

2009-06-23 Thread Jeff Laing
cker.com/software/email-apps/how-to-use-gmail-as-your-smtp-server-66.php -Original Message- From: Andrew Farmer [mailto:andf...@gmail.com] Sent: Wednesday, 24 June 2009 3:27 PM To: Jeff Laing Cc: Nick Zitzmann; cocoa-dev@lists.apple.com Subject: Re: Cocoa and email (SMTP/POP3) On 23 Ju

RE: GC pros and cons

2009-06-24 Thread Jeff Laing
> I think it depends what language you weaned yourself on. If you've used Lisp > or some other > functional language, manual reclamation is an unthinkable monstrosity. If you > weaned yourself > on C or similar languages, manual reclamation seems like the default state of > play. Its also going

RE: GC pros and cons

2009-06-24 Thread Jeff Laing
> Well, no, that's not a good summary of the last couple paragraphs. IF > YOU HAVE A FINALIZER, then you should probably be using the Unless you peer into the implementation details of your superclasses, you should assume that all classes may have a finalizer. Unless you don't care about every l

RE: GC pros and cons

2009-06-24 Thread Jeff Laing
> 1. If your objects use (scarce) resources that are not themselves > subject to GC (file handles, network connections, whatever), you'd be [snip] > 2. If you expect objects to be returned to the free memory pool "the > instant that those objects aren't required" then GC isn't going to > satisfy yo

RE: Clarification on accessors? (was: Yet another memory management question)

2009-07-08 Thread Jeff Laing
> Because you have no idea what subclassers may do in their overrides of > the accessors Sort of invalidates the whole encapsulation promise of OO design, doesn't it? > (e.g. The subclassed accessor may rely on state that's > been torn down earlier in -dealloc). But any subclass that's going to

RE: Clarification on accessors? (was: Yet another memory management question)

2009-07-08 Thread Jeff Laing
> No, it doesn't. It would in fact violate the encapsulation principle > if your -dealloc method required your accessors to not rely on certain > state. The "ability to override accessors violates encapsulation" because it adds additional restrictions to the accessor that the superclass is not a

RE: literal strings - who do they belong to?

2009-07-12 Thread Jeff Laing
> According to Cocoa/ObjC memory-management, if you get an object > (reference) via "alloc","new",any object that contains "copy", and > any object you send [ retain] to, is yours - it becomes your > responsibility to call [ release] on it when you're > done. Ditto for properties like > > @propert

RE: literal strings - who do they belong to?

2009-07-12 Thread Jeff Laing
> Unfortunately, this contract isn't always followed. Lots of people > "optimise" away this policy instead of doing a "superfluous" 'return > [[foo retain] autorelease]'. On initial read, I didn't quite follow this. If my method is returning a foo that I know I have "retained", what requirement

RE: literal strings - who do they belong to?

2009-07-13 Thread Jeff Laing
obj foo]; b) indirectly.NSObject *val = [[[someobj foo] retain] autorelease]; return val; Technically those are the only ways you are allowed to retrieve the value then return it and in both cases there is zero change in 'retain count' and the object remains aliv

RE: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> OK, so this discussion is getting a little crazy :-) Agreed. > The -hash method is important for objects that are used as keys in > associative collections. > [snip] > So, in practice, it's perfectly safe in 99.9% of cases to base your > hash off your object's properties. In the specific case

RE: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> Core Data doesn't use random objects as keys in dictionaries or sets > for this reason. It's not that we don't trust you, but ... to > prevent misunderstandings, all NSManagedObject subclasses are > forbidden from overriding -hash and -isEqual. I have to admit, I didn't know this bit but I see

RE: When do I need to override hash?

2009-08-20 Thread Jeff Laing
> Separately, collections may (and presumably sometimes do) use *object* > hash values to distribute objects in memory. (Obviously, NSSet does, > and for all we know NSDictionary does too, to distribute object values > that stored under the same key hash value -- though it would be an > implementat

RE: First trials in Cocoa app

2010-09-08 Thread Jeff Laing
> > If that's not possible, how can I define a function that can reach the > objects of my application? The ViewController is stored in the > ApplicationDeletegate, but I can't find any reference to that object. Ummm, is this really hard? id MyAppDelegate = [[UIApplication sharedApplication] dele

RE: NSDictionary allValues not mutable

2010-10-10 Thread Jeff Laing
> Of course it is. Suppose for a minute that [myMutableDictionary allValues] > returned a mutable array. That means that you could add to and remove from > this array with impunity. > > Except... the objects in this array are supposed to have an associated key. Um, no they aren't. Arrays don't

RE: nib loading / displaying question.

2008-12-16 Thread Jeff Laing
> > How many times will the user display the about panel in an average session > > of working with your app? > > > > Most likely, the answer is once. At the risk of being provocative, I'd say the answer is closer to zero. As such, it's a premature optimisation to worry about it, and we all know A

RE: One IBAction, multiple results from multiple methods

2009-02-26 Thread Jeff Laing
That's because you aren't making the point hard enough. Make the seekForward: method look at the bottom "two digits" in the ID of the button. That lets the interface designer has a 1x 2x 4x 8x 16x seek buttons it he wants to, or just 1x - (IBAction)seekForward:(id)sender { [self seekBy:1

RE: Outlets / IBOutlet declarations (was Re: Interface Builder & Wiring Objects)

2008-11-17 Thread Jeff Laing
> If you declare a property: > > @property (nonatomic, assign) MyLabel *label1; > > but make the connection in IB to mLabel1, then the property accessor > isn't used. So the outlet is set using setValue:forKey:. Which > results in the value being retained, precisely as described in the > docume

RE: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)

2008-11-19 Thread Jeff Laing
> But if your dealloc is like this... > > - (void)dealloc > { > self.thisProp = nil; > self.thatProp = nil; > ... > } > > then you'll be calling the accessors and the right thing will happen > (i.e. release if necessary). This is what I currently do for all dev > work (iPhone or M

RE: Outlets / IBOutlet declarations (was Re: Interface Builder &Wiring Objects)

2008-11-19 Thread Jeff Laing
cessors* for the property' which it does do completely. And it does seem like having one more hack, perhaps - (void)dealloc { @release xxx; [super dealloc]; } would make me feel like the feature (properties) was actually complete. Jeff Laing <[EMAIL PROTECTED]> ---

RE: Outlets / IBOutlet declarations (was Re: InterfaceBuilder &Wiring Objects)

2008-11-19 Thread Jeff Laing
> There's no difference between setting through a property, and setting > through a plain old setter method. That said, it's up to you to decide > if you want to go with the official recommendation or not. If you > think that you have enough control over the implementation of your > accessor method

RE: Outlets / IBOutlet declarations (was Re: InterfaceBuilder &Wiring Objects)

2008-11-19 Thread Jeff Laing
> From: Roland King [mailto:[EMAIL PROTECTED] > I think if you're talking about your own instance variables which you > are declaring and synthesizing, you have enough information to decide > if it's safe to call your property accessors in dealloc or not. Well, that's sort of my point, really. I d

RE: Checking for NULL (was "Re: Can't get setDelegate to work...")

2009-03-04 Thread Jeff Laing
Mark D. Gerl asked: > There's something that's just "uncomfortable" about dereferencing > pointers without first checking for validity. Is it just me? I don't think its just you, though most Cocoa types eventually give up and go with the simpler 'just trust it, it works' approach. Personally,

RE: How to create a modal dialog that blocks on start-up?

2009-03-05 Thread Jeff Laing
> So what? Implement the appropriate methods in your NSApp delegate, or > perhaps a custom subclass of NSDocumentController, and have them stow > any arguments and keep reminding themselves using > -performSelector:withObject:afterDelay: until conditions change such > that the original message can

RE: Enforcing trial software on Mac

2009-03-16 Thread Jeff Laing
> I have seen a couple of fairly nice solutions, and lots of really > awful ones. Generally speaking, the awful ones try to go to great > lengths to be sneaky and hide files or other data in places in your > computer they shouldn't be messing with. Its worth pointing out that most hacker-ty

RE: Reading one line at a time using NSFileHandle

2009-03-25 Thread Jeff Laing
>> Is there a way to read one line of a text file at a time >> using NSFileHandle (the way fgets does)? > > This code illustrates how you might approach > filtering lines of data obtained through an NSFileHandle. I've come across this problem as well - its fine to say "read it all into memory,

Cocoa Access to iPhone info

2009-04-01 Thread Jeff Laing
gured I might as well ask. Failing Cocoa, is that info available via some sort of sysctl() or ioctl() interface ? Thanks in advance, Jeff Laing -- Remember kids, there are no stupid questions, just stupid p

RE: Suppressing variable hiding warning in Xcode

2009-04-05 Thread Jeff Laing
st locals vs an enum in an enclosing scope. Apple might think about using better (ie, prefixed) names for all their enums if they are going to clash like this, otherwise the set of available variable names is going to evaporate over time... Jeff Laing