蓝牙身份证阅读器使用Uniapp调用二次开发demo
<template>
<view class="content">
<view class="search" :loading="searchingstatus" @click="searchbluetooth"> {{searchingstatus?"搜索中":"搜索蓝牙阅读器"}} </view>
<view class="section">
<block v-for="(item, index) in devices" :key="item.deviceId">
<view :class="item.deviceconnected?'list-item deviceconnected':'list-item'">
<view class="list-item-left">
<view class="devices_name">设备名称:{{item.name}}</view>
<view class="devices_id">设备ID:{{item.deviceId}}</view>
</view>
<button class="devices_btn" size="mini" @click="connectDevices(index)"> {{item.deviceconnected?"已连接":"未连接"}} </button>
</view>
</block>
</view>
<view class="idCard_content" v-if="idCardName">
<view>姓名: {{idCardName}}</view>
<view>性别: {{idCardSex}}</view>
<view>身份证号码: {{idCardNo}}</view>
</view>
<view @click="readIdcard" class="submit">读取</view>
<view @click="reset" class="submit">清空</view>
</view>
</template>
<script>
var app = getApp()
var temp = []
var serviceId = "0000ffe0-0000-1000-8000-00805f9b34fb"
var characteristicId = "0000ffe1-0000-1000-8000-00805f9b34fb"
var searchCardResult = false
var selectCardResult = false
var index = 0
var cardInfoArray = new Array()
var util = require("../../utils/util.js");
var analyCardTimer
var strName = '';
var strSex = '';
var strNation = '';
var strBirth = null;
var strAddr = null;
var strIdCode = null;
var strIssue = null;
var strBeginDate = null;
var strEndDate = null;
let that;
export default {
data() {
return {
detectCode: '',
idCardNo: '',
idCardName: '',
idCardSex: '',
telephone: '',
remark: '',
userUid: '',
deviceId: '',
devices: [],
isbluetoothready: false,
deviceconnected_index: 0,
searchingstatus: false,
is_open_blue:false,//监听初始化页面时是否打开蓝牙
}
},
onLoad() {
that = this;
this.switchBlueTooth();
},
methods: {
switchBlueTooth: function () {
uni.openBluetoothAdapter({
success: function (res) {
that.is_open_blue = true;
//蓝牙打开成功,若当前没有链接设备,搜索设备
that.searchbluetooth();
uni.onBluetoothAdapterStateChange(function (res) {
console.log("监听蓝牙状态改变",res);
if(!res.available){
let devices = that.devices;
let connect_index = that.deviceconnected_index;
devices[connect_index].deviceconnected = false;
that.deviceconnected = false;
that.devices = devices;
}
that.isbluetoothready = res.available;
that.searchingstatus = res.discovering;
})
//监听蓝牙搜索到设备回调
uni.onBluetoothDeviceFound(function (devices) {
console.log("监听搜索回调",devices)
if (!devices.devices[0].name) {
return
} else {
temp.push(devices.devices[0])
that.devices =temp;
console.log('发现新蓝牙设备',devices);
//本地连过的历史记录
let local_devices = uni.getStorageSync("devices");
if(local_devices && local_devices[0].deviceId == devices.devices[0].deviceId){
that.connectTO(devices.devices[0]);
}
// uni.stopBluetoothDevicesDiscovery({
// success: function (res) {
// console.log("停止蓝牙搜索")
// }
// })
}
})
//接收数据
uni.onBLECharacteristicValueChange(function (characteristic) {
let buffer = characteristic.value
let dataView = new DataView(buffer)
var intArray = new Uint8Array(buffer) //将arraybuffer转换为array
if (!searchCardResult && searchCardIsOk(intArray)) { //寻卡成功
searchCardResult = true
uni.writeBLECharacteristicValue({ //选卡
deviceId: that.connectedDeviceId,
serviceId: serviceId,
characteristicId: characteristicId,
value: util.stringToArrayBuffer('aaaaaa96690003200221'),
success: function (res) {
console.log('writeBLECharacteristicValue success 2', res.errMsg)
},
})
} else if (searchCardResult && !selectCardResult) {
if (selectCardIsOk(intArray)) { //选卡成功
selectCardResult = true
uni.writeBLECharacteristicValue({ //读卡
deviceId: that.connectedDeviceId,
serviceId: serviceId,
characteristicId: characteristicId,
//value: util.stringToArrayBuffer('aaaaaa96690003301023'), //读文字+照片+指纹信息,小程序无法解析照片,故显示都无照片信息
value: util.stringToArrayBuffer('aaaaaa96690003300132'), //读文字+照片信息,小程序无法解析照片,故显示都无照片信息
success: function (res) {
console.log('writeBLECharacteristicValue success 3', res)
}
})
} else {
startSearchCard(that); //寻卡
}
} else if (searchCardResult && selectCardResult) {
for (var i = 0; i < intArray.byteLength; i++) {
cardInfoArray[index] = intArray[i]
index++ //二代证 1297 三代证2321
}
clearTimeout(analyCardTimer)
//if ((cardInfoArray.length == 2321) || (cardInfoArray.length == 1297)){
if ((cardInfoArray.length == 2321) || (cardInfoArray.length == 1295)) {
analyCardTimer = setTimeout(function () {
uni.hideLoading();
readCardIsOk(cardInfoArray)
updateInfo(that)
}, 500)
}
} else {
startSearchCard(that); //寻卡
}
var str = ""
for (var i = 0; i < dataView.byteLength; i++) {
// console.log((dataView.getUint8(i)))
// str += String.fromCharCode(dataView.getUint8(i))
var temp = (dataView.getUint8(i)).toString(16)
var len = temp.length
while (len < 2) {
temp = '0' + temp //补位
len++
}
// str = (dataView.getUint8(i)).toString(16)
str += temp
}
})
},
fail: function (res) {
uni.showModal({
title: '提示',
content: '请检查手机蓝牙是否打开',
success: function (res) {
that.is_open_blue = false;
that.isbluetoothready = false;
that.searchingstatus = false;
}
})
}
})
},
searchbluetooth: function () {
if(!this.is_open_blue){
//打开小程序前未打开蓝牙,点击搜索时需要重新初始化蓝牙
this.switchBlueTooth();
return;
}
temp = [];
this.devices.forEach(function(item){
if(item.deviceconnected){
temp.push(item);
}
})
var that = this
if (!that.searchingstatus) {
var that = this
uni.startBluetoothDevicesDiscovery({
//指定services搜索 0000ffe0-0000-1000-8000-00805f9b34fb 过滤掉其他类型蓝牙设备
services: ['0000ffe0-0000-1000-8000-00805f9b34fb'],
success: function (res) {
that.searchingstatus = !that.searchingstatus;
},
fail: function (res) {
uni.showToast({
icon: "none",
title: that.replaceMsg(res.errCode,res.errMsg),
})
}
})
} else {
that.searchingstatus = false;
uni.stopBluetoothDevicesDiscovery({
success: function (res) {
console.log("停止蓝牙搜索",res)
}
})
}
},
connectDevices(index){
let devices = this.devices[index];
this.connectTO(devices)
},
connectTO: function (e) {
var that = this;
var devices = JSON.parse(JSON.stringify(this.devices));
var index = devices.findIndex(function(item) {
return item.deviceId === e.deviceId;
});
console.log(index)
if (devices[index].deviceconnected) {
uni.notifyBLECharacteristicValueChange({
state: false, // 停用notify 功能
deviceId: that.connectedDeviceId,
serviceId: serviceId,
characteristicId: characteristicId,
success: function (res) {
console.log("停用notify 功能")
}
})
uni.closeBLEConnection({
deviceId: e.deviceId,
complete: function (res) {
console.log("断开设备",res);
devices[index].deviceconnected = false;
that.devices = devices;
that.connectedDeviceId = "";
}
})
// getApp().globalData.devices = [];
} else {
uni.showLoading({
title: '连接蓝牙设备中...',
})
uni.createBLEConnection({
deviceId: e.deviceId,
success: function (res) {
console.log("createBLEConnection",res)
uni.getBLEDeviceServices({
// 这里的 deviceId 需要已经通过 createBLEConnection 与对应设备建立链接
deviceId: e.deviceId,
success: function (res) {
//下面两行,Android测试不行的时候注释测试下,Android比较复杂。
//苹果端可用 安卓端不可用,如果安卓读取失败,可以注释掉这行试试
uni.getSystemInfo({
success(resP) {
if( resP.platform == 'ios'){
serviceId = res.services[res.services.length - 1].uuid;
}else{
serviceId = res.services[res.services.length - 3].uuid;
}
}
})
console.log("serviceId",res,"e",e);
setTimeout(function () {
uni.getBLEDeviceCharacteristics({
deviceId: e.deviceId,
serviceId: serviceId,
success: function (res) {
characteristicId = res.characteristics[0].uuid;
// console.log("设备charater获取成功", res)
uni.notifyBLECharacteristicValueChange({
state: true, // 启用 notify 功能
deviceId: that.connectedDeviceId,
serviceId: serviceId,
characteristicId: characteristicId,
success: function (res) {
console.log("启用notify")
},
fail: function (res) {
console.log("启用notify失败", res)
},
})
},
fail: function (res) {
console.log("设备charater获取失败", res)
},
})
}, 2000)
}
})
uni.hideLoading()
uni.showToast({
title: '连接成功',
icon: 'success',
duration: 1000
})
console.log("连接设备成功",res)
devices.forEach((item) => {
item.deviceconnected = false
})
devices[index].deviceconnected = true;
that.connectedDeviceId = e.deviceId;
that.deviceconnected_index = index;
that.devices = devices;
// getApp().globalData.devices = [e];
// getApp().globalData.connectedDeviceId = e.deviceId;
uni.setStorageSync('devices', [e]);
},
fail: function (res) {
uni.hideLoading()
uni.showToast({
title: that.replaceMsg(res.errCode,res.errMsg),
icon: 'none',
duration: 1000
})
console.log("连接设备失败",res)
that.connected = false;
}
})
uni.stopBluetoothDevicesDiscovery({
success: function (res) {
console.log("停止蓝牙搜索")
}
})
}
},
readIdcard(){
let that = this;
uni.showLoading({
title: '读取中~',
})
startSearchCard(that)
},
replaceMsg(errCode,errMsg){
let codeMsg = errMsg;
if(errCode == -1){
codeMsg = '已连接';
}else if(errCode == 10001){
codeMsg = '请检查手机是否已打开蓝牙';
}else if(errCode == 10000){
codeMsg = '未初始化蓝牙适配器';
}else if(errCode == 10002){
codeMsg = '没有找到指定设备';
}else if(errCode == 10003){
codeMsg = '连接失败';
}else if(errCode == 10006){
codeMsg = '当前连接已断开';
}else if(errCode == 10012){
codeMsg = '连接超时';
}
return codeMsg
},
reset(){
this.idCardName = '';
this.idCardSex = '';
this.idCardNo = '';
}
}
}
//寻卡
function startSearchCard(that) {
searchCardResult = false
selectCardResult = false
index = 0;
console.log("1----")
uni.writeBLECharacteristicValue({
deviceId: that.connectedDeviceId,
serviceId: serviceId,
characteristicId: characteristicId,
value: util.stringToArrayBuffer('aaaaaa96690003200122'),
success: function (res) {
console.log(res)
console.log('writeBLECharacteristicValue success 1', res.errMsg)
},
fail: function (res) {
uni.hideLoading();
console.log("writeBLECharacteristicValue fail", res)
uni.showToast({
title: that.replaceMsg(res.errCode,res.errMsg),
icon:'none'
})
},
})
}
//寻卡结果分析
function searchCardIsOk(result) {
var SW1 = result[7];
var SW2 = result[8];
var SW3 = result[9];
if ((0x0 != SW1) || (0x0 != SW2) || (0x9F) != SW3) {
return false;
}
return true;
}
//选卡结果分析
function selectCardIsOk(result) {
console.log('选卡解析:', result)
var SW1 = result[7];
var SW2 = result[8];
var SW3 = result[9];
if ((0x0 != SW1) || (0x0 != SW2) || (0x90) != SW3) {
return false;
}
console.log('选卡成功')
return true;
}
//读卡结果分析
function readCardIsOk(_i_bys_resp) {
var SW1 = _i_bys_resp[7];
var SW2 = _i_bys_resp[8];
var SW3 = _i_bys_resp[9];
if ((0x0 != SW1) || (0x0 != SW2) || ((0x90) != SW3)) {
return false;
}
if (_i_bys_resp.length < 1024) {
return false;
}
///
//
var i = 0;
var j = 0;
var iOffset = 0;
var bysName = new Array(30);
var bysSexCode = new Array(2);
var bysNationCode = new Array(4);
var bysBirth = new Array(16);
var bysAddr = new Array(70);
var bysIdCode = new Array(36);
var bysIssue = new Array(30);
var bysBeginDate = new Array(16);
var bysEndDate = new Array(16);
var iTextSize = 0;
var iPhotoSize = 0;
var iFingerSize = 0;
iTextSize = _i_bys_resp[10] << 8 + _i_bys_resp[11];
iPhotoSize = _i_bys_resp[12] << 8 + _i_bys_resp[13];
iFingerSize = _i_bys_resp[14] << 8 + _i_bys_resp[15];
///
//截取数据
//iOffset = 16;
iOffset = 14;
//截取姓名
j = 0;
for (i = iOffset; i < (iOffset + 30); i++) {
bysName[j] = _i_bys_resp[i];
j++;
}
try {
strName = util.uint8ArrayToStr(bysName)
} catch (Exception) {}
iOffset += 30;
//截取性别
j = 0;
for (i = iOffset; i < (iOffset + 2); i++) {
bysSexCode[j] = _i_bys_resp[i];
j++;
}
var strSexCode = null;
try {
strSexCode = util.uint8ArrayToStr(bysSexCode);
strSex = util.getSexFromCode(strSexCode);
} catch (Exception) {}
iOffset += 2;
//截取民族
j = 0;
for (i = iOffset; i < (iOffset + 4); i++) {
bysNationCode[j] = _i_bys_resp[i];
j++;
}
var strNationCode = null;
try {
strNationCode = util.uint8ArrayToStr(bysNationCode, );
strNation = util.getNationFromCode(strNationCode);
} catch (Exception) {}
iOffset += 4;
//截取生日
j = 0;
for (i = iOffset; i < (iOffset + 16); i++) {
bysBirth[j] = _i_bys_resp[i];
j++;
}
try {
strBirth = new String(bysBirth, "UTF-16LE");
} catch (Exception) {}
iOffset += 16;
//截取地址
j = 0;
for (i = iOffset; i < (iOffset + 70); i++) {
bysAddr[j] = _i_bys_resp[i];
j++;
}
try {
strAddr = util.uint8ArrayToStr(bysAddr);
} catch (Exception) {}
iOffset += 70;
//截取身份证号
j = 0;
for (i = iOffset; i < (iOffset + 36); i++) {
bysIdCode[j] = _i_bys_resp[i];
j++;
}
try {
strIdCode = util.uint8ArrayToStr(bysIdCode);
} catch (Exception) {}
iOffset += 36;
//截取签发机关
j = 0;
for (i = iOffset; i < (iOffset + 30); i++) {
bysIssue[j] = _i_bys_resp[i];
j++;
}
try {
strIssue = util.uint8ArrayToStr(bysIssue);
} catch (Exception) {}
iOffset += 30;
//截取有效期开始日期
j = 0;
for (i = iOffset; i < (iOffset + 16); i++) {
bysBeginDate[j] = _i_bys_resp[i];
j++;
}
try {
strBeginDate = util.uint8ArrayToStr(bysBeginDate);
} catch (Exception) {}
iOffset += 16;
//截取有效期结束日期
j = 0;
for (i = iOffset; i < (iOffset + 16); i++) {
bysEndDate[j] = _i_bys_resp[i];
j++;
}
try {
if (bysEndDate[0] >= '0' && bysEndDate[0] <= '9') {
// strEndDate = new String(bysEndDate, "UTF-16LE");
} else {
// strEndDate = new String(bysEndDate, "UTF-16LE");
}
strEndDate = util.uint8ArrayToStr(bysEndDate)
} catch (Exception) {}
iOffset += 16;
// //照片
// var wlt = new byte[1024];
// byte[] bmp = new byte[14 + 40 + 308 * 126];
// for (i = 0; i < iPhotoSize; i++) {
// wlt[i] = _i_bys_resp[16 + iTextSize + i];
// }
// //int iResult = JniCall.hxgc_Wlt2Bmp(wlt, bmp, 0);
// int iResult = DecodeWlt.hxgc_Wlt2Bmp(wlt, bmp, 708);
// Bitmap bitmapIdPhoto = null;
// if (iResult != -1) {
// bitmapIdPhoto = BitmapFactory.decodeByteArray(bmp, 0, bmp.length);
// }
return true;
}
function updateInfo(that) {
console.log('姓名:', strName)
console.log('性别:', strSex)
console.log('身份证号:', strIdCode)
console.log('地址:', strAddr)
that.idCardName = strName;
that.idCardNo = strIdCode;
that.idCardSex = strSex;
}
function ab2hex(buffer) {
const hexArr = Array.prototype.map.call(
new Uint8Array(buffer),
function (bit) {
return ('00' + bit.toString(16)).slice(-2)
}
)
return hexArr.join('')
}
</script>
<style>
.content {
/* display: flex;
flex-direction: column;
align-items: center;
justify-content: center; */
}
.search{
width: 100%;
height: 90rpx;
background: #0e47a1;
text-align: center;
line-height: 90rpx;
font-size: 32rpx;
font-weight: 600;
color: #fff;
letter-spacing: 2rpx;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
.idCard_content{
width: 700rpx;
margin-left: 50rpx;
font-size: 26rpx;
color: #000;
line-height: 40rpx;
margin-top: 50rpx;
}
.section{
margin: 20rpx 30rpx;
background: #fff;
border-radius: 10rpx;
color: #000;
font-size: 28rpx;
}
.section_devices{
background: none;
height: 130rpx;
overflow: scroll;
}
.list_item{
display: flex;
align-items: center;
justify-content: space-between;
padding: 7rpx 30rpx;
min-height: 80rpx;
position: relative;
}
.item_left{
width: 150rpx;
text-align: left;
}
.item_right{
text-align: right;
}
.list-item {
display: flex;
align-items: center;
background: #fff;
border-radius: 10rpx;
color: #000;
font-size: 28rpx;
padding: 20rpx;
margin-bottom: 15rpx;
}
.list-item:last-child{
margin-bottom: 0rpx;
}
.devices_name,.devices_id{
max-width: 480rpx;
padding: 5rpx 0;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
line-height: 31rpx;
max-height: 31rpx;
-webkit-line-clamp: 1;
-webkit-box-orient: vertical;
word-wrap:break-word;
word-break:break-all;
}
.devices_btn {
margin-right: 10rpx;
}
.deviceconnected {
background-color: sandybrown
}
.submit{
width: 350rpx;
height: 80rpx;
line-height: 80rpx;
background: #0e47a1;
color: #fff;
font-size: 34rpx;
text-align: center;
border-radius: 40rpx;
margin: 20px auto;
}
</style>
相关文章:
蓝牙身份证阅读器使用Uniapp调用二次开发demo
<template> <view class"content"> <view class"search" :loading"searchingstatus" click"searchbluetooth"> {{searchingstatus?"搜索中":"搜索蓝牙阅读器"}} </view> …...
好用的shell终端工具
FinalShell SSH工具,服务器管理 FinalShell SSH工具,服务器管理,远程桌面加速软件,支持Windows,macOS,Linux,版本4.5.12,更新日期2024.10.30 - FinalShell官网...
OSPF不规则区域划分
1、建立一条虚链路 vlink 可以被视为是⻣⼲区域的⼀段延伸。 这⼀条虚拟的链路,只能够跨域⼀个⾮⻣⼲区域。 [r2-ospf-1-area-0.0.0.1]vlink-peer 3.3.3.3 [r3-ospf-1-area-0.0.0.1]vlink-peer 2.2.2.2 在没有建立虚链路之前,r1是不能ping r4的。vlink建⽴的邻居关…...
复习javascript
1.修改元素内的内容 <div>zsgh</div> <script> const box1document.querySelector("div") box1.innerText"ppp" box1.innerHtml<h1>修改</h1> </script> 2.随机点名练习 <!DOCTYPE html> <html lang…...
海盗王64位服务端+32位客户端3.0版本
经过多天的尝试,终于把海盗王3.0的服务端改成了64位的,包括AccountServer GroupServer GameServer GateServer。 客户端则保留了32位。 服务端改成64位的好处是GameServer可以只启动一个就开全部地图,大概6G内存左右,直接将跳…...
【从零实现JsonRpc框架#2】Muduo库介绍
1.基本概念 Muduo 由陈硕大佬开发,是一个基于非阻塞IO和事件驱动的C高并发TCP网络编程库。它是一款基于主从Reactor模型的网络库,其使用的线程模型是 one loop per thread。 1.1 主从 Reactor 模型 主 Reactor(MainReactor,通常…...
如何创建伪服务器,伪接口
创建伪接口一般是用于模拟真实接口的行为,以便在开发和测试过程中进行使用,以下是一些常见的创建伪接口的方法: 使用 Web 框架搭建: Python 和 Flask:Flask 是一个轻量级的 Python Web 框架。示例代码如下:…...
NX949NX952美光科技闪存NX961NX964
NX949NX952美光科技闪存NX961NX964 在半导体存储领域,美光科技始终扮演着技术引领者的角色。其NX系列闪存产品线凭借卓越的性能与创新设计,成为数据中心、人工智能、高端消费电子等场景的核心组件。本文将围绕NX949、NX952、NX961及NX964四款代表性产品…...
vue配置代理解决前端跨域的问题
文章目录 一、概述二、报错现象三、通过配置代理来解决修改request.js中的baseURL为/api在vite.config.js中增加代理配置 四、参考资料 一、概述 跨域是指由于浏览器的同源策略限制,向不同源(不同协议、不同域名、不同端口)发送ajax请求会失败 二、报错现象 三、…...
深入解析Vue3中ref与reactive的区别及源码实现
深入解析Vue3中ref与reactive的区别及源码实现 前言 Vue3带来了全新的响应式系统,其中ref和reactive是最常用的两个API。本文将从基础使用、核心区别到源码实现,由浅入深地分析这两个API。 一、基础使用 1. ref import { ref } from vueconst count…...
Java Bean容器详解:核心功能与最佳使用实践
在Java企业级开发中,Bean容器是框架的核心组件之一,它通过管理对象(Bean)的生命周期、依赖关系等,显著提升了代码的可维护性和扩展性。主流的框架如Spring、Jakarta EE(原Java EE)均提供了成熟的…...
Xilinx Kintex-7 XC7K325T-2FFG676I 赛灵思 FPGA
XC7K325T-2FFG676I 属于 Kintex-7 FPGA ,低功耗与合理成本的应用市场,可提供比前代产品两倍的性价比提升和卓越的系统集成能力。该器件于 28 nm 工艺节点制造,速度等级为 -2,适合对时序要求严格但预算有限的系统设计。 产品架构与…...
AI实战笔记(1)AI 的 6 大核心方向 + 学习阶段路径
一、机器学习(ML) 目标:用数据“训练”模型,完成分类、回归、聚类等任务。 学习阶段: (1)基础数学:线性代数、概率统计、微积分(适度) (2…...
Ceph集群故障处理 - PG不一致修复
Ceph集群故障处理 - PG不一致修复 目录故障现象故障分析故障定位修复过程磁盘状态检查OSD存储结构检查修复分析故障总结问题原因修复方法后续建议经验教训最佳实践 参考资料 # ceph -v ceph version 14.2.22目录 故障现象故障分析故障定位修复过程磁盘状态检查OSD存储结构检查…...
【前端】每日一道面试题3:如何实现一个基于CSS Grid的12列自适应布局?
要实现一个基于CSS Grid的12列自适应布局,关键在于利用网格系统的灵活性和响应式设计能力。以下是具体实现步骤及核心代码示例: 一、基础网格容器定义 创建网格容器 使用display: grid将父元素定义为网格容器: .container {display: grid;gr…...
leetcode 349. Intersection of Two Arrays
题目描述 题目限制0 < nums1[i], nums2[i] < 1000,所以可以开辟一个1001个元素的数组来做哈希表。 class Solution { public:vector<int> intersection(vector<int>& nums1, vector<int>& nums2) {vector<int> table(1001,0…...
机器学习 day01
文章目录 前言一、机器学习的基本概念二、数据集的加载1.玩具数据集2.联网数据集3.本地数据集 三、数据集的划分四、特征提取1.稀疏矩阵与稠密矩阵2.字典列表特征提取3.文本特征提取 前言 目前我开始学习机器学习部分的相关知识,通过今天的学习,我掌握了…...
C++STL——priority_queue
优先队列 前言优先队列仿函数头文件 前言 本篇主要讲解优先队列及其底层实现。 优先队列 优先队列的本质就是个堆,其与queue一样,都是容器适配器,不过优先队列是默认为vector实现的。priority_queue的接口优先队列默认为大根堆。 仿函数 …...
DS18B20温度传感器
1.基本信息 测温范围为一55~ 125℃;3.3/5V的供电电压;-10~85内精度较高; 典型的温度转换时间为 750ms(12 位分辨率); 输出最小分辨率:0.0625; 采用单总线数据格式&am…...
《Python星球日记》 第50天:深度学习概述与环境搭建
名人说:路漫漫其修远兮,吾将上下而求索。—— 屈原《离骚》 创作者:Code_流苏(CSDN)(一个喜欢古诗词和编程的Coder😊) 目录 一、什么是深度学习?它与传统机器学习的区别1. 深度学习的定义2. 深…...
BUUCTF——Cookie is so stable
BUUCTF——Cookie is so stable 进入靶场 页面有点熟悉 跟之前做过的靶场有点像 先简单看一看靶场信息 有几个功能点 flag.php 随便输了个admin 根据题目提示 应该与cookie有关 抓包看看 构造payload Cookie: PHPSESSIDef0623af2c1a6d2012d57f3529427d52; user{{7*7}}有…...
Java 基础面试题
🧑 博主简介:CSDN博客专家,历代文学网(PC端可以访问:https://literature.sinhy.com/#/literature?__c1000,移动端可微信小程序搜索“历代文学”)总架构师,15年工作经验,…...
bcm5482 phy 场景总结
1,BCM5482是一款双端口10/100/1000BASE-T以太网PHY芯片,支持多种速率和双工模式。其配置主要通过MDIO(Management Data Input/Output)接口进行,MDIO接口用于访问PHY芯片内部的寄存器,从而配置网络速率、双工模式以及其他相关参数。 a,具体以下面两种场景举例 2. 寄存器和…...
小程序多线程实战
在小程序开发中,由于微信小程序的运行环境限制,原生并不支持传统意义上的多线程编程,但可以通过以下两种核心方案实现类似多线程的并发处理效果,尤其在处理复杂计算、避免主线程阻塞时非常关键: 一、官方方案ÿ…...
PPT图表怎么制作?说5款自己使用过的PPT图表制作工具
PPT图表怎么制作?准备一份吸引人的PPT演示文稿时,图表往往能起到画龙点睛的作用。但是,对于很多人来说,制作既美观又专业的图表却不是一件容易的事情。今天,我们就来聊聊如何利用一些优秀的工具制作PPT图表。 1、亿图图…...
渠道销售简历模板范文
模板信息 简历范文名称:渠道销售简历模板范文,所属行业:其他 | 职位,模板编号:KRZ3J3 专业的个人简历模板,逻辑清晰,排版简洁美观,让你的个人简历显得更专业,找到好工作…...
数据库实验10
设计性实验 1.实验要求 1.编写函数FsumXXX,1~n(参数)求和; GO CREATE FUNCTION Fsum065 (n INT) RETURNS INT AS BEGIN DECLARE sum INT 0 WHILE n > 0 BEGIN SET sum sum n SET n n - 1 END RETURN sum END …...
C#异步Task,await,async和Unity同步协程
标题 TaskawaitasyncUnity协程 Task Task是声明异步任务的必要关键字,也可以使用Task<>泛型来定义Task的返回值。 await await是用于等待一个Task结束,否则让出该线程控制权,让步给其他线程,直到该Task结束才往下运行。 …...
【ML-Agents】ML-Agents示例项目导入unity报错解决
最近在跑ML-Agents的示例代码,无奈往unity中导入项目后,就出现报错。本文简要描述了各个报错的解决方法。 文章目录 一、error CS0234: The type or namespace name InputSystem does not exist in the namespace UnityEngine (are you missing an assem…...
【Web前端开发】HTML基础
Web前端开发是用来直接给用户呈现一个一个的网页,主要包含实现用户的结构(HTML)、样式(CSS)、交互(JavaScript)。然而一个软件通常是由后端和前端完成的。可以查阅文档:HTML 教程 (w…...
spark-哈希join介绍
目录 1. Shuffle Join 和 Hash Join 的复杂度1.1 Shuffle Join1.2 Hash Join 2. 哈希算法的原理2.1 什么是哈希算法?2.2 哈希算法的工作原理2.3 常见哈希函数 3. 哈希算法的弊端3.1 哈希碰撞3.2 哈希分布不均匀3.3 哈希值不可逆 4. 哈希碰撞的处理方法4.1 链地址法4…...
计算机网络与多线程同步机制详解
一、IP地址与子网划分 在互联网世界中,IP地址就像是每个设备的"门牌号",它使得数据包能够准确送达目的地。IP地址的划分与管理就像城市的规划,通过合理的子网划分,能够高效地管理网络资源。 子网掩码的工作原理 子网…...
栈溢出攻击最基本原理
函数在调用的过程中,函数在调用之前呢,会将调用完这个函数之后的下一条命令的地址保存到LR中。 void func() {int a[4];a[6] 100; } 这个函数在用gcc编译的时候是不会报错的,所以我们可以在尝试之后,修改LR的值,让代…...
ChemDraw、InDraw、KingDraw有什么差别?
在化学相关的科研与教学领域,一款好用的结构式编辑器至关重要,ChemDraw因此闻名;但近年来,ChemDraw代理商频繁发送律师函,给学校和企业带来诸多困扰,促使大家纷纷寻找替代软件。InDraw和KingDraw这两款软件…...
NVMe控制器IP设计之接口模块
这是NVMe控制器IP设计系列博客之一,其他的见本博客或csdn搜用户名:tiantianuser。相关视频见B站用户名:专注与守望。 接口转换模块负责完成AXI4接口与控制器内部的自定义接口之间的转换工作。接口转换模块的框图如图1所示。 图1 接口转换示…...
从0开始学linux韦东山教程第三章问题小结(2)
本人从0开始学习linux,使用的是韦东山的教程,在跟着课程学习的情况下的所遇到的问题的总结,理论虽枯燥但是是基础。 摘要关键词:PC远程访问ubuntu配置,ubuntu配置uboot环境,串口控制开发板 本文详细介绍以下问题&…...
JS正则表达式介绍(JavaScript正则表达式)
文章目录 JavaScript正则表达式完全指南正则表达式基础元字符与特殊字符基本元字符. - 点号\d - 数字\D - 非数字\w - 单词字符\W - 非单词字符\s - 空白字符\S - 非空白字符 正则表达式标志常用标志详解g - 全局匹配i - 忽略大小写m - 多行匹配s - 点号匹配所有字符u - Unicod…...
(51单片机)LCD显示红外遥控相关数字(Delay延时函数)(LCD1602教程)(Int0和Timer0外部中断教程)(IR红外遥控模块教程)
前言: 本次Timer0模块改装了一下,注意!!!今天只是简单的实现一下,明天用次功能显示遥控密码锁 演示视频: 在审核 源代码: 如上图将9个文放在Keli5 中即可,然后烧录在…...
关于单片机的基础知识(一)
成长路上不孤单😊😊😊😊😊😊 【14后😊///计算机爱好者😊///持续分享所学😊///如有需要欢迎收藏转发///😊】 今日分享关于单片机基础知识的相关内容…...
操作系统学习笔记第2章 (竟成)
第 2 章 进程管理 【考纲内容】 1.进程与线程: (1) 进程 / 线程的基本概念; (2) 进程 / 线程的状态与转换; (3) 线程的实现:内核支持的线程;线程库支持的线程; (4) 进程与线程的组织与控制; (5)…...
《从零开始:构建你的第一个区块链应用》
一、引言 区块链技术,这个曾经只在金融领域被广泛讨论的技术,如今已经渗透到各个行业。从供应链管理到智能合约,区块链的应用场景越来越丰富。对于开发者来说,理解区块链的基本原理并构建一个简单的区块链应用,是进入这…...
[思维模式-24]:《本质思考力》-5- 马克思主义毛泽东思想揭示了了人类社会运作的普遍规律有哪些?
目录 一、马克思主义毛泽东思想揭示了了人类社会运作的普遍规律有哪些? 1、生产力与生产关系的辩证运动规律 2、阶级斗争与社会革命规律 3、社会形态演变规律 4、人民群众是历史创造者的规律 5、社会基本矛盾运动规律 6、认识与实践的辩证关系规律 二、马克…...
CentOS7.9部署FunASR实时语音识别接口 | 部署商用级别实时语音识别接口FunASR
0. 环境说明 本次在云服务器中部署一套实时语音识别接口,基于阿里开源的FunASR。 云服务器使用莱卡云,4核心4GB内存50GB存储空间,带宽10Mbps。 操作系统使用CentOS7.9 视频演示可以看 云服务器中部署实时语音识别接口 | FunASR在云服务器…...
炫酷粒子系统动画实战:Matplotlib实现银河漩涡效果
炫酷粒子系统动画实战:Matplotlib实现银河漩涡效果 效果演示:银河粒子漩涡核心代码分析1. 粒子系统初始化2. 动画更新函数3. 渲染优化技巧 完整实现代码Matplotlib的动画模块介绍核心类对比核心功能分点注意事项 效果演示:银河粒子漩涡 动…...
MAD-TD: MODEL-AUGMENTED DATA STABILIZES HIGH UPDATE RATIO RL
ICLR 2025 spotlight paper 构建能够在少量样本下学习出优良策略的深度强化学习(RL)智能体一直是一个极具挑战性的任务。为了提高样本效率,近期的研究尝试在每获取一个新样本后执行大量的梯度更新。尽管这种高更新-数据比(UTD&am…...
机器学习第四讲:无监督学习 → 给无标签积木自由组合,发现隐藏规律
机器学习第四讲:无监督学习 → 给无标签积木自由组合,发现隐藏规律 资料取自《零基础学机器学习》。 查看总目录:学习大纲 关于DeepSeek本地部署指南可以看下我之前写的文章:DeepSeek R1本地与线上满血版部署:超详细…...
Vue 两种导航方式
目录 一、声明式导航 二、编程式导航 三、两句话总结 一、声明式导航 1. 传参跳转: <router-link :to"/user?nameCHEEMS&id114514">Query传参 </router-link><router-link :to"/user?参数名1参数值1&参数名2参数值2&a…...
HTTP 的发展史:从前端视角看网络协议的演进
别再让才华被埋没,别再让github 项目蒙尘!github star 请点击 GitHub 在线专业服务直通车GitHub赋能精灵 - 艾米莉,立即加入这场席卷全球开发者的星光革命!若你有快速提升github Star github 加星数的需求,访问taimili…...
Spring 必会之微服务篇(2)
经过上一篇文章的介绍,应该对微服务有了基本的认识,以及为什么要用微服务和微服务要面临的挑战和对应的解决问题,这一期继续聊聊关于微服务的相关知识。 服务拆分 为什么拆 对于大多数的小型项目来说,一般是先采用单体架构,但是随着后面的用户规模变大,业务越来越复杂…...
21.【.NET 8 实战--孢子记账--从单体到微服务--转向微服务】--单体转微服务--身份认证服务拆分规划
从这篇文章开始我们将开始一步一步的拆分现有的单体应用孢子记账项目。按照上一篇文章中的介绍,我们首先把身份认证服务拆分出来。 一、功能分析 在当前的单体应用中,身份认证服务主要负责用户认证、授权以及角色权限管理等核心功能。 在拆分之前&…...