人生 波澜壮阔

Reading: The Nvidia Way

中文标题: 推荐:[英伟达之道] 这两天读了《The Nvidia Way》这本书,总体感觉非常不错。英语原版比较简单,推荐大家读原版。推荐原因有三点: 关于英伟达的发展,书中的故事线非常清晰。 黄仁勋作为英伟达的掌舵人,性格特征很迷人。 英伟达的企业文化与众不同,值得借鉴。 英伟达的发展历史还是挺有趣的,就是在那个硅谷兴起的年代,当下的巨头在那时还只是初创公司,起起伏伏,最终成为巨头。很有历史感。 就黄仁勋本人而言,他让我觉得印象最深刻的,就是太普通了。台裔美国人,普普通通的家庭背景,普普通通的起点。相比之下,乔布斯则是与众不同。除了被广泛模仿的穿衣风格,普通人很难再从乔布斯身上学到什么东西。 就是因为黄仁勋看起来普普通通,反而能让我很明显地看出他的闪光点,并且拿来学习和借鉴。比如当下AI浪潮,与其说是英伟达撞在了风口上,不如说是英伟达一手促成了这个风口。英伟达和AI,可以说是“鸡和蛋的关系”:英伟达在很早之前就在准备游戏领域之外的显卡应用: 和高校合作推广 CUDA 来做并行计算,和 Adobe 合作开发 GPU 加速。没有英伟达在这些领域的投入,AI模型就无法训练的那么快,AI浪潮也就不会来得那么快。说白了,黄皮衣早就不满足于只赚游戏佬的钱了,他很清楚未来企业端的才是营收大头。 关于显卡的定价,书中也提到,黄皮衣就是认定了游戏用户愿意为顶尖的性能多花钱,所以从一开始的时候,价格就是比较高。这一点也从侧面反映出,黄皮衣虽然是做技术出身,但是商业策略非常出色的。从目前的状况来看,只要 AMD 和 Intel 的显卡对英伟达没有威胁,英伟达的显卡价格就不会降。 关于黄仁勋做决策的过程,我觉得有两点最值得学习: 黄仁勋是技术出身的创始人,他自己也通过不断地学习和努力工作,来保持对技术的敏锐度。我觉得在这一点上,国内的雷军是相似的。 黄仁勋也有很强的商业头脑和管理能力。他的这些能力也是后天培养的,是通过实践管理英伟达,学习其他公司的成功或失败的管理经验,来培养的。 当然天生的因素也有,比如黄仁勋的智商和好胜心。只是这些因素比较难被学习。 书里还有很大的篇幅在讲英伟达的企业文化,我觉得很有意思。黄仁勋作为技术出身的创始人,是在下狠功夫来防范大公司病。我没在英伟达工作过,但是从书里看,英伟达的组织结构还是非常有效的。至少从一个程序员的角度来说,是很令人向往的。

June 28, 2025

Django Beginers - Map Bootstrap5 Alert Styles to Django Message Tags

中文标题: 连接 Bootstrap5 Alert 样式和 Django Message Tags 在开发过程中,AI 生成了如下的代码: {% if messages %} <div class="alert alert-{{ message.tags }}" role="alert"> {{ message }} </div> {% endif %} from django.contrib import messages ... messages.add_message(request, messages.ERROR, 'Info message') 但是,AI 生成的代码无法工作,因为 Bootstrap5 Alert 样式和 Django Message Tags 之间没有直接的映射关系。 在这里,我们想要的是红色的错误消息,但因为上述原因,我们实际看到的只有文字,没有 alert 样式。 为了实现这个目标,我们需要新增一个 filter, 在模板中使用。 如下是新增的 filter 文件 your_django_app/templatetags/template_filters.py # api2d/templatetags/template_filters.py from django import template from django.contrib.messages import constants register = template.Library() @register.filter def bootstrap_alert_class(message_tag): """ Maps Django's message tags to Bootstrap's alert classes....

June 5, 2025

Django Beginers - Difference Between login_required and LoginRequiredMixin

中文标题: login_required 和 LoginRequiredMixin 的区别 Both login_required and LoginRequiredMixin serve the same purpose of restricting access to authenticated users, but they’re used in different contexts: @login_required (Function-Based Views) Type: Decorator Usage: Used with function-based views How it works: If user is not logged in, redirects to settings.LOGIN_URL Passes the current path in the query string as ?next=/path/ Example: from django.contrib.auth.decorators import login_required @login_required def my_view(request): return HttpResponse('This view requires login') LoginRequiredMixin (Class-Based Views) Type: Mixin class Usage: Used with class-based views How it works: Must be the left-most mixin in the inheritance list Implements dispatch() to check authentication Also redirects to settings....

June 4, 2025

Django Beginers - Difference Between Blank and Null

中文标题: Blank 和 Null 的区别 Forshort, null is for database, blank is for form. Below are common combinations: Required field (default) name = models.CharField(max_length=100) # blank=False, null=False Optional field (with null in database) middle_name = models.CharField(max_length=100, blank=True, null=True) Optional Field with Empty String nickname = models.CharField(max_length=100, blank=True, default='') Important Notes For string-based fields (CharField, TextField), it’s often better to use blank=True with default='' instead of null=True to avoid having both NULL and empty strings in the database....

June 4, 2025

Book Review: Clean Code

I just finished reading this book: Clean Code: A Handbook of Agile Software Craftsmanship Clean Code: A Handbook of Agile Software Craftsmanship. It’s the best professional book I have ever read. This book gives excellent advices to write clean code which is highly readable and well structured. The code examples provided in this book is as good as an article. The reading experience is really smooth. Also, the author as a sense a humor, which makes the book more fun than the others....

February 22, 2023

Book Review: Jenkins2 Up and Run

I’m reading this book, and find it provides a systematic view of Jenkins 2, as well as many tips. It definitely worths reading. Below is a brief summary of what I have learned from this book: Jenkins 2 introduces the Declarative Pipeline, which is different from the Script Pipeline from Jenkins 1. The Declarative Pipeline is recommended over the Script Pipeline. A comprehensive pipeline should includes the following parts: Build Deploy Test Release Staging Production The declarative pipeline has a clear structure, as the following picture shows (taken from the book)....

January 21, 2023

[ETL] A Quick Way to Check If Files Are Landed Completely

Introduction When working for ETL projects, I find there is a need to check if files are landed (or downloaded) completely for next-step processing. We may suffer data lost if we process the files immediately when they are still being transferred. The ideal case is to negotiate a signal with your up-steam. The signal will be shown when all files are finished transferring. In this case, you don’t need to perform an landing check....

January 15, 2023

[Article] Revist 'iterator' in Depth

Introduction I’m using Google Bigquery in Python and find that the library uses iterator a lot. I’m curious about why they design the library in that way. To have a better unstanding, I revisit the concepts of iteratable and iterator. This article will show you the difference between iterator and iteratale, how the for loop works differently on iterator and iteratale. What is the difference between iterator and iteratale? I take the following quote from Python’s wiki:...

December 22, 2022

[Books] 足利女童连续失踪事件-清水洁 & 李沧东

足利女童连续失踪事件 / [日] 清水洁 Police systems are corrupted all over the world. This is how I feel after reading this book, as well as watching korean dramas. I highlighted the following part: 最后,风间议员责问道:“侦查机关重启调查,抓捕 真凶,难道不是体恤家属,防止案件再度发生应尽的责任 吗?” 小川副大臣答道:“如果时效已过,就不能追诉。我 不是说重新搜捕毫无意义,可找到嫌疑人,将其公之于 众,难道不会产生人权问题吗?” 我目不转睛地盯着小川副大臣,愤怒涌上心头——践 踏了菅家人权的法务省不去将真凶绳之以法,反而一口 一个凶手的人权,这不可笑吗?小川副大臣的回答分明在 说,凶手逍遥法外的事实以及被害人家属的感受并不重 要,所谓凶手的人权及时效才是最重要的。 The modern society is distorted and this is only a tip of the iceberg. The COVID restrictions in China during the post pandemic time is another example. People die not because of the virus, but the governance....

October 16, 2022

[Book] La Fabrique Du Consommateur / 制造消费者

This book tells the story of how humans from working for surviving to for shopping. I already know it, but without a systematic view before reading this book. It makes me realize a big problem in modern society is that we are far away from production and waste in our daily life. We buy everything from supermarkets instead of producing them by ourselves. The wastes are throwed into the trash bin and we don’t have a clear picture about how they are processed or what kind of polutions it will produce....

September 24, 2022