javaSwing酒店管理系统

一、 使用方法:

在使用前,需要到druid.properties 配置文件中,修改自己对应于自己数据库的属性;如用户名,密码等

driverClassName=com.mysql.cj.jdbc.Driver
url=jdbc:mysql:///hotel?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
username=root
password=123456
# 初始化连接数量
initialSize=5
# 最大连接数
maxActive=10
# 最大等待时间
maxWait=3000

注意:如果是保持数据库连接异常,则说明数据库和jar包版本匹配了,注意升级数据库jar包版本;

二、项目介绍

  1. 本项目主要是基于Swing框架搭建的java桌面应用程序 在项目中主要实现的功能有:

1.开始界面

  • 开始界面为动态代码雨的欢迎效果
    在这里插入图片描述

2.注册界面

  • 注册界面。实现了验证码的生成和验证,以及出生日期的日历控件化的选择,当用户注册成功后,用户名密码就会通过方法传到登录界面从而避免了用户第二次填账号密码的麻烦

    在这里插入图片描述

3.分角色登录

  • 登录主要分为管理员登录和用户登录,管理员登录后有

    • 客房管理功能:这个功能主要实现了对房间的增删改查,以及查看对应房间的评论等;涉及到了多对多的查询

在这里插入图片描述

4.用户管理

  • 用户管理功能:主要的增删改查操作,点击对应的用户右边小框框展示用户的头像

在这里插入图片描述

5.订单管理

  • 订单管理功能:在这里会展示用户的全部订单,通过多对多的查询展示用户的订房信息等;已经对用户的一些信息进行统计;主要用到了ifreechart 框架进行绘制表格

在这里插入图片描述

6.客房服务

  • 客房服务功能:就是给房间添加一些新的设备以及多张配图,方便用户浏览

在这里插入图片描述

7.历史记录

  • 历史记录:主要记录用户的订房退房记录,实现这个功能主要用到mysql的触发器,通过触发器,没删除一个订单,就将对于的订单保存到历史记录表里边;最后导出表格,而我导出的表格用csv文件逗号阵列,比较方便生成

在这里插入图片描述

