@无名啊,可以插自己的卡用自己的流量,我是连接的家里的wifi
编译安装个mysql8.0要多久。![]()
@旧人,开完 MySQL,只剩下三百多 MB 内存了??
@晨曦,确实,内存太小了,连 1GB 都不到。。java 应用应该是跑不起了
这内存
我是晨曦,我喂自己袋盐!
宝塔可以跑起来![]()
@无名啊,你可以对它说请用中文回复。不过目前其他人已经插入了其他对话,所以你应该得不到上下文相关的回答。
要阅读本文,请使用谷歌浏览器翻译。
@老虎会游泳,怎么突然变成英文回复了。。。
层主 @老虎会游泳 于 2023-02-19 03:22 删除了该楼层。
层主 @老虎会游泳 于 2023-02-19 03:22 删除了该楼层。
@511,对
@老虎会游泳,cdn回源超时也会504吧
源站是在哪里,海外用国内cdn的确会这样,建议香港的节点中转下或者仅静态资源使用cdn
小米MIX2s(白)
@511,504表示cdn连不上你的服务器。问题也可能是cdn节点到你的服务器之间网络较差。
@无名啊,嗯,我的C++应用程序需要调用cgroup功能
@老虎会游泳,老虎这是深钻 Linux ?
@hik,品控差+1,再也不想碰了。我买的机械革命笔记本已经返修2次了,即将迎来第三次返修,早就有问题了,一直没空!!!
哈哈,机械革命Pro笔记本 rtx4060+12代标压i7只要5999,品控差,但价格香啊![]()
asecyv@mailto.plus
package main//计算hex校验和
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum, := strconv.ParseInt(line[len(line)-2:], 16, 64) //pattern := regexp.MustCompile(`.{2}`) parts := pattern.FindAllString(line[1:len(line)-2], -1) var nums []int for _, p := range parts { num, _ := strconv.ParseInt(p, 16, 64) nums = append(nums, int(num)) } newChecksum := 256 - reduce(nums) if checksum == int64(newChecksum) { fmt.Println("校验和匹配,该行无需修改") } else { fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum) fmt.Println("正确的行:") fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum) }}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}
func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}This is a program written in Go to calculate the checksum of a given hex line and compare it to the last two digits of the input line. The program takes input from the user, removes whitespace characters, and extracts the last two digits as the expected checksum. Then, it extracts pairs of hex digits (two characters) from the remaining part of the input line and converts them to integers. The reduce function is called with the resulting list of integers as an argument, which recursively sums them and takes the result modulo 256. The calculated checksum is then compared to the expected checksum, and if they match, the program outputs that the line is correct. Otherwise, the program outputs the correct checksum and the modified line with the correct checksum appended at the end.
asecyv@mailto.plus
package main//计算hex校验和
import (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum, := strconv.ParseInt(line[len(line)-2:], 16, 64) //pattern := regexp.MustCompile(`.{2}`) parts := pattern.FindAllString(line[1:len(line)-2], -1) var nums []int for _, p := range parts { num, _ := strconv.ParseInt(p, 16, 64) nums = append(nums, int(num)) } newChecksum := 256 - reduce(nums) if checksum == int64(newChecksum) { fmt.Println("校验和匹配,该行无需修改") } else { fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum) fmt.Println("正确的行:") fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum) }}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}
func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
改下添加按任意键退出
Sure, you can modify the code to add a prompt for the user to press any key to exit the program. You can use the function to wait for the user to input any text before exiting the program. Here's an example:fmt.Scanln()go
Copy code
package mainimport (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings"
)func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum, := strconv.ParseInt(line[len(line)-2:], 16, 64)pattern := regexp.MustCompile(`.{2}`) parts := pattern.FindAllString(line[1:len(line)-2], -1) var nums []int for _, p := range parts { num, _ := strconv.ParseInt(p, 16, 64) nums = append(nums, int(num)) } newChecksum := 256 - reduce(nums) if checksum == int64(newChecksum) { fmt.Println("校验和匹配,该行无需修改") } else { fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum) fmt.Println("正确的行:") fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum) } fmt.Println("按任意键退出...") fmt.Scanln()}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
With this modification, the program will wait for the user to press any key before exiting.asecyv@mailto.plus
fmt.Scanln()只能算是按回车键退出,不算是任意键退出
You are correct, waits for the user to input a complete line, which usually requires pressing the Enter key. If you want to wait for the user to press any key, you can use a platform-specific package like to read a single key without waiting for Enter to be pressed. Here's an example that uses this package to wait for the user to press any key:fmt.Scanln()github.com/eiannone/keyboardgo
Copy code
package mainimport (
"bufio"
"fmt"
"os"
"regexp"
"strconv"
"strings""github.com/eiannone/keyboard")
func main() {
fmt.Println("请输入要计算校验和的行:")
reader := bufio.NewReader(os.Stdin)
line, := reader.ReadString('\n')
line = strings.TrimSpace(line)
checksum, := strconv.ParseInt(line[len(line)-2:], 16, 64)pattern := regexp.MustCompile(`.{2}`) parts := pattern.FindAllString(line[1:len(line)-2], -1) var nums []int for _, p := range parts { num, _ := strconv.ParseInt(p, 16, 64) nums = append(nums, int(num)) } newChecksum := 256 - reduce(nums) if checksum == int64(newChecksum) { fmt.Println("校验和匹配,该行无需修改") } else { fmt.Printf("校验和不匹配,原校验和:%d,应该改为:%d\n", checksum, newChecksum) fmt.Println("正确的行:") fmt.Printf("%s%02X\n", line[:len(line)-2], newChecksum) } fmt.Println("按任意键退出...") keyboard.GetSingleKey()}
func reduce(nums []int) int {
return reduceHelper(nums, 0)
}func reduceHelper(nums []int, acc int) int {
if len(nums) == 0 {
return acc % 256
}
return reduceHelper(nums[1:], (acc+nums[0])%256)
}
In this example, we use the function from the package to wait for the user to press any key before exiting. Note that this package may not work on all platforms, so you should check the documentation and test the program on the platforms you plan to use it on.GetSingleKey()github.com/eiannone/keyboard
一加8Pro
