java

腾讯开源 iOS 内存监控组件和OOM检测工具

谁说胖子不能爱 提交于 2021-02-20 19:57:20
自阿里巴巴开源Android检测内存泄露工具 LeakCanary 后,腾讯开源了一个在iOS 内存监控组件和一个OOM检测工具。 MLeaksFinder MLeaksFinder 是腾讯开源的 iOS 平台的自动内存泄漏检测工具,引进 MLeaksFinder 后,就可以在日常的开发,调试业务逻辑的过程中自动地发现并警告内存泄漏。开发者无需打开 instrument 等工具,也无需为了找内存泄漏而去跑额外的流程。并且,由于开发者是在修改代码之后一跑业务逻辑就能发现内存泄漏的,这使得开发者能很快地意识到是哪里的代码写得问题。这种及时的内存泄漏的发现在很大的程度上降低了修复内存泄漏的成本。 特性: 自动检测内存泄漏和释放不及时的场景 构建泄漏对象相对于 ViewContrller 的引用链以帮助开发者定位问题 不侵入业务逻辑,引入即生效,无需修改任何代码或引入头文件 用法 MLeaksFinder 可自动查找 UIView 和 UIViewController 对象中的泄漏。当发生泄漏时,它会在 View-ViewController 堆栈中显示泄漏对象预警。 Memory Leak ( MyTableViewController , UITableView, UITableViewWrapperView, MyTableViewCell ) OOMDetector

浅谈导出Execl的报表数据解决方案

☆樱花仙子☆ 提交于 2021-02-20 19:54:34
项目中免不了要做一些数据导出功能,比如导出前一天的订单记录。涉及导出功能可大可小,根据系统具体的用户量、一天的订单量等情况。今天就讨论一下怎么设计一个合理的导出功能。 0x01:同步导出 这个方案最简单,就只需一个导出接口。这个接口只需实现根据用户条件到数据库查询相关数据,然后在应用程序中生成Execl电子表格,最后通过Response把生成的Execl电子表格回写到客户端即可 该方案简单,因为是同步导出,所以不适用大量数据导出。如果使用该方案进行大量数据导出的话,存在客户端(浏览器)超时的情况,导致导出失败;因为浏览器与Nginx之间有超时设置。 0x02:异步导出 异步导出一般需要设计三个接口。 第一个接口:开启一个线程对进行数据查询,并对查询到的数据进行Execl电子表格读写操作,同步返回导出状态标识; 第二个接口:查询第一个接口的完成状态,如果完成Execl电子表格操作,则返回true;否则返回false; 第三个接口:根据第二个接口返回的状态,如果返回true,就调用下载Execl电子表格;否则返回false的话继续轮询调用第二个接口,直到返回true; 这种方案比较耗服务器性能,因为需要第二个接口轮询应用服务器的导出状态,设置一个比较合理的轮询周期显得非常必要。另外,第一种方案和第二种方案都没有对导出的结果进行存库记录,如果要下载同样的数据,要整个流程重新走一遍

Java ---- 遍历链表(递归与非递归实现)

风格不统一 提交于 2021-02-20 19:30:13
package test; // 前序遍历的递归实现与非递归实现 import java.util.Stack; public class Test { public static void main(String[] args) { TreeNode[] node = new TreeNode[10]; // 以数组形式生成一棵完全二叉树 for ( int i = 0; i < 10; i++ ) { node[i] = new TreeNode(i); } for ( int i = 0; i < 10; i++ ) { if (i*2+1 < 10 ) node[i].left = node[i*2+1 ]; if (i*2+2 < 10 ) node[i].right = node[i*2+2 ]; } preOrderRe(node[ 0 ]); } public static void preOrderRe(TreeNode biTree) { // 递归实现 System.out.println(biTree.value); TreeNode leftTree = biTree.left; if (leftTree != null ) { preOrderRe(leftTree); } TreeNode rightTree = biTree.right; if

Java程序员养成日记一(计算机基础)2.20

