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

迁移临时数据脚本

打开PowerShell 输入命令powershell -ExecutionPolicy Bypass -File xxx.ps1这句 PowerShell 命令的作用是临时允许执行脚本文件并且运行指定的 .ps1 脚本。1. 每个部分是什么意思powershell启动 PowerShell 环境-ExecutionPolicy Bypass临时关闭执行策略限制Windows 默认禁止直接运行陌生 .ps1 脚本加这句就是“这次先不管安全限制允许运行脚本”-File 文件名.ps1指定要运行的PowerShell 脚本文件2. 常见正常用途# 基础使用默认路径自动备份检查进程 .\migrate_temp_data.ps1 # 指定根路径 .\migrate_temp_data.ps1 -RootPath D:\your-app-root # 跳过备份 跳过进程检查 .\migrate_temp_data.ps1 -SkipBackup -SkipProcessCheckpowershell启动 PowerShell 环境-ExecutionPolicy Bypass临时关闭执行策略限制Windows 默认禁止直接运行陌生 .ps1 脚本加这句就是“这次先不管安全限制允许运行脚本”-File 文件名.ps1指定要运行的PowerShell 脚本文件以绕过系统安全策略的方式直接运行 xxx.ps1 这个 PowerShell 脚本。.安全提醒非常重要这是高权限操作可以绕过系统对脚本的安全拦截如果你不知道这个脚本是干嘛的不要随便运行很多病毒、木马、流氓软件也会用这种方式偷偷执行恶意脚本运行自己写的批量自动化脚本安装 / 配置软件、部署环境系统维护、批量修改设置迁移临时数据脚本[CmdletBinding()] param( [Parameter(Mandatory $false)] [string]$RootPath $PSScriptRoot, [switch]$SkipBackup, [switch]$SkipProcessCheck ) Set-StrictMode -Version Latest $ErrorActionPreference Stop if ([string]::IsNullOrWhiteSpace($RootPath)) { $RootPath (Get-Location).Path } function Write-Log { param( [Parameter(Mandatory $true)][string]$Message, [ValidateSet(INFO, WARN, ERROR)] [string]$Level INFO ) $line [{0}] {1,-5} {2} -f (Get-Date -Format yyyy-MM-dd HH:mm:ss), $Level, $Message Write-Host $line } function Resolve-FullPath { param( [Parameter(Mandatory $true)][string]$PathValue, [switch]$AllowMissing ) $resolved Resolve-Path -LiteralPath $PathValue -ErrorAction SilentlyContinue if ($resolved) { return $resolved.Path } if ($AllowMissing) { return [System.IO.Path]::GetFullPath($PathValue) } throw Path not found: $PathValue } function Get-PythonCommand { $candidates ( { Exe py; Args (-3) }, { Exe python; Args () }, { Exe python3; Args () } ) foreach ($candidate in $candidates) { $cmd Get-Command $candidate.Exe -ErrorAction SilentlyContinue if (-not $cmd) { continue } try { $candidate.Exe ($candidate.Args (--version)) * $null if ($LASTEXITCODE -eq 0) { return $candidate } } catch { continue } } return $null } function Test-FileLocked { param([Parameter(Mandatory $true)][string]$PathValue) if (-not (Test-Path -LiteralPath $PathValue)) { return $false } try { $stream [System.IO.File]::Open( $PathValue, [System.IO.FileMode]::Open, [System.IO.FileAccess]::ReadWrite, [System.IO.FileShare]::None ) $stream.Close() return $false } catch { return $true } } function Invoke-RobocopyMerge { param( [Parameter(Mandatory $true)][string]$Source, [Parameter(Mandatory $true)][string]$Destination ) New-Item -ItemType Directory -Path $Destination -Force | Out-Null # /E copy all subdirs including empty; merge into destination without deleting extras. robocopy $Source $Destination /E /COPY:DAT /R:2 /W:1 /NFL /NDL /NJH /NJS /NP | Out-Null $code $LASTEXITCODE if ($code -gt 7) { throw robocopy failed with exit code $code while copying $Source - $Destination } } function Apply-BackendImageHotfix { param([Parameter(Mandatory $true)][string]$RootPathValue) $routeFile Join-Path $RootPathValue resources\backend\src\automation\yingdao_routes_ops_task.py if (-not (Test-Path -LiteralPath $routeFile)) { Write-Log Backend route file not found, skip image hotfix: $routeFile WARN return } $content Get-Content -LiteralPath $routeFile -Raw -Encoding UTF8 $updated $content $mimeFallbackPattern if not mimetype:r?n\s*mimetype application/octet-stream $mimeFallbackReplacement if not mimetype: suffix file_path.suffix.lower() if suffix .webp: mimetype image/webp elif suffix in {.jpg, .jpeg}: mimetype image/jpeg elif suffix .png: mimetype image/png elif suffix .gif: mimetype image/gif else: mimetype application/octet-stream $updated [System.Text.RegularExpressions.Regex]::Replace( $updated, $mimeFallbackPattern, $mimeFallbackReplacement ) $updated [System.Text.RegularExpressions.Regex]::Replace( $updated, response\.headers\[Connection\]\s*\s*keep-alive, response.headers.pop(Connection, None) ) if ($updated -ne $content) { Set-Content -LiteralPath $routeFile -Value $updated -Encoding UTF8 Write-Log Applied backend image hotfix: $routeFile } else { Write-Log Backend image hotfix already present: $routeFile } } $root Resolve-FullPath -PathValue $RootPath $sourceData Join-Path $root temp\data $sourceConfig Join-Path $root temp\config $sourceImages Join-Path $root temp\images $targetData Join-Path $root data $targetConfig Join-Path $root config $targetImages Join-Path $root images $targetDb Join-Path $targetData database\app.db Write-Log Root path: $root Write-Log Source data: $sourceData Write-Log Source config: $sourceConfig Write-Log Source images: $sourceImages if (-not (Test-Path -LiteralPath $sourceData)) { throw Missing source directory: $sourceData } if (-not (Test-Path -LiteralPath $sourceConfig)) { throw Missing source directory: $sourceConfig } if (-not $SkipProcessCheck) { $running Get-Process -ErrorAction SilentlyContinue | Where-Object { $_.ProcessName -eq 1688-OZON Automation } if ($running) { throw Detected running process 1688-OZON Automation. Please close app before migration. } } if (Test-FileLocked -PathValue $targetDb) { throw Target database is locked: $targetDb } if (-not $SkipBackup) { $stamp Get-Date -Format yyyyMMdd_HHmmss $backupRoot Join-Path $root (migration_backup_$stamp) New-Item -ItemType Directory -Path $backupRoot -Force | Out-Null if (Test-Path -LiteralPath $targetConfig) { Copy-Item -LiteralPath $targetConfig -Destination (Join-Path $backupRoot config) -Recurse -Force } if (Test-Path -LiteralPath $targetData) { Copy-Item -LiteralPath $targetData -Destination (Join-Path $backupRoot data) -Recurse -Force } Write-Log Backup created: $backupRoot } else { Write-Log Skip backup requested WARN } Write-Log Copying config files from temp/config - config ... Invoke-RobocopyMerge -Source $sourceConfig -Destination $targetConfig Write-Log Copying data files from temp/data - data ... Invoke-RobocopyMerge -Source $sourceData -Destination $targetData if (Test-Path -LiteralPath $sourceImages) { Write-Log Copying image files from temp/images - images ... Invoke-RobocopyMerge -Source $sourceImages -Destination $targetImages } else { Write-Log temp/images not found, skip image copy. Existing images directory will be kept. WARN } if (-not (Test-Path -LiteralPath $targetDb)) { throw Database not found after copy: $targetDb } # Avoid stale SQLite sidecar files from previous runs. foreach ($sidecar in ($targetDb-wal, $targetDb-shm)) { if (Test-Path -LiteralPath $sidecar) { Remove-Item -LiteralPath $sidecar -Force -ErrorAction SilentlyContinue Write-Log Removed SQLite sidecar: $sidecar } } $python Get-PythonCommand if (-not $python) { throw Python runtime not found. Install Python 3 or ensure py/python is in PATH. } $pythonScript import json import shutil import sqlite3 import sys from datetime import datetime from pathlib import Path db_path Path(sys.argv[1]) images_root Path(sys.argv[2]) if len(sys.argv) 2 else None if not db_path.exists(): raise SystemExit(fDatabase not found: {db_path}) obsolete_tables [ collection_tasks, upload_tasks, system_logs, customer_service_tasks, category_update_tasks, ] def table_exists(cursor, table_name): cursor.execute( SELECT 1 FROM sqlite_master WHERE typetable AND name? LIMIT 1, (table_name,), ) return cursor.fetchone() is not None def columns(cursor, table_name): cursor.execute(fPRAGMA table_info({table_name})) return [row[1] for row in cursor.fetchall()] def read_integrity(connection): _cur connection.cursor() _cur.execute(PRAGMA integrity_check) return _cur.fetchone()[0] def sql_quote_path(path_obj: Path) - str: return str(path_obj).replace(, ) def parse_json_list(value): if value is None: return [] if isinstance(value, str): text value.strip() if not text: return [] try: decoded json.loads(text) except Exception: return [text] else: decoded value if isinstance(decoded, list): return decoded if isinstance(decoded, str): return [decoded] return [] def normalize_image_ref(value): raw str(value or ).strip() if not raw: return None if raw.startswith((http://, https://)): return raw normalized raw.replace(\\, /) normalized normalized.split(?, 1)[0].split(#, 1)[0] lower_text normalized.lower() marker /images/ marker_index lower_text.find(marker) if marker_index 0: relative normalized[marker_index len(marker):] elif lower_text.startswith(images/): relative normalized[len(images/):] else: path_obj Path(normalized) if path_obj.is_absolute(): parts [part for part in path_obj.parts if part not in (path_obj.anchor, \\, /)] lower_parts [part.lower() for part in parts] if images in lower_parts: idx lower_parts.index(images) relative /.join(parts[idx 1 :]) else: relative /.join(parts) else: relative normalized relative relative.lstrip(/).replace(\\, /) if not relative: return None return f/images/{relative} def normalize_image_list(values): result [] for item in values: normalized normalize_image_ref(item) if not normalized: continue if normalized not in result: result.append(normalized) return result def image_exists(image_url): if not isinstance(image_url, str) or not image_url.startswith(/images/): return True if images_root is None: return True relative image_url[len(/images/):] return (images_root / relative).exists() def repair_database_in_place(path_obj: Path) - str: stamp datetime.now().strftime(%Y%m%d_%H%M%S) backup_path path_obj.with_name(f{path_obj.name}.before_auto_repair_{stamp}) repaired_path path_obj.with_name(f{path_obj.stem}.auto_repaired_{stamp}{path_obj.suffix}) shutil.copy2(path_obj, backup_path) source_conn sqlite3.connect(str(path_obj)) source_conn.execute(fVACUUM INTO {sql_quote_path(repaired_path)}) source_conn.close() verify_conn sqlite3.connect(str(repaired_path)) repaired_integrity read_integrity(verify_conn) verify_conn.close() if repaired_integrity ! ok: repaired_path.unlink(missing_okTrue) raise RuntimeError(fauto repair failed, rebuilt db integrity is: {repaired_integrity}) path_obj.unlink(missing_okTrue) repaired_path.replace(path_obj) return str(backup_path) conn sqlite3.connect(str(db_path)) conn.execute(PRAGMA busy_timeout 5000) cur conn.cursor() added [] skipped [] dropped [] not_found [] normalized_image_rows 0 normalized_image_fields {images: 0, images_ru: 0} image_refs_total 0 image_refs_missing 0 image_refs_missing_samples [] auto_repair_performed False repair_backup integrity_before read_integrity(conn) if integrity_before ! ok: conn.close() repair_backup repair_database_in_place(db_path) auto_repair_performed True conn sqlite3.connect(str(db_path)) conn.execute(PRAGMA busy_timeout 5000) cur conn.cursor() integrity_after_repair read_integrity(conn) if integrity_after_repair ! ok: raise RuntimeError(fdb integrity remains invalid after repair attempt: {integrity_after_repair}) if table_exists(cur, task_progress): existing set(columns(cur, task_progress)) if is_file not in existing: cur.execute(ALTER TABLE task_progress ADD COLUMN is_file BOOLEAN DEFAULT 0) added.append(task_progress.is_file) else: skipped.append(task_progress.is_file) else: raise RuntimeError(Missing required table: task_progress) for name in obsolete_tables: if table_exists(cur, name): cur.execute(fDROP TABLE {name}) dropped.append(name) else: not_found.append(name) if table_exists(cur, products): cur.execute(SELECT id, images, images_ru FROM products) for product_id, images_raw, images_ru_raw in cur.fetchall(): row_changed False for field_name, field_value in ((images, images_raw), (images_ru, images_ru_raw)): old_values parse_json_list(field_value) new_values normalize_image_list(old_values) if new_values ! old_values: cur.execute( fUPDATE products SET {field_name} ? WHERE id ?, (json.dumps(new_values, ensure_asciiFalse), product_id), ) normalized_image_fields[field_name] 1 row_changed True for image_url in new_values: if not isinstance(image_url, str) or not image_url.startswith(/images/): continue image_refs_total 1 if not image_exists(image_url): image_refs_missing 1 if len(image_refs_missing_samples) 20: image_refs_missing_samples.append({ product_id: product_id, field: field_name, image: image_url, }) if row_changed: normalized_image_rows 1 conn.commit() integrity_final read_integrity(conn) result { db_path: str(db_path), added: added, skipped: skipped, dropped: dropped, not_found: not_found, auto_repair_performed: auto_repair_performed, repair_backup: repair_backup, integrity_before: integrity_before, integrity_after_repair: integrity_after_repair, integrity_final: integrity_final, task_progress_columns: columns(cur, task_progress), normalized_image_rows: normalized_image_rows, normalized_image_fields: normalized_image_fields, image_refs_total: image_refs_total, image_refs_missing: image_refs_missing, image_refs_missing_samples: image_refs_missing_samples, } conn.close() print(json.dumps(result, ensure_asciiFalse)) $tempPy Join-Path $env:TEMP (ozon_migrate_ [Guid]::NewGuid().ToString(N) .py) Set-Content -LiteralPath $tempPy -Value $pythonScript -Encoding UTF8 try { $raw $python.Exe ($python.Args ($tempPy, $targetDb, $targetImages)) 21 if ($LASTEXITCODE -ne 0) { throw (Database migration failed:n ($raw | Out-String)) } } finally { Remove-Item -LiteralPath $tempPy -Force -ErrorAction SilentlyContinue } $result (($raw | Out-String).Trim()) | ConvertFrom-Json if ($result.integrity_final -ne ok) { throw SQLite integrity_check failed: $($result.integrity_final) } Write-Log Database migrated: $($result.db_path) Write-Log Added fields: $(($result.added) -join , ) Write-Log Dropped obsolete tables: $(($result.dropped) -join , ) Write-Log Integrity: before$($result.integrity_before), after_repair$($result.integrity_after_repair), final$($result.integrity_final) if ($result.auto_repair_performed) { Write-Log Auto-repaired SQLite before migration. Backup: $($result.repair_backup) WARN } Write-Log task_progress columns: $(($result.task_progress_columns) -join , ) Write-Log Normalized product image paths: rows$($result.normalized_image_rows), images$($result.normalized_image_fields.images), images_ru$($result.normalized_image_fields.images_ru) Write-Log Image reference check: total$($result.image_refs_total), missing$($result.image_refs_missing) if ($result.image_refs_missing -gt 0) { Write-Log (Missing image samples: ((($result.image_refs_missing_samples) | ConvertTo-Json -Compress))) WARN } Apply-BackendImageHotfix -RootPathValue $root Write-Log Migration completed successfully. Write-Log Image migration: if temp/images exists it has been merged into images/.运行命令powershell -ExecutionPolicy Bypass -File migrate_temp_data.ps1一、脚本核心功能参数配置可指定根路径默认脚本所在目录支持跳过备份、跳过进程检查严格模式执行错误立即终止ErrorActionPreference Stop基础工具函数Write-Log带时间戳、日志级别的日志输出Resolve-FullPath解析绝对路径支持允许路径不存在的场景Get-PythonCommand自动检测系统中的 Pythonpy/python/python3Test-FileLocked检测文件是否被锁定用于检查数据库是否被占用Invoke-RobocopyMerge调用 robocopy 合并目录保留目标目录原有文件前置检查校验源目录temp/data、temp/config是否存在检查目标数据库data/database/app.db是否被锁定可选检查 “1688-OZON Automation” 进程是否运行避免文件占用数据备份默认对目标 config、data 目录备份命名格式migration_backup_时间戳支持通过-SkipBackup参数跳过备份数据迁移用 robocopy 将 temp/config → config、temp/data → data、temp/images → images目录合并不删除目标原有文件清理 SQLite 临时文件app.db-wal、app.db-shm数据库处理核心 Python 脚本自动修复检测数据库完整性若损坏则自动修复并备份原文件字段调整给 task_progress 表添加 is_file 字段不存在时清理废弃表删除 collection_tasks、upload_tasks 等废弃表图片路径标准化统一 products 表的 images、images_ru 字段路径格式转为/images/相对路径检查图片文件是否存在输出缺失的图片引用完整性校验迁移后再次校验数据库完整性后端代码热修复修正yingdao_routes_ops_task.py中的 MIME 类型处理支持 webp/jpg/png/gif移除 Connection: keep-alive 响应头二、关键使用场景powershell# 基础使用默认路径自动备份检查进程 .\migrate_temp_data.ps1 # 指定根路径 .\migrate_temp_data.ps1 -RootPath D:\your-app-root # 跳过备份 跳过进程检查 .\migrate_temp_data.ps1 -SkipBackup -SkipProcessCheck三、核心注意事项四、常见问题排查如果需要对脚本进行修改比如新增废弃表、调整图片 MIME 类型、修改备份规则等可以针对性调整对应函数或 Python 脚本片段。依赖 Python脚本依赖 Python 3 环境需确保 py/python/python3 在系统 PATH 中文件锁定目标数据库被占用时会终止执行需关闭相关进程日志输出所有操作有详细日志可通过控制台查看执行状态图片迁移仅当 temp/images 存在时才会合并目标 images 目录原有文件会保留数据库修复若数据库损坏会自动修复并备份原文件修复失败会抛出异常Python 未找到安装 Python 并添加到 PATH或手动指定 Python 路径数据库锁定关闭 “1688-OZON Automation” 进程或用-SkipProcessCheck跳过检查不推荐robocopy 报错检查源 / 目标目录权限确保 robocopy 可执行Windows 自带图片缺失警告日志中显示的缺失图片需手动核对文件是否存在于 images 目录

