Scribbles for my bad memory

Menu

Menu

  • Blog
  • Email
  • Feed
  • Draft
  • Log in

Categories

  • Tutorial
  • Database
  • English
  • Tips
  • Networking
  • Git
  • Movies
  • Essays
  • Programming
  • Linux

Pages

  • About me
  • Links
  • Vegetable Garden

Recent Posts

  • 网友语录 - 第33期 - 能睡好觉,就是人生最好的福报
  • 网友语录 - 第32期 -…
  • Useful Oracle SQL syntax…
  • Update your flutter app icons…
  • 网友语录 - 第31期 -…

Archive

  • May 2025
  • April 2025
  • March 2025
  • February 2025
  • January 2025
  • December 2024
  • November 2024
  • October 2024
  • September 2024
  • August 2024
  • July 2024
  • June 2024
Archive of 2022

December 2021

  • Microsoft Wubi…

    I use the Wubi-pinyin input method on macOS and Linux systems by installing the Rime input method framework. On a Windows system, Rime is also available if you have the Administrator privilege. Unfortunately, I am only a standard user on my laptop at work. So I have to find a not-bad alternative and the built-in Microsoft Wubi looks like a good choice. It actually tastes delicious. No compatible issue, it is Wubi-pinyin compatible, and very fast. The only thing I might complain about is that you cannot press Enter key to send out the code you input onto the screen, but pressing the Shift key twice did the trick. In total, it is a good choice, and most importantly, it is built-in.

    Permanent link to “Microsoft Wubi (微软五笔) is good”
  • MSYS2 TIPS

    You might be surprised why I am using MSYS2 so much these days. In short, my new job doesn't allow me to use Linux at work. I cannot bear the CMD.EXE and PWSH.EXE, they might be great tools for someone else, but definitely not for me. If you visit a shared folder like /c/vagrant, you will get the infamous Too many levels of symbolic links error message. Fortunately, we have a solution: add a new user Environment variable MSYS=nonativeinnerlinks. I assume you know how to add a user environment to the windows system. If it doesn't take effect, save your current work and reboot. I didn't reboot my Windows 11 VM, but I did have restarted the Windows terminal application to ensure the new MSYS2 terminal will work with the links! If you prefer using Git for windows in MSYS2 but don't want to install GitBash because GitBash is also built on MSYS2, Install Git for windows inside MSYS2 will help you! BTW, git_bash_for_windows_is_based_on_msys2_why_not is another very good reference for this…

    Permanent link to “MSYS2 TIPS”

November 2021

  • Rider Terminal tips

    Stop Leaving the Terminal when you press the Escape key. It is really annoying when you are a vim fan like me! here's the solution Go to "Settings | Tools | Terminal" and click "Configure terminal keybindings". Find "Plug-ins | Terminal | Switch Focus To Editor" action and change its keyboard shortcut (by default "Escape") via the context menu. Keybindings are IDE-wide, so there is no need to change them for each project. Using msys2 bash as the embedded terminal: at Settings > Tools > Terminal Environment Variables: CHERE_INVOKING=1 Shell path: c:\msys64\usr\bin\bash.exe --login Unfortunately, the environment variables above work only on the current project; It is definitely a tedious process that you have to repeatedly set it up for every project. So I eventually found a better way to achieve the same goal without setting up the Environment variables in Rider. Here is the answer Reference: Shell path: C:\msys64\msys2_shell.cmd -defterm…

    Permanent link to “Rider Terminal tips”

