From bill at cheeseman.name Thu Feb 1 04:37:39 2007 From: bill at cheeseman.name (Bill Cheeseman) Date: Thu Feb 1 04:42:15 2007 Subject: [ANN] PreFab UI Browser 2.0.2 Message-ID: In case you missed it on the Mac news sites, version 2.0.2 of UI Browser is available for download on the PreFab Web site at . It fixes a minor bug in the AppleScript statements generated from UI Browser's AppleScript menu. -- Bill Cheeseman - wjcheeseman@prefabsoftware.com PreFab Software, Inc. - prefabsoftware.com From trent at jacobs.co.za Fri Feb 2 08:38:54 2007 From: trent at jacobs.co.za (Trent Jacobs) Date: Fri Feb 2 09:05:33 2007 Subject: NSMovieView not disappearing when it should Message-ID: Hi all, I have a window with a tab view in it. In the third tab, I have an NSMovieView which allows users to preview the selected movie before going live with it. The problem is that if I have selected and previewed a movie, switching to a different tab doesn't make the movie disappear - it stays visible over all other controls. Moving the window around doesn't help, and neither does closing and opening the window. I've uploaded screenshots at www.enhanceworship.com/problem.html The first screenshot is the window with the third tab selected so you can see what I mean. Has anyone seen this behavior before? Thanks in advance! Trent. From leeg at thaesofereode.info Fri Feb 2 09:14:28 2007 From: leeg at thaesofereode.info (Graham J Lee) Date: Fri Feb 2 09:15:01 2007 Subject: WebServicesCore problem Message-ID: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> Hi, I'm trying to connect to an XML-RPC service using WebServicesCore in synchronous mode (actually, I'm just trying to get it to connect to see whether I understand the documentation, the specific way I invoke it will change over time). The code I have below fails, but with no reason in the kWSFaultString, which the docs say *will* be set on failure. :-( One thing which may affect the behaviour of WSCore is that the connection is over SSL (on a nonstandard port, too), and that the certificate is self-signed. Is there a way to get WSCore to ignore the certificate? Thanks, Graham. > #include > > int main (int argc, const char * argv[]) { > // insert code here... > CFURLRef url = CFURLCreateWithString(NULL,CFSTR("https://server: > 1234/XMLRPC"),NULL); > CFStringRef method = CFSTR("Service.Method"); > WSMethodInvocationRef inv = WSMethodInvocationCreate > (url,method,kWSXMLRPCProtocol); > > // add the service ID and password to the parameters > int sid = 123; > CFNumberRef serviceID = CFNumberCreate > (NULL,kCFNumberIntType,&sid); > CFStringRef pw = CFSTR("likeiwouldpostthattoamailinglist;-)"); > > CFMutableArrayRef order = CFArrayCreateMutable(NULL,2,NULL); > CFMutableDictionaryRef params = CFDictionaryCreateMutable(NULL, > 2,NULL,NULL); > > CFDictionaryAddValue(params,CFSTR("Service"),serviceID); > CFDictionaryAddValue(params,CFSTR("Password"),pw); > > CFArrayAppendValue(order, CFSTR("Service")); > CFArrayAppendValue(order, CFSTR("Password")); > > WSMethodInvocationSetParameters(inv,params,order); > //right, should be able to invoke the method now > > CFDictionaryRef result = WSMethodInvocationInvoke(inv); > > CFStringRef returnStr; > //let's see if that worked > if(WSMethodResultIsFault(result)) > { > printf("Didn't work.\n"); > returnStr = CFDictionaryGetValue(result, kWSFaultString); > printf("Fault: %s\n",CFStringGetCStringPtr > (returnStr,kCFStringEncodingUTF8)); > } > else > { > printf("Worked!\n"); > returnStr = CFDictionaryGetValue(result, > kWSMethodInvocationResult); > printf("%s\n",CFStringGetCStringPtr > (returnStr,kCFStringEncodingUTF8)); > } > > return 0; > } > From wave at pixar.com Fri Feb 2 09:26:29 2007 From: wave at pixar.com (Michael B Johnson) Date: Fri Feb 2 09:26:40 2007 Subject: NSMovieView not disappearing when it should In-Reply-To: References: Message-ID: <6D605019-142E-4768-9104-969379635F1F@pixar.com> Can you not use QTMovieView? NSMovieView has lots of bugs that I doubt will ever get fixed... On Feb 2, 2007, at 8:38 AM, Trent Jacobs wrote: > Hi all, > > I have a window with a tab view in it. In the third tab, I have an > NSMovieView which allows users to preview the selected movie before > going live with it. The problem is that if I have selected and > previewed a movie, switching to a different tab doesn't make the > movie disappear - it stays visible over all other controls. Moving > the window around doesn't help, and neither does closing and > opening the window. > > I've uploaded screenshots at www.enhanceworship.com/problem.html > > The first screenshot is the window with the third tab selected so > you can see what I mean. > > Has anyone seen this behavior before? > > Thanks in advance! > Trent. > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev --> Michael B. Johnson, PhD --> http://homepage.mac.com/drwave (personal) --> http://xenia.media.mit.edu/~wave (alum) --> MPG Lead --> Pixar Animation Studios From itod at mac.com Fri Feb 2 09:26:30 2007 From: itod at mac.com (Todd Ditchendorf) Date: Fri Feb 2 09:27:04 2007 Subject: WebServicesCore problem In-Reply-To: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> Message-ID: I suppose it's possible that your server XML-RPC impl is not sending a fault string... you need to see the raw XML-RPC response (and request too) to see where the problem lies. Here's what i would do before sending the request: // for good measure, make the call follow redirects. WSMethodInvocationSetProperty(inv, kWSHTTPFollowsRedirects, kCFBooleanTrue); // set debug props WSMethodInvocationSetProperty(inv, kWSDebugIncomingBody, kCFBooleanTrue); WSMethodInvocationSetProperty(inv, kWSDebugIncomingHeaders, kCFBooleanTrue); WSMethodInvocationSetProperty(inv, kWSDebugOutgoingBody, kCFBooleanTrue); WSMethodInvocationSetProperty(inv, kWSDebugOutgoingHeaders, kCFBooleanTrue); This will cause it to follow redirects and also include raw req and res in the result dicitonary. Print the entire result dictionary to see those. BTW, I just blogged about WebServices Core and HTTP auth (somewhat related) the other day on my blog: http://www.ditchnet.org/wp/2007/01/30/example-code-webservices-core- cfnetwork-for-soap-http-auth-on-os-x/ Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us On Feb 2, 2007, at 9:14 AM, Graham J Lee wrote: > Hi, I'm trying to connect to an XML-RPC service using > WebServicesCore in synchronous mode (actually, I'm just trying to > get it to connect to see whether I understand the documentation, > the specific way I invoke it will change over time). The code I > have below fails, but with no reason in the kWSFaultString, which > the docs say *will* be set on failure. :-( > > One thing which may affect the behaviour of WSCore is that the > connection is over SSL (on a nonstandard port, too), and that the > certificate is self-signed. Is there a way to get WSCore to ignore > the certificate? > > Thanks, > > Graham. > >> #include >> >> int main (int argc, const char * argv[]) { >> // insert code here... >> CFURLRef url = CFURLCreateWithString(NULL,CFSTR("https:// >> server:1234/XMLRPC"),NULL); >> CFStringRef method = CFSTR("Service.Method"); >> WSMethodInvocationRef inv = WSMethodInvocationCreate >> (url,method,kWSXMLRPCProtocol); >> >> // add the service ID and password to the parameters >> int sid = 123; >> CFNumberRef serviceID = CFNumberCreate >> (NULL,kCFNumberIntType,&sid); >> CFStringRef pw = CFSTR("likeiwouldpostthattoamailinglist;-)"); >> >> CFMutableArrayRef order = CFArrayCreateMutable(NULL,2,NULL); >> CFMutableDictionaryRef params = CFDictionaryCreateMutable(NULL, >> 2,NULL,NULL); >> >> CFDictionaryAddValue(params,CFSTR("Service"),serviceID); >> CFDictionaryAddValue(params,CFSTR("Password"),pw); >> >> CFArrayAppendValue(order, CFSTR("Service")); >> CFArrayAppendValue(order, CFSTR("Password")); >> >> WSMethodInvocationSetParameters(inv,params,order); >> //right, should be able to invoke the method now >> >> CFDictionaryRef result = WSMethodInvocationInvoke(inv); >> >> CFStringRef returnStr; >> //let's see if that worked >> if(WSMethodResultIsFault(result)) >> { >> printf("Didn't work.\n"); >> returnStr = CFDictionaryGetValue(result, kWSFaultString); >> printf("Fault: %s\n",CFStringGetCStringPtr >> (returnStr,kCFStringEncodingUTF8)); >> } >> else >> { >> printf("Worked!\n"); >> returnStr = CFDictionaryGetValue(result, >> kWSMethodInvocationResult); >> printf("%s\n",CFStringGetCStringPtr >> (returnStr,kCFStringEncodingUTF8)); >> } >> >> return 0; >> } >> > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From leeg at thaesofereode.info Fri Feb 2 09:51:11 2007 From: leeg at thaesofereode.info (Graham J Lee) Date: Fri Feb 2 09:51:38 2007 Subject: WebServicesCore problem In-Reply-To: References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> Message-ID: <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> On 2 Feb 2007, at 17:26, Todd Ditchendorf wrote: > This will cause it to follow redirects and also include raw req and > res in the result dicitonary. Print the entire result dictionary to > see those. Thanks for the hint. I added your lines, then tried to walk the dictionary like this: > //print out the whole result dict > int i, count = 0; > count = CFDictionaryGetCount(result); > void **keys = malloc(count*sizeof(void *)); > void **values = malloc(count*sizeof(void *)); > > CFDictionaryGetKeysAndValues(result,keys,values); > > for(i=0; i { > printf("%s: %s\n", CFStringGetCStringPtr(keys > [i],kCFStringEncodingUTF8), > CFStringGetCStringPtr(values > [i],kCFStringEncodingUTF8)); > } > which resulted in this: > (null): (null) > (null): (null) > (null): (null) > (null): (null) > as you can tell, I'm more used to doing: NSLog(@"%@",(NSDictionary *)result); but as this project is in C I can't use the toll-free bridging :-(. So it looks like I'm missing something fundamental about CoreFoundation...question is, what is it? :-) Cheers, Graham. From itod at mac.com Fri Feb 2 09:57:38 2007 From: itod at mac.com (Todd Ditchendorf) Date: Fri Feb 2 09:58:03 2007 Subject: WebServicesCore problem In-Reply-To: <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> Message-ID: <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> > which resulted in this: > >> (null): (null) >> (null): (null) >> (null): (null) >> (null): (null) >> > woah... i wonder if you're even hitting the server... this seems to hint that you may not be. I'm *def* not the best c programmer, but: > void **keys = malloc(count*sizeof(void *)); > void **values = malloc(count*sizeof(void *)); > > CFDictionaryGetKeysAndValues(result,keys,values); i would try this instead: > void *keys = malloc(count*sizeof(void *)); > void *values = malloc(count*sizeof(void *)); > > CFDictionaryGetKeysAndValues(result,&keys,&values); > as you can tell, I'm more used to doing: > NSLog(@"%@",(NSDictionary *)result); > but as this project is in C I can't use the toll-free bridging :- > (. So it looks like I'm missing something fundamental about > CoreFoundation...question is, what is it? :-) I'm thinking you're not actually accessing the service (is the url correct?, etc). I would try coding it with TFB and Foundation included just for kicks until you are certain it's working, then slowly remove the cocoa code line by line, checking for problems each step of the way. But then I'm way more comfortable in Cocoa than CF, so who knows. > > Cheers, > > Graham. Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us From leeg at thaesofereode.info Fri Feb 2 10:30:38 2007 From: leeg at thaesofereode.info (Graham J Lee) Date: Fri Feb 2 10:32:27 2007 Subject: WebServicesCore problem In-Reply-To: <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> Message-ID: On 2 Feb 2007, at 17:57, Todd Ditchendorf wrote: > >> which resulted in this: >> >>> (null): (null) >>> (null): (null) >>> (null): (null) >>> (null): (null) >>> >> > > woah... i wonder if you're even hitting the server... this seems to > hint that you may not be. Thanks again, I'll try some other things over the w/e. I did stick ethereal on and observed that there was _some_ interaction with the remote server/port - can't tell what because of the SSL though. Cheers, Graham. From mzarra at mac.com Fri Feb 2 14:05:24 2007 From: mzarra at mac.com (Marcus S. Zarra) Date: Fri Feb 2 14:05:41 2007 Subject: Core Data Confusion In-Reply-To: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> Message-ID: Short answer is no It is not a bad thing to be accessing the primitive values in this situation. I believe that warning was for external access to the values. e.g. object A should be calling -getValueForKey: instead of - getPrimitiveValueForKey: on object B. This ensures that object B has complete control over what happens when that value is accessed. Marcus S. Zarra Zarra Studios LLC Simply Elegant Software for OS X www.zarrastudios.com On Jan 31, 2007, at 10:32 AM, Boisy Pitre wrote: > For the last couple of weeks I have been navigating through the > Core Data swamp and have made significant progress in my > understanding of the architecture. That said, there are a couple > of things that really have me shaking my head, and I would > appreciate a second look. > > Real quick: my application is intended to track information about > animals on different farms. The data model has three entities: > > - FARM <-->> ANIMAL <-->> VACCINATION > > Note the relationships between each entity are to-many going in the > right direction and to-one going in the left (inverse) direction. > A farm can contain many animals and each animal can have multiple > vaccinations. > > Without getting into too much detail, the FARM entity has a > transient property report(a string) which depends on other > attributes in the FARM entity changes. So the initialize method in > my FARM Managed Object class is: > > + (void)initialize > { > [self setKeys:[NSArray arrayWithObjects: > @"farmName", > @"managerName", > nil] > triggerChangeNotificationsForDependentKey:@"report"]; > } > > The attributes farmName and managerName are updated in text fields > in a window and are updated daily. The idea is that when either of > these values change, the report attribute should be updated to > reflect changes to the names. My report method: > > - (NSString *)report > { > NSString * tmpValue = nil; > > [self willAccessValueForKey: @"report"]; > tmpValue = [self constructFarmReport]; > [self didAccessValueForKey: @"report"]; > > return tmpValue; > } > > > - (NSString *)constructFarmReport > { > NSString *reportString = [[NSString alloc] initWithString:@""]; > NSString *farm = [self primitiveValueForKey:@"farmName"]; > NSString *manager = [self primitiveValueForKey:@"managerName"]; > ... > > When the report method is called due to a change in farmName/ > managerName, it will call constructFarmReport which builds the > report string and returns it. Note that I am using the method > primitiveValueForKey to access the values farmName/managerName > instead of accessing the identifiers directly. I've found that in > the debugger, if I don't use primitiveValueForKey, then the > willAccessValueForKey/didAccessValueForKey methods get invoked. My > question is: is using the primitive method to obtain the values of > these attributes a bad thing? I know the Core Data document > discourages one from using the primitive version of the call, and > encourages use of either valueForKey: or access the identifier > directly, but if control is already in a method which was invoked > BECAUSE of KVO, is accessing that variable again INSIDE of the > observed method a bad thing? > -- > Boisy G. Pitre > 337.781.3570 mobile > email: boisy@boisypitre.com > Website: www.boisypitre.com > > "If there is truth to the proposition that knowing the past helps > us to understand the present, I believe there is at least as much > truth to the proposition that what we know of the present is > crucial to our understanding of the past. What we have not > ourselves experienced or observed we can at most only partially and > imperfectly comprehend; and I suspect that there is much in history > that is so remote from our own experiences or observations as to be > largely beyond our understanding." - Kenneth M. Stamp > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From sstevenson at mac.com Fri Feb 2 14:51:24 2007 From: sstevenson at mac.com (Scott Stevenson) Date: Fri Feb 2 14:51:17 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> Message-ID: <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> On Feb 2, 2007, at 2:05 PM, Marcus S. Zarra wrote: > It is not a bad thing to be accessing the primitive values in this > situation. I believe that warning was for external access to the > values. e.g. object A should be calling -getValueForKey: instead > of -getPrimitiveValueForKey: on object B. This ensures that object > B has complete control over what happens when that value is accessed. What do you think about the fact that -primitiveValueForKey isn't wrapped in will/did accessValueForKey? That seems like it could cause some bizarre behavior. - Scott From cmhofman at gmail.com Fri Feb 2 15:07:39 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Fri Feb 2 15:07:51 2007 Subject: Core Data Confusion In-Reply-To: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> Message-ID: <7C546796-5389-4663-A084-6E38DB014701@gmail.com> On 31 Jan 2007, at 6:32 PM, Boisy Pitre wrote: > For the last couple of weeks I have been navigating through the > Core Data swamp and have made significant progress in my > understanding of the architecture. That said, there are a couple > of things that really have me shaking my head, and I would > appreciate a second look. > > Real quick: my application is intended to track information about > animals on different farms. The data model has three entities: > > - FARM <-->> ANIMAL <-->> VACCINATION > > Note the relationships between each entity are to-many going in the > right direction and to-one going in the left (inverse) direction. > A farm can contain many animals and each animal can have multiple > vaccinations. > > Without getting into too much detail, the FARM entity has a > transient property report(a string) which depends on other > attributes in the FARM entity changes. So the initialize method in > my FARM Managed Object class is: > > + (void)initialize > { > [self setKeys:[NSArray arrayWithObjects: > @"farmName", > @"managerName", > nil] > triggerChangeNotificationsForDependentKey:@"report"]; > } > > The attributes farmName and managerName are updated in text fields > in a window and are updated daily. The idea is that when either of > these values change, the report attribute should be updated to > reflect changes to the names. My report method: > > - (NSString *)report > { > NSString * tmpValue = nil; > > [self willAccessValueForKey: @"report"]; > tmpValue = [self constructFarmReport]; > [self didAccessValueForKey: @"report"]; > > return tmpValue; > } > > > - (NSString *)constructFarmReport > { > NSString *reportString = [[NSString alloc] initWithString:@""]; > NSString *farm = [self primitiveValueForKey:@"farmName"]; > NSString *manager = [self primitiveValueForKey:@"managerName"]; > ... > > When the report method is called due to a change in farmName/ > managerName, it will call constructFarmReport which builds the > report string and returns it. Note that I am using the method > primitiveValueForKey to access the values farmName/managerName > instead of accessing the identifiers directly. I've found that in > the debugger, if I don't use primitiveValueForKey, then the > willAccessValueForKey/didAccessValueForKey methods get invoked. My > question is: is using the primitive method to obtain the values of > these attributes a bad thing? I know the Core Data document > discourages one from using the primitive version of the call, and > encourages use of either valueForKey: or access the identifier > directly, but if control is already in a method which was invoked > BECAUSE of KVO, is accessing that variable again INSIDE of the > observed method a bad thing? Why would it be called JUST because of KVO? If you use the report property anywhere, it could just be called because the report value is needed for (inital) display or something. Generally, when you access a variable in CD you should use valueForKey or call willAccessValueForKey/didAccessForKey, I don't see any reason why this situation is any different. I can imagine that CD has to fetch or update the value for farmName or managerName (I don't really know how willAccessValueForKey/didAccessForKey are used, but they can do something). Christiaan > -- > Boisy G. Pitre > 337.781.3570 mobile > email: boisy@boisypitre.com > Website: www.boisypitre.com > > "If there is truth to the proposition that knowing the past helps > us to understand the present, I believe there is at least as much > truth to the proposition that what we know of the present is > crucial to our understanding of the past. What we have not > ourselves experienced or observed we can at most only partially and > imperfectly comprehend; and I suspect that there is much in history > that is so remote from our own experiences or observations as to be > largely beyond our understanding." - Kenneth M. Stamp > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From leeg at thaesofereode.info Sat Feb 3 03:06:33 2007 From: leeg at thaesofereode.info (Graham J Lee) Date: Sat Feb 3 03:06:27 2007 Subject: WebServicesCore problem In-Reply-To: <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> Message-ID: <608AF6E2-2F1E-4E32-AD30-121DB1F49735@thaesofereode.info> On 2 Feb 2007, at 17:57, Todd Ditchendorf wrote: > [...] >> as you can tell, I'm more used to doing: >> NSLog(@"%@",(NSDictionary *)result); >> but as this project is in C I can't use the toll-free bridging :- >> (. So it looks like I'm missing something fundamental about >> CoreFoundation...question is, what is it? :-) > > I'm thinking you're not actually accessing the service (is the url > correct?, etc). I would try coding it with TFB and Foundation > included just for kicks until you are certain it's working, then > slowly remove the cocoa code line by line, checking for problems > each step of the way. But then I'm way more comfortable in Cocoa > than CF, so who knows. That at least got me to print out the dictionary... Result: { "/FaultCode" = -65794; "/FaultExtra" = {domain = 3; error = -9812; msg = "Stream Error"; }; "/FaultString" = "/CFStreamFault"; "/kWSResultIsFault" = 1; } I'm willing to bet this is a problem with the SSL certificate, as the WSMethodInvocationRef doesn't even appear to have generated any XML. Actually, I just thought of a way to test that...I have access to the same API (but no credentials) on a deployment system. Connecting to that produces a different error, but one which shows that the transaction did actually occur. Wow, so much hassle to find a configuration problem ;-) Thanks for all your help, Graham. From itod at mac.com Sat Feb 3 09:20:25 2007 From: itod at mac.com (Todd Ditchendorf) Date: Sat Feb 3 09:20:37 2007 Subject: WebServicesCore problem In-Reply-To: <608AF6E2-2F1E-4E32-AD30-121DB1F49735@thaesofereode.info> References: <02FE83D8-3180-4868-9FD3-4C95F377A9AC@thaesofereode.info> <68CA2455-0E0A-4BD7-BACA-B09FB35F8530@thaesofereode.info> <42F76B81-81E8-4E28-9DEF-5AD40440BC59@mac.com> <608AF6E2-2F1E-4E32-AD30-121DB1F49735@thaesofereode.info> Message-ID: > XML. Actually, I just thought of a way to test that...I have > access to the same API (but no credentials) on a deployment > system. Connecting to that produces a different error, but one > which shows that the transaction did actually occur. > > Wow, so much hassle to find a configuration problem ;-) Sounds like my experiences with SOAP :( BTW, have you tried my Cocoa desktop app for debugging SOAP+WSDL- based services?: http://www.ditchnet.org/soapclient/ I don't know if it will support ssl, but it does support http basic & digest auth. Just enter your wsld file's location in the text field, click parse, and you should see an html user interface dynamically generated for your soap service. the endpoint, namespace, soapaction header will already be filled in for you... just select a method and enter param values. I think you're right... debugging a non-ssl version first is a good approach if it's possible. Good luck. Todd Ditchendorf Scandalous Software - Mac XML Developer Tools http://scan.dalo.us From milke at mac.com Sun Feb 4 14:32:38 2007 From: milke at mac.com (=?UTF-8?Q?Dragan_Mili=C4=87?=) Date: Sun Feb 4 14:32:46 2007 Subject: AppleScript support - 10.3/10.4 Message-ID: <77972D28-3CD2-4457-86A7-793F9643F6C6@mac.com> Hello everyone, Perhaps this should be posted to any of lists dedicated to AppleScript, but is' related not to AppleScript specifically, but more to support for it in an Cocoa application, so I still hope this is the right place. If not, I apologise in advance. I've developed a UB Cocoa app, which still needs to work on Panther 10.3+, so even prior 10.3.9. For that reason, I built the executable with the following environment variables: GCC_VERSION_i386: 4.0 GCC_VERSION_ppc: 3.3 MACOSX_DEPLOYMENT_TARGET_i386: 10.4 MACOSX_DEPLOYMENT_TARGET_ppc: 10.3 SDKROOT_i386: /Developer/SDKs/MacOSX10.4u.sdk SDKROOT_ppc: /Developer/SDKs/MacOSX10.3.9.sdk The app works fine on both 10.3.x and 10.4.x on PPC and 10.4.x on Intel. Now I need to add some basic AppleScript support, and there I encounter a problem, probably related to differences in scripting definitions in 10.3 and 10.4. Following Apple Developer documentation, I've created .def file and run sdp tool to produce both .scriptSuite and .scriptTerminology files. All three files are then included into app bundle resources. On 10.3.x and PPC, everything works OK, I can open app's scripting definition dictionary from within Script Editor and successfully use all definitions from my scripting suite (classes, commands, etc.). The same goes for running on 10.4.x and Intel processors. But, I've got a problem when running on 10.4.x and PPC. I can still open scripting definition dictionary from within Script Editor and read all the definitions from my scripting suite, but if I try to use any of them in the script, the Script Editor complains about undefined variable. For example, there is the command "extract" in the suite, I can clearly see it when opening dictionary, but every attempt to use it in the script results with the "The variable extract is not defined." message in an error sheet of the editor. The same goes for classes, type definitions, etc. Building the executable without environment variables mentioned above solves the problem, so I can successfully script the app on 10.4.x and PPC, but of course, I can't run it on system version prior to 10.3.9 (because of gcc 4.0). Clearly, the collision happens when trying to script executable built for 10.3 and running on 10.4. What is not clear to me is how this situation can be overcome. Any hint or tip is highly appreciated. Regards, Milke From treaves at silverfieldstech.com Sun Feb 4 14:42:54 2007 From: treaves at silverfieldstech.com (Timothy Reaves) Date: Sun Feb 4 14:45:02 2007 Subject: XCode won't stop at breakpoint Message-ID: I'm using XCode 2.4.1, and when I debug my app, none of my breakpoints are having any effect. I've checked everything I can think of that may have caused this, and nothing seems to work. Any ideas? From sstevenson at mac.com Sun Feb 4 15:23:48 2007 From: sstevenson at mac.com (Scott Stevenson) Date: Sun Feb 4 15:23:33 2007 Subject: XCode won't stop at breakpoint In-Reply-To: References: Message-ID: <924A6BDA-93C4-46CC-8E94-7DFFE240EFB0@mac.com> On Feb 4, 2007, at 2:42 PM, Timothy Reaves wrote: > I'm using XCode 2.4.1, and when I debug my app, none of my > breakpoints are having any effect. I've checked everything I can > think of that may have caused this, and nothing seems to work. 1. Are you sure you're running in debug mode? 2. Is there only one copy of the app running? 3. Does it happen if you make a new test project? - Scott From cmhofman at gmail.com Sun Feb 4 15:56:03 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Sun Feb 4 15:56:09 2007 Subject: AppleScript support - 10.3/10.4 In-Reply-To: <77972D28-3CD2-4457-86A7-793F9643F6C6@mac.com> References: <77972D28-3CD2-4457-86A7-793F9643F6C6@mac.com> Message-ID: On 4 Feb 2007, at 11:32 PM, Dragan Mili? wrote: > Hello everyone, > > Perhaps this should be posted to any of lists dedicated to > AppleScript, but is' related not to AppleScript specifically, but > more to support for it in an Cocoa application, so I still hope > this is the right place. If not, I apologise in advance. > > I've developed a UB Cocoa app, which still needs to work on Panther > 10.3+, so even prior 10.3.9. For that reason, I built the > executable with the following environment variables: > > GCC_VERSION_i386: 4.0 > GCC_VERSION_ppc: 3.3 > MACOSX_DEPLOYMENT_TARGET_i386: 10.4 > MACOSX_DEPLOYMENT_TARGET_ppc: 10.3 > SDKROOT_i386: /Developer/SDKs/MacOSX10.4u.sdk > SDKROOT_ppc: /Developer/SDKs/MacOSX10.3.9.sdk > > The app works fine on both 10.3.x and 10.4.x on PPC and 10.4.x on > Intel. Now I need to add some basic AppleScript support, and there > I encounter a problem, probably related to differences in scripting > definitions in 10.3 and 10.4. Following Apple Developer > documentation, I've created .def file and run sdp tool to produce > both .scriptSuite and .scriptTerminology files. All three files are > then included into app bundle resources. > > On 10.3.x and PPC, everything works OK, I can open app's scripting > definition dictionary from within Script Editor and successfully > use all definitions from my scripting suite (classes, commands, > etc.). The same goes for running on 10.4.x and Intel processors. > But, I've got a problem when running on 10.4.x and PPC. I can still > open scripting definition dictionary from within Script Editor and > read all the definitions from my scripting suite, but if I try to > use any of them in the script, the Script Editor complains about > undefined variable. For example, there is the command "extract" in > the suite, I can clearly see it when opening dictionary, but every > attempt to use it in the script results with the "The variable > extract is not defined." message in an error sheet of the editor. > The same goes for classes, type definitions, etc. Building the > executable without environment variables mentioned above solves the > problem, so I can successfully script the app on 10.4.x and PPC, > but of course, I can't run it on system version prior to 10.3.9 > (because of gcc 4.0). > Do you have (Objective-)C++ code? If not, you can use gcc 4.0 without a problem (is 10.3.0+ for C and Objective-C). Christiaan > Clearly, the collision happens when trying to script executable > built for 10.3 and running on 10.4. What is not clear to me is how > this situation can be overcome. Any hint or tip is highly appreciated. > > Regards, > Milke > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev From milke at mac.com Sun Feb 4 16:07:15 2007 From: milke at mac.com (=?UTF-8?Q?Dragan_Mili=C4=87?=) Date: Sun Feb 4 16:07:28 2007 Subject: [Solved] AppleScript support - 10.3/10.4 Message-ID: On ned 04. 02. 2007., at 23:32, Dragan Mili? wrote: > Hello everyone, > > Perhaps this should be posted to any of lists dedicated to > AppleScript, but is' related not to AppleScript specifically, but > more to support for it in an Cocoa application, so I still hope > this is the right place. If not, I apologise in advance... > > ... Regards, > Milke Hello again, this problem is solved. Actually the issue was, as I was explained, a " typical" AppleScript Dictionary Caching problem. Thanks to Jerry Krinock who has pointed that out to me. Regards, Milke From milke at mac.com Sun Feb 4 16:14:48 2007 From: milke at mac.com (=?UTF-8?Q?Dragan_Mili=C4=87?=) Date: Sun Feb 4 16:14:46 2007 Subject: AppleScript support - 10.3/10.4 In-Reply-To: References: <77972D28-3CD2-4457-86A7-793F9643F6C6@mac.com> Message-ID: <71DF8048-1FA5-457A-B79C-83E30673ED7A@mac.com> On pon 05. 02. 2007., at 00:56, Christiaan Hofman wrote: > Do you have (Objective-)C++ code? If not, you can use gcc 4.0 > without a problem (is 10.3.0+ for C and Objective-C). > > Christiaan Yes, I do have (Objective-)C++, that's why I'm using gcc 3.3 for 10.3 build. Anyway, the problem was in AppleScript Dictionary Caching, works fine now. Regards, Milke From boisy at boisypitre.com Sun Feb 4 16:59:32 2007 From: boisy at boisypitre.com (Boisy Pitre) Date: Sun Feb 4 17:16:57 2007 Subject: Core Data Minefield In-Reply-To: <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> Message-ID: Thanks Marcus and Scott for the advice and wisdom. I think I will stick to using primitiveValueForKey for now. Another issue has cropped up regarding the loading of a previously saved data file in my Core Data application. A quick review of the classes involved: FARM <-->> ANIMALS <-->> VACCINATIONS ANIMALS has a transient attribute that is calculated based on attributes in VACCINATIONS. Also, FARM has a transient attribute that is calculated based on attributes in ANIMALS. Apple's Core Data application states if an entity wants to be aware of changes made to an attribute in another entity, it can register for notifications. As per Apple's suggestion to solve this, I have the following code in both FARM.m and ANIMALS.m: /* Called from awakeFromInsert and awakeFromFetch. Here we register for the notification for changes to the managed object context. */ - (void)commonAwake { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refresh:) name:NSManagedObjectContextObjectsDidChangeNotification object:[self managedObjectContext]]; } - (void)awakeFromInsert { [super awakeFromInsert]; [self setValue:[NSNumber numberWithInt:2] forKey:@"timeIntervalUnit"]; [self commonAwake]; } - (void)awakeFromFetch { [super awakeFromFetch]; [self commonAwake]; } The refresh method referenced in commonAwake checks for the expected notification and recomputes its transient if so. What I am seeing is that when a previously saved data file is opened, the inserted/deleted/updated NSManagedObjectContextObjectsDidChangeNotification notifications are NOT triggered. These notifications only appear when inserting, updating or deleting data AFTER the file has been loaded. The question of the hour is: how can transients be recomputed from data in other entities when the data file is loaded from storage? It appears that the NSManagedObjectContextObjectsDidChangeNotification notification is not sent when data is inserted on LOAD. -- Boisy G. Pitre 337.781.3570 mobile email: boisy@boisypitre.com Website: www.boisypitre.com From huntc at internode.on.net Sun Feb 4 23:30:26 2007 From: huntc at internode.on.net (Christopher Hunt) Date: Sun Feb 4 23:30:38 2007 Subject: CGDisplayCapture and display sleep Message-ID: <83C69245-C7B8-46E0-B6F8-545D8C3AAF37@internode.on.net> Hi there, Can anyone confirm that CGDisplayCapture prevents a display from sleeping? I'm guessing that this is the case as I'm entering full screen mode (full screen gl context) and my "pmset -a force displaysleep 1" doesn't work when I'm in fullscreen mode. Additionally using the sys prefs UI to sleep the display after 1 min of inactivity doesn't appear to work either. All is fine if I'm not in full screen mode. Thanks in advance. Kind regards, Christopher From mmalc_lists at mac.com Mon Feb 5 04:52:02 2007 From: mmalc_lists at mac.com (mmalc crawford) Date: Mon Feb 5 04:52:22 2007 Subject: Core Data Minefield In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> Message-ID: <548C07B5-AE06-45F5-A62A-69B14AFFEEBC@mac.com> On Feb 4, 2007, at 4:59 PM, Boisy Pitre wrote: > What I am seeing is that when a previously saved data file is > opened, the inserted/deleted/updated > NSManagedObjectContextObjectsDidChangeNotification notifications are > NOT triggered. > Why would you expect to see a NSManagedObjectContextObjectsDidChangeNotification notification on load? The managed objects aren't changed. mmalc From mmalc_lists at mac.com Mon Feb 5 04:55:18 2007 From: mmalc_lists at mac.com (mmalc crawford) Date: Mon Feb 5 04:55:32 2007 Subject: Core Data Confusion In-Reply-To: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> Message-ID: On Jan 31, 2007, at 9:32 AM, Boisy Pitre wrote: > My question is: is using the primitive method to obtain the values > of these attributes a bad thing? I know the Core Data document > discourages one from using the primitive version of the call, and > encourages use of either valueForKey: or access the identifier > directly, but if control is already in a method which was invoked > BECAUSE of KVO, is accessing that variable again INSIDE of the > observed method a bad thing? > Yes -- it's not clear why you would ignore the advice in the documentation? The will/didAccess.. calls are required to fire faults. mmalc From cmhofman at gmail.com Mon Feb 5 05:40:48 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Mon Feb 5 05:41:04 2007 Subject: Core Data Confusion In-Reply-To: <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: I think the OP meant the remark about KVO the other way around: he seems to think that the report is called only because KVO told that the underlying data has changed. At least that is what I understood, and remarked this assumption is generally incorrect. Generally, when accessing properties managed by CD, one should use the proper non-primitive methods or wrap will/didAccessValueForKey methods around the primitive accessors. That's what the docs say, and I assume that's for a reason. The reason I can think of is that the will/didAccess.. methods make sure to fire the fault (fetch/update the value) if necessary. That would make sense to me, knowing that CD doesn't fetch properties immediately. Anyway, I don't know what it does, and I don't need to know. The only thing I need to know is what is in the docs: you better do it make sure the will/didAccess... methods are called. HOWEVER, if you choose to use primitive accessors, you are responsible to make sure everything is set up right. When you also don't use the will/didAccess... methods, you have to make sure that everything these methods does (like faulting,etc ?) has been taken care of. This DOES mean you need to know what these methods do (and you don't, unless you work for Apple, but also that is not true, as some framework developer might need to subclass these methods). So to conclude. Can it hurt? The answer is: Yes. Christiaan On 3 Feb 2007, at 8:47 PM, Marcus S. Zarra wrote: > It is true that -valueForKey: does not cause the KVO to fire and > that the OP could just use that instead of the primitive > accessors. But it also does not hurt anything, especially if he > has some other logic sitting in the -(NSString*)reportName; method > that he does not want to fire. > > Marcus S. Zarra > Zarra Studios LLC > Simply Elegant Software for OS X > www.zarrastudios.com > > On Feb 2, 2007, at 4:07 PM, Christiaan Hofman wrote: > >> >> On 31 Jan 2007, at 6:32 PM, Boisy Pitre wrote: >> >>> For the last couple of weeks I have been navigating through the >>> Core Data swamp and have made significant progress in my >>> understanding of the architecture. That said, there are a couple >>> of things that really have me shaking my head, and I would >>> appreciate a second look. >>> >>> Real quick: my application is intended to track information about >>> animals on different farms. The data model has three entities: >>> >>> - FARM <-->> ANIMAL <-->> VACCINATION >>> >>> Note the relationships between each entity are to-many going in >>> the right direction and to-one going in the left (inverse) >>> direction. A farm can contain many animals and each animal can >>> have multiple vaccinations. >>> >>> Without getting into too much detail, the FARM entity has a >>> transient property report(a string) which depends on other >>> attributes in the FARM entity changes. So the initialize method >>> in my FARM Managed Object class is: >>> >>> + (void)initialize >>> { >>> [self setKeys:[NSArray arrayWithObjects: >>> @"farmName", >>> @"managerName", >>> nil] >>> triggerChangeNotificationsForDependentKey:@"report"]; >>> } >>> >>> The attributes farmName and managerName are updated in text >>> fields in a window and are updated daily. The idea is that when >>> either of these values change, the report attribute should be >>> updated to reflect changes to the names. My report method: >>> >>> - (NSString *)report >>> { >>> NSString * tmpValue = nil; >>> >>> [self willAccessValueForKey: @"report"]; >>> tmpValue = [self constructFarmReport]; >>> [self didAccessValueForKey: @"report"]; >>> >>> return tmpValue; >>> } >>> >>> >>> - (NSString *)constructFarmReport >>> { >>> NSString *reportString = [[NSString alloc] initWithString:@""]; >>> NSString *farm = [self primitiveValueForKey:@"farmName"]; >>> NSString *manager = [self primitiveValueForKey:@"managerName"]; >>> ... >>> >>> When the report method is called due to a change in farmName/ >>> managerName, it will call constructFarmReport which builds the >>> report string and returns it. Note that I am using the method >>> primitiveValueForKey to access the values farmName/managerName >>> instead of accessing the identifiers directly. I've found that >>> in the debugger, if I don't use primitiveValueForKey, then the >>> willAccessValueForKey/didAccessValueForKey methods get invoked. >>> My question is: is using the primitive method to obtain the >>> values of these attributes a bad thing? I know the Core Data >>> document discourages one from using the primitive version of the >>> call, and encourages use of either valueForKey: or access the >>> identifier directly, but if control is already in a method which >>> was invoked BECAUSE of KVO, is accessing that variable again >>> INSIDE of the observed method a bad thing? >> >> >> Why would it be called JUST because of KVO? If you use the report >> property anywhere, it could just be called because the report >> value is needed for (inital) display or something. Generally, when >> you access a variable in CD you should use valueForKey or call >> willAccessValueForKey/didAccessForKey, I don't see any reason why >> this situation is any different. I can imagine that CD has to >> fetch or update the value for farmName or managerName (I don't >> really know how willAccessValueForKey/didAccessForKey are used, >> but they can do something). >> >> Christiaan >> >>> -- >>> Boisy G. Pitre >>> 337.781.3570 mobile >>> email: boisy@boisypitre.com >>> Website: www.boisypitre.com >>> >>> "If there is truth to the proposition that knowing the past helps >>> us to understand the present, I believe there is at least as much >>> truth to the proposition that what we know of the present is >>> crucial to our understanding of the past. What we have not >>> ourselves experienced or observed we can at most only partially >>> and imperfectly comprehend; and I suspect that there is much in >>> history that is so remote from our own experiences or >>> observations as to be largely beyond our understanding." - >>> Kenneth M. Stamp From mzarra at mac.com Mon Feb 5 09:04:39 2007 From: mzarra at mac.com (Marcus S. Zarra) Date: Mon Feb 5 09:04:46 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: The KVO methods do not fire faults in Core Data. Core Data retrieves all of the values for a managed object when that object is accessed. It specifically does not do any lazy initialization of attributes. However, it does do lazy initialization of relationships. The primitive methods will cause a fault to fire on a lazy relationship. If you access another managed object via - primitiveValueForKey: and that object has not been loaded yet -- the - primitiveValueForKey: method will cause it to fire. This can be tested very easily. The -willChangeValueForKey: and -didChangeValueForKey: should be wrapped around any calls to primitive setters -- not getters. The will/did methods cause a KVO notice to be sent out to let other observers know that the value has changed. It does not make sense to fire the will/did when you are reading the value. In the example the OP posted, the will/did are not necessary and accessing the values in the same managed object via the primitive methods is safe and makes sense in some situations. Marcus S. Zarra Zarra Studios LLC Simply Elegant Software for OS X www.zarrastudios.com On Feb 5, 2007, at 6:40 AM, Christiaan Hofman wrote: > I think the OP meant the remark about KVO the other way around: he > seems to think that the report is called only because KVO told that > the underlying data has changed. At least that is what I > understood, and remarked this assumption is generally incorrect. > > Generally, when accessing properties managed by CD, one should use > the proper non-primitive methods or wrap will/didAccessValueForKey > methods around the primitive accessors. That's what the docs say, > and I assume that's for a reason. The reason I can think of is that > the will/didAccess.. methods make sure to fire the fault (fetch/ > update the value) if necessary. That would make sense to me, > knowing that CD doesn't fetch properties immediately. Anyway, I > don't know what it does, and I don't need to know. The only thing I > need to know is what is in the docs: you better do it make sure the > will/didAccess... methods are called. HOWEVER, if you choose to use > primitive accessors, you are responsible to make sure everything is > set up right. When you also don't use the will/didAccess... > methods, you have to make sure that everything these methods does > (like faulting,etc ?) has been taken care of. This DOES mean you > need to know what these methods do (and you don't, unless you work > for Apple, but also that is not true, as some framework developer > might need to subclass these methods). > > So to conclude. Can it hurt? The answer is: Yes. > > Christiaan From shawnce at gmail.com Mon Feb 5 09:11:10 2007 From: shawnce at gmail.com (Shawn Erickson) Date: Mon Feb 5 09:11:15 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: On 2/5/07, Marcus S. Zarra wrote: > The KVO methods do not fire faults in Core Data. Core Data retrieves > all of the values for a managed object when that object is accessed. > It specifically does not do any lazy initialization of attributes. > However, it does do lazy initialization of relationships. > > The primitive methods will cause a fault to fire on a lazy > relationship. If you access another managed object via - > primitiveValueForKey: and that object has not been loaded yet -- the - > primitiveValueForKey: method will cause it to fire. This can be > tested very easily. > > The -willChangeValueForKey: and -didChangeValueForKey: should be > wrapped around any calls to primitive setters -- not getters. ...and folks are talking about will/didAccessValueForKey: [1]. For example... - (Measure *)measure { id tmpObject; [self willAccessValueForKey: @"measure"]; tmpObject = [self primitiveValueForKey: @"measure"]; [self didAccessValueForKey: @"measure"]; return tmpObject; } - (void)setMeasure:(Measure *)value { [self willChangeValueForKey: @"measure"]; [self setPrimitiveValue: value forKey: @"measure"]; [self didChangeValueForKey: @"measure"]; } [1] From shawnce at gmail.com Mon Feb 5 09:19:28 2007 From: shawnce at gmail.com (Shawn Erickson) Date: Mon Feb 5 09:19:37 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: On 2/5/07, Marcus S. Zarra wrote: > The KVO methods do not fire faults in Core Data. Core Data retrieves > all of the values for a managed object when that object is accessed. > It specifically does not do any lazy initialization of attributes. > However, it does do lazy initialization of relationships. I should also note that your are making assumption about how Core Data will operate... it could change its faulting behavior in the future (it could lazily load some subset of attributes). Using the correct will/did Access/Change methods when dealing with primitive values will protect you from changes in the implementation. The API and documentation do not preclude that Apple could extend Core Data in such ways... (in fact the documentation recommendations and API actually support that type of enhancement) -Shawn From cmhofman at gmail.com Mon Feb 5 09:33:17 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Mon Feb 5 09:33:29 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: On 5 Feb 2007, at 6:19 PM, Shawn Erickson wrote: > On 2/5/07, Marcus S. Zarra wrote: >> The KVO methods do not fire faults in Core Data. So why does the documentation on didAccessValueForKey : say / explicitly/: Together with willAccessValueForKey:, this method is used to fire faults, ... (see the link in the earlier mail from Shawn Erickson). >> Core Data retrieves >> all of the values for a managed object when that object is accessed. >> It specifically does not do any lazy initialization of attributes. >> However, it does do lazy initialization of relationships. > > I should also note that your are making assumption about how Core Data > will operate... it could change its faulting behavior in the future > (it could lazily load some subset of attributes). Using the correct > will/did Access/Change methods when dealing with primitive values will > protect you from changes in the implementation. > > The API and documentation do not preclude that Apple could extend Core > Data in such ways... (in fact the documentation recommendations and > API actually support that type of enhancement) > > -Shawn Exactly my point: perhaps it does nothing in some specific cases, but you cannot rely on that as long the documentation says otherwise. And as I noted: subclassers could also change that behavior. Christiaan From sstevenson at mac.com Mon Feb 5 09:55:27 2007 From: sstevenson at mac.com (Scott Stevenson) Date: Mon Feb 5 09:55:11 2007 Subject: Core Data Confusion In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <7C546796-5389-4663-A084-6E38DB014701@gmail.com> <4106AE2F-8B43-4333-ACF9-24A8B0477C52@mac.com> Message-ID: On Feb 5, 2007, at 9:04 AM, Marcus S. Zarra wrote: > The KVO methods do not fire faults in Core Data. [...] > The primitive methods will cause a fault to fire on a lazy > relationship. Even if that's true now (and I don't think it is), it could change in the future. It's an implementation detail which is encapsulated and shouldn't be relied on. > The -willChangeValueForKey: and -didChangeValueForKey: should be > wrapped around any calls to primitive setters -- not getters True, but these are easily confused with -will__Access__ValueForKey: and -did__Access__ValueForKey: which do (potentially) fire faults. There are two sets of will/did notifications: Getters: - willAccessValueForKey; - didAccessValueForKey; Setters: - willChangeValueForKey: - didChangeValueForKey: I heard your Late Night Cocoa interview* (which was quite good), so you clearly know what you're talking about. I suspect there was a typo somewhere in this thread that caused all of this confusion. Ironically, the word confusion is right in the thread name. - Scott (* http://latenightcocoa.com/?q=node/16) From macosxdevlist at personal.fishh2o.com Mon Feb 5 10:57:33 2007 From: macosxdevlist at personal.fishh2o.com (SD) Date: Mon Feb 5 11:25:31 2007 Subject: NSGenericException: can't open database In-Reply-To: References: Message-ID: Have you tried rebooting? ----- You could also try examining the db with sqlite3 > sqlite3 /Users/name/Library/Application >Support/SyncServices/Local/data.syncdb Then try running an sql command on the db. ______________________________________________________________________ Previous message from James Jesudason on 2/5/07 at 5:10 PM +0000 ********************************************************************** >Hi, > >I'm getting the following error on a sync: > > NSGenericException: can't open database >/Users/name/Library/Application >Support/SyncServices/Local/data.syncdb > >I've tried resetting the sync history in iSync, and also tried >deleting the ~/Library/Application Support/SyncServices/Local/*, but >can't seem to get past this error. > >Any thoughts? > >James > >_______________________________________________ >Do not post admin requests to the list. They will be ignored. >Syncservices-dev mailing list (Syncservices-dev@lists.apple.com) >Help/Unsubscribe/Update your Subscription: >%(user_optionsurl)s > >This email sent to %(user_address)s -- ========================================== SD WARNING: Programming may be habit forming. From stefan at agentfarms.net Mon Feb 5 15:30:51 2007 From: stefan at agentfarms.net (Stefan Urbanek) Date: Mon Feb 5 15:47:15 2007 Subject: Smart Containers In-Reply-To: <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> References: <1168862581.45ab6d757d3d2@mail.atlantis.sk> <39A60F90-864B-43B4-AD51-DCF8C1F1AEE2@mac.com> <1168871402.45ab8fea77774@mail.atlantis.sk> <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> Message-ID: <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> On 15.1.2007, at 17:16, Christiaan Hofman wrote: > I suggest you try to work through the CoreRecipes example project(s), > it contains smart groups and a UI to create predicates for smart > groups (be careful because it contains some bugs, at least the last > time I looked at it.) It's fairly complex, but that's just the way > it is (though I think their UI controller is a bit too complicated.) > This should give you an idea of the concepts involved in building > smart groups. If you have questions about specific (implementation) > details, you can come back to this list with those. > Thank you for your suggestion. I am now following the CoreRecipes example, with small modifications - I use NSPersistentDocument. I will try to create a short how-to to this problem after finishing it :-) The basic model is similar to the CoreRecipes: Group -> Context SmartGroup -> AbstractContext (i will use 'smart folder' name here) ManualGroup -> ConcreteContext (i will use 'folder' name here) Recipe -> Object initialisation of document: - set up a persistent store for 'smart folder' - set up smart folder called Universe and assign it to the 'smart' store - create 'unsaved document store' in configurePersistentStoreCoordinatorForURL I do: if unsavedDocumentStore != nil documentStore = [coordinator migratePersistentStore:unsavedDocumentStore toURL:url options:nil withType:NSXMLStoreType error:error]; else documentStore = [coordinator addPersistentStoreWithType:NSXMLStoreType configuration:nil URL:url options:nil error:error]; I have special action method for creating new concrete folder, similar to one in CoreRecipes. This is to make sure that the new folder is placed to the document persistent store. Also to prevent array controller to create instance of an abstract class. The UI is quickly designed as follows: - table view for folders - table view for objects - some text fields for selected object - array controller for folders - array controller for objects Folder creation works, object creation works as well. The 'Universe' folder works as expected. When I save the document without objects, only with new folders, it works. When I create some objects and try to save the document I get: 2007-02-06 00:10:55.048 SocNet6[6838] *** -[NSCFArray subarrayWithRange:]: index (2) beyond bounds (2) Stack: #0 0x9297c008 in -[NSException raise] #1 0x9297be5c in +[NSException raise:format:] #2 0x92985248 in -[NSArray subarrayWithRange:] #3 0x940ceb08 in -[NSPersistentStoreCoordinator(_NSInternalMethods) executeRequest:withContext:] #4 0x940e1b68 in -[NSManagedObjectContext save:] #5 0x93c39ee4 in -[NSPersistentDocument writeToURL:ofType:forSaveOperation:originalContentsURL:error:] #6 0x93953458 in -[NSDocument _writeToURL:ofType:forSaveOperation:inFolder:makingTemporaryCopyInFolder :error:] #7 0x93952f6c in -[NSDocument _writeSafelyToURL:ofType:forSaveOperation:error:] #8 0x93952cc8 in -[NSDocument writeSafelyToURL:ofType:forSaveOperation:error:] #9 0x93c3a1fc in -[NSPersistentDocument writeSafelyToURL:ofType:forSaveOperation:error:] #10 0x93952a08 in -[NSDocument saveToURL:ofType:forSaveOperation:error:] #11 0x93a3fce8 in -[NSDocument _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: ] #12 0x93952944 in -[NSDocument saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] #13 0x939526c4 in -[NSDocument saveDocumentWithDelegate:didSaveSelector:contextInfo:] #14 0x937acc4c in -[NSApplication sendAction:to:from:] ... I do not know what the array is. The number 2 does not reflect anything known to me - neither number of objects, nor number of folders. Only known 2 is number of persistent stores. Does anyone know what is possibly causing the problem? What should I try to get more information about what is going on? Thanks for any hints, Stefan Urbanek -- http://stefan.agentfarms.net First they ignore you, then they laugh at you, then they fight you, then you win. - Mahatma Gandhi From cmhofman at gmail.com Mon Feb 5 16:05:42 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Mon Feb 5 16:05:50 2007 Subject: Smart Containers In-Reply-To: <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> References: <1168862581.45ab6d757d3d2@mail.atlantis.sk> <39A60F90-864B-43B4-AD51-DCF8C1F1AEE2@mac.com> <1168871402.45ab8fea77774@mail.atlantis.sk> <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> Message-ID: <20166d560702051605u326117abha8af728881f8d61e@mail.gmail.com> I am totally confused about your store setup. Do you have 3 persistent store, and why would you want that? Usually you have one persistent store for each URL. You have at least 2 (the default one, and the documentStore you added, I don't know what unsavedDocumentStore is). There might be a problem that some group is on one persistent store, while the containing objects it refers to is in another. Christiaan On 2/6/07, Stefan Urbanek wrote: > > > On 15.1.2007, at 17:16, Christiaan Hofman wrote: > > > I suggest you try to work through the CoreRecipes example project(s), > > it contains smart groups and a UI to create predicates for smart > > groups (be careful because it contains some bugs, at least the last > > time I looked at it.) It's fairly complex, but that's just the way > > it is (though I think their UI controller is a bit too complicated.) > > This should give you an idea of the concepts involved in building > > smart groups. If you have questions about specific (implementation) > > details, you can come back to this list with those. > > > > Thank you for your suggestion. I am now following the CoreRecipes > example, with small modifications - I use NSPersistentDocument. I > will try to create a short how-to to this problem after finishing it :-) > > The basic model is similar to the CoreRecipes: > > Group -> Context > SmartGroup -> AbstractContext (i will use 'smart folder' name here) > ManualGroup -> ConcreteContext (i will use 'folder' name here) > Recipe -> Object > > initialisation of document: > - set up a persistent store for 'smart folder' > - set up smart folder called Universe and assign it to the 'smart' store > - create 'unsaved document store' > > in configurePersistentStoreCoordinatorForURL I do: > > if unsavedDocumentStore != nil > > documentStore = [coordinator > migratePersistentStore:unsavedDocumentStore > toURL:url > options:nil > > withType:NSXMLStoreType > error:error]; > > else > > documentStore = [coordinator > addPersistentStoreWithType:NSXMLStoreType > configuration:nil > URL:url > options:nil > error:error]; > > I have special action method for creating new concrete folder, > similar to one in CoreRecipes. This is to make sure that the new > folder is placed to the document persistent store. Also to prevent > array controller to create instance of an abstract class. > > The UI is quickly designed as follows: > - table view for folders > - table view for objects > - some text fields for selected object > - array controller for folders > - array controller for objects > > Folder creation works, object creation works as well. The 'Universe' > folder works as expected. When I save the document without objects, > only with new folders, it works. When I create some objects and try > to save the document I get: > > 2007-02-06 00:10:55.048 SocNet6[6838] *** -[NSCFArray > subarrayWithRange:]: index (2) beyond bounds (2) > > Stack: > > #0 0x9297c008 in -[NSException raise] > #1 0x9297be5c in +[NSException raise:format:] > #2 0x92985248 in -[NSArray subarrayWithRange:] > #3 0x940ceb08 in -[NSPersistentStoreCoordinator(_NSInternalMethods) > executeRequest:withContext:] > #4 0x940e1b68 in -[NSManagedObjectContext save:] > #5 0x93c39ee4 in -[NSPersistentDocument > writeToURL:ofType:forSaveOperation:originalContentsURL:error:] > #6 0x93953458 in -[NSDocument > _writeToURL:ofType:forSaveOperation:inFolder:makingTemporaryCopyInFolder > :error:] > #7 0x93952f6c in -[NSDocument > _writeSafelyToURL:ofType:forSaveOperation:error:] > #8 0x93952cc8 in -[NSDocument > writeSafelyToURL:ofType:forSaveOperation:error:] > #9 0x93c3a1fc in -[NSPersistentDocument > writeSafelyToURL:ofType:forSaveOperation:error:] > #10 0x93952a08 in -[NSDocument > saveToURL:ofType:forSaveOperation:error:] > #11 0x93a3fce8 in -[NSDocument > _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: > ] > #12 0x93952944 in -[NSDocument > saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] > #13 0x939526c4 in -[NSDocument > saveDocumentWithDelegate:didSaveSelector:contextInfo:] > #14 0x937acc4c in -[NSApplication sendAction:to:from:] > ... > > I do not know what the array is. The number 2 does not reflect > anything known to me - neither number of objects, nor number of > folders. Only known 2 is number of persistent stores. > > Does anyone know what is possibly causing the problem? What should I > try to get more information about what is going on? > > Thanks for any hints, > > > > Stefan Urbanek > -- > http://stefan.agentfarms.net > > First they ignore you, then they laugh at you, then they fight you, > then you win. > - Mahatma Gandhi > > > > From stefan at agentfarms.net Mon Feb 5 23:38:28 2007 From: stefan at agentfarms.net (Stefan Urbanek) Date: Mon Feb 5 23:38:56 2007 Subject: Smart Containers In-Reply-To: <20166d560702051605u326117abha8af728881f8d61e@mail.gmail.com> References: <1168862581.45ab6d757d3d2@mail.atlantis.sk> <39A60F90-864B-43B4-AD51-DCF8C1F1AEE2@mac.com> <1168871402.45ab8fea77774@mail.atlantis.sk> <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> <20166d560702051605u326117abha8af728881f8d61e@mail.gmail.com> Message-ID: <1170747508.45c83074cf1f9@mail.atlantis.sk> Excuse me for not giving enough facts. Goal is to have ordinary folders (manual folders), smart folders and built-in smart folders. Problems are causing the built-in smart folders, like 'Library' in CoreRecipes or iTunes. For simplicity, let us have only one built-in smart folder called Universe holding all objects - having 'true predicate'. The built-in folders are created by the application, but are not stored in the document store. The CoreRecipes solves this problem by having two stores: in-memory store and default on-disk store. The Universe object is created and put in the memory store, other objects are created and assigned to the default store. Because the core recipes is not document based it uses only one default store and the store has permanent location within user's directory structure - the URL of that store is known from the beginning. My application is a document based application. When I create a new document, I do not know where default document store is located, as it does not exist, obviously. However, I need to put new objects somewhere. I can not put them into the memory store where built-in smart folders are, as I do not want to mix them. I want to keep built-in smart folders separate. Therefore I need to create temporary in-memory store which I call 'unsaved document store'. This is the default document store from the beginning until user saves the document. When user saves the document for the first time, the unsaved document store is migrated from memory to the user specified URL. At this point I have two persistant stores: in-memory store for built-in smart folders and on-disk store as the default document store. (I am using three instance variables to know the state of my stores. I can use a flag instead...) If user opens an existing document, then the unsaved document store is not created at all. Stefan Urbanek Cit?t Christiaan Hofman : > I am totally confused about your store setup. Do you have 3 persistent > store, and why would you want that? Usually you have one persistent store > for each URL. You have at least 2 (the default one, and the documentStore > you added, I don't know what unsavedDocumentStore is). There might be a > problem that some group is on one persistent store, while the containing > objects it refers to is in another. > > Christiaan > > On 2/6/07, Stefan Urbanek wrote: > > > > > > On 15.1.2007, at 17:16, Christiaan Hofman wrote: > > > > > I suggest you try to work through the CoreRecipes example project(s), > > > it contains smart groups and a UI to create predicates for smart > > > groups (be careful because it contains some bugs, at least the last > > > time I looked at it.) It's fairly complex, but that's just the way > > > it is (though I think their UI controller is a bit too complicated.) > > > This should give you an idea of the concepts involved in building > > > smart groups. If you have questions about specific (implementation) > > > details, you can come back to this list with those. > > > > > > > Thank you for your suggestion. I am now following the CoreRecipes > > example, with small modifications - I use NSPersistentDocument. I > > will try to create a short how-to to this problem after finishing it :-) > > > > The basic model is similar to the CoreRecipes: > > > > Group -> Context > > SmartGroup -> AbstractContext (i will use 'smart folder' name here) > > ManualGroup -> ConcreteContext (i will use 'folder' name here) > > Recipe -> Object > > > > initialisation of document: > > - set up a persistent store for 'smart folder' > > - set up smart folder called Universe and assign it to the 'smart' store > > - create 'unsaved document store' > > > > in configurePersistentStoreCoordinatorForURL I do: > > > > if unsavedDocumentStore != nil > > > > documentStore = [coordinator > > migratePersistentStore:unsavedDocumentStore > > toURL:url > > options:nil > > > > withType:NSXMLStoreType > > error:error]; > > > > else > > > > documentStore = [coordinator > > addPersistentStoreWithType:NSXMLStoreType > > configuration:nil > > URL:url > > options:nil > > error:error]; > > > > I have special action method for creating new concrete folder, > > similar to one in CoreRecipes. This is to make sure that the new > > folder is placed to the document persistent store. Also to prevent > > array controller to create instance of an abstract class. > > > > The UI is quickly designed as follows: > > - table view for folders > > - table view for objects > > - some text fields for selected object > > - array controller for folders > > - array controller for objects > > > > Folder creation works, object creation works as well. The 'Universe' > > folder works as expected. When I save the document without objects, > > only with new folders, it works. When I create some objects and try > > to save the document I get: > > > > 2007-02-06 00:10:55.048 SocNet6[6838] *** -[NSCFArray > > subarrayWithRange:]: index (2) beyond bounds (2) > > > > Stack: > > > > #0 0x9297c008 in -[NSException raise] > > #1 0x9297be5c in +[NSException raise:format:] > > #2 0x92985248 in -[NSArray subarrayWithRange:] > > #3 0x940ceb08 in -[NSPersistentStoreCoordinator(_NSInternalMethods) > > executeRequest:withContext:] > > #4 0x940e1b68 in -[NSManagedObjectContext save:] > > #5 0x93c39ee4 in -[NSPersistentDocument > > writeToURL:ofType:forSaveOperation:originalContentsURL:error:] > > #6 0x93953458 in -[NSDocument > > _writeToURL:ofType:forSaveOperation:inFolder:makingTemporaryCopyInFolder > > :error:] > > #7 0x93952f6c in -[NSDocument > > _writeSafelyToURL:ofType:forSaveOperation:error:] > > #8 0x93952cc8 in -[NSDocument > > writeSafelyToURL:ofType:forSaveOperation:error:] > > #9 0x93c3a1fc in -[NSPersistentDocument > > writeSafelyToURL:ofType:forSaveOperation:error:] > > #10 0x93952a08 in -[NSDocument > > saveToURL:ofType:forSaveOperation:error:] > > #11 0x93a3fce8 in -[NSDocument > > _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: > > ] > > #12 0x93952944 in -[NSDocument > > saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] > > #13 0x939526c4 in -[NSDocument > > saveDocumentWithDelegate:didSaveSelector:contextInfo:] > > #14 0x937acc4c in -[NSApplication sendAction:to:from:] > > ... > > > > I do not know what the array is. The number 2 does not reflect > > anything known to me - neither number of objects, nor number of > > folders. Only known 2 is number of persistent stores. > > > > Does anyone know what is possibly causing the problem? What should I > > try to get more information about what is going on? > > > > Thanks for any hints, > > > > > > > > Stefan Urbanek > > -- > > http://stefan.agentfarms.net > > > > First they ignore you, then they laugh at you, then they fight you, > > then you win. > > - Mahatma Gandhi > > > > > > > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > -- http://stefan.agentfarms.net First they ignore you, then they laugh at you, then they fight you, then you win. - Mahatma Gandhi From cmhofman at gmail.com Tue Feb 6 02:27:15 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Tue Feb 6 02:27:18 2007 Subject: Smart Containers In-Reply-To: <1170747508.45c83074cf1f9@mail.atlantis.sk> References: <1168862581.45ab6d757d3d2@mail.atlantis.sk> <39A60F90-864B-43B4-AD51-DCF8C1F1AEE2@mac.com> <1168871402.45ab8fea77774@mail.atlantis.sk> <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> <20166d560702051605u326117abha8af728881f8d61e@mail.gmail.com> <1170747508.45c83074cf1f9@mail.atlantis.sk> Message-ID: <20166d560702060227t4ea06061o560f5004533b5da2@mail.gmail.com> On 2/6/07, Stefan Urbanek wrote: > > Excuse me for not giving enough facts. > > Goal is to have ordinary folders (manual folders), smart folders and > built-in > smart folders. Problems are causing the built-in smart folders, like > 'Library' > in CoreRecipes or iTunes. For simplicity, let us have only one built-in > smart > folder called Universe holding all objects - having 'true predicate'. > > The built-in folders are created by the application, but are not stored in > the > document store. The CoreRecipes solves this problem by having two stores: > in-memory store and default on-disk store. The Universe object is created > and > put in the memory store, other objects are created and assigned to the > default > store. Because the core recipes is not document based it uses only one > default > store and the store has permanent location within user's directory > structure - > the URL of that store is known from the beginning. > > My application is a document based application. When I create a new > document, I > do not know where default document store is located, as it does not exist, > obviously. However, I need to put new objects somewhere. I can not put > them > into the memory store where built-in smart folders are, as I do not want > to mix > them. I want to keep built-in smart folders separate. Therefore I need to > create > temporary in-memory store which I call 'unsaved document store'. This is > the > default document store from the beginning until user saves the document. > > When user saves the document for the first time, the unsaved document > store is > migrated from memory to the user specified URL. At this point I have two > persistant stores: in-memory store for built-in smart folders and on-disk > store > as the default document store. (I am using three instance variables to > know the > state of my stores. I can use a flag instead...) If user opens an existing > document, then the unsaved document store is not created at all. > > Stefan Urbanek And did you consider that NSPersistentDocument creates a store by default (though perhaps that doesn't happen now)? I don't see why you need the unsavedDocumentStore. Usually new objects belong to a document, so the persistent store for that document is present to put them in. I can imagine that you're doing something wrong with the migration, I don't know too much about that myself (never used it, because I never needed it). What I do, and it works perfect, is create the inMemoryStore in the -init of my persistent document. inMemoryStore = [[coordinator addPersistentStoreWithType:NSInMemoryStoreType configuration:@"InMemoryConfiguration" URL:nil options:nil error:nil] retain]; I use a separate configuration for non-perstistent entities like Library groups, so I don't have to explicitly assign them. Whether you can do that depends on your model. My -configurePersistentStoreCoordinatorForURL:... basically does this: [coordinator addPersistentStoreWithType:storeType configuration:@"PersistentConfiguration" URL:url options:nil error:&outError]; The InMemoryConfiguration and PersistentConfiguration are mutually exclusive configurations. If you explicitly assign objects to a particular store, as in CoreRecipies, you don't need configurePersistentStoreCoordinatorForURL:... at all, as the default implementation will do. I don't need anything else. Christiaan Cit?t Christiaan Hofman : > > > I am totally confused about your store setup. Do you have 3 persistent > > store, and why would you want that? Usually you have one persistent > store > > for each URL. You have at least 2 (the default one, and the > documentStore > > you added, I don't know what unsavedDocumentStore is). There might be a > > problem that some group is on one persistent store, while the containing > > > objects it refers to is in another. > > > > Christiaan > > > > On 2/6/07, Stefan Urbanek wrote: > > > > > > > > > On 15.1.2007, at 17:16, Christiaan Hofman wrote: > > > > > > > I suggest you try to work through the CoreRecipes example > project(s), > > > > it contains smart groups and a UI to create predicates for smart > > > > groups (be careful because it contains some bugs, at least the last > > > > time I looked at it.) It's fairly complex, but that's just the way > > > > it is (though I think their UI controller is a bit too complicated.) > > > > > This should give you an idea of the concepts involved in building > > > > smart groups. If you have questions about specific (implementation) > > > > details, you can come back to this list with those. > > > > > > > > > > Thank you for your suggestion. I am now following the CoreRecipes > > > example, with small modifications - I use NSPersistentDocument. I > > > will try to create a short how-to to this problem after finishing it > :-) > > > > > > The basic model is similar to the CoreRecipes: > > > > > > Group -> Context > > > SmartGroup -> AbstractContext (i will use 'smart folder' name here) > > > ManualGroup -> ConcreteContext (i will use 'folder' name here) > > > Recipe -> Object > > > > > > initialisation of document: > > > - set up a persistent store for 'smart folder' > > > - set up smart folder called Universe and assign it to the 'smart' > store > > > - create 'unsaved document store' > > > > > > in configurePersistentStoreCoordinatorForURL I do: > > > > > > if unsavedDocumentStore != nil > > > > > > documentStore = [coordinator > > > migratePersistentStore:unsavedDocumentStore > > > toURL:url > > > options:nil > > > > > > withType:NSXMLStoreType > > > error:error]; > > > > > > else > > > > > > documentStore = [coordinator > > > addPersistentStoreWithType:NSXMLStoreType > > > configuration:nil > > > URL:url > > > options:nil > > > > error:error]; > > > > > > I have special action method for creating new concrete folder, > > > similar to one in CoreRecipes. This is to make sure that the new > > > folder is placed to the document persistent store. Also to prevent > > > array controller to create instance of an abstract class. > > > > > > The UI is quickly designed as follows: > > > - table view for folders > > > - table view for objects > > > - some text fields for selected object > > > - array controller for folders > > > - array controller for objects > > > > > > Folder creation works, object creation works as well. The 'Universe' > > > folder works as expected. When I save the document without objects, > > > only with new folders, it works. When I create some objects and try > > > to save the document I get: > > > > > > 2007-02-06 00:10: 55.048 SocNet6[6838] *** -[NSCFArray > > > subarrayWithRange:]: index (2) beyond bounds (2) > > > > > > Stack: > > > > > > #0 0x9297c008 in -[NSException raise] > > > #1 0x9297be5c in +[NSException raise:format:] > > > #2 0x92985248 in -[NSArray subarrayWithRange:] > > > #3 0x940ceb08 in > -[NSPersistentStoreCoordinator(_NSInternalMethods) > > > executeRequest:withContext:] > > > #4 0x940e1b68 in -[NSManagedObjectContext save:] > > > #5 0x93c39ee4 in -[NSPersistentDocument > > > writeToURL:ofType:forSaveOperation:originalContentsURL:error:] > > > #6 0x93953458 in -[NSDocument > > > > _writeToURL:ofType:forSaveOperation:inFolder:makingTemporaryCopyInFolder > > > :error:] > > > #7 0x93952f6c in -[NSDocument > > > _writeSafelyToURL:ofType:forSaveOperation:error:] > > > #8 0x93952cc8 in -[NSDocument > > > writeSafelyToURL:ofType:forSaveOperation:error:] > > > #9 0x93c3a1fc in -[NSPersistentDocument > > > writeSafelyToURL:ofType:forSaveOperation:error:] > > > #10 0x93952a08 in -[NSDocument > > > saveToURL:ofType:forSaveOperation:error:] > > > #11 0x93a3fce8 in -[NSDocument > > > > _saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo: > > > ] > > > #12 0x93952944 in -[NSDocument > > > > saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:] > > > #13 0x939526c4 in -[NSDocument > > > saveDocumentWithDelegate:didSaveSelector:contextInfo:] > > > #14 0x937acc4c in -[NSApplication sendAction:to:from:] > > > ... > > > > > > I do not know what the array is. The number 2 does not reflect > > > anything known to me - neither number of objects, nor number of > > > folders. Only known 2 is number of persistent stores. > > > > > > Does anyone know what is possibly causing the problem? What should I > > > try to get more information about what is going on? > > > > > > Thanks for any hints, > > > > > > > > > > > > Stefan Urbanek > > > -- > > > http://stefan.agentfarms.net > > > > > > First they ignore you, then they laugh at you, then they fight you, > > > then you win. > > > - Mahatma Gandhi > > > > > > > > > > > > > > _______________________________________________ > > MacOSX-dev mailing list > > MacOSX-dev@omnigroup.com > > http://www.omnigroup.com/mailman/listinfo/macosx-dev > > > > > > > -- > http://stefan.agentfarms.net > > First they ignore you, then they laugh at you, then they fight you, > then you win. > - Mahatma Gandhi > From boisy at boisypitre.com Tue Feb 6 06:35:04 2007 From: boisy at boisypitre.com (Boisy Pitre) Date: Tue Feb 6 06:35:19 2007 Subject: Core Data Minefield In-Reply-To: <548C07B5-AE06-45F5-A62A-69B14AFFEEBC@mac.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> <548C07B5-AE06-45F5-A62A-69B14AFFEEBC@mac.com> Message-ID: <49298E72-6437-4098-A596-42B206F08964@boisypitre.com> On Feb 5, 2007, at 6:52 AM, mmalc crawford wrote: > > On Feb 4, 2007, at 4:59 PM, Boisy Pitre wrote: > >> What I am seeing is that when a previously saved data file is >> opened, the inserted/deleted/updated >> NSManagedObjectContextObjectsDidChangeNotification notifications >> are NOT triggered. >> > Why would you expect to see a > NSManagedObjectContextObjectsDidChangeNotification notification on > load? The managed objects aren't changed. mmalc, I would expect to see a NSManagedObjectContextObjectsDidChangeNotification notification on load by virtue of the fact that managed objects are being inserted into the managed object context. There are three keys that can be part of the passed userInfo dictionary: inserted, updated and deleted. When loading the data from the store, are they not being inserted into the managed object context? By extension, shouldn't this trigger the NSManagedObjectContextObjectsDidChangeNotification notification, alerting any registered observers? > t > mmalc > From sstevenson at mac.com Tue Feb 6 07:29:07 2007 From: sstevenson at mac.com (Scott Stevenson) Date: Tue Feb 6 07:29:03 2007 Subject: Core Data Minefield In-Reply-To: <49298E72-6437-4098-A596-42B206F08964@boisypitre.com> References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> <548C07B5-AE06-45F5-A62A-69B14AFFEEBC@mac.com> <49298E72-6437-4098-A596-42B206F08964@boisypitre.com> Message-ID: On Feb 6, 2007, at 6:35 AM, Boisy Pitre wrote: > I would expect to see a > NSManagedObjectContextObjectsDidChangeNotification notification on > load by virtue of the fact that managed objects are being inserted > into the managed object context [...] > There are three keys that can be part of the passed userInfo > dictionary: inserted, updated and deleted. When loading the data > from the store, are they not being inserted into the managed object > context? Actually, no. Insert really means "create". If you want an object to do something when it is loaded, you might look at overriding - awakeFromFetch in NSManagedObject. - Scott From patrick at narkinsky.com Tue Feb 6 07:57:35 2007 From: patrick at narkinsky.com (Patrick Narkinsky) Date: Tue Feb 6 08:05:31 2007 Subject: Sample code for OWSGMLProcessor? Message-ID: <1FDA6ECC-67B2-4D51-B329-E9324A7DF047@narkinsky.com> Greetings ... I'm fairly new to Objective C, Cocoa, etc., and I'm working on an application that needs to process SGMl files, and it looks like OWF is it when it comes to pure Objective-C SGML processors. Does anyone have or know of any sample code that uses OWSGMLProcessor and friends? Failing that, does anyone have any sample code for other descendants of OWObjectStreamProcessor that I could look at? I think I can figure this out if I have to, but some sample code sure would make life easier. Thanks, Patrick -- Patrick Narkinsky - patrick@narkinsky.com "We need not fear those who do evil in the name of evil, but Heaven protect us from those who do evil in the name of good." - Arthur C. Adams From milke at mac.com Tue Feb 6 09:17:31 2007 From: milke at mac.com (=?UTF-8?Q?Dragan_Mili=C4=87?=) Date: Tue Feb 6 09:17:46 2007 Subject: Struggling with basic AppleScript support Message-ID: Hello everyone, I'm definitely getting frustrated with AppleScript and adding support for it in a Cocoa application. First, I had a problem with "AppleScript Dictionary Caching" gotcha, but now that it's solved I really struggle with a very basic support for AppleScript. So, after spending the whole day trying to figure out what I was doing wrong, I saw no other way further than to ask on this list. I'll try to explain as detailed as possible what I did, so I apologise in advance to those not liking long posts. My application is NOT a document based one. Let's suppose its name is iPet. The principal class is NSApplication. An application controller MyPetController is the delegate of the NSApp. Each pet is represented by an instance of class MyPet, which is the subclass of NSObject, and has got two attributes: name and species, both of NSString type. All pets are recorded in an NSMutableArray pets, which is an instance variable of the MyPetController. MyPetController correctly implements -pets: get accessor method (set accessor is not implemented, there's no way to set all pets, one can only add them to the pets array): - (NSArray *)pets { return [NSArray arrayWithArray:pets]; } Also, in MyPetController I've implemented required delegate method: - (BOOL)delegateHandlesKey:(NSString *)key { return [key isEqualToString:@"pets"]; } MyPet class correctly implements both get and set accessors for its attributes: - (NSString *)name { return name; } - (void)setName:(NSString *)aName { [aName retain]; [name release]; name = aName; } - (NSString *)species { return species; } - (void)setSpecies:(NSString *)aSpec { [aSpec retain]; [species release]; species = aSpec; } Finally, this is how .scriptSuite and .scripTerminology (I need to support 10.3) files look like (don't worry, they are not long): iPetSuite.scriptSuite: AppleEventCode iPet Classes NSApplication AppleEventCode capp Superclass NSCoreSuite.NSApplication ToManyRelationships pets AppleEventCode Pett Type iPetSuite.MyPet MyPet AppleEventCode Pett Attributes name AppleEventCode Name Type NSString species AppleEventCode Spcs Type NSString Superclass NSCoreSuite.AbstractObject Name iPetSuite iPetSuite.scriptTerminology: Classes NSApplication Name application PluralName applications MyPet Attributes name Description The pet's name. Name name species Description The pet's species. Name species Name pet PluralName pets Name iPet Suite So, let's say the script looks like this: tell application "iPet" to get pets I can confirm that the delegate method -delegateHandlesKey: is called with key="pets" and I can observe that the -pets; accessor method of MyPetController really gets called. So, in the Script Editor output I'd expect to see something like (if pets array contains e.g. four instances of MyPet class): {pet 1 of application "iPet", pet 2 of application "iPet", pet 3 of application "iPet", pet 4 of application "iPet"} But instead I see: {application "iPet", application "iPet", application "iPet", application "iPet"} It's like I get four instances of NSApplication class, not MyPet. Add another pet to the array and as a result I get file instances of NSApplication class! When executing: tell application "iPet" to get last pet Again I can confirm that the delegate method -delegateHandlesKey: is called with key="pets" and I can observe that the -pets; accessor method of MyPetController really gets called. Instead of expected result: {pet 4 of application "iPet"} I get nothing. Of course, if I try something like: tell application "iPet" to set name of last pet to "Dingo" I get the script error, since MyPet object is not returned. There's probably some stupid thing that I'm overlooking, but I just can't figure out what that'd be. If I compare my .scriptSuite and .scriptTerminology files to those of TextEdit application, they look almost exactly the same. Same goes for the relevant code of MyPetController and TextEdit controller class. But still, TextEdit can be scripted successfully. Someone please put me out of my misery :-) Regards, Milke From cmhofman at gmail.com Tue Feb 6 09:55:27 2007 From: cmhofman at gmail.com (Christiaan Hofman) Date: Tue Feb 6 09:55:34 2007 Subject: Struggling with basic AppleScript support In-Reply-To: References: Message-ID: <20166d560702060955w6c7b6ba3w99ec4c2ad17d5c40@mail.gmail.com> Do you implement -[MyPet objectSpecifier] ? This is required for AppleScript support of custom objects. Christiaan On 2/6/07, Dragan Mili? wrote: > > Hello everyone, > > I'm definitely getting frustrated with AppleScript and adding support > for it in a Cocoa application. First, I had a problem with > "AppleScript Dictionary Caching" gotcha, but now that it's solved I > really struggle with a very basic support for AppleScript. So, after > spending the whole day trying to figure out what I was doing wrong, I > saw no other way further than to ask on this list. I'll try to > explain as detailed as possible what I did, so I apologise in advance > to those not liking long posts. > > My application is NOT a document based one. Let's suppose its name is > iPet. The principal class is NSApplication. An application controller > MyPetController is the delegate of the NSApp. Each pet is represented > by an instance of class MyPet, which is the subclass of NSObject, and > has got two attributes: name and species, both of NSString type. All > pets are recorded in an NSMutableArray pets, which is an instance > variable of the MyPetController. > > MyPetController correctly implements -pets: get accessor method (set > accessor is not implemented, there's no way to set all pets, one can > only add them to the pets array): > > - (NSArray *)pets > { > return [NSArray arrayWithArray:pets]; > } > > Also, in MyPetController I've implemented required delegate method: > > - (BOOL)delegateHandlesKey:(NSString *)key > { > return [key isEqualToString:@"pets"]; > } > > MyPet class correctly implements both get and set accessors for its > attributes: > > - (NSString *)name > { > return name; > } > > - (void)setName:(NSString *)aName > { > [aName retain]; > [name release]; > name = aName; > } > > - (NSString *)species > { > return species; > } > > - (void)setSpecies:(NSString *)aSpec > { > [aSpec retain]; > [species release]; > species = aSpec; > } > > Finally, this is how .scriptSuite and .scripTerminology (I need to > support 10.3) files look like (don't worry, they are not long): > > iPetSuite.scriptSuite: > > > www.apple.com/DTDs/PropertyList-1.0.dtd"> > > > AppleEventCode > iPet > Classes > > NSApplication > > AppleEventCode > capp > Superclass > NSCoreSuite.NSApplication > ToManyRelationships > > pets > > AppleEventCode > Pett > Type > iPetSuite.MyPet > > > > MyPet > > AppleEventCode > Pett > Attributes > > name > > AppleEventCode > Name > Type > NSString > > species > > AppleEventCode > Spcs > Type > NSString > > > Superclass > NSCoreSuite.AbstractObject > > > Name > iPetSuite > > > > iPetSuite.scriptTerminology: > > > www.apple.com/DTDs/PropertyList-1.0.dtd"> > > > Classes > > NSApplication > > Name > application > PluralName > applications > > MyPet > > Attributes > > name > > Description > The pet's name. > Name > name > > species > > Description > The pet's species. > Name > species > > > Name > pet > PluralName > pets > > > Name > iPet Suite > > > > So, let's say the script looks like this: > > tell application "iPet" to get pets > > I can confirm that the delegate method -delegateHandlesKey: is called > with key="pets" and I can observe that the -pets; accessor method of > MyPetController really gets called. So, in the Script Editor output > I'd expect to see something like (if pets array contains e.g. four > instances of MyPet class): > > {pet 1 of application "iPet", pet 2 of application "iPet", pet 3 of > application "iPet", pet 4 of application "iPet"} > > But instead I see: > > {application "iPet", application "iPet", application "iPet", > application "iPet"} > > It's like I get four instances of NSApplication class, not MyPet. Add > another pet to the array and as a result I get file instances of > NSApplication class! > > When executing: > > tell application "iPet" to get last pet > > Again I can confirm that the delegate method -delegateHandlesKey: is > called with key="pets" and I can observe that the -pets; accessor > method of MyPetController really gets called. Instead of expected > result: > > {pet 4 of application "iPet"} > > I get nothing. Of course, if I try something like: > > tell application "iPet" to set name of last pet to "Dingo" > > I get the script error, since MyPet object is not returned. > > There's probably some stupid thing that I'm overlooking, but I just > can't figure out what that'd be. If I compare my .scriptSuite > and .scriptTerminology files to those of TextEdit application, they > look almost exactly the same. Same goes for the relevant code of > MyPetController and TextEdit controller class. But still, TextEdit > can be scripted successfully. > > Someone please put me out of my misery :-) > > Regards, > Milke > > > _______________________________________________ > MacOSX-dev mailing list > MacOSX-dev@omnigroup.com > http://www.omnigroup.com/mailman/listinfo/macosx-dev > From milke at mac.com Tue Feb 6 10:05:11 2007 From: milke at mac.com (=?UTF-8?Q?Dragan_Mili=C4=87?=) Date: Tue Feb 6 10:05:26 2007 Subject: Struggling with basic AppleScript support In-Reply-To: <20166d560702060955w6c7b6ba3w99ec4c2ad17d5c40@mail.gmail.com> References: <20166d560702060955w6c7b6ba3w99ec4c2ad17d5c40@mail.gmail.com> Message-ID: <8BE9B1BD-3CAA-46B5-B6D2-2A60806AE5E8@mac.com> On uto 06. 02. 2007., at 18:55, Christiaan Hofman wrote: > Do you implement -[MyPet objectSpecifier] ? This is required for > AppleScript support of custom objects. > > Christiaan No, I knew that I've probably missed something. God, AppleScript support documentation is really spread all over the place. Thanks, I'll do that and inform of results. Regards, Milke From stefan at agentfarms.net Tue Feb 6 15:34:30 2007 From: stefan at agentfarms.net (Stefan Urbanek) Date: Tue Feb 6 15:34:46 2007 Subject: Smart Containers In-Reply-To: <20166d560702060227t4ea06061o560f5004533b5da2@mail.gmail.com> References: <1168862581.45ab6d757d3d2@mail.atlantis.sk> <39A60F90-864B-43B4-AD51-DCF8C1F1AEE2@mac.com> <1168871402.45ab8fea77774@mail.atlantis.sk> <436156C3-0B1D-4E3E-B90A-FB4AE36A5769@gmail.com> <5B8EF2F6-BD84-46BC-9EEA-325BD65520BF@agentfarms.net> <20166d560702051605u326117abha8af728881f8d61e@mail.gmail.com> <1170747508.45c83074cf1f9@mail.atlantis.sk> <20166d560702060227t4ea06061o560f5004533b5da2@mail.gmail.com> Message-ID: On 6.2.2007, at 11:27, Christiaan Hofman wrote: > > And did you consider that NSPersistentDocument creates a store by > default (though perhaps that doesn't happen now)? I don't see why > you need the unsavedDocumentStore. Usually new objects belong to a > document, so the persistent store for that document is present to > put them in. I can imagine that you're doing something wrong with > the migration, I don't know too much about that myself (never used > it, because I never needed it). > > What I do, and it works perfect, is create the inMemoryStore in the > -init of my persistent document. > > inMemoryStore = [[coordinator > addPersistentStoreWithType:NSInMemoryStoreType > configuration:@"InMemoryConfiguration" URL:nil > options:nil error:nil] retain]; > > I use a separate configuration for non-perstistent entities like > Library groups, so I don't have to explicitly assign them. Whether > you can do that depends on your model. My - > configurePersistentStoreCoordinatorForURL:... basically does this: > > [coordinator addPersistentStoreWithType:storeType > configuration:@"PersistentConfiguration" URL:url options:nil > error:&outError]; > > The InMemoryConfiguration and PersistentConfiguration are mutually > exclusive configurations. If you explicitly assign objects to a > particular store, as in CoreRecipies, you don't need > configurePersistentStoreCoordinatorForURL:... at all, as the > default implementation will do. I don't need anything else. > > Christiaan > Thanks, this works like a charm :) and is much cleaner. I was not thinking about using configurations. Only thing I needed to change was to add another (sub)entity for representing built-in smart folders, as they are only kind of smart folders that are in memory (others can be in the document store). Regards, Stefan Stefan Urbanek -- http://stefan.agentfarms.net First they ignore you, then they laugh at you, then they fight you, then you win. - Mahatma Gandhi From heizer1 at llnl.gov Thu Feb 8 09:55:50 2007 From: heizer1 at llnl.gov (Charles E. Heizer) Date: Thu Feb 8 09:55:59 2007 Subject: Build and Run problem in xcode... Message-ID: <385D648C-00B4-47EC-92FB-AF26AD6A80DD@llnl.gov> Hello, I'm brand new to C and ObjC using xcode, i've been in java land for a while and I wanted to do something new. So, I found some example code on using ldap api and wrote my little test tool which connects to our ldap(AD) server and will do a query. The app appears to compile just fine but when I run it I get a error: ZeroLink: unknown symbol '_ldap_open' LDAPCall has exited due to signal 6 (SIGABRT). Can someone please tell me what I'm going wrong. Thanks, Charles From clarkcox3 at gmail.com Thu Feb 8 10:08:11 2007 From: clarkcox3 at gmail.com (Clark Cox) Date: Thu Feb 8 10:08:17 2007 Subject: Build and Run problem in xcode... In-Reply-To: <385D648C-00B4-47EC-92FB-AF26AD6A80DD@llnl.gov> References: <385D648C-00B4-47EC-92FB-AF26AD6A80DD@llnl.gov> Message-ID: On 2/8/07, Charles E. Heizer wrote: > Hello, > I'm brand new to C and ObjC using xcode, i've been in java land for a > while and I wanted to do something new. > > So, I found some example code on using ldap api and wrote my little > test tool which connects to our ldap(AD) server and will do a query. > The app appears to compile just fine but when I run it I get a error: > > ZeroLink: unknown symbol '_ldap_open' One unfortunate side-effect of using ZeroLink is that many linktime errors become runtime errors due to the way that parts of the code are dynamically linked at runtime. Had you built this without using ZeroLink, you would've gotten an error at buildtime. Essentially, you haven't linked against the library that contains the ldap_open function. -- Clark S. Cox III clarkcox3@gmail.com From heizer1 at llnl.gov Thu Feb 8 11:00:47 2007 From: heizer1 at llnl.gov (Charles Heizer) Date: Thu Feb 8 11:01:07 2007 Subject: Build and Run problem in xcode... In-Reply-To: References: <385D648C-00B4-47EC-92FB-AF26AD6A80DD@llnl.gov> Message-ID: Huh, I did the import of ldap header "#import " in my code and xcode does the autofill ( code by multiple choice :-) ). Is there a good/easy way to find out what I'm missing? Thanks, Charles On Feb 8, 2007, at 10:08 AM, Clark Cox wrote: > On 2/8/07, Charles E. Heizer wrote: >> Hello, >> I'm brand new to C and ObjC using xcode, i've been in java land for a >> while and I wanted to do something new. >> >> So, I found some example code on using ldap api and wrote my little >> test tool which connects to our ldap(AD) server and will do a query. >> The app appears to compile just fine but when I run it I get a error: >> >> ZeroLink: unknown symbol '_ldap_open' > > One unfortunate side-effect of using ZeroLink is that many linktime > errors become runtime errors due to the way that parts of the code are > dynamically linked at runtime. Had you built this without using > ZeroLink, you would've gotten an error at buildtime. > > Essentially, you haven't linked against the library that contains the > ldap_open function. > > -- > Clark S. Cox III > clarkcox3@gmail.com > From leeg at thaesofereode.info Thu Feb 8 11:11:38 2007 From: leeg at thaesofereode.info (Graham J Lee) Date: Thu Feb 8 11:11:38 2007 Subject: Build and Run problem in xcode... In-Reply-To: References: <385D648C-00B4-47EC-92FB-AF26AD6A80DD@llnl.gov> Message-ID: <173654D8-C40D-4B79-B41B-E7D946A3DA5E@thaesofereode.info> On 8 Feb 2007, at 19:00, Charles Heizer wrote: > Huh, > I did the import of ldap header "#import " in my code and > xcode does the autofill ( code by multiple choice :-) ). Is there a > good/easy way to find out what I'm missing? It's not the inclusion, it's the linking that's causing issue. Navigate to the "external frameworks and libraries" area of the Xcode project, choose the Project->Add to Project... menu item, find the library (perhaps called something like libldap.dylib or libldap.a) and add it. That should solve the problem. Cheers, Graham. From pelorus at mac.com Thu Feb 8 14:51:52 2007 From: pelorus at mac.com (Matt Johnston) Date: Thu Feb 8 14:52:07 2007 Subject: Creating kMDMattsCoolMetadata? Message-ID: <075F4341-87F7-441E-B7C4-4798878524C5@mac.com> Hi Guys, I've been reading around the subject and finding there's not much out there for creating, for example, kMDMattsCoolMetadata and assigning it to a file so, for example, I then should get: blancmange:~/Desktop wibble$ mdls LittleFile.txt LittleFile.txt ------------- kMDItemAttributeChangeDate = 2007-02-08 22:47:14 +0000 kMDItemFSContentChangeDate = 2007-02-08 22:47:31 +0000 kMDItemFSCreationDate = 2007-02-08 22:47:31 +0000 kMDItemFSCreatorCode = 0 kMDItemFSFinderFlags = 0 kMDItemFSInvisible = 0 kMDItemFSIsExtensionHidden = 0 kMDItemFSLabel = 0 kMDItemFSName = "LittleFile.txt" kMDItemFSNodeCount = 0 kMDItemFSOwnerGroupID = 501 kMDItemFSOwnerUserID = 501 kMDItemFSSize = 0 kMDItemFSTypeCode = 0 kMDItemID = 2042666 kMDItemLastUsedDate = 2007-02-08 22:47:31 +0000 kMDItemUsedDates = (2007-02-08 22:47:31 +0000) kMDMattsCoolMetadata = Hello Mum blancmange:~/Desktop wibble$ There's a heap of stuff on CocoaDev - but seems to be a lot of people asking the same question. We can read the stores, but how do we just set a single metadata item? Can anyone either put me out of my misery or point me at a helpful article? Thanks in advance, Matt From boisy at boisypitre.com Thu Feb 8 18:16:18 2007 From: boisy at boisypitre.com (Boisy Pitre) Date: Thu Feb 8 18:16:55 2007 Subject: Core Data Minefield In-Reply-To: References: <31FC5C93-8476-4EB8-BFA5-F7B8DB3A6352@boisypitre.com> <0555C7B3-43F4-46EF-8ABB-71228A911206@mac.com> <548C07B5-AE06-45F5-A62A-69B14AFFEEBC@mac.com> <49298E72-6437-4098-A596-42B206F08964@boisypitre.com> Message-ID: <8DF0A350-077C-456E-81FF-F7495237DA8B@boisypitre.com> On Feb 6, 2007, at 9:29 AM, Scott Stevenson wrote: > > On Feb 6, 2007, at 6:35 AM, Boisy Pitre wrote: > >> I would expect to see a >> NSManagedObjectContextObjectsDidChangeNotification notification on >> load by virtue of the fact that managed objects are being inserted >> into the managed object context > [...] >> There are three keys that can be part of the passed userInfo >> dictionary: inserted, updated and deleted. When loading the data >> from the store, are they not being inserted into the managed >> object context? > > Actually, no. Insert really means "create". If you want an object > to do something when it is loaded, you might look at overriding - > awakeFromFetch in NSManagedObject. Scott, Thanks for responding. I see your point in that case. Slight but important distinction. My original problem remains: class FARM depends on attribute X in class ANIMAL. Can you recommend something that would alert class A when class B is loaded and its awakeFromFetch is called? Boisy From bcarter at mac.com Fri Feb 9 07:34:15 2007 From: bcarter at mac.com (Brad Carter) Date: Fri Feb 9 07:39:26 2007 Subject: NSButton Up/Down Events Message-ID: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> I'm new to the list and very new to Cocoa and programming in general. My only programming experience was Basic about 20 years ago when my father put me in classes. I have just finished one book on Object C and the other, Cocoa Programming for Mac OS X. I have an AppleScript Studio app that I'm rewriting in Cocoa. The app sends a curl command with a URL to a box that does relay closures and that in turn controls the pan/tilt of a video camera. I have the AppleScript set up using mouse down/up events so when the button is pressed and held down the camera pans, when the button is release the panning stops. I can't figure out how to do this in Cocoa. I have subclassed NSButton and overridden mouseDown: and mouseUp and display this to NSLog confirming my success. How do I tell what button was pressed in the mouseDown: method? I can't find anything in NSEvent that would hint that this info would be passed as an NSEvent. Here's my code below. Thanks, Brad - (void)mouseDown:(NSEvent *)event { NSLog(@"down"); [super mouseDown:event]; [self mouseUp:event]; } - (void)mouseUp:(NSEvent *)event { NSLog(@"up"); } -------------------------------------------------------------- The smime.p7s file below is my public encryption key, not a virus. From shawnce at gmail.com Fri Feb 9 08:46:42 2007 From: shawnce at gmail.com (Shawn Erickson) Date: Fri Feb 9 08:46:57 2007 Subject: NSButton Up/Down Events In-Reply-To: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> References: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> Message-ID: On Feb 9, 2007, at 7:34 AM, Brad Carter wrote: > I'm new to the list and very new to Cocoa and programming in > general. My only programming experience was Basic about 20 years > ago when my father put me in classes. I have just finished one > book on Object C and the other, Cocoa Programming for Mac OS X. > > I have an AppleScript Studio app that I'm rewriting in Cocoa. The > app sends a curl command with a URL to a box that does relay > closures and that in turn controls the pan/tilt of a video camera. > I have the AppleScript set up using mouse down/up events so when > the button is pressed and held down the camera pans, when the > button is release the panning stops. > > I can't figure out how to do this in Cocoa. I have subclassed > NSButton and overridden mouseDown: and mouseUp and display this to > NSLog confirming my success. How do I tell what button was pressed > in the mouseDown: method? I can't find anything in NSEvent that > would hint that this info would be passed as an NSEvent. Here's my > code below. Responder objects (views and controls are such things) get their mouseDown: called if the mouse down hit them or hit some responder they contain [1]. So the object that got the mouseDown: message was the one clicked (aka the one clicked is self). Review... It sounds like you need to do something like what is outlined in the following... -Shawn [1] ...or in some way they are in the responder chain. From jtoolan at star.net.uk Fri Feb 9 09:05:00 2007 From: jtoolan at star.net.uk (Jonathan Toolan) Date: Fri Feb 9 09:14:37 2007 Subject: NSButton Up/Down Events In-Reply-To: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> References: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> Message-ID: <811F0D7D3A37DC4D9E06B62EF563AE2F019C2398@SIBRN2EXC003.int.star.net.uk> Brad, I think what you're looking for is "type": From http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/ Classes/NSEvent_Class/Reference/Reference.html#//apple_ref/occ/instm/NSE vent/type NSEventType which = [event type]; Returns the type of the receiving event. - (NSEventType)type The type will be one of the following: NSLeftMouseDown NSLeftMouseUp NSRightMouseDown NSRightMouseUp ... Etc ... But I could be wrong. :) Hope that helped. Jonathan -----Original Message----- From: macosx-dev-bounces@omnigroup.com [mailto:macosx-dev-bounces@omnigroup.com] On Behalf Of Brad Carter Sent: 09 February 2007 15:34 To: macosx-dev@omnigroup.com Subject: NSButton Up/Down Events I'm new to the list and very new to Cocoa and programming in general. My only programming experience was Basic about 20 years ago when my father put me in classes. I have just finished one book on Object C and the other, Cocoa Programming for Mac OS X. I have an AppleScript Studio app that I'm rewriting in Cocoa. The app sends a curl command with a URL to a box that does relay closures and that in turn controls the pan/tilt of a video camera. I have the AppleScript set up using mouse down/up events so when the button is pressed and held down the camera pans, when the button is release the panning stops. I can't figure out how to do this in Cocoa. I have subclassed NSButton and overridden mouseDown: and mouseUp and display this to NSLog confirming my success. How do I tell what button was pressed in the mouseDown: method? I can't find anything in NSEvent that would hint that this info would be passed as an NSEvent. Here's my code below. Thanks, Brad - (void)mouseDown:(NSEvent *)event { NSLog(@"down"); [super mouseDown:event]; [self mouseUp:event]; } - (void)mouseUp:(NSEvent *)event { NSLog(@"up"); } -------------------------------------------------------------- The smime.p7s file below is my public encryption key, not a virus. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ Disclaimer This message and its attachments is intended for the above named only, and may be privileged or confidential. If it has come to you in error you must take no action based on it, nor must you copy or show it to anyone. If you have received this message in error please destroy it and contact the sender, either via our switchboard on +44 (0) 1285 884420 or via return e-mail. All reasonable precautions have been taken to ensure that no viruses are present in this e-mail, however, Star Technology Services Ltd cannot accept responsibility for loss or damage arising from the use of this message or attachments and recommend that you undertake your virus checking procedures prior to use. Star Technology Services Ltd does not enter into any form of contract via this medium, nor is our staff authorised to do so on our behalf. Any opinions expressed in this e-mail are those of the sender, and will not reflect the opinions of Star Technology Services Ltd unless specifically stated. Star Technology Services Ltd, 1240 Lansdowne Court, Gloucester Business Park, Gloucester, Gloucestershire, GL3 4AB, United Kingdom. A company registered in England No: 3077786 http://www.star.net.uk/ ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________ From shawnce at gmail.com Fri Feb 9 09:33:01 2007 From: shawnce at gmail.com (Shawn Erickson) Date: Fri Feb 9 09:33:06 2007 Subject: NSButton Up/Down Events In-Reply-To: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> References: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> Message-ID: On 2/9/07, Brad Carter wrote: > I can't figure out how to do this in Cocoa. I have subclassed > NSButton and overridden mouseDown: and mouseUp and display this to > NSLog confirming my success. How do I tell what button was pressed > in the mouseDown: method? I can't find anything in NSEvent that > would hint that this info would be passed as an NSEvent. Here's my > code below. Oh I may have misread what you asked above... by "button" did you mean mouse button or user interface button? The reference documentation I linked earlier covers both questions but in case of the former... mouseDown:, mouseDragged:, and mouseUp: only happens if the "left" (primary) mouse button is clicked. So you don't need to check event type... getting the message implies that the primary button was clicked. rightMouseDown:, rightMouseDragged:, and rightMouseUp: only happen if the "right" (secondary) mouse button is clicked. All other buttons that the mouse may have come in via otherMouseDown:, otherMouseDragged:, and otherMouseUp: messages and you would check [event buttonNumber] to know which button on the mouse was clicked. Finally note that scroll wheel events come in via scrollWheel:. -Shawn From bcarter at mac.com Fri Feb 9 10:25:32 2007 From: bcarter at mac.com (Brad Carter) Date: Fri Feb 9 10:25:40 2007 Subject: NSButton Up/Down Events In-Reply-To: References: <31649C87-3BD5-401D-8E00-D47613F3F4B2@mac.com> Message-ID: <2C61FDB0-7F98-4042-BC7D-2A98C343E8AC@mac.com> yes, I think I wasn't explaining what I wanted correctly. I need this for the button down, not mouseDown. I think I was stuck on the thought of using mouseDown because that's how I got it to work in AppleScript Studio. So, on button down I call a method and then when the button is released it calls another method. Here's an example of a mouseDown I did using AppleScript and it also has an 'on mouse up' section that basically does the same thing. on mouse down theObject event theEvent if the name of theObject is equal to "panLeft" then do shell script "/usr/bin/curl --connect-timeout 2 http://admin: 12345678@10.160.101.12/SetIO?p61=0 > /dev/null 2>&1 &" On Feb 9, 2007, at 10:33 AM, Shawn Erickson wrote: > > Oh I may have misread what you asked above... by "button" did you mean > mouse button or user interface button? > > The reference documentation I linked earlier covers both questions but > in case of the former... > > mouseDown:, mouseDragged:, and mouseUp: only happens if the "left" > (primary) mouse button is clicked. So you don't need to check event > type... getting the message implies that the primary button was > clicked. > > rightMouseDown:, rightMouseDragged:, and rightMouseUp: only happen if > the "right" (secondary) mouse button is clicked. > > All other buttons that the mouse may have come in via otherMouseDown:, > otherMouseDragged:, and otherMouseUp: messages and you would check > [event buttonNumber] to know which button on the mouse was clicked. > > Finally note that scroll wheel events come in via scrollWheel:. > > -Shawn From bob at apple.com Fri Feb 9 14:53:11 2007 From: bob at apple.com (Bob Frank) Date: Fri Feb 9 14:53:25 2007 Subject: MEETING: Chicago CocoaHeads / CAWUG Tuesday Feb. 13 6:00 pm Message-ID: <17C6B555-55DA-478A-A642-81558FAAC86F@apple.com> Hi all, The Chicago CocoaHeads / Chicago Cocoa and WebObjects User Group (CAWUG) is holding our next meeting t