烂漫一生 提交于 2021-02-20 19:28:29
参照博客 java程序员技能树 (如有侵权马上删除) 经典回顾 操作系统( operation system OS) 简介 操作系统(operation system,简称OS)是管理 计算机硬件 与 软件 资源的 计算机程序 。操作系统需要处理如管理与配置 内存 、决定 系统资源 供需的优先次序、控制 输入设备 与 输出设备 、操作网络与管理文件系统等基本事务。操作系统也提供一个让用户与系统交互的操作界面。 主要的操作系统 嵌入式( VxWorks 、 eCos 、 Symbian OS 及 Palm OS 、 iOS 、 Android ) 类 Unix( System V 、 BSD 与 Linux ) Microsoft Windows( Windows XP 、 Windows 7 、 Windows 10 、) MacOS X( MacOS 和MacOS X ) Google Chrome OS( Google的轻型的、基于网络的计算机操作系统计划 ) 编译原理 基本概念 编译原理即是对高级程序语言进行翻译的一门科学技术, 我们都知道计算机程序由 程序语言 编写而成, 在早期计算机程序语言发展较为缓慢, 因为计算机存储的数据和执行的程序都是由0、1代码组合而成的,

Try-catch creates infinite loop [duplicate]

只谈情不闲聊 提交于 2021-02-20 19:08:39
问题 This question already has answers here : Endless while loop problem with try/catch (2 answers) Closed 5 years ago . I need to be able to take user input until the input is greater than the initial price, but I also need to make it robust so that the user can't break the program by entering something other than a double/integer. If the user does enter something other than a double/int. The problem is that it creates a loop and repeats "Please enter valid currency" + "Please enter: price"

visualvm - Local java applications cannot be detected

柔情痞子 提交于 2021-02-20 18:55:23
问题 I am trying to run visualvm in my Windows 8 machine and i am getting error 'Local java applications cannot be detected'. I tried to follow the below steps to resolve the issue as suggested in 'https://visualvm.github.io/troubleshooting.html'. I gave full permission to my 'AppData\Local\Temp\hsperfdata_Dhasan' folder. But still i am getting the same error whenever i start visualvm. Please help me to fix this issue. Thanks. 回答1: Quit all java applications and delete hsperfdata_Dhasan folder. 来源

Dynamic programming problems solution to interleaving strings

你。 提交于 2021-02-20 18:52:08
问题 I was trying to solve this problem, and I gave up, and found the solution below, although I do not understand how the solution works, or why it works. Any in-depth solution would be deeply appreciated. Question: Given s1 , s2 , s3 , find whether s3 is formed by the interleaving of s1 and s2 . For example, Given: s1 = "aabcc" s2 = "dbbca" When s3 = "aadbbcbcac" , return true. When s3 = "aadbbbaccc" , return false. Solution: public static boolean isInterleave(String s1, String s2, String s3) {

Programmatically update certificates in tomcat 8 without server restart

扶醉桌前 提交于 2021-02-20 18:50:10
问题 In order to update the certificate that I use for SSL for my server I have a code that does the import\export and validation that I need. It works well, but In order for the changes to take effect I have to restart the tomcat. I wish to avoid the restart, and update it without using external tools (keytool for example). I looked up for some similar questions, and found a solution - restarting the 443 connector. I'm able to do so, and the connector is stopping and starting, but the certificate

sonarqube 6.3 error could-not-complete-symbolic-execution-reached-limit-of-16000 steps

谁都会走 提交于 2021-02-20 18:48:34
问题 We have a scan that aborts on the code below, with the exception: org.sonar.java.se.ExplodedGraphWalker$MaximumStepsReachedException: reached limit of 16000 steps for method getServiceProviders#151 in class ServiceProviderService We looked at rules S2259 and S2583 and would like to keep notifications about null pointers. This happens in both "regular" and debug (-X) mode, so it's not issue 1406. In our case it really seems to be related to try/catch. (See sample method below.) Could it be a

sonarqube 6.3 error could-not-complete-symbolic-execution-reached-limit-of-16000 steps

泄露秘密 提交于 2021-02-20 18:47:14
问题 We have a scan that aborts on the code below, with the exception: org.sonar.java.se.ExplodedGraphWalker$MaximumStepsReachedException: reached limit of 16000 steps for method getServiceProviders#151 in class ServiceProviderService We looked at rules S2259 and S2583 and would like to keep notifications about null pointers. This happens in both "regular" and debug (-X) mode, so it's not issue 1406. In our case it really seems to be related to try/catch. (See sample method below.) Could it be a