快乐E栈项目实战第四阶段

2023-11-18

快乐E栈项目实战第四阶段



学完Java的IO操作,我们使用文件将快递信息存储起来,这样程序重新启动起来存储的快递信息也不会丢失,暂时不使用序列化进行存储,使用Properties文件进行快递信息存储。

1、思路

快递信息的index转换为字符串作为key值进行存储,快递信息以逗号分隔,然后通过冒号映射对应的数据,即存储到文件中的快递信息如下:

#\u5FEB\u9012\u4FE1\u606F
#Sun Apr 04 15:42:51 CST 2021
96=number\:123,company\:\u987A\u4E30,code\:677491
70=number\:124,company\:\u5706\u901A,code\:638754
20=number\:125,company\:\u4E2D\u901A,code\:990138

存储的是unicode,需要转换为中文:

#快递信息
#Sun Apr 04 15:42:51 CST 2021
96=number\:123,company\:顺丰,code\:677491
70=number\:124,company\:圆通,code\:638754
20=number\:125,company\:中通,code\:990138

2、代码

view部分:

package com.xiaoyaoyou.view;

import com.xiaoyaoyou.bean.Express;
import sun.lwawt.macosx.CSystemTray;

import java.util.ArrayList;
import java.util.Scanner;

public class Views {
    private Scanner input = new Scanner(System.in);

    /**
     *  欢迎
     */
    public void welcome() {
        System.out.println("欢迎使用快乐E栈快递管理系统");
    }

    /**
     *  再见
     */
    public void bye() {
        System.out.println("欢迎下次使用~");
    }

    /**
     * 选择身份菜单
     * @return
     */
    public int menu() {
        System.out.println("请根据提示,输入功能序号:");
        System.out.println("1. 快递员");
        System.out.println("2. 普通用户");
        System.out.println("0. 退出");

        //这里的代码逻辑,相较于nextInt优点在哪?
        //单思考这个方法内的逻辑,没有什么优点
        //但是思考全局,是有优点的:所有方法均使用nextLine,不会因为输入产生冲突,还可以更好的接收到各种类型的数据
        String text = input.nextLine();
        int num = -1;
        try {
            num = Integer.parseInt(text);
        }catch (NumberFormatException e) {
            System.out.println("输入有误,请重新输入");
            return menu();
        }

        if(num < 0 || num > 2) {
            System.out.println("输入有误,请重新输入");
            return menu();
        }
        return num;
    }

    /**
     * 快递员菜单
     * @return
     */
    public int cMenu() {
        System.out.println("请根据提示,输入功能序号:");
        System.out.println("1. 快递录入");
        System.out.println("2. 快递修改");
        System.out.println("3. 快递删除");
        System.out.println("4. 查看所有快递");
        System.out.println("0. 返回上级目录");

        String text = input.nextLine();
        int num = -1;
        try {
            num = Integer.parseInt(text);
        }catch (NumberFormatException e) {
            System.out.println("输入有误,请重新输入");
            return cMenu();
        }

        if(num < 0 || num > 4) {
            System.out.println("输入有误,请重新输入");
            return cMenu();
        }
        return num;
    }

    /**
     * 快递员录入快递
     * @return 包含了快递单号和快递公司的快递对象
     */
    public Express insert() {
        System.out.println("请根据提示,输入快递信息:");
        System.out.println("请输入快递单号:");
        String number = input.nextLine();
        System.out.println("请输入快递公司:");
        String company = input.nextLine();
        Express e = new Express();
        e.setCompany(company);
        e.setNumber(number);
        return e;
    }

    /**
     * 提示用于输入快递单号
     * @return
     */
    public String findByNumber() {
        System.out.println("请根据提示,输入快递信息:");
        System.out.println("请输入要操作的快递单号:");
        String number = input.nextLine();
        return number;
    }

    /**
     * 显示快递信息
     * @param e
     */
    public void printExpress(Express e) {
        System.out.println("快递信息如下:");
        System.out.println("快递公司:"+e.getCompany()+",快递单号:"+e.getNumber()
        +",取件码:"+e.getCode());
    }

    public void printNull() {
        System.out.println("快递不存在,请检查您的输入");
    }

