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

【iOS】——知乎日报第五周总结

文章目录

  • 一、评论区展开与收缩
  • 二、FMDB库实现本地持久化
      • FMDB常用类:
      • FMDB的简单使用:
  • 三、点赞和收藏的持久化


一、评论区展开与收缩

有的评论没有被回复评论或者被回复评论过短,这时就不需要展开全文的按钮,所以首先计算被回复评论的文本高度,根据文本高度来决定是否隐藏展开全文的按钮。

CGSize constrainedSize = CGSizeMake(WIDTH - 70, CGFLOAT_MAX); // labelWidth为UILabel的宽度,高度设置为无限大NSDictionary *attributes = @{NSFontAttributeName: cell.replyLabel.font}; // label为要计算高度的UILabel控件CGRect textRect = [cell.replyLabel.text boundingRectWithSize:constrainedSizeoptions:NSStringDrawingUsesLineFragmentOriginattributes:attributescontext:nil];CGFloat textHeight = CGRectGetHeight(textRect);if (textHeight > 100) {cell.foldButton.hidden = NO;} else {cell.foldButton.hidden = YES;}

要实现评论区的展开全文和收起,需要先实现评论区文本的自适应高度,接着我用数组来记录每个按钮的状态,如果为展开状态则为1,如果为收起状态则为0。通过数组中按钮的状态为按钮的selected属性做出选择并改变cell的高度。当我点击按钮时就改变该按钮在数组中的相应值。

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {if (indexPath.section == 0 && self.longComments != 0) {NSString* longStr = [self.discussModel.longCommentsArray[indexPath.row] content];NSString* longReplyStr = [self.discussModel.longCommentsArray[indexPath.row] reply_to][@"content"];CGSize constrainedSize = CGSizeMake(WIDTH - 70, CGFLOAT_MAX); // labelWidth为UILabel的宽度,高度设置为无限大UIFont *font = [UIFont systemFontOfSize:18.0];NSDictionary *attributes = @{NSFontAttributeName: font}; // label为要计算高度的UILabel控件CGRect textRect = [longStr boundingRectWithSize:constrainedSizeoptions:NSStringDrawingUsesLineFragmentOriginattributes:attributescontext:nil];CGFloat textHeight = CGRectGetHeight(textRect);CGSize constrainedSize02 = CGSizeMake(WIDTH - 70, CGFLOAT_MAX); // labelWidth为UILabel的宽度,高度设置为无限大UIFont *font02 = [UIFont systemFontOfSize:16.0];NSDictionary *attributes02 = @{NSFontAttributeName: font02}; // label为要计算高度的UILabel控件CGRect textRect02 = [longReplyStr boundingRectWithSize:constrainedSize02options:NSStringDrawingUsesLineFragmentOriginattributes:attributes02context:nil];CGFloat textHeight02 = CGRectGetHeight(textRect02);NSLog(@"长评论高度为:%f", textHeight);if ([self.discussModel.longButtonSelectArray[indexPath.row] isEqualToString:@"1"]) {return textHeight + textHeight02 + 180;}return textHeight + 180;} else {NSString* shortStr = [self.discussModel.shortCommentsArray[indexPath.row] content];NSString* shortReplyStr = [self.discussModel.shortCommentsArray[indexPath.row] reply_to][@"content"];CGSize constrainedSize = CGSizeMake(WIDTH - 70, CGFLOAT_MAX); // labelWidth为UILabel的宽度,高度设置为无限大UIFont *font = [UIFont systemFontOfSize:18.0];NSDictionary *attributes = @{NSFontAttributeName: font}; // label为要计算高度的UILabel控件CGRect textRect = [shortStr boundingRectWithSize:constrainedSizeoptions:NSStringDrawingUsesLineFragmentOriginattributes:attributescontext:nil];CGFloat textHeight = CGRectGetHeight(textRect);CGSize constrainedSize02 = CGSizeMake(WIDTH - 70, CGFLOAT_MAX); // labelWidth为UILabel的宽度,高度设置为无限大UIFont *font02 = [UIFont systemFontOfSize:16.0];NSDictionary *attributes02 = @{NSFontAttributeName: font02}; // label为要计算高度的UILabel控件CGRect textRect02 = [shortReplyStr boundingRectWithSize:constrainedSize02options:NSStringDrawingUsesLineFragmentOriginattributes:attributes02context:nil];CGFloat textHeight02 = CGRectGetHeight(textRect02);NSLog(@"段评论高度为:%f", textHeight);if ([self.discussModel.shortButtonSelectArray[indexPath.row] isEqualToString:@"1"]) {return textHeight + textHeight02 + 180;}return textHeight + 180;}  
}- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (indexPath.section == 0 && self.longComments != 0) {if (indexPath.row == 0) {cell.commentsNumLabel.text = [NSString stringWithFormat:@"%ld条长评", self.longComments];}cell.foldButton.tag = indexPath.row * 2 + 1;if ([self.discussModel.longButtonSelectArray[indexPath.row] isEqualToString:@"1"]) {cell.foldButton.selected = YES;cell.replyLabel.numberOfLines = 0;} else {cell.foldButton.selected = NO;cell.replyLabel.numberOfLines = 2;}
}else {cell.foldButton.tag = indexPath.row * 2;if ([self.discussModel.shortButtonSelectArray[indexPath.row] isEqualToString:@"1"]) {cell.foldButton.selected = YES;cell.replyLabel.numberOfLines = 0;} else {cell.foldButton.selected = NO;cell.replyLabel.numberOfLines = 2;}
- (void)pressFold:(UIButton*)button {DiscussCustomCell* cell = (DiscussCustomCell*)[[button superview] superview];if ([self.discussModel.longButtonSelectArray[(button.tag - 1) / 2] isEqualToString:@"1"]) {[self.discussModel.longButtonSelectArray replaceObjectAtIndex:((button.tag - 1) / 2) withObject:@"0"];[self.discussView.tableview reloadData];} else {[self.discussModel.longButtonSelectArray replaceObjectAtIndex:((button.tag - 1) / 2) withObject:@"1"];[self.discussView.tableview reloadData];}if ([self.discussModel.shortButtonSelectArray[button.tag / 2] isEqualToString:@"1"]) {[self.discussModel.shortButtonSelectArray replaceObjectAtIndex:(button.tag / 2) withObject:@"0"];[self.discussView.tableview reloadData];} else {[self.discussModel.shortButtonSelectArray replaceObjectAtIndex:(button.tag / 2) withObject:@"1"];[self.discussView.tableview reloadData];}
}

请添加图片描述

请添加图片描述

二、FMDB库实现本地持久化

FMDB是iOS平台的SQLite数据库框架,以OC的方式封装了SQLite的C语言API。

FMDB常用类:

FMDatabase:一个FMDatabase对象就代表一个单独的SQLite数据库用来执行SQL语句。
FMResultSet:使用FMDatabase执行查询后的结果集。
FMDatabaseQueue:用于在多线程中执行多个查询或更新,它是线程安全的。

FMDB的简单使用:

要使用FMDB库首先需要通过CocoaPods来安装这个第三方库

pod 'FMDB'

安装完成之后就可以进行使用了。

创建数据库

//获取数据库文件的路径NSString* doc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];NSString *fileName = [doc stringByAppendingPathComponent:@"collectionData.sqlite"];//获得数据库self.collectionDatabase = [FMDatabase databaseWithPath:fileName];//打开数据库if ([self.collectionDatabase open]) {BOOL result = [self.collectionDatabase executeUpdate:@"CREATE TABLE IF NOT EXISTS collectionData (mainLabel text NOT NULL, nameLabel text NOT NULL, imageURL text NOT NULL, networkURL text NOT NULL, dateLabel text NOT NULL, nowLocation text NOT NULL, goodState text NOT NULL, collectionState text NOT NULL, id text NOT NULL);"];if (result) {NSLog(@"创表成功");} else {NSLog(@"创表失败");}}

数据库增加数据

//插入数据
- (void)insertData {if ([self.collectionDatabase open]) {NSString *string = @"GenShen";BOOL result = [self.collectionDatabase executeUpdate:@"INSERT INTO collectionData (mainLabel, nameLabel, imageURL, networkURL, dateLabel, nowLocation, goodState, collectionState, id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?);", string, string, string, string, string, string, string, string, string];if (!result) {NSLog(@"增加数据失败");}else{NSLog(@"增加数据成功");}[self.collectionDatabase close];}
}

数据库修改数据

//修改数据
- (void)updateData {if ([self.collectionDatabase open]) {NSString* sql = @"UPDATE collectionData SET id = ? WHERE nameLabel = ?";BOOL result = [self.collectionDatabase executeUpdate:sql, @"114514",@"GenShen"];if (!result) {NSLog(@"数据修改失败");} else {NSLog(@"数据修改成功");}[self.collectionDatabase close];}
}

数据库删除数据

//删除数据
- (void)deleteData {if ([self.collectionDatabase open]) {NSString* sql = @"delete from collectionData WHERE collectionState = ?";BOOL result = [self.collectionDatabase executeUpdate:sql, @"爱玩原神"];if (!result) {NSLog(@"数据删除失败");} else {NSLog(@"数据删除成功");}[self.collectionDatabase close];}
}

数据库查询数据

//查询数据
- (void)queryData {if ([self.collectionDatabase open]) {FMResultSet* resultSet = [self.collectionDatabase executeQuery:@"SELECT * FROM collectionData"];while ([resultSet next]) {NSString *mainLabel = [resultSet stringForColumn:@"mainLabel"];NSLog(@"mainLabel = %@",mainLabel);NSString *nameLabel = [resultSet stringForColumn:@"nameLabel"];NSLog(@"nameLabel = %@",nameLabel);NSString *imageURL = [resultSet stringForColumn:@"imageURL"];NSLog(@"imageURL = %@",imageURL);NSString *networkURL = [resultSet stringForColumn:@"networkURL"];NSLog(@"networkURL = %@",networkURL);NSString *dateLabel = [resultSet stringForColumn:@"dateLabel"];NSLog(@"dateLabel = %@",dateLabel);NSString *nowLocation = [resultSet stringForColumn:@"nowLocation"];NSLog(@"nowLocation = %@",nowLocation);NSString *goodState = [resultSet stringForColumn:@"goodState"];NSLog(@"goodState = %@",goodState);NSString *collectionState = [resultSet stringForColumn:@"collectionState"];NSLog(@"collectionState = %@",collectionState);NSString *id = [resultSet stringForColumn:@"id"];NSLog(@"id = %@",id);}[self.collectionDatabase close];}
}

三、点赞和收藏的持久化

要实现点赞和收藏的持久化就需要用到前面所提到的FMDB库进行操作。在需要用到数据库的部分进行数据库的创建和一些基本操作例如增删改查。以收藏持久化为例子,当点击点赞收藏按钮的时候,进入到数据库查询函数进行查询,如果找到就将该数据进行删除然后将按钮状态设置为未选中状态。如果没有找到该数据就进行添加然后将按钮状态设置为选中状态

- (void)pressCollect:(UIButton*)button {NSString* collectionIdStr = [NSString stringWithFormat:@"%ld", self.idStr];int flag = [self queryCollectionData];if (flag == 1) {self.mainWebView.collectButton.selected = NO;[self deleteCollectionData:collectionIdStr];} else {self.mainWebView.collectButton.selected = YES;[self insertCollectionData:self.mainLabel andUrl:self.imageUrl andStr:collectionIdStr];}
}

当滑动切换页面请求新闻额外信息时也需要先进行判断当前点赞和收藏的按钮状态

[[ExtraManager sharedSingleton] ExtraGetWithData:^(GetExtraModel * _Nullable extraModel) {dispatch_async(dispatch_get_main_queue(), ^{int flag = [self queryLikesData];int collectFlag = [self queryCollectionData];self.mainWebView.discussLabel.text = [NSString stringWithFormat:@"%ld", extraModel.comments];self.mainWebView.likeLabel.text = [NSString stringWithFormat:@"%ld", extraModel.popularity];self.longComments = extraModel.long_comments;self.shortComments = extraModel.short_comments;if (flag == 1) {self.mainWebView.likeButton.selected = YES;NSInteger likesNum = [self.mainWebView.likeLabel.text integerValue];likesNum++;self.mainWebView.likeLabel.text = [NSString stringWithFormat:@"%ld", likesNum];NSString* likesIdStr = [NSString stringWithFormat:@"%ld", self.idStr];[self insertLikesData:likesIdStr];} else {self.mainWebView.likeButton.selected = NO;}if (collectFlag == 1) {self.mainWebView.collectButton.selected = YES;} else {self.mainWebView.collectButton.selected = NO;}NSLog(@"额外信息获取成功");});} andError:^(NSError * _Nullable error) {NSLog(@"额外信息获取失败");} andIdStr:self.idStr];

收藏数据库部分代码如下:

//创建
- (void)databaseInit {NSString* likesDoc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];NSLog(@"%@", likesDoc);NSString * likesFileName = [likesDoc stringByAppendingPathComponent:@"likesData.sqlite"];self.likesDatabase = [FMDatabase databaseWithPath:likesFileName];if ([self.likesDatabase open]) {BOOL result = [self.likesDatabase executeUpdate:@"CREATE TABLE IF NOT EXISTS likesData (id text NOT NULL);"];if (result) {NSLog(@"创表成功");} else {NSLog(@"创表失败");}}NSString* collectionDoc = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];NSLog(@"%@", collectionDoc);NSString * collectionFileName = [collectionDoc stringByAppendingPathComponent:@"collectionData02.sqlite"];self.collectionDatabase = [FMDatabase databaseWithPath:collectionFileName];if ([self.collectionDatabase open]) {BOOL result  = [self.collectionDatabase executeUpdate:@"CREATE TABLE IF NOT EXISTS collectionData (mainLabel text NOT NULL, imageURL text NOT NULL, id text NOT NULL);"];if (result) {NSLog(@"创表成功");} else {NSLog(@"创表失败");}}}
//增加
- (void)insertCollectionData:(NSString *)mainLabel andUrl:(NSString *)imageURL andStr:(NSString*)string {if ([self.collectionDatabase open]) {BOOL result = [self.collectionDatabase executeUpdate:@"INSERT INTO collectionData (mainLabel, imageURL, id) VALUES (?, ?, ?);", mainLabel, imageURL,string];if (!result) {NSLog(@"增加收藏数据失败");}else{NSLog(@"增加收藏数据成功");}}[self.collectionDatabase close];
}
//删除
- (void)deleteCollectionData:(NSString*)string {if ([self.collectionDatabase open]) {NSString *sql = @"delete from collectionData WHERE id = ?";BOOL result = [self.collectionDatabase executeUpdate:sql, string];if (!result) {NSLog(@"删除收藏数据失败");}else{NSLog(@"删除收藏数据成功");}}[self.collectionDatabase close];
}//查询
- (int)queryCollectionData {if ([self.collectionDatabase open]) {FMResultSet* collectionResultSet = [self.collectionDatabase executeQuery:@"SELECT * FROM collectionData"];int count = 0;while ([collectionResultSet next]) {NSString *sqlIdStr = [NSString stringWithFormat:@"%@", [collectionResultSet objectForColumn:@"id"]];NSInteger sqlId = [sqlIdStr integerValue];NSLog(@"第 %d 个收藏数据库数据:%ld", count++ ,sqlId);if (self.idStr == sqlId) {[self.collectionDatabase close];return 1;}}}[self.collectionDatabase close];return 0;
}

