Today’s Discovery

If you have a Core Data data model with one Entity, say “AircraftCategory” that has a “to-many” Relationship to another, say “AircraftClass”, you can access the AircraftClass objects for an AircraftCategory using an NSMutableSet. But if you Fetch an NSMutableArray of AircraftCategory, and are doing a “fast enumeration” through the AircraftCategory objects, and you happen to remove one of the AircraftClass items from the current AircraftCategory object using one of the generated accessors, the fast enumeration will see that as a modification of the NSMutableArray of AircraftCategory and throw an exception. This is in contrast to Java where you would only get an exception if you were to add or remove things from the actual Collection that you were iterating, and not from calling setter methods on the objects in the Collection.

So instead of removing the AircraftClass from the AircraftCategory, I discovered that what I have to do is remove it from Core Data directly, using
[managedObjectContext deleteObject:aircraftClass];

I haven’t tried it yet, but I wonder if this wouldn’t happen if I assigned the fetch results to an NSArray instead of an NSMutableArray?

Yesterday’s Discovery

Yesterday, Dan told me that I’ve been doing my training wrong all my life. All my life, I’ve always started doing a good pace, and building up the distance until I could do that pace for the sort of distance I wanted to race, and adding in some shorter interval, speed play and strength work outs for speed. For running, that pace was around 8 mph, and I started out doing a mile or so and worked up to regularly running 8 to 12 miles at that pace, in preparation for 6-8 km long orienteering races. For skiing, it was around 18-20 km/hr, and I was regularly doing 40 or 50 km at that pace, in preparation for 15 or 30 km races (I was quite a bit slower for the Canadian Ski Marathon, but it was 168 km in two days over quite rugged terrain). And for kayaking, it seems like 6 mph is that pace, and I’ve built up to doing 8 miles at that speed, trying to build up to longer than the 10 miles of a normal race.

But Dan says what I should be doing is going slower for longer distances, and doing more interval work outs at much faster than race pace, and basically do race distances at race speeds almost never. And he appears to have the research papers to back it up. I guess I’ll try it his way and see how it goes. Maybe I won’t have the same problem I had for skiing and orienteering, where I really didn’t have any ability to go faster for shorter races – I basically had one pace and that was it.