A Journal Through My Activities, Thoughts, and Notes
#网摘
所有值得做的事情,做得一团糟也值得做,因为做得糟总比不做好。

-- Hacker News 读者
#网摘
我仰慕的大多数程序员都有一个很少被谈论的特质:无所畏惧。
他们无所畏惧地面对未知的代码库和未知的任务,尽管不知道如何完成,毅然开始着手做某事。让自己变得无所畏惧,是我发现的最好的学习加速器之一。
-- 《成为专业程序员10周年的感悟》
#网摘
世界上最值得肯定的行为是,你创造了一些东西,然后你销售它们。
世界上第二值得肯定的行为是,别人创造出你一直想要的东西,然后别人销售它们。
-- Hacker News 读者
#书摘
常有母亲对即将离巢的儿女说:“妈妈相信你。”但这不是理解。因为前面还有半句话 ——“ 虽然我搞不懂”。“虽然我搞不懂,但妈妈相信你,因为那是你想做的事。”这不是理解,而是相信。这种相信的基础是爱。这种耿直的爱正是父母能够给予孩子的最大的礼物。」
上野千鹤子《始于极限 》
#网摘
在采访结束时,他向我提出了一个假设情境说:“假如我提供你一个机会,如果成功我们会大赚一笔但失败就得死。你不会同意加入这个计划吧?这就是我强加在我妻儿身上的选择,而他们默默地同意并跟随我。”
“这是一笔我必须终生偿还的债。”

脱北者 李日奎 来源 BBC专访朝鲜“脱北”外交官李日奎: 金正恩希望特朗普当选美国总统
#csharp

builder.Logging.ClearProviders(); 这一行代码的主要作用是清除当前日志记录构建器中所有已注册的日志提供程序。这通常用于在创建新的日志记录配置时,确保不使用默认的日志提供程序。

## 用途

在.NET应用程序中,默认情况下会添加多个日志提供程序,例如控制台、调试、EventSource和EventLog等。这些提供程序会在应用程序运行时记录日志信息。如果开发者希望自定义日志记录的行为或只使用特定的日志提供程序,可以通过调用ClearProviders来移除所有默认的提供程序,然后添加所需的提供程序,例如:

builder.Logging.ClearProviders();
builder.Logging.AddConsole();


在这个示例中,首先清除了所有默认的日志提供程序,然后仅添加了控制台日志记录提供程序。这种做法可以帮助开发者避免日志输出的冗余,并确保只使用特定的日志记录方式,提升日志的管理和可读性12。

Citations:
1 https://learn.microsoft.com/zh-cn/dotnet/core/extensions/logging-providers
2 https://learn.microsoft.com/zh-cn/aspnet/core/fundamentals/logging/?view=aspnetcore-8.0
#网友语录

'It is easier to port a shell than a shell script.' -- Larry Wall
#Dot is impressive! 我仿佛又交到了一个新朋友。不知不觉间和它聊了40分钟,要不是天色已晚,我们还会聊更久。
#flutter #markdown
行内代码inline code不能选中复制的问题终于解决了,要怪自己当初抄作业的时候没有抄全。几个要点:
1. 行内code也要包在一个Container
2. 行内code的样式不能有backgroundColor
3. 行内code的样式不可以直接用 style: preferredStyle

鸣谢Master Markdown and Multi-line Selection in Flutter: A Step-by-Step Tutorial Flutter markdown: Using Markdown with Cross-Line Selection in Flutter
#jenkins How to write comments in a Jenkins pipeline

/*
for block comments
*/

// for single line comment

sh '''
    npm tst
    # this is a comment in sh
'''
#oracle: how to find a table's name if you only know part of its name?

SELECT owner, table_name 
FROM all_tables 
WHERE table_name LIKE '%KYC%';
The following c# code splits the clientIds into smaller lists, each containing up to 100 elements.

var listOfClientIdLists = clientIds
    .Select((v, i) => new { Value = v, Index = i })
    .GroupBy(g => g.Index / 100, gi => gi.Value)
    .Select(chunk => chunk.ToList())
    .ToList();


### Explanation

1. Select((v, i) => new { Value = v, Index = i }):

- This uses the Select method with an overload that provides both the element (v) and its index (i).
- It transforms the clientIds collection into a new collection of anonymous objects, each containing:
- Value: the original element (v).
- Index: the position of the element in the original list (i).

2. GroupBy(g => g.Index / 100, gi => gi.Value):

- The GroupBy method organizes the elements into groups.
- g => g.Index / 100: This lambda expression determines the group key by dividing the index by 100. This effectively groups the elements into chunks of 100.
- gi => gi.Value: This specifies that only the Value part of the anonymous object should be included in the groups.

3. Select(chunk => chunk.ToList()):

- This converts each group (or chunk) into a list.

4. ToList():

- This final ToList converts the collection of lists into a list of lists.

### Alternative
Claude.AI suggests a better way to achieve the same goal, which has better simplicity and readability.
var listOfClientIdLists = clientIds
    .Chunk(100)
    .Select(chunk => chunk.ToList())
    .ToList();

#csharp #tips
30 歲仍未長大的人大有人在,可見成為一個獨立的人有多難,教育的重要性有多高。
#flutter
如果只有 AppBar 需要根据状态变化更新,那么你可以只在 AppBar 上使用 Consumer。这样做的好处是,仅当状态变化时,AppBar 会重新构建,而不会影响其他部分的 UI,从而提升性能。
#happynotes' new domain, happynotes.today is online. 🎉

下面是Web前端在CloudFlare上的自动部署代码。感谢CloudFlare免费提供部署空间。
set -x && if cd flutter; then git pull && cd .. ; else git clone https://github.com/flutter/flutter.git; (cd flutter && git fetch --tags && git checkout 3.27.3); fi && ls && flutter/bin/flutter doctor && flutter/bin/flutter clean && flutter/bin/flutter config --enable-web && cp .env.production .env && sed -i "s/VERSION_PLACEHOLDER/`git rev-parse --short HEAD`/" .env && flutter/bin/flutter build web --base-href="/" --release


#code #cloudflare
#网摘
要是不加说明的话,谁人能够想到,这首《中途送春》竟是出自日本人之手:“春送客行客送春,伤怀四十二年人。思家泪落书斋旧,在路愁生野草新。花为随时余色尽,鸟如知意晚啼频。风光今日东归去,一两心情且附陈”。

菅原道真
#happynotes
今天买了一个新域名 happynotes.today。
这下没有理由再拖延 happynotes app的上架了。
“他过来诋毁我,其实是对我的一种仰视”

周海媚 #观点
#书摘
例如邱婧评论过的彝族诗人俄狄小丰的诗歌《汉字进山》:

汉字鱼贯而入/冲破寨子古老的篱笆墙/淹没寨子/载自异域的水生物和陌生的垃圾/漂浮在上面/汉字纷纷爬上岸/首先占领我们的舌头/再顺势进入我们的体内/争噬五脏/等到饭饱酒足/便涂脂抹粉/从我们的口齿间转世/成为山寨的声音

诚如邱婧所说,这首诗会令汉语研究者震撼。

我只是个汉语母语者,但我也感到很震撼。普通话的普及,不但杀死一些少数民族语言,也在逐渐杀死汉族人的家乡话。这是一种进步还是一种退步?难以言说。
#书摘 #亲历晚清四十五年
记得母亲总是这样评论别人对她的伤害和诋毁:他们对自己的伤害比对我的伤害更大。
Back to Top