草庐IT

query_result

全部标签

mongodb - 根据 Mongodb Query 中的一个字段查找最大连续记录数

我想根据一个特定字段查找最大连续记录数。我的db.people集合在找到基于字段的排序后是:>db.people.find().sort({updated_at:1}){"_id":1,"name":"aaa","flag":true,"updated_at":ISODate("2014-02-07T08:42:48.688Z")}{"_id":2,"name":"bbb","flag":false,"updated_at":ISODate("2014-02-07T08:43:10Z")}{"_id":3,"name":"ccc","flag":true,"updated_at":IS

android - GCM : MulticastResult - which result is from which device?

在GCM:GettingStarted的最后一节之后指导,收到结果后有一些簿记要做。引自指南:It'snownecessarytoparsetheresultandtaketheproperactioninthefollowingcases:IfthemessagewascreatedbuttheresultreturnedacanonicalregistrationID,it'snecessarytoreplacethecurrentregistrationIDwiththecanonicalone.IfthereturnederrorisNotRegistered,it'snece

android - SCAN_RESULTS_AVAILABLE_ACTION 在 Android 6.0 中返回空列表

昨天我的Nexus5收到了从AndroidMNC到版本6.0-Marshmallow的更新。此后,扫描设备中可用网络的操作停止接收列表,在这种情况下,结果列表的大小为0,即使Wifi系统设置中列出了10多个Wifi网络。这方面的代码是通常的:注册SCAN_RESULTS_AVAILABLE_ACTION并在接收器中等待事件,如下所示://RegistertheReceiverinsomepartosfragment...getActivity().registerReceiver(wifiListener,newIntentFilter(WifiManager.SCAN_RESULTS

android - managedQuery() vs context.getContentResolver.query() vs android.provider.something.query()

很简单。这三者有什么区别?我想列出设备中的每个图像。我应该使用managedQuery()、android.provider.MediaStore.Images.Media.query()还是context.getContentResolver.query() 最佳答案 managedQuery()将使用ContentResolver的query()。不同的是使用managedQuery()Activity将保留对您的引用光标并在需要时关闭它(例如在onDestroy()中。)如果您自己执行query(),您将必须将Cursor作为

android - 在 SQLiteDatabase.query() 中使用 String[] selectionArgs

如何在SQLiteDatabase.query()中使用String[]selectionArgs?我希望我可以将它设置为null,因为我没有用它。我只是想将整个未排序的表从数据库加载到Cursor中。关于如何实现这一点的任何建议? 最佳答案 selectionArgs替换选择字符串中的任何问号。例如:String[]args={"firststring","second@string.com"};Cursorcursor=db.query("TABLE_NAME",null,"name=?ANDemail=?",args,null

android - 遍历来自 Sqlite-query 的行

我有一个表格布局,我想用数据库查询的结果进行填充。我使用全选,查询返回四行数据。我使用此代码在表格行中填充TextView。Cursorc=null;c=dh.getAlternative2();startManagingCursor(c);//thedesiredcolumnstobeboundString[]columns=newString[]{DataHelper.KEY_ALT};//theXMLdefinedviewswhichthedatawillbeboundtoint[]to=newint[]{R.id.name_entry};SimpleCursorAdapterm

android - java.lang.RuntimeException : Failure delivering result ResultInfo{who=null, request=1888, result=0, data=null} 到 Activity

我的应用程序允许用户按下一个按钮,它会打开相机,他们可以拍照,它会显示在ImageView中。如果用户在相机打开时按下或取消,我会强制关闭-将结果ResultInfo{who=null,request=1888,result=0,data=null}传递给Activity失败......所以我猜结果=0是我需要插入什么才能使此停止强制关闭的问题?下面是我的代码。我知道我忘记了一些东西,但就是想不通!(诚​​然,我学习android开发大约需要2周时间)。感谢您的帮助!privatestaticfinalintCAMERA_REQUEST=1888;privateImageViewima

android - 是什么导致 Android 的 ContentResolver.query() 返回 null?

ContentResolver.query在什么条件下()返回null而不是游标对象?我之前得到了空游标,但刚刚意识到该方法也可以返回null。不过,我无法追踪发生这种情况的情况。 最佳答案 由于我今天收到我的应用程序的用户崩溃报告,我刚刚偶然发现了同样的问题。如果Android文档对某些内容不清楚,则查看源代码会有所帮助。这就是我发现ContentResolver.query()返回null的原因:无法获取内容提供者。这可能是由于指定的Uri有问题,或者因为它根本不存在于系统中。如果Uri是问题,原因是:协议(protocol)不

Node.js : How to return Object in Query Aggregation?

我需要使用groupby从我的集合中计算指定字段的总和所以,我使用了聚合函数。我的愿望是函数应该只返回对象。当我使用aggregate时,它返回ArrayofObjects。但我的查询返回的是对象数组([{..},{..},{..}])而不是单个对象({..}).例如,到目前为止我尝试过用数组[]结构指定MyModel.aggregate([{$match:...},{$group:...}],function(err,result){console.log(result);});指定不带数组[]结构MyModel.aggregate({$match:...},{$group:...}

Node.js : How to return Object in Query Aggregation?

我需要使用groupby从我的集合中计算指定字段的总和所以,我使用了聚合函数。我的愿望是函数应该只返回对象。当我使用aggregate时,它返回ArrayofObjects。但我的查询返回的是对象数组([{..},{..},{..}])而不是单个对象({..}).例如,到目前为止我尝试过用数组[]结构指定MyModel.aggregate([{$match:...},{$group:...}],function(err,result){console.log(result);});指定不带数组[]结构MyModel.aggregate({$match:...},{$group:...}