相关文章:

迁移临时数据脚本

打开PowerShell 输入命令powershell -ExecutionPolicy Bypass -File xxx.ps1这句 PowerShell 命令的作用是:临时允许执行脚本文件,并且运行指定的 .ps1 脚本。1. 每个部分是什么意思powershell启动 PowerShell 环境-ExecutionPolicy Bypass临时关闭执行策…...

HCIE为什么总是招人骂?现在还有价值吗?

说起HCIE,搞网络工程的人都清楚,它以前那可是被当成网络工程师的“终极证书”,意味着网络技术的最高水准。 不过呢,随着考这个证的人越来越多,市场环境也变了,HCIE在国内的含金量是不是还跟以前一样高呢&am…...

程序员必备:如何用Raycast和Alfred打造高效macOS开发环境(2023最新配置)

程序员必备:如何用Raycast和Alfred打造高效macOS开发环境(2023最新配置) 在快节奏的开发工作中,效率工具的选择往往能决定一天的产出量。作为长期使用macOS的开发者,我尝试过几乎所有主流效率工具,最终形成…...

告别手动折腾!用优利德CTS-ENET100软件+MSO8000HD示波器,自动化搞定100BASE-Tx以太网一致性测试

以太网一致性测试自动化革命:优利德CTS-ENET100与MSO8000HD的高效实践 当硬件测试工程师面对堆积如山的待测设备时,最痛苦的莫过于重复执行数十项标准化测试。我曾见过同事为了完成100BASE-Tx认证,连续三天守在示波器前手动调整参数&#xff…...

