avatar
Articles
292
Tags
211
Categories
0

karr's blog
Search

karr's blog

iframe内嵌页面,监听iframe内容高度dom跨域问题
Created2024-07-12
運用 postMessage 解決 iframe 與父層溝通的問題 问题描述当在iframe的父级监听iframe中的内容时候,如果内嵌的路由与父级的源不一致,会出现跨域问题。出现如下报错信息: 12345const iframe = document.querySelector("iframe");iframe.onload = () => { const iframeInner = iframe.contentWindow; console.log(iframeInner);}; 12Uncaught DOMException: Failed to read a named property 'document' from 'Window': Blocked a frame with origin "http://localhost:1024" from accessing a cross-origin frame. at eval ( 基於同源政策,如果 ...
python 操作 ftp
Created2024-07-10
ftp_manager.py 123456789101112131415161718192021222324252627282930313233343536373839404142434445from ftplib import FTPclass FtpManager: host = "" username = "" password = "" def __init__(self): """连接到 FTP 服务器""" self.ftp = FTP(self.host) # 替换为你的 FTP 服务器地址 self.ftp.login(user=self.username, passwd=self.password) # 替换为你的用户名和密码 def list_files(self): """列举目录中的所有文件""" ...
manager -- 通用业务处理层
Created2024-07-10
manager – 通用业务处理层,对第三方平台封装、对 Service 层通用能力的下沉以及对多个 DAO 的组合复用
mysql text 类型长度
Created2024-07-10
类型 最大长度 备注 TINYTEXT 256 bytes TEXT 65,535 bytes ~64kb MEDIUMTEXT 16,777,215 bytes ~16MB LONGTEXT 4,294,967,295 bytes ~4GB
nginx rewrite 与 proxy_pass 结合使用
Created2024-07-09
问题描述有这么一个需求,我需要将一个请求重写到另一个地址,然后再将这个地址代理到另一个服务。这个需求在实际开发中是很常见的,比如我们需要将一个旧的接口地址重写到新的接口地址,然后再将新的接口地址代理到后端服务。 如:请求 http://example.com/v1重写到 http://example.com/v2 然后再将 http://example.com/v2 代理到后端服务 http://127.0.0.1:8080/v2 解决方案在 Nginx 中,我们可以使用 rewrite 指令和 proxy_pass 指令来实现这个需求。 12345678server { listen 80; server_name example.com; location /v1/ { rewrite ^/v1/(.*) /v2/$1 break; proxy_pass http://127.0.0.1:8080 } 详细的参数说明: $1:匹配的第一个括号中的内容,即请求的路径。break:表示匹配成功一次后就停 ...
/bin/sh^M: bad interpreter: No such file or directory
Created2024-07-08
This worked for me: Open file /usr/local/bin/brew with vi (vi /usr/local/bin/brew)While on vi issue this commad (via esc or :) :set fileformat=unixClose file on vi via :wq!The brew command should be OK now. Regards.
git提交commit message规范
Created2024-07-07
业界通用的 git 提交规范有哪些? 1.commitizen AngularJS 在 github上 的提交记录被业内许多人认可,逐渐被大家引用。 格式:type(scope) : subject scope选填表示commit的作用范围,如数据层、视图层,也可以是目录名称subject必填用于对commit进行简短的描述type必填表示提交类型,值有以下几种: feat - 新功能 feature fix - 修复 bug docs - 文档注释 style - 代码格式(不影响代码运行的变动) refactor - 重构、优化(既不增加新功能,也不是修复bug) perf - 性能优化 test - 增加测试 chore - 构建过程或辅助工具的变动 revert - 回退 build - 打包
MySQL 8.0 及以上版本默认启用了 ONLY_FULL_GROUP_BY SQL 模式,这要求 SELECT 子句中的所有列要么出现在 GROUP BY 子句中,要么在聚合函数中使用
Created2024-07-03
实际生成中遇到的sql问题,记录一下。包含场景复现sql,隐藏实际数据。 解决方法方法一:修改 GROUP BY 子句 将 sys_user.real_name、swimplat_member_record.cost_count 和 swimplat_member_ticket.type 添加到 GROUP BY中。但是这可能会返回更多的行,具体取决于这些列的值是否唯一。 123456789101112131415SELECT sys_user.real_name AS 姓名, sys_user.phonenumber AS 电话, swimplat_member_record.cost_count AS 消费次数, swimplat_member_ticket.type AS 套票类型FROM swimplat_member_recordLEFT JOIN swimplat_member_card ON swimplat_member_card.id = swimplat_member_record.member_card_idLEFT JO ...
多种编程语言接入ChatGPT详细教程:Python、JavaScript、Java、C#
Created2024-07-01
使用多种编程语言接入 ChatGPT 的详细教程准备工作API 密钥获取要接入 ChatGPT,首先需要一个 OpenAI API 密钥。请按照以下步骤获取你的 API 密钥: 访问 OpenAI 官网. 登录你的账号。如果没有账号,注册一个新账号。 在用户界面中导航到“API 密钥”页面。 创建一个新的 API 密钥并将其保存到安全的地方。 安装和设置为了使用 OpenAI 的 API,你需要安装相应的库和工具。以下是每种语言的具体安装步骤。 Python 接入安装库在使用 Python 调用 OpenAI API 之前,你需要安装 openai 库。你可以使用以下命令通过 pip 安装它: 1pip install openai 示例代码下面是一个简单的 Python 代码示例,展示如何调用 ChatGPT API: 123456789101112import openaiopenai.api_key = "你的API密钥"response = openai.ChatCompletion.create( model="gpt-4", ...
hexo网站提高SEO优化方法
Created2024-07-01
主要步骤 添加站点地图 sitemap.xml文件和搜索机器人文件robots.txt 提交站点到搜索引擎(百度和谷歌) hexo针对搜索的优化 添加站点地图 sitemap.xml1.添加hexo插件 12npm install hexo-generator-sitemap --savenpm install hexo-generator-baidu-sitemap --save 2.修改_config.yml配置 1234sitemap: path: sitemap.xmlbaidusitemap: path: baidusitemap.xml 搜索机器人文件robots.txt在source目录下新建robots.txt文件,文件内容如下: 123456789101112131415User-agent: *Allow: /Allow: /archives/Allow: /categories/Allow: /tags/ Allow: /resources/ Disallow: /vendors/Disallow: /js/Disallow: /css/Disallow ...
1…567…30
avatar
karr
世界那么大,我想去看看。
Articles
292
Tags
211
Categories
0
gitee
Announcement
This is my Blog
Recent Post
python 使用线程池来同时执行多个函数2025-07-23
获取 A 股全部历史数据保存到本地2025-07-22
What are AI Agents?2025-07-21
Hello, 极简AES!2025-07-20
Git报错: Failed to connect to github.com port 443 解决方案2025-03-30
Tags
memory_profiler mysqlclient react-error utils OTP io多路复用 importlib postMessage 字典 救猫咪 数据库 text npm 协程 react-warning git-lfs Artificial Intelligence vue-router Android 前端 变现 Homebrew commit message 重复数据 动态口令 Next-key lock stopPropagation ONLY_FULL_GROUP_BY react-fragment-error-message 代码 口罩检测系统 react-props-warning-message 远程仓库 FastAPI eslint es6 GROUP BY 搜索引擎 md5 react-text-error-message
Archives
  • July 20254
  • March 20256
  • February 20252
  • January 20253
  • November 20242
  • October 20243
  • September 20247
  • August 202410
Info
Article :
292
UV :
PV :
Last Update :
©2024 - 2025 By karr
Framework Hexo|Theme Butterfly
Search
Loading the Database