October 2021

  • Fix Printer Spooler…

    One of my old classmates asked me to fix the issue that her computer cannot print anything. Thanks to TeamViewer, I could connect to her computer then fix the issue. I found that the Printer Spooler service is down and could not start. When you start it, it started and then automatically shuts down in 2 seconds. Google helped me. For this case, in short: Remove all files in C:\Windows\system32\spool\PRINTERS directory After that, the service could start, and all printers came back and worked.

    Permanent link to “Fix Printer Spooler service cannot start issue on Windows 7 system”
  • Fritz 7490: Root…

    tl;dr The root cause is that the default route was not set to the router's IP address. My journey to resolve the issue: The issue is that port mapping can work with my raspberry pi while it couldn't work with a virtual machine in the same LAN. I firstly think it must be a bug from the router. I upgrade the router to its latest firmware, but it still doesn't work. I google back and forth, I learned much from all kinds of answers, but they were just not my case. I almost decided to give up. Then I found the following answer from E. van Putten, he answered this question and nobody gave his answer a "Like"!!! In case you landed on this page because you can't reach a server running inside a Xen Guest from the internet (but can connect locally), then read on... The fritzbox can get confused by different OS'es appearing from the same MAC-address etc. (could happen while you are setting up / experimenting with Xen) The fritzbox has seemingly duplicate entries in the list, but with…

    Permanent link to “Fritz 7490: Root cause for Port mapping failure issue on a vagrant virtual machine”
  • Setup PiVPN on a…

    PiVPN should be easy to setup at any debian/ubuntu family distribution. However, my case wasn't. The first issue I met is Can't call method "set" on an undefined value at /usr/share/perl5/Debconf/FrontEnd.pm line 126, line 5., and I found a useful anwser from https://github.com/pivpn/pivpn/issues/718, which is apt-get install --reinstall debconf it worked! though I don't know the root cause. The second issue is rather weird, it simple stuck after showing ::: Backing up the openvpn folder... message. What's wrong with that on earth? Unfortunately, I couldn't find anything useful from google/stackoverflow.... I have to find out the root cause by myself. ps -ef command shows there is a wget -qO- https://github.com/OpenVPN/easy-rsa/releases/download/v3.0.7/EasyRSA-3.0.7.tgz process running. Why it is running so long and looks never end? I copied the wget command and run it manually. aha, I found the cause! wget…

    Permanent link to “Setup PiVPN on a Vagrant virtual machine that is running Ubuntu 20.04”

September 2021

  • What is good code?…

    I was asked those questions recently and the following is my answer: What is good code? Good code has at least the following characteristics: Good code has good readability, so it is easy to understand. Good code is well organized, a clear and reasonable directory structure with meaningful filename is the basic element of good code. Every class, method, variable has a deliberate and meaningful name. You can know the purpose of an identifier through the name at first glance. Methods should be short, every method should only do one thing. Good code does not use magic numbers and hard coded strings. Good code has automated tests, so it is easy to maintain or change. Good code has a good architecture, so its components can easily be replaced by another. Good code has explicit dependencies. Good code has good performance. It does not do database queries or other time-consuming jobs in a loop. It should use a queue for certain situations It should use a full-text search engine instead of…

    Permanent link to “What is good code? and what attributes do you think an ideal software developer demonstrates?”
  • Approval Testing is…

    Just record a few tips here: [UseApprovalSubdirectory("Approvals")] can be used to set up the directory that saves the approval results. It can be used for a test class or a test method. Links ApprovalTests.Net Project

    Permanent link to “Approval Testing is tasty”
  • An awesome entry to…

    For some reason, I was told an interesting github repo, The Gilded Rose Kata. It really grasps my attention. The code's behavior is correct, but both code quality and code style are terrible. The author of the repo made it so bad on purpose. So it is the best material to teach newbies how to refactor. From the Readme file of the repo, I learnt some new tools, one is the text based approval test. I actually know that concept before many years ago, but never practiced it. I just found it is easy to setup and easy to run. It tests your code from a new angle. I believe it could belong to a kind of greybox test. You need to know the code to test, but you don't know too much like other unit test methods. I have done the refactoring, and my result has been put on Github.com first approach is on the main branch https://github.com/shukebeta/GildedRose-Refactoring-Kata/tree/main/csharpcore a better approach is on the other branch…

    Permanent link to “An awesome entry to better code: The gilded rose kata”
  • Git Tips: Remove…

    My colleage Joe asked me tonight, "how to remove those branches that no longer exist on remote?" In short, you have two options run git remote prune origin at times run git config --global fetch.prune true command to config your git to delete those branches every time when you run git fetch I prefer the second option, how about you? Reference

    Permanent link to “Git Tips: Remove tracking branches no longer on remote”

August 2021

  • Fix swagger stuck…

    Referenced I found the root cause is that the JSON generated by swagger is too large: Swagger outputs over 18000 lines for that API! Further research told me that two property fields contribute about 17000 lines. So how to configure swagger to ignore these two properties is the key. After googling a while, I found VeganHunter's answer in this thread Reference is the simplest. Solution for .NET Core 3.1 and .NET Standard 2.1: Use JsonIgnore from System.Text.Json.Serialization namespace. ( JsonIgnore from Newtonsoft.Json will NOT work ) public class Test { [System.Text.Json.Serialization.JsonIgnore] public int HiddenProperty { get; set; } public int VisibleProperty { get; set; } } Hope it could also help someone else. 😀

    Permanent link to “Fix swagger stuck on extend an API: How to configure Swashbuckle to ignore property on model”

