当前位置: 首页 > news >正文

Java 家庭物联网

家庭物联网系统的代码和说明,包括用户认证、设备控制、数据监控、通知和警报、日志记录以及WebSocket实时更新功能。

### 项目结构

```plaintext
home-iot-system
├── backend
│   └── src
│       └── main
│           └── java
│               └── com
│                   └── example
│                       └── homeiot
│                           ├── config
│                           ├── controller
│                           ├── model
│                           ├── repository
│                           ├── service
│                           ├── websocket
│                           └── HomeIotApplication.java
├── frontend
│   ├── public
│   └── src
│       ├── components
│       ├── pages
│       ├── services
│       └── App.js
├── pom.xml
└── package.json
```

### 后端(Spring Boot)

#### `pom.xml`

```xml
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://www.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>home-iot-system</artifactId>
    <version>1.0-SNAPSHOT</version>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-websocket</artifactId>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>
</project>
```

#### `HomeIotApplication.java`

```java
package com.example.homeiot;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class HomeIotApplication {
    public static void main(String[] args) {
        SpringApplication.run(HomeIotApplication.class, args);
    }
}
```

#### 用户认证和角色管理

##### `SecurityConfig.java`

```java
package com.example.homeiot.config;

import com.example.homeiot.service.UserService;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {

    private final UserService userService;

    public SecurityConfig(UserService userService) {
        this.userService = userService;
    }

    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.userDetailsService(userService).passwordEncoder(passwordEncoder());
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http
            .csrf().disable()
            .authorizeRequests()
                .antMatchers("/api/**").authenticated()
                .antMatchers("/admin/**").hasRole("ADMIN")
                .anyRequest().permitAll()
                .and()
            .formLogin()
                .and()
            .httpBasic();
    }

    @Bean
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder();
    }
}
```

##### `Role.java`

```java
package com.example.homeiot.model;

import javax.persistence.*;
import java.util.Set;

@Entity
public class Role {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;

    @ManyToMany(mappedBy = "roles")
    private Set<User> users;

    // getters and setters
}
```

##### `User.java`

```java
package com.example.homeiot.model;

import javax.persistence.*;
import java.util.Set;

@Entity
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String username;
    private String password;

    @ManyToMany(fetch = FetchType.EAGER)
    @JoinTable(
      name = "user_role", 
      joinColumns = @JoinColumn(name = "user_id"), 
      inverseJoinColumns = @JoinColumn(name = "role_id"))
    private Set<Role> roles;

    // getters and setters
}
```

##### `UserRepository.java`

```java
package com.example.homeiot.repository;

import com.example.homeiot.model.User;
import org.springframework.data.repository.CrudRepository;

public interface UserRepository extends CrudRepository<User, Long> {
    User findByUsername(String username);
}
```

##### `RoleRepository.java`

```java
package com.example.homeiot.repository;

import com.example.homeiot.model.Role;
import org.springframework.data.repository.CrudRepository;

public interface RoleRepository extends CrudRepository<Role, Long> {
}
```

##### `UserService.java`

```java
package com.example.homeiot.service;

import com.example.homeiot.model.User;
import com.example.homeiot.repository.UserRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;

@Service
public class UserService implements UserDetailsService {
    @Autowired
    private UserRepository userRepository;

    @Autowired
    private PasswordEncoder passwordEncoder;

    public User save(User user) {
        user.setPassword(passwordEncoder.encode(user.getPassword()));
        return userRepository.save(user);
    }

    public User findByUsername(String username) {
        return userRepository.findByUsername(username);
    }

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        User user = userRepository.findByUsername(username);
        if (user == null) {
            throw new UsernameNotFoundException("User not found");
        }
        return org.springframework.security.core.userdetails.User
                .withUsername(username)
                .password(user.getPassword())
                .authorities(user.getRoles().stream()
                        .map(role -> "ROLE_" + role.getName().toUpperCase())
                        .toArray(String[]::new))
                .build();
    }
}
```