请添加图片描述

请添加图片描述

相关文章:

【iOS】——知乎日报第五周总结

文章目录 一、评论区展开与收缩二、FMDB库实现本地持久化FMDB常用类:FMDB的简单使用: 三、点赞和收藏的持久化 一、评论区展开与收缩 有的评论没有被回复评论或者被回复评论过短,这时就不需要展开全文的按钮,所以首先计算被回复评…...

gRPC 四模式之 双向流RPC模式

双向流RPC模式 在双向流 RPC 模式中,客户端以消息流的形式发送请求到服务器端,服务器端也以消息流的形式进行响应。调用必须由客户端发起,但在此之后,通信完全基于 gRPC 客户端和服务器端的应用程序逻辑。 为什么有了双向流模式…...

五分钟,Docker安装kafka 3.5,kafka-map图形化管理工具

首先确保已经安装docker,如果是windows安装docker,可参考 wsl2安装docker 1、安装zk docker run -d --restartalways -e ALLOW_ANONYMOUS_LOGINyes --log-driver json-file --log-opt max-size100m --log-opt max-file2 --name zookeeper -p 2181:218…...

2023.11.18html中如何使用input/button进行网页跳转

2023.11.18html中如何使用input/button进行网页跳转 在做网页时有时会用元素,有时会用元素进行form表单操作或者网页跳转,但是用bootstrap时两种元素会出现不同的样式,为了样式一致,有时需要使用这两种元素相互实现其常用功能。 …...

