Re: NSTableView doesn't show data until I click on a header

2012-04-29 Thread mmalc Crawford
On Apr 29, 2012, at 9:22 AM, Koen van der Drift koenvanderdr...@gmail.com wrote: So for future reference, my data model is an NSMutableArray. Instead of adding objects by calling addObject, I need to call it as follows: - (void)addMyObject:(MyObject *)obj { NSMutableArray *temp =

Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker

2010-12-17 Thread mmalc Crawford
On Dec 17, 2010, at 1:24 pm, Flavio Donadio wrote: Lesson learnt, but I took that code directly from Apple. Check Movie 11 on this page: http://developer.apple.com/cocoa/coredatatutorial/index.html That's an overview tutorial from several years ago, prior to the introduction of

Re: Core data - binding related problem in NSNumberFormatter and NSDatePicker

2010-12-16 Thread mmalc Crawford
On Dec 16, 2010, at 3:45 pm, Flavio Donadio wrote: [self setValue:[NSDate date] forKey:@datePurchased]; Don't use KVC to set managed object properties unless you have a good reason (dynamic code). Core Data generates accessor methods for you that are much more efficient to use:

Re: Programmatic initialization of a NSManagedObject with a Relationship

2010-10-31 Thread mmalc Crawford
On Oct 30, 2010, at 4:46 pm, Paul Johnson wrote: I have 2 tableviews (A and B) in a window. Both use Core Data. A 3rd tableview (in a drawer) has a complete list of items that I can selectively Drag and Drop to tableview B. I have almost implemented the Drag and Drop, but one step is

Re: Designated Initializer

2010-10-30 Thread mmalc Crawford
On Oct 30, 2010, at 12:12 pm, Dave Carrigan wrote: All initialized objects have at some point called super; they aren't fully initialized otherwise. In the implementation, the non-designated initializers typically chain to the designated initializer, which in turn chains to super's

Re: Drag and drop between two table views.

2010-10-28 Thread mmalc Crawford
On Oct 27, 2010, at 8:38 pm, Paul Johnson wrote: I took your suggestion to archive the array to a NSData object. I needed to implement encodeWithCoder for the object that defines the data for a row (containing 3 columns with an NSString in each column). I used the Data Modeler to define the

Re: Drag and drop between two table views.

2010-10-28 Thread mmalc Crawford
On Oct 28, 2010, at 2:20 pm, Paul Johnson wrote: The model for the data in the destination tableview is essentially the same as for the source tableview. The only difference is that the data model for the destination tableview has an additional entity and a relationship. Then it's not the

Re: Drag and drop between 2 table views

2010-10-28 Thread mmalc Crawford
the dictionary. Per previous reply: On Oct 28, 2010, at 9:25 am, mmalc Crawford wrote: What you do to support drag and drop depends on the functionality you want. If you want to copy the objects, then you need to create representations that are not managed objects -- for example a dictionary

Re: Access object from another view

2010-09-21 Thread mmalc Crawford
On Sep 21, 2010, at 2:49 pm, Steve Wetzel wrote: Then [self.view addSubView:viewController2.view]; brings up the subview. You should [almost certainly] not be doing this. If you want to display another view controller's view, you should use an appropriate technique to present the view

Re: Simple instance [[alloc] init] question.

2010-08-30 Thread mmalc Crawford
On Aug 30, 2010, at 6:37 PM, Dave Geering wrote: // 1) self.serialIDs = [[IRMSerialDetailsDO alloc] init]; The alloc method allocates an instance with a retain count of 1, and assigning it to the serialIDs property bumps it up to 2. In your dealloc method, you will [hopefully] send it a

Re: Array controllers in code?

2010-07-22 Thread mmalc Crawford
On Jul 22, 2010, at 2:05 am, Amy Gibbs wrote: Some things I want to do though need to be actually coded, but how do I reference the Arrays/Array controllers in the code? Do I need to declare them? They aren't at the moment that I can see, but somehow it's using them. All the tutorials I

Re: managing split view iPad

2010-07-19 Thread mmalc Crawford
On Jul 19, 2010, at 12:19 am, Andrea Mattiuz wrote: I can't manage the change of a navigation controller on the right side of a split view application (iPad) after a tap on the left side. The behavior of this app would be similar to the 'settings' app in the iPad simulator. any

Re: Managing Files with CoreData

2010-07-18 Thread mmalc Crawford
On Jul 18, 2010, at 1:20 pm, Gordon Apple wrote: I have a series of questions about using CoreData (iPad). Although CoreData is supposedly easy to use, I have found it anything but. Per Keary's reply, the documentation makes it abundantly clear that it's not a beginner's tool. It comes

Re: Using NSFetchRequest to fetch NSManagedObject subclasses

2010-07-11 Thread mmalc Crawford
On Jul 10, 2010, at 7:31 am, Matt James wrote: That's absolutely right, though I'm glad Joanna chimed in since I didn't know that was the common way to generate those classes to begin with (as I said, I'm completely new to the workings of Core Data). This technique is described in the

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 19, 2010, at 4:38 am, Sherm Pendley wrote: If you set the ivars directly, as above, the synthesized setters will NOT be called. For that to happen, you need to use dot-syntax, like this: - (void) dealloc { self.beginButton = nil; self.endButton = nil; // etc...

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 19, 2010, at 1:48 am, Sai wrote: 1. Look at the awakeFromNib method of Controller, my output of the retain count to the console are myModel retain count: 5 controller retain count: 17 both number are very surprised me, why is that? I suppose they should be 2 or 1? Can anyone

Re: Regarding MVC design pattern

2010-05-20 Thread mmalc Crawford
On May 20, 2010, at 7:40 am, Thomas Davie wrote: However, you should typically not invoke accessor methods in init or dealloc methods. Can I ask why you shouldn't use them in init? It makes a lot of sense to not use them in alloc/dealloc, but I'm not using them in init... after all,

Re: Solving memory leaks

2010-03-28 Thread mmalc Crawford
On Mar 28, 2010, at 10:27 am, Michael Davey wrote: That would be gut for the fact that my fields are released and set to nil whenever a new SELECT query is executed - however, I think I can do this by emptying the array when a new query is done and just counting the size of the array in

Re: Solving memory leaks

2010-03-28 Thread mmalc Crawford
On Mar 28, 2010, at 11:03 am, Philip Mobley wrote: When calling setFields, you are then responsible for releasing the newFields NSMutableArray you created in your sample code, because [newFields mutableCopy] increments the ref counter. This is not correct. [newFields mutableCopy] returns

Re: Core data backed UITableView

2010-03-15 Thread mmalc Crawford
On Mar 15, 2010, at 5:33 pm, Damien Cooke wrote: [self.myTableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade]; Why are you doing this rather than (in addition to? which if so would probably be the cause of the problem)

Re: Checking integrity of a Core Data document with SQLite store

2010-03-14 Thread mmalc Crawford
On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote: So my question is - how do you detect this before loading the file? I'm aware of the sqlite3 PRAGMA integrity_check, but there does not seem to be a C API for this. Any pointers?

Re: Getting relative day-of-week name?

2010-02-24 Thread mmalc Crawford
On Feb 24, 2010, at 12:04 pm, Rick Mann wrote: I'd like to take an NSDate and get a relative day-of-week name. For example, if today is 2/24, and the NSDate is some time on 2/23, it would be Yesterday. If the NSDate were 2/22, it would be Monday. Is there an existing format specifier for

Re: Core Data: Custom to-many relationship setter not being invoked

2010-02-23 Thread mmalc Crawford
On Feb 22, 2010, at 2:59 pm, Ken Tabb wrote: Distilling my problem down into the Department Employees example, both are custom NSManagedObject subclasses, each with an inverse to-many / to-one relationship as you'd expect. My problem is that Department's custom -awakeFromInsert gets

Re: What classes have -init?

2010-02-11 Thread mmalc Crawford
On Feb 11, 2010, at 12:08 pm, Gordon Apple wrote: My point was that if you could count on init being called internally and all you needed was to initialize some ivars, you could override init and not have to override the (sometimes more involved) designated initializer and possibly other

Re: Core Data: Insert, Fetch, Re-Fetch. Same Object?

2010-02-11 Thread mmalc Crawford
On Feb 10, 2010, at 7:07 pm, Jerry Krinock wrote: Yes, basically. There is only going to be one in-memory object at a time that represents the same managed object. It certainly seems to be sensible, but I just wish someone could find such documentation. I can't. Uniquing:

Re: Hot to define a connection from source code?

2010-01-29 Thread mmalc Crawford
On Jan 28, 2010, at 9:17 pm, Jonathan Chacón wrote: Could you tell me any example project where I examine the source code? If you want to do iPhone development, I suspect the most useful for you will be UICatalog:

Re: Hot to define a connection from source code?

2010-01-29 Thread mmalc Crawford
On Jan 29, 2010, at 10:32 am, B.J. Buchalter wrote: On Jan 29, 2010, at 1:05 PM, mmalc Crawford wrote: If you want to do iPhone development, I suspect the most useful for you will be UICatalog: http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html [...] I

Re: NSSlider

2010-01-28 Thread mmalc Crawford
On Jan 28, 2010, at 9:42 am, vincent habchi wrote: Check the continuous checkbox in IB (or set the object property of the same name) and your target will get called while the user drags, as soon as the position changes. Do not forget there are some pitfalls. For example, I bound a slider

Re: UIButton's Sender Control Events

2010-01-24 Thread mmalc Crawford
On Jan 24, 2010, at 10:27 am, Chunk 1978 wrote: refactoring code so one method for the same button can handle a small if/else statement could easily be considered more ideal than having two separate methods. No, it couldn't. If you have different actions that should happen in response to

Re: NSDictionary trouble

2010-01-19 Thread mmalc Crawford
On Jan 19, 2010, at 5:50 pm, Jeff Laing wrote: 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. No, you should

Re: NSDictionary trouble

2010-01-19 Thread mmalc Crawford
On Jan 19, 2010, at 8:47 pm, Jeff Laing wrote: I wrote: No, you should just *retain* the result of dictionaryWithCapacity. mmalc wrote: No, you shouldn't. With all due respect, why not? Because it's difficult to imagine a common situation in which your advice will be valid, for

Re: Adding to-many objects programmatically

2010-01-16 Thread mmalc Crawford
On Jan 16, 2010, at 12:17 am, Roland King wrote: Cast to the actual type before calling the method. Instead of [ managedObject method1 ] do [ (Employee*)managedObject method1 ] No; the OP stated, I don't use custom classes, so this won't work. Follow the pattern described in the

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 8:52 pm, Jenny M wrote: but I don't know about the code... Modifying to-many relationships is described here: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdUsingMOs.html#//apple_ref/doc/uid/TP40001803 What did you try

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 10:00 pm, Jenny M wrote: I guess my question is also, was there any easier way to do it?? Is that how it's normally done? It's not clear exactly what you're referring to. Do you mean, is the typical pattern that which you described earlier, namely: I've been setting it

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 10:57 pm, Jenny M wrote: The objects do load, I ran the program regardless of warnings and it did set the categories and references. So, how would I get it to build without those warnings? All of this is covered in the documentation:

Re: Bindings Problem

2010-01-14 Thread mmalc Crawford
On Jan 14, 2010, at 3:11 pm, Carter R. Harrison wrote: In the addValueToSet: method I have the following code: - (IBAction)addValueToSet:(id)sender See

Re: Bindings; Was: whether property in Cocoa class is KVO-compliant?

2010-01-11 Thread mmalc Crawford
On Jan 11, 2010, at 9:01 am, Jerry Krinock wrote: I wonder why bindings was not as an extension of KVO, instead of as a separate sideshow. The effect is the same as KVO, It's not at all. Bindings uses KVO to ensure that things are kept synchronised; KVO is a general mechanism that allows

Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-10 Thread mmalc Crawford
On Jan 10, 2010, at 4:57 am, Quincey Morris wrote: I'm not sure where to go next with this ... I would strongly recommend dispensing with bindings for the moment: it's not an entry-level technology; it depends on an understanding of the fundamentals of Cocoa development including object

Re: How to know whether property in Cocoa class is KVO-compliant?

2010-01-10 Thread mmalc Crawford
On Jan 10, 2010, at 8:18 pm, Dave Fernandes wrote: Look for Cocoa Bindings Guide in the docs. It would be nice if it were cross-referenced in every class description. SelectedIndex should work for a segmented control. Haven't tried it myself though. No; the Cocoa Bindings Reference

Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-09 Thread mmalc Crawford
On Jan 9, 2010, at 1:50 pm, Russell Gray wrote: On 10/01/2010, at 8:18 AM, Quincey Morris wrote: How about if you register your own KVO observer of the subscriptions property? Does it get notified when the property changes? Did you check the log for exception error messages? So, I added an

Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-09 Thread mmalc Crawford
On Jan 9, 2010, at 2:15 pm, Russell Gray wrote: [subscriptionsArray addObject:output]; You haven't shown where you're modifying 'subscriptions' (apart from in the init method). Do you have two arrays that mirror each other, subscriptions and subscriptionsArray? Otherwise, if this is a

Re: if statement causing 32 Byte leak?

2010-01-09 Thread mmalc Crawford
On Jan 9, 2010, at 6:34 pm, Graham Cox wrote: 'string' does not contain 'new', 'alloc' or 'copy' therefore you do not own it. That summary is just very subtly wrong(*), which is why people are generally discouraged from paraphrasing the rules. That said, there is indeed really very little

Re: programatically updating UI for NSArrayContoller/NSTableView combo

2010-01-08 Thread mmalc Crawford
On Jan 8, 2010, at 1:10 pm, Russell Gray wrote: I am having trouble trying to get a tableView to update its contents, when bound to an NSArrayController - but only when new objects are added. removal, and updating of current objects works fine.

Re: NSDate without time portion

2010-01-05 Thread mmalc Crawford
On Jan 5, 2010, at 12:40 pm, Robert Claeson wrote: (Greenwich, the G in GMT, is in North London) Well, if we're being pedantic, South East of London, actually...

Re: NSDate without time portion

2010-01-05 Thread mmalc Crawford
On Jan 5, 2010, at 1:35 pm, Kyle Sluder wrote: On Tue, Jan 5, 2010 at 1:23 PM, mmalc Crawford mmalc_li...@me.com wrote: An NSDate object represent a single point in time -- you can think of it basically as a wrapper for an NSTimeInterval from the reference date. If you want to create

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 12:54 pm, Rick Mann wrote: In my app I have a situation where I have two (Core Data) documents open, and I need to merge all the changes made in one doc1 to the changes in doc2. I've been reading the section on Change Management in the Core Data Programming Guide, but

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 1:58 pm, Rick Mann wrote: Is that operation discussed in the docs somewhere? Yes. http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/cdProgrammingGuide.html#//apple_ref/doc/uid/TP30001200 mmalc ___

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 2:24 pm, Rick Mann wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then (if

Re: Merging changes across NSManagedObjectContexts

2009-12-30 Thread mmalc Crawford
On Dec 30, 2009, at 2:08 pm, Mike Abdullah wrote: It's pretty much the same as any other operation on with a MOC. You cannot copy or move a managed object from one MOC to another in a simple fashion. Instead, you have got to create new, corresponding objects in the second MOC, and then

Re: Creating CoreData classes

2009-12-27 Thread mmalc Crawford
On Dec 27, 2009, at 9:07 pm, Jim Correia wrote: On Dec 27, 2009, at 11:52 PM, Brian Bruinewoud wrote: If I've generated core data classes from my model, how do I use them to create new values? Currently I'm doing this: CDClass *cdObject = (CDClass *)[ NSEntityDescription

Re: Releasing Objects

2009-12-23 Thread mmalc Crawford
On Dec 22, 2009, at 9:40 pm, Michael Craig wrote: At the point where the tutorial discusses garbage collection (end of ch. 5), I decided to implement the deallocation of the Converter objects created by ConverterController's convert: method. I want the deallocation to happen inside convert:.

Re: Autorotation for a subview

2009-12-22 Thread mmalc Crawford
On Dec 22, 2009, at 3:37 pm, Matt Neuburg wrote: This sounds like a good time for the view to post an NSNotification. The subview can then respond to it. m. Sounds like overkill --- swatting mosquitoes with sledgehammers. An NSNotification is not a sledgehammer. And letting interested

Re: Autorotation for a subview

2009-12-22 Thread mmalc Crawford
On Dec 22, 2009, at 5:09 pm, Eric E. Dolecki wrote: I already stated (I believe) that I needed to redo the way this application is being constructed. In this way I'll have more direct access to subviews. I originally created another view controller with it's own nib and I was indeed

Re: Core Data Migration

2009-12-21 Thread mmalc Crawford
On Dec 20, 2009, at 11:40 pm, Chaitanya Pandit wrote: One weird thing that is happening is that just after the configurePersistentStoreCoordinatorForURL... call, the contents of my document on the disk are changed, even if i didn't save the document It's not clear in what sense this is

Re: UIDatePicker in landscape - displaying items moving into position weirdness

2009-12-11 Thread mmalc Crawford
On Dec 11, 2009, at 1:06 pm, Alex Kac wrote: if (timeSpanPicker) { //remove it [timeSpanPicker removeFromSuperview]; [timeSpanPicker release]; //now add it again [self

Re: Additional action when a view's value changes (Cocoa Bindings)

2009-12-09 Thread mmalc Crawford
On Dec 9, 2009, at 5:47 am, Christian Ziegler wrote: Sorry I got to correct myself, it's not Cocoa Bindings, but direct target/action. So I connected the takeIntegerValue action of both views to each other in contrast to connecting it to a controller. Don't do that. Both should invoke an

Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford
On Dec 7, 2009, at 7:08 pm, Chunk 1978 wrote: is this suppose to work for multiple touches where one touch is already present, then another touches the screen? Yes, it does; tested in a working application. it's not working for me. each time i touch the screen and add an object to the

Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford
On Dec 8, 2009, at 12:38 am, mmalc Crawford wrote: is this suppose to work for multiple touches where one touch is already present, then another touches the screen? Yes, it does; tested in a working application. it's not working for me. each time i touch the screen and add an object

Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford
On Dec 8, 2009, at 3:49 am, Chunk 1978 wrote: i meant that i find it complicated compared to basic single touches or gestures. It's not clear what's complicated. You typically want to know when touches began, moved, and ended, and there are methods to inform you when each of these things

Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford
On Dec 8, 2009, at 8:59 am, Chunk 1978 wrote: this is what i have so far, but i have no idea how to write the touchesEnded method so that the appropriate label will clear. so if 3 fingers are touching the screen and displaying their different coordinates, if the 2nd finger that was pressed

Re: Tracking Multiple Touches For Appropriate Label

2009-12-08 Thread mmalc Crawford
On Dec 8, 2009, at 12:33 pm, mmalc Crawford wrote: Get the logic right... - (void)setUpTouchHandling { touchToLabelMapping = CFDictionaryCreateMutable (kCFAllocatorDefault, 5, kCFTypeDictionaryKeyCallBacks, kCFTypeDictionaryValueCallBacks); availableLabels = [[NSMutableArray alloc

Re: Binding and Observers

2009-12-08 Thread mmalc Crawford
On Dec 8, 2009, at 2:17 am, Gerriet M. Denkmann wrote: - (void)windowWillClose:(NSNotification *)notification { id f = [ ikView observationInfo ]; NSString *oi = [ f description ]; BOOL ok; NSString *obs = @Observer:; NSString *kpa = @Key path:;

Re: Tracking Multiple Touches For Appropriate Label

2009-12-07 Thread mmalc Crawford
On Dec 7, 2009, at 4:12 pm, Chunk 1978 wrote: if ([[[event allTouches] anyObject] view] == self) { for (UITouch *touch in touches) { CGPoint touchPoint = [[touches anyObject] locationInView:self];

Re: Strings mangled on generalPasteboard

2009-11-23 Thread mmalc Crawford
On Nov 23, 2009, at 8:54 am, Jens Alfke wrote: The Cocoa Pasteboard API has the annoying limitation that there is no standard, public data type for multiple URLs. This is no longer true with Mac OS X v10.6 and later -- you can write and read multiple URLs to and from to the pasteboard.

Re: Strings mangled on generalPasteboard

2009-11-23 Thread mmalc Crawford
On Nov 23, 2009, at 1:04 pm, Jens Alfke wrote: [url pasteboardPropertyListForType:(NSString *)kUTTypeURL] But that still only writes a single NSURL, right? How do you write multiple using that API? On Mac OS X v10.6 and later, you can write multiple items to a pasteboard, so you

Re: Programmatic Binding KVC KVO

2009-11-04 Thread mmalc Crawford
On Nov 4, 2009, at 5:20 pm, Rob Keniger wrote: See mmalc’s Graphics Bindings sample: http://homepage.mac.com/mmalc/CocoaExamples/controllers.html Sometimes Cocoa can be overwhelming. This will help. Thank you so much. :) You might also find this blog post very helpful:

Re: Adding new Core Data objects through a form

2009-10-28 Thread mmalc Crawford
On Oct 28, 2009, at 6:26 am, Martin Cote wrote: That said, the situation in this sample project is quite different. When they add an object, they actually add an empty object in an array controller. This is precisely what the example does not do.

Re: Preparing for MOM versioning in version 1

2009-10-26 Thread mmalc Crawford
On Oct 26, 2009, at 9:00 am, Fritz Anderson wrote: I'm about to unleash a Core Data-based application, and I'm sure the schema will change in later versions. The Core Data Model Versioning and Data Migration Programming Guide seems to say that migrating a store from one version to

Re: 2 Questions about the project With and Without bindings

2009-10-23 Thread mmalc Crawford
On Oct 23, 2009, at 5:27 pm, Ken Thomases wrote: Indeed, there are no dealloc methods in the entire sample, which makes it buggy. There should be one for the MyDocument and Bookmark classes. The bug is actually that, for some reason, the projects aren't marked as using garbage collection.

Re: Sending a Selector to another Class.

2009-10-22 Thread mmalc Crawford
On Oct 22, 2009, at 9:54 am, Jeff Johnson wrote: Ignore bbum. We hereby promise never to break == for SEL. (But SEL is not char*. We will break that.) And now that it's on the mailing lists, it can be considered part of Apple's official documentation. ;-) It already is:

Re: Search on Core data Table issue?

2009-10-22 Thread mmalc Crawford
On Oct 22, 2009, at 4:09 am, Matthew Lindfield Seager wrote: A reducing search is more commonly referred to as filtering. A google search should help you very quickly as this is very easy with core data bindings. The question is related to iPhone and NSFetchedRestultsController, therefore

Re: odd behavior with NSError?

2009-10-16 Thread mmalc Crawford
On Oct 15, 2009, at 10:41 pm, Nathan Vander Wilt wrote: Ouch. So the following pattern is incorrect? NSError* internalError = nil; (void)[foo somethingReturningBool:bar error:internalError]; if (internalError) { // ... }

Re: Can I make custom pasteboard type for an object reference?

2009-10-14 Thread mmalc Crawford
On Oct 14, 2009, at 5:21 PM, Rick Mann wrote: NSMutableData* data = [NSMutableData data]; [data appendBytes: self length: sizeof (self)]; Try using an NSValue: + (NSValue *)valueWithPointer:(const void *)aPointer archive then unarchive - (void *)pointerValue mmalc

Re: Binding to values which aren't there

2009-10-09 Thread mmalc Crawford
On Oct 9, 2009, at 3:17 PM, A B wrote: I have a situation in which I would like a column in a table that is bound to an NSArrayController to display information that isn't actually in the objects being represented, but is instead the result of an operation that involves a bit of data in

Re: Core data - how to set string min max programmatically?

2009-09-16 Thread mmalc Crawford
On Sep 16, 2009, at 3:56 PM, Leon Starr wrote: I have been creating my models programmatically and am wondering how to treat the min/max length fields for string attributes. I can't seem to find any corresponding programatic settings. (Also wondering if there is any effect to these

Re: CoreData Bug? (SQLite vs XML)

2009-09-13 Thread mmalc Crawford
On Sep 13, 2009, at 9:14 AM, Milen Dzhumerov wrote: -(void)awakeFromFetch { for(id base in [self relationship]) Log(@%@, base); ... } awakeFromFetch [...] Important: Subclasses must invoke super’s implementation before performing their own initialization.

Re: NSArrayController design/usage question

2009-09-08 Thread mmalc Crawford
On Sep 6, 2009, at 10:00 AM, Steven Degutis wrote: For instance, if you have 2 genuine properties on your Person entity called firstName and lastName then you can create a fullName property on your Person class, and when firstName or lastName change, call -willChangeValueForKey: and

Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread mmalc Crawford
On Sep 3, 2009, at 7:56 AM, Scott Andrew wrote: As Cocoa documentation states all items returned from a message are autoreleased unless otherwise stated in the documentation for the API call. The documentation emphatically does not state that. The basic rules are given here:

Re: Core Data completely unable to find the source object model for migration

2009-08-06 Thread mmalc Crawford
On Aug 6, 2009, at 10:37 AM, Matteo Manferdini wrote: What I discovered is that in the first case the hashes are the same for the model and the store, while in the second case the model has lost a lot of metadata in the versioning process. Along with my entities there are also other entities

Re: Core Data completely unable to find the source object model for migration

2009-08-05 Thread mmalc Crawford
On Aug 4, 2009, at 11:20 PM, Matteo Manferdini wrote: I'm trying to run core data migration on the store of my app but it seems to be unable to find the source object model no matter what. What happens if you don't try to perform migration and instead simply open the existing store with the

Re: Disabling Undo in Core Data

2009-08-01 Thread mmalc Crawford
On Aug 1, 2009, at 5:11 AM, Squ Aire wrote: 1) In awakeFromNib, call either [[self managedObjectContext] setUndoManager:nil]; or [[[self managedObjectContext] undoManager] disableUndoRegistration]; This certainly works, but the problem with this is that the

Re: When saving the managed object context

2009-07-22 Thread mmalc Crawford
On Jul 22, 2009, at 7:22 AM, Squ Aire wrote: How can I do some custom stuff before my NSManagedObjectContext saves? Register for NSManagedObjectContextWillSaveNotification. mmalc ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do

Re: When saving the managed object context

2009-07-22 Thread mmalc Crawford
On Jul 22, 2009, at 8:05 AM, Squ Aire wrote: On Jul 22, 2009, at 7:22 AM, Squ Aire wrote: How can I do some custom stuff before my NSManagedObjectContext saves? Register for NSManagedObjectContextWillSaveNotification. I see no such thing in my docs. Only DidSave. Not WillSave. Sorry, I've

Re: Core Data design patterns

2009-07-19 Thread mmalc Crawford
On Jul 19, 2009, at 3:15 PM, Jerry Krinock wrote: The case in point here is that -[NSManagedObjectContext executeFetchRequest:error:] returns an NSError if something goes wrong. This is misleading. The fundamental behaviour is that method returns NO if something goes wrong. In

Re: Core Data design patterns

2009-07-19 Thread mmalc Crawford
On Jul 19, 2009, at 1:59 PM, Squ Aire wrote: * Finally an unrelated and basic Core Data question: Where do you paste the code you copy using the Copy Method Declarations/ Implementations feature in the data modeling tool? I really want to use those things because it is, according to docs,

Re: Core Data design patterns

2009-07-19 Thread mmalc Crawford
On Jul 19, 2009, at 5:05 PM, mmalc Crawford wrote: The fundamental behaviour is that method returns NO if something goes wrong. As Jerry kindly pointed out off-list, this method of course returns nil -- not NO -- if something goes wrong. The important issue (and one which has given

Re: Core Data debugging (Fritz Anderson)

2009-07-16 Thread mmalc Crawford
On Jul 16, 2009, at 12:51 PM, tmow...@talktalk.net wrote: I have removed it completely and just called the longer winded [[NSApp delegate] managedObjectContext] when I need it. I suppose I could have set the ivar in the awakeFromNib when all NIB objects are guaranteed to have been

Terminating UIApplication and exit() (was Re: NSApplication and UIApplication)

2009-07-06 Thread mmalc Crawford
On Jul 6, 2009, at 11:38 AM, DKJ wrote: I want to terminate my UIApplication under some specific error conditions. I'm used to doing this kind of thing using: [[NSApplication sharedApplication] terminate]; But docs don't show a terminate method for UIApplication. Apparently it will

Re: Is there any document to explain the process about the DepartmentAndEmployee code?

2009-07-06 Thread mmalc Crawford
On Jul 6, 2009, at 8:20 PM, Bright wrote: And I find there are several sample code about Core Data, such as DepartmentAndEmployee and CoreRecipe But I don't know how these code were implemented step by step. Is there any document to show/explain the process to implement them

Re: EXC_BAD_ACCESS on returning an int?

2009-07-05 Thread mmalc Crawford
On Jul 4, 2009, at 5:39 PM, Ian Havelock wrote: For future reference, in many cases EXC_BAD_ACCESS can be indicative of a memory management problem. Here, however, you are asking NSLog to print int values as objects ('%@' is the format specifier for an object): NSLog(@Number of Sides:

Re: EXC_BAD_ACCESS on returning an int?

2009-07-05 Thread mmalc Crawford
On Jul 4, 2009, at 11:43 PM, Andrew Farmer wrote: - (int)numberOfSides { return numberOfSides; } - (void)setNumberOfSides:(int)value { numberOfSides = value; } Let me guess: does your stack trace (type tb in the gdb console) indicate infinite recursion? Either

Re: Display either date part or time part in LOCAL format

2009-07-05 Thread mmalc Crawford
On Jul 5, 2009, at 12:21 AM, Jacob Rhoden wrote: I am probably overlooking something obvious (I hope) but what is the proper way to convert. either the Date or Time part of an NSDate to a localised string? I know I can do the following but its not exactly localised :( NSDate *now =

Re: Yet another memory management question

2009-07-05 Thread mmalc Crawford
On Jul 5, 2009, at 8:23 AM, Michael Ash wrote: It's the same benefit as anywhere else. You have two places, viewDidUnload and dealloc, which perform the exact same action. They do not perform the exact same action. In dealloc, you obviously relinquish ownership of all objects you own (and

Re: Yet another memory management question

2009-07-04 Thread mmalc Crawford
On Jul 4, 2009, at 8:11 PM, WT wrote: The following is ok, though, assuming that you have appropriately declared myObject in your class (for example, as an instance variable): - (void)viewDidLoad { myObject = [[NSObject alloc] init]; } In general, this is not recommended. If you

Re: Yet another memory management question

2009-07-04 Thread mmalc Crawford
On Jul 4, 2009, at 9:31 PM, DKJ wrote: On 4-Jul-09, at 21:10 , mmalc Crawford wrote: you should use accessor methods rather than direct variable manipulation Would declaring all the variables as properties, and then synthesising them, take care of this? Strictly, this is an orthogonal

Re: Yet another memory management question

2009-07-04 Thread mmalc Crawford
On Jul 4, 2009, at 9:40 PM, WT wrote: In general, this is not recommended. If you manipulate an instance variable anywhere other than in an initialiser or a dealloc method, you should use a suitable accessor method. - (void)viewDidLoad { id anObject = [[NSObject alloc] init]; [self

Re: Design for custom tableviewcell button action

2009-07-03 Thread mmalc Crawford
On Jul 3, 2009, at 11:54 AM, Brian Slick wrote: So, if TaggedLocations was flying while mine was sucking, I'd probably concede that what I was doing was wrong (and would probably need more custom cells). But since neither one is performing very well, and I can't find any significant

Re: Design for custom tableviewcell button action

2009-07-03 Thread mmalc Crawford
On Jul 3, 2009, at 2:45 PM, Brian Slick wrote: So now I either need to figure out how to make my scenarios all work with a single identifier, or I may just go ahead with the code-only cell I just built in response to the performance issue. If would be nice if there was some kind of

Re: in search of a starter iphone painting tutorial or sample code

2009-07-03 Thread mmalc Crawford
On Jul 3, 2009, at 2:15 PM, colo wrote: I am seeking a bare bones beginner source or tutorial for building painting apps on the iphone. This one uses OpenGL: http://developer.apple.com/iphone/library/samplecode/GLPaint/ index.html You could use a similar technique to create CGPaths to

Re: NSDateFormatter Breaks on non-English OS

2009-07-01 Thread mmalc Crawford
On Jun 30, 2009, at 3:29 PM, Trygve Inda wrote: NSString* myDateFormat = @%a %b %e %H:%M:%S %Z %Y; NSDate*myDate = nil; // myDateString is Tue Jun 30 15:53:24 UTC 2009 myFormatter = [[NSDateFormatter alloc] initWithDateFormat:imageDateFormat allowNaturalLanguage:NO]; myDate =

  1   2   3   4   >