3.λ.形而下技术博客

这里只关注技术实现,用代码说话。

LLDB调试Qt5的问题

MacOS下,LLDB调试Qt5应用通常会遇到无法打印QString变量的问题。

1
2
3
4
5
6
7
8
9
10
11
12
* thread #1, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
frame #0: 0x0000000100003a81 a.out`main(argc=1, argv=0x00007ff7bfefeb40) at test.cpp:10:11
7 QCoreApplication a(argc, argv);
8
9 QString s = "Hello World";
-> 10 return a.exec();
11 }
Target 0: (a.out) stopped.
(lldb) print s
(QString) $0 = {
d = 0x0000600000c04b70
}

这里无法获取变量s的值Hello World,只能看到一个地址。

阅读全文 »

什么是LangChain

自从ChatGPT出现以来,就一直在使用,那么ChatGPT毕竟是有局限性的,因为ChatGPT训练的语料是有限的。很多问题回答不了, 也经常会胡言乱语闹笑话。

但是ChatGPT背后的大语言模型LLM是可以扩展的,也就是说,可以把特定的领域知识让LLM(大语言模型)学习。这样就在一定 程度上解决了局限性。

LangChain项目就是这样的杀手锏,这里是官方文档

阅读全文 »

题目概述

leetcode现在支持Go了,这次用Go写一个算法题——消除游戏。

原题链接

You have a list arr of all integers in the range [1, n] sorted in a strictly increasing order. Apply the following algorithm on arr:

Starting from left to right, remove the first number and every other number afterward until you reach the end of the list.
Repeat the previous step again, but this time from right to left, remove the rightmost number and every other number from the remaining numbers.
Keep repeating the steps again, alternating left to right and right to left, until a single number remains.
Given the integer n, return the last number that remains in arr.

Example 1:

Input: n = 9

Output: 6

Explanation:

arr = [1, 2, 3, 4, 5, 6, 7, 8, 9]

arr = [2, 4, 6, 8]

arr = [2, 6]

arr = [6]

简单说就是从左至右消除,再从右到左消除,如果不唯一继续这个过程。对于这个例子,输入是9,那么开始就有1-9, 9个数。第一次,消除{1,3,5,7,9}, 第二次消除{8,4},第三次消除{2},最后留下数字6。

老办法,先用naive、暴力的方法求解,再优化。

阅读全文 »

问题

jetson tx2开发板上安装了dockerk3s,部署了一个pod,发现日志报错

1
"dial tcp: lookup esmp-cloud-sync.dev.ennew.com on 10.43.0.10:53: no such host"

其中esmp-cloud-sync.dev.ennew.com是内网域名,说明pod无法解析该域名。

阅读全文 »

CLion介绍

CLion是一款针对C/C++项目的跨平台的集成IDE(A cross-platform IDE for C and C++)。2020版本以前,只支持cmake项目, 但是2021版本对Makefile项目的支持度增加了。我们看看如何对Makefile项目进行断点调试。

阅读全文 »

ASN.1介绍

X.509证书常用的编码方式有DER格式和PEM格式。证书是一个对象的话,那么需要一个描述这个对象的语言。ASN.1就是这样的一个语言规范。而DER是ASN.1编码的一种方式。如果要解析DER编码文件,就需要了解ASN.1语言规范的编解码。

阅读全文 »

X.509证书的颁发和使用

X.509证书是用来认证身份的,例如在访问一个HTTPS网站的时候,浏览器会首先下载该网站 的证书,验证是否有效。如果无效,浏览器会提示您的连接不是私密连接,进一步访问网站有风险。 如果有效则可以直接访问,不会告警。

浏览器怎么验证网站证书是否有效呢?简单说就是看网站证书的颁发机构是不是已经被操作系统信任,即看 颁发机构的身份证书是否已经安装到操作系统里,并被设置为信任。

那么我们接下来做的事情就是在mac系统上验证浏览器的上述行为。

阅读全文 »
0%