#658 Redis 版本历史

2021-10-20
版本 日期
6.2.8 October 2021
6.2.4 August 2021
6.0.20 April 2021
6.0.12 January 2021
6.0.8 September 2020
6.0 May 2020
5.6.0 April 2020
5.5 Preview April 2019
5.4.14 February 2020
5.4.10 December 2019
5.4.6 July 2019
5.4.4 June 2019
5.4.2 April 2019
5.4 December 2018
5.2.2 August 2018
5.3 beta July 2018
5.2 June 2018
5.0.2 2018 March
5.0 November 2017
4.5 May 2017
4.4 December 2016
4.3.0-230 August 2, 2016
4.2.1-30 October 18, 2015
4.0.0-49 June 18, 2015
0.99.5-24 February 15, 2015
0.99.5-11 January 5, 2015

Redis 4

  1. 模块系统,为后来的 RedisJSON,RedisSearch 打基础
  2. PSYNC 2.0(部分复制)
  3. LFU 优化
  4. 异步优化
  5. DEL -> UNLINK
  6. FLUSHDB, FLUSHALL 增加 ASYNC 参数
  7. RDB-AOF 混合持久化
  8. SWAPDB 命令
  9. MEMORY 命令

Redis 5

Redis 6

  • 多线程 IO
  • SSL
  • ACL 权限控制
  • RESP3
  • 客户端缓存

Redis 7

参见:2022/04/29,Redis 7 的变化

参考资料与拓展阅读

#657 Golang: 泛型

2021-10-18

泛型就是在编码中,涉及类型的定义可以不指定具体的类型,编译器根据使用时的上下文来生成相应类型的定义。

#656 亚马逊领导力准则

2021-10-15

亚马逊领导力准则
Amazon Leadership Principles

