在我的工作中,不允许从Microsoft Store安装应用程序。是的,这是一家银行,不支持Windows 10(这是地狱)。
是否可以在WSL中安装Ubuntu,而无需从应用程序商店中下载它?
还是可以在没有Microsoft Store的情况下下载Ubuntu应用,然后再安装它?
Telegram bot 的发送文件大小限制为 50MB。
我需要发送大文件。有没有办法解决?
我知道这个项目https://github.com/pwrtelegram/pwrtelegram但我无法让它工作。
也许有人已经解决了这样的问题?
有一个选项可以通过 Telegram API 实现文件上传,然后通过file_id与 bot发送。
我使用库https://github.com/rubenlagus/TelegramBots用 Java 编写了一个机器人
更新
为了解决这个问题,我使用了电报 api,它对大文件有 1.5 GB 的限制。
我更喜欢 kotlogram - 具有良好文档的完美库https://github.com/badoualy/kotlogram
更新 2
我如何使用这个库的例子:
private void uploadToServer(TelegramClient telegramClient, TLInputPeerChannel tlInputPeerChannel, Path pathToFile, int partSize) {
File file = pathToFile.toFile();
long fileId = getRandomId();
int totalParts = Math.toIntExact(file.length() / partSize + 1);
int filePart = 0;
int offset = filePart * partSize;
try (InputStream is = new FileInputStream(file)) {
byte[] …Run Code Online (Sandbox Code Playgroud) 您知道吗,在并发环境中将映射变量链接更改为另一个是否安全?
一个例子是datamap 在一个 goroutine 中替换为 new map 并在另一个 goroutine 中从它们中读取元素:
import (
"fmt"
"math/rand"
"strconv"
"testing"
"time"
)
func TestMap(t *testing.T) {
s1 := rand.NewSource(time.Now().UnixNano())
r1 := rand.New(s1)
data := fill(r1.Intn(100))
timer := time.NewTimer(10 * time.Second)
go func() {
s1 := rand.NewSource(time.Now().UnixNano())
r1 := rand.New(s1)
for {
select {
case <-timer.C:
return
default:
}
p := r1.Intn(100)
v := fill(p)
data = v
fmt.Println("_p=" + strconv.Itoa(p))
}
}()
for range []int{1, 2, 3, 4, 5, 6, 7, 8} …Run Code Online (Sandbox Code Playgroud)