8.管理员登录

  • 管理员管理,主要是设置权限的1位超级管理员0 为普通管理员

     ![在这里插入图片描述](https://img-blog.csdnimg.cn/direct/d88c15305f3149caba1e5e256299300d.png)
    
    • 在退出前会有监听事件,会询问用户是否最小化托盘,如果最小化托盘则项目已经在运行中

    • 在登录前,由于想模仿QQ登录功能输入对应的账号显示不同的头像,最后添加了键盘监听功能和数据库查询,所以刚开始会有点卡

9.查看房间

  • 用户登录功能

    • 用户登录后,可以查看房间和其各种资料;

      在这里插入图片描述

10.点评房间

  • 用户也可以点评房间

    在这里插入图片描述

11.充值界面

  • 用户可以对客房进行预订,如果金额不足之前则需要用户进行充值

    • 而充值界面需要用户点击我的头像那里进入个人信息页面

    在这里插入图片描述

  • 用户个人信息还有评论记录都可以在个人信息这里修改删除等

三、文件夹目录说明

image    主要用于保存项目中用到的图片文件的
lib      主要用于保存用项目中用到jar包
sql      整个项目运行的数据和数据库表
src      全部源码
	com.ludashen.control  主要保存各种自定义的控件的
	com.ludashen.dao      数据库交互代码
	com.ludashen.frame    用户交互界面代码
	com.ludashen.hothl    模型对象类
	com.ludashen.panel    面板容器
resource  资源文件,图片等
druid.properties 数据库配置文件

四、 代码

1.runFrame

package com.ludashen.frame;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Random;

public class RunFrame extends JDialog implements ActionListener {
    private int gi=0;
    private Random random = new Random();
    private Dimension screenSize;
    private JPanel graphicsPanel;
    private final static int gap = 20;
    //存放雨点顶部的位置信息(marginTop)
    private int[] posArr;
    //行数
    private int lines;
    //列数
    private int columns;
    public RunFrame() {
        initComponents();
    }
    private void initComponents() {
        setLayout(new BorderLayout());
        graphicsPanel = new GraphicsPanel();
        add(graphicsPanel, BorderLayout.CENTER);
        this.setUndecorated(true);
        setSize(500,400);
        setLocationRelativeTo(null);
        this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
        setVisible(true);
        screenSize = Toolkit.getDefaultToolkit().getScreenSize();
        lines = screenSize.height / gap;
        columns = screenSize.width / gap;
        posArr = new int[columns + 1];
        random = new Random();
        for (int i = 0; i < posArr.length; i++) {
            posArr[i] = random.nextInt(lines);
        }

        new Timer(120, this).start();
    }
    private int getChr() {
        return random.nextInt(10);
    }
    //定时器的
    @Override
    public void actionPerformed(ActionEvent e) {
        graphicsPanel.repaint();
    }

    private class GraphicsPanel extends JPanel {
        @Override
        public void paint(Graphics g) {
            Graphics2D g2d = (Graphics2D) g;
            g2d.setFont(getFont().deriveFont(Font.BOLD));
            g2d.setColor(Color.BLACK);
            g2d.fillRect(0, 0, screenSize.width, screenSize.height);
            //当前列
            int currentColumn = 0;
            for (int x = 0; x < screenSize.width; x += gap) {
                int endPos = posArr[currentColumn];
                g2d.setColor(Color.CYAN);
                g2d.drawString(String.valueOf(getChr()), x, endPos * gap);
                int cg = 0;
                for (int j = endPos - 15; j < endPos; j++) {
                    //颜色渐变
                    cg += 20;
                    if (cg > 255) {
                        cg = 255;
                    }
                    g2d.setColor(new Color(0, cg, 0));
                    g2d.drawString(String.valueOf(getChr()), x, j * gap);
                }
                //每放完一帧,当前列上雨点的位置随机下移1~5行
                posArr[currentColumn] += random.nextInt(5);
                //当雨点位置超过屏幕高度时,重新产生一个随机位置
                if (posArr[currentColumn] * gap > getHeight()) {
                    posArr[currentColumn] = random.nextInt(lines);
                }
                currentColumn++;
            }
            if(gi>6){
                g2d.setFont(new Font("italicc",3,25));
                g2d.setColor(Color.WHITE);
                g2d.drawString("欢迎使用酒店管理系统", getWidth()/2-100, getHeight()/2);
            }
            if(gi++>25){
                dispose();
                new LoginFrame().setVisible(true);
            }
        }
    }

    public static void main(String[] args) {
        new RunFrame();
    }
}

2.UserFrame

package com.ludashen.frame;

import com.ludashen.control.*;

import com.ludashen.dao.CommentDao;
import com.ludashen.dao.HouseDao;
import com.ludashen.dao.RoomInfoDao;
import com.ludashen.dao.UserDao;
import com.ludashen.hothl.Comment;
import com.ludashen.hothl.House;
import com.ludashen.hothl.RoomInfo;


import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;



public class UserFrame extends JFrame {
    private Map<String, Object> userInfo;//保存用户信息的
    private JMenuBar menuBar;
    private JLabel title,img;   //选中列表显示房子标题和图片
    private JTextPane tDetails;     //客房详情
    private JTextPane tComment;     //顾客点评
    private List<House> house;
    private int hid;    //用于记录房子id的
    private String detail;  //记录房子详情的
    private JList buddyList;    //列表信息
    private int choose; //获取当前选择的列
    private List<String> image=new ArrayList<>();//用于放当前房间的片
    private int index;//记录当前放到那张照片了


    public UserFrame(String uid){
        //构造函数根据登录id查找用户信息
        super("酒店管理系统");
        try {
        userInfo= UserDao.users(uid);
        }catch (Exception e){
            JOptionPane.showMessageDialog(null,"没有这个用户请重新登录");
            System.exit(0);
        }
        setTitle("酒店系统----"+userInfo.get("uName")+"在线");
        init();
    }


    private void init() {


        setResizable(false);
        //设置标题图标
        setIconImage(Toolkit.getDefaultToolkit().getImage(getClass().getResource("/resource/log.png")));

        title= new JLabel();
        img=new JLabel();
        tDetails=new JTextPane();
        tComment=new JTextPane();
        tComment.setEnabled(false);
        tDetails.setEnabled(false);
        tDetails.setBackground(new Color(0x134FAE));
        addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent e) {
                super.windowClosing(e);
                if (JOptionPane.showConfirmDialog(null, "是否最小化托盘") != 0) {
                    System.exit(0);
                }
            }
        });
        tDetails.setContentType("text/html");
        tComment.setContentType("text/html");
        title.setFont(new Font("",1,30));


        topBar();

        Tool.SystemTrayInitial(this);
        this.add(mainPanel());
        this.setSize(900,750);
        this.setLocationRelativeTo(null);
    }


    private JPanel mainPanel(){



        JPanel p=new JPanel(null);
        JPanel panel = new JPanel();

        tDetails.setOpaque(false);
        RScrollPane details=new RScrollPane(tDetails,"/resource/bg1.jpg");

        panel.setLayout(new BorderLayout());
        JPanel p2=new JPanel(new BorderLayout());
        JTextField field=new JTextField(50);
        field.setSize(500,30);
        RButton send=new RButton("发送");
        p2.add(field,BorderLayout.WEST);
        p2.add(send,BorderLayout.EAST);
        panel.add(p2, BorderLayout.SOUTH);

        tComment.setOpaque(false);
        RScrollPane comment=new RScrollPane(tComment,"/resource/bg1.jpg");

        panel.add(comment, BorderLayout.CENTER);


        JTabbedPane jTabbedPane =Tool.jTabbedPane(235,450,p,640,215);
        jTabbedPane.setTabPlacement(1);
        Tool.Tabp(jTabbedPane,"酒店详情", "/resource/tabp/applicatio.png",details, "详情");
        Tool.Tabp(jTabbedPane,"点评列表", "/resource/tabp/Comment.png", panel, "列表");

        RButton ding=Tool.rButton(800,5,"预定",p,80);
        title.setBounds(240,5,260,45);
        img.setBounds(240,50,630,400);
        p.add(Tool.getFunButton(500, 10, "/resource/button/back1.png", "/resource/button/back2.png", e->{
            setBackImage();
        }));
        p.add(Tool.getFunButton(600, 10, "/resource/button/next1.png", "/resource/button/next2.png", e -> {
            setNetImage();
        }));

        RButton refresh=Tool.rButton(0,633,"刷新",p,235);

        send.addActionListener(e->{
            Comment comment1=new Comment((String) userInfo.get("uid"),String.valueOf(hid),field.getText());
            if(CommentDao.setCommentDao(comment1)) {
                tComment.setText(commentDao());
                JOptionPane.showMessageDialog(null,"评论成功!");
                field.setText("");
            }
        });

        ding.addActionListener(e ->{
            new YudingDialog(house.get(choose).getHid(),(String) userInfo.get("uid"),(Float) userInfo.get("money")).setVisible(true);
        });

        refresh.addActionListener(e -> {
            reRoom();
        });

        p.add(img);
        p.add(title);
        p.add(listRoom());
        p.add(refresh);
        return p;
    }

    private JScrollPane listRoom(){
        buddyList = new JList();
        buddyList.setOpaque(false);
        reRoom();
        if(house.size()!=0){
            img.setIcon(new ImageIcon((Image) new ImageIcon("image\\room\\"+house.get(0).gethImg()).getImage().getScaledInstance(630, 400,Image.SCALE_DEFAULT )));
            title.setText(house.get(0).gethName());
            image.add(house.get(0).gethImg());
            hid=house.get(0).getHid();
            detail= "<html><h2>详情:"+house.get(0).gethDetails()+"</h2>"+roomInfo()+"</html>";
            tDetails.setText(detail);
            choose=0;
        }
        else {
            tDetails.setText("<h1>没有空房间</h1>");
        }

        buddyList.addListSelectionListener(e -> {
            if(buddyList.getValueIsAdjusting())
            try {
                img.setIcon(new ImageIcon((Image) new ImageIcon("image\\room\\"+house.get(buddyList.getSelectedIndex()).gethImg()).getImage().getScaledInstance(630, 400,Image.SCALE_DEFAULT )));    //设置JLable的图片
                image.clear();
                index=0;
                image.add(house.get(buddyList.getSelectedIndex()).gethImg());
                hid=house.get(buddyList.getSelectedIndex()).getHid();
                detail= "<html><h2>详情:"+house.get(buddyList.getSelectedIndex()).gethDetails()+"</h2>"+roomInfo()+"</html>";
                title.setText(house.get(buddyList.getSelectedIndex()).gethName());
                tDetails.setText(detail);
                tComment.setText(commentDao());
                choose=buddyList.getSelectedIndex();

                for (RoomInfo imgs:RoomInfoDao.getRoomInfo(hid,3)){
                    image.add(imgs.getFuntion());
                }

            }catch (Exception e1){
                buddyList.clearSelection();
            }

        });

        buddyList.setCellRenderer(new FriListCellRenderer());
        buddyList.setFont(new Font(Font.SERIF, Font.PLAIN, 18));
        buddyList.setPreferredSize(new Dimension(230, 72*house.size()));
        RScrollPane jp = new RScrollPane(buddyList,"");
        jp.setBounds(0,0,233,630);
        return jp;
    }

    private void setNetImage() {

        if(index==image.size()-1) {
            JOptionPane.showMessageDialog(null,"已经是最后一张了");
            return;
        }
        else
            index++;
            img.setIcon(new ImageIcon((Image) new ImageIcon("image\\room\\"+image.get(index)).getImage().getScaledInstance(630, 400,Image.SCALE_DEFAULT )));
    }

    private void setBackImage(){
        if(index==0) {
            JOptionPane.showMessageDialog(null,"已经是第一张了");
            return;
        }
        index--;
        img.setIcon(new ImageIcon((Image) new ImageIcon("image\\room\\"+image.get(index)).getImage().getScaledInstance(630, 400,Image.SCALE_DEFAULT )));

    }

    public void reRoom(){
   
  

        house= HouseDao.getHouser(2);
        HouseModel buddy = new HouseModel(house);
        buddyList.setModel(buddy);


    }

    private String roomInfo(){


        List<RoomInfo> roomInfo =RoomInfoDao.getRoomInfo(hid,1);
        StringBuffer str=new StringBuffer();
        for(RoomInfo info:roomInfo){
            str.append("<p>"+info.getName()+":");
            str.append(info.getFuntion()+"</p>");
        }
        return str.toString();
    }
    private String commentDao(){
        int a=0;
        List<Comment> comments= CommentDao.getRoomComment(String.valueOf(hid),1);
        StringBuffer str=new StringBuffer();
        str.append("<html>");
        for (Comment comment:comments){
            if(a%2==0) {
                str.append("<div style='background-color:#3333CC;'><span style='font-size: 20px'>");
                str.append(comment.getUid() + "</span><br>");
                str.append(comment.getComment() + "<br>" + comment.getDate());
                str.append("<br></div>");
            }else {
                str.append("<div  style='background-color:#3300FF;'><span style='font-size: 20px'>");
                str.append(comment.getUid() + "</span><br>");
                str.append(comment.getComment() + "<br>" + comment.getDate());
                str.append("<br></div>");
            }
            a++;
        }
        if (comments.size()==0)
            str.append("占时没有评论");

        str.append("</table></html>");
        return str.toString();
    }





    private void topBar() {
  
 
        menuBar = new JMenuBar();
        menuBar.setLayout(null);
        JButton head=new CircleButton(40,(String)userInfo.get("head"));
        head.setBounds(840, 0, 40, 40);
        head.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                new UserInfoDialog(userInfo).setVisible(true);
            }
        });

        JMenu menu = new JMenu("酒店");
        menu.setBounds(0,0,80,30);
        JMenuItem zmenu = new JMenuItem("酒店简介");
        zmenu.addActionListener(e->{
            IntroduceDialog introduceDialog = new IntroduceDialog();
            introduceDialog.setVisible(true);
            new Thread(introduceDialog).start();
        });
        menu.add(zmenu);
        menuBar.add(head);
        menuBar.add(menu);
        menuBar.setPreferredSize(new Dimension(300, 40));
        setJMenuBar(menuBar);
    }
}