Amazon LOGO

  1. 顾客至尚 Customer Obsession
    领导者从客户入手,再反向推动工作。他们努力工作,赢得并维系客户对他们的信任。虽然领导者会关注竞争对手,但是他们更关注客户。
    Leaders start with the customer and work backwards. They work vigorously to earn and keep customer trust. Although leaders pay attention to competitors, they obsess over customers.
    ps: 作为开发者也应该关心客户(无论是真是的产品使用者,还是代码世界中接口调用方)会如何使用我们的代码。
  2. 主人翁精神 Ownership
    领导者是主人翁。他们会从长远考虑,不会为了短期业绩而牺牲长期价值。他们不仅仅代表自己的团队,而且代表整个公司行事。他们绝不会说“那不是我的工作”。
    Leaders are owners. They think long term and don’t sacrifice long-term value for short-term results. They act on behalf of the entire company, beyond just their own team. They never say “that’s not my job."
    ps: 领导者是必须要有这种精神的,积极主动,认真负责。不过有些公司喜欢向员工洗脑 “公司是我家” 的理念,但也没见把员工当家人,这就有点扯淡了。
  3. 创新简化 Invent and Simplify
    领导者期望并要求自己的团队进行创新和发明,并始终寻求使工作简化的方法。他们了解外界动态,四处寻找新的创意,并且不局限于“非我发明”的观念。当我们开展新事物时,我们要接受被长期误解的可能。
    Leaders expect and require innovation and invention from their teams and always find ways to simplify. They are externally aware, look for new ideas from everywhere, and are not limited by “not invented here." As we do new things, we accept that we may be misunderstood for long periods of time.
  4. 决策正确 Are Right, A Lot
    领导者在大多数情况下都能做出正确的决定。他们拥有卓越的业务判断能力和敏锐的直觉.他们寻求多样的视角,并挑战自己的观念。
    Leaders are right a lot. They have strong judgment and good instincts. They seek diverse perspectives and work to disconfirm their beliefs.
  5. 好奇求知 Learn and Be Curious
    领导者从不停止学习,并不断寻找机会以提升自己。领导者对各种可能性充满好奇并付于行动加以探索。
    Leaders are never done learning and always seek to improve themselves. They are curious about new possibilities and act to explore them.
  6. 选贤育能 Hire and Develop the Best
    领导者不断提升招聘和晋升员工的标准。他们表彰杰出的人才,并乐于在组织中通过轮岗磨砺他们。领导者培养领导人才,他们严肃地对待自己育才树人的职责。领导者从员工角度出发,创建职业发展机制。
    Leaders raise the performance bar with every hire and promotion. They recognize exceptional talent, and willingly move them throughout the organization. Leaders develop leaders and take seriously their role in coaching others. We work on behalf of our people to invent mechanisms for development like Career Choice.
    ps: 愿意去培养员工的公司就是好公司。
  7. 最高标准 Insist on the Highest Standards
    领导者有着近乎严苛的高标准 — 这些标准在很多人看来可能高得不可理喻。领导者不断提高标准,激励自己的团队提供优质产品、服务和流程。领导者会确保任何问题不会蔓延,及时彻底解决问题并确保问题不再出现。
    Leaders have relentlessly high standards — many people may think these standards are unreasonably high. Leaders are continually raising the bar and drive their teams to deliver high quality products, services, and processes. Leaders ensure that defects do not get sent down the line and that problems are fixed so they stay fixed.
    ps: 完美主义不一定适用于所有场景。
  8. 远见卓识 Think Big
    局限性思考只能带来局限性的结果。领导者大胆提出并阐明大局策略,由此激发良好的成果。他们从不同角度考虑问题,并广泛寻找服务客户的方式。
    Thinking small is a self-fulfilling prophecy. Leaders create and communicate a bold direction that inspires results. They think differently and look around corners for ways to serve customers.
  9. 崇尚行动 Bias for Action
    速度对业务影响至关重要。很多决策和行动都可以改变,因此不需要进行过于广泛的推敲。我们提倡在深思熟虑前提下进行冒险。
    Speed matters in business. Many decisions and actions are reversible and do not need extensive study. We value calculated risk taking.
  10. 勤俭节约 Frugality
    力争以更少的投入实现更大的产出。勤俭节约可以让我们开动脑筋、自给自足并不断创新。增加人力、预算以及固定支出并不会为你赢得额外加分。
    Accomplish more with less. Constraints breed resourcefulness, self-sufficiency, and invention. There are no extra points for growing headcount, budget size, or fixed expense.
  11. 赢得信任 Earn Trust
    ​领导者专注倾听,坦诚沟通,尊重他人。领导者敢于自我批评,即便这样做会令自己尴尬或难堪。他们并不认为自己或其团队总是对的。领导者会以最佳领导者和团队为标准来要求自己及其团队。
    Leaders listen attentively, speak candidly, and treat others respectfully. They are vocally self-critical, even when doing so is awkward or embarrassing. Leaders do not believe their or their team’s body odor smells of perfume. They benchmark themselves and their teams against the best.
  12. 刨根问底 Dive Deep
    ​领导者深入各个环节,随时掌控细节,经常进行审核,当数据与传闻不一致时持有怀疑态度。领导者不会遗漏任何工作。
    Leaders operate at all levels, stay connected to the details, audit frequently, and are skeptical when metrics and anecdote differ. No task is beneath them.
  13. 敢于谏言,服从大局 Have Backbone; Disagree and Commit
    ​领导者必须要能够不卑不亢地质疑他们无法苟同的决策,哪怕这样做让人心烦意乱,精疲力尽。领导者要信念坚定,矢志不移。他们不会为了保持一团和气而屈就妥协。一旦做出决定,他们就会全身心地致力于实现目标。
    Leaders are obligated to respectfully challenge decisions when they disagree, even when doing so is uncomfortable or exhausting. Leaders have conviction and are tenacious. They do not compromise for the sake of social cohesion. Once a decision is determined, they commit wholly.
    ps: 不同意就提出来,如果有分歧就意见保留。
  14. 达成业绩 Deliver Results
    ​领导者会关注其业务的关键决定条件,确保工作质量并及时完成。尽管遭受挫折,领导者依然勇于面对挑战,从不气馁。
    Leaders focus on the key inputs for their business and deliver them with the right quality and in a timely fashion. Despite setbacks, they rise to the occasion and never settle.
    ps: 目标导向。
  15. 致力于成为全球最佳雇主 Strive to be Earth's Best Employer
    领导者致力于打造一个更安全、更高生产力、更高效、更多元、更公平的工作环境。领导者具备同理心,享受工作乐趣,并帮助他人也在工作中获得乐趣。领导者时常自省:团队成员在成长吗?他们是否被赋能?是否准备好迎接未来?领导者对员工的个人成功拥有愿景和承诺,无论这成功是在亚马逊还是在其他地方。
    Leaders work every day to create a safer, more productive, higher performing, more diverse, and more just work environment. They lead with empathy, have fun at work, and make it easy for others to have fun. Leaders ask themselves: Are my fellow employees growing? Are they empowered? Are they ready for what's next? Leaders have a vision for and commitment to their employees' personal success, whether that be at Amazon or elsewhere.
    ps: 无论哪家公司肯定是老板赚钱第一,只能当口号讲讲,员工也姑妄听之。
  16. 成功和规模带来更大的责任 Success and Scale Bring Broad Responsibility
    亚马逊诞生于车库,但并未止步于此。亚马逊的业务规模庞大,对世界产生着影响,但我们还远非完美。我们必须时刻保持谦虚,并谨慎思考我们的行动带来的潜在影响。我们所在的社区、地球和后代需要我们每日精益求精做到更好。为了惠及客户、员工、合作伙伴以及全球更多人,我们必须抱着进步的决心开启每一天,并在每天结束时,深信明天可以更有作为。领导者要创造远超其所消费的更多价值,做到发现问题、并推动事物向更好的方向发展。
    We started in a garage, but we're not there anymore. We are big, we impact the world, and we are far from perfect. We must be humble and thoughtful about even the secondary effects of our actions. Our local communities, planet, and future generations need us to be better every day. We must begin each day with a determination to make better, do better, and be better for our customers, our employees, our partners, and the world at large. And we must end every day knowing we can do even more tomorrow. Leaders create more than they consume and always leave things better than how they found them.
    ps: 一般来说,能对客户负责就很不错了,如果还能对员工负责就更厉害了,如果还要讲社会责任就有点高山仰止了。大公司还是要讲讲社会责任的。

