Posts

  • 《莎士比亚、牛顿和贝多芬:不同的创造模式》

    本书是钱德拉塞卡的演讲稿的合集,原名是“Truth and Beauty”,译者认为这个中文名更有传播度。事实上,译者确实是对的,我第一次见到这个名字就联想到了《哥德尔、艾舍尔、巴赫》。本书的主题是科学、真理与美,就是英文名总结的那样,其中探讨了科学家对真理和美的追求。

  • CMake 中 find_package 是如何工作的?

    用 CMake 稍不留神就会出现这样的报错:

  • Command line tools for process management in Linux

    top & htop

  • Command line tools for service management in Linux

    When it comes to service management in Linux, the controversial role of systemd is undeniable. Despite the numerous critical arguments it has faced, systemd continues to be an essential component of Linux distributions.

  • Command line tools for network management in Linux

    There are a wide array of tools for network management in Linux. As a system administrator, you must to have these to for network configuring, maintaining, and troubleshooting.

  • 禁忌搜索

    禁忌搜索——一个可用于旅行商问题的搜索方法
  • git-annex

    A stupid filename and metadata tracker
  • YubiKey 5 初步体验

    大致尝试了一下 YubiKey 的各种功能。
  • POJ 3109 Inner Vertices (坐标离散化、差分、树状数组)

    一个无限平面上有 N 个黑点其余为白点,如果某个白点水平左右、垂直上下都存在黑点,那么该点会变为黑点,求最终平面有多少黑点。
  • 写一份报告

    我认为对于写一份报告而言 Org mode 是最好的选择(谦虚点……之一)。
  • Arch Linux NVIDIA 显卡配置小记

    曾经因为配置不好 NVIDIA 和 Intel 双显卡而换到别的发行版。现在重新安装发现意外的简单……

  • 线程传参

    创建 POSIX 线程需要使用函数 pthread_create(),例如:

    pthread_t threads[N];
    for (int i = 0; i < N; i++) {
      int *datap = (int *) malloc(sizeof(int));
      *datap = i;
      pthread_create(&threads[i], NULL, print, datap);
    }
    

    4 个参数依次为存储线程地址、属性、执行的函数名、向线程传递的参数的指针。

    上述代码问题在于内存分配了 N 次,但是没有及时释放,内存分配的指针被下一次覆盖而丢失,存在内存泄露问题。

  • 如何编码状态?

    对排列组合的编码、解码及相关问题。