摘要: # -*- coding: utf8 -*- import serial import time import datetime import struct # 替换成你的串口名称和波特率 ser = serial.Serial('COM5', 115200, timeout=1) def anal 阅读全文
posted @ 2024-09-13 15:30 西北逍遥 阅读(1) 评论(0) 推荐(0) 编辑
摘要: #include <QApplication> #include <QFileDialog> #include <QFile> #include <QTextStream> #include <QMessageBox> void saveFileWithDialog() { QString file 阅读全文
posted @ 2024-09-10 10:14 西北逍遥 阅读(3) 评论(0) 推荐(0) 编辑
摘要: unity3d通过串口接收Arduino数据 using System.Collections; using System.Collections.Generic; using UnityEngine; using System.IO.Ports; using System; using Syste 阅读全文
posted @ 2024-09-01 00:16 西北逍遥 阅读(7) 评论(0) 推荐(0) 编辑
摘要: ImageDraw.Draw 填充区域 在Python的PIL(Python Imaging Library,现在通常称为Pillow)库中,ImageDraw.Draw 对象用于在图像上绘制形状。要填充一个区域,你通常会使用 rectangle、ellipse、polygon 等方法,并指定填充颜 阅读全文
posted @ 2024-08-30 19:12 西北逍遥 阅读(13) 评论(0) 推荐(0) 编辑
摘要: python 计算list的方差 import numpy as np # 假设我们有一个包含数值的列表 data = [1, 2, 3, 4, 5] # 计算均值 mean = np.mean(data) # 计算方差 variance = np.var(data) # 这将使用默认的N-1作为分 阅读全文
posted @ 2024-08-21 18:12 西北逍遥 阅读(8) 评论(0) 推荐(0) 编辑
摘要: if (tcpSocketObj->state()==QAbstractSocket::SocketState::ConnectedState) { qDebug() << "send data:"<<dataStr; tcpSocketObj->write(dataStr.toUtf8()); } 阅读全文
posted @ 2024-08-17 22:49 西北逍遥 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 在Qt中,QTcpSocket 类用于TCP网络编程,它提供了丰富的接口来管理TCP连接。要判断 QTcpSocket 的连接状态,可以使用 state() 方法,该方法返回一个 QAbstractSocket::SocketState 枚举值,表示当前的连接状态。 以下是一些常见的连接状态及其对应 阅读全文
posted @ 2024-08-14 21:52 西北逍遥 阅读(53) 评论(0) 推荐(0) 编辑
摘要: python获取当前日期 年月日时分秒 from datetime import datetime now = datetime.now() current_time = now.strftime("%Y-%m-%d %H:%M:%S") ############################## 阅读全文
posted @ 2024-08-13 22:05 西北逍遥 阅读(46) 评论(0) 推荐(0) 编辑
摘要: pyqt5 combox选择事件绑定 import sys from PyQt5.QtWidgets import QApplication, QWidget, QComboBox, QVBoxLayout, QLabel class ComboBoxExample(QWidget): def __ 阅读全文
posted @ 2024-08-12 15:13 西北逍遥 阅读(20) 评论(0) 推荐(0) 编辑
摘要: unity3d 动态改变物体的位置 using UnityEngine; public class MoveObject : MonoBehaviour { void Start() { // GameObject myObject = GameObject.Find("myObject"); if 阅读全文
posted @ 2024-08-11 16:26 西北逍遥 阅读(5) 评论(0) 推荐(0) 编辑
摘要: python 读取文本文件 # 打开文件 with open('myfile.txt', 'r') as file: # 读取文件内容 content = file.read() # 打印文件内容 print(content) ########################## 阅读全文
posted @ 2024-08-10 19:38 西北逍遥 阅读(1) 评论(0) 推荐(0) 编辑
摘要: string currentDate = DateTime.Now.ToString("yyyyMMdd"); Console.WriteLine("Current Date: " + currentDate); ############################## 阅读全文
posted @ 2024-08-09 14:18 西北逍遥 阅读(6) 评论(0) 推荐(0) 编辑
摘要: SELECT w.company, COUNT(DISTINCT d.RFID_ID) AS total_unique_checkins -- 对每个公司,计算不同RFID_ID的打卡次数 FROM t_worker w JOIN t_rfid r ON w.signNum = r.num1 JOI 阅读全文
posted @ 2024-08-08 20:49 西北逍遥 阅读(1) 评论(0) 推荐(0) 编辑
摘要: python 逐行读取文本文件 # 打开文件 with open('myfile.txt', 'r') as file: # 逐行读取文件内容 for line in file: print(line, end='') # 注意,print 函数默认会在每行末尾添加换行符,所以这里使用 end='' 阅读全文
posted @ 2024-08-07 20:22 西北逍遥 阅读(3) 评论(0) 推荐(0) 编辑
摘要: python 写入文本文件 # 打开文件,如果文件不存在则创建它 with open('myfile.txt', 'w') as file: # 写入内容 file.write('kkkkkkkkkkkkkkkkkkk!\n') ################################### 阅读全文
posted @ 2024-08-06 18:48 西北逍遥 阅读(5) 评论(0) 推荐(0) 编辑
摘要: public class CharCountExample { public static void main(String[] args) { String text = "Hello, world! How are you?"; char targetChar = 'o'; int count 阅读全文
posted @ 2024-08-05 19:05 西北逍遥 阅读(5) 评论(0) 推荐(0) 编辑
摘要: #include <QDate> #include <QString> #include <QDebug> int main() { // 创建一个QDate对象 QDate date(2023, 4, 5); // 假设日期是2023年4月5日 // 使用toString()方法将日期格式化为yy 阅读全文
posted @ 2024-08-04 13:49 西北逍遥 阅读(3) 评论(0) 推荐(0) 编辑
摘要: python 追加到文本文件 # 打开文件以追加内容 with open('myfile.txt', 'a') as file: # 追加内容 file.write('kkkkkkkkkkkkkkkkkkkkk.\n') ################################# 阅读全文
posted @ 2024-08-03 19:35 西北逍遥 阅读(5) 评论(0) 推荐(0) 编辑
摘要: using System.IO; using UnityEngine; using UnityEngine.UI; public class SaveRawImageAsPNG : MonoBehaviour { public RawImage rawImage; public void SaveI 阅读全文
posted @ 2024-08-01 15:25 西北逍遥 阅读(7) 评论(0) 推荐(0) 编辑
摘要: using System; namespace DateTimeExample { class Program { static void Main(string[] args) { // 获取当前时间 DateTime now = DateTime.Now; // 格式化日期为 yyyyMMdd 阅读全文
posted @ 2024-07-31 19:26 西北逍遥 阅读(18) 评论(0) 推荐(0) 编辑
摘要: python 修改文本文件 # 读取文件内容 with open('myfile.txt', 'r') as file: content = file.read() # 修改内容(这里只是一个简单的替换示例) modified_content = content.replace('old_text' 阅读全文
posted @ 2024-07-30 18:53 西北逍遥 阅读(4) 评论(0) 推荐(0) 编辑
摘要: python 读取CSV文件 import csv # 打开CSV文件 with open('example.csv', 'r', newline='') as file: reader = csv.reader(file) # 遍历CSV文件的每一行 for row in reader: prin 阅读全文
posted @ 2024-07-29 16:52 西北逍遥 阅读(1) 评论(0) 推荐(0) 编辑
摘要: python 写入CSV文件 import csv # 定义要写入CSV文件的数据 data = [ ['Name', 'Age', 'City'], ['Alice', '25', 'New York'], ['Bob', '30', 'San Francisco'], # ... ] # 打开C 阅读全文
posted @ 2024-07-28 15:56 西北逍遥 阅读(4) 评论(0) 推荐(0) 编辑
摘要: python 读取CSV文件 import csv # 打开CSV文件 with open('example.csv', 'r', newline='') as file: reader = csv.DictReader(file) # 遍历CSV文件的每一行(作为字典) for row in re 阅读全文
posted @ 2024-07-27 23:19 西北逍遥 阅读(2) 评论(0) 推荐(0) 编辑
摘要: python 使用字典写入CSV文件 import csv # 定义要写入CSV文件的数据(作为字典列表) data = [ {'Name': 'Alice', 'Age': '25', 'City': 'New York'}, {'Name': 'Bob', 'Age': '30', 'City' 阅读全文
posted @ 2024-07-26 23:04 西北逍遥 阅读(6) 评论(0) 推荐(0) 编辑
摘要: python两个三阶矩阵相乘 import numpy as np matrix1 = np.array([[1, 2, 3], [4, 5, 6], [7, 8, 9]]) matrix2 = np.array([[9, 8, 7], [6, 5, 4], [3, 2, 1]]) result = 阅读全文
posted @ 2024-07-25 23:31 西北逍遥 阅读(1) 评论(0) 推荐(0) 编辑
摘要: C++ opencv putText #include <opencv2/opencv.hpp> int main() { // 创建一个空白图像 cv::Mat img(400, 400, CV_8UC3, cv::Scalar(255, 255, 255)); // 设置文本内容 std::st 阅读全文
posted @ 2024-07-24 16:28 西北逍遥 阅读(21) 评论(0) 推荐(0) 编辑
摘要: unity3d碰撞 Unity3D提供了多个碰撞事件函数,用于处理不同类型的碰撞情况。常用的碰撞事件函数包括: OnCollisionEnter:当两个物体开始碰撞时触发。这是碰撞的起始点,可以用于执行碰撞开始时的逻辑,如播放碰撞音效、改变游戏状态等。 OnCollisionStay:在两个物体持续 阅读全文
posted @ 2024-07-23 19:38 西北逍遥 阅读(15) 评论(0) 推荐(0) 编辑
摘要: unity3d Dictionary 根据key获取value using System; using System.Collections.Generic; using UnityEngine; public class DictionaryExample : MonoBehaviour { pr 阅读全文
posted @ 2024-07-21 22:26 西北逍遥 阅读(8) 评论(0) 推荐(0) 编辑
摘要: unity3d缩放物体 using UnityEngine; public class ScaleObject : MonoBehaviour { // 缩放速度,可以根据需要调整 public float scaleSpeed = 0.1f; // 控制缩放的方向,这里以X轴为例 public b 阅读全文
posted @ 2024-07-20 23:05 西北逍遥 阅读(7) 评论(0) 推荐(0) 编辑