3.loginFrame

package com.ludashen.frame;

import com.ludashen.control.*;
import com.ludashen.dao.AdminDao;
import com.ludashen.dao.ContFile;
import com.ludashen.dao.UserDao;
import jdk.nashorn.internal.scripts.JO;

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.net.URL;
import java.sql.SQLException;

public class LoginFrame extends JFrame {
    private RPanel RP1;
    private RPanel RP2;
    private JPanel p;
    private JTextField userName;
    private JPasswordField password;
    private static Boolean isAdmin=false;
    private JLabel head;
    ContFile file=new ContFile();
    public LoginFrame(){
        super();
        init();
    }

    public static void setAdmin(Boolean b){
        isAdmin=b;
    }

    private void init(){


        setResizable(false);
        //设置图片
        URL re = getClass().getResource("/resource/log.png");
        ImageIcon ico =new ImageIcon(re);
        setIconImage(Toolkit.getDefaultToolkit().getImage(re));//设置标题图标
        this.setLayout(null);
        RP1=new RPanel("/resource/Lmain.png");
        RP2=new RPanel("/resource/login.png");
        RP1.setBounds(0,0,600,400);
        RP2.setBounds(0,400,600,100);
        RP2.setLayout(null);
        RP1.setLayout(null);


        Tool.jLabel(50,40,"账号:",RP2);
        Tool.jLabel(280,40,"密码:",RP2);
        userName= Tool.jTextField(100, 40, RP2,162);
        password=Tool.passwordField(330, 40, '*',RP2,159);

        head=Tool.jLabel(250,150,"",RP1,100,100);

        userName.addKeyListener(new KeyAdapter() {
            @Override
            public void keyReleased(KeyEvent e) {
                super.keyReleased(e);
                head.setIcon(new ImageIcon((Image) new ImageIcon("image\\head\\" +UserDao.head(userName.getText())).getImage().getScaledInstance(100, 100,Image.SCALE_DEFAULT )));
            }
        });
        RButton LoginButton=Tool.rButton(500, 39,"登录",RP2,80);
        JLabel register=Tool.jLabel(530, 69,"快速注册",RP2);
        JLabel set=Tool.jLabel(480, 69, "设置",RP2);

        setChangColor(register, new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                new Register().setVisible(true);
                dispose();
            }
        });

        setChangColor(set, new MouseAdapter() {
            @Override
            public void mouseClicked(MouseEvent e) {
                super.mouseClicked(e);
                new LoginSetDialog().setVisible(true);
            }
        });

        RP1.add(Tool.getFunButton(560, 5, "/resource/close2.png", "/resource/close1.png", e->{
               System.exit(0);
        }));
        RP1.add(Tool.getFunButton(520, 5, "/resource/min1.png", "/resource/min2.png", e -> {
                setExtendedState(JFrame.ICONIFIED);
        }));

        LoginButton.addActionListener(e -> {
            try {
                String pass = file.readFile("pass");
                String[] sp = pass.split("@");
                String name = userName.getText();
                String spass = new String(password.getPassword());
                if (!isAdmin) {
                    if (UserDao.getUser(name, spass)) {
                        if (sp[0].trim().equals("0")) {
                            file.writeFile("pass", "0@" + name + "@" + spass);
                        } else {
                            file.writeFile("pass", "1");
                        }
                        new UserFrame(name).setVisible(true);
                        dispose();
                    } else {
                        JOptionPane.showMessageDialog(null, "您现在正在登陆用户系统,而用户密码或名字错误");
                    }
                } else {
                    if (AdminDao.getAdminLogin(name, spass)) {
                        if (sp[0].trim().equals("0")) {
                            file.writeFile("pass", "0@" + name + "@" + spass);
                        } else {
                            file.writeFile("pass", "1");
                        }
                        new AdminFrame(name).setVisible(true);
                        dispose();
                    } else {
                        JOptionPane.showMessageDialog(null, "您现在正在登陆管理系统,用户密码或名字错误");
                    }

                }
            }catch (Exception e1){
//                new ContFile().writeFile("e.txt",e1.printStackTrace());
                JOptionPane.showMessageDialog(null,e1.getLocalizedMessage());
            }
        });

        pass();
        this.add(RP1);
        this.add(RP2);
        this.setUndecorated(true);//去掉标题栏
        this.setSize(600,500);
        this.setLocationRelativeTo(null);
        this.setDefaultCloseOperation(3);
    }

    private void pass(){
        String pass=file.readFile("pass");
        String[] sp=pass.split("@");
        if(sp[0].trim().equals("0")&&sp.length>1){
            userName.setText(sp[1]);
            password.setText(sp[2]);
            head.setIcon(new ImageIcon((Image) new ImageIcon("image\\head\\" +sp[1]).getImage().getScaledInstance(100, 100,Image.SCALE_DEFAULT )));
        }
    }



    private void setChangColor(JLabel jLabel,MouseListener l){

        jLabel.addMouseListener(l);
        jLabel.addMouseListener(new MouseAdapter() {
            @Override
            public void mouseEntered(MouseEvent e) {
                super.mouseEntered(e);
                jLabel.setForeground(Color.WHITE);
            }

            @Override
            public void mouseExited(MouseEvent e) {
                super.mouseExited(e);
                jLabel.setForeground(Color.ORANGE);
            }

        });
    }

    public void setUser(String name,String pass){

        userName.setText(name);
        password.setText(pass);
    }

}