July 2021

  • Permanent link to “"Wind River" is a great movie”
  • Solved: XPS 15 on…

    Previously, I have updated the firmware several times, so when I saw there's a new update, I clicked the "Update" button without too much thoughts. Yes, I got trouble this time. I got a black screen while the system is not dead. I can log into the system by pressing Alt+Ctrl+F2, no gui, but I can do something to fix it. It is good enough. I searched on my cellphone to try find something. And the following article helped me. System76 login-loop-pop In my case, I guess that the root cause could be the nvidia driver, so I followed the [Reinstall NVIDIA Driver] section in that article and it did save my life. # remove current driver sudo apt purge ~nnvidia sudo apt autoremove sudo apt clean # reinstall it sudo apt update sudo apt full-upgrade sudo apt install system76-driver-nvidia In case someone else got trapped into the same situation, I wrote my solution here and hope it helps.

    Permanent link to “Solved: XPS 15 on Pop OS 20.04 gui got stuck after updating firmware”
  • Permanent link to “The Truman Show”
  • PopOS/Ubuntu…

    By my recommendation, my new workmate He (贺) moved to Ubuntu from windows, and he was annoyed of one thing: cannot input Chinese. And I have to google again to find out the answer. This is why I wrote this list for him like people and myself. sudo apt install fcitx fcitx-rime im-config # and select fcitx as the input engine fcitx-configtool # > Add input method, remember to tick off `Only Show Current Language`

    Permanent link to “PopOS/Ubuntu fcitx-rime setup”

