ABPerson and Note property issue

2009-12-07 Thread Greg Hoover
When setting the value for the note property in an ABPerson record, the new 
value isn't available until relaunching the application.

Scenario:
- read the note value for a contact and I get foo 
- set the value to bar
- save the address book

- read the note value for the contact but get an empty string

I'm printing the description of the record after writing and before reading.  
After writing the new value, the description does show that the value for the 
note attribute has been set correctly.  However, when reading the note property 
the next time the record shows no note at all.

Interestingly I get the correct (new) value if I store the note as RTF rather 
than plain text.  I use RTFDataFromRange and initWithData:encoding: 
(NSASCIIStringEncoding) to convert the contents of an NSTextView to an ASCII 
RTF string.

Can anyone shed some light on this?

Thanks,
Greg___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Dealing with faults in CoreData / AppleScript

2009-11-19 Thread Greg Hoover
I've been working through adding scriptability to my CoreData application but 
ran into a snag: accessing relationships may return a fault instead of the 
actual set of objects.  Is there an accepted way of solving this issue?  I 
don't want the accessor to always fault the objects in, just when they're 
being accessed from AppleScript.  Is creating another accessor the proper way 
to get around this?

Thanks,
Greg

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


All Address Book person unique IDs are the same [solved]

2009-11-12 Thread Greg Hoover
I extended NSManagedObject to provide a uniqueId accessor similar to that of 
ABRecord.  Turns out that this messed with the uniqueId accessor of ABRecord.  
The docs don't say that ABRecord inherits from NSManagedObject but somewhere 
they do I guess (it seems reasonable that they would)...lesson learned.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


All Address Book person unique IDs are the same

