Re: Tree rest resource and sorting

David Steinberger <[email protected]>
Newsgroups gmane.comp.web.gallery.devel
Organization FH - KufsteinTirol
Message-ID <[email protected]>
Right after I sent the message I realized that I'd be beaten up by that.

So let me give details: Core Data doesn't store NSArray, but NSSet:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html

Yes it's platform specific. but right now iOS is the most common one.
Core Data is the best way to serialize objects (IMHO) and I really want 
to use it.

Why should it be wrong to indicate the sort by an attribute?
It doesn't impact the server-side at all.

On 6/6/11 12:16 AM, Bharat Mediratta wrote:
>
> Hm.  An array is an ordered list, and I would expect NSArray to 
> maintain the ordering -- 
> http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSArray_Class/NSArray.html seems 
> to bear that out.  Are you seeing it lose the ordering?
>
> Even if it was, I'd expect that this is a platform specific problem so 
> I'd expect it'd be something you'd fix on your side by updating the 
> entity after you load it.  Doing it on the server side smells wrong to me.
>
> Thoughts?
>
> On Wed, Jun 1, 2011 at 10:55 AM, David Steinberger 
> <[email protected] <mailto:[email protected]>> wrote:
>
>     Team,
>
>     I'm reworking the data model of my iPhone app.
>     One thing I want to revisit is how I deal with the tree rest
>     resource (tree_rest.php).
>
>     Reason:
>     I know that the tree_rest.php delivers the objects in the right
>     order, but this doesn't help me much.
>     I need to store and retrieve the array and by doing such an
>     operation with an array the order might be lost.
>
>     Proposed solution:
>     The patch attached adds a relative_position attribute to each
>     entity. Via this attribute the entity order can be reconstructed
>     at any time. There's no impact on performance and overall structure.
>
>     Please review and merge to master or propose something even better.
>
>     Thanks,
>       David
>
>     ---
>
>     FYI Details:
>     I use core data to cache all objects (tree/album, items, tags,
>     ...). Core data is kind of a database for objects on iOS. The tree
>     is modeled via a Class that has a NSString property that holds the
>     url (that's the primary key) and a NSArray that holds all the
>     entities.
>     But when I retrieve the object-graph iOS applies any sorting. ==>
>     A sort-attribute is needed.
>
>     	
>
>     	
>
>     	
>
>     	
>
>     	
>
>
>     ------------------------------------------------------------------------------
>     Simplify data backup and recovery for your virtual environment
>     with vRanger.
>     Installation's a snap, and flexible recovery options mean your
>     data is safe,
>     secure and there when you need it. Data protection magic?
>     Nope - It's vRanger. Get your free trial download today.
>     http://p.sf.net/sfu/quest-sfdev2dev
>     __[ g a l l e r y - d e v e l ]_________________________
>
>     [ list info/archive --> http://gallery.sf.net/lists.php ]
>     [ gallery info/FAQ/download --> http://gallery.sf.net ]
>
>

------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2

__[ g a l l e r y - d e v e l ]_________________________

[ list info/archive --> http://gallery.sf.net/lists.php ]
[ gallery info/FAQ/download --> http://gallery.sf.net ]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.