java文件压缩加密,使用流的方式

使用net.lingala.zip4j来进行文件加密压缩。 添加依赖net.lingala.zip4j包依赖&#xff0c;这里使用的是最新的包2.11.5版本。 <dependency><groupId>net.lingala.zip4j</groupId><artifactId>zip4j</artifactId><version>${zip4j.versi…...

月子会所信息展示服务预约小程序的作用是什么

传统线下门店经营只依赖自然流量咨询或简单的线上付费推广是比较低效的&#xff0c;属于靠“天”吃饭&#xff0c;如今的年轻人学历水平相对较高&#xff0c;接触的事物或接受的思想也更多更广&#xff0c;加之生活水平提升及互联网带来的长期知识赋能&#xff0c;因此在寻找/咨…...

Windows核心编程 静态库与动态库

资源文件 .rc 文件 会被 rc.exe 变成 .res 文件(二进制文件) 在链接时链接进入 .exe 文件 一、如何保护源码 程序编译链接过程 不想让别人拿到源代码&#xff0c;但是想让其使用功能&#xff0c;根据上图观察&#xff0c;把自己生成的obj给对方&#xff0c;对方拿到obj后&…...

【Spring Boot】如何自定义序列化以及反序列器

在我们使用默认的消息转换器&#xff0c;将java的Long类型通过json数据传输到前端JS时&#xff0c;会导致Long类型的精度丢失&#xff0c;这是因为JS处理Long类型数字只能精确到前16位&#xff0c;所以我们可以采用自定义序列化方式将Long类型数据统一转为String字符串&#xf…...

