本文记录了 INVALID_STATE_ERR 排查过程。项目前端使用 SAPUI5 开发,运行集成测试时,所有的 AJAX 请求都会被 Mock。今天遇到一个问题,一些 URL 改动后集成测试运行失败, 报了个 INVALID_STATE_ERR 的错误。

Read more »

Cache is a hardware or software component that stores data so that future requests for that data can be served faster.

按照维基百科的定义,缓存是一种用来存储数据的硬件或者软件,它使得后续的信息传输更快。

Read more »

LRU 概述

This algorithm requires keeping track of what was used when, which is expensive if one wants to make sure the algorithm always discards the least recently used item. General implementations of this technique require keeping “age bits” for cache-lines and track the “Least Recently Used” cache-line based on age-bits. – from Wikipedia

LRU 算法的思想是淘汰最近没有使用的缓存。

Read more »

女朋友最近在学习 wireshark 时候问了我一个问题:为什么使用 http.host == baidu.com 过滤不到请求数据?

明明已经在 Chrome 上输入了 baidu.com,也看到返回结果了,为什么通过 http.host == baidu.com 过滤不到数据包呢?

Read more »

描述

给定一个数组,删除部分元素使得所有元素最多重复两次。

Example 1:

1
2
3
4
5
Given nums = [1,1,1,2,2,3],

Your function should return length = 5, with the first five elements of nums being 1, 1, 2, 2 and 3 respectively.

It doesn't matter what you leave beyond the returned length.
Read more »

描述

题目描述 - https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers
给定一个数组 nums 和整数 k,判断是否将数组 nums 分成有 k 个连续数字组成的若干子数组。

Example 1:

1
2
3
Input: nums = [1,2,3,3,4,4,5,6], k = 4
Output: true
Explanation: Array can be divided into [1,2,3,4] and [3,4,5,6].

Example 2:

1
2
3
Input: nums = [1,2,3,4], k = 3
Output: false
Explanation: Each array should be divided in subarrays of size 3.
Read more »

描述

在给定的 2D 平面 board 中搜索单词 word,可以在垂直相邻和水平相邻方向进行深度搜索,如果找到返回 True,否则返回 False。

1
2
3
4
5
6
7
8
9
10
board =
[
['A','B','C','E'],
['S','F','C','S'],
['A','D','E','E']
]

Given word = "ABCCED", return true.
Given word = "SEE", return true.
Given word = "ABCB", return false.
Read more »
0%