草庐IT

message_count

全部标签

android - Google Cloud Messaging (GCM) 使用哪个端口和协议(protocol)?

GoogleCloudMessaging(GCM)使用哪个端口和协议(protocol)?我们有时会遇到消息无法通过的情况,并且注意到这取决于我们所在的网络。 最佳答案 设备通过端口5228-5230访问GCM服务器。Note:IfyourorganizationhasafirewallthatrestrictsthetraffictoorfromtheInternet,you'llneedtoconfigureittoallowconnectivitywithGCM.Theportstoopenare:5228,5229,and5

与 Firebase 相关的 Google Play 服务更新后,Android Google Cloud Messaging (GCM) token 生成崩溃

我的Android应用程序今天在为GoogleCloudMessaging(GCM)生成token时开始崩溃。这发生在多种设备和Android版本上。我认为这可能与Google昨天在GoogleIO上宣布的新Firebase功能有关。当这种情况开始发生时,我没有处理与GCM相关的代码,所以这是出乎意料的。如果我从Android系统设置中卸载GooglePlay服务更新,该应用程序将不再崩溃。一旦我重新安装最新版本,应用程序每次都会再次崩溃。FATALEXCEPTION:IntentService[MyGCMRegistrationIntentService]Process:,PID:2

android - 如何在我的内容提供商中获取 _count?

我应该怎么做才能让我的内容提供者返回包含记录数的_count列?文档说它是自动的,但也许它只需要一些内置的内容提供程序。对数据库运行查询似乎不会返回它。 最佳答案 如果您使用的是contentProvider,那么您必须像count(*)AScount那样进行操作。如果您使用cursor.getCount(),那将没有上述方法那么有效。使用cursor.getCount()您获取所有记录只是为了获得计数。整个代码应如下所示-CursorcountCursor=getContentResolver().query(CONTENT_UR

android - NullPointerException : println needs a message in android

在我的媒体播放器中,我从sdcard播放一首歌曲。它显示错误为NullPointerException:println需要在android中显示消息e。我尝试了很长时间,但我不知道原因。请帮助我。代码:try{mediaPlayer=newMediaPlayer();mediaPlayer.setDataSource("/sdcard/t1.mp3");seek.setMax(mediaPlayer.getDuration());mediaPlayer.prepare();mediaPlayer.start();mediaPlayer.setOnCompletionListener(t

android - 更新 GUI : Runnables vs Messages

要从其他线程更新GUI,主要有两种方法:将java.lang.Runnable与以下任一方法一起使用:Activity.runOnUiThread(Runnable)View.post(Runnable)View.postDelayed(Runnable,long)Handler.post(Runnable)使用android.os.Message:Handler.sendMessage(Message)/Handler.handleMessage(Message)您也可以使用AsyncTask,但我的问题更侧重于更新一个非常简单的组件的用例。让我们看看如何使用这两种方法来完成:使用R

java堆分析与oql : Count unique strings

我正在对现有的java软件进行内存分析。oql中是否有等效的sql'groupby'来查看具有相同值但不同实例的对象的计数。选择计数(*)来自java.lang.Strings按s.toString()分组我想获得一个重复字符串的列表以及重复的数量。这样做的目的是查看大量案例,以便可以使用String.intern()对其进行优化。例子:"foo"100"bar"99"lazyfox"50等等…… 最佳答案 以下内容基于PeterDolberg的回答,可用于VisualVMOQL控制台:varcounts={};varalready

STL - STL count_if 的标准谓词

我正在使用STL函数count_if来计算所有正值在doublevector中。例如我的代码是这样的:vectorArray(1,1.0)Array.push_back(-1.0);Array.push_back(1.0);cout其中函数isPositive定义为boolisPositive(doublex){return(x>0);}以下代码将返回2。有没有办法做到以上几点不写我自己的函数isPositive?有没有内置的我可以使用的功能?谢谢! 最佳答案 std::count_if(v.begin(),v.end(),std:

c++ - 为什么 std::count(_if) 返回 iterator::difference_type 而不是 size_t?

这个问题在这里已经有了答案:关闭10年前。PossibleDuplicate:WhydoestheC++standardalgorithm“count”returnaptrdiff_tinsteadofsize_t?标准C++中有std::count/std::count_if算法。templatetypenameiterator_traits::difference_typecount(InputIteratorfirst,InputIteratorlast,constT&value);templatetypenameiterator_traits::difference_typec

c++ protobuf : how to iterate through fields of message?

我是protobuf的新手,但我的任务很简单:我需要遍历消息字段并检查它的类型。如果类型是消息,我将递归地对此消息执行相同的操作。例如,我有这样的消息:packageMyTool;messageConfiguration{requiredGloablSettingsglobalSettings=1;optionalstringoption1=2;optionalint32option2=3;optionalbooloption3=4;}messageGloablSettings{requiredbooloption1=1;requiredbooloption2=2;requiredbo

c++ - 使用 vm.count() 时始终存在具有默认值的 Boost 程序选项

我一直在尝试使用boost::program_options验证我通过的选项。我的命令有几种模式,每种模式都有可以指定的相关参数。我要做的是确保这些关联的参数与模式一起传递,即unicorn--fly--magic-wings-threshold--fly是模式,--magic-wings-threshold是相关参数。我注意到的是如果--magic-wings-threshold有一个默认值,例如("magic-wings-threshold,w",po::value(&wings_thresh)->default_value(0.8,"0.8"),"Magicwingsmaximu