    /**
     * 修改快递信息
     * @param e
     */
    public void update(Express e) {
        System.out.println("请根据提示,输入新的快递单号:");
        String number = input.nextLine();
        if(number == "") {
            update(e);
        }
        System.out.println("请根据提示,输入新的快递公司:");
        String company = input.nextLine();
        if(company == "") {
            update(e);
        }
        e.setNumber(number);
        e.setCompany(company);
    }

    /**
     * 确认是否删除
     * @return
     */
    public int delete() {
        System.out.println("是否确认删除?");
        System.out.println("1. 确认删除");
        System.out.println("2. 取消操作");
        System.out.println("0. 退出");
        String text = input.nextLine();
        int num = -1;
        try {
            num = Integer.parseInt(text);
        }catch (NumberFormatException e) {
            System.out.println("输入有误,请重新输入");
            return delete();
        }

        if(num < 0 || num > 2) {
            System.out.println("输入有误,请重新输入");
            return delete();
        }
        return num;
    }

    /**
     * 将给定数组的快递信息遍历显示
     * @param es
     */
    public void printAll(ArrayList<Express> es) {
        if(es == null || es.size() == 0) {
            System.out.println("暂无快递");
            return;
        }
        int count = 0;
        for (Express e: es) {
            if(e.getNumber() != null) {
                printExpress(e);
                count++;
            }
        }
        if(count == 0) {
            System.out.println("柜中暂无快递信息");
        }
    }

    /**
     * 用户的菜单
     * @return
     */
    public int uMenu() {
        System.out.println("请根据提示,输入六位取件码:");
        System.out.println("请输入您的取件码");

        String code = input.nextLine();
        int num = -1;
        try {
            num = Integer.parseInt(code);
        }catch (NumberFormatException e) {
            System.out.println("输入有误,请重新输入");
            return uMenu();
        }

        if(num < 100000 || num > 999999) {
            System.out.println("输入有误,请重新输入");
            return uMenu();
        }
        return num;
    }

    public void expressExist() {
        System.out.println("此单号在快递柜中已存在,请勿重复存储");
    }

    public void printCode(Express e) {
        System.out.println("快递的取件码为:"+e.getCode());
    }

    public void success() {
        System.out.println("操作成功");
    }
}

bean部分:

package com.xiaoyaoyou.bean;

import java.util.Objects;

public class Express {
    //单号
    private String number;
    //快递公司
    private String company;
    //取件码
    private int code;

    public Express(String number, String company, int code) {
        this.number = number;
        this.company = company;
        this.code = code;
    }

    @Override
    public String toString() {
        return "number:" + number +
                ",company:" + company +
                ",code:" + code;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass() || number == null) return false;
        Express express = (Express) o;
        return number.equals(express.number);
    }

    @Override
    public int hashCode() {
        return Objects.hash(number);
    }

    public Express() {
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public String getCompany() {
        return company;
    }

    public void setCompany(String company) {
        this.company = company;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }
}

dao数据操作部分:

package com.xiaoyaoyou.dao;

import com.xiaoyaoyou.bean.Express;

import java.io.*;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Random;