#### 设备数据监控和日志记录

##### `Device.java`

```java
package com.example.homeiot.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;

@Entity
public class Device {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private String name;
    private String status;
    private String data;
    private LocalDateTime lastUpdated;

    // getters and setters
}
```

##### `DeviceLog.java`

```java
package com.example.homeiot.model;

import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.time.LocalDateTime;

@Entity
public class DeviceLog {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    private Long deviceId;
    private String status;
    private String data;
    private LocalDateTime timestamp;

    // getters and setters
}
```

##### `DeviceLogRepository.java`

```java
package com.example.homeiot.repository;

import com.example.homeiot.model.DeviceLog;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface DeviceLogRepository extends CrudRepository<DeviceLog, Long> {
    List<DeviceLog> findByDeviceId(Long deviceId);
}
```

##### `DeviceRepository.java`

```java
package com.example.homeiot.repository;

import com.example.homeiot.model.Device;
import org.springframework.data.repository.CrudRepository;

public interface DeviceRepository extends CrudRepository<Device, Long> {
}
```

##### `DeviceService.java`

```java
package com.example.homeiot.service;

import com.example.homeiot.model.Device;
import com.example.homeiot.model.DeviceLog;
import com.example.homeiot.repository.DeviceLogRepository;
import com.example.homeiot.repository.DeviceRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.simp.SimpMessagingTemplate;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Service
public class DeviceService {
    @Autowired
    private DeviceRepository deviceRepository;

    @Autowired
    private DeviceLogRepository deviceLogRepository;

    @Autowired
    private SimpMessagingTemplate messagingTemplate;

    public List<Device> getAllDevices() {
        return (List<Device>) deviceRepository.findAll();
    }

    public Device addDevice(Device device) {
        device.setLastUpdated(LocalDateTime.now());
        return deviceRepository.save(device);
    }

    public Device updateDeviceStatus(Long id, String status) {
        Device device = deviceRepository.findById(id).orElseThrow(() -> new RuntimeException("Device not found"));
        device.setStatus(status);
        device.setLastUpdated(LocalDateTime.now());
        deviceRepository.save(device);

        DeviceLog log = new DeviceLog();
        log.setDeviceId(id);
        log.setStatus(status);
        log.setTimestamp(LocalDateTime.now());
        deviceLogRepository.save(log);

        messagingTemplate.convertAndSend("/topic/devices", device);

        return device;
    }

    public List<DeviceLog> getDeviceLogs(Long deviceId) {
        return deviceLogRepository.findByDeviceId(deviceId);
    }
}
```

##### `DeviceController.java`

```java
package com.example.homeiot.controller;

import com.example.homeiot.model.Device;
import com.example.homeiot.model.DeviceLog;
import com.example.homeiot.service.DeviceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/devices")
public class DeviceController {
    @Autowired
    private DeviceService deviceService;

    @GetMapping
    public List<Device> getAllDevices() {
        return deviceService.getAllDevices();
    }

    @PostMapping
    public Device addDevice(@RequestBody Device device) {
        return deviceService.addDevice(device);
    }

    @PutMapping("/{id}/status")
    public Device updateDeviceStatus(@PathVariable Long id, @RequestParam String status) {
        return deviceService.updateDeviceStatus(id, status);
    }

    @GetMapping("/{id}/logs")
    public List<DeviceLog> getDeviceLogs(@PathVariable Long id) {
        return deviceService.getDeviceLogs(id);
    }

    @MessageMapping("/changeStatus")
    @SendTo("/topic/devices")
    public Device changeDeviceStatus(Device device) {
        return deviceService.updateDeviceStatus(device.getId(), device.getStatus());
    }
}
```

#### WebSocket 实时更新

##### `WebSocketConfig.java`

