Core Data - GROUP BY - iphone

I am trying to group results returned by Core Data. I read that you need to use "SortDescriptors" with a selector but I cant seem to get it to work?
I am trying to return group'ed "unique" name values?
http://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/SortDescriptors/Concepts/Creating.html

Actually, I think you want #distinctUnionOfObjects. See the Xcode Documentation: Key-Value Coding Programming Guide: Collection Operators.

try using #distinctUnionOfArrays.contactNumber to get the objects

Related

Mongodb I can see the size of the collection but, find() does not return anything

I am new to working with Mongo. I recently taken over our LearningLocker database from a previous employee. I can see using show dbs, the database has 4.188GB. But even using a simple db.learninglocker.find() is not returning anything. Any suggestions on how to review the data?
You should pass down an object as argument to the find function:
db.learninglocker.find({})

How to filter REST API JSON result by passing params

I'm trying to consume JIRA 2 API and trying to get custom fields. I want to further filter by passing appropriate criteria in URI itself. Current query I'm using is something similar to this:
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields
The result I'm getting from above request is about 2000 lines.. How can I further filter to get only Custom_fields and also under custom fields I need to only the ones which are required?
I'm pretty new to REST API. Please guide me If anything is wrong... TIA. I spent a lot of time browsing but don't know what exactly I need to search for or where exactly I need to get started.
You can use another queryParam just like expand and add further filtering or pagination.
http://localhost:8522/jira522/rest/api/2/issue/createmeta?expand=projects.issuetypes.fields&limit=1000

iPhone Data Structure and accessor code advice

I need a code based solution for storing the following data without using CoreData. Preferably I would be able to access each row based on it's index, and each data field using a key/pair perhaps?
The PHP equivalent of what I'm looking for would be something like;
echo $arr[0]['Image'];
Apple.png
The simplest way is to use an NSMutableArray of NSMutableDictionary objects.
NSMutableArray has a -writeToURL: method you can use to save it to disk.
You can use either plist, sqlite or Any other data storage take look at this link. and if you are using like Sqlite than select query will get the Apple.png.

MongoDB ObjectId foreign key implementation recommendation

I'm looking for a recommendation on how best to implement MongoDB foreign key ObjectId fields. There seem to be two possible options, either containing the nested _id field or without.
Take a look at the fkUid field below.
{'_id':ObjectId('4ee12488f047051590000000'), 'fkUid':{'_id':ObjectId('4ee12488f047051590000001')} }
OR
{'_id':ObjectId('4ee12488f047051590000000'), 'fkUid':ObjectId('4ee12488f047051590000001')} }
Any recommendations would be much appreciated.
I'm having a hard time coming up with any possible advantages for putting an extra field "layer" in there, so I would personally just store the ObjectId directly in fkUid.
I suggest to use default dbref implementation, that is described here http://www.mongodb.org/display/DOCS/Database+References and is compatible with most of specific language drivers.
If your question is about the naming of the field (what you have in the title), usually the convention is to name it after the object to which it refers.
The both ways that you have mentioned are one of the same meaning. But they have different kind of usages.
Storing fkUid like 'fkUid':{'_id':ObjectId('4ee12488f047051590000001')} an object has it's own pros. Let me give an example, Suppose there is a website where users can post images and view images posted by other users as well. But when showing the image the website also shows the name/username of the user. By using this way you also can store the details like 'fkUid':{'_id':ObjectId('4ee12488f047051590000001'), username: 'SOME_X'}. When you are getting details from the db you don't have to send a request again to get the username for the specific _id.
Where as in the second way 'fkUid':ObjectId('4ee12488f047051590000001')} } you have to send another request to the server only for getting the name/username and nothing else is useful from the same object.

Cassandra get_range_slices

I am new to Cassandra and I am having some difficulties fetching data.
I looked into the function:
list<KeySlice> get_range_slices(column_parent, predicate, range, consistency_level)
But, I do not understand what the column_parent is supposed to be.
Anybody any idea?=
Thanx,
Granit
column_parent is basicly used for indicator of ColumnFamily(but in rare cases it can indicate a supercolumn). In java you would put : new ColumnParent("Posts") there. but there should be one more parameter for namespace in get_range_slices query, I guess you are not using thrift but a client api. then you should check your client's documentation.
Edit:
the definition of ColumnParent in cassandra api :
The ColumnParent is the path to the
parent of a particular set of Columns.
It is used when selecting groups of
columns from the same ColumnFamily. In
directory structure terms, imagine
ColumnParent as ColumnPath + '/../'.
Frail is correct, but the real answer is "don't use raw Thrift, use one of the clients from http://wiki.apache.org/cassandra/ClientOptions instead."