PAT甲级 1014 Waiting in Line (30分)

Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are: The space inside the yellow line in front of each window is enough to contain a line with M customers. Hence when all the N lines are full, all the customers after (and including) the (NM+1)st one will have to wait in a line behind the yellow line. Each customer will choose the shortest line to wait in when crossing the yellow line. If there are two or more lines with the same length, the customer will always choose the window with the smallest number. Customer[i] will take T[i] minutes to have his/her transaction processed. The first N customers are assumed to be served at 8:00am. Now given the processing time of each customer, you are supposed to tell the exact time at which a customer has his/her business done. ...

March 8, 2020 · 4 min

Dubbo微服务影院系列(2):微服务入门

传统业务应用 传统应用带来的问题 单一业务开发和迭代困难 扩容困难 部署和回滚困难 微服务发展历程 面向服务开发 - SOA 微服务开发 微服务概述 微服务是一种将业务系统进一步拆分的架构风格 微服务强调每个单一业务都独立运行 每个单一服务都应该使用更轻量的机制保持通信 服务不强调环境,可以不同语言或数据源 微服务选择 Dubbo Spring Cloud Zero ICE

March 6, 2020 · 1 min

Dubbo微服务影院系列(1):课程导学

为什么使用Dubbo Dubbo 是基于 RPC 通信协议,速度更快 Dubbo 的多中心配置更灵活 ZooKeeper Redis Dubbo 可以按需集成其他组件,完成微服务生态环境构建 Hystrix Zipkin 包括阿里、小米、京东等多家互联网公司都有使用 学习目标 构建业务完整的商业化项目 掌握以 Dubbo 为底的各项微服务套件的应用 掌握基于 Dubbo 的微服务常见面试问题 业务结构图 核心功能 主要知识点 技术架构图

March 6, 2020 · 1 min

Outsourcing

What is GSE? GSE is a complex phenomenon that unites many different collaboration models and project organization models. Reason for GSE? Reduce overheads, free up resources Improve efficiency Offload non-core functions Get access to specialized skills Get access to a specific market Differences between co-located team and global team According to What, When, Where to determine whether the supplier is suitable ...

June 21, 2019 · 5 min

Spring Boot 简化分页查询Page接口的JSON响应

多余的分页信息 Spring Data 的 Page 接口进行数据分页返回了很多很多垃圾信息: { "status": 0, "data": { "content": [ { "goodsId": 1, "producerId": 1, "categoryId": 4, "name": "耐克sb滑板鞋", "price": 500, "stock": 500, "status": "正常", "createTime": "2019-02-02T03:48:33.000+0000", "updateTime": null }, { "goodsId": 2, "producerId": 1, "categoryId": 4, "name": "阿迪达斯小白鞋", "price": 500, "stock": 300, "status": "正常", "createTime": "2019-02-02T03:48:59.000+0000", "updateTime": null } ], "pageable": { "sort": { "sorted": false, "unsorted": true, "empty": true }, "offset": 0, "pageSize": 10, "pageNumber": 0, "paged": true, "unpaged": false }, "last": true, "totalPages": 1, "totalElements": 2, "size": 10, "number": 0, "numberOfElements": 2, "sort": { "sorted": false, "unsorted": true, "empty": true }, "first": true, "empty": false } } 实际需要的分页信息 实际上我只需要下面这些分页信息: ...

February 2, 2019 · 2 min

Spring Cloud Eureka

Spring Cloud Eureka 基于 Netflix Eureka 做了二次封装 两个组件组成: Eureka Server 注册中心 作为具有服务注册功能的服务器,是服务注册中心,系统中的其他微服务使用 Eureka Client 连接到Eureka Server ,并维持心跳连接以监控各个微服务是否正常运行。 Eureka Client 服务注册 用于简化与服务器的交互,作为轮询负载均衡器,并提供服务的故障切换支持。 启动 Eureka Server 1. 创建Spring项目 2. 填充项目信息 3. 选择项目类型为 Cloud Discovery 中的 Eureka Server 4. 完成创建 5. 添加注解 @EnableEurekaServer @SpringBootApplication @EnableEurekaServer public class EurekaApplication { public static void main(String[] args) { SpringApplication.run(EurekaApplication.class, args); } } 6. 配置 application.yml eureka: client: service-url: defaultZone: http://localhost:8761/eureka/ register-with-eureka: false spring: application: name: eureka server: port: 8761 7. 启动 Eureka Server ...