五、联系与交流

扣:969060742 运行视频 完整程序资源 sql 程序资源

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/234249.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

【C++ 程序设计入门基础】- 第3节-循环结构02

目录 while 语句 案例 while 循环 输入一个整数 n &#xff0c;输出 1~n 的所有整数。 查看运行结果&#xff1a; while 语句结构解析 do while 语句 案例 do while 循环 输入一个整数n&#xff0c;输出1&#xff5e;n的所有整数。 查看运行结果 while、do while的区别 …

Go压测工具

前言 在做Go的性能分析调研的时候也使用到了一些压测方面的工具&#xff0c;go本身也给我们提供了BenchMark性能测试用例&#xff0c;可以很好的去测试我们的单个程序性能&#xff0c;比如测试某个函数&#xff0c;另外还有第三方包go-wrk也可以帮助我们做http接口的性能压测&…

TCP为什么可靠之“重传机制”

TCP重传机制 TCP针对数据包丢失的情况&#xff0c;会通过重传机制解决&#xff0c;包括像超时重传、快速重传、选择确认SACK、D-SACK 超时重传 TCP会设置一个定时器&#xff0c;如果在发送数据之后的规定时间内&#xff0c;没有收到对方的ACK报文&#xff0c;就会触发重新发…

【Qt开发流程】之容器类2:使用STL风格迭代器进行遍历

