从零开始JVM(一):初探JVM运行时数据区域

2021-10-24
阅读 5 分钟
2.4k
最近重新开始阅读《深入了解Java虚拟机》这本书,就想着用一个系列文章来记录和分享自己的心得。为什么要说”重新“呢?是因为这本书我在多年前就买了,中间也曾翻来覆去的看过。这个”翻来覆去“可以说是非常的生动形象,因为我不仅从前往后看,也从后往前看了这本书。但是,这并不是一个值得骄傲的过程,因为我之前看的时...
封面图

猫头鹰的深夜翻译:开发者最常踩到的六个低效陷阱

2021-10-04
阅读 3 分钟
2.2k
每个企业都试图通过自动化流水线,升级版IDE和DevOps来降低成本提高效能。而通过避免以下六种低效陷阱可以让你的领先一步,收获高效的一天。

一劳永逸的优化!并发RPC调用小工具

2021-10-04
阅读 8 分钟
2.9k
系统的性能优化是每一个程序员的必经之路,但也可能是走过的最深的套路。它不仅需要对各种工具的深入了解,有时还需要结合具体的业务场景得出定制化的优化方案。当然,你也可以在代码中悄悄藏上一个Thread.sleep,在需要优化的时候少睡几毫秒(手动狗头)。性能优化这个课题实在是太浩瀚了,以至于目前市面上没有一本优...

日志分析常规操作

2021-10-02
阅读 7 分钟
6.2k
日志是开发者用来分析程序和排查问题的重要工具。随着系统架构从早期的单体应用,演变到如今的微服务架构,日志的重要性也逐步提升。除了用日志辅助问题排查,还可以通过日志对微服务请求的全链路进行性能分析,甚至可以它用来解决分布式系统中的一致性问题。与此同时,系统产生的日志量和日志管理难度也显著增加。于是...
封面图

猫头鹰的深夜翻译:趣谈Java Exception

2021-10-01
阅读 3 分钟
2.4k
Java异常类(Exception)是用来处理异常程序行为的一组类。在这篇文章中,我将介绍如何使用Java异常类,以及在程序中如何设计Java异常体系。Exception类是Java体系中非常重要的一环,每一个程序员都必须熟悉并掌握它。

Mybatis Generator Plugin悲观锁实现

2021-09-27
阅读 12 分钟
4.4k
Mybatis Generator插件可以快速的实现基础的数据库CRUD操作,它同时支持JAVA语言和Kotlin语言,将程序员从重复的Mapper和Dao层代码编写中释放出来。Mybatis Generator可以自动生成大部分的SQL代码,如update,updateSelectively,insert,insertSelectively,select语句等。但是,当程序中需要SQL不在自动生成的SQL范围...

记一次PageHelper分页未生效问题排查

2021-09-03
阅读 12 分钟
4.7k
排查的时候发现,count代码通过mybatis生成的sql语句中包含了分页参数,但是select语句却没有,因此将查询数据列表的请求放在计算总数据行数前面即可解决这个问题。

记一次logback配置文件未生效问题排查

2021-08-30
阅读 8 分钟
11.4k
最近在公司新建了一个JAVA微服务,采用的是springboot框架,logback作为日志模块的实现。在搭建的的过程中想起之前在文档中看到springboot支持用logback-spring.xml作为定制的logback配置文件。在这个文件中可以使用spring的定制化标签,比如可以根据当前生效的profile对日志文件进行配置,从而省去配置多份日志文件并在...

每个开发必须了解的Unicode和字符集的那些事!

2021-03-27
阅读 6 分钟
1.8k
我很失望的发现有非常多的软件开发者并不了解字符集,编码,unicode等相关的知识。几年前, FogBUGZ网站的一个测试人员想要知道它是否能够成功接收来自日本的邮件。日本?日本也要用这个邮件系统?我一头雾水。在仔细研究用来解析MIME邮件消息的商业ActiveX控制器后,发现它解析字符集的方式是完全错误的,所以我们不得...

leetcode460. LFU Cache

2020-02-02
阅读 3 分钟
2.3k
Design and implement a data structure for Least Frequently Used (LFU) cache. It should support the following operations: get and put.

leetcode495. Teemo Attacking

2020-02-01
阅读 2 分钟
2k
In LOL world, there is a hero called Teemo and his attacking can make his enemy Ashe be in poisoned condition. Now, given the Teemo's attacking ascending time series towards Ashe and the poisoning time duration per Teemo's attacking, you need to output the total time that Ashe is in poisoned cond...

leetcode543. Diameter of Binary Tree

2020-02-01
阅读 1 分钟
2k
Given a binary tree, you need to compute the length of the diameter of the tree. The diameter of a binary tree is the length of the longest path between any two nodes in a tree. This path may or may not pass through the root.