#655 Windows 11

2021-10-15

https://www.microsoft.com/zh-cn/windows/windows-11-specifications

主要的变化

  1. 新的 UI 设计
    根据网上流传的图片,还挺好看的,令人耳目一心
  2. 支持 Android App

其他:

  1. 新的应用商城
  2. 整合了微软的 Teams 作聊天功能
  3. 游戏相关的功能
  4. DirectX 12 Ultimate
  5. DirectStorage
  6. Auto HDR
  7. XBox 相关整合

硬件要求

CPU (1GHz,双核),内存 (4G),磁盘 (64G)

  1. CPU: 1GHz,双核
  2. 内存: 4G
  3. 磁盘: 64G
  4. UEFI 安全启动
  5. TPM 2.0
  6. 显卡:支持 DirectX 12, WDDM 2.0 驱动

CPU, 内存, 磁盘方面的要求,主流的配置应该都能满足。
UEFI 安全启动

检测工具

MS 官方工具只能给出一个是否的答复,太弱了(正在开发新的监测工具)。

社区有提供一个检测工具:WhyNotWin11.exe (GitHub 下载)

第一次检测:

WhyNotWin11 Result Before

  1. 引导方式:Legacy
  2. CPU 兼容性:不支持
  3. 硬盘分区形式:分区形式不是 GPT
  4. 安全启动:禁用或未检测到
  5. TPM 版本:不存在 TPM 模块或 BIOS 禁用

除了 CPU 之外,其他几项都可以在 BIOS 中设置。
TPM:如果是 Intel 就找一下 Platform Trust Technology, AMD 可能是 fTPM。

WhyNotWin11 Result After