概述 对于每个容器类&#xff0c;都有两种stl风格的迭代器类型:一种提供只读访问&#xff0c;另一种提供读写访问。应该尽可能使用只读迭代器&#xff0c;因为它们比读写迭代器快。 STL迭代器的API以数组中的指针为模型。例如&#xff0c;操作符将迭代器推进到下一项&#xf…

vue2+datav可视化数据大屏(1)

开始 &#x1f4d3; 最近打算出一个前端可视化数据大屏的系列专栏&#xff0c;这次将很全面的教大家设计可视化大屏&#xff0c;从开始到打包结束&#xff0c;其中&#xff0c;包括如何设计框架&#xff0c;如何封装axios&#xff0c;等等&#xff0c;本次使用的数据均为mock数…

关于AllowBeanDefinitionOverriding属性设置问题

&#x1f4e2;&#x1f4e2;&#x1f4e2;&#x1f4e3;&#x1f4e3;&#x1f4e3; 哈喽&#xff01;大家好&#xff0c;我是「奇点」&#xff0c;江湖人称 singularity。刚工作几年&#xff0c;想和大家一同进步&#x1f91d;&#x1f91d; 一位上进心十足的【Java ToB端大厂…

二叉树的OJ练习(二)

通过前序遍历数组构建二叉树 题目&#xff1a;通过前序遍历的数组&#xff08;ABD##E#H##CF##G##&#xff09;构建二叉树 TreeNode* TreeCreat(char* a,int* pi) {if(a[*pi] #){(*pi);return NULL; }TreeNode* root (TreeNode*)malloc(sizeof(TreeNode));if(root NULL){p…