leetcode540. Single Element in a Sorted Array

2020-02-01
阅读 2 分钟
2k
You are given a sorted array consisting of only integers where every element appears exactly twice, except for one element which appears exactly once. Find this single element that appears only once.

leetcode535. Encode and Decode TinyURL

2020-01-30
阅读 2 分钟
3k
TinyURL is a URL shortening service where you enter a URL such as https://leetcode.com/problems/design-tinyurl and it returns a short URL such as http://tinyurl.com/4e9iAk.

leetcode529. Minesweeper

2020-01-29
阅读 5 分钟
2.2k
You are given a 2D char matrix representing the game board. 'M' represents an unrevealed mine,'E' represents an unrevealed empty square, 'B' represents a revealed blank square that has no adjacent (above, below, left, right, and all 4 diagonals) mines, digit ('1' to '8') represents how many mines...

leetcode542. 01 Matrix

2020-01-27
阅读 4 分钟
2.4k
Given a matrix consists of 0 and 1, find the distance of the nearest 0 for each cell.

leetcode554. Brick Wall

2020-01-26
阅读 2 分钟
2.2k
There is a brick wall in front of you. The wall is rectangular and has several rows of bricks. The bricks have the same height but different width. You want to draw a vertical line from the top to the bottom and cross the least bricks.

leetcode538. Convert BST to Greater Tree

2020-01-26
阅读 2 分钟
2.2k
Given a Binary Search Tree (BST), convert it to a Greater Tree such that every key of the original BST is changed to the original key plus sum of all keys greater than the original key in BST.

547. Friend Circles

2020-01-19
阅读 3 分钟
2.7k
There are N students in a class. Some of them are friends, while some are not. Their friendship is transitive in nature. For example, if A is a direct friend of B, and B is a direct friend of C, then A is an indirect friend of C. And we defined a friend circle is a group of students who are direc...

leetcode525. Contiguous Array

2020-01-18
阅读 2 分钟
2k
Given a binary array, find the maximum length of a contiguous subarray with equal number of 0 and 1.

leetcode502. IPO

2020-01-09
阅读 4 分钟
2.1k
Suppose LeetCode will start its IPO soon. In order to sell a good price of its shares to Venture Capital, LeetCode would like to work on some projects to increase its capital before the IPO. Since it has limited resources, it can only finish at most k distinct projects before the IPO. Help LeetCo...

MYSQL锁学习笔记

2020-01-08
阅读 5 分钟
3.2k
MYSQL是在大小公司中使用率极高的开源的关系型数据库,以其良好的易用性和在分布式场景下的高性能而著称,也是所有新手在数据库入门时的产品首选。最近因为听了公司的一位师兄关于MYSQL InnoDB锁的讲座,收获很多,所以将MYSQL锁相关的必备知识在此进行梳理。这些知识不仅可以帮助面试,也可以在日常开发进行性能优化或...

leetcode556. Next Greater Element III

2020-01-07
阅读 2 分钟
2.1k
Given a positive 32-bit integer n, you need to find the smallest 32-bit integer which has exactly the same digits existing in the integer n and is greater in value than n. If no such positive 32-bit integer exists, you need to return -1.

leetcode523. Continuous Subarray Sum

2019-12-31
阅读 3 分钟
1.9k
Given a list of non-negative numbers and a target integer k, write a function to check if the array has a continuous subarray of size at least 2 that sums up to a multiple of k, that is, sums up to n*k where n is also an integer.

leetcode503. Next Greater Element II

2019-12-28
阅读 2 分钟
1.9k
Given a circular array (the next element of the last element is the first element of the array), print the Next Greater Number for every element. The Next Greater Number of a number x is the first greater number to its traversing-order next in the array, which means you could search circularly to...

leetcode519. Random Flip Matrix

2019-12-05
阅读 3 分钟
2.3k
You are given the number of rows n_rows and number of columns n_cols of a 2D binary matrix where all values are initially 0. Write a function flip which chooses a 0 value uniformly at random, changes it to 1, and then returns the position [row.id, col.id] of that value. Also, write a function res...

leetcode464. Can I Win

2019-11-30
阅读 3 分钟
2.7k
In the "100 game," two players take turns adding, to a running total, any integer from 1..10. The player who first causes the running total to reach or exceed 100 wins.

leetcode516. Longest Palindromic Subsequence

2019-11-26
阅读 2 分钟
2.3k
Given a string s, find the longest palindromic subsequence's length in s. You may assume that the maximum length of s is 1000.

leetcode480. Sliding Window Median

2019-11-24
阅读 5 分钟
1.8k
Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.

513. Find Bottom Left Tree Value

2019-11-17
阅读 1 分钟
1.5k
Given a binary tree, find the leftmost value in the last row of the tree.