public class ExpressDao {
    private ArrayList<Express> data = null;
    Properties properties = new Properties();
    public FileOutputStream fileOutputStream = null;
    Reader reader = null;
    //当前存储的快递数(空间换时间)
    private int size;
    {
        data = new ArrayList<Express>();
        for(int i = 1; i <= 100; i++) {
            data.add(new Express());
        }

        try {
            File file = new File("express.txt");
            if(!file.exists()) {
                file.createNewFile();
            }
            reader = new FileReader("express.txt");
            try {
                properties.load(reader);
                for (int i = 1; i <= 100; i++) {
                    String value = properties.getProperty(i+"");
                    if(value != null) {
                        System.out.println(value);
                        getExpressInfo(value, data.get(i));
                    }
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public void getExpressInfo(String str, Express express) {
        String[] ss = str.split(",");
        for (int i = 0; i < ss.length; i++) {
            String[] ss2 = ss[i].split(":");
            switch (i) {
                case 0:
                    express.setNumber(ss2[1]);
                    break;
                case 1:
                    try {
                        express.setCompany(ss2[1]);
                    } catch (NumberFormatException e) {
                        e.printStackTrace();
                    }
                    break;
                case 2:
                    try {
                        express.setCode(Integer.parseInt(ss2[1]));
                    } catch (NumberFormatException e) {
                        e.printStackTrace();
                    }
                    break;
            }
        }
    }

    private Random random = new Random();

    /**
     * 用于存储快递
     * @param e
     * @return
     */
    public boolean add(Express e) {
        if(size == 100) {
            return false;
        }
        //1. 随机生成ArrayList的下标
        int index = -1;

        while (true) {
            index = random.nextInt(100);
            if (data.get(index).getNumber() == null) {
                //此位置无快递
                break;
            }
        }
        //2. 取件码
        int code = randomCode();
        e.setCode(code);
        data.set(index, e);
        size++;
        saveToFile();

        return true;
    }

    public void saveToFile() {
        properties.clear();
        for (Express express: data) {
            if(express.getNumber() != null) {
                properties.put(data.indexOf(express) + "", express.toString());
                System.out.println(express.getNumber());
            }
        }
        try {
            fileOutputStream = new FileOutputStream("express.txt");
            properties.store(fileOutputStream, "快递信息");
            fileOutputStream.flush();
        } catch (IOException ioException) {
            ioException.printStackTrace();
        }
    }

    /**
     * 生成取件码(模板方法设计模式)
     * @return
     */
    private int randomCode() {
        while (true){
            int code = random.nextInt(900000)+100000;
            Express e = findByCode(code);
            if(e == null) {
                return code;
            }
        }
    }

    /**
     * 根据快递单号查询快递
     * @param number
     * @return 查询的结果,查询失败时返回null
     */
    public Express findByNumber(String number) {
        Express e = new Express();
        e.setNumber(number);
        for (Express v: data) {
            if(e.equals(v)) {
                return v;
            }
        }

        return null;
    }

    /**
     * 根据取件码查询快递
     * @param code 要查询的取件码
     * @return 查询的结果,查询失败时返回null
     */
    public Express findByCode(int code) {
        for (Express e: data) {
            if (e != null) {
                if (e.getCode() == code) {
                    return e;
                }
            }
        }
        return null;
    }


    /**
     * 多余的操作,为了mvc更圆润
     * @param oldExpress
     * @param newExpress
     */
    public void update(Express oldExpress, Express newExpress) {
        saveToFile();
    }

    /**
     * 删除快递
     * @param e
     */
    public void delete(Express e) {
        if (data.isEmpty()) {
            return;
        }
        for (Express v: data) {
            if(e.getNumber() == v.getNumber()) {
                e.setCode(0);
                e.setCompany(null);
                e.setNumber(null);
                size--;
                break;
            }
        }

        saveToFile();
        return ;
    }

    public ArrayList<Express> findAll() {
        return data;
    }
}

main调用控制部分:

package com.xiaoyaoyou.main;

import com.xiaoyaoyou.bean.Express;
import com.xiaoyaoyou.dao.ExpressDao;
import com.xiaoyaoyou.view.Views;

import java.util.ArrayList;

public class CourierClient {
    private ExpressDao dao;
    private Views v;
    public void CourierClient() {
    }

    public CourierClient(ExpressDao dao, Views v) {
        this.dao = dao;
        this.v = v;
    }

    public ExpressDao getDao() {
        return dao;
    }

    public void setDao(ExpressDao dao) {
        this.dao = dao;
    }

    public Views getV() {
        return v;
    }

    public void setV(Views v) {
        this.v = v;
    }

    public void select() {
        while (true) {
            int menu = v.cMenu();
            switch (menu) {
                case 0:
                    return;
                case 1:
                    saveExpress();
                    break;
                case 2:
                    updateExpress();
                    break;
                case 3:
                    deleteExpress();
                    break;
                case 4:
                    queryExpress();
                    break;
            }
        }
    }

    public void saveExpress() {
        //1、提示输入快递信息
        Express e = v.insert();
        //2、此快递是否已经存储过
        Express e2 = dao.findByNumber(e.getNumber());
        //3、存储快递
        if (e2 != null) {
            //单号在快递柜中已存在
            v.expressExist();
            return;
        }

        //未存储过,
        dao.add(e);
        v.printExpress(e);
    }

    public void updateExpress() {
        //1、提示输入快递信息
        String number = v.findByNumber();
        //2、查找数据
        Express e = dao.findByNumber(number);
        Express e2 = e;
        //3、打印快递信息
        if (e == null) {
            v.printNull();
            return;
        }

        v.printExpress(e);
        //4、提示修改
        v.update(e2);
        dao.update(e, e2);
        v.printExpress(e2);
    }

    public void deleteExpress() {
        //1、输入快递单号
        String number = v.findByNumber();
        //2、查找快递对象
        Express e = dao.findByNumber(number);
        if(e == null) {
            v.printNull();
            return;
        }

        v.printExpress(e);
        int type = v.delete();
        if(type == 1) {
            dao.delete(e);
            v.success();
        }
    }

    public void queryExpress() {
        ArrayList<Express> all = dao.findAll();
        v.printAll(all);
    }
}
package com.xiaoyaoyou.main;

import com.xiaoyaoyou.bean.Express;
import com.xiaoyaoyou.dao.ExpressDao;
import com.xiaoyaoyou.view.Views;

public class UserClient {
    private ExpressDao dao;
    private Views v;

    public UserClient() {
    }

    public UserClient(ExpressDao dao, Views v) {
        this.dao = dao;
        this.v = v;
    }

    public ExpressDao getDao() {
        return dao;
    }

    public void setDao(ExpressDao dao) {
        this.dao = dao;
    }

    public Views getV() {
        return v;
    }

    public void setV(Views v) {
        this.v = v;
    }

    public void getExpress() {
        //1、获取取件码
        int code = v.uMenu();
        //2、根据取件码取出快递
        Express e = dao.findByCode(code);
        if (e == null) {
            v.printNull();
        } else {
            v.success();
            v.printExpress(e);
            dao.delete(e);
        }
    }
}
package com.xiaoyaoyou.main;

import com.xiaoyaoyou.dao.ExpressDao;
import com.xiaoyaoyou.view.Views;

import java.io.IOException;

public class Main {
    //初始化视图对象
    private static Views v = new Views();
    //初始化dao对象
    private static ExpressDao dao = new ExpressDao();

    private static CourierClient cClient;
    private static UserClient uClient;

    public static void main(String[] args) {
        init();

        while (run()) {
        }

        destroy();
    }

    /**
     * 初始化
     */
    private static void init() {
        //1.欢迎
        v.welcome();

        cClient = new CourierClient(dao, v);
        uClient = new UserClient(dao, v);
    }

    /**
     * 主进程运行流程
     * @return
     */
    private static boolean run() {
        //2.弹出身份选择菜单
        int menu = v.menu();
        switch (menu) {
            case 0:
                //退出
                return false;
            case 1:
                //快递员
                cClient.select();
                break ;
            case 2:
                //用户
                uClient.getExpress();
                break ;
        }

        return true;
    }

    /**
     * 资源释放
     */
    private static void destroy() {
        //释放资源
        try {
            dao.fileOutputStream.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        v.bye();
    }
}

3、结果

欢迎使用快乐E栈快递管理系统
请根据提示,输入功能序号:
1. 快递员
2. 普通用户
0. 退出
1
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
1
请根据提示,输入快递信息:
请输入快递单号:
123
请输入快递公司:
顺丰
123
快递信息如下:
快递公司:顺丰,快递单号:123,取件码:928922
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
1
请根据提示,输入快递信息:
请输入快递单号:
124
请输入快递公司:
圆通
123
124
快递信息如下:
快递公司:圆通,快递单号:124,取件码:194236
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
1
请根据提示,输入快递信息:
请输入快递单号:
125
请输入快递公司:
申通
125
123
124
快递信息如下:
快递公司:申通,快递单号:125,取件码:259180
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
2
请根据提示,输入快递信息:
请输入要操作的快递单号:
124
快递信息如下:
快递公司:圆通,快递单号:124,取件码:194236
请根据提示,输入新的快递单号:
125
请根据提示,输入新的快递公司:
顺达
125
123
125
快递信息如下:
快递公司:顺达,快递单号:125,取件码:194236
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
3
请根据提示,输入快递信息:
请输入要操作的快递单号:
125
快递信息如下:
快递公司:申通,快递单号:125,取件码:259180
是否确认删除?
1. 确认删除
2. 取消操作
0. 退出
1
123
125
操作成功
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
0
请根据提示,输入功能序号:
1. 快递员
2. 普通用户
0. 退出
2
请根据提示,输入六位取件码:
请输入您的取件码
194236
操作成功
快递信息如下:
快递公司:顺达,快递单号:125,取件码:194236
123
请根据提示,输入功能序号:
1. 快递员
2. 普通用户
0. 退出
1
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录
4
快递信息如下:
快递公司:顺丰,快递单号:123,取件码:928922
请根据提示,输入功能序号:
1. 快递录入
2. 快递修改
3. 快递删除
4. 查看所有快递
0. 返回上级目录

在这里插入图片描述

在这里插入图片描述

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

快乐E栈项目实战第四阶段 的相关文章

  • 为什么会出现此异常 FileItemStream$ItemSkippedException?

    在 gwt Web 应用程序中 我必须发送一个文件和附加的一些参数 在服务器端 try ServletFileUpload upload new ServletFileUpload FileItemIterator iterator upl
  • 我在socket上设置了超时,发现这个值不能大于21

    我在socket上设置了超时 该值小于21秒才有效 21秒后发现超时还是21秒 public static void main String args SimpleDateFormat sdf new SimpleDateFormat yy
  • Hashmap并发问题

    我有一个哈希图 出于速度原因 我希望不需要锁定 假设我不介意过时的数据 同时更新它和访问它会导致任何问题吗 我的访问是获取 而不是迭代 删除是更新的一部分 是的 这会导致重大问题 一个例子是向散列映射添加值时可能发生的情况 这可能会导致表重
  • JavaFX 图像未在舞台中显示

    我尝试了很多次 尝试了很多方法 但都无法让自己的形象在舞台上如我所愿 我认为这可能与java寻找资源的路径有关 但我不确定 因为我刚刚开始使用视觉库 在本例中为JavaFX 这是我的目录结构 MyProject assets img myI
  • 在Java中使用命令行编译多个包

    您好 我一直在使用 IDE 但现在我需要从命令行运行和编译 问题是我有多个软件包 我试图找到答案 但没有任何效果 所以我有 src Support java files Me java files Wrapers java files 你知
  • Jackson - 反序列化嵌套 JSON

    我有一个 JSON 字符串 其格式如下 response execution status ready report cache hit true created on 2013 07 29 08 42 42 fact cache erro
  • jvm 次要版本与编译器次要版本

    当运行使用具有相同主要版本但次要版本高于 JVM 的 JDK 编译的类时 JVM 会抛出异常吗 JDK 版本并不重要 类文件格式版本 http blogs oracle com darcy entry source target class
  • 防止 Spring Boot 注册 Spring Security 过滤器之一

    我想禁用安全链中的 Spring Security 过滤器之一 我已经看到了防止 Spring Boot 注册 servlet 过滤器 https stackoverflow com questions 28421966 prevent s
  • 正则表达式获取字符串中的第一个数字和其他字符

    我是正则表达式的新手 想知道如何才能只获取字符串中的第一个数字 例如100 2011 10 20 14 28 55 在这种情况下 我希望它返回100 但该数字也可以更短或更长 我在想类似的事情 0 9 但它单独获取每个数字 100 2001
  • 如何导入 org.apache.commons.lang3.ArrayUtils;进入 Eclipse [关闭]

    Closed 这个问题正在寻求书籍 工具 软件库等的推荐 不满足堆栈溢出指南 help closed questions 目前不接受答案 我如何导入 org apache commons lang3 ArrayUtils 将库添加到 Ecl
  • 在 IntelliJ 中运行 Spring Boot 会导致 Unable to load 'javax.el.E​​xpressionFactory'

    我正在尝试运行一个简单的 Spring Boot 应用程序 该应用程序具有以下 Maven pom file
  • 如何将 Observable>> 转换为 Observable>

    我陷入了如何将以下可观察类型转换 转换为我的目标类型的困境 我有以下类型的可观察值 Observable
  • 我想在java中使用XQuery进行Xml处理

    我想用XQuery用于从 java 中的 Xml 获取数据 但我没有得到需要为此添加哪个 Jar 我在谷歌上搜索了很多 但没有得到任何有用的例子 例如我得到以下链接 https docs oracle com database 121 AD
  • 在 Java 中将弯音发送到 MIDI 音序器

    我了解启动和运行 MIDI 音序器的基础知识 并且希望能够在播放过程中增加 减小序列的音高 但弯音是发送到合成器而不是音序器的消息 我尝试将音序器的接收器设置为合成器的发射器 当我发送弯音短消息时 音序器保持相同的音调 但随后合成器以新的弯
  • 如何找到被点击的JLabel并从中显示ImageIcon?

    这是我的代码 我想知道哪个l单击 然后在新框架中显示该 ImageIcon e getSource 不起作用 final JFrame shirts new JFrame T shirts JPanel panel new JPanel n
  • Hibernate HQL:将对值作为 IN 子句中的参数传递

    我面临一个问题 如何使用 IN 子句将查询中的成对值的参数传递给 HQL 例如 select id name from ABC where id reg date in x y 并且参数是不同的数据类型string id 和reg date
  • 了解 Spark 中的 DAG

    问题是我有以下 DAG 我认为当需要洗牌时 火花将工作划分为不同的阶段 考虑阶段 0 和阶段 1 有些操作不需要洗牌 那么为什么 Spark 将它们分成不同的阶段呢 我认为跨分区的实际数据移动应该发生在第 2 阶段 因为这里我们需要cogr
  • Java中的回调接口是什么?

    SetObserver 接口的代码片段取自有效的Java 避免过度同步第67条 public interface SetObserver
  • 如何解决 PDFBox 没有 unicode 映射错误?

    我有一个现有的 PDF 文件 我想使用 python 脚本将其转换为 Excel 文件 目前正在使用PDFBox 但是存在多个类似以下错误 org apache pdfbox pdmodel font PDType0Font toUnico
  • 为什么这个私人浮动字段变为零?

    我有一些奇怪的行为 我很难向自己解释 称为 textureScale 的浮点字段变为零 如果某些代码正在更改该值 则可以解释这一点 然而 我希望能够通过将其设置为 私有最终浮点 来导致构建失败 或者至少是运行时异常 那么无论更改该值都将失败

随机推荐

  • Ubuntu18中NVIDIA,cuda,cudnn,pytorch安装

    注意 nvidia驱动和cuda cudnn pytroch python的对应关系 linux安装pytorch 包括cuda与cudnn linux清华园按照pytorch1 12 BryceRui的博客 CSDN博客 安装流程 安装c
  • R手册(Visualise)--gganimate(ggplot2 extensions)

    文章目录 gganimate Create easy animations with ggplot2 返回ggplot2扩展主目录 gganimate Create easy animations with ggplot2 GitHub链接
  • SpringCloudAlibaba集成Sentinel

    什么是 Sentinel 随着微服务的流行 服务和服务之间的稳定性变得越来越重要 Sentinel 以流量为切入点 从流量控制 熔断降级 系统负载保护等多个维度保护服务的稳定性 Sentinel 的特征 丰富的应用场景 Sentinel 承
  • 游戏服务器稳定ping值,网友玩游戏时Ping值超过了2亿!

    经常玩网络游戏的朋友肯定都经历过延迟 太高的Ping值会使游戏体验惨不忍睹 但你见过超过2亿的Ping吗 这里简单介绍一下Ping 它是玩家客户端和游戏服务器之间的网络延迟 一般以毫秒 ms 作为单位 Ping越低 延迟越低 严重的延迟通常
  • 微信小程序项目使用npm安装vant-weapp的正确步骤及错误处理方法

    微信小程序项目使用npm安装vant weapp的正确步骤及错误处理方法 1 搭建小程序 1 1 项目 新建项目 如下图所示 1 2点击图中 新建 即可创建成功小程序项目 2 安装vant weapp库 2 0 在安装vant weapp之
  • ORA-01950: 对表空间 ‘SYSTEM‘ 无权限

    对表空间 SYSTEM 无权限 问题 对表空间 SYSTEM 无权限 处理 alter user test 用户名 quota unlimited on users 问题 对表空间 SYSTEM 无权限 出现ORA 01950 对表空间 S
  • QML-消息提示框

    QML 消息提示框 前言 一 提示框 二 警告提示框 三 错误提示框 四 属性介绍 前言 介绍常用的消息提示框 包括提示 错误 报警等 一 提示框 import QtQuick 2 12 import QtQuick Window 2 12
  • Qt creator出现mainwindow.ui does not exist,导致无法编译通过

    遇到这个问题 首先是之前做过删除ui mainwindow h的操作步骤 导致出现这样的问题 参考博客 https blog csdn net mhw828 article details 104143881 解决的方法就如这位博主说的 需
  • redis集群模式

    redis单机版 出现单机故障后 导致redis无法使用 如果程序使用redis 间接导致程序出错 redis的集群模式 主从复制模式 哨兵模式 集群化模式 1 主从复制模式 一主多从模式 一个主节点 多个从节点 那么主节点可以负责 读操作
  • MySQL拾遗之数据类型的默认值-default

    MySQL 中 所有的数据类型 都可以显式或隐式的拥有默认值 我们可以使用 DEFAULT 约束显式的为列指定一个默认值 比如 CREATE TABLE t1 i INT DEFAULT 1 c VARCHAR 10 DEFAULT pri
  • 正则,JS:this,同步异步,原型链笔记整理

    一 正则表达式 正则表达式 regular expression 是一种表达文本模式 即字符串结构 的方法 有点像字符串的模板 常常用来按照 给定模式 匹配文本 正则表达式可以用于以下常见操作 匹配 判断一个字符串是否符合某个模式 搜索 在
  • DCA和DTS关系

    On the consumer level DTS is the oft used shorthand for the DTS Coherent Acoustics DCA codec transportable through S PDI
  • 深信服C++开发岗笔试记录

    如果大家也在找面试笔试题目内容 可以看我的总结文章 正在更新之中 有没涉及到的内容 欢迎大家指出 附链接 数据库 C C HTML OS 计网面试准备 更新中 笔试共有三部分 不定项选择 8道 填空 7道 编程 3道 选择和填空的部分内容涉
  • Mybatis left join 一对多及多对多查询配置

    一对一查询配置
  • 90-50-010-源码-hbase的rowkey设计

    1 视界 1 rowKey编码概述 注 Kylin源码分析系列基于Kylin的2 6 0版本的源码 其他版本可以类比 2 相关概念 前面介绍了Kylin中Cube构建的流程 但Cube数据具体是以什么样的形式存在 可能还不是特别清晰明了 这
  • 拷贝构造函数调用总结

    拷贝构造函数主要在以下三种情况下起初始化作用 1 在声明语句中用一个对象初始化另一个对象 2 将一个对象作为参数按值调用方式传递给另一个对象时生成对象副本 3 生成一个临时对象作为函数的返回结果 那么接着就看一下在这三种情况下拷贝构造函数分
  • python自动化课程笔记(六)函数

    函数 类 模块 包 项目 包与文件夹的区别在于 包中有很多模块 和init文件 函数 提高编码的效率及代码的重用 把独立功能的代码块组成一个小模块 def printInfo 定义一个函数 print 10 print 人生苦短 我用pyt
  • Microsoft Office 2021安装

    哈喽 大家好 今天一起学习的是office2021的安装 有兴趣的小伙伴也可以来一起试试手 一 测试演示参数 演示操作系统 Windows 11 支持Win10安装 不支持Win7 XP系统 系统类型 64位 演示版本 cn office
  • PMP估算方法对比:参数估算、类比估算、自下而上估算、三点估算和粗略量级估算

    目录 1 类比估算 2 参数估算 3 自下而上估算 4 三点估算 5 粗略量级估算 1 类比估算 英文全称 Analogous Estimating Technique 定义 与过去类似活动的参数值 如范围 成本 预算和持续时间等 或规模指
  • 快乐E栈项目实战第四阶段

    快乐E栈项目实战第四阶段 文章目录 快乐E栈项目实战第四阶段 1 思路 2 代码 3 结果 学完Java的IO操作 我们使用文件将快递信息存储起来 这样程序重新启动起来存储的快递信息也不会丢失 暂时不使用序列化进行存储 使用Properti