```java
package com.example.homeiot.websocket;

import org.springframework.context.annotation.Configuration;
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
import org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker;
import org.springframework.web.socket.config.annotation.StompEndpointRegistry;
import org.springframework.web.socket.config.annotation.WebSocketMessageBrokerConfigurer;

@Configuration
@EnableWebSocketMessageBroker
public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {

    @Override
    public void configureMessageBroker(MessageBrokerRegistry config) {
        config.enableSimpleBroker("/topic");
        config.setApplicationDestinationPrefixes("/app");
    }

    @Override
    public void registerStompEndpoints(StompEndpointRegistry registry) {
        registry.addEndpoint("/ws").withSockJS();
    }
}
```

### 前端(React)

#### `package.json`

```json
{
  "name": "home-iot-frontend",
  "version": "1.0.0",
  "dependencies": {
    "axios": "^0.21.1",
    "react": "^17.0.2",
    "react-dom": "^17.0.2",
    "react-router-dom": "^5.2.0",
    "react-scripts": "4.0.3",
    "sockjs-client": "^1.5.0",
    "@stomp/stompjs": "^6.1.0"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  }
}
```

#### `App.js`

```jsx
import React, { useState, useEffect } from 'react';
import axios from 'axios';
import SockJS from 'sockjs-client';
import { Stomp } from '@stomp/stompjs';

function App() {
  const [devices, setDevices] = useState([]);
  const [deviceName, setDeviceName] = useState('');
  const [client, setClient] = useState(null);

  useEffect(() => {
    fetchDevices();
    connectWebSocket();
  }, []);

  const fetchDevices = () => {
    axios.get('/api/devices')
      .then(response => setDevices(response.data))
      .catch(error => console.error('Error fetching devices:', error));
  };

  const addDevice = () => {
    axios.post('/api/devices', { name: deviceName, status: 'off' })
      .then(response => {
        setDevices([...devices, response.data]);
        setDeviceName('');
      })
      .catch(error => console.error('Error adding device:', error));
  };

  const updateDeviceStatus = (deviceId, status) => {
    axios.put(`/api/devices/${deviceId}/status`, null, { params: { status } })
      .then(response => {
        const updatedDevices = devices.map(device => device.id === deviceId ? response.data : device);
        setDevices(updatedDevices);
      })
      .catch(error => console.error('Error updating device status:', error));
  };

  const connectWebSocket = () => {
    const socket = new SockJS('/ws');
    const stompClient = Stomp.over(socket);
    stompClient.connect({}, frame => {
      console.log('Connected: ' + frame);
      stompClient.subscribe('/topic/devices', message => {
        const updatedDevice = JSON.parse(message.body);
        setDevices(prevDevices =>
          prevDevices.map(device => device.id === updatedDevice.id ? updatedDevice : device)
        );
      });
    });
    setClient(stompClient);
  };

  return (
    <div>
      <h1>Home IoT System</h1>
      <input
        type="text"
        value={deviceName}
        onChange={e => setDeviceName(e.target.value)}
        placeholder="Enter device name"
      />
      <button onClick={addDevice}>Add Device</button>
      <ul>
        {devices.map(device => (
          <li key={device.id}>
            {device.name} - {device.status}
            <button onClick={() => updateDeviceStatus(device.id, device.status === 'off' ? 'on' : 'off')}>
              Toggle Status
            </button>
          </li>
        ))}
      </ul>
    </div>
  );
}

export default App;
```

系统具备了用户认证、角色管理、设备数据监控、日志记录、通知和警报、以及WebSocket实时更新功能。

相关文章:

Java 家庭物联网

家庭物联网系统的代码和说明&#xff0c;包括用户认证、设备控制、数据监控、通知和警报、日志记录以及WebSocket实时更新功能。 ### 项目结构 plaintext home-iot-system ├── backend │ └── src │ └── main │ └── java │ └…...

机器学习——随机森林

随机森林 1、集成学习方法 通过构造多个模型组合来解决单一的问题。它的原理是生成多个分类器/模型&#xff0c;各自独立的学习和做出预测。这些预测最后会结合成组合预测&#xff0c;因此优于任何一个单分类得到的预测。 2、什么是随机森林&#xff1f; 随机森林是一个包含…...

