0x00. OpenAPI 简介

在之前的文章 Restful API 设计指导 中,我介绍了如何设计 Restful API。随着前后端的分离以及软件架构的复杂化,你是否也遇到过以下的一个或者多个问题呢?

  1. API 的设计和实现并非同一个人。无论是在大型互联网架构中还是复杂的软件开发中,API 的设计往往是有架构师、资深工程师、PM 等这些经验丰富的人负责。一旦设计完成,才将具体的开发任务分配给相应的 API 开发工程师。
  2. API 有完整的测试。越是复杂的产品,对产品的质量有越高的要求,一般而言会有专门的测试团队对 API 进行完整的自动化测试。
  3. 前端开发工程师(或者 API 的调用方)和 API 工程师协同开发,因此前端工程师需要 Mock API 以解除对 API 开发进度的依赖。
Read more »

本文记录了一个前端按钮没有按照正常逻辑显示的 Debug 过程。有一个容器中有三个 Tile,如下定义容器的三种显示状态:三个 Tile 可以并列显示在一排时的状态为 Normal;当三个 Tile 无法一排显示在一排,其中有一个或者两个 Tile 处于 Overflow 的状态为 Collapsed;三个 Tile 显示在多排的状态为 Expanded。

Read more »

本文记录了 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 »
0%