6 Redis的慢查询配置原理

1、redis的命令执行流程 redis的慢查询只针对步骤3 默认情况下&#xff0c;慢查询的阈值是10ms...

JAVA小游戏 “拼图”

第一步是创建项目 项目名自拟 第二部创建个包名 来规范class 然后是创建类 创建一个代码类 和一个运行类 代码如下&#xff1a; package heima; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import …...

Spring 配置

配置文件最主要的目的 : 解决硬编码的问题(代码写死) SpringBoot 的配置文件,有三种格式 1.properties 2.yaml 3.yml(是 yaml 的简写) SpringBoot 只支持三个文件 1.application.properties 2.application.yaml 3.application.yml yaml 和 yml 是一样的,学会一个就行…...

全新酷盒9.0源码:多功能工具箱软件的最新iapp解决方案

全能工具箱软件酷盒&#xff1a;源码提供iapp解决方案&#xff0c;自定义打造个性化体验 酷盒是一款功能丰富的工具箱软件&#xff0c;内置众多实用功能&#xff0c;并实时更新热门功能。该软件还拥有丰富的资源库&#xff0c;用户可以在线畅玩游戏、免费下载音乐等。 我们提…...

aspose.cells java合并多个excel

背景 有需求需要把多个excel合并到一个excel文件里面&#xff0c;之前一直都是用python来处理办公自动化的东西&#xff0c;但是这个需求用python的openxyl库处理基本只能合并数据&#xff0c;样式没办法一比一合并过去&#xff0c;找了很多解决方案都没法实现&#xff0c;所以…...

