The problem that Phragmén’s methods try to solve is that of electing a set of a given numbers of persons from a larger set of candidates. Phragmén discussed this in the context of a parliamentary election in a multi-member constituency; the same problem can, of course, also occur in local elections, but also in many other situations such as electing a board or a committee in an organization.
Nest介绍
Nest 基础功能 —— Module
Nest 主要特性中的模块化开发,就源自与此。Nest 使用 Module 来组织应用程序结构,每个应用程序至少有一个模块,即根模块。根模块是 Nest 开始排列应用程序树的地方。事实上,根模块可能是应用程序中唯一的模块,尤其是当应用程序很小时。然而,对于大型应用来说,这是没有意义的。在大多数情况下,您将有很多模块,每个模块都有一组与其密切相关的功能。
Introduction to mxgraph
业务背景
业务流程图在线绘制需求在业务场景中广泛存在,常用业务需求如下:
流程图框架需求列表
| 需求名称 | 优先级 |
|---|---|
| 批量圈选(图形&连线圈选) | P0 |
| 拉伸 | P0 |
| 元素形状定制 | P0 |
| 元素样式定制(图形、连线) | P0 |
| 批量拖拽 | P0 |
| 母子节点拖拽 | P0 |
| 批量圈选添加连线 | P0 |
| 左侧可拖拽组件在画布中展现可所见不所得 | P0 |
| 右键功能定制 | P0 |
| 双击功能定制 | P0 |
| 每一个vertex一个独立id | P0 |
| 某条线或节点或锚点高亮 | P0 |
| 重命名 | P0 |
| 自动布局 | P1 |
| 滚动时始终保持有一部分在可视范围 | P1 |
| 快捷键批量选择 | P1 |
| 动画(连线数据流动画) | P1 |
| 双击编辑 | P1 |
| 100%自适应 | P1 |
| 文字缩小极值(保证文字可识别) | P1 |
| 锚点定制 | P1 |
| ctrl+z 回退 | P1 |
| 连线自动对齐 | P1 |
目前市面上比较流行的流程图绘图框架大致有 jointjs、jsplumb、mxgraph、bpmnjs、antv g6 等。对以上框架进行技术调研,从商业版权、易用性、功能完善性、可定制性、浏览器兼容性、社区支持方面进行评估,大致得出如下结果:
Introduction to nestjs
代码分析
入口main.ts
import { NestFactory } from '@nestjs/core';
import { ApplicationModule } from './app.module';
async function bootstrap() {
const app = await NestFactory.create(ApplicationModule);
await app.listen(3000);
}
bootstrap();
NestFactory构造
public async create(
module: any,
serverOrOptions?: any,
options?: NestApplicationOptions,
): Promise<
INestApplication & (INestExpressApplication | INestFastifyApplication)
> {
const isHttpServer = serverOrOptions && serverOrOptions.patch;
// tslint:disable-next-line:prefer-const
let [httpServer, appOptions] = isHttpServer
? [serverOrOptions, options]
: [ExpressFactory.create()/* 默认使用Express*/, serverOrOptions];
const applicationConfig = new ApplicationConfig();
const container = new NestContainer(applicationConfig);//生成容器container;传入了配置对象
httpServer = this.applyExpressAdapter(httpServer);//初始化http服务
this.applyLogger(appOptions);//日志输出对象
await this.initialize(module, container, applicationConfig, httpServer);
return this.createNestInstance<NestApplication>(
new NestApplication(container, httpServer, applicationConfig, appOptions),
);
}
- 第一个参数是使用是传入的类似angularmodule的对象
- 第二个参数可以是设置参数,也可以是类似express的MVC,如官网提到的fastify,覆盖默认使用的express
- 第三个参数就是设置参数
初始化模块
Introduction to Skynet
代码结构
首先要关注一下config.path文件。
skynet/example/config.path
root = "./"
luaservice = root.."service/?.lua;"..root.."test/?.lua;"..root.."examples/?.lua;"..root.."test/?/init.lua"
lualoader = root .. "lualib/loader.lua"
lua_path = root.."lualib/?.lua;"..root.."lualib/?/init.lua"
lua_cpath = root .. "luaclib/?.so"
snax = root.."examples/?.lua;"..root.."test/?.lua"
root代表的是skynet所在的目录。 luaservice代表服务所在的目录。 lualoader 用哪一段 lua 代码加载 lua 服务。通常配置为 lualib/loader.lua ,再由这段代码解析服务名称,进一步加载 lua 代码。不用去修改它。 lua_path和lua_cpath代表require要加载的文件所在的目录。 snax代表使用snax框架写的服务所在的目录。
Introduction to Go Modules
The upcoming version 1.11 of the Go programming language will bring experimental support for modules, a new dependency management system for Go.A few days ago, I wrote a quick post about it. Since that post went live, things changed a bit and as we’re now very close to the new release, I thought it would be a good time for another post with a more hands-on approach.So here’s what we’ll do: we’ll create a new package and then we’ll make a few releases to see how that would work.
Build Your Own Blockchains in JavaScript from Zero
Build Your Own Blockchains in JavaScript from Zero (Scratch)
prometheus v2.0 storage
Writing a Time Series Database from Scratch
lex-yacc
lex是一种词法分析器,可以识别文本中的词汇模式,模式可以用正则表达式表示。通过lex编译l文件(词法文件)就可以生产对应的c代码.lex可以参数一系列标记,如果我们想当某个标记序列出现时执行某一动作,该怎么实现呢?Yacc该出场了。通过yacc编译y文件(语法文件)就可以产生对应的c程序了
gotour code analysis
GoTour as a web project to study golang