不会飞的章鱼

熟能生巧,勤能补拙;念念不忘,必有回响。

什么是Yapi

YApi 是由去哪儿移动架构组推出的一款开源项目,是高效、易用、功能强大的 api 管理平台,旨在为开发、产品、测试人员提供更优雅的接口管理服务。

官网:https://yapi.ymfe.org/,Yapi具有以下功能特性

权限管理

扁平化权限设计,即保证了大型企业级项目的管理,又保证了易用性。

阅读全文 »

k8s基本介绍

什么是k8s

  • k8s是谷歌开源的容器集群管理系统
  • 可以简化应用程序的工作流,加快开发速度

为什么需要k8s

  • 真正的生产型应用会涉及多个容器
  • 容器必须跨多个服务器主机进行部署
  • 借助k8s构建多个容器的应用服务、跨集群调度、扩展这些容器
阅读全文 »

介绍

Nebula Graph 是一款开源的、分布式的、易扩展的原生图数据库,能够承载数千亿个点和数万亿条边的超大规模数据集,并且提供毫秒级查询。

图数据库是专门存储庞大的图形网络并从中检索信息的数据库。它可以将图中的数据高效存储为点(Vertex)和边(Edge),还可以将属性(Property)附加到点和边上。

阅读全文 »

Swagger 介绍

Swagger 是一套围绕 OpenAPI 规范构建的开源工具,可以设计、构建、编写和使用REST API。Swagger 包含很多工具,其中主要的 Swagger 工具包括:

  • Swagger 编辑器:基于浏览器的编辑器,可以在其中编写 OpenAPI 规范,并实时预览API 文档。https://editor.swagger.io 就是一个 Swagger 编辑器,你可以尝试在其中编辑和预览 API 文档。
  • Swagger UI:将 OpenAPI 规范呈现为交互式 API 文档,并可以在浏览器中尝试 API调用。
  • Swagger Codegen:根据 OpenAPI 规范,生成服务器存根和客户端代码库,目前已涵盖了 40 多种语言。

Swagger 和 OpenAPI 的区别

OpenAPI 是一个 API 规范,它的前身叫 Swagger 规范,通过定义一种用来描述 API 格式或 API 定义的语言,来规范 RESTful 服务开发过程,目前最新的 OpenAPI 规范是OpenAPI 3.0(也就是 Swagger 2.0 规范)。

阅读全文 »

Java 基础语法:语法、变量与运算

2160 · 打印 “Hello Java”

1
2
3
4
5
6
7
8
9
public class Solution {
/* Your first java code
* print Hello Java to console
*/
public static void main(String[] args) {
// write your code here
System.out.print("Hello Java");
}
}

2157 · 打印 Welcome to LintCode!

1
2
3
4
5
6
public class Solution {
public static void main(String[] args) {
// write your code here
System.out.print("Welcome to LintCode!");
}
}
阅读全文 »

关于Casbin

Casbin是用于Golang项目的功能强大且高效的开源访问控制库。
casbin中文官方文档

Casbin的作用

  • 以经典{subject, object, action}形式或您定义的自定义形式实施策略,同时支持允许和拒绝授权。
  • 处理访问控制模型及其策略的存储。
  • 管理角色用户映射和角色角色映射(RBAC中的角色层次结构)。
  • 支持内置的超级用户,例如root或administrator。超级用户可以在没有显式权限的情况下执行任何操作。
  • 多个内置运算符支持规则匹配。例如,keyMatch可以将资源键映射/foo/bar到模式/foo*。

Casbin不执行的操作

阅读全文 »

SQL 教程链接:https://www.lintcode.com/learn