Java - JDK17语法新增特性(如果想知道Java - JDK17语法新增常见的特性的知识点,那么只看这一篇就足够了!)

前言&#xff1a;Java在2021年发布了最新的长期支持版本&#xff1a;JDK 17。这个版本引入了许多新的语法特性&#xff0c;提升了开发效率和代码可读性。本文将简要介绍一些常见的新特性&#xff0c;帮助开发者快速掌握并应用于实际开发中。 ✨✨✨这里是秋刀鱼不做梦的BLOG ✨…...

Linux-DNS

DNS域名解析服务 1.DNS介绍 DNS 是域名系统 (Domain Name System) 的缩写&#xff0c;是因特网的一项核心服务&#xff0c;它作为可以将域名和IP地址相互映射的一个分布式数据库&#xff0c;能够使人更方便的访问互联网&#xff0c;而不用去记住能够被机器直接读取的IP数串。…...

使用gitlab的CI/CD实现logseq笔记自动发布为单页应用

使用gitlab的CI/CD实现logseq笔记自动发布为单页应用 使用gitlab的CI/CD实现logseq笔记自动发布为单页应用如何实现将logseq的笔记发布成网站使用 logseq-publish-docker 实现手动发布使用gitlab的CI/CD实现自动发布过程中的问题及解决参考资料 使用gitlab的CI/CD实现logseq笔记…...

云联壹云 FinOps:赋能某车企公有云成本管理与精细化运营

背景 某车企&#xff0c;世界 500 强企业&#xff0c;使用了大量的公有云资源&#xff0c;分布于多家公有云&#xff0c;月消费在千万级别。 业务线多且分散&#xff0c;相关的云消耗由一个核心团队进行管理&#xff0c;本次案例的内容将围绕这些云成本的管理展开的。 需求 …...

C#静态类与非静态类

1、静态类 静态类有几个重要的特点&#xff1a; 1&#xff09;无法实例化&#xff1a;由于静态类不能被实例化&#xff0c;因此它不会占用对象内存。 2&#xff09;静态成员&#xff1a;静态类只能包含静态成员&#xff08;静态方法、静态属性、静态事件等&#xff09;。 3&am…...

亚信安全:《2024云安全技术发展白皮书》

标签 云计算 安全威胁 云安全技术 网络攻击 数据保护 一句话总结 《云安全技术发展白皮书》全面分析了云计算安全威胁的演进&#xff0c;探讨了云安全技术的发展历程、当前应用和未来趋势&#xff0c;强调了构建全面云安全防护体系的重要性。 摘要 云安全威胁演进&#xff…...

GuLi商城-商品服务-API-品牌管理-云存储开通与使用

这里学习下阿里云对象存储 地址&#xff1a;对象存储 OSS_云存储服务_企业数据管理_存储-阿里云 登录支付宝账号&#xff0c;找到了我以前开通的阿里云对象存储 熟悉下API 文档中心 简介_对象存储(OSS)-阿里云帮助中心 我们将用这种方式上传阿里云OSS...

git 命令行初始化并上传项目

XXXX 为项目名称 1. 初始化 cd D:\XXXX git init git remote add origin http://账号192.168.1.231:8088/r/XXXX.git 2. 拉取项目&#xff0c;做本地合并 git pull origin master git fetch origin git merge origin/master 3. 添加注释&#xff0c;上传 git add . git c…...

Spring框架Mvc(2)

1.传递数组 代码示例 结果 2.集合参数存储并进行存储类似集合类 代码示例 postman进行测试 &#xff0c;测试结果 3.用Json来对其进行数据的传递 &#xff08;1&#xff09;Json是一个经常使用的用来表示对象的字符串 &#xff08;2&#xff09;Json字符串在字符串和对象…...

Python学习笔记29:进阶篇(十八)常见标准库使用之质量控制中的数据清洗