2009-11-10 Thread Greg Hoover
I'm using the following code to search for AB Records matching an email 
address.  The search finds matching records but every returned record has the 
same unique ID (which doesn't match the unique ID of any Person records in AB). 
 Any ideas?


ABAddressBook *book = [ABAddressBook sharedAddressBook];
ABSearchElement *element = [ABPerson searchElementForProperty: 
kABEmailProperty

label: nil

  key: nil

value: email

   comparison: kABEqualCaseInsensitive];

NSArray *records = [book recordsMatchingSearchElement: element];


Thanks.___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Greg Hoover
I have the same piece of code making a secure request to a server in a  
Mac application and in an iPhone app.  Both use an NSURLRequest with  
exactly the same settings, message, body, etc.  On the Mac, the  
request succeeds, returning the data expected.  On the iPhone however,  
the request fails with an untrusted server certificate error  
(NSURLErrorDomain -1202).


I suspected that the iPhone implementation somehow doesn't have access  
to the root certificates, so I checked on the servers SSL cert using  
openssl.  Openssl says: unable to verify the first certificate.  So  
now I figure that the Mac (10.6.1) implementation just allows the  
request to proceed when the verification fails (it doesn't return an  
error of any kind actually).  Can anyone shed some light on this?


Thanks,
Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSURLRequest SSL Mac vs iPhone

2009-10-16 Thread Greg Hoover


On Oct 16, 2009, at 1:13 AM, Andrew Farmer wrote:


On 16 Oct 2009, at 00:48, Greg Hoover wrote:
I have the same piece of code making a secure request to a server  
in a Mac application and in an iPhone app.  Both use an  
NSURLRequest with exactly the same settings, message, body, etc.   
On the Mac, the request succeeds, returning the data expected.  On  
the iPhone however, the request fails with an untrusted server  
certificate error (NSURLErrorDomain -1202).


My guess is the root certificates are different on the two  
platforms. Just a guess, but if the server you're connecting to is  
using a cert signed by a weird authority, that might be it.




It's signed by Verisign.  Where does NSURLRequest and its supporting  
routines find the CA root certs?


I suspected that the iPhone implementation somehow doesn't have  
access to the root certificates, so I checked on the servers SSL  
cert using openssl.  Openssl says: unable to verify the first  
certificate.  So now I figure that the Mac (10.6.1) implementation  
just allows the request to proceed when the verification fails (it  
doesn't return an error of any kind actually).  Can anyone shed  
some light on this?


OpenSSL is a red herring. NSURLRequest doesn't use openssl to verify  
certificates. In fact, openssl has no root certs installed at all by  
default on OS X, so it'll fail to verify any certificate at all.



Well when I run OpenSSL on my own server it checks out fine.  I was  
thinking that my CA root certs were just out of date, but when I run  
OpenSSL its more like it can't find several certs that should be part  
of the chain.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: CoreData / SQL hang on save

2009-09-19 Thread Greg Hoover

Hi Anthony,

I actually debugged this issue with an Apple engineer and it turns out  
there's a bug connected to float and double types when you write back  
identical or nearly identical values.  I solved it by extending  
NSManagedObjectContext and calling this bit of code instead of the  
regular save:


- (BOOL)safeSave {
BOOL success = YES;

if ([self hasChanges]) {
for (id object in [self updatedObjects]) {
if (![[object changedValues] count]) {
[self refreshObject: object
   mergeChanges: NO];
}
}

NSError *error = nil;
if (![self save: error]) {
MSReportErrorMessage(error);
success = NO;
}
}

return success;
}

This was on 10.6 btw, and may have been fixed in the latest release (I  
haven't checked).


Greg

On Sep 19, 2009, at 3:00 AM, Anthony Mittaz wrote:


Hi Greg,

Just had this exact same problem for the last week or so, aka  
binding not implemented for SQLType 7 on a core data iPhone 3.0  
project.


Basically what went wrong is that I was trying to save an int64 into  
a double column...


Not sure if you ever fixed your problem but this may help.

(used -com.apple.CoreData.SQLDebug 3 in order to see what was  
happening under the hood)


Regards
Anthony Mittaz



Thanks for you response.

The problem actually just started showing up in 10.6 (wasn't a  
problem in 10.4 or 10.5). :-/


The hang stopped for a few launches and reverted to its previous  
output: binding not implemented for SQLType 7. But then it  
happened again... The SQL file does not have null values for any  
Z_OPT fields.



CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ? WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ? WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ? WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
safe save
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ? WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ? WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ? WHERE Z_PK = ? AND Z_OPT  
= ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ? WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
safe save

Thanks,
Greg

On Aug 25, 2009, at 1:16 PM, Melissa J. Turner wrote:


On Aug 25, 2009, at 02:19, Greg Hoover wrote:

I've run into a hang in CoreData save. I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well). The hang occurs inside the  
NSSQLCore and seems to just loop endlessly. The SQL output supports  
this. Requests performed at launch succeed as expected, but the app  
quickly reaches a point where Optimistic locking failure exceptions  
are thrown with an endless sequence of ROLLBACKs followed by  
UPDATEs. All of the contexts are using the  
MergeByPropertyObjectTrump merge policy.


Any insight would be much appreciated.



There is a known issue on 10.5.* that results in Core Data entering  
an infinite loop during save if the database has been corrupted such  
that the optimistic locking column is set to NULL.


A way to tell would be to run sqlite3 on the database and execute  
the following SQL statement:


select Z_PK, Z_OPT from ZSTOCK where Z_PK IN (1, 4);

I'm guessing you'll get back something that looks like:

1|
4|

Which means that something has stuffed unexpected NULLs into your  
database.


The issue has been fixed in 10.6, but the only real workaround on  
10.5.* is to manually repair the database by setting the value of  
the Z_OPT column to be non-null (1 is always a good option).


Cheers,
+Melissa







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe

Problem building for 10.4 on 10.6

2009-08-26 Thread Greg Hoover
Has anyone seen an error in XCode like this: GCC 4.2 is not compatible  
with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build using  
the 10.5 SDK, but attempting to build with 10.4 doesn't seem to work.


Thanks,
Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Problem building for 10.4 on 10.6

2009-08-26 Thread Greg Hoover

Thanks, I knew it had to be something simple that I was overlooking.

On Aug 26, 2009, at 8:50 PM, Glenn L. Austin wrote:


On Aug 26, 2009, at 8:41 PM, Greg Hoover wrote:

Has anyone seen an error in XCode like this: GCC 4.2 is not  
compatible with the Mac OS X 10.4 SDK (file NSString+extras.m)


I remove the referenced file and another pops up.  I can build  
using the 10.5 SDK, but attempting to build with 10.4 doesn't seem  
to work.



Yes -- the problem is that you're using GCC 4.2.  You need to change  
the C/C++/Obj-C compiler to GCC 4.0.


--
Glenn L. Austin, Computer Wizard and Race Car Driver 
http://www.austin-soft.com





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


CoreData / SQL hang on save

2009-08-25 Thread Greg Hoover
I've run into a hang in CoreData save.  I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well).  The hang occurs inside the  
NSSQLCore and seems to just loop endlessly.  The SQL output supports  
this.  Requests performed at launch succeed as expected, but the app  
quickly reaches a point where Optimistic locking failure exceptions  
are thrown with an endless sequence of ROLLBACKs followed by UPDATEs.   
All of the contexts are using the MergeByPropertyObjectTrump merge  
policy.


Any insight would be much appreciated.


CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0004s
CoreData: annotation: total fetch execution time: 0.0006s for 0 rows.
CoreData: annotation: to-many relationship fault stopTransactions  
for objectID 0x560060 x-coredata://46056D7C-91E4-42C2-9119-AEB4FB4288D2/Stock/p2 
 fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0003s
CoreData: annotation: total fetch execution time: 0.0006s for 0 rows.
CoreData: annotation: to-many relationship fault stopTransactions  
for objectID 0x558f30 x-coredata://46056D7C-91E4-42C2-9119-AEB4FB4288D2/Stock/p3 
 fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0012s
CoreData: annotation: total fetch execution time: 0.0015s for 0 rows.
CoreData: annotation: to-many relationship fault stopTransactions  
for objectID 0x562e80 x-coredata://46056D7C-91E4-42C2-9119-AEB4FB4288D2/Stock/p4 
 fulfilled from database.  Got 0 rows
CoreData: sql: SELECT 0, t0.Z_PK FROM ZTRANSACTION t0 WHERE   
t0.Z4STOPTRANSACTIONS = ?

CoreData: annotation: sql connection fetch time: 0.0073s
CoreData: annotation: total fetch execution time: 0.0096s for 0 rows.
CoreData: annotation: to-many relationship fault stopTransactions  
for objectID 0x562e90 x-coredata://46056D7C-91E4-42C2-9119-AEB4FB4288D2/Stock/p5 
 fulfilled from database.  Got 0 rows

CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: COMMIT
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, ZBID = ?, Z_OPT  
= ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?
CoreData: sql: SELECT Z_PK,Z_OPT FROM ZSTOCK WHERE Z_PK IN (1,2,3,4,5)  
ORDER BY Z_PK

CoreData: annotation: sql execution time: 0.0011s
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZFORWARDPE,  
t0.ZLASTTIME, t0.ZMANUAL, t0.ZEPS, t0.ZANNUALEPS, t0.ZDAYRANGE,  
t0.ZTRANSACTIONERROR, t0.ZOPEN, t0.ZDIV, t0.ZNEWS, t0.ZPERCENT,  
t0.ZANNUALEPSDATE, t0.ZUPDATEREQUIRED, t0.ZMARKETCAP, t0.ZEXCHANGE,  
t0.ZDATE, t0.ZCURRENCY, t0.ZMUTUALFUND, t0.ZLABEL,  
t0.ZOPTIONEXPIRATION, t0.ZYEARRANGE, t0.ZCHARTS, t0.ZCURRENCYSET,  
t0.ZONEYEAR, t0.ZTRANSACTIONCACHE, t0.ZHIGH, t0.ZEXCHANGEID,  
t0.ZAVGVOL, t0.ZLABELCOLOR, t0.ZNEWSERRORS, t0.ZNAME, t0.ZCLOSE,  
t0.ZCUSTOMNAME, t0.ZDIVIDENDYIELD, t0.ZDIVDATE, t0.ZLASTDATE,  
t0.ZEXCHANGERATE, t0.ZENABLED, t0.ZASK, t0.ZQUARTERLYEPS, t0.ZBID,  
t0.ZISOPTION, t0.ZALARMSTATUS, t0.ZLOW, t0.ZQUOTEERRORS, t0.ZLAST,  
t0.ZSTRIKE, t0.ZALARMS, t0.ZVOLUME, t0.ZQUARTERLYEPSDATE, t0.ZCHART,  
t0.ZSERVICES, t0.ZCHANGE, t0.ZUNREADNEWS, t0.ZNOTES, t0.ZPE,  
t0.ZCLOSED, t0.ZPEG, t0.ZEXDIVDATE, t0.ZOPTIONTYPE, t0.ZCHARTERRORS  
FROM ZSTOCK t0 WHERE  t0.Z_PK = ?

CoreData: annotation: sql connection fetch time: 0.0008s
CoreData: annotation: total fetch execution time: 0.0013s for 1 rows.
CoreData: annotation: Optimistic locking failure for 0x51fc30 x-coredata://46056D7C-91E4-42C2-9119-AEB4FB4288D2/Stock/p1 
.  Row was updated.
CoreData: sql: SELECT 0, t0.Z_PK, t0.Z_OPT, t0.ZFORWARDPE,  
t0.ZLASTTIME, t0.ZMANUAL, t0.ZEPS, t0.ZANNUALEPS, t0.ZDAYRANGE,  
t0.ZTRANSACTIONERROR, t0.ZOPEN, t0.ZDIV, t0.ZNEWS, t0.ZPERCENT,  
t0.ZANNUALEPSDATE, t0.ZUPDATEREQUIRED, t0.ZMARKETCAP, t0.ZEXCHANGE,  
t0.ZDATE, t0.ZCURRENCY, t0.ZMUTUALFUND, t0.ZLABEL,  
t0.ZOPTIONEXPIRATION, t0.ZYEARRANGE, t0.ZCHARTS, t0.ZCURRENCYSET,  
t0.ZONEYEAR, t0.ZTRANSACTIONCACHE, t0.ZHIGH, t0.ZEXCHANGEID,  
t0.ZAVGVOL, t0.ZLABELCOLOR, t0.ZNEWSERRORS, t0.ZNAME, t0.ZCLOSE,  
t0.ZCUSTOMNAME, t0.ZDIVIDENDYIELD, t0.ZDIVDATE, t0.ZLASTDATE,  
t0.ZEXCHANGERATE, t0.ZENABLED, t0.ZASK, t0.ZQUARTERLYEPS, t0.ZBID,  
t0.ZISOPTION, t0.ZALARMSTATUS, t0.ZLOW, t0.ZQUOTEERRORS, t0.ZLAST,  
t0.ZSTRIKE, t0.ZALARMS, t0.ZVOLUME, t0.ZQUARTERLYEPSDATE, t0.ZCHART,  
t0.ZSERVICES, t0.ZCHANGE, t0.ZUNREADNEWS, t0.ZNOTES, t0.ZPE,  
t0.ZCLOSED, t0.ZPEG, t0.ZEXDIVDATE, t0.ZOPTIONTYPE, t0.ZCHARTERRORS  
FROM ZSTOCK t0 WHERE  t0.Z_PK = ?

CoreData: 

Re: CoreData / SQL hang on save

2009-08-25 Thread Greg Hoover

Hi Melissa,

Thanks for you response.

The problem actually just started showing up in 10.6 (wasn't a problem  
in 10.4 or 10.5). :-/


The hang stopped for a few launches and reverted to its previous  
output: binding not implemented for SQLType 7.  But then it happened  
again...  The SQL file does not have null values for any Z_OPT fields.



CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?

CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
safe save
CoreData: sql: BEGIN EXCLUSIVE
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZOPEN = ?, Z_OPT = ?  WHERE Z_PK = ?  
AND Z_OPT = ?

CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET Z_OPT = ?  WHERE Z_PK = ? AND Z_OPT = ?
CoreData: sql: UPDATE ZSTOCK SET ZEPS = ?, ZASK = ?, Z_OPT = ?  WHERE  
Z_PK = ? AND Z_OPT = ?

CoreData: sql: ROLLBACK
binding not implemented for this SQLType 7
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
CoreData: annotation: total fetch execution time: 0.s for 0 rows.
safe save

Thanks,
Greg

On Aug 25, 2009, at 1:16 PM, Melissa J. Turner wrote:



On Aug 25, 2009, at 02:19, Greg Hoover wrote:

I've run into a hang in CoreData save.  I'm the single coordinator,  
multiple object contexts threading model and a SQL store (though it  
seems to happen with XML as well).  The hang occurs inside the  
NSSQLCore and seems to just loop endlessly.  The SQL output  
supports this.  Requests performed at launch succeed as expected,  
but the app quickly reaches a point where Optimistic locking  
failure exceptions are thrown with an endless sequence of ROLLBACKs  
followed by UPDATEs.  All of the contexts are using the  
MergeByPropertyObjectTrump merge policy.


Any insight would be much appreciated.




There is a known issue on 10.5.* that results in Core Data entering  
an infinite loop during save if the database has been corrupted such  
that the optimistic locking column is set to NULL.


A way to tell would be to run sqlite3 on the database and execute  
the following SQL statement:


select Z_PK, Z_OPT from ZSTOCK where Z_PK IN (1, 4);

I'm guessing you'll get back something that looks like:

1|
4|

Which means that something has stuffed unexpected NULLs into your  
database.


The issue has been fixed in 10.6, but the only real workaround on  
10.5.* is to manually repair the database by setting the value of  
the Z_OPT column to be non-null (1 is always a good option).


Cheers,
+Melissa





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSURLConnection sendSynchronousRequest: crashes since upgrading to 10.5.7

2009-05-14 Thread Greg Hoover
After upgrading to 10.5.7 I've been having intermittent trouble with  
deallocated objects in NSURLConnections.  All of my URL requests are  
made using sendSynchronousRequest.  Everything is fine for about 10-15  
minutes, then I get this crash.  I am making requests on multiple  
threads, obviously only one at a time per thread though since they're  
synchronous.


 *** -[CFArray count]: message sent to deallocated instance 0x27eb6950
*** NSInvocation: warning: object 0x27eb6950 of class  
'_NSZombie_CFArray' does not implement methodSignatureForSelector: --  
trouble ahead


#0  0x90718640 in ___forwarding___
#1  0x90718972 in __forwarding_prep_0___
#2  0x90627da1 in CFArrayGetCount
#3  0x906ab581 in _CFStreamSignalEventSynch
#4  0x90699595 in CFRunLoopRunSpecific
#5  0x90699c78 in CFRunLoopRunInMode
#6	0x9468f530 in +[NSURLConnection(NSURLConnectionReallyInternal)  
_resourceLoadLoop:]

#7  0x9462be0d in -[NSThread main]
#8  0x9462b9b4 in __NSThread__main__
#9  0x94365155 in _pthread_start
#10 0x94365012 in thread_start

Any insight would be great,
Greg



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Forcing controller to update binding of compound value

2009-04-22 Thread Greg Hoover
I'm using bindings to display values in a table.  I use an array  
controller bound to the attribute of a model object.  The controller  
handles content as compound value because of the way I access and  
update the content from a larger set.  Everything is great in that  
values are retrieved and updated in the model as expected.  The  
problem is that there are dependencies between some of the values.   
When a key is updated in the model, its dependent keys are updated in  
the model as well, but the controller doesn't see these changes.  Is  
there a way to force the controller to re-fetch the bound content array?


Thanks,
Greg

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: HTTP response using CFHTTPMessageCreateEmpty/CFHTTPMessageAppendBytes

2009-03-14 Thread Greg Hoover
Wow.  Don't you hate it when its staring you in the face and you still  
can't see it.


Thanks.

On Mar 14, 2009, at 5:31 PM, Michael Ash wrote:

On Sat, Mar 14, 2009 at 5:17 PM, Greg Hoover ghoo...@greg-web.net  
wrote:
I'm trying to parse an HTTP Post response using the following  
code.  The
problem is that CFHTTPMessageAppendBytes always returns false.   
I've tested
by stripping down the response to just HTTP/1.0 200 OK\r\n\r\n  
and still

no go.  Does anyone know what the appropriate response format is?

CFHTTPMessageRef response =  
CFHTTPMessageCreateEmpty(kCFAllocatorDefault,

TRUE);


From the documentation for CFHTTPMessageCreateEmpty:

Pass TRUE to create an empty request message; pass FALSE to create an
empty response message.

You're passing TRUE, indicating a request, but then you're feeding it
a response. What happens if you pass FALSE?

Mike


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSDateFormatter strangeness

2008-11-18 Thread Greg Hoover

Ok, I buy that, but then what's the problem here:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @dd/MM/];
NSString *str = @3/10/2008; 
	NSLog(@[EMAIL PROTECTED]@\r%@, str, [formatter dateFromString: str], [formatter  
stringFromDate: [formatter dateFromString: str]]);

[formatter release];

This code uses the formatter both directions but prints out the  
following:


3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to  
date.  Is there an issue with creating static NSDateFormatters?  Its  
curious because some of the date formatters in my app work as  
expected, others do not.


Greg

On Nov 18, 2008, at 12:06 AM, Nathan Kinsinger wrote:


On Nov 17, 2008, at 6:23 PM, Greg Hoover wrote:


I am using NSDateFormatter.  The code snippet included shows this.

Greg
On Nov 17, 2008, at 3:38 PM, Kyle Sluder wrote:


I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa).

So, don't log NSDate objects, send them through an NSDateFormatter  
instead.


--Kyle Sluder


The method -[NSDateFormatter dateFromString:] returns an NSDate,  
which is what NSLog sees, which results in the problem that Kyle  
refers to.


First you need to create an NSDate that NSDateFormatter can then  
format into a string, like so:


NSLog(@%@ - %@, dateString, [dateFormatter stringFromDate:[NSDate  
dateWithNaturalLanguageString:dateString]]);



Hope that helps,
--Nathan







___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-18 Thread Greg Hoover

Wow!  That totally fixed it. Thank you.  Wow do I feel dumb!

Greg

On Nov 18, 2008, at 9:28 AM, Simon Wolf wrote:


On 18 Nov 2008, at 17:06, Greg Hoover wrote:


Ok, I buy that, but then what's the problem here:

NSDateFormatter *formatter = [[NSDateFormatter alloc] init];
[formatter setDateFormat: @dd/MM/];
NSString *str = @3/10/2008; 
	NSLog(@[EMAIL PROTECTED]@\r%@, str, [formatter dateFromString: str],  
[formatter stringFromDate: [formatter dateFromString: str]]);

[formatter release];

This code uses the formatter both directions but prints out the  
following:


3/10/2008
2007-12-23 00:00:00 -0800
23/12/2007

So it's clear that there is a problem converting from the string to  
date.  Is there an issue with creating static NSDateFormatters?   
Its curious because some of the date formatters in my app work as  
expected, others do not.


Set your date format string to dd/MM/

[formatter setDateFormat: @dd/MM/];

Simon Wolf

Cocoa Blog: http://www.ottersoftware.com/developer//developer/
Twitter: http://www.twitter.com/sgaw


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSDateFormatter strangeness

2008-11-17 Thread Greg Hoover
I've worked with formatters for a while now, but this morning  
something odd happened.  The following code translates the date string  
17 Nov 2008 to 2007-12-23 00:00:00 -0800.


NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat: @dd MMM ];

