Re: Should I learn CoreData for this project?

2009-11-10 Thread Ruotger Skupin

On 04.11.2009, at 12:15, Kai Brüning wrote:

>> 2. multithreaded core data is very hard to get right (multiple contexts, 
>> data merges)
> 
> Isn’t this true for multi threaded code in general?
> Seriously, the documentation explains how to structure multi threaded use of 
> Core Data. This might even save you some pitfalls compared with a "naive" 
> approach to multi-threading a model.

True, but as I found out the hard way, using Core Data multithreaded and 
Bindings at the same time is a very bad idea and will lead you into a world of 
pain. 
Or as the documentation cautiously puts it:

"For the most part, the Application Kit is not thread safe; in particular, 
Cocoa bindings and controllers are not thread safe—if you are using these 
technologies, multi-threading may be complex."

Ruotger

___

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: Should I learn CoreData for this project?

2009-11-04 Thread Ruotger Skupin

more disadvantages to mention:

1. schema updates with every model change if you use an sql store (you  
have to make a mapping for every single from version/ to version  
combination you need to support)
2. multithreaded core data is very hard to get right (multiple  
contexts, data merges)
3. performance tuning of core data often means making your schema more  
complex (see also point 1)
4. debugging core data can be hard (most bugs only get to the surface  
when you try to save your data).
5. core data throws exceptions all over the place so you may end up  
with a try-catch block with every data access in your code


If your data set fits in memory and you don't mind loading it all at  
once, stay away from core data.


my two cents
Ruotger

On 04.11.2009, at 08:54, Kai Brüning wrote:


Hi David,

this question is most definitely on topic :-)

So, lets see, what would Core Data give you:

- Scalability, fast incremental loads and saves for big data sets.
I don’t think you’ll need this. Loading and saving 500 items each  
time will be fast enough.


- A data model modeler.
That’s actually more valuable then it may seem on first glance. I  
often look at my Core Data models when thinking about algorithms and  
want to recap how the object graph looks.


- Automatic and semi-automatic version migration.
Depends on the lifecycle of your application. When needed, it’ll  
save you tons of time.


- Object graph consistency management.
A big one. Core Data automatically updates inverse relationships as  
needed. A lot of work to do manually, and always a source of subtle  
bugs.


- Automatic undo support.
Big

- Disadvantage: Core Data does not support ordered relationships.  
That is, it uses sets instead of arrays. If you need an order, you  
have to manage this yourself. Not hard, but sometimes an annoyance  
(the reason for this "shortcoming" are hard technical problems).


That’s it out of my head. I’m sure I forgot something.

The learning effort? Hard to say. Core Data is well documented and  
works (almost always) as advertised. So it depends on how well you  
learn new abstractions.


One unrelated advice: by all means use garbage collection. It makes  
object graph management (and a lot of other things) so much easier,  
no matter whether you use Core Data or not.


Good luck!
Kai

On 4.11.2009, at 05:22, David Hirsch wrote:

So, I'm hearing folks sing the praises of CoreData, which I have  
not yet learned.  It seems like a long uphill climb, but if life  
will be spectacular afterwards, I'll do it.  I am a semi-casual  
programmer; I've just finished a couple of small programs that do  
not use CoreData, and I can see the advantage in gaining open/save  
and undo/redo for free, but I'm concerned about the work I'll have  
to put in to learn it.  I've read a bunch of the CoreData intro  
documentation, but it doesn't give a feel for how difficult it will  
be to learn, nor how big the advantages are if I do.


Here's the next project I'm going to work on, for which I'm  
considering CoreData:


A simulated annealing code for class scheduling.  The CoreData part  
would lie in managing all the lists involved: classes, rooms,  
instructors, preferences, conflict cost weights, etc.  I estimate  
that I will have about 500 items spread over about 10 arrays.  I  
would not expect to have a complex object graph (if that's the  
right term) - just a lot of items in lists, items that need to be  
managed, displayed, saved, loaded, etc.  I could use NSArrays for  
all these, which I currently understand.


Does this sound like it's worth learning CoreData for?

Thanks,
Dave

S.A.: I hope this is on topic; I think it is.

Those recent projects I mentioned:
http://almandine.geol.wwu.edu/~dave/research/code/ModeMaker/
http://almandine.geol.wwu.edu/~dave/research/code/ModeQuiz/



Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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/lists%40kai-bruening.de

This email sent to li...@kai-bruening.de


___

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/lists%40chipmunk-app.com

This email sent to li...@chipmunk-app.com



Re: "Could not merge data"-error on save in a single moc app

2009-11-02 Thread Ruotger Skupin

On 29.10.2009, at 20:05, Ben Trumbull wrote:


I get a "Could not merge changes"-error on save in a single moc app
(*). The docs state this is a problem of a multi-moc setup:

http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html



Yes, the MOC you are saving refers to data that has changed out from  
underneath it in either the PSC or the database file itself.  This  
is an optimistic concurrency control failure.



The error does not appear on every system and seems to be related to
when save is called. (race condition?) So far I only have users
complaining that run Mac OS 10.6. I can rarely reproduce the error
myself.

Any pointers where to look?


Well, you can break on -[NSManagedObjectContext init], and -save: to  
see if you really only have 1 MOC.  Other than that, breaking on + 
[NSError errorWithDomain:code:userInfo:] and doing "thread apply all  
bt" in gdb is usually helpful.