前言 本文是根据python官方教程中标准库模块的介绍&#xff0c;自己查询资料并整理&#xff0c;编写代码示例做出的学习笔记。 根据模块知识&#xff0c;一次讲解单个或者多个模块的内容。 教程链接&#xff1a;https://docs.python.org/zh-cn/3/tutorial/index.html 质量控制…...

【LLM】一、利用ollama本地部署大模型

目录 前言 一、Ollama 简介 1、什么是Ollama 2、特点&#xff1a; 二、Windows部署 1.下载 2.安装 3.测试安装 4.模型部署&#xff1a; 5.注意 三、 Docker部署 1.docker安装 2.ollama镜像拉取 3.ollama运行容器 4.模型部署&#xff1a; 5.注意&#xff1a; 总结 前言…...

Java毕业设计 基于SSM vue新生报到系统小程序 微信小程序

Java毕业设计 基于SSM vue新生报到系统小程序 微信小程序 SSM 新生报到系统小程序 功能介绍 学生 登录 注册 忘记密码 首页 学校公告 录取信息 录取详情 师资力量 教师详情 收藏 评论 用户信息修改 宿舍安排 签到信息 在线缴费 教室分配 我的收藏管理 我要发贴 我的发贴 管理…...

玩转云服务:Oracle Cloud甲骨文永久免费云服务器注册及配置指南

上一篇&#xff0c;带大家分享了&#xff1a;如何薅一台腾讯云服务器。 不过&#xff0c;只有一个月免费额度&#xff0c;到期后需要付费使用。 相对而言&#xff0c;海外云厂商更加慷慨一些&#xff0c;比如微软Azure、甲骨文、亚马逊AWS等。 甲骨文2019年9月就推出了永久免…...

Zabbix——宏

目录 宏的类型 常用宏 定义和使用宏 宏的优先级 使用宏的示例 在 Zabbix 中&#xff0c;宏&#xff08;Macros&#xff09;是一个非常强大的功能&#xff0c;允许你在监控配置中使用动态变量。宏可以在各种配置项中使用&#xff0c;例如触发器、动作、通知、图形和模板等。…...

Unity 简单载具路线 Waypoint 导航

前言 在游戏开发和导航系统中&#xff0c;"waypoint" 是指路径中的一个特定位置或点。它通常用于定义一个物体或角色在场景中移动的目标位置或路径的一部分。通过一系列的 waypoints&#xff0c;可以指定复杂的移动路径和行为。以下是一些 waypoint 的具体用途&…...

科普文:微服务之服务网格Service Mesh

一、ServiceMesh概念 背景 随着业务的发展&#xff0c;传统单体应用的问题越来越严重&#xff1a; 单体应用代码库庞大&#xff0c;不易于理解和修改持续部署困难&#xff0c;由于单体应用各组件间依赖性强&#xff0c;只要其中任何一个组件发生更改&#xff0c;将重新部署整…...

第四十九章 解决 IRIS 中的 SOAP 问题 - 发送消息时出现问题

文章目录 第四十九章 解决 IRIS 中的 SOAP 问题 - 发送消息时出现问题 第四十九章 解决 IRIS 中的 SOAP 问题 - 发送消息时出现问题 如果在向 IRIS Web 服务或客户端发送或接收 SOAP 消息时遇到问题&#xff0c;请考虑以下常见场景列表&#xff1a; SOAP 消息可能包含极长的字…...

STM32-HAL-FATFS(文件系统)(没做完,stm32f103zet6(有大佬的可以在评论区说一下次板子为什么挂载失败了))

1STM32Cube配置 1-1配置时钟 1-2配置调试端口 1-3配置uart 1-4配置SDIO&#xff08;注意参数&#xff09;&#xff08;其中他的初始化的异常函数给注释&#xff0c;SD卡文件写了&#xff09; 配置了还要打开中断和DMA可在我的其他文章中看一样的 1-5配置FatFs (只改了图选中…...

RestClient