如何3分钟完成QQ音乐加密文件解密:专业音频格式转换方案

如何3分钟完成QQ音乐加密文件解密:专业音频格式转换方案 【免费下载链接】qmc-decoder Fastest & best convert qmc 2 mp3 | flac tools 项目地址: https://gitcode.com/gh_mirrors/qm/qmc-decoder 还在为QQ音乐下载的加密音频文件无法在其他播放器播放而…...

做工商业储能项目,储能逆变器光储一体机怎么选才不踩坑?

最近和不少做新能源贸易的朋友聊天,大家都在吐槽今年工商储项目好接,但光储一体机的选品太容易出问题:要么是拿到的产品转换效率虚标,实际运行发电量比宣传低 10%,客户拒付尾款;要么是产品没有对应地区的并…...

Phi-4-mini-reasoning助力Java面试:算法与系统设计题智能解析

Phi-4-mini-reasoning助力Java面试:算法与系统设计题智能解析 1. 模型能力概览 Phi-4-mini-reasoning作为一款专注于代码生成与逻辑推理的AI模型,在Java技术面试准备中展现出独特价值。不同于通用编程助手,它能同时处理算法实现、系统设计思…...

社会韧性正在被AIAgent悄悄稀释?SITS2026压力测试揭示4类隐性系统性风险