【Unity动画】Avatar Mask

创建 Avatar Mask可以设置那一部分骨骼运动和不运动 然后放在状态机里面的层中来混合 【后续完善】

前端入门:HTML初级指南,网页的简单实现!

代码部分&#xff1a; <!DOCTYPE html> <!-- 上方为DOCTYPE声明&#xff0c;指定文档类型为HTML --> <html lang"en"> <!-- html标签为整个页面的根元素 --> <head> <!-- title标签用于定义文档标题 --> <title>初始HT…

快速测试 3节点的redis sentinel集群宕机2个节点以后是否仍能正常使用

有同事问我&#xff0c;三个redis sentinel节点&#xff0c;宕机两个节点以后&#xff0c;是否还能够正常的通过redis sentinel正常访问redis的数据。我想了想&#xff0c;理论上是可以的&#xff0c;但是我没试过&#xff0c;今天有时间就测试了一下。搭建环境和测试代码的过程…

Linux Component概述和高通component的使用

1 Linux为什么要引入Component框架&#xff1f; 为了让subsystem按照一定顺序初始化设备才提出来的。 subsystem中由很多设备模块&#xff0c;内核加载这些模块的时间不确定。子系统内有些模块是需要依赖其它模块先初始化才能进行自己初始化工作(例如v4l2 subdev和v4l2 video …