I use garbage collection.

regards
Ruotger

(*) the context is handed out by a singleton method. I NSAssert()  
this

method is only called by the main thread.


Well, it's still possible for code to leak it to another thread if,  
you say, pass NSManagedObjects around, and then ask them for their  
MOC.


- Ben


Hi,

I've checked all accesses to the moc and by using mogenerator I  
generated files that assert that every single access of a managed  
object is on the main thread. I still get the "Could not merge data"- 
error or sometimes this one:


Printing description of error:
Error Domain=NSCocoaErrorDomain Code=1550 UserInfo=0x5d45490 "balances  
is not valid."


balances is a one-way to multiple relation.

Any more ideas?

regards
Ruotger


___

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


"Could not merge data"-error on save in a single moc app

2009-10-29 Thread Ruotger Skupin

Hi,

I get a "Could not merge changes"-error on save in a single moc app 
(*). The docs state this is a problem of a multi-moc setup:


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreData/Articles/cdTroubleshooting.html

The error does not appear on every system and seems to be related to  
when save is called. (race condition?) So far I only have users  
complaining that run Mac OS 10.6. I can rarely reproduce the error  
myself.


Any pointers where to look?

I use garbage collection.

regards
Ruotger

(*) the context is handed out by a singleton method. I NSAssert() this  
method is only called by the main thread.  
 I have seen horses puke in  
front of a pharmacy 

___

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: Core Data dog-slow when using first time after boot

2009-09-03 Thread Ruotger Skupin


Am 26.08.2009 um 01:21 schrieb Ben Trumbull:


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent  
to instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use  
future-break objc_exception_throw





Thanks.  What is the actual set of keypaths you set in the fetch  
request ?  setRelationshipKeyPathsForPrefetching expects all the  
keypaths to terminate in a relationship object, not the attribute  
off that related object.

Yes, that was the problem.





|-|
| Transaction |
|-| ||
|net  | --> | Amount | <<-- (one other entity)
|gross| --> ||
|fee  | --> |value   | <<-
|account  | <<- |currency||
|...  |||||
|-||  |
   |  |
 --   |
| |
|||   |
|| Account|   |
|||   |
||balances| --
 --> |transactions|
 |... |
 ||

So basically I use Amount only as a container for a currency  
descriptor and a value. I would have to model 7 inverse  
relationships on that entity to make all relationships two-way.


Hmm.  I'd recommend consider whether or not it makes sense to de- 
normalize Amount into Transaction instead of making it a separate  
entity.  I assume the net/gross/fee are all going to be in the same  
currency, yes ?  Amount is very fine grained, and not (apparently)  
offering very much value for the abstraction cost.

Will do that. At least for the amounts in Transaction.



Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if  
you've run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original  
post, but since I use Smart Folders predicates can look a lot  
different (i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)





You'll want to prefetch additionalInfo and account.


Hm. Problem here is: As mentioned I use the predicate for a smart  
group. So the predicate can vary wildly and can reference basically  
any entity in the model. So what is the best strategy here?  
"Decompile" the predicate (which is built by an NSPredicateEditor) and  
prefetch the keypaths it takes? Prefetch "everything"?


Kind Regards
Ruotger

___

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: Core Data dog-slow when using first time after boot

2009-08-25 Thread Ruotger Skupin


Am 24.08.2009 um 23:13 schrieb Ben Trumbull:


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent  
to instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use  
future-break objc_exception_throw


#0  0x97503f26 in objc_exception_throw ()
#1  0x944279db in -[NSObject(NSObject) doesNotRecognizeSelector:] ()
#2  0x94383026 in ___forwarding___ ()
#3  0x94382bf2 in __forwarding_prep_0___ ()
#4  0x97b3acae in -[NSSQLCore  
_prefetchRelationshipKey:sourceEntityDescription:sourceObjectIDs:prefetchRelationshipKeys:inContext 
:] ()
#5  0x97b3ab87 in -[NSSQLCore  
_prefetchWithFetchRequest:withObjectIDs:inContext:] ()
#6  0x97b3d159 in -[NSSQLCore  
_prefetchRelationshipKey:sourceEntityDescription:sourceObjectIDs:prefetchRelationshipKeys:inContext 
:] ()
#7  0x97b3ab87 in -[NSSQLCore  
_prefetchWithFetchRequest:withObjectIDs:inContext:] ()

#8  0x97b2c106 in newFetchedRowsForFetchPlan_MT ()
#9  0x97b164e7 in -[NSSQLCore newRowsForFetchPlan:] ()
#10 0x97b15d75 in -[NSSQLCore objectsForFetchRequest:inContext:] ()
#11 0x97b15991 in -[NSSQLCore executeRequest:withContext:] ()
#12 0x97b14ae1 in -[NSPersistentStoreCoordinator(_NSInternalMethods)  
executeRequest:withContext:] ()
#13 0x97b11fff in -[NSManagedObjectContext executeFetchRequest:error:]  
()
#14 0x00010b6e in +[GPPayPalTransaction  
transactionsWithPredicate:sortDescriptors:returnObjectsAsFaults:relationshipKeyPathsForPrefetching:inManagedObjectContext:error 
:] (self=0x10ebd4, _cmd=0x6a180, inPredicate=0x0,  
inSortDescriptors=0x10adb80, inAsFaults=0 '\000',  
inPrefetchKeyPaths=0x10ff990, inContext=0x10ad7e0,  
outError=0xbfffe73c) at /Users/roddi/Development/GaragePay/ 
GPPayPalTransaction.m:100