什么是RestClient RestClient 是 Elasticsearch 官方提供的 Java 低级 REST 客户端&#xff0c;它允许HTTP与Elasticsearch 集群通信&#xff0c;而无需处理 JSON 序列化/反序列化等底层细节。它是 Elasticsearch Java API 客户端的基础。 RestClient 主要特点 轻量级&#xff…...

Lombok 的 @Data 注解失效,未生成 getter/setter 方法引发的HTTP 406 错误

HTTP 状态码 406 (Not Acceptable) 和 500 (Internal Server Error) 是两类完全不同的错误&#xff0c;它们的含义、原因和解决方法都有显著区别。以下是详细对比&#xff1a; 1. HTTP 406 (Not Acceptable) 含义&#xff1a; 客户端请求的内容类型与服务器支持的内容类型不匹…...

大型活动交通拥堵治理的视觉算法应用

大型活动下智慧交通的视觉分析应用 一、背景与挑战 大型活动&#xff08;如演唱会、马拉松赛事、高考中考等&#xff09;期间&#xff0c;城市交通面临瞬时人流车流激增、传统摄像头模糊、交通拥堵识别滞后等问题。以演唱会为例&#xff0c;暖城商圈曾因观众集中离场导致周边…...

el-switch文字内置

el-switch文字内置 效果 vue <div style"color:#ffffff;font-size:14px;float:left;margin-bottom:5px;margin-right:5px;">自动加载</div> <el-switch v-model"value" active-color"#3E99FB" inactive-color"#DCDFE6"…...

【项目实战】通过多模态+LangGraph实现PPT生成助手

PPT自动生成系统 基于LangGraph的PPT自动生成系统&#xff0c;可以将Markdown文档自动转换为PPT演示文稿。 功能特点 Markdown解析&#xff1a;自动解析Markdown文档结构PPT模板分析&#xff1a;分析PPT模板的布局和风格智能布局决策&#xff1a;匹配内容与合适的PPT布局自动…...

PL0语法,分析器实现!

简介 PL/0 是一种简单的编程语言,通常用于教学编译原理。它的语法结构清晰,功能包括常量定义、变量声明、过程(子程序)定义以及基本的控制结构(如条件语句和循环语句)。 PL/0 语法规范 PL/0 是一种教学用的小型编程语言,由 Niklaus Wirth 设计,用于展示编译原理的核…...

大模型多显卡多服务器并行计算方法与实践指南

一、分布式训练概述 大规模语言模型的训练通常需要分布式计算技术,以解决单机资源不足的问题。分布式训练主要分为两种模式: 数据并行:将数据分片到不同设备,每个设备拥有完整的模型副本 模型并行:将模型分割到不同设备,每个设备处理部分模型计算 现代大模型训练通常结合…...

【MATLAB代码】基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),附源代码|订阅专栏后可直接查看

文章所述的代码实现了基于最大相关熵准则(MCC)的三维鲁棒卡尔曼滤波算法(MCC-KF),针对传感器观测数据中存在的脉冲型异常噪声问题,通过非线性加权机制提升滤波器的抗干扰能力。代码通过对比传统KF与MCC-KF在含异常值场景下的表现,验证了后者在状态估计鲁棒性方面的显著优…...

uniapp 集成腾讯云 IM 富媒体消息(地理位置/文件)

UniApp 集成腾讯云 IM 富媒体消息全攻略&#xff08;地理位置/文件&#xff09; 一、功能实现原理 腾讯云 IM 通过 消息扩展机制 支持富媒体类型&#xff0c;核心实现方式&#xff1a; 标准消息类型&#xff1a;直接使用 SDK 内置类型&#xff08;文件、图片等&#xff09;自…...

6个月Python学习计划 Day 16 - 面向对象编程(OOP)基础

第三周 Day 3 &#x1f3af; 今日目标 理解类&#xff08;class&#xff09;和对象&#xff08;object&#xff09;的关系学会定义类的属性、方法和构造函数&#xff08;init&#xff09;掌握对象的创建与使用初识封装、继承和多态的基本概念&#xff08;预告&#xff09; &a…...