NSString *dateString = @17 Nov 2008;
	NSLog(@%@ - %@, dateString, [dateFormatter dateFromString:  
dateString]);

[dateFormatter release];

I'm at a loss for what's happening.  When I run stringFromDate on with  
[NSDate date] I get 17 Nov 2008.


Thanks,
Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: NSDateFormatter strangeness

2008-11-17 Thread Greg Hoover

I am using NSDateFormatter.  The code snippet included shows this.

Greg
On Nov 17, 2008, at 3:38 PM, Kyle Sluder wrote:


I think it's a known issue.  The documentation for -[NSDate
descriptionWithCalendarFormat:timeZone:locale:] (which I can only
assume that -[NSDate description] calls) has this caveat:

There are several problems with the implementation of this method
that cannot be fixed for compatibility reasons. To format a date
correctly, you should consider using a date formatter object instead
(see NSDateFormatter and Data Formatting Programming Guide for
Cocoa).

So, don't log NSDate objects, send them through an NSDateFormatter  
instead.


--Kyle Sluder


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Re: Drawing on Another App's CGDisplayCapture

2008-09-16 Thread Greg Hoover
I'm building a very similar function to the one described by Ben, but  
using PowerPoint -- I have an overlay window that is supposed to show  
auxiliary info during a PowerPoint presentation.  I've verified that  
the drawing routines are running on my overlay window, but the updates  
are never shown on the screen (I assume because PowerPoint captures  
the display).  From other postings it seems to be that there is no way  
to promote the redrawn state of the overlay window to the screen until  
the app releases the display, yes?  Are there any known workarounds  
for this?