(this is 10A432)




For the record: I do use one-way relationships



That should be okay as long as you're not pretending to use a no  
inverse to-many relationship as a de facto many to many  
relationship.  No inverse relationships can only behave as if the  
inverse were to-one.  Specifically, each row in the destination  
entity may only be associated with a single row in the source entity  
if the relationship on the source entity does not have an inverse.   
(e.g. you only get join tables in fully modeled bi-directional  
relationships)
Do I understand that correctly? No two (or more) Accounts or  
Transactions should "point" to the same Amount (see simplified  
schema). Unless there's a bug somewhere that's not the case.


|-|
| Transaction |
|-| ||
|net  | --> | Amount | <<-- (one other entity)
|gross| --> ||
|fee  | --> |value   | <<-
|account  | <<- |currency||
|...  |||||
|-||  |
   |  |
 --   |
| |
|||   |
|| Account|   |
|||   |
||balances| --
 --> |transactions|
 |... |
 ||

So basically I use Amount only as a container for a currency  
descriptor and a value. I would have to model 7 inverse relationships  
on that entity to make all relationships two-way.





Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if you've  
run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original post,  
but since I use Smart Folders predicates can look a lot different  
(i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)


AdditionalInfo has a one-to-one two-way relationship with Transaction  
(not depicted above).


Hope that helps
Ruotger

___

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: Core Data dog-slow when using first time after boot

2009-08-24 Thread Ruotger Skupin


Am 20.08.2009 um 22:28 schrieb Ben Trumbull:


setRelationshipKeyPathsForPrefetching


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent to  
instance 0x10ee150


For the record: I do use one-way relationships

Ruotger

___

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: Core Data dog-slow when using first time after boot

2009-08-20 Thread Ruotger Skupin


Am 20.08.2009 um 11:34 schrieb Ruotger Skupin:



Am 19.08.2009 um 22:00 schrieb Ben Trumbull:

I debugged it with some Snow Leopard magic and found out, that  
firing

faults is very slow the first time after boot. When I use -[NSArray
filteredArrayUsingPredicate:] the fault firing is killing me.


What's the predicate you are using ?
I'm not using a predicate for the first fetch. (Ok, I have learned  
now, I should do so.)




You're almost certainly filtering in memory after fetching only a  
subset of the data needed to perform your in memory filtering  
(specifically, only the source entity and not its relationships).
Yes I do some on-the-fly filtering which depends on other objects.  
(Ok, lesson learned: Bad idea)


Since you didn't fetch the related objects, Core Data goes and  
retrieves them on demand.  However, mind reading is technically  
challenging, and Plan B, retrieving the related objects one at a  
time, is a rather inefficient I/O pattern. It would be vastly  
faster to filter the data in the database using a predicate on the  
fetch request.
So, would it be better to perform the on-the-fly filtering  
calculation every time the object changes and put flags in the root  
object? Then fetch with a predicate testing these flags? Probably.  
(model change! yay!)


If that's not possible, then you should use a fetch request  
predicate that approximates what you need, and filter those results  
more precisely in memory.
That's what I'm doing now because the most common use case is: I  
need almost everything. So the approximation is: I fetch everything  
and filter out some objects.


Like a bounding rect in views.  If you have already fetched the  
objects, but want to identity different subsets, you can use  
objectID fetch results to simply identify the matching objects  
without pulling back all the row data.

The subsets depend on the data of the objects. (Smart Folders)

Complex locale aware Unicode text queries can be slow.  If you find  
yourself spending time with such a query, you should consider some  
of the techniques shown in the DerivedProperty example available on  
ADC.
Isn't all text Unicode? I don't understand. This shouldn't be a  
special case. But I will have a look at the sample.


In my case I'd guess that at least half of the objects contain  
unicode strings (international names and addresses). What I want to  
say: write anything in German or French and you end up with Unicode.


Typically, apps that launch slowly once, and then run quickly  
afterwards are doing far too much I/O.  On successive launches, the  
kernel has cached most of the data, so instead of doing to-disk I// 
O the app is doing to-kernel-memory I/O.


As stated before I need almost all data anyway. Is there a way to  
bulk-load the whole database into mem in one go? That's not what sql  
is about, is it?


The most common problem in Core Data apps is when people allow  
faulting to lazily fetch data one row at a time, even when the app  
needs all the data immediately.  They should prefetch the related  
objects with the original fetch request by setting the prefetching  
keypaths.

Ok, will try to do that.

Another question: I'm using Garbage Collection. Should I look out  
for something special there? Keep managed objects on purpose?  
Letting them go as soon as possible?


Thanks for the insight
Ruotger



___

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: Core Data dog-slow when using first time after boot

2009-08-20 Thread Ruotger Skupin


Am 20.08.2009 um 04:38 schrieb M Pulis:


I got that, Bill, thank you.