June 2021

  • 书摘 《半生为人》

    豆瓣链接 14年底读了这本书,这是当时的书摘。 2014-12-20 18:12:12 这一切都始于那个周日的午后,始于偶然回首的一瞬间他那冷峻而若有所思的样子对一个女孩儿的触动。 2014-12-20 18:13:34 赶二十里路用饭盒带粥,这样的事恐怕只有他才做得出来。 注: 此言差矣。沉浸在爱情中的小年轻,什么都做得出来。 2014-12-20 18:15:37 他们有时候海阔天空,国事家事天下事无所不谈;有时候话又很少,可贵在于“一切尽在不言中”的默契。 2014-12-20 18:45:57 现在我们上哪里去寻找当年的圆明园、丁家滩、十渡,又怎样才能促成当年那种背着瓶啤酒,带着干面包,在野外玩儿童年时的游戏的郊游呢? 2014-12-20 18:48:15 上午参加一个朋友的婚礼,我为他高兴,可是晚上回到家里又得知另外一个朋友被判处死刑,我的心情是可想而知的。然而,又能怎样,这就是生活。 …more

    Permanent link to “书摘 《半生为人》”
  • 我的微博自选集 (2013)

    13年5月的时候,我整理了那年3月和4月的微博。我记得为了整理微博还专门写过一个网页工具。也许有一天能把它捞出来做成一个通用的工具。 3月 相册就是相册,照片就应该是绝对的主体。 更新Blog的Blogger越来越少, 说明什么问题? 来Lava超群,创建你的独立微博站点。 Lava超群个人站,超群站,都要支持RSS全文输出。 甚至我们可以在每篇文章的末尾提供付费支持链接呀!(申请微收款功能) 烦恼的时候,要忏,不要怨。 …more

    Permanent link to “我的微博自选集 (2013)”
  • Last Christmas

    A friend on twitter recommended this film, and I watched it tonight. It was a moving movie, and I love it! Last Christmas Last Christmas I gave you my heart But the very next day you gave it away This year, to save me from tears I'll give it to someone special Last Christmas I gave you my heart But the very next day you gave it away (you gave it away) This year, to save me from tears I'll give it to someone special (special) Once bitten and twice shy I keep my distance, but you still catch my eye Tell me baby, do you recognize me? Well, it's been a year, it doesn't surprise me "Merry Christmas" I wrapped it up and sent it With a note saying "I love you", I meant it Now I know what a fool I've been But if you kissed me now, I know you'd fool me again Last Christmas I gave you my heart But the very next day you gave it away (you gave it away) This year, to save me from tears I'll…

    Permanent link to “Last Christmas”
  • A tricky issue…

    I heard my colleague Joe met a tricky bug this morning and he has no idea about it. After a brief google, I found it's a rather famous one. So many people met this issue and most of them haven't got an answer. So I dug it deeper and found a clue that locates at https://developers.weixin.qq.com/community/develop/doc/0000c6d4b6c2d0cb128a1c0475b000?_at=1566630830developers.weixin.qq.com and eventually, I found my solution. I shared it at https://developers.weixin.qq.com/community/develop/doc/000ac29db444e0b922c6caee759c00 PS: there's a common phenomenon among developers in China. Someone asks a question, and many people replyed they have met the same issue. But, no answers. I don't think all of them haven't found out their answer. People are interested in asking questions but have less interest to answer, even they finally got a valuable answer. It's a shame. I won't be that kind of person.

    Permanent link to “A tricky issue about [getImageInfo:fail image not found] painter component for WeChat Miniprogram”
  • 我的微博自选集 (2012)

    2012年,我基本就只在Lava微博发贴了,那时Lava微博已经能够自动将微博同步发表到饭否、新浪微博还有腾讯微博等7,8个平台。到13年年中的时候,Lava微博开始转型今天的校内外。一直到2018年我离开公司,我不间断的在这个平台写东西。出发点只是为自己,当然倘若同时能帮助到其他人,不亦美哉! 2012年整理好的就这些。没有9月和10月,也没有12月。也许只是懒,当时没有整理。 1月 【告诫各位女生】 男生就像大食堂里的菜,虽然难吃……但是……但是…………去得晚了居然没了! 发表于:2012-01-01 00:11:19 快速学习是一个伪命题。只有一小时一小时的学进去,持续不断的投入,方能达成目标。好的方法能适当加速这个过程,不过别忘记,找方法也需要时间。多读书,多了解,能节省一些试错的时间,如果你选书得当,读得够快,并且能充分吸收的话,算是同样并不轻松的捷径。 发表于:2012-01-01 13:45:39 开放的社会让人们可以集合记忆,自由交换记忆,进而比对记忆﹑发掘其中的错误。//一个自由开放的微博系统,即是这样一个社会。 发表于:2012-01-01 15:23:31 在一个“大者恒大”的世界里,找到自己的风格,坚持自己的风格是“弱者”的生存之道。#故事照亮未来# 发表于:2012-01-01 15:30:44 #故事照亮未来# 高科技产业上的决战点,不见得一定是谁网罗了最多最优秀的研究﹑营销人才。许多公司的崛起,靠的是明白单纯的风格﹑个性,企业环绕着一种风格,建构其管理锁链﹑孕育其组织节奏,这种公司显然比较容易找到市场上的利基,集中焦点把事情做好,也相对能禁得起景气的波动变化。 发表于:2012-01-01 15:39:11 一个人使用鼠标的方式可以反映出他的思维速度。脑筋转动越快的人,越倾向于使用键盘而不是鼠标。那些思维活跃,前途无量的家伙基本上都是手不离键盘。 发表于:2012-01-02 19:46:48 …more

    Permanent link to “我的微博自选集 (2012)”
  • 我的微博自选集 (2011)

    2011年那一年,我正带领一个小团队在点击科技开发 Lava微博。那也是我玩微博很疯狂的一年。那一年结束的时候,我有了一个想法,要把一年零散写下的微博里,把值得留存的部分集中起来,发表到当时支持长微博的 Lava微博。这个保存工作至少花了我数个小时,但它是值得的。看,这里保存着十年前的我。 2011年3月 "明哲保身", "事不关己,高高挂起", "各人自扫门前雪,谁管他人瓦上霜" 这些思想害了中国5000年, 到今天仍然有很大的市场. 请大家记住, 只求自保, 一定保不住自己. 普及公民教育, 唤醒公民意识, 刻不容缓. 3月1日13:23 来自新浪微博 据说: 很多人梦想和目标不能实现的原因有两个:晚上下不了网, 早晨起不了床。 3月2日13:59 来自新浪微博 葛剑雄教授:知识分子多少有点知识,这是他们的幸运,也是他们的不幸。有了知识,就想有运用的机会,就不会满足于有饭吃,有衣穿,有妻子儿女,这就是所谓实现自身价值。在皇权垄断一切的社会里,要实现自身价值,舍做官就别无他途。可是做了官就只能服从法律和上司,就绝对避不开现实政治。疾恶如仇会有党人那样的下场,洁身自好或许能做到,却因此而一事无成,同流合污又有违初衷,而不齿于士林,急流勇退倒也干脆,但原来的理想也随之成为泡影。 3月4日19:42 来自S60客户端 顾准语录:要像小孩捡石子一样为自己收集知识财富。一个人在任何时候都要为自己寻找一个目标,即使明知道这个目标是自欺欺人的,也要向着这个目标奋斗,否则你的生活就没有中心。 3月5日11:02 来自S60客户端 …more

    Permanent link to “我的微博自选集 (2011)”

