Skip to content

Instantly share code, notes, and snippets.

- What do Etcd, Consul, and Zookeeper do?
- Service Registration:
- Host, port number, and sometimes authentication credentials, protocols, versions
numbers, and/or environment details.
- Service Discovery:
- Ability for client application to query the central registry to learn of service location.
- Consistent and durable general-purpose K/V store across distributed system.
- Some solutions support this better than others.
- Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
- Centralized locking can be based on this K/V store.
@frombegin
frombegin / nginxproxy.md
Created November 18, 2016 11:00 — forked from soheilhy/nginxproxy.md
How to proxy web apps using nginx?

Virtual Hosts on nginx (CSC309)

When hosting our web applications, we often have one public IP address (i.e., an IP address visible to the outside world) using which we want to host multiple web apps. For example, one may wants to host three different web apps respectively for example1.com, example2.com, and example1.com/images on the same machine using a single IP address.

How can we do that? Well, the good news is Internet browsers

插件实体需要实现如下接口:

1、自动摘要(Summarize),包含指纹(WithFingerprint),Map映射(Mapper)

interface Summarize {
  String getSummary();
}
docker 放到独立的目录
#coderoot
\pom.xml
\src
\main
\test
\docker <---

层次分解:

  1. api 层使用 jsonrpc
    com.xw.jsonrpc.intf.UserApi
    com.xw.jsonrpc.impl.UserApiImpl
    api 层构造 ScopeContext,调用 biz 层中的 Service, api 层自己要处理从对象到 json 的转换(如果缺省没实现的话)

开发规范

  • 不要使用 java8 特性,只支持 java7
  • 不要有警告,避免 typo
  • 排版使用 IDE 缺省配置,自动化 format 保持一致
  • 重构时要有单元测试
  • 避免重复代码
  • 注重结构,注意代码的简洁
  • 定期 codereview

分页器处理:

  • 将数据操作移到 dao 层,包括:
    int getTotalCount(DSLContext create, ...)
    List<Record-Or-CustomItem> getList(DSLContext create, ..., limit, offset)
  • biz 层调用 dao,封装成 Pagination
import java.util.*;
public class Main {
static class Validator {
public boolean validate(Object value) {
return true;
}
}
# 删除所有的容器
docker rm `docker ps -qa`
# 强制删除所有的容器
docker rm --force `docker ps -qa`
update-alternatives命令说明简介及用法
1.功能作用
update-alternatives是dpkg的实用工具,用来维护系统命令的符号链接,以决定系统默认使用什么命令。
在Debian系统中,我们可能会同时安装有很多功能类似的程序和可选配置,如Web浏览器程序(firefox,konqueror)、窗口管理器(wmaker、metacity)和鼠标的不同主题等。这样,用户在使用系统时就可进行选择,以满足自已的需求。
但对于普通用户来说,在这些程序间进行选择配置会较困难。update-alternatives工具就是为了解决这个问题,帮助用户能方便地选择自已喜欢程序和配置系统功能