The OP did not specify what particular sql store (we still do NOT  
know) nor if he is compiled Universal, has any helper programs, etc,  
he did however, describe symptoms I have seen with Rosetta. So I  
simply proposed checking that no PPC code was being engaged. Simple  
to do.




For the record: I compiled Universal (debug version: Intel-only) 32bit- 
only. No helper programs. So it's pretty save to say, I'm not using  
Rosetta.


Ruotger

___

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: Core Data dog-slow when using first time after boot

2009-08-19 Thread Ruotger Skupin


Am 19.08.2009 um 19:18 schrieb I. Savant:



 Hmm ... time to hit the books if you haven't already:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdPerformance.html#/ 
/apple_ref/doc/uid/TP40003468


 Have you tried anything suggested there?



Fetch Limits: Not tried
The App basically loads objects and displays them in a table, so I  
can't fetch only half of them as sorting depends on the contents of  
the objects. I do fetches with sort descriptors though, to keep  
sorting time down (always below 0.1 sec).


Batch faulting: tried
It helps but it is still too slow.

Pre-fetching: not tried
But if I understand the document right it's just a special case of  
Batch Faulting and I don't see any faults fired since I use Batch  
Faulting anyway


Reducing Memory Overhead: most don't apply (Garbage Collection / no  
temporary managed objects)

I set the undo manager to nil

Large Data Objects (BLOBs): not used
I'd say all object are under 1k

Would switching to a different store type (other than SQL) help? The  
database is not that large (in my example 55MB) maybe an atomic store  
has its advantages there?


Ruotger

___

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: Core Data dog-slow when using first time after boot

2009-08-19 Thread Ruotger Skupin


Am 19.08.2009 um 18:38 schrieb Nick Zitzmann:



On Aug 19, 2009, at 4:13 AM, Ruotger Skupin wrote:

when fetching about 5000 objects from an sql store, Core Data is  
very slow the very first time after a boot. When running the app  
the first time it takes 50 to 90 seconds and when starting it the  
second time it is well below one second.


What is going on here? Has anyone noticed this too?



Did you try using Shark to find out why this is happening?

According to shark basically nothing plus some time spend in faults.  
Shark is useless when perf-debugging Core Data.


I debugged it with some Snow Leopard magic and found out, that firing  
faults is very slow the first time after boot. When I use -[NSArray  
filteredArrayUsingPredicate:] the fault firing is killing me.


So I recoded it to fetch everything upfront with [fetchRequest  
setReturnsObjectsAsFaults:NO]; and the fetching of 5000 objects still  
takes more than 15 seconds. On second launch that's about 3 seconds.  
This seems to be slow.


Ruotger

___

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


Core Data dog-slow when using first time after boot

2009-08-19 Thread Ruotger Skupin

Hi,

when fetching about 5000 objects from an sql store, Core Data is very  
slow the very first time after a boot. When running the app the first  
time it takes 50 to 90 seconds and when starting it the second time it  
is well below one second.


What is going on here? Has anyone noticed this too?

I thought of writing a background app to load the store and fetch the  
objects when logging in, just in case the user might launch the app...  
But that's madness of course!


