随笔分类 -  software engineering

1 2 3 4 5 ··· 7 下一页
摘要:在Golang中依赖管理范式推荐分组管理 标准库(SDK) 第三方依赖 项目内部依赖 效果如图: import ( // Go SDK "log" "sync" // Third-party "google.golang.org/grpc" "google.golang.org/grpc/crede 阅读全文
posted @ 2025-09-08 17:56 Ashe|||^_^ 阅读(17) 评论(0) 推荐(0)
摘要:场景:抽象而言,存在一个活动,成功概率是30%,但是承诺参加m次必成功n次(比如5次必成功2次)。 5次必成功2次对于后端而言就是保底概率的实现。也就是说在第4次、第5次仍然失败(前置概率结果)的情况必须统计当前用户之前的成功次数,不足则强制让其本次成功。 那么5就是这个环形缓冲区的size,每次成 阅读全文
posted @ 2025-07-30 19:15 Ashe|||^_^ 阅读(6) 评论(0) 推荐(0)
摘要:前瞻: 初次接触可能会认为(身份认证)接入是比较复杂且困难的过程,其实只是简单调用一下API接口,得到一个URL,访问URL,设备会要求获取摄像头权限,允许后做一下眨眼张嘴等动作完成动作采集即可。 然后再调用另一个API接口查询人脸识别认证的结果。 注:官网人工客服不是后端技术,因此沟通时会造成一定 阅读全文
posted @ 2025-07-23 16:59 Ashe|||^_^ 阅读(218) 评论(0) 推荐(0)
摘要:// 安装Gen Tool go install gorm.io/gen/tools/gentool@latest // (在项目根目录下执行)根据数据库表生成对应仓储层代码 gentool -db mysql -dsn "username:passwd@tcp(db_ip:3306)/databa 阅读全文
posted @ 2025-05-10 22:57 Ashe|||^_^ 阅读(482) 评论(0) 推荐(0)
摘要:场景: Hugo + PaperMod 搭建的github静态博客网页,需要更换字体 目标字体: https://font.subf.dev/ 英文确实好看,但是其汉字与英文字体风格迥异,搭在一起过于突兀 下载了MapleMono-Light.woff2文件(chatgpt更推荐该字体扩展格式.wo 阅读全文
posted @ 2025-05-03 15:54 Ashe|||^_^ 阅读(112) 评论(0) 推荐(0)
摘要:func main() { ctx, cancel := context.WithCancel(context.Background()) defer cancel() r := NewTriggerableTaskRunner(10*time.Second, func(ctx context.Co 阅读全文
posted @ 2025-04-29 23:12 Ashe|||^_^ 阅读(0) 评论(0) 推荐(0)
摘要:场景: Failed to find a valid digest in the 'integrity' attribute for resource '<xxx>.css' with computed SHA-256 integrity '9J1myq6eoP1D8h8p5xqNPihFF+13D 阅读全文
posted @ 2025-04-28 10:55 Ashe|||^_^ 阅读(149) 评论(0) 推荐(0)
摘要:const ( MsgSuccess = "success" MsgFailed = "failed" Null = "" ) type Response struct { Code int `json:"code"` Msg string `json:"msg"` Data any `json:" 阅读全文
posted @ 2025-04-11 00:05 Ashe|||^_^ 阅读(38) 评论(0) 推荐(0)
摘要:安装 sudo apt install nginx 修改默认配置文件 sudo vim /etc/nginx/nginx.conf 图中所圈用户默认为www-data,即nginx工作用户 当使用Nginx代理访问前端静态资源时,则会报错,根据报错日志可以看到类似 (13: Permission d 阅读全文
posted @ 2025-04-09 13:22 Ashe|||^_^ 阅读(27) 评论(0) 推荐(0)
摘要:vue_alpha/ ├── node_modules/ # 存放依赖的文件夹 ├── public/ # 存放静态文件,如 index.html ├── src/ # 存放源代码 │ ├── assets/ # 存放图片、样式等静态资源 │ ├── components/ # 存放 Vue 组件 阅读全文
posted @ 2025-04-09 11:37 Ashe|||^_^ 阅读(46) 评论(0) 推荐(0)
摘要:Vue.js 是一个流行的前端JavaScript框架,用于构建用户界面和单页应用程序。以下是在您的计算机上搭建Vue开发环境的步骤: 1. 环境准备 在开始之前,请确保您的开发环境已经安装了以下工具: Node.js (推荐使用LTS版本) npm 包管理器(通常随Node.js一起安装) 可以通 阅读全文
posted @ 2025-04-09 11:13 Ashe|||^_^ 阅读(149) 评论(0) 推荐(0)
摘要:Echo framework写法示例 // 创建 Echo 实例 e := echo.New() // Custom error handler e.HTTPErrorHandler = func(err error, c echo.Context) { // Log the error log.L 阅读全文
posted @ 2025-04-03 21:34 Ashe|||^_^ 阅读(72) 评论(0) 推荐(0)
摘要:在 Go 语言中,协程(goroutine) 是一种轻量级的线程,由 Go 运行时(Go runtime)进行管理。 Goroutine 的特点 轻量级:与传统的操作系统线程相比,goroutine 的创建和销毁成本非常低。这得益于 Go 运行时对线程池和调度器的优化。 并发执行:多个 gorout 阅读全文
posted @ 2025-03-27 00:21 Ashe|||^_^ 阅读(52) 评论(0) 推荐(0)
摘要:在 Go 语言中,具有接收者的函数被称为“方法”(method)。方法与普通的函数不同,它附加在特定的类型上,并且可以通过该类型的实例(或指向该类型的指针)来调用。 方法的定义包括接收者类型和名称,以及方法的名称和参数列表。以下是方法定义的一般形式: func (recv *ReceiverType 阅读全文
posted @ 2025-03-26 18:00 Ashe|||^_^ 阅读(31) 评论(0) 推荐(0)
摘要:go mod init gin_beta 初始化go mod,Goland在创建project时会默认已完成 go get -u github.com/gin-gonic/gin go get -u github.com/labstack/echo/v4 引入gin依赖 go mod tidy 移除 阅读全文
posted @ 2025-03-22 20:42 Ashe|||^_^ 阅读(45) 评论(0) 推荐(0)
摘要:打开命令提示符(cmd)或 PowerShell。 $env:GOOS = "linux" $env:GOARCH = "amd64" cd C:\workspace\golang\gin_alpha\cmd\ dir go build -o myapp-linux 然后将生成的Linux可执行文件 阅读全文
posted @ 2025-03-20 23:18 Ashe|||^_^ 阅读(1151) 评论(0) 推荐(0)
摘要:/your_project │── /api │ ├── api.go # API 路由管理 │── /cmd │ └── main.go # 入口 │── /configs │ ├── config.go # 读取配置 │ ├── config.yaml # 配置文件 │ ├── config_t 阅读全文
posted @ 2025-03-15 18:30 Ashe|||^_^ 阅读(93) 评论(0) 推荐(0)
摘要:EXPLAIN in MySQL is a powerful tool used to analyze and understand how MySQL executes a particular query. Here’s what EXPLAIN can do: Display the quer 阅读全文
posted @ 2025-03-14 18:55 Ashe|||^_^ 阅读(32) 评论(0) 推荐(0)
摘要:Before we embark on our journey through the world of pointers in Go, we must fist grasp the significance of the & operator. func main() { var i int = 阅读全文
posted @ 2025-02-28 17:12 Ashe|||^_^ 阅读(21) 评论(0) 推荐(0)
摘要:Known for its speed and small memory footprint, Gin is one of the most popular and widely used Go web frameworks. It provides features like routing, m 阅读全文
posted @ 2025-02-27 22:07 Ashe|||^_^ 阅读(35) 评论(0) 推荐(0)

1 2 3 4 5 ··· 7 下一页