6-数据链路层-介质访问控制子层
介质访问控制子层(MAC子层)概述MAC子层要解决的问题1. 介质的多路访问控制/介质访问控制MAC2. 数据通信方式(单播/广播/组播)
单播(unicast):一对一的通信,是客户端与服务器之间的点到点连接
广播(broadcast):一堆所有的通信,发出的信息,要送达到所有对象
组播(multicast):一对一个组的通信,发出的信息送达到特定组的用户
局域网中采用了共享传输介质的方式来降低成本,共享传输介质上通常采用的就是广播的通信方式
广播网络面临问题一条信道上有多个站点,所以会出现在共享信道(多路访问信道,广播信道)上同时有两个甚至更多的站点同时请求占用网络解决方法:介质的多路访问控制:在多路访问信道上确定下一个使用者(分配信道)
分配信道方式:
静态分配:预先分配信道给用户,对于不同用户也采用相同的信道分配方式
动态分配:信道开放,没有预分配,按照需求临时分配给用户
静态分配已经学习过的静态分配方式:
频分多路复用 FDM(Frequency Division Multiplexing)
时分多路复用 TDM(Time Division Multiplexing ...
5-网络层(下)
链路状态路由选择(Link State Routing)简称LS距离矢量路由法由于不能从全局把握问题,只能从邻居节点获取信息导致了无穷计数,路由环等问题
这些问题可以通过链路状态路由选择加以解决
LS主要思想
发现:发现邻居节点,了解它们的网络地址
设置:设置规定到每个邻居的成本度量
构造:构造分组,包含所了解到的所有信息
发送:将这个分组发送给其他路由器
计算:计算到每个路由器的最短路径
发现发现邻居节点当一个路由器启动时,会向每条点对点线路发送一个特别的HELLO分组,收到HELLO分组的路由器会回送一个应答,应答中包含自己的名字(采用全球唯一的一个名字Globally Unique Name)
设置设置链路成本(开销/量度/代价)可以自动发现设置或是采用人工设置,常见的量度是设置为与链路带宽成反比
延迟也可以作为量度
路由器会发送一个特别的ECHO分组,另一端立刻回送一个应答
通过测量往返时间RTT,可以获得一个合理的延迟估计值
可以通过多次测量,取平均值,保证结果有效性
构造构造链路状态分组:Link State Packet/Adevertisement(LSP/LSA) ...
1-区块链基础概述
1-区块链基础概述
区块链(英语:blockchain或block chain)是借由密码学串接并保护内容的串连文字记录(又称区块)。每一个区块包含了前一个区块的加密散列、相应时间戳记以及交易资料(通常用默克尔树(Merkle tree)算法计算的散列值表示),这样的设计使得区块内容具有难以篡改的特性。用区块链技术所串接的分布式账本能让两方有效记录交易,且可永久查验此交易。目前区块链技术最大的应用是数字货币,例如比特币的发明。
比特币(英语:Bitcoin,缩写:BTC 或 XBT)是一种基于去中心化,采用点对点网络与共识主动性,开放源代码,以区块链作为底层技术的加密货币,比特币由中本聪(网名)(Satoshi Nakamoto)于2008年10月31日发表论文,2009年1月3日,创世区块诞生。在某些国家、央行、政府机关则将比特币视为虚拟商品,而不认为是货币。
区块链结构在加密货币应用中,区块链结构的作用就是用作账本,每一个区块都是一页账册,它们相互之间通过哈希值进行连接形成一条完整有序的链表,每个区块的头部哈希是它们的唯一标识。
从上面的区块链结构可以看得出,一个区块由主要 ...
基于tio实现P2P网络
基于tio实现P2P网络结构导入相关依赖1234567891011121314151617181920212223<!-- swagger API框架--><dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.9.2</version></dependency><dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger-ui</artifactId> <version>2.9.2</version></dependency><!-- tio Network framework 基于JVM的网络编程框架--> ...
Swagger技术概述
Swagger技术概述Swagger出现的原因,很大程度上是由于前后端开发人员对于接口文档,无法做到高效的同步。前端人员苦于接口文档老旧,更新不及时,后端人员苦于在任务外另外维护接口文档。故而随着项目开发时间的推移,就导致项目的接口文档老旧,使用性差等问题暴露出来。
为解决这一问题而出现的Swagger,通过总结规范,开发项目工具,实现生成各种格式的接口文档,生成多种语言的客户端和服务端的代码,以及在线接口调试页面等。按照新的开发模式,在开发新版本或者迭代版本的时候,只需要更新Swagger描述文件,就可以自动生成接口文档和客户端服务端代码,做到调用端代码、服务端代码以及接口文档的一致性。
Swagger开发流程1. 在SpringBoot项目中引入相关依赖1234567891011<!-- swagger API框架--><dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> ...
4-基于SpringBoot的Web开发
基于SpringBoot的Web开发流程静态资源的导入SpringBoot项目中的静态资源有两种访问方式
通过webjars访问首先引入相关依赖
12345678910<dependency><!--Webjars版本定位工具(前端)--> <groupId>org.webjars</groupId> <artifactId>webjars-locator-core</artifactId></dependency><dependency><!--Jquery组件(前端)--> <groupId>org.webjars</groupId> <artifactId>jquery</artifactId> <version>3.3.1</version></dependency>
根据webjars路径访问静态资源,快速访问:http://localhost:8080/ ...
3-Lombok应用
Lombok应用在SpringBoot中整合SSM项目的过程中,不可避免的涉及对数据库的操作,既然有对数据库的操作就必然包括依据数据库结构创建POJO,而POJO创建过程重复度高,并且使得代码看起来冗杂,这种情况下可以通过使用Lombok插件,通过注解的方式,简化POJO的创建过程
使用过程1. 在IDEA中安装Lombok插件
2. 添加Lombok对应的依赖到项目pom.xml文件中1234<dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId></dependency>
3. 改造实体类,使用Lombok方式配置基本注解
@Data:自动提供getter和setter,hashCode,equals,toString等方法
@Getter:自动提供Getter方法
@Setter:自动提供Setter方法
@Slf4j:自动在bean中提供log变量(本质还是使用slf4j的日志功能)
...
14-关系代数Relation Algebra
关系代数Relation Algebra概述
关系代数是一种抽象的查询语言,用对关系的运算来表达查询,作为研究关系数据语言的数学工具。关系代数的运算对象是关系(集合),运算结果亦为关系(集合)。
传统的集合运算:广义笛卡尔积运算,并,交和差运算
专门的关系运算:选择,投影,连接和除运算
传统的集合运算基本概念设关系模式为$R(A_1,A_2,…,A_n)$
R表示关系模式$R(A_1,A_2,…,A_n)$的一个关系
t表示元组,$t\in R$表示t是R的一个元组,可以理解为数据库某一表中一行实例
$t[A_i]$表示元组t中相对应于属性$A_i$的一个分量,即表中t元组中$A_i$属性所对应单元格的值
若$A=\lbrace A_{i1},A_{i2},A_{i3},…,A_{ik}\rbrace$,其中$A_{i1},A_{i2},….,A_{ik}$是$A_1,A_2,…,A_n$中的一部分,则称A为属性列或属性组,简单来说,属性组就是一个关系所有属性的一个子集
$t[A]=(t[A_{i1}],t[A_{i2}],…,t[A_{ik}])$表示元组t在属性列A上诸分量 ...
2-Yaml文件
Yaml文件SpringBoot使用一个全局配置文件,配置文件的名称是固定的,但文件类型有两种
application.properties
语法结构:key=value
application.yaml (推荐)
语法结构: key: value
注意冒号后边必须跟空格,否则语法结构错误(约定大于配置的体现)
YAML 是 “YAML Ain’t a Markup Language”(YAML 不是一种标记语言)的递归缩写。在开发的这种语言时,YAML 的意思其实是:”Yet Another Markup Language”(仍是一种标记语言)。
YAML 的语法和其他高级语言类似,并且可以简单表达清单、散列表,标量等数据形态。它使用空白符号缩进和大量依赖外观的特色,特别适合用来表达或编辑数据结构、各种配置文件、倾印调试内容、文件大纲(例如:许多电子邮件标题格式和YAML非常接近)。
YAML 的配置文件后缀为 .yml,如:application.yml
Yaml文件基本语法1234567891011121314151617181920# yaml配置文件可以注入到 ...
1-SpringBoot基础
SpringBoot基础
SpringBoot是由Pivotal团队在2013年开始研发、2014年4月发布第一个版本的全新开源的轻量级框架。它基于Spring4.0设计,不仅继承了Spring框架原有的优秀特性,而且还通过简化配置来进一步简化了Spring应用的整个搭建和开发过程。另外SpringBoot通过集成大量的框架使得依赖包的版本冲突,以及引用的不稳定性等问题得到了很好的解决。
SpringBoot所具备的特征有:
可以创建独立的Spring应用程序,并且基于其Maven或Gradle插件,可以创建可执行的JARs和WARs;
内嵌Tomcat或Jetty等Servlet容器;
提供自动配置的“starter”项目对象模型(POMS)以简化Maven配置;
尽可能自动配置Spring容器;
提供准备好的特性,如指标、健康检查和外部化配置;
绝对没有代码生成,不需要XML配置。
IDEA快速部署SpringBoot项目通过SpringInitializr创建SpringBoot项目,配置相关信息
自动配置SpringWeb
完成项目部署
编写Controller层,测试结 ...