C++类和对象练习:Date类实现日期的差,比较日期的大小,日期的前置后置++,--,输入输出Date类,对默认函数的练习。
引言
C++类和对象练习:Date类实现日期的差,比较日期的大小,日期的前置后置++,--,输入输出Date类,对默认函数的练习。
_涂色_-博客主页
C++基础专栏
分三个文件来写:
Date.cpp //类函数的实现
Date.h //类函数的声明
Test.cpp //测试类的功能是否正确
一、先在Date.h中声明类里面的函数
#pragma once
#include<assert.h>
#include<stdio.h>
#include<iostream>using namespace std;class Date
{
public:// 友函数的声明,外面的函数要访问类里面的对象,需要使用友函数。friend ostream& operator<<(ostream& out, const Date& d);friend istream& operator>>(istream& in, Date& d);int GetMonthDay(int year, int month){assert(month > 0 && month < 13);int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };if (month == 2 && ((year % 4 == 0 && year % 400 != 0) || year % 400 == 0))return 29;return monthDayArray[month];}// 只要不改变调用对象的函数都建议加constvoid Print() const;bool CheckDate()const; //检查日期是否合法Date(int year = 1, int month = 1, int day = 1);Date& operator+=(int day);Date operator+(int day) const ;Date& operator-=(int day);Date operator-(int day) const;// ++d1; -> d1.operator++();Date& operator++();// d1++; -> d1.operator++(1);Date& operator++(int);// --d1;Date& operator--();//d1;Date operator--(int);bool operator==(const Date& d) const;bool operator!=(const Date& d) const;bool operator<(const Date& d) const;bool operator<=(const Date& d) const;bool operator>(const Date& d) const;bool operator>=(const Date& d) const;// 日期-日期 难int operator-(const Date& d) const;
private:int _year;int _month;int _day;
};
//这个函数需要声明的类的外面,为了书写代码符合常规逻辑
ostream& operator<<(ostream& out, const Date& d);
istream& operator>>(istream& in, Date& d);
二、实现类里面的函数(在Date.cpp中实现)
1、实现检查日期是否合法,打印日期的函数
bool Date::CheckDate() const
{if (_month < 1 || _month > 12|| _day < 1 || _day > GetMonthDay(_year, _month)){return false;}return true;
}// void Print(const Date* const this) const
void Date::Print() const
{cout << _year << "/" << _month << "/" << _day << endl;
}
2、构造函数,拷贝构造函数
下一章介绍实例化构造函数,所以这里先不使用实例化构造
Date::Date(int year, int month, int day) //构造函数
{_year = year;_month = month;_day = day;if (!CheckDate()){cout << "非法日期" << endl;}
}Date::Date(const Date& d) // 拷贝构造函数
{_year = d._year;_month = d._month;_day = d._day;
}
3、日期+=day函数,日期+day函数
// +=
Date& Date::operator+=(int day)
{_day += day;//进位while (_day > GetMonthDay(_year, _month)){_day -= GetMonthDay(_year, _month);++_month;if (_month == 13){_month = 1;_year++;}}return *this;
}// +
Date Date::operator+(int day) const
{Date tmp(*this); //使用的是默认的拷贝构造tmp += day;return tmp;
}
4、日期 -= day函数,日期-day函数
Date& Date::operator-=(int day)
{_day -= day;while (_day <= 0){--_month;if (_month == 0){_month = 12;--_year;}_day += GetMonthDay(_year, _month);}return *this;
}// 日期-天数
// d1 - 100
Date Date::operator-(int day) const
{Date tmp(*this);tmp -= day;return tmp;
}
5、前置++,后置++,前置--,后置--
//++d1; -> d1.operator++()
Date& Date::operator++()
{*this += 1;return *this;
}// d1++; -> d1.operator++(int)
Date Date::operator++(int)
{Date tmp(*this);*this += 1;return tmp;
}//--d1
Date& Date::operator--()
{*this -= 1;return *this;
}//d1--
Date Date::operator--(int)
{Date tmp(*this);*this -= 1;return tmp;
}
6、两个日期比较大小
技巧:实现== 和 < 逻辑,其他比较使用这两个逻辑来实现
bool Date::operator==(const Date& d) const
{return _year == d._year&& _month == d._month&& _year == d._year;
}
bool Date::operator!=(const Date& d) const
{return !(*this == d);
}bool Date::operator<(const Date& d) const
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}// d1 <= d2
bool Date::operator<=(const Date& d) const
{return (*this < d || *this == d);
}// d1 > d2
bool Date::operator>(const Date& d) const
{return !(*this <= d);
}// d1 >= d2;
bool Date::operator>=(const Date& d) const
{return !(*this < d);
}
7、日期-日期
// 日期-日期
//d1 - d
int Date::operator-(const Date& d) const
{Date max = *this;Date min = d;int flag = 1;if (*this < d){max = d;min = *this;flag = -1;}int n = 0;while (min != max){++min;++n;}return n * flag; //大的减小的是正数,小的减大的是负数
}
8、实现类的输入和输出
将重载函数写在类里面:
ostream& Date::operator<<(ostream& out)
{out << this->_year << "年" << this->_month << "月" << this->_day << "日" << endl;return out;
}
输出的格式:会发现不符合常规逻辑。
原因:
• 重载 << 和 >> 时,需要重载为全局函数,因为重载为成员函数,this指针默认抢占了第一个形参位置,第一个形参位置是左侧运算对象,调用时就变成了对象 <<cout,不符合使用习惯和可读性。重载为全局函数把ostream/istream放到第一个形参位置就可以了,第二个形参位置当前类类型对象。
所以将重载函数写在类的外面:
因为要访问类的私有成员,所以在类中要使用函数的友元。
ostream& operator<<(ostream& out, const Date& d)
{out << d._year << "年" << d._month << "月" << d._day << "日" << endl;return out;
}istream& operator>>(istream& in, Date& d)
{while (1){cout << "请依次输入年月日:>";in >> d._year >> d._month >> d._day;if (d.CheckDate()){break;}else{cout << "非法日期,请重新输入!" << endl;}}return in;
}
三、所有代码:
在Date.h中:
#pragma once
#include<assert.h>
#include<stdio.h>
#include<iostream>using namespace std;class Date
{
public:// 友函数的声明,外面的函数要访问类里面的对象,需要使用友函数。friend ostream& operator<<(ostream& out, const Date& d);friend istream& operator>>(istream& in, Date& d);int GetMonthDay(int year, int month) const{assert(month > 0 && month < 13);int monthDayArray[13] = { -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };if (month == 2 && ((year % 4 == 0 && year % 400 != 0) || year % 400 == 0))return 29;return monthDayArray[month];}// 只要不改变调用对象的函数都建议加constvoid Print() const;bool CheckDate()const; //检查日期是否合法Date(int year = 1, int month = 1, int day = 1); //构造函数Date(const Date& d); // 拷贝构造函数Date& operator+=(int day);Date operator+(int day) const ;Date& operator-=(int day);Date operator-(int day) const;// ++d1; -> d1.operator++();Date& operator++();// d1++; -> d1.operator++(1);Date operator++(int);// --d1;Date& operator--();//d1;Date operator--(int);bool operator==(const Date& d) const;bool operator!=(const Date& d) const;bool operator<(const Date& d) const;bool operator<=(const Date& d) const;bool operator>(const Date& d) const;bool operator>=(const Date& d) const;// 日期-日期 int operator-(const Date& d) const;
private:int _year;int _month;int _day;
};
//这个函数需要声明的类的外面,为了书写代码符合常规逻辑
ostream& operator<<(ostream& out, const Date& d);
istream& operator>>(istream& in, Date& d);
在Date.cpp中:
#include"Date.h"bool Date::CheckDate() const
{if (_month < 1 || _month > 12|| _day < 1 || _day > GetMonthDay(_year, _month)){return false;}return true;
}// void Print(const Date* const this) const
void Date::Print() const
{cout << _year << "/" << _month << "/" << _day << endl;
}Date::Date(int year, int month, int day) //构造函数
{_year = year;_month = month;_day = day;if (!CheckDate()){cout << "非法日期" << endl;}
}Date::Date(const Date& d) // 拷贝构造函数
{_year = d._year;_month = d._month;_day = d._day;
}// +=
Date& Date::operator+=(int day)
{_day += day;//进位while (_day > GetMonthDay(_year, _month)){_day -= GetMonthDay(_year, _month);++_month;if (_month == 13){_month = 1;_year++;}}return *this;
}// +
Date Date::operator+(int day) const
{Date tmp(*this); //使用的是默认的拷贝构造tmp += day;return tmp;
}Date& Date::operator-=(int day)
{_day -= day;while (_day <= 0){--_month;if (_month == 0){_month = 12;--_year;}_day += GetMonthDay(_year, _month);}return *this;
}// 日期-天数
// d1 - 100
Date Date::operator-(int day) const
{Date tmp(*this);tmp -= day;return tmp;
}//++d1; -> d1.operator++()
Date& Date::operator++()
{*this += 1;return *this;
}// d1++; -> d1.operator++(int)
Date Date::operator++(int)
{Date tmp(*this);*this += 1;return tmp;
}//--d1
Date& Date::operator--()
{*this -= 1;return *this;
}//d1--
Date Date::operator--(int)
{Date tmp(*this);*this -= 1;return tmp;
}bool Date::operator==(const Date& d) const
{return _year == d._year&& _month == d._month&& _year == d._year;
}
bool Date::operator!=(const Date& d) const
{return !(*this == d);
}bool Date::operator<(const Date& d) const
{if (_year < d._year){return true;}else if (_year == d._year && _month < d._month){return true;}else if (_year == d._year && _month == d._month && _day < d._day){return true;}return false;
}// d1 <= d2
bool Date::operator<=(const Date& d) const
{return (*this < d || *this == d);
}// d1 > d2
bool Date::operator>(const Date& d) const
{return !(*this <= d);
}// d1 >= d2;
bool Date::operator>=(const Date& d) const
{return !(*this < d);
}// 日期-日期
//d1 - d
int Date::operator-(const Date& d) const
{Date max = *this;Date min = d;int flag = 1;if (*this < d){max = d;min = *this;flag = -1;}int n = 0;while (min != max){++min;++n;}return n * flag; //大的减小的是正数,小的减大的是负数
}//ostream& Date::operator<<(ostream& out)
//{
// out << this->_year << "年" << this->_month << "月" << this->_day << "日" << endl;
// return out;
//}ostream& operator<<(ostream& out, const Date& d)
{out << d._year << "年" << d._month << "月" << d._day << "日" << endl;return out;
}istream& operator>>(istream& in, Date& d)
{while (1){cout << "请依次输入年月日:>";in >> d._year >> d._month >> d._day;if (d.CheckDate()){break;}else{cout << "非法日期,请重新输入!" << endl;}}return in;
}
在test.c中:
#include"Date.h"void test1()
{Date d1(2025,1,1);d1.Print();d1 += 10;d1.Print();Date d2(2025, 1, 2);d2 = d1 + 10;d2.Print();d1.Print();}
void test2()
{Date d1(2025, 1, 1);Date d2(2025, 1, 1);d1.Print();d1 -= 10;d2 = d1 - 10;d2.Print();d1.Print();
}void test03()
{Date d1(2025, 1, 1);Date d2(2025, 1, 10);++d1;d1.Print();d2 = d1++;d2.Print();d1.Print();//d1 << cout;cin >> d1 >> d2;cout << d1 << d2;
}int main()
{//test1();//test2();test03();return 0;
}
相关文章:
C++类和对象练习:Date类实现日期的差,比较日期的大小,日期的前置后置++,--,输入输出Date类,对默认函数的练习。
引言 C类和对象练习:Date类实现日期的差,比较日期的大小,日期的前置后置,--,输入输出Date类,对默认函数的练习。 _涂色_-博客主页 C基础专栏 分三个文件来写: Date.cpp //类函数的实现 Date.h…...
C++学习之打车软件git版本控制
目录 01 3-git的简介 02 4-git的下载和提交代码 03 5-git添加一个新文件 04 5-删除一个文件 05 6-git的批量添加和提交文件 06 7-git重命名文件名 07 8-git解决代码冲突 08 9-git的分支的概念 09 10-创建项目代码仓库 10 1-git提交代码复习 01 3-git的简介 1 --------…...
QT之信号与槽
欢迎来到 破晓的历程的 博客 ⛺️不负时光,不负己✈️ 文章目录 QT信号与槽机制详解基本概念信号(Signal)槽(Slot) 信号与槽的连接方式基本语法QT5新语法(推荐) 信号与槽的特点实际示例传统方式QT5新语法 连接类型注意事项高级用法信号连接信号使用lambda表达式自动…...
文章记单词 | 第73篇(六级)
一,单词释义 apart /əˈpɑːt/ adv. 分开地;相距assistant /əˈsɪstənt/ n. 助手;助理useless /ˈjuːsləs/ adj. 无用的;无效的ampere /ˈmpɛr/ n. 安培(电流单位)recite /rɪˈsaɪt/ v. 背诵&am…...
在Ubuntu24.04中配置开源直线特征提取软件DeepLSD
在Ubuntu24.04中配置开源直线特征提取软件DeepLSD 本文提供在Ubuntu24.04中配置开源直线特征提取软件DeepLSD的基础环境配置、列出需要修改的文件内容,以及报错解决方案集锦。 基础的编译安装环境 python3.8.12CUDA12gcc/g 9.5(系统自带的g-13版本太新…...
什么是SparkONYarn模式?
(一)什么是SparkONYarn模式 Spark on YARN(Yet Another Resource Negotiator)是 Spark 框架在 Hadoop 集群中运行的一种部署模式,它借助 Hadoop YARN 来管理资源和调度任务。 架构组成 ResourceManager:作…...
STMCubeMX使用TB6612驱动编码轮并进行测速
硬件介绍 TB6612电机驱动模块功能与特性 电机方向控制 描述如何通过 TB6612 的 IN1 和 IN2 引脚控制电机的旋转方向。提供代码示例,展示如何通过 GPIO 控制电机的正反转。 速度控制与减速 解释如何通过调整 PWM 信号的占空比来控制电机的速度,并…...
数据安全与权限管控,如何实现双重保障?
数据安全和权限管控并非孤立存在,而是相互依存、相互促进的关系。强大的权限管控体系是数据安全的重要防线,能够从源头上限制潜在的风险;而完善的数据安全策略和技术手段,则为权限管控的有效实施提供了保障。只有构建起数据安全与…...
如何创建自动工作流程拆分Google Drive中的PDF文件
以下是完整的工作流程。在构建自动拆分工作流程之前,您可以尝试我们的免费在线 PDF 拆分器。 步骤 1:Make 自动拆分 PDF 的要求 要设置自动 PDF 拆分工作流程,您需要: 免费的Make.com帐户。可访问 Google Drive 并处理 PDF 文件…...
【SpringBoot实战指南】集成Easy ES
一、Easy ES 简介 Easy ES(简称EE)是一款基于 Elasticsearch 官方 RestHighLevelClient 封装的 ORM 框架,提供类似 MyBatis-Plus 的 API 设计,可以帮助开发者更简单地集成和使用 Elasticsearch,让操作 Elasticsearch …...
深入理解指针(1)
🎁个人主页:工藤新一 🔍系列专栏:C面向对象(类和对象篇) 🌟心中的天空之城,终会照亮我前方的路 🎉欢迎大家点赞👍评论📝收藏⭐文章 文章目录 深…...
vue.js中的渲染【条件渲染】
条件渲染 在 Vue 中,条件渲染用于根据表达式的值来决定是否在 DOM 中渲染某个元素。Vue 提供了几种方式来实现条件渲染: v-if 指令 用于根据条件是否为真来销毁或创建元素。 <p v-if"isVisible">显示这段内容</p>data() {retu…...
Qwen3如何强化推理能力?
大模型的推理能力一直是衡量其智能水平的关键指标。近期,Qwen3系列模型在这方面取得了显著突破。通过对Qwen3技术报告的解读,我们可以窥见一套完整的推理能力提升体系。本文将以结构化视角,剖析Qwen3推理能力提升的关键环节。 报告地址&#…...
2025年中国主流DevOps平台对比分析:Gitee、阿里云效与GitLab CE的技术适配与合规实践全景解读
在2025年中国企业数字化转型持续深化的背景下,DevOps 工具的选型呈现出多元化趋势。以下从安全合规、技术生态适配性、实践案例和选型建议四个维度,对 Gitee、阿里云效(云效 DevOps)和 GitLab CE(中国版)三…...
从lightrag的prompt到基于openai Structured Outputs 的优化实现思路
LightRAG 是一个用于构建 RAG 系统核心组件的配置和管理类。它集成了文档处理、存储、向量化、图谱构建和 LLM 交互等功能。你可以通过配置 LightRAG 实例的各种参数来定制 RAG 系统的行为。 目前lightrag中的实体关系抽取实现如下 PROMPTS["entity_extraction"] …...
论文阅读笔记——双流网络
双流网络论文 视频相比图像包含更多信息:运动信息、时序信息、背景信息等等。 原先处理视频的方法: CNN LSTM:CNN 抽取关键特征,LSTM 做时序逻辑;抽取视频中关键 K 帧输入 CNN 得到图片特征,再输入 LSTM&…...
Android清单文件
清单文件AndroidManifest.xml AndroidManifest.xml 配置清单文件是 每个 Android 应用的配置中心,系统在安装和运行应用时,首先会读取它。 它是 Android 应用的 “说明书”,主要作用是: 功能说明声明应用组件比如 Activity、Se…...
Single image dehazing论文阅读
Single image dehazing 1. 论文的研究目标与实际意义1.1 研究目标1.2 实际问题与产业意义2. 论文的创新方法、模型与公式2.1 改进的大气散射模型2.2 局部统计不相关性约束2.2.1 传输函数估计2.2.2 大气光颜色估计2.3 算法流程2.4 与传统方法的对比优势3. 实验设计与结果3.1 实验…...
数字信号处理-大实验1.3
MATLAB仿真实验目录 验证实验:常见离散信号产生和实现验证实验:离散系统的时域分析应用实验:语音信号的基音周期(频率)测定 说明:(1)本文是DSP大实验1的最后一篇,主要讲…...
【Pandas】pandas DataFrame describe
Pandas2.2 DataFrame Computations descriptive stats 方法描述DataFrame.abs()用于返回 DataFrame 中每个元素的绝对值DataFrame.all([axis, bool_only, skipna])用于判断 DataFrame 中是否所有元素在指定轴上都为 TrueDataFrame.any(*[, axis, bool_only, skipna])用于判断…...
C++GO语言微服务之Dockerfile docker-compose②
目录 01 12-yaml文件书写规则01 12-yaml文件书写规则 02 13-yaml中的数据类型 03 14-docker-compose配置文件格式 04 15-docker-compose中的关键字 05 16-prots和volumes关键字的使用 06 17-volumes_from的使用 07 18-extends的使用 08 19-networks的使用 09 20-docker…...
【计算机视觉】OpenCV实战项目:Face-Mask-Detection 项目深度解析:基于深度学习的口罩检测系统
Face-Mask-Detection 项目深度解析:基于深度学习的口罩检测系统 一、项目概述项目特点 二、项目运行方式与执行步骤(一)环境准备(二)项目结构(三)执行步骤 三、重要逻辑代码解析(一&…...
鸿蒙OSUniApp 实现的语音输入与语音识别功能#三方框架 #Uniapp
UniApp 实现的语音输入与语音识别功能 最近在开发跨平台应用时,客户要求添加语音输入功能以提升用户体验。经过一番调研和实践,我成功在UniApp项目中实现了语音输入与识别功能,现将过程和方法分享出来,希望对有类似需求的开发者有…...
python:一个代理流量监控的媒体文件下载脚本
前言 一个mitmproxy代理服务应用,作用是监听系统流量,并自动下载可能的video媒体文件到本地。 如果你没有安装mitmproxy或没有做完准备工作,请参考我的这篇文章: python:mitmproxy代理服务搭建-CSDN博客 文件架构目录…...
openfeign与dubbo调用下载excel实践
一、前言 openfeign和dubbo均是rpc框架 RPC(Remote Procedure Call,远程过程调用)框架 是一种允许程序像调用本地方法一样调用远程服务器上函数的技术。它隐藏了底层网络通信的复杂性,让开发者可以专注于业务逻辑,实现…...
Android多媒体——媒体start流程分析(十三)
当多媒体的数据源准备好,并且完成调用准备结束流程后,接下来就开始是调用 start() 方法开始播放媒体了。这里我们就来分析一下媒体开始播放的整个流程。 一、媒体播放流程 对于媒体播放流程的 Java 层和 JNI 层与前面的示例基本相同,这里不再重复展示了,我们直接从 mediap…...
数据库系统概论(八)SQL单表查询语言超详细讲解(附带例题表格对比带你一步步掌握)
数据库系统概论(八)SQL单表查询语言超详细讲解(附带例题表格对比带你一步步掌握) 前言一、创建表(了解一下就好,后面会详细讲)二、数据查询的概念2.1 什么是数据查询?2.2 数据查询的…...
【IPMV】图像处理与机器视觉:Lec11 Keypoint Features and Corners
【IPMV】图像处理与机器视觉:Lec11 Keypoint Features and Corners 本系列为2025年同济大学自动化专业**图像处理与机器视觉**课程笔记 Lecturer: Rui Fan、Yanchao Dong Lec0 Course Description Lec3 Perspective Transformation Lec7 Image Filtering Lec8 I…...
C++23 中的 ranges::starts_with 与 ranges::ends_with
文章目录 功能介绍ranges::starts_withranges::ends_with 示例代码编译器支持总结 C23 标准引入了 ranges::starts_with 和 ranges::ends_with,这两个算法由提案 P1659R3 提出,旨在为任意范围提供检查前缀和后缀的功能。 功能介绍 ranges::starts_wit…...
2025 uniapp的请求封装工具类以及使用【拿来就用】
一、创建一个http请求封装的js文件,名字自定义:my_http.js /*** 基础API请求地址(常量,全大写命名规范)* type {string}* constant*/ let BASE_URL //通过环境来判断基础路径 if (process.env.NODE_ENV development…...
Axure设计之内联框架切换页面、子页面间跳转问题
在Axure中,你可以通过以下步骤实现主页面中的内联框架在点击按钮时切换页面内容,从A页面切换到B页面。(误区:子页面之间切换不要设置“框架中打开链接”然后选“父级框架”这个交互) 主框架页面(左侧导航展…...
PyTorch 中神经网络相关要点(损失函数,学习率)及优化方法总结
笔记 1 神经网络搭建和参数计算 1.1 构建神经网络模型 import torch import torch.nn as nn # 线性模型和初始化方法 # todo:1-创建类继承 nn.module类 class ModelDemo(nn.Module):# todo:2-定义__init__构造方法, 构建神经网络def __init__(self):# todo:2-1 调用父…...
适用于 iOS 的 开源Ultralytics YOLO:应用程序和 Swift 软件包,用于在您自己的 iOS 应用程序中运行 YOLO
一、软件介绍 文末提供程序和源码下载 该项目利用 Ultralytics 最先进的 YOLO11 模型将您的 iOS 设备转变为用于对象检测的强大实时推理工具。直接从 App Store 下载该应用程序,或浏览我们的指南,将 YOLO 功能集成到您自己的 Swift 应用程序中。 二、…...
why FPGA喜欢FMC子卡?
FMC 即 FPGA Mezzanine Card ( FPGA中间层板卡),由子板模块、载卡两构成。 FMC 载卡:为子板模块提供插槽,使用母座FMC连接器。载卡连接器引脚与具有可配置IO资源的芯片例如FPGA引脚通过PCB设计连接在一起。。 盘古100…...
【优选算法 | 字符串】字符串模拟题精选:思维+实现解析
算法相关知识点可以通过点击以下链接进行学习一起加油!双指针滑动窗口二分查找前缀和位运算模拟链表哈希表 在众多字符串算法题中,有一类题目看起来没有太多算法技巧,却经常让人“翻车”——那就是字符串模拟题。这类题型往往不依赖复杂的数据…...
比亚迪固态电池突破:王传福的技术哲学与产业重构|创客匠人热点评述
合肥某车间凌晨两点依然灯火通明,工程师正在调试的银白色设备,即将颠覆整个电动车行业 —— 比亚迪全固态电池产线的曝光,标志着中国新能源汽车产业正式迈入 “技术定义市场” 的新纪元。 一、技术突破的底层逻辑 比亚迪全固态电池的核心竞…...
UUG杭州站 | 团结引擎1.5.0 OpenHarmony新Feature介绍
PPT下载地址:https://u3d.sharepoint.cn/:b:/s/UnityChinaResources/EaZmiWfAAdFFmuyd6c-7_3ABhvZoaM69g4Uo2RrSzT3tZQ?e2h7RaL 在2025年4月12日的Unity User Group杭州站中,Unity中国OpenHarmony技术负责人刘伟贤带来演讲《团结引擎1.5.0 OpenHarmony新…...
OpenHarmony轻量系统--BearPi-Nano开发板网络程序测试
本文介绍RISC-V架构海思Hi3861开发板,通过Linux开发环境运行OpenHarmony轻量化系统,下载测试网络例程的过程与步骤。 OpenHarmony操作系统分类 轻量系统(mini system) 面向MCU类处理器例如Arm Cortex-M、RISC-V 32位的设备&#x…...
k8s 中使用 Service 访问时NetworkPolicy不生效问题排查
背景 针对一个服务如下NetworkPolicy, 表示只有n9e命名空间的POD才能访问 k8s-man 服务 kind: NetworkPolicy apiVersion: networking.k8s.io/v1 metadata:name: k8s-mannamespace: n9elabels:app: k8s-manversion: v1 spec:podSelector:matchLabels:app: k8s-manversion: v1…...
2025 AI如何重构网络安全产品
威胁检测与防御 利用机器学习算法提升威胁检测能力 :AI能够分析大量的网络数据和行为模式,通过机器学习算法自动识别出潜在的威胁和异常行为。例如,Darktrace的Cyber AI Analyst基于真实SOC数据训练,可推进威胁调查,提…...
ARM杂谈——临界段保护恢复的中断状态可靠吗
0 前言 在MCU中,临界段保护是指在多任务或多线程环境中,确保某段代码在执行时不会被其他任务或中断打断,从而避免数据竞争或不一致的问题。临界段保护通常用于共享资源的访问,如全局变量、硬件寄存器等。 我们有一些常用的临界段…...
数据库MySQL学习——day10()
文章目录 1. 什么是子查询(Subquery)?2. 创建样例表:商品表 products3. 插入示例数据4. 子查询的三种常用位置4.1 子查询在 WHERE 子句中(最常见)4.2 子查询在 FROM 子句中(可以当成临时表&…...
YashanDB V23.4 LTS 正式发布|两地三中心、库级闪回重磅特性上线,生产级可用性再升级
近日,YashanDB V23.4 LTS(Long-Term Support Release)版本正式发布,新版本深度契合关键行业数字化转型对数据库“业务永续、风险可控”的核心诉求,打造两地三中心秒级容灾、库级闪回秒级恢复、MySQL全面兼容等重磅特性…...
AI规则引擎:解锁SQL数据分析新姿势
一、AI 规则引擎与 SQL 的奇妙邂逅 在当今数字化时代,数据如同石油,是企业发展和创新的核心驱动力。而如何从海量的数据中提取有价值的信息,成为了企业面临的关键挑战。人工智能规则引擎和 SQL,作为数据分析领域的两大重要工具&a…...
Kotlin Multiplatform与Flutter、Compose共存:构建高效跨平台应用的完整指南
简介 在移动开发领域,跨平台技术正在重塑开发范式。Kotlin Multiplatform (KMP) 作为 JetBrains 推出的多平台开发框架,结合了 Kotlin 的简洁性与原生性能优势,使开发者能够高效共享业务逻辑。而 Flutter 凭借其高性能渲染引擎(Skia)和丰富的组件库,成为混合开发的首选方…...
FunASR:语音识别与合成一体化,企业级开发实战详解
简介 FunASR是由阿里巴巴达摩院开源的高性能语音识别工具包,它不仅提供语音识别(ASR)功能,还集成了语音端点检测(VAD)、标点恢复、说话人分离等工业级模块,形成了完整的语音处理解决方案。 FunASR支持离线和实时两种模式,能够高效处理多语言音频,并提供高精度的识别结果。…...
【Spark分析HBase数据】Spark读取并分析HBase数据
Spark读取并分析HBase数据 一、摘要二、实现过程三、小结 一、摘要 Apache Spark 是一个快速、通用的大数据处理引擎,提供了丰富的 API 用于数据处理和分析。HBase 是一个分布式、可扩展的 NoSQL 数据库,适合存储海量结构化和半结构化数据。Spark 与 HB…...
探索直播美颜SDK的核心算法:图像增强与AI美颜技术详解
一款优秀的直播美颜SDK不仅能让主播拥有完美的在线形象,还能帮助平台吸引更多用户。然而,这背后的关键在于其核心算法——从基本的图像增强到前沿的AI美颜技术,每一步都至关重要。今天,我们就来深入探讨这些技术背后的秘密。 一、…...
全新linux网络配置工具nmcli:
1.Linux全新网络管理工具nmcli的使用 ,网络管理命令行工具nmcli 在nmcli中有2个命令最为常用: (1)nmcli connection 表示连接,可理解为配置文件,相当于ifcfg-ethX。可以简写为nmcli c (2)nmcl…...
LeetCode100.5 盛最多水的容器
对于这题,首先明确的是:盛水的体积取决于两垂线间的距离与两垂线中最短的长度。 那么使用双指针,在每次移动时,只移动其中最短的那个,因为若移动最长的那个,体积不会变大。 class Solution { public:int …...