第一章:SITS2026压力测试框架与AIAgent社会影响评估范式 2026奇点智能技术大会(https://ml-summit.org) SITS2026(Scalable Intelligent Testing Suite 2026)是一套面向大规模多模态AI Agent集群的开源压力测试框架,专为验证系统…...

答辩PPT救星!百考通AI助你30分钟高效搞定,告别熬夜

还在对着上万字的论文发愁,不知从何下手?试试这个专为学术答辩设计的智能工具。 临近毕业季,各大高校的本科生们正处在毕业论文答辩的最后冲刺阶段。每当此时,除了论文本身的修改完善,最令学生们头疼的莫过于答辩PPT的…...

电竞椅哪个牌子质量好?傲风M6Pro,告诉你什么是“开挂式”舒适

对于热爱电竞的玩家来说,电竞椅早已不只是“坐着玩游戏”的工具,而是影响状态、决定胜负的关键装备。市面上的电竞椅品牌琳琅满目,电竞椅哪个牌子质量好?我们从市场地位、腰背支撑、材质工艺、调节灵活性等维度,深度解…...

本科生论文写作新选择:百考通AI实战指南,告别熬夜与低效

如果你是一名正在为毕业论文发愁的本科生,这篇文章可能会帮到你。在CSDN这个以技术分享与实用干货为主的社区,我们不谈夸张的“黑科技”,只聊实实在在能提升效率的工具与方法。今天要介绍的,是一款名为百考通AI的辅助写作工具&…...

【SCI复现】基于纳什博弈和ADMM的多微网主体能源共享研究附Matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,擅长数据处理、建模仿真、程序设计、完整代码获取、论文复现及科研仿真。🍎 往期回顾关注个人主页:Matlab科研工作室🍊个人信条:格物致知,完整Matlab代码及仿真咨询…...

周期性计划,硬盘分区管理,文件系统基本管理

13、周期性计划作业: 计算机也要定时要完成自己的事情: 每天巡检系统资源使用情况。 每小时检查一次异常日志 每天夜里 0:00 备份数据 crond 服务,提供定制任务功能,定期触发执行相应命令。 13.1实践 实现每分钟同步一次上一…...

终极指南:3步快速解锁Intel/AMD电脑隐藏性能的免费开源工具

终极指南:3步快速解锁Intel/AMD电脑隐藏性能的免费开源工具 【免费下载链接】Universal-x86-Tuning-Utility Unlock the full potential of your Intel/AMD based device. 项目地址: https://gitcode.com/gh_mirrors/un/Universal-x86-Tuning-Utility Univer…...

青椒hub:如何精准识别同名学者并评估科研实力

1. 为什么同名学者识别是个技术难题 第一次用青椒hub查导师资料时,我也被同名问题困扰过。输入"张伟"这个名字,系统返回了37位同名学者,从材料学教授到医学院研究员应有尽有。这种情况在科研领域特别常见,主要原因有三个…...

WEB前端开发、html5、css3、JavaScript、数据库操作、PDO、Laravel等相关方面的朋友们

WEB前端开发、html5、css3、JavaScript、数据库操作、PDO、Laravel等相关方面的朋友们!! 学历要求: 1、国内985/211高校大三以上,研究生、硕士等; 2.英语满足其中条件之一:非英语专业六级500以上、英语专业专八良好以上…...

Scrcpy不止于投屏:解锁电脑键鼠反向控制Android、多开、录屏等隐藏玩法

Scrcpy不止于投屏:解锁电脑键鼠反向控制Android、多开、录屏等隐藏玩法 在移动办公和跨设备协作成为主流的今天,如何高效地在电脑上操作手机内容成为许多专业人士的痛点。Scrcpy作为一款开源工具,早已超越了基础投屏的范畴,正在重…...

上传视频时截取正脸照片

借助ai模型vladmandic/face-api实现截取视频中的正脸照片 npm i vladmandic/face-api 加载模型 //可以加载CDN资源 const MODEL_URL ‘https://cdn.jsdelivr.net/npm/vladmandic/face-api/model/’ //也可以将face-api的模型直接拷贝下来放在public下 const MODEL_URL ‘/mod…...

RTOS核心原理解析

目录 一、 RTOS核心原理架构 二、 核心原理详解 1. 任务管理与调度:从“顺序执行”到“并发执行” 2. 中断处理:快速响应与任务解耦 3. 任务间通信与同步:协调多任务有序工作 4. 时间管理与低功耗 三、 RTOS带来的优势与挑战 参考来源…...

Vue3 动态路由组件加载:后台字符串到前端懒加载组件的完美转换

前言 在后台管理系统中,菜单和路由信息通常存储在数据库里。当后台返回类似 views/menu/index.vue 这样的组件路径字符串时,前端如何将它转换为 Vue Router 可识别的动态加载组件?本文将通过实际项目代码,带你深入理解这一转换过程…...

5分钟告别英文界面困扰:FigmaCN为中文设计师打造的智能汉化解决方案

5分钟告别英文界面困扰:FigmaCN为中文设计师打造的智能汉化解决方案 【免费下载链接】figmaCN 中文 Figma 插件,设计师人工翻译校验 项目地址: https://gitcode.com/gh_mirrors/fi/figmaCN 你是否曾因Figma的英文界面而分心,无法专注于…...

春招求职如何用AI工具做简历?5款主流AI简历工具推荐与使用思路

每到求职和春招节点,简历都会变成很多应届生最先焦虑的一关。不会写、不会改、不知道项目经历怎么量化、不清楚岗位关键词怎么放进简历里,几乎是每一届毕业生都会遇到的问题。也正因为如此,越来越多人开始搜索各种 AI工具,希望更高…...

L1-039_古风排版博客(20 分)[java][python]

题目来源:PTA 团体程序设计天梯赛 题目编号:L1-039 作者:陈越 出题单位:浙江大学 分值:20 分📋 题目描述 中国的古人写文字,是从右向左竖向排版的。本题就请你编写程序,把一段文字按…...

别再死记公式了!用Matlab手把手带你算离散信道容量(附完整代码与习题验证)

别再死记公式了!用Matlab手把手带你算离散信道容量(附完整代码与习题验证) 信息论课程中,信道容量这个概念总是让学生们又爱又恨——它既揭示了通信系统的极限性能,又伴随着复杂的数学推导。很多同学在作业和实验中&am…...

解决Ubuntu远程桌面黑屏问题:xrdp配置避坑指南(2023最新版)

Ubuntu远程桌面黑屏全攻略:从xrdp故障排查到高效替代方案 当你正急着通过远程桌面处理Ubuntu服务器上的任务,屏幕突然一片漆黑——这种经历足以让任何系统管理员血压飙升。xrdp作为Linux平台上最常用的RDP协议实现工具,确实为Ubuntu用户提供…...

技术利益相关者的业务代表角色

技术利益相关者的业务代表角色:连接技术与业务的桥梁 在数字化转型浪潮中,技术利益相关者的业务代表角色日益关键。他们不仅是技术方案的推动者,更是业务需求与技术落地的翻译者。这一角色需要既懂技术语言,又理解业务逻辑&#…...

基于机器视觉的瓶盖有无拧紧检测解决方案

项目背景在众多产品的包装过程中,瓶盖的拧紧程度至关重要,这一检测环节的存在是基于多方面的行业需求与实际考量。无论是食品、饮料、药品还是化妆品等行业,产品的密封性直接影响其质量和保质期。以食品行业为例,如果瓶盖未拧紧&a…...

LoRA QLoRA

二者区别QLoRA 弊端...

告别混乱!用嘉立创EDA个人/团队库,高效管理你的STM32项目原理图符号

告别混乱!用嘉立创EDA个人/团队库,高效管理你的STM32项目原理图符号 在硬件开发领域,一个精心设计的原理图符号库就像建筑师的标准化图纸——它不仅能显著提升设计效率,还能从根本上避免因符号混乱导致的沟通成本和设计错误。对于…...

Cursor Free VIP终极教程:如何绕过试用限制享受终身Pro功能

Cursor Free VIP终极教程:如何绕过试用限制享受终身Pro功能 【免费下载链接】cursor-free-vip [Support 0.45](Multi Language 多语言)自动注册 Cursor Ai ,自动重置机器ID , 免费升级使用Pro 功能: Youve reached you…...