Thanks,
Greg

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSArrayController vs NSImage sort indicator image

2008-04-22 Thread Greg Hoover
Has anyone noticed that the image NSArrayController puts in the header  
of a table column looks different than the one retrieved by [NSImage  
imageNamed: @NSAscendingSortIndicator] -- the NSArrayController  
image looks sharper and aligns vertically centered to the header.


Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


NSUserDefaults, threads, and binding

2008-04-16 Thread Greg Hoover
I've encountered a situation where NSUserDefaults is definitely not  
thread safe.  Consider an user defaults value bound to an interface  
object.  A background thread modifies this value, first acquiring the  
lock to write to the user defaults, writes the new value, and finally  
triggers a KVO notification, in turn triggering a call to the main  
thread to draw the updated value in the interface. Meanwhile the main  
thread wants to access a value in the user defaults too, but blocks on  
the lock because the background thread acquired it.  The application  
is now deadlocked with both threads waiting on the other.


This is my understanding of what's happening in my app based on the  
following stack traces.  An existing post mentions putting all access  
to NSUserDefaults in a @synchronized block.  Before doing this, can  
anyone verify that that works?


Main Thread:
		61 -[NSWindow makeKeyAndOrderFront:] + 189 (in AppKit)  
[0x95308afa]
  61 -[NSWindow  
orderWindow:relativeTo:] + 105 (in AppKit) [0x953410d8]
61 -[NSWindow  
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] +  
1354 (in AppKit) [0x95341681]
  61 - 