【每日一题】三个无重叠子数组的最大和

文章目录 Tag题目来源题目解读解题思路方法一&#xff1a;滑动窗口 写在最后 Tag 【滑动窗口】【数组】【2023-11-19】 题目来源 689. 三个无重叠子数组的最大和 题目解读 解题思路 方法一&#xff1a;滑动窗口 单个子数组的最大和 我们先来考虑一个长度为 k 的子数组的最…...

react之基于@reduxjs/toolkit使用react-redux

react之基于reduxjs/toolkit使用react-redux 一、配置基础环境二、使用React Toolkit 创建 counterStore三、为React注入store四、React组件使用store中的数据五、实现效果六、提交action传递参数七、异步状态操作 一、配置基础环境 1.使用cra快速创建一个react项目 npx crea…...

基于51单片机水位监测控制报警仿真设计( proteus仿真+程序+设计报告+讲解视频)

这里写目录标题 &#x1f4a5;1. 主要功能&#xff1a;&#x1f4a5;2. 讲解视频&#xff1a;&#x1f4a5;3. 仿真&#x1f4a5;4. 程序代码&#x1f4a5;5. 设计报告&#x1f4a5;6. 设计资料内容清单&&下载链接&#x1f4a5;[资料下载链接&#xff1a;](https://doc…...

