V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  BRS5672023  ›  全部回复第 1 页 / 共 3 页
回复总数  41
1  2  3  
11 小时 11 分钟前
回复了 bitvector 创建的主题 Linux 有购买 Thinkbook 14+ 2024 成功安装 Linux 的大佬吗?
@imjiaoyuan 更新 bios 好像是可以在 Linux 上操作的,不过比较麻烦一点(记得还看到过有教程的,基本就是要从联想给的 exe 里面解压出 fw 文件然后用 fwupd 更新的,不过一时还找不到了),我现在是在一块外接的固态硬盘上分区装了 windows 系统,bios 更新也可以在 win2go 里面完成(在外接硬盘上用 vhdx 安装 windows 使用 ventoy 引导似乎是更好的方案,不过我在 vhdx 安装的 windows 上遇到了 onedrive 不能按需同步只能整个同步的问题,以及 windows update 里面的更新无法正常安装的问题)
86 天前
回复了 anivie 创建的主题 Linux kde 美化问题
不知道 ubuntu 上是怎么回事,arch 上对应 qt5/qt6 的包名为 kvantum-qt5 和 kvantum (后者没有后缀了)
99 天前
回复了 falser101 创建的主题 Linux Linux 使用 kitty 问题
zsh 补全需要 zsh-completions 吧。。好像常用的还有一些其他的包也要装和配置(感觉还是 fish 好用些)
132 天前
回复了 punish19 创建的主题 Android Open GApps 停更了,各位推荐哪个 GApps?
@showgood163 revanced 的 microg 应该是不一样的,好像两个能同时安装( revanced 的 youtube 和原版也能同时存在),不过我对 revanced 的应用没啥需求
132 天前
回复了 punish19 创建的主题 Android Open GApps 停更了,各位推荐哪个 GApps?
@BRS5672023 不过有一些使用上的不便之处,感觉特别是谷歌的应用在体验上有一些问题。。

比如 gboard ,无法下载语言包(然后就无法使用比如五笔输入法); chrome 无法补全密码(我看到有人说原因是谷歌把这一部分功能移动到了 gms 里面,所以老版的 chrome 能补全密码); googlequicksearchbox 直接白屏,没有内容显示; youtube 会出现看视频十几秒就卡住无法缓冲,但我重新安装 preview 版本的 microg 就没有这个问题了,应该是修复了
132 天前
回复了 punish19 创建的主题 Android Open GApps 停更了,各位推荐哪个 GApps?
microg ,我在 lineageos 的机器上装了,对比之下没有 gms 那么耗电(不过我没有使用谷歌的 play store ,而是用的 aurora store )
136 天前
回复了 Tardis07 创建的主题 Linux 寻找一个支持排除窗口的 Linux 录屏工具
@Tardis07 而且窗口捕获 wayland 应该还没有对应的 protocol 吧?
137 天前
回复了 Tardis07 创建的主题 Linux 寻找一个支持排除窗口的 Linux 录屏工具
@Tardis07 黑框啥意思?所以你是想要除了你自己别人都看不见这个窗口吗?而不只是别人看不到这个窗口的内容?
137 天前
回复了 Tardis07 创建的主题 Linux 寻找一个支持排除窗口的 Linux 录屏工具
niri wm 作为一个窗口管理器有这个功能 https://github.com/YaLTeR/niri/wiki/Configuration:-Window-Rules#block-out-from ,然而其录屏功能需要 xdg-desktop-portal-gnome 来实现,而我在 archlinux 上使用 niri wm 却不能正常启动 xdg-desktop-portal-gnome 这个服务。。
143 天前
回复了 BRS5672023 创建的主题 C++ C++ 新手问下有没有办法链式定义一个类
@blacktail 只是随便写了下化简的部分;重点也不是在化简的部分,但是当然希望我的计算结果能够输出一个简化过的形式。。