I'm talking about Leopard 10.5.7 and 10.5.8 here.  Don't know about  
Tiger (can't talk about SL)


regards
    Ruotger Skupin

___

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: [iPhone] Abort/remove all running/pending animations [SOLVED]

2009-02-17 Thread Ruotger Skupin

To answer my own question:

+[UIView setAnimationsEnabled:];

BUT !!!1!eleven!!one!

-[UIScrollView setContentOffset: animated:] messes also with +[UIView  
setAnimationsEnabled:] whether or not you use animated. So when  
getting the scrollViewDidEndZooming:withView:atScale: delegate  
callback call, reorder your content subviews so that the zoomed view  
stays where it is already and use the contentInset property  
creatively. Do not use -[UIScrollView setContentOffset: animated:] in  
that delegate callback call.


Hope that helps people running into the same problem

Ruotger


Am 12.02.2009 um 11:57 schrieb Ruotger Skupin:


Hi,

I'm resizing and moving the content of a UIScrollView in the - 
scrollViewDidEndZooming:withView:atScale: method including the  
removing/adding of views. This usually results in the content  
bouncing more or less uncontrollable.


My question:

Is it possible to remove/abort *all* (really all) pending/running  
animations (especially those in UIScrollView) to reorder all the  
views and start custom animations from there?


Ruotger


___

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/lists%40chipmunk-app.com

This email sent to li...@chipmunk-app.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


Re: Retrieve Default Currency Type in Mac, iPhone

2009-02-16 Thread Ruotger Skupin

Hi Ben,

Be careful with your assumptions. Some Locales have the currency  
symbol after the number, e.g. German:


1.234,56 €

(note the decimal separator between the 4 and the 5 for additional  
scanning fun!)


Roddi


Am 16.02.2009 um 12:35 schrieb Ben:

I haven't checked the docs, but could you maybe scan the string up  
to the first numeric character and use that?


- Ben

On 16 Feb 2009, at 11:30, Tharindu Madushanka wrote:


Hi,
I want to get the currency type of iPhone default selected  
language. If I
add an NSNumberFormatter and format a number I will get a string  
with the
currency type. But I cannot sub string this and get the currency  
type since

it might vary the character size.
When international is selected as United States,
For example $ 123,290.00 , I want to get $ mark only.
TRY 2.500,00, I want to get TRY only.

Can I do this, Please explain me.

Thank you,
Tharindu


___

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/lists%40chipmunk-app.com

This email sent to li...@chipmunk-app.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


[iPhone] Abort/remove all running/pending animations

2009-02-12 Thread Ruotger Skupin

Hi,

I'm resizing and moving the content of a UIScrollView in the - 
scrollViewDidEndZooming:withView:atScale: method including the  
removing/adding of views. This usually results in the content bouncing  
more or less uncontrollable.


My question:

Is it possible to remove/abort *all* (really all) pending/running  
animations (especially those in UIScrollView) to reorder all the views  
and start custom animations from there?


Ruotger


___

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


UIScrollView - photo viewer like usage

2009-02-10 Thread Ruotger Skupin

Hi,

this is going to sound like an angry rant but actually it isn't. I'm  
simply a bit frustrated...


I have been trying to use UIScrollView to build an Photo app-like  
image viewer. The view is supposed to show photos with swiping between  
them, zooming and rotating with interface rotation.


It seems this is impossible. When you add more than one subview to  
UIScrollView, zooming seems to be broken beyond repair with strange  
behaviour all over the place, no control over the subviews while  
zooming and weird whizzing of views when the zooming ends. It's hard  
to post Radar bugs here, because there is only little documentation of  
what should actually happen or what can be done when


- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView: 
(UIView *)view atScale:(float)scale


is called.

So my questions:

Has anyone done this successfully (with UIScrollView)?
Is it better to re-implement all this with layers to have more control  
over everything?


To Apple people:
Does it make sense to spend a support incident on this or is it just a  
waste of everyone's time.


Regards and no offence meant
Ruotger

P.S.: to see what I mean download the Scrolling sample and add these  
methods to MyViewController:


- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView
{
CGPoint offset = scrollView.contentOffset;
int imageIndex = (int)(floorf(offset.x / kScrollObjWidth));

if (imageIndex >= 0 && imageIndex < [[scrollView1 subviews] count])
return [[scrollView1 subviews] objectAtIndex:imageIndex];
return nil;
}

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView: 
(UIView *)view atScale:(float)scale

{

}

// and add this to -[MyViewController viewDidLoad]:

scrollView1.minimumZoomScale = 1;
scrollView1.maximumZoomScale = 3;
scrollView1.delegate = self;

___

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


Comparing the Class

2008-10-15 Thread Ruotger Skupin

Hi,

when comparing the class of two objects I usually do [obj1  
isKindOfClass:[obj2 class]]. But if I say have the Class as an input  
value to a method:


- (void) bla:(Class) inClass
{
if (/* inClass is an NSString */)
{
// do stuff
}
else if (/* inClass is an NSNumber */)
{
// do other stuff
}
}

Is it save to compare like this:

inClass == [NSString class]

or do I have to e.g.:

[[NSNumber numberWithInt:0] isKindOfClass:inClass]

Roddi

___

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: NSUndoManager messing up Core Data database

2008-10-09 Thread Ruotger Skupin

Hi Ron,

I wasn't clear enough on one point. The main thread context's undo  
manager crashes (the posted backtrace), but changing the DB only  
happens in the background thread. Assuming no binding changes the main  
thread context, there shouldn't be anything to undo in the main thread  
context. I cannot be 100% sure the bindings behave read-only when they  
should, of course.


btw.: I'd like to propose that there should be a way to switch a  
context to read-only. I'd file a radar if you want me to.


Am 08.10.2008 um 18:23 schrieb Ron Lue-Sang:



The background thread (called database access thread) is the one  
that changes the database exclusively, all database modifying is  
funnelled through it. The main thread is supposed to only read- 
access the database. How do I do that? Since I already use  
mogenerator (http://rentzsch.com/code/mogenerator) I changed the  
generator template to check for the correct thread on write access.  
That way I could pinpoint a lot of accidental write accesses, which  
led to context inconsistencies.


There's one I could not get rid of. It is done by the  
NSUndoManager. Which is weird as there is no write access to the  
database from the main thread the NSUndoManager is so keen on  
undoing. What is going on?


In my case I'd like to get rid of the NSUndoManager altogether as I  
don't need it. Is there a way to do that?




Well, the short answer is:
backgroundManagedObjectContext = [[NSManagedObjectContext alloc]  
init];

[backgroundManagedObjectContext setUndoManager:nil];

But that's assuming that the undoManager in frame 15 of your bt is  
[backgroundManagedObjectContext undoManager]. I think that's the  
only way you'd get into the situation you've described.



--
RONZILLA





Ruotger

___

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: NSUndoManager [EMAIL PROTECTED] up Core Data database

2008-10-09 Thread Ruotger Skupin

Hi Ben,

yes, there are some sporadic problems left in save: but these are  
exception I can handle. The NSUndoManager crashes were totally beyond  
my control, so this is going to help a lot.


Thanks
Ruotger


Am 08.10.2008 um 22:23 schrieb Ben Trumbull:


Ruotger,

This has less to do with the undo manager itself, and more to do  
with event coalescing.  You can set the undo manager for the MOC to  
nil, but this problem will happen elsewhere later, like -save: or - 
executeFetchRequest: or when you call -processPendingChanges  
yourself.  This code is following the delete rules in your model for  
a deleted object to cascade the necessary relationship maintenance  
throughout the graph.


- Ben



___

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]


Multithreaded Core Data app design

2008-10-09 Thread Ruotger Skupin

Hi,

Since Ron asked, let's move this to an own thread (no pun intended):

Am 08.10.2008 um 18:23 schrieb Ron Lue-Sang:


Hi,

I have a core data database with two contexts attached to it. One  
read-only for the main thread and bindings, one read/write for a  
background thread that takes data from the network and feeds it  
into the database. I know this is an effed-up design you shouldn't  
copy, but it won't change.
(For why this is a bad idea: http://lists.apple.com/archives/Cocoa-dev/2007/May/msg00066.html 
 but please let's not discuss this here, thx)


Where shall we discuss this then? I have comments  =)





Here. Go ahead!



Ruotger

___

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]