我的 CPU 是六代 i5,这就真的没办法了,i5 的话,最低要求是八代 (完整的 CPU 要求清单:Windows 11 supported Intel processors

抛弃才发布六年(2015/09)的六代 CPU 绝壁是一个愚蠢的决定,希望微软耗子喂汁!

Tiny11(2023-02-07)

根据微信公众号高效程序员文章《Win11 极限精简版发布:2G内存就能流畅运行!》中的信息,有人基于 Windows 11 Pro 22H2 打造了 Tiny11,不需要 TPM 和安全启动。

#652 元宇宙

2021-10-10

元宇宙

最近总听说这个词,这到底是是个啥?

元宇宙(英语:Metaverse)一词由前缀“ meta”(意思是超越)和词干“ verse”(通过逆向构词法从“宇宙(universe)”得来)组成;简称:MVS;这个词通常用来描述未来互联网迭代的概念,由连接到一个可感知的虚拟宇宙的持久、共享的3D 虚拟空间组成。广义上的元宇宙不仅指虚拟世界,还指整个互联网,包括增强现实的整个范围。

历史

这个词是在尼尔·斯蒂芬森在1992 年的科幻小说《雪崩》中创造的,其中人类作为化身,在一个使用现实世界模拟的三维虚拟空间中与彼此和软件客户端进行交互。斯蒂芬森用这个词来描述一个基于虚拟现实的互联网后继者。类似于元宇宙的概念很早就以各种名称出现在赛博朋克小说类型中,最早可以追溯到1981 年的中篇小说《真实姓名》。史蒂芬森在《雪崩》的后记中表示,在完成小说后,他了解了《Habitat》 ,这是一款类似于元宇宙的大型多人在线角色扮演游戏。

看这个解释,就是虚拟世界啊,应该是《第二人生》,《头号玩家》类似的概念。
在回头看看国内的相关新闻,这通概念炒作,估计是有人缺钱了。

Update @ 2021-10-29

扎克伯格宣布 Facebook 公司更名为 Meta,就是来自 Metaverse,股票代码也由 FB 改成 MVRS,同时更改公司发展方向为“元宇宙优先”。

社交网络中的种树、种菜、养鸡、停车、开餐厅确实有很多人喜欢玩,或许今后技术发达之后,科幻电影中的那些第二人生的场景也会真的出现,但我不认为目前很有意义。
虽然可能 Facebook 的新战略能为他们带来新的赢利点,但对于其他人来说参考价值不大。
尤其是在中国,我们还是比较注重现实世界一些。

参考资料与拓展阅读

#651 c const

2021-10-06

C 常量

c 常量的两种实现方法:

  1. define
  2. const 关键字

const 关键字

  • 常量 const int a / int const a
    a 是一个 int 类型常量
  • 常量指针 const int *a / int const *a
    a 是一个指针,指向一个 int 类型常量
  • 指针常量 int *const a
    a 是一个指针常量(指针类型(int *)的常量), 指向的位置不能修改
  • 指向常量的指针常量 const int *const a
    同上,不过更进一步,指向位置是一个常量(const int),不能更改

问题

int main()
{
    const int a = 1;

    int *ptr = (int *)&a;
    *ptr = 2;
    printf("a = %d\n", a);

    return 0;
}

如果用 gcc 编译会输出:a = 2, g++ 的话,会输出 a = 1, WHY? 为什么 C 允许修改常量,是不是一个 BUG?

原因

参考网上诸多资料,我的理解如下:

  1. C 会给 const 常量正常分配内存,const 只会在编译时起到静态分析的作用(限定常量不能作为左值)。
  2. C++ 则是将 const 常量放在符号表,如果用指针指向这个常量,会新分配内存地址,操作也是操作的这个内存空间,符号表中存储的值不受影响。
  3. 符号表在内存布局中的那一部分?

参考资料与拓展阅读

#649 scrypt 加密

2021-10-03

在 Python 标准库 hashlib 中见过 scrypt,说是 3.6 引入。
然后,这两天看到的资讯说是 Django 4 将加入了 scrypt 做密码哈希,据说安全性比之前的 PBKDF2 更好。
PS: 由于需要 OpenSSL 1.1+ 的支持,以及会消耗更多的内存,所以不是默认选项。