Re: Tree rest resource and sorting

Bharat Mediratta <[email protected]>
Newsgroups gmane.comp.web.gallery.devel
Message-ID <[email protected]>
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]>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.