NSUndoManager [EMAIL PROTECTED] up Core Data database

2008-10-08 Thread Ruotger Skupin

Hi,

I have a core data database with two contexts attached to it. One read- 
only for the main thread and bindings, one read/write for a background  
thread that takes data from the network and feeds it into the  
database. I know this is an effed-up design you shouldn't copy, but it  
won't change.
(For why this is a bad idea: http://lists.apple.com/archives/Cocoa-dev/2007/May/msg00066.html 
 but please let's not discuss this here, thx)


The background thread (called database access thread) is the one that  
changes the database exclusively, all database modifying is funnelled  
through it. The main thread is supposed to only read-access the  
database. How do I do that? Since I already use mogenerator (http://rentzsch.com/code/mogenerator 
) I changed the generator template to check for the correct thread on  
write access. That way I could pinpoint a lot of accidental write  
accesses, which led to context inconsistencies.


There's one I could not get rid of. It is done by the NSUndoManager.  
Which is weird as there is no write access to the database from the  
main thread the NSUndoManager is so keen on undoing. What is going on?


#1  0x00045652 in -[_GBEbayItem setDetails:] at _GBEbayItem.m:812
#2  0x97009f14 in -[NSManagedObject(_NSInternalMethods) _propagateDelete]
#3	0x970099b4 in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_propagateDeletesUsingTable:]
#4	0x970096df in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_processDeletedObjects:]
#5	0x96fc7398 in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_propagatePendingDeletesAtEndOfEvent:]
#6	0x96fc6f69 in -[NSManagedObjectContext(_NSInternalChangeProcessing)  
_processRecentChanges:]

#7  0x96fdabea in -[NSManagedObjectContext processPendingChanges]
#8	0x970033a5 in - 
[NSManagedObjectContext(_NSInternalNotificationHandling)  
_processEndOfEventNotification:]

#9  0x953152dc in _nsnote_callback
#10 0x94803aba in __CFXNotificationPost
#11 0x94803d93 in _CFXNotificationPostNotification
#12	0x95312440 in -[NSNotificationCenter  
postNotificationName:object:userInfo:]

#13 0x9531bc88 in -[NSNotificationCenter postNotificationName:object:]
#14	0x9537c10a in -[NSUndoManager(NSUndoManagerPrivate)  
_postCheckpointNotification]

#15 0x9537bf73 in -[NSUndoManager endUndoGrouping]
#16 0x948aaa8c in -[NSSet makeObjectsPerformSelector:withObject:]
#17	0x9535a750 in +[NSUndoManager(NSUndoManagerPrivate)  
_endTopLevelGroupings]

#18 0x93db1d27 in -[NSApplication run]
#19 0x93d7ef14 in NSApplicationMain

In my case I'd like to get rid of the NSUndoManager altogether as I  
don't need it. Is there a way to do that?


Ruotger

P.S.: I think all this started around 10.5.3 or 10.5.4 but I'm not sure

___

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]


mouseMoved events and unfocused views

2008-08-20 Thread Ruotger Skupin

Hi,

is there a way to get mouseMoved events in a view without it being the  
focused view (and without getting the focus, of course)?


Thanks
Ruotger
___

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: Message Framework and Garbage Collection

2008-08-06 Thread Ruotger Skupin

Hi,

just to let you know:

I'm trying to use the Message Framework with Garbage Collection  
enabled and it crashes deep down in the framework.

I filed a bug: 6128812



You can [...] use Pantomime,
Pantomime is not GC-ready. I haven't tried to switch on CG and see  
what happens though.



Ruotger

___

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: Message Framework and Garbage Collection

2008-08-05 Thread Ruotger Skupin

Hi B.

I'm trying not to sound mean or angry here but I doubt that Apple will  
fix such an obvious bug in a deprecated framework, since it didn't do  
so already. So filing a radar bug seems to be a waste of time (again).


Does anyone know, a way to send a mail programmatically in the  
background, i.e. without opening a "mailto:"; url?


Ruotger

On 04.08.2008, at 20:28, Bill Bumgarner wrote:


On Aug 4, 2008, at 10:35 AM, Ruotger Skupin wrote:
I'm trying to use the Message Framework with Garbage Collection  
enabled and it crashes deep down in the framework. With retain/ 
release it works fine. Am I correct in assuming that since it is  
deprecated for 10.5 it can't be used with GC?