May 2021

  • A simple nfs server…

    At the server end choose a server as the nfs-server, do things below in root role dnf -y install nfs-utils mkdir /mnt/nfs-share chown -R nobody /mnt/nfs-share/ vim /etc/exports add a line /mnt/nfs-share 192.168.178.0/255.255.255.0(rw,sync,all_squash) save and exit systemctl enable nfs-server systemctl start nfs-server At the client end dnf -y install nfs-utils mkdir /mnt/nfs-local chown -R nobody /mnt/nfs-local/ vim /etc/hosts add a line, replace 192.168.xxx.yyy to the IP addr of your NFS server nfs-server 192.168.xxx.yyy vim /etc/fstab add a line nfs-server:/mnt/nfs-share /mnt/nfs-local nfs defaults 0 0 save and exit mount -a # to confirm what you have done is right other utils: You could use showmount -e 192.168.xxx.yyy to get a share list from the nfs server.

    Permanent link to “A simple nfs server on centos”
  • Don't simple unset…

    Sometimes we need to run shopt -s dotglob nullglob before moving files including dotfiles. So there's another question, do we need to set it back afterward? The most correct answer is It's usually not clear if either dotglob or nullglob were already set before running shopt -s to set them. Thus, blindly un-setting them may not be the proper reset to do. Setting them in a subshell would leave the current shell's settings unchanged: ( shopt -s dotglob nullglob; mv /public/* /public_html/ ) Reference: Jeff Schaller's answer under this question

    Permanent link to “Don't simple unset them afterward when using `shopt` change a setting”

April 2021

  • 神奇且无害的REBASE 2014年底翻译了这篇文章,当时发表在GotGit 群组,搬过来留存一下 作者:Jeff Kreeftmeijer 发表于 2010-10-11 原文链接 大约一个月前, 以Git为主题我写了不少文章,始于@nvie 出色的git开发流程和教你写出更好的提交注释,终结于强大的reflog和惊人强大的bisect 。你猜怎么着?我竟然忘记了介绍神奇的rebase。 人们通常认为rebase是一种压合提交工具,但这并非它的看家本领。顾名思义,它的本职工作是变基(改变我们所做变更的基础)。 哦,忘掉那篇吓唬人的文章,只要清楚自己在做什么,根本不会产生什么恶果。 假设你正工作在一个名叫feature/login的新功能分支上,某个家伙实现了某样东西,并把他的代码push到了develop分支上。你需要那个东西,该怎么做? 可以把develop分支合并到你正在工作的分支,这会产生一些....乱七八糟的合并提交,不好。 也可以把我们需要的那个提交cherry-pick过来。不过经验表明虽然不是什么大问题,从一堆提交里找出需要拣选的提交,终究是个麻烦事。 Git的rebase指令允许我们先回退自己的改动(类似“倒带”),拉回另一个分支的所有变动之后(变基),在新的基础(HEAD)上“重放”我们的变更: $ git rebase develop First, rewinding head to replay your work on top of it... Fast-forwarded feature/login to develop. 仿佛在拉回那些变更之前,我们什么也没做(我们所有的改动仿佛发生那些变更之后)。这非常好,是不是?我们还能在pull的同时变基(使用--rebase选项),这样的话我们甚至都不需要离开自己的工作分支。 ##更小块的冲突 rebase让我们拥有干净的提交历史,即便在rebase的过程中发生冲突,它也是我们解决冲突的坚强后盾: $ git rebase develop First, rewinding head to replay your work on top of it... Applying: feature/login Using index info to reconstruct a base tree...…

    Permanent link to “神奇且无害的REBASE 2014年底翻译了这篇文章,当时发表在GotGit 群组,搬过来留存一下 作者:Jeff Kreeftmeijer…”
  • Tuple type in C#

    It's a rather interesting feature. I first use it the same way as the python tuple type. I immediately found I was wrong. It doesn't support using an index to visit certain element Stupid enough. I think. Soon I found the correct way, you know, the Item1, Item2 way. It's so Stupid! Then I found the best way: the named element way. Task<(List<string> orderIdList, List<string> orderNoList)> GetExpiringOrderIdListAndOrderNoList(DateTime checkTime); Ok. It's not very stupid.

    Permanent link to “Tuple type in C#”
  • Permanent link to “flameshot: a better screenshot tool with editing support for ubuntu”
  • How to install…

    The biggest problem you faced is actually the following one https://otodiginet.com/operating-system/how-to-install-snapd-on-centos-8/ and the article above answers the question very well. certbot certos

    Permanent link to “How to install certbot on CentOS8”
  • .NET Core: Set the…

    Create a middleware to do that task public static void SetCurrentCulture(this IApplicationBuilder app) { app.Use(async (context, next) => { var cultureQuery = context.Request.Headers["lang"] == "en" ? "en-US" : "zh-CN"; if (!string.IsNullOrWhiteSpace(cultureQuery)) { var culture = new CultureInfo(cultureQuery); CultureInfo.CurrentCulture = culture; CultureInfo.CurrentUICulture = culture; } await next(); }); } Use the middleware in Startup.cs public void Configure(IApplicationBuilder app, IWebHostEnvironment env, ILog logger, IExceptionEntityService exceptionEntityService) { ... app.SetCurrentCulture(); ... }

    Permanent link to “.NET Core: Set the correct CurrentCulture basing the `lang` header”

