Article List
Congratulations πππ Ohtani, in his 7th year in the majors and 1st year with the Dodgers, has won his first World Series. Yoshinobu Yamamoto (26) also claimed the crown in his rookie MLB season.
Baseball is truly a fantastic team sport. Although Ohtani had an outstanding regular season, his performance in the World Series was not great (Judge also struggled, but he did hit a home run later). However, he has incredible teammates.
...
1. golangci-lint 1.1 Environment Setup Install golangci-lint
1$ go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest Example batch script for linting all Go modules in a project:
1@if "%DEBUG%"=="" @echo off 2@rem ########################################################################## 3@rem 4@rem Lint all Go modules in backend and frontend folders 5@rem 6@rem ########################################################################## 7 8@rem Set local scope for variables in Windows NT shell 9if "%OS%"=="Windows_NT" setlocal 10 11setlocal enabledelayedexpansion 12 13@REM Get the directory of this script 14set BAT_PATH=%~dp0 15@REM Navigate to the code directory to ensure consistent behavior 16cd /D %BAT_PATH% 17cd .
...
1. proto File 1// Specifies the version of the proto syntax, either 2 or 3 2syntax = "proto3"; 3// Declares the import path for the generated Go code, which is the path used to import the pb.go file in other code 4option go_package = "internal/controller"; 5// Package name 6package controller; 1@if "%DEBUG%"=="" @echo off 2@rem ########################################################################## 3@rem 4@rem Build proto 5@rem 6@rem ########################################################################## 7 8set DIRNAME=%~dp0 9cd /D %DIRNAME% 10cd .
...
Commonly used fields [Files] Source: "README.TXT"; DestDir: "{app}"; Flags: onlyifdoesntexist onlyifdoesntexist
Only install the file if it doesn’t already exist on the user’s system.
ignoreversion
Don’t compare version info at all; replace existing files regardless of their version number.This flag should only be used on files private to your application, never on shared system files.
1// findSmallestMissingNumber finds the smallest missing positive integer in the array 2func findSmallestMissingNumber(nums []int) int { 3 n := len(nums) 4 5 // Traverse the array, placing each number in its correct position 6 for i := 0; i < n; i++ { 7 for nums[i] > 0 && nums[i] <= n && nums[nums[i]-1] != nums[i] { 8 nums[i], nums[nums[i]-1] = nums[nums[i]-1], nums[i] 9 } 10 } 11 12 // Traverse the array again to find the first number not in its correct position 13 for i := 0; i < n; i++ { 14 if nums[i] !
...
1// UndistortImage Distortion Correction 2func UndistortImage(imgData []byte, imgSize image.Point, cameraMatrix gocv.Mat, distCoeffs gocv.Mat, newCameraMatrix gocv.Mat) ([]byte, error) { 3 mapx := gocv.NewMatWithSize(imgSize.X, imgSize.Y, gocv.MatTypeCV32F) 4 defer mapx.Close() 5 mapy := gocv.NewMatWithSize(imgSize.X, imgSize.Y, gocv.MatTypeCV32F) 6 defer mapy.Close() 7 r := gocv.Eye(3, 3, gocv.MatTypeCV32F) 8 defer r.Close() 9 10 // Initialize the correction map 11 gocv.InitUndistortRectifyMap(cameraMatrix, distCoeffs, r, newCameraMatrix, imgSize, int(gocv.MatTypeCV32F), mapx, mapy) 12 // Save the corrected image 13 src, err := gocv.
...
The business requirement was to adjust the cursor style of the rotate button in Konva.transformer to a rotation icon. I found a method on Stack Overflow, but it wasn’t entirely suitable for my needs.
1const stage = new Konva.Stage({ 2 container: 'container', 3 width: window.innerWidth, 4 height: window.innerHeight 5}); 6 7const layer = new Konva.Layer(); 8stage.add(layer); 9 10const shape = new Konva.Circle({ 11 x: stage.width() / 2, 12 y: stage.height() / 2, 13 radius: 50, 14 fill: 'green' 15}); 16layer.
...
1// CalibCamera calibrates the camera 2func CalibCamera(imgDatas [][]byte, chessboardRowCornerCount int, chessboardColCornerCount int, curImageIndex int) error { 3 // Save the 2D coordinates of the corner points in each image, i.e., pixel coordinates 4 imgPoints := gocv.NewPoints2fVector() 5 defer imgPoints.Close() 6 // Save the 3D coordinates of the corner points in each image, i.e., world coordinates 7 objPoints := gocv.NewPoints3fVector() 8 defer objPoints.Close() 9 // Save the image size 10 imgSize := image.
...
The application storage directory structure is divided into Users\Username\AppData, and is further categorized into three folders: Roaming, Local, and LocalLow.
Windows uses the Local and LocalLow folders to store non-roaming application data (similar to the Local_machine registry) and some application data that is too large to roam. The Roaming folder, on the other hand, is used to store user application data that can roam, such as personalized settings for each user.
...
1. Least Squares Method 1// fitCenterByLeastSquare fits a circle using the least squares method 2func fitCenterByLeastSquare(points []gocv.Point2f) (gocv.Point2f, float32) { 3 var sumX, sumY, sumX2, sumY2, sumXY, sumX3, sumY3, sumX2Y, sumY2X float32 4 for _, p := range points { 5 sumX += p.X 6 sumY += p.Y 7 sumX2 += p.X * p.X 8 sumY2 += p.Y * p.Y 9 sumXY += p.X * p.Y 10 sumX3 += p.X * p.
...