[NSWindow displayIfNeeded] + 189 (in AppKit) [0x95285ab9]
61 - 
[NSView displayIfNeeded] + 933 (in AppKit) [0x95285f09]
  61 - 
[NSView  
_displayRectIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:] +  
3090 (in AppKit) [0x9534552d]
61 - 
[NSThemeFrame  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 306 (in AppKit) [0x953489f7]
  61 - 
[NSView  
_recursiveDisplayRectIfNeededIgnoringOpacity:isVisibleRect:rectIsVisibleRectForView:topView 
:] + 759 (in AppKit) [0x953490b4]
 
61 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1902  
(in AppKit) [0x9534aaa5]


...
  61 
 -[NSView _recursiveDisplayAllDirtyWithLockFocus:visRect:] + 1050 (in  
AppKit) [0x9534a751]
61 
 -[NSTextView _drawRect:clip:] + 2579 (in AppKit) [0x953b07a6]
  61 
 -[NSTextView drawRect:] + 250 (in AppKit) [0x953b09fd]
61 
 -[NSUserDefaults(NSUserDefaults) objectForKey:] + 36 (in Foundation)  
[0x91907524]
  61 
 _semaphore_wait_signal_trap + 10 (in libSystem.B.dylib) [0x91403a2e]


Background Thread:
  61 -[NSUserDefaults(NSUserDefaults)  
setObject:forKey:] + 113 (in Foundation) [0x91964821]
61 __CFXPreferencesSetValue + 102 (in  
CoreFoundation) [0x90966c46]
  61 - 
[CFXPreferencesPropertyListSource setValue:forKey:] + 86 (in  
CoreFoundation) [0x90965f86]
61 - 
[NSObject(NSKeyValueObserverNotification) didChangeValueForKey:] + 546  
(in Foundation) [0x91907f22]
  61 _NSKVONotify + 62 (in  
Foundation) [0x9198b58e]
61 -[NSController  
observeValueForKeyPath:ofObject:change:context:] + 949 (in AppKit)  
[0x95488920]
  61 -[NSController  
_notifyObserversForKeyPath:change:] + 248 (in AppKit) [0x9526b15e]
61 - 
[NSObject(NSKeyValueObservingPrivate)  
_notifyObserversForKeyPath:change:] + 373 (in Foundation) [0x9191be45]
  61 _NSKVONotify + 62  
(in Foundation) [0x9198b58e]
61 -[NSEditableBinder  
_observeValueForKeyPath:ofObject:context:] + 124 (in AppKit)  
[0x9544ab24]
  61 -[NSView  
_setHidden:] + 50 (in AppKit) [0x9527290d]
61 - 
[NSView(NSInternal) _setHidden:setNeedsDisplay:] + 1318 (in AppKit)  
[0x95272e3c]
  61 -[NSView  
_invalidateGStatesForTree] + 49 (in AppKit) [0x9526648a]
61 -[NSView  

Re: Transparent view click-through -- SOLVED

2008-04-12 Thread Greg Hoover
I hadn't implemented the isOpaque method on my custom views.  This did  
the trick, at least for my situation.


Thanks.

On Apr 12, 2008, at 1:19 AM, Ron Fleckner wrote:



On 12/04/2008, at 9:54 AM, Greg Hoover wrote:

Is there a way to prevent click through on a transparent view?

Greg


Not really the answer you're looking for, but a workaround is to set  
the colour of the view to be white, then set the transparency to  
5%.  Anything less than 5% allows click-through.  This works on my  
Tiger system.


Ron


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Transparent view click-through

2008-04-11 Thread Greg Hoover

Is there a way to prevent click through on a transparent view?

Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]