首页 文章 精选 留言 我的

精选列表

搜索[接口调试],共10009篇文章
优秀的个人博客,低调大师

Android--Xutils3源码案例调试

版权声明:本文为博主原创文章,转载请标明出处。 https://blog.csdn.net/chaoyu168/article/details/77842358 下载网址:https://github.com/wyouflf/xUtils3 第一步:新建一个自己的工程; 第二步:点File->New->Import Module,选择自己下载好的xutils3,目录为:D:\adtext\xUtils3-master\sample 第三步:修改库xutils的build.gradle,屏蔽无用代码,将versionName的值改为版本号,修改; apply plugin: 'com.android.library' //apply plugin: 'com.github.dcendents.android-maven' //apply plugin: 'com.jfrog.bintray' // //def siteUrl = 'https://github.com/wyouflf/xUtils3' //def gitUrl = 'https://github.com/wyouflf/xUtils3.git' //group = "org.xutils" //version = "3.5.0" android { compileSdkVersion 25 buildToolsVersion '25.0.0' defaultConfig { minSdkVersion 14 targetSdkVersion 25 versionCode 20170405 versionName "3.5.0" } buildTypes { debug { minifyEnabled false debuggable true } release { minifyEnabled false debuggable true } } sourceSets { main { jniLibs.srcDirs = ['libs'] java.srcDirs = ['src/main/java'] } } compileOptions { sourceCompatibility JavaVersion.VERSION_1_6 targetCompatibility JavaVersion.VERSION_1_6 } } //install { // repositories.mavenInstaller { // // This generates POM.xml with proper parameters // pom { // project { // packaging 'aar' // name 'xUtils' // description 'android orm, bitmap, http, view inject... ' // // #CONFIG# // project title // url siteUrl // // Set your license // licenses { // license { // name 'The Apache Software License, Version 2.0' // url 'http://www.apache.org/licenses/LICENSE-2.0.txt' // } // } // developers { // developer { // id 'wyouflf' // // #CONFIG# // your user id (you can write your nickname) // name 'lei.jiao' // // #CONFIG# // your user name // email 'wyouflf@qq.com' // // #CONFIG# // your email // } // } // scm { // connection gitUrl // developerConnection gitUrl // url siteUrl // } // } // } // } //} //task sourcesJar(type: Jar) { // from android.sourceSets.main.java.srcDirs // classifier = 'sources' //} //task javadoc(type: Javadoc) { // options.encoding = "UTF-8" // source = android.sourceSets.main.java.srcDirs // classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) //} //task javadocJar(type: Jar, dependsOn: javadoc) { // classifier = 'javadoc' // from javadoc.destinationDir //} //artifacts { // archives javadocJar // archives sourcesJar //} //Properties properties = new Properties() //properties.load(project.rootProject.file('local.properties').newDataInputStream()) //bintray { // user = properties.getProperty("bintray.user") // key = properties.getProperty("bintray.apikey") // configurations = ['archives'] // pkg { // repo = "maven" // name = "xUtils" // // #CONFIG# project name in jcenter // websiteUrl = siteUrl // vcsUrl = gitUrl // licenses = ["Apache-2.0"] // publish = true // } //}第四步:修改xutils_sample的 build.gradle,修改红色字体的版本号,要与自己app的build.gradle版本号一致; apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion '25.0.0' defaultConfig { applicationId "org.xutils.sample" minSdkVersion 14 targetSdkVersion 22 // 不使用api23的动态权限策略 versionCode 1 versionName "1.0" } signingConfigs { debugConfig { storeFile file("debug.keystore") storePassword "android" keyAlias "androiddebugkey" keyPassword "android" } } buildTypes { release { debuggable false minifyEnabled true signingConfig signingConfigs.debugConfig proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } } dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') compile 'com.android.support:appcompat-v7:25.3.1' compile 'com.android.support:support-v4:25.3.1' compile 'com.android.support:recyclerview-v7:25.3.1' compile 'com.android.support:design:25.3.1' compile project(':xutils') } 第五步:将xutils库作为工程添加到自己app的build.gradle中,在File->Project Structure中选择APP,然后library中添加 初始化时导入: import org.xutils.x;

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

Kubernetes环境下的各种调试方法