March 2021

  • Note: recover from…

    Cause: This morning, I change to the /backup directory and found I cannot write in it. So I rapidly typed sudo chown -R david:david .. then press Enter. You know what happened! All the files in / directory were changing the owner to me! I realized this by seeing an error message like "You cannot change the owner of xxx file to david". Damn, how silly I was! Unfortunately, that was not the end of my bad luck. When I try to revert it by typing sudo chown -R root:root /, I got another error message: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set. Then I tried su - root but it seems that I haven't set a root password. How can I recover my pop! OS? reboot it into single-user mode, edit the boot menu, add systemd.unit=rescue.target at the end of the boot line. In the boot console, chown -R root:root /usr; chmod 4755 /usr/bin/{sudo,dpkg,pkexec,crontab}; reboot Rather easy, right? It did cost me over 10mins! PS. I met many issues later after recovering from the…

    Permanent link to “Note: recover from accidentally changed the ownership of `sudo` command”

February 2021

  • 什么是AOP?这种在运行时,动态地将代…

    什么是AOP?这种在运行时,动态地将代码切入到类的指定方法、指定位置上的编程思想就是面向切面的编程。

    Permanent link to “什么是AOP?这种在运行时,动态地将代码切入到类的指定方法、指定位置上的编程思想就是面向切面的编程。”
  • Fix the ‘Too Many…

    In short: Change the service file, and add two lines after [Service] line, [Service] LimitNOFILE=65535 LimitNOFILESoft=65535 If you want to know more, read the Reference

    Permanent link to “Fix the ‘Too Many Open Files’ Error in a systemd service in Linux”
  • SELinux sucks?!…

    Just record what I made Nginx working with a project located in someone's HOME directory on a Linux machine with SELinux on. Nginx seems working normally, but it actually Didn't listen to a non-80 port at all. If it reports ValueError: Port tcp/8081 already defined, replace -a with -m. semanage port -a -t http_port_t -p tcp 8081 Reference1 Reference2 telnet localhost 8081 works, but telnet 192.168.168.168 8081 from another machine not working! firewall-cmd permanent add-port=8081/tcp firewall-cmd --reload Everything seems working good, but when you visit your site, Nginx just gives you a 403! You should ensure Nginx can access your project directory, everyone knows that, but is not enough when SELinux is on. setsebool -P httpd_enable_homedirs 1 setenforce 0 systemctl restart nginx systemctl daemon-reload Reference

    Permanent link to “SELinux sucks?! Safety always means inconvenient, right!”

January 2021

  • Caution: Javascript…

    I had written the following code in a project ... return s && s.value || null It works well for some days until a colleague did some code refactoring. In the beginning, s.value is a string value, and an empty string is not a valid value, so the code works well. After the refactoring, s.value became an integer, and this time 0 is a valid value. So you can imagine when s.value === 0 the code above will return null instead of 0. It leads to a bug! Therefore please use the"A || B" expression with caution!

    Permanent link to “Caution: Javascript A || B expression is handy, but it also can cause tricky bugs”
Archive of 2020