Is there anything that can be used instead?


If it is in 10.5, it should work.  Please file a radar.

b.bum



___

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]


Message Framework and Garbage Collection

2008-08-04 Thread Ruotger Skupin

Hi,

I'm trying to use the Message Framework with Garbage Collection  
enabled and it crashes deep down in the framework. With retain/release  
it works fine. Am I correct in assuming that since it is deprecated  
for 10.5 it can't be used with GC?


Is there anything that can be used instead?

Ruotger

___

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: Trashing files and undo

2008-07-12 Thread Ruotger Skupin

Hi,

if I get you right, you are suggesting I put an alias to the file into  
(say) ~/Library/Application Support/MyApp/UndoAliases/ remember the  
original path/filename then trash the file. To get it back I resolve  
the alias and move/rename it.


What's the advantage over the FSRef solution Charles proposed?

Ruotger

Am 11.07.2008 um 17:44 schrieb Gregory Weston:


Ruotger Skupin wrote:


my app trashes files with -[NSWorkspace
performFileOperation:source:destination:files:tag:] and
NSWorkspaceRecycleOperation. This works flawlessly but users want  
undo.


NSWorkspace does not seem to allow undoing said file operation (or  
any

file operation for that matter). Correct me if I'm wrong.

So I might have to figure out where the trash directory for a given
volume/user/file etc is and move it myself. Is there an easy way to
find that out?


Drop-dead simple. FSFindFolder is your friend. Give it a volume  
reference number and tell it you're looking for the user's trash and  
it'll hand it back to you (creating it if necessary and you asked  
for that behavior).


I think possibly a bigger issue here is going to be that moving  
files to the trash can cause them to be renamed. At least doing so  
in Finder can; I'm not sure if the NSWorkspace routine does the  
same. You'll need a reliable way to track the file and map that back  
to the original location and name. You'll want to look at aliases  
for that.

___

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/lists%40chipmunk-app.com

This email sent to [EMAIL PROTECTED]


___

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: Trashing files and undo

2008-07-12 Thread Ruotger Skupin

Hi Charles,

let me make sure I understand that.

I get the FSRef and the original path of the file and keep hold of the  
information before trashing it with performFileOperation. When I  
want it back, I resolve the FSRef and move it back to original location.


Ruotger


Am 11.07.2008 um 17:54 schrieb Charles Srstka:


On Jul 11, 2008, at 10:44 AM, Gregory Weston wrote:

Drop-dead simple. FSFindFolder is your friend. Give it a volume  
reference number and tell it you're looking for the user's trash  
and it'll hand it back to you (creating it if necessary and you  
asked for that behavior).


I think possibly a bigger issue here is going to be that moving  
files to the trash can cause them to be renamed. At least doing so  
in Finder can; I'm not sure if the NSWorkspace routine does the  
same. You'll need a reliable way to track the file and map that  
back to the original location and name. You'll want to look at  
aliases for that.


You can just use an FSRef, which will track the file even after it's  
been moved. You have to use a little Carbon for this, but it's not  
bad. Just use either FSPathMakeRef() or CFURLGetFSRef() to make the  
FSRef before you move the file to the trash, and then use  
FSRefMakePath() or CFURLCreateFromFSRef() to get the new path to the  
file after you've trashed it.


An added benefit to this is that even if Apple ends up moving  
~/.Trash to some other location in a future version of OS X, this  
will still work (as long as FSRefs still work on whatever new file  
system we get moved to).


Charles
___

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/lists%40chipmunk-app.com

This email sent to [EMAIL PROTECTED]


___

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]


Trashing files and undo

2008-07-11 Thread Ruotger Skupin

Hi,

my app trashes files with -[NSWorkspace  
performFileOperation:source:destination:files:tag:] and  
NSWorkspaceRecycleOperation. This works flawlessly but users want undo.


NSWorkspace does not seem to allow undoing said file operation (or any  
file operation for that matter). Correct me if I'm wrong.


So I might have to figure out where the trash directory for a given  
volume/user/file etc is and move it myself. Is there an easy way to  
find that out?


Thanks for any pointers

Ruotger
___

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: Debugging strategy - exceptions

2008-07-09 Thread Ruotger Skupin

I would rather not try to teach my users gdb...

Ruotger

Am 09.07.2008 um 12:31 schrieb Joan Lluch (casa):



El 09/07/2008, a las 12:13, Ruotger Skupin escribió:


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any  
chance to get near the culprit without a stack trace (which I don't  
have)?



This question is more suitable for the Xcode-user list, but anyway,  
you should get a proper stack trace by breaking at  
"objc_exception_throw". Did you try it?


Joan Lluch


___

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]


Debugging strategy - exceptions

2008-07-09 Thread Ruotger Skupin

Hi,

this is more of an open discussion topic than a concrete question but  
hopefully someone has a good idea about this:


I got a bug report of a non-crash bug I cannot reproduce and where I  
do not even know where to start looking. The only hint is a line in  
the console.log:


*** -[NSCFDictionary initWithObjects:forKeys:count:]: attempt to  
insert nil value at objects[0] (key: NSFont)