git基本用法和操作

文章目录 创建版本库方式&#xff1a;Git常用操作命令&#xff1a;远程仓库相关命令分支(branch)操作相关命令版本(tag)操作相关命令子模块(submodule)相关操作命令忽略一些文件、文件夹不提交其他常用命令 创建版本库方式&#xff1a; 创建文件夹 在目录下 右键 Git Bush H…...

设计模式-组合模式-笔记

“数据结构”模式 常常有一些组件在内部具有特定的数据结构&#xff0c;如果让客户程序依赖这些特定数据结构&#xff0c;将极大地破坏组件的复用。这时候&#xff0c;将这些特定数据结构封装在内部&#xff0c;在外部提供统一的接口&#xff0c;来实现与特定数据结构无关的访…...

Android 弹出自定义对话框

Android在任意Activity界面弹出一个自定义的对话框&#xff0c;效果如下图所示: 准备一张小图片&#xff0c;右上角的小X图标64*64&#xff0c;close_icon.png&#xff0c;随便找个小图片代替&#xff1b; 第一步&#xff1a;样式添加&#xff0c;注意&#xff1a;默认在value…...

(论文阅读40-45)图像描述1

40.文献阅读笔记&#xff08;m-RNN&#xff09; 简介 题目 Explain Images with Multimodal Recurrent Neural Networks 作者 Junhua Mao, Wei Xu, Yi Yang, Jiang Wang, Alan L. Yuille, arXiv:1410.1090 原文链接 http://arxiv.org/pdf/1410.1090.pdf 关键词 m-RNN、…...

synchronized 学习

学习源&#xff1a; https://www.bilibili.com/video/BV1aJ411V763?spm_id_from333.788.videopod.episodes&vd_source32e1c41a9370911ab06d12fbc36c4ebc 1.应用场景 不超卖&#xff0c;也要考虑性能问题&#xff08;场景&#xff09; 2.常见面试问题&#xff1a; sync出…...