启动单个容器 不使用Pod或Replication Controller,启动单个容器: $ kubectl run webserver --image=nginx 想更改镜像,又不想升级版本? 每次修改之后,需要更新镜像的版本也好烦人啊。每次构建出新的镜像,Push到Docker Registry时,可以使用一个固定的版本,然后让Kubernetes在启动某个镜像时,无论本地是否有镜像,都去Docker Registry拉取镜像就好了。 ImagePullPolicy从默认的 IfNotPresent,改为 Always。 想直接修改容器里的程序,又不想更新镜像? 什么,还能这样做?在容器内部修改,比如修改了脚本,或者直接替换二进制程序,然后使用docker restart container-id。我尝试过此时使用docker commit提交修改,但是下次启动时,Kubernets就会报错。应该是有完整性校验的原因。 Pod重启了,如何看重启之前的日志? 下面的命令只能看到当前Pod的日志: $ kubectl logs zookeeper-1 通过 --previous参数可以看之前Pod的日志 $ kubectl logs zookeeper-1 --previous 查看Pod生命周期的事件 通过如下命令,看命令末尾 events 一节,查看kubelet给APIServer发送的Pod生命周期里发生的事件 $ kubectl describe pod podname 没有看到任何事件,但是Pod重启了? 依然通过describe命令,Containers.[*].Last State一节: $ kubectl describe pod podname Name: kafka-1 ... Containers: kafka: ... State: Running Started: Sat, 08 Apr 2017 02:29:04 +0000 Last State: Terminated Reason: OOMKilled Exit Code: 0 Started: Fri, 07 Apr 2017 11:06:56 +0000 Finished: Sat, 08 Apr 2017 02:29:04 +0000 Ready: True Restart Count: 1 ... 可以看到 Kafka-1 这个Container因为内存消耗太多,达到内存的上限(Memory Resource Limit)而被干掉了。如果看到 Reason: Completed,说明是容器内部pid为1的程序主动退出的。 查看资源(CPU/Memory)使用情况 资源使用最多的节点 $ kubectl top nodes 资源使用最多的Pod $ kubectl top pods 查看节点的资源使用情况 $ kubectl describe nodes | grep -A 2 -e "^\\s*CPU Requests" 如何摘下某个Pod进行Debug 使用label机制,对Pod进行标记。在Service定义中,我们添加 status: serving字段。当需要摘下某个Pod做Debug,而又不影响整个服务,可以: $ kubectl get pods --selector="status=serving" $ kubectl label pods webserver-rc-lxag2 --overwrite status=debuging 此时kubelet就会把这个Pod从Service的后端列表中删掉。等到Debug完,想恢复?再改回去就好了: $ kubectl label pods webserver-rc-lxag2 --overwrite status=serving References: 10 most common reasons kuberntes deployments fail Kubernetes Community Resources

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

接口动态调用

spring配置文件配置 <"bean id="dt" class="DtClass" /> 调用方法 private ServiceOutput doClazzByBeanName(String beanName, ServiceInput input) throws ServiceException { ServiceOutput output = new CServiceOutput(input); try { ApplicationContext context = ApplicationContextUtil.getContext(); IServcieV2 service = (Servcie) context.getBean(beanName); output = service.doService(input); } catch (ServiceException e) { throw new ServiceException(ResultType.ErrorTip, "动态调用服务" + beanName + "异常"); } catch (Exception e) { throw new ServiceException(ResultType.ErrorTip, "动态获取服务" + beanName + "异常"); } return output; } ApplicationContextUtil类 import org.springframework.beans.BeansException;import org.springframework.context.ApplicationContext;import org.springframework.context.ApplicationContextAware; public class ApplicationContextUtil implements ApplicationContextAware { private static ApplicationContext context; public ApplicationContextUtil() { } public void setApplicationContext(ApplicationContext context) throws BeansException { context = context; } public static ApplicationContext getContext() { return context; } }

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

Nacos

Nacos

Nacos /nɑ:kəʊs/ 是 Dynamic Naming and Configuration Service 的首字母简称,一个易于构建 AI Agent 应用的动态服务发现、配置管理和AI智能体管理平台。Nacos 致力于帮助您发现、配置和管理微服务及AI智能体应用。Nacos 提供了一组简单易用的特性集,帮助您快速实现动态服务发现、服务配置、服务元数据、流量管理。Nacos 帮助您更敏捷和容易地构建、交付和管理微服务平台。

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文件系统,支持十年生命周期更新。

用户登录
用户注册