So an exception got thrown for a pretty obvious reason, but where?  
Could be anywhere, even in WebKit (which we use). Is there any chance  
to get near the culprit without a stack trace (which I don't have)?


Even worse: There does not to be a way to switch off exceptions  
without switching off @synchronized() at the same time. That's not an  
option for the code in question.


Ruotger

___

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]


NSPredicateEditor and decimal numbers with fractions

2008-06-19 Thread Ruotger Skupin

Hi,

I've set up an NSPredicateEditor with a template that forms a  
predicate like: [Gross Value] [is] [32.99]


the format of the text field is set as Number in Interface Builder. If  
I input 32.99 into the field I get a predicate like this:


grossAmount.amount == 32

Obviously the number is rounded off at the decimal point. Since this  
is a currency amount, I need the decimal fraction ("the cents").


Any Advice?

Ruotger

___

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]


NSPredicateEditor and decimal numbers with fractions

2008-06-19 Thread Ruotger Skupin

Hi,

I've set up a NSPredicateEditor with a template that forms for example  
a predicate like: [Gross Value] [is] [   ]


the format of the text field is set as Number in Interface Builder. If  
I input 32.99 into the field I get a predicate like this:


grossAmount.amount == 32

Obviously the number is rounded off at the decimal point. Since this  
is a currency amount, I need the decimal fraction ("the cents").


Any Advice?

Ruotger

___

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]


probably OT: using encrypted disk images with NSTask and hdiutil

2008-05-22 Thread Ruotger Skupin

Hi,

To protect sensitive user data I attach an encrypted disk image and  
store the application data there.


I'm using hdiutil with the -passphrase option to create and attach  
encrypted disk images. This is deprecated and obviously not the  
correct way but quite frankly the man file for hdiutil is not very  
helpful:


 -certificate certificate_file
specify a secondary access certificate for the  
image being created.

 -pubkey PK1,PK2,...,PKn
specify a list of public key hashes in ASCII hex  
for the image being created.  The hash(s) will be used to locate a  
public key used to protect an encrypted image.


Is there any example code how to do this in Cocoa?

Ruotger









___

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]


Core Data: How to encrypt a persistent store

2008-05-22 Thread Ruotger Skupin

Hi,

I have an application which uses Core Data and handles sensitive  
information. Is there an easy way to encrypt the on-disk persistent  
store provided I'm reasonably fluent in libCrypto and do not want to  
use an encrypted disk image?


Ruotger

___

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: Chained Migration of Leopard CoreData stores

2008-04-17 Thread Ruotger Skupin


Am 17.04.2008 um 02:30 schrieb Ben Trumbull:

Hi,

let's say I have four versions of my data model:

DataModel1.xcdatamodel
DataModel2.xcdatamodel
DataModel3.xcdatamodel
DataModel4.xcdatamodel (this is the current one)

and three model mapping files which always map from version n to  
version n+1:


Mapping1to2.xcmappingmodel
Mapping2to3.xcmappingmodel
Mapping3to4.xcmappingmodel


Now I load a version 1 data file:

NSDictionary *options = [NSDictionary dictionaryWithObject: 
[NSNumber numberWithBool:YES]  
forKey:NSMigratePersistentStoresAutomaticallyOption];

NSError *error = nil;
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil  
URL:url options:options error:&error])

{
...
}

should the data file automatically be migrated to the current  
version 4 or do I need a single direct mapping like this:


Mapping1to4.xcmappingmodel


If you want Core Data to do everything, you'll need 1 mapping model,  
since we don't assume that iterative upgrades will necessarily work.
fair enough. But when releasing a version n of my app I'd rather have  
have the cost O(1) than O(n) building mappings.


If you're confident that composing your N+1 mapping models together  
makes sense for your app, you can run N+1 migrations in a row to  
avoid needing an umbrella mapping model.

Ok, let's say I'm confident. Two questions:

- How do I find out what data model my store uses? (So that I know  
where to start)
- How do I find out which two data models correspond to a given  
mapping? (So that I know which data model and mapping to use next)


Ruotger
___

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]


Chained Migration of Leopard CoreData stores

2008-04-16 Thread Ruotger Skupin

Hi,

let's say I have four versions of my data model:

DataModel1.xcdatamodel
DataModel2.xcdatamodel
DataModel3.xcdatamodel
DataModel4.xcdatamodel (this is the current one)

and three model mapping files which always map from version n to  
version n+1:


Mapping1to2.xcmappingmodel
Mapping2to3.xcmappingmodel
Mapping3to4.xcmappingmodel


Now I load a version 1 data file:

NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber  
numberWithBool:YES]  
forKey:NSMigratePersistentStoresAutomaticallyOption];

NSError *error = nil;
if (![persistentStoreCoordinator  
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:url  
options:options error:&error])

{
 ...
}

should the data file automatically be migrated to the current version  
4 or do I need a single direct mapping like this:


Mapping1to4.xcmappingmodel


Ruotger

___

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]


NSLocale: " " vs. " "

2008-03-19 Thread Ruotger Skupin

Hi,

Is there a way to determine if a user (or an address depending on the  
country) prefers the zip code first or the city name first, e.g.:


Apple
1 Infinite Loop
Cupertino, CA 95014

vs

Apple Computer GmbH

Dornacher Straße 3 D
85622 Feldkirchen
Germany

Probably one might want to figure out the whole address format somehow.

Ruotger

___

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]