LEVEL1:

  • 2045 · Output Hello LintCode

    1
    SELECT "Hello LintCode!";
  • 2013 · Check the name of the teacher

    1
    SELECT `name` FROM `teachers`
  • 2007 · Check course name and class size

    1
    SELECT `name`,`student_count` FROM courses
  • 2009 · Query all teachers

    1
    SELECT * FROM `teachers`
  • 1981 · Check the nationality of all teachers

    1
    SELECT DISTINCT country FROM teachers
  • 2011.Search for information on courses with more than 1000 participants

    1
    SELECT * FROM `courses` WHERE `student_count`>1000
  • 2012 · Find course information for the course named Artificial Intelligence

    1
    SELECT * FROM courses WHERE `name`= 'Artificial Intelligence';
  • 2017 · Inserting SQL course information into the course table

    1
    INSERT INTO courses VALUES (14,"SQL",200,"2021-02-25",1)
  • 2021 · Insert teacher information into the specified column of the teachers table

    1
    2
    INSERT INTO `teachers` (`name`,`email`,`age`,`country`) VALUES
    ('XiaoFu','XiaoFu@lintcode.com',20,'CN');
  • 2020 · Update on the number of students choosing artificial intelligence

    1
    UPDATE `courses` SET `student_count`=500 WHERE `name`='Artificial Intelligence'
  • 2004 · Delete all courses until 2020

    1
    DELETE FROM `courses` WHERE `created_at`<'2020-1-1'
  • 2019 · Delete all rows in the table

    1
    DELETE FROM `courses`

LEVEL2:

  • 1952 · Query teachers over 20 years old

    1
    SELECT * FROM `teachers` WHERE `age`>20
  • 1953 · Query the name of the Chinese teacher

    1
    SELECT `name` FROM `teachers` WHERE `country`='CN'
  • 1957 · Inquire about courses starting before May 2020

    1
    SELECT `name`,`created_at` FROM `courses` WHERE `created_at`>='2020-1-1' AND `created_at`<'2020-5-1'
  • 1958 · Query the courses that meet the conditions taught by the specified teacher

    1
    SELECT * FROM `courses` WHERE `teacher_id`=4 AND `student_count`>500
  • 2001 · Query the course information of ‘Web’ or ‘Big Data’

    1
    SELECT * FROM `courses`WHERE `name`='Web' OR `name`='Big Data';
  • 2040 · Search for courses with an instructor id of less than 3 and more than 800 students

    1
    SELECT * FROM `courses` WHERE (NOT `teacher_id`=3) AND (`student_count`>800);
  • 1960 · Query course information for a specific time

    1
    SELECT * FROM `courses` WHERE created_at IN ('2021-1-1','2021-1-3')
  • 1962 · Query courses with teacher id other than 1 and 3

    1
    SELECT `name` FROM courses WHERE `teacher_id` NOT IN(1,3)
  • 1964 · Query for course information about the number of students within the specified range

    1
    SELECT * FROM `courses` WHERE `student_count` BETWEEN 50 AND 55;
  • 1972 · Inquire about Chinese and Japanese teachers who have e-mail addresses

    1
    SELECT * FROM teachers WHERE (email IS NOT NULL) AND (`country`='CN' OR `country`='JP');
  • 1974 · Query teacher information by email

    1
    SELECT `name`,`email` FROM `teachers` WHERE `email` LIKE '%@qq.com';
  • 1982 · Check the age of teachers and sort them in ascending order

    1
    SELECT DISTINCT `age` FROM `teachers` ORDER BY `age`;
  • 1977 · Sorted by age of Chinese teachers in descending order

    1
    SELECT * FROM `teachers` WHERE `country`='CN' ORDER BY `age` DESC;
  • 1980 · Search for the oldest Chinese teacher

    1
    SELECT * FROM `teachers` WHERE `country`='CN' ORDER BY `age` DESC LIMIT 1;
阅读全文 »

题目链接

322. 零钱兑换

解法一:贪心算法

贪心算法,就是指它的每一步计算作出的都是在当前看起来最好的选择,也就是说它所作出的选择只是在某种意义上的局部最优选择,并不从整体最优考虑。

基本思路:
1,根据问题来建立数学模型,一般面试题会定义一个简单模型;
2,把待求解问题划分成若干个子问题,对每个子问题进行求解,得到子问题的局部最优解;
3,把子问题的局部最优解进行合并,得到最后基于局部最优解的一个解,即原问题的答案。

阅读全文 »

坏味道

缺乏业务含义的命名

错误命名

  • 宽泛的命名
  • 用技术术语命名

命名遵循的原则

阅读全文 »