January 31, 2019 · 1 min

微服务简介

images 定义 The microservice architectural style is an approach to developing a single application running as a suite of small services, each running its own process and communicating with lightweight mechanisms, often an HTTP resource API. These services are built around business capabilities and independently deployable by fully automated deployment machinery. There is a bare minimum of centralized management of these services, which may be written in different programming languages and use different data storage technologies. ...

January 31, 2019 · 1 min

CentOS jar包后台运行

运行jar包命令 java -jar application.jar 当前ssh窗口被锁定,可按CTRL + C打断程序运行,或直接关闭窗口让程序退出。 那如何让窗口不被锁定? 方法一 java -jar application.jar & &代表在后台运行。 当前ssh窗口不被锁定,但是当窗口关闭时,程序中止运行。 继续改进,如何让窗口关闭时,程序仍然运行? 方法二 nohup java -jar application.jar & nohup 意思是不挂断运行命令,当账户退出或终端关闭时,程序仍然运行。 那怎么不打印该程序输出的内容,而写入某个文件中呢? 方法四 nohup java -jar application.jar >out.txt & 当用 nohup 命令执行作业时,缺省情况下该作业的所有输出被重定向到nohup.out的文件中,除非另外指定了输出文件,如 out.txt。 command >out.txt是将command的输出重定向到out.txt文件,即输出内容不打印到屏幕上,而是输出到out.txt文件中。 通过jobs命令查看后台运行任务 jobs 那么就会列出所有后台执行的作业,并且每个作业前面都有个编号。 如果想将某个作业调回前台控制,只需要 fg + 编号即可。 fg 23 查看某端口占用的线程的pid netstat -nlp |grep :9181

January 30, 2019 · 1 min

Applied Software Project Management

General characteristics of a project A project is a temporary endeavour undertaken to create a unique product or service. It is specific, timely, usually multidisciplinary, and always conflict ridden. Projects are parts of overall programs and may be broken down into tasks, subtasks, and further if desired. Vary in size Vary in type Have desired completion dates Requires various kinds of knowledge Requires domain knowledge Requires team work Requires responsibilities and authorities Do not exist in isolation General management vs. Project management General management Organizational management Portfolio management Program management Not time limited? No completion dates? No managerial hierarchy? Routine activities Annual budgeting Project management Project management is the application of knowledge, skills, tools, and techniques to project activities to meet the project requirements Five categories of activities Initiating Planning Executing Monitoring and Controlling Closing How does the world look like? Uncertainty Plans go awry Even the closest future is unpredictable Chance events occur frequently The life is a rough road We need to do trade-offs every day We constantly negotiate We need flexibility Risk management “Project management is risk management” Identify potential problems before they occur Put preventive actions in place before unrecoverable harm occurs Risks possible events that may affect the project negatively Problems events that have or will affect the project negatively Stages in risk management: Risk identification; project, product and business risks Risk analysis; probability and consequences, triggers Risk planning; how to address risks – eliminate, reduce, ignore Risk monitoring; controlling and updating the risks ...

January 20, 2019 · 11 min

Software Architecture and Quality

CH 1. What is software architecture? What is software architecture The software architecture of a system is the set of structures needed to reason about the system, which comprise software elements, relations among them, and properties of both. To find out what users of the system think about the system. × To assist in marketing activities. × To make estimate for projects planning purposes. √ To use as input for dividing up the work into tasks. √ To analyze and predict characteristics of the implemented system. √ To present the future development of the product. × Categories of structures First, some structures partition systems into implementation units called modules. Other structures are dynamic, meaning that they focus on the way the elements interact with each other at runtime to carry out the system’s functions. we will call runtime structures component-and-connector (C&C) structures. A third kind of structure describes the mapping from software structures to the system’s organizational, developmental, installation, and execution environments. These mappings are called allocation structures. Three Kinds of Structures Module structures embody decisions as to how the system is to be structured as a set of code or data units that have to be constructed or procured. ...

January 19, 2019 · 12 min