首页 文章 精选 留言 我的

精选列表

搜索[提示词调教],共10007篇文章
优秀的个人博客,低调大师

dubbo invoke调用提示 no such method

dubbo通过invoke的方式去调用服务 method() invoke method() ----- 正常调用 method(int param1, int param2) invoke method(1, 2) ---- 正常调用 method(XXXObject obj) invoke method(json字符串) --- 报错, no such method ** 请问为什么第三种情况下,会调用不到服务。以前用过传json的也可以正常调用。 之后看dubbo invoke调用之后的处理 InvokeTelnetHandler。发现在校验参数的时候,会去判断类型是否一致。当我们传入json的时候,参数类型是jsonObject,所以我们得添加一个属性class,来指定参数类型。

优秀的个人博客,低调大师

Android 下载apk提示更新以及解决Android 6.0 Marshmallow提示更新报错问题

下载并安装apk的方法很多,但是谷歌还是建议我们采用DownloadManager。 下载更新的代码比较简单,分如下几块: 启动下载 public long startDownload(String uri, String title, String description) { DownloadManager.Request req = new DownloadManager.Request(Uri.parse(uri)); req.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI); //req.setAllowedOverRoaming(false); req.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //设置文件的保存的位置[三种方式] //第一种 //file:///storage/emulated/0/Android/data/your-package/files/Download/update.apk req.setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, "update.apk"); //第二种 //file:///storage/emulated/0/Download/update.apk //req.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, "update.apk"); //第三种 自定义文件路径 //req.setDestinationUri() // 设置一些基本显示信息 req.setTitle(title); req.setDescription(description); //req.setMimeType("application/vnd.android.package-archive"); return dm.enqueue(req); } 然后是监听下载完成的Receive public class ApkInstallReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(DownloadManager.ACTION_DOWNLOAD_COMPLETE)) { long downloadApkId = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1); long id = PrefUtils.getDownloadId(); if (downloadApkId == id) { installApk(context, downloadApkId); } } } private void installApk(Context context, long downloadApkId) { Intent install = new Intent(Intent.ACTION_VIEW); DownloadManager dManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); Uri downloadFileUri = dManager.getUriForDownloadedFile(downloadApkId); if (downloadFileUri != null) { Log.d("DownloadManager", downloadFileUri.toString()); install.setDataAndType(downloadFileUri, "application/vnd.android.package-archive"); install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(install); } else { Log.e("DownloadManager", "下载失败"); } } 上面的做法在Android 6.0 Marshmallow 系统之前是没有问题的,但是在6.0之后,会报错,倒是应用直接挂掉;报错LOG如下: Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=content: typ=application/vnd.android.package-archive flg=0x10000000 } 经过查看Uri的值,发现6.0与之前的不一样 6.0的downloadFileUri 值为: content://downloads/my_downloads/10 6.0之前的downloadFileUri 值为:file:///storage/emulated/0/Android/data/com.chiclam.download/files/Download/update-2.apk 完整的解决写法: private void installApk(Context context, long downloadApkId) { DownloadManager dManager = (DownloadManager) context.getSystemService(Context.DOWNLOAD_SERVICE); DownloadManager.Query query = new DownloadManager.Query(); query.setFilterById(downloadApkId); Cursor c = dManager.query(query); if(c != null) { if (c.moveToFirst()) { int columnIndex = c.getColumnIndex(DownloadManager.COLUMN_STATUS); if (DownloadManager.STATUS_SUCCESSFUL == c.getInt(columnIndex)) { String downloadFileUrl = c.getString(c.getColumnIndex(DownloadManager.COLUMN_LOCAL_URI)); startInstall(context, Uri.parse(downloadFileUrl)); } } c.close(); } } private boolean startInstall(Context context, Uri uri) { if(!new File( uri.getPath()).exists()) { System.out.println( " local file has been deleted! "); return false; } Intent intent = new Intent(); intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK); intent.setAction( Intent.ACTION_VIEW); intent.setDataAndType( uri, "application/vnd.android.package-archive"); context.startActivity( intent); return true; } 这样便完美解决了6.0上自动启动更新界面BUG

优秀的个人博客,低调大师

elasticsearch 同义词配置

在elasticsearch-2.3.1/config目录下面,存放synonyms.txt curl -XPOST 'http://localhost:9200/sy' -d '{ "analysis": { "analyzer":{ "mysynonym":{ "type": "custom", "tokenizer":"ik_max_word", "filter":[ "local_synonym" ] } }, "filter":{ "local_synonym":{ "expand":true, "ignore_case":true, "type":"synonym", "synonyms_path":"synonym.txt" } } } }' curl -XPOST 'http://localhost:9200/sy/sy/_mapping' -d '{ "sy":{ "_all":{ "search_analyzer":"ik_smart", "analyzer":"mysynonym" }, "properties":{ "name":{ "type":"string" }, "title":{ "type":"string" }, "number":{ "type": "long" } } } } }' curl -XPOST http://127.0.0.1:9200/sy/sy/1?pretty -d' {"name":"番茄" , "title" : "FQtitle" , "number" : 10000} ' curl -XPOST http://127.0.0.1:9200/sy/sy/2?pretty -d' {"name":"西红柿" , "title" : "XHStitle" , "number" : 20000} ' curl -XPOST http://127.0.0.1:9200/sy/sy/3?pretty -d' {"name":"圣女果" , "title" : "SVGtitle" , "number" : 30000} ' curl -XGET 'http://127.0.0.1:9200/sy/sy/_search?pretty' -d '{ "from" : 0, "size" : 2, "query": { "bool" : { "must" : { "query_string" : { "query" : "圣女果" } } } } }' 本文转自whk66668888 51CTO博客,原文链接:http://blog.51cto.com/12597095/1915508

资源下载

更多资源
腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Spring

Spring

Spring框架(Spring Framework)是由Rod Johnson于2002年提出的开源Java企业级应用框架,旨在通过使用JavaBean替代传统EJB实现方式降低企业级编程开发的复杂性。该框架基于简单性、可测试性和松耦合性设计理念,提供核心容器、应用上下文、数据访问集成等模块,支持整合Hibernate、Struts等第三方框架,其适用范围不仅限于服务器端开发,绝大多数Java应用均可从中受益。

Rocky Linux

Rocky Linux

Rocky Linux(中文名:洛基)是由Gregory Kurtzer于2020年12月发起的企业级Linux发行版,作为CentOS稳定版停止维护后与RHEL(Red Hat Enterprise Linux)完全兼容的开源替代方案,由社区拥有并管理,支持x86_64、aarch64等架构。其通过重新编译RHEL源代码提供长期稳定性,采用模块化包装和SELinux安全架构,默认包含GNOME桌面环境及XFS文件系统,支持十年生命周期更新。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册