RError.com

RError.com Logo RError.com Logo

RError.com Navigation

  • 主页

Mobile menu

Close
  • 主页
  • 系统&网络
    • 热门问题
    • 最新问题
    • 标签
  • Ubuntu
    • 热门问题
    • 最新问题
    • 标签
  • 帮助
主页 / user-603952

gth-other's questions

Martin Hope
gth-other
Asked: 2024-08-30 04:44:13 +0000 UTC

如何了解传感器命令的输出中有哪些设备?

  • 5
Every 2,0s: sensors                                                                                                                                                                 Honor: Thu Aug 29 23:40:56 2024

ath11k_hwmon-pci-0200
Adapter: PCI adapter
temp1:        +38.0°C

nvme-pci-0300
Adapter: PCI adapter
Composite:    +36.9°C  (low  = -273.1°C, high = +80.8°C)
                       (crit = +84.8°C)
Sensor 1:     +36.9°C  (low  = -273.1°C, high = +65261.8°C)
Sensor 2:     +38.9°C  (low  = -273.1°C, high = +65261.8°C)

acpitz-acpi-0
Adapter: ACPI interface
temp1:        +80.0°C  (crit = +110.0°C)

k10temp-pci-00c3
Adapter: PCI adapter
Tctl:         +80.4°C

amdgpu-pci-0400
Adapter: PCI adapter
vddgfx:      987.00 mV
vddnb:       949.00 mV
edge:         +65.0°C
PPT:          29.00 W

BAT0-acpi-0
Adapter: ACPI interface
in0:          14.70 V
curr1:         2.69 A

笔记本电脑在负载下开始关闭,传感器显示以下内容。如何了解他们acpitz-acpi-0是谁k10temp-pci-00c3?

linux
  • 1 个回答
  • 15 Views
Martin Hope
gth-other
Asked: 2024-08-26 21:25:04 +0000 UTC

在 C++ 中删除单例很常见吗?

  • 5

例如,有一个类Textures:

Textures.hpp:

#include <unordered_map>
#include <SFML/Graphics.hpp>


#pragma once


class Textures {
public:
    static Textures *get() {
        if (Textures::singletone == nullptr) {
            Textures::singletone = new Textures();
        }
        return Textures::singletone;
    }

    void add(const std::string& name, const std::string& path);
    void add(const std::string& name, const sf::Texture& texture);
    sf::Texture *get(const std::string& name);
private:
    Textures() = default;
    Textures(const Textures& copy);
    static Textures *singletone;

    std::unordered_map<std::string, sf::Texture> textures;
};

Textures.cpp:

#include <iostream>
#include "Textures.hpp"
#include "Root.hpp"
#include "CouldntOpenTexture.hpp"


Textures *Textures::singletone = nullptr;


void Textures::add(const std::string& name, const std::string& path) {
    if (!this->textures[name].loadFromFile(Root::get()->getDataRoot() + "/" + path)) {
        throw CouldntOpenTexture(path);
    }
}
void Textures::add(const std::string& name, const sf::Texture& texture) {
    this->textures[name] = texture;
}
sf::Texture *Textures::get(const std::string& name) {
    auto it = this->textures.find(name);
    if (it == this->textures.end()) {
        std::cerr << "Invalid texture uid: " << name << std::endl;
    }
    return &it->second;
}

显然这里存在内存泄漏;*Textures singletone通过 分配new,但不会在任何地方删除。然而,单例在整个执行过程中都存在,并且至少出于安全原因,任何操作系统都必须在进程终止后完全清除进程的内存。那么,是否可以不删除它们呢?

c++
  • 2 个回答
  • 39 Views
Martin Hope
gth-other
Asked: 2024-08-18 16:57:24 +0000 UTC

C++二进制数据变化的优化表示

  • 6

服务器存储大约二十KB大小的字符串。该行定期被类似的行替换,变化可能是:

  1. 如有必要,添加一个小片段,将所有内容向右移动
  2. 删除一个小片段,如有必要,向左移动,所有内容都向左移动
  3. 将小片段中的数据替换为其他数据

及其各种组合。我们所说的小片段通常是指不超过五十字节。


服务器需要在每次更新此行后向所有善意客户端提供最新版本。由于更改相对于行的大小来说很小并且频繁发生,因此发送整行在流量消耗方面过于浪费。连接可确保所有数据包均按相同顺序无损坏、丢失、重复地传送。


我认为这个问题可以通过以下方式解决。除了线路的当前状态之外,服务器还将存储发送给客户端的最后一个数据包到达时应在客户端中的线路状态。在这种情况下,不必重新发送全部 20 KB,而只需重新发送特殊编码的更改即可。关于从新旧版本的二进制数据生成这种特殊编码的更改的主题,我可以查看哪些算法或实现?

c++
  • 1 个回答
  • 39 Views
Martin Hope
gth-other
Asked: 2024-08-16 23:41:36 +0000 UTC

复制 UDP 数据包以最大程度地减少数据包丢失的可能性是一个好习惯吗?

  • 10

例如,客户端向服务器发送单击的鼠标坐标。如果服务器因为数据包丢失而简单地忽略其操作,那么客户端显然不会喜欢它。我认为我可以通过将包裹编号添加到数据包的开头(随机的,因此,几乎在任何方面都是唯一的大数字)并一次发送多个具有相同编号的数据包来轻松解决这个问题。在这种情况下,当接收到数据包时,服务器将在某个哈希表中查找接收到的数据包的编号,如果不存在,则对其进行处理并将该编号标记为已处理。这样的解决方案有什么陷阱吗?他们在任何地方都这样做吗?

ip
  • 1 个回答
  • 61 Views

Sidebar

Stats

  • 问题 10021
  • Answers 30001
  • 最佳答案 8000
  • 用户 6900
  • 常问
  • 回答
  • Marko Smith

    我看不懂措辞

    • 1 个回答
  • Marko Smith

    请求的模块“del”不提供名为“default”的导出

    • 3 个回答
  • Marko Smith

    "!+tab" 在 HTML 的 vs 代码中不起作用

    • 5 个回答
  • Marko Smith

    我正在尝试解决“猜词”的问题。Python

    • 2 个回答
  • Marko Smith

    可以使用哪些命令将当前指针移动到指定的提交而不更改工作目录中的文件?

    • 1 个回答
  • Marko Smith

    Python解析野莓

    • 1 个回答
  • Marko Smith

    问题:“警告:检查最新版本的 pip 时出错。”

    • 2 个回答
  • Marko Smith

    帮助编写一个用值填充变量的循环。解决这个问题

    • 2 个回答
  • Marko Smith

    尽管依赖数组为空,但在渲染上调用了 2 次 useEffect

    • 2 个回答
  • Marko Smith

    数据不通过 Telegram.WebApp.sendData 发送

    • 1 个回答
  • Martin Hope
    Alexandr_TT 2020年新年大赛! 2020-12-20 18:20:21 +0000 UTC
  • Martin Hope
    Alexandr_TT 圣诞树动画 2020-12-23 00:38:08 +0000 UTC
  • Martin Hope
    Air 究竟是什么标识了网站访问者? 2020-11-03 15:49:20 +0000 UTC
  • Martin Hope
    Qwertiy 号码显示 9223372036854775807 2020-07-11 18:16:49 +0000 UTC
  • Martin Hope
    user216109 如何为黑客设下陷阱,或充分击退攻击? 2020-05-10 02:22:52 +0000 UTC
  • Martin Hope
    Qwertiy 并变成3个无穷大 2020-11-06 07:15:57 +0000 UTC
  • Martin Hope
    koks_rs 什么是样板代码? 2020-10-27 15:43:19 +0000 UTC
  • Martin Hope
    Sirop4ik 向 git 提交发布的正确方法是什么? 2020-10-05 00:02:00 +0000 UTC
  • Martin Hope
    faoxis 为什么在这么多示例中函数都称为 foo? 2020-08-15 04:42:49 +0000 UTC
  • Martin Hope
    Pavel Mayorov 如何从事件或回调函数中返回值?或者至少等他们完成。 2020-08-11 16:49:28 +0000 UTC

热门标签

javascript python java php c# c++ html android jquery mysql

Explore

  • 主页
  • 问题
    • 热门问题
    • 最新问题
  • 标签
  • 帮助

Footer

RError.com

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

帮助

© 2023 RError.com All Rights Reserve   沪ICP备12040472号-5