【OSG学习笔记】Day 18: 碰撞检测与物理交互

物理引擎&#xff08;Physics Engine&#xff09; 物理引擎 是一种通过计算机模拟物理规律&#xff08;如力学、碰撞、重力、流体动力学等&#xff09;的软件工具或库。 它的核心目标是在虚拟环境中逼真地模拟物体的运动和交互&#xff0c;广泛应用于 游戏开发、动画制作、虚…...

Unity3D中Gfx.WaitForPresent优化方案

前言 在Unity中&#xff0c;Gfx.WaitForPresent占用CPU过高通常表示主线程在等待GPU完成渲染&#xff08;即CPU被阻塞&#xff09;&#xff0c;这表明存在GPU瓶颈或垂直同步/帧率设置问题。以下是系统的优化方案&#xff1a; 对惹&#xff0c;这里有一个游戏开发交流小组&…...

Nuxt.js 中的路由配置详解

Nuxt.js 通过其内置的路由系统简化了应用的路由配置&#xff0c;使得开发者可以轻松地管理页面导航和 URL 结构。路由配置主要涉及页面组件的组织、动态路由的设置以及路由元信息的配置。 自动路由生成 Nuxt.js 会根据 pages 目录下的文件结构自动生成路由配置。每个文件都会对…...

NFT模式:数字资产确权与链游经济系统构建

NFT模式&#xff1a;数字资产确权与链游经济系统构建 ——从技术架构到可持续生态的范式革命 一、确权技术革新&#xff1a;构建可信数字资产基石 1. 区块链底层架构的进化 跨链互操作协议&#xff1a;基于LayerZero协议实现以太坊、Solana等公链资产互通&#xff0c;通过零知…...

Spring AI与Spring Modulith核心技术解析

Spring AI核心架构解析 Spring AI&#xff08;https://spring.io/projects/spring-ai&#xff09;作为Spring生态中的AI集成框架&#xff0c;其核心设计理念是通过模块化架构降低AI应用的开发复杂度。与Python生态中的LangChain/LlamaIndex等工具类似&#xff0c;但特别为多语…...

Android 之 kotlin 语言学习笔记三(Kotlin-Java 互操作)

参考官方文档&#xff1a;https://developer.android.google.cn/kotlin/interop?hlzh-cn 一、Java&#xff08;供 Kotlin 使用&#xff09; 1、不得使用硬关键字 不要使用 Kotlin 的任何硬关键字作为方法的名称 或字段。允许使用 Kotlin 的软关键字、修饰符关键字和特殊标识…...

【碎碎念】宝可梦 Mesh GO : 基于MESH网络的口袋妖怪 宝可梦GO游戏自组网系统

目录 游戏说明《宝可梦 Mesh GO》 —— 局域宝可梦探索Pokmon GO 类游戏核心理念应用场景Mesh 特性 宝可梦玩法融合设计游戏构想要素1. 地图探索&#xff08;基于物理空间 广播范围&#xff09;2. 野生宝可梦生成与广播3. 对战系统4. 道具与通信5. 延伸玩法 安全性设计 技术选…...

使用Matplotlib创建炫酷的3D散点图:数据可视化的新维度

文章目录 基础实现代码代码解析进阶技巧1. 自定义点的大小和颜色2. 添加图例和样式美化3. 真实数据应用示例实用技巧与注意事项完整示例(带样式)应用场景在数据科学和可视化领域,三维图形能为我们提供更丰富的数据洞察。本文将手把手教你如何使用Python的Matplotlib库创建引…...

现有的 Redis 分布式锁库(如 Redisson)提供了哪些便利?

现有的 Redis 分布式锁库&#xff08;如 Redisson&#xff09;相比于开发者自己基于 Redis 命令&#xff08;如 SETNX, EXPIRE, DEL&#xff09;手动实现分布式锁&#xff0c;提供了巨大的便利性和健壮性。主要体现在以下几个方面&#xff1a; 原子性保证 (Atomicity)&#xff…...