虚拟化之通用计时器

Arm架构包含通用定时器(Generic Timer),这是每个处理器中都有的一组标准化定时器。通用定时器包括一组比较器,这些比较器与一个共同的系统计数进行比较。当比较器的值等于或小于系统计数时,该比较器会生成中断。在下图中,我们可以看到系统中的通用定时器(橙色)以及其比…

HTML+CSS+JavaScript制作简单轮播图

一 运行效果 二 图片资源 三 代码 <!DOCTYPE html> <html><head><meta charset"utf-8"><title></title><style>img{position:absolute;top:6%;left:20%;width:800px;height:240px;}.picture {back…

【FMCW毫米波雷达设计 】 — FMCW波形

原书&#xff1a;FMCW Radar Design 1 引言 本章研究驱动FMCW雷达的主要波形:线性调频(LFM)波形。我们研究信号的行为及其性质。随后&#xff0c;本章讨论了匹配滤波理论&#xff0c;并研究了压缩这种波形的技术&#xff0c;特别是所谓的拉伸处理&#xff0c;它赋予FMCW雷达极…

最长子序列问题(LCS)--动态规划解法

题目描述&#xff1a; 如果Z既是X的子序列&#xff0c;又是Y的子序列&#xff0c;则称Z为X和Y的公共子序列。 如果给定X、Y&#xff0c;求出最长Z及其长度。 示例&#xff1a; 输入 ABCPDSFJGODIHJOFDIUSHGD OSDIHGKODGHBLKSJBHKAGHI 输出 SDIHODSHG 9 分析&#xff1a…

课堂练习4.2:页式内存管理

4-3 课堂练习4.2:页式内存管理 创建一个进程(创建进程是在磁盘中),进程以字节为单位编号,然后再进程分为许多页(每页 4KB ),内存中有对应的页框(设定同页)。通过页表(记录页和页框的对应关系),将最需要的页调入内存,其他页留在磁盘中。根据 CPU 的需要动态的更新…

鸿蒙开发之封装优化

面向对象开发离不开封装&#xff0c;将重复的可以复用的代码封装起来&#xff0c;提高开发效率。 基于之前的List&#xff0c;对代码进行封装。 1、抽取component 将List的头部抽离出来作为一个新的component。可以创建一个新的ArkTS文件&#xff0c;写我们的头部代码 为了…

Springboot获取jar版本方法

Springboot获取jar版本方法 方案一: 通过jar的pom.properties文件获取 获取demo Properties properties new Properties(); try {properties.load(RakicAppInfo.class.getResourceAsStream("/META-INF/maven/com.rakic.framework/rakic-app-springboot-start/pom.pro…

Kubernetes里的DNS;API资源对象ingress;Kubernetes调度;节点选择器NodeSelector;节点亲和性NodeAffinity

Kubernetes里的DNS K8s集群内有一个DNS服务&#xff1a; kubectl get svc -n kube-system |grep dns测试&#xff1a; 在tang3上安装bind-utils,目的是安装dig命令 yum install -y bind-utils apt install dnsutils #ubuntu上 解析外网域名 dig 10.15.0.10 www.baidu.com…

JavaScript-节点操作

节点操作 DOM节点 DOM节点&#xff1a;DOM树里每一个内容都称之为节点 节点类型&#xff1a; 元素节点 所有的标签 比如body、divhtml时跟节点 属性节点 所有的属性&#xff0c;比如href 文本节点 所有的文本 其他 查找节点 节点的关系&#xff1a;针对的找亲戚返回的都是…
最新文章