另外程序写的还是有挺多问题的,包括甚至不能计算展开多项式的乘积。。
144 天前
回复了 BRS5672023 创建的主题 C++ C++ 新手问下有没有办法链式定义一个类
上面的程序输出的结果是
```
Polynomial before simplification:
3 * pow(p, 2) * pow(q, 1) + 5 * pow(p, 2) * pow(q, 1) + 2 * pow(p, 1) * pow(q, 1)
Polynomial after simplification:
8 * pow(p, 2) * pow(q, 1) + 2 * pow(p, 1) * pow(q, 1)
```
144 天前
回复了 BRS5672023 创建的主题 C++ C++ 新手问下有没有办法链式定义一个类
@ipwx 我试了一下,大概是下面的形式
```
#include <iostream>
using namespace std;

#include <string>
#include <vector>

class Mono {
public:
int coefficient;
char variable1;
int power1;
char variable2;
int power2;

Mono(int a, char p, int n = 0, char q = '1', int m = 0) : coefficient(a), variable1(p), power1(n), variable2(q), power2(m) {}

bool isSameTerm(const Mono & other) {
return(variable1 == other.variable1 && power1 == other.power1 && variable2 == other.variable2 && power2 == other.power2);
}

};

Mono operator * (int coef, const Mono & mono) {
return Mono(coef * mono.coefficient, mono.variable1, mono.power1, mono.variable2, mono.power2);
}

Mono operator * (const Mono & lhs, const Mono & rhs) {
if (lhs.variable2 == '1' && rhs.variable2 == '1') {
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1, rhs.variable1, rhs.power1);
}
else if (lhs.variable1 == rhs.variable1 && lhs.variable2 == '1') {
if (rhs.variable2 == '1') {
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1 + rhs.power1);
}
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1 + rhs.power1, lhs.variable2, lhs.power2);
}
else if (lhs.variable1 == rhs.variable1 && rhs.variable2 == '1') { // We do not need consider the case when the second variable of lhs is '1', which was already contained in the last case.
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1 + rhs.power1, rhs.variable2, rhs.power2);
}
else if (lhs.variable1 == rhs.variable1 && lhs.variable2 == rhs.variable2) {
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1 + rhs.power1, lhs.variable2, lhs.power2 + rhs.power2);
}
else if (lhs.variable1 == rhs.variable2 && lhs.variable2 == rhs.variable1) {
return Mono(lhs.coefficient * rhs.coefficient, lhs.variable1, lhs.power1 + rhs.power2, lhs.variable2, lhs.power2 + rhs.power1);
}
throw -1;
}

Mono pow(char variable, int power) {
return Mono(1, variable, power);
}

class Poly {
friend ostream & operator << (ostream & os, const Poly & poly);
private:
vector<Mono> terms;

public:
Poly & addTerm(const Mono & term) {
terms.push_back(term);
return * this;
}

Poly & operator + (const Mono & term) {
addTerm(term);
return * this;
}

void simplify() {
for (size_t i = 0; i < terms.size(); i++) {
for (size_t j = i + 1; j < terms.size(); j++) {
if (terms[i].isSameTerm(terms[j])) {
terms[i].coefficient = terms[i].coefficient + terms[j].coefficient;
terms.erase(terms.begin() + j);
j--;
}
}
}
}
};

ostream & operator << (ostream & os, const Poly & poly) {
for (size_t i = 0; i < poly.terms.size(); i++) {
const auto & term = poly.terms[i];
if (term.coefficient != 0) {
if (term.power1 == 0 && term.power2 == 0) {
os << term.coefficient;
}
else if (term.power1 == 0) {
os << term.coefficient << " * pow(" << term.variable2 << ", " << term.power2 << ")";
}
else if (term.power2 == 0) {
os << term.coefficient << " * pow(" << term.variable1 << ", " << term.power1 << ")";
}
else {
os << term.coefficient << " * pow(" << term.variable1 << ", " << term.power1 << ") * " << "pow(" << term.variable2 << ", " << term.power2 << ")";
}
if (i < poly.terms.size() - 1) {
os << " + ";
}
}
}
return os;
}

int main() {
try {
Poly poly;
poly = poly + (3 * pow('p', 2) * pow('q', 1)) + (5 * pow('p', 2) * pow('q', 1)) + (2 * pow('p', 1) * pow('q', 1));
cout << "Polynomial before simplification:\n" << poly << endl;

poly.simplify();
cout << "Polynomial after simplification:\n" << poly << endl;
}

catch(int err0) {
cout << "You must input polynomials of two variables with aligned variables for multiplication!" << endl;
cout << "Error number: " << err0 << endl;
}
return 0;
}
```
问题是我这样写就必须这样定义一个多项式
```
Poly poly;
poly = poly + (3 * pow('p', 2) * pow('q', 1)) + (5 * pow('p', 2) * pow('q', 1)) + (2 * pow('p', 1) * pow('q', 1));
```
还有就是无法区分 pow(p, n) * pow(q, m) 和 pow(q, m) * pow(p, n) 这两种形式(除非我指定两个 char 的顺序);不过第二个问题就是我一开始想要的对于非交换的多项式的计算。。(然后我期待可以计算两个多项式的对易子,最后计算得到关于 p q 的对易子的一个多项式)
@yanqiyu

