One Day
17 subscribers
40 photos
3 videos
7 files
491 links
A Journal Through My Activities, Thoughts, and Notes
Download Telegram
#flutter #initState #tips
The error you're encountering is caused by trying to update the UI (noteModel.content = '#${noteModel.initialTag}\n';) within the initState method, which triggers a rebuild of the widget while it is still in the build phase. This is not allowed in Flutter, as it can lead to inconsistent states.

To resolve this issue, you should delay the update until after the build phase. You can achieve this by using WidgetsBinding.instance.addPostFrameCallback, which schedules the code to run after the current frame has been rendered.
#regex #tips
JavaScript does not have a single-line modifier. Use \S\s instead of a dot if you want to match any character including newlines.
#网友语录 如月中天
不记得啥时候从不懂就问变成了不懂就学呗🤦肯吃苦就有吃不完的苦,肯学习就有学不完的知识……
👏1
#bug #fixed
flutter最近升级到3.24版,我也第一时间跟进升级了。结果发现有坑,本来文本框复制黏贴就困难,升级后这功能干脆彻底失效了。赶紧回退到3.22。好了!
#网摘
什么样的人才是合格的父亲呢?鲁迅认为,合格的父亲,他们“要做解放子女的父母,也应预备一种能力,便是自己虽然已经带着过去的色彩,却不失独立的本领和精神,有广博的趣味,高尚的娱乐”。这就是鲁迅所说的“‘人’之父”“觉醒的人”。

—— 张向东《“救救孩子”还是“救救父亲”》
想来想去,还是应该多输出(分享),输出利人利已。更何况我们现在有自由的平台mastodon,没有人捂住我们的嘴。
#书摘 #亲历晚清四十五年
记得母亲总是这样评论别人对她的伤害和诋毁:他们对自己的伤害比对我的伤害更大。
#书摘
例如邱婧评论过的彝族诗人俄狄小丰的诗歌《汉字进山》:

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

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

我只是个汉语母语者,但我也感到很震撼。普通话的普及,不但杀死一些少数民族语言,也在逐渐杀死汉族人的家乡话。这是一种进步还是一种退步?难以言说。
“他过来诋毁我,其实是对我的一种仰视”

周海媚 #观点
#happynotes
今天买了一个新域名 happynotes.today。
这下没有理由再拖延 happynotes app的上架了。
#网摘
要是不加说明的话,谁人能够想到,这首《中途送春》竟是出自日本人之手:“春送客行客送春,伤怀四十二年人。思家泪落书斋旧,在路愁生野草新。花为随时余色尽,鸟如知意晚啼频。风光今日东归去,一两心情且附陈”。

菅原道真
#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
#flutter
如果只有 AppBar 需要根据状态变化更新,那么你可以只在 AppBar 上使用 Consumer。这样做的好处是,仅当状态变化时,AppBar 会重新构建,而不会影响其他部分的 UI,从而提升性能。
30 歲仍未長大的人大有人在,可見成為一個獨立的人有多難,教育的重要性有多高。
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
#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%';
#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
'''
#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
#Dot is impressive! 我仿佛又交到了一个新朋友。不知不觉间和它聊了40分钟,要不是天色已晚,我们还会聊更久。
#网友语录

'It is easier to port a shell than a shell script.' -- Larry Wall
#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