>> 特别是如果我把 getValidInput 函数的这个判断给注释掉的话,那么在我输入 "2" 使用 "显示联系人" 这个功能时,需要再输入一个回车才会显示 "请按回车键继续" 的字符

> cin.ignore(numeric_limits<streamsize>::max(), '\n'); 会一直等输入(堵塞)直到遇到回车,要是缓冲区里面没有回车的话。

这个地方为什么它在 case 1 和 case 2 的时候行为不一致呢?是因为我在使用 case 2 的 showPerson 函数里面没有任何输入所以需要我先输入一个回车吗?然后我加入的 cin.eof() 的判断就相当于把 cin.ignore 这一行给注释掉了所以在我一开始选择 case 的 getValidInput 里就会把我最初输入的 1 或者 2 给保留下来,然后 case 2 里的 pause 就不再需要我再输入一个换行符了,大概是这个原因?
@sagaxu 这个方法不错,感谢
@cnbatch 直接按照你给出的说法替换后在我进行添加联系人的操作后的输出结果是

Press enter to continue1 、添加联系人
2 、显示联系人
3 、删除联系人
4 、查找联系人
5 、修改联系人
6 、清空联系人
0 、退出通讯录

不太清楚怎么回事。。
149 天前
回复了 TrackBack 创建的主题 Linux 联想 thinkbook 在 Linux 下风扇不转正常吗
我是 14+ (G6+ AHP) 8845h 版的,风扇没有问题,不过比如 s-tui 里读不到风扇转速。。我估计也是没法调转速的。。

另外,之前买过一个戴尔的本子,本身 Linux 兼容性还是很不错的,就是风扇策略有点离谱。。然后查了一下,发现控制风扇的程序是逆向出来的,并且因为我买的本子太新了还不能用(不过至少 s-tui 里还能读到风扇转速)
151 天前
回复了 ityspace 创建的主题 Linux 推荐一个平铺化桌面 Niri
另外 github 里面有一些讨论很有意思,比如这个 overview 的概念 https://github.com/YaLTeR/niri/discussions/352#discussioncomment-10094739
@BRS5672023 这个问题原来在 libcamera 0.3.2 上已经修复了。。
@imjiaoyuan 耗电问题你看和 pipewire 的这个 bug 有没有关系,我的 amd 机型也遇到了耗电的问题。。

https://www.reddit.com/r/linux/comments/1em8biv/psa_pipewire_has_been_halving_your_battery_life/
159 天前
回复了 ityspace 创建的主题 Linux 推荐一个平铺化桌面 Niri
@Immortal 优势就是打开新窗口不会改变已经打开窗口的大小,niri 上的 workspace 相当于几条不相交的带子,每条都可以在水平方向无限延伸,但是其实在每一条带子上定位一个窗口就没那么简单了(如果一条带子上的窗口数目足够多的情况下)
1  2  3  
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2401 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 83ms · UTC 16:08 · PVG 00:08 · LAX 09:08 · JFK 12:08
Developed with CodeLauncher
♥ Do have faith in what you're doing.