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 2023

November 2022

  • Two useful links…

    Unsaved creations https://photos.google.com/unsaved Possibly all creations? https://photos.google.com/foryou

    Permanent link to “Two useful links from google photos you might not know”

October 2022

  • .NET Core/6:…

    We use Graylog to log everything, on Windows machines we also log into EventLog. I recently noticed for every exception in C# I got two items in EventViewer, one is Logged by our code, and the other is logged by the .net runtime I guess. It is a little bit annoying. TLDR; here's the answer: public override void OnException(ExceptionContext actionExecutedContext) { _logger.Error(actionExecutedContext.Exception); + actionExecutedContext.ExceptionHandled = true; actionExecutedContext.HttpContext.Response.StatusCode = StatusCodes.Status500InternalServerError; actionExecutedContext.Result = new ObjectResult(new ErrorResponse() { StatusCode = (HttpStatusCode) StatusCodes.Status500InternalServerError, Message = actionExecutedContext.Exception.Message, }); base.OnException(actionExecutedContext); } The key is this line actionExecutedContext.ExceptionHandled = true;. Reference

    Permanent link to “.NET Core/6: Prevent .NET runtime from logging errors that are already handled in ExceptionFilter”
  • PL/SQL: Local…

    Occasionally, we will need to define local used functions in a public procedure or a function. Fortunately, PL/SQL supports embedded functions. I spent more than an hour trying to find the correct way to use this feature. Yes. forgive me, I am a little dumb. According to my retries, the best position to put your local functions is sharp before the BEGIN symbol. And here's a sample. set serveroutput on; CREATE OR REPLACE PROCEDURE tmp12345(v_full_name IN VARCHAR2) AS localv varchar2(100); -- local function definitaions start --- FUNCTION FETCH_REAL_NAME(v_statement_name IN VARCHAR2) RETURN VARCHAR2 AS pattern VARCHAR2(100) := '^(Dr|Ms|Mx|Mr|Mrs)\s+'; full_name varchar2(100); BEGIN -- replace possible multiple spaces to one space full_name := TRIM(REGEXP_REPLACE(v_statement_name, '\s+', ' ')); IF (REGEXP_LIKE(full_name, pattern, 'i')) THEN -- REGEXP_REPLACE(string, pattern [, replacement_string [, start_position [, nth_appearance [, match_parameter ] ] ] ]) RETURN…

    Permanent link to “PL/SQL: Local function definition in a public procedure / function”

August 2022

  • MySQL…

    In MySQL, we can SELECT IF(A IS NULL, "something", A) FROM some_table; If you want to do a similar thing in PL/SQL, you need to SELECT (CASE WHEN A IS NULL THEN "something" ELSE A END) FROM some_table; If you want to get the first non-null value from several fields, you have a better choice than using the CASE keyword. SELECT COALESCE(A, B) FROM some_table see more information about the Oracle COALESCE function

    Permanent link to “MySQL IF(EXPRESSION, A, B) equivalent in PL/SQL (Oracle)”

July 2022

  • Permanent link to “Vodafone ultrahub pihole local DNS setup”
  • Permanent link to “香港老电影《甜蜜蜜》”
  • 书摘:自卑与超越

    作者:【奥】阿弗雷德·阿德勒 2013-03-30 17:45:35 人生的意义即“对整体作出贡献”。 2013-04-01 06:35:55 人的目标一旦建立,随后便会开始自我管理。 2013-04-01 06:36:29 人生的真谛就在于奉献与合作。 2013-04-01 06:38:08 他们对于人生的理解已经表现在他们的行为之中,如果他们不对自己的思想加以改变,行为自然也不会改变。 2013-04-01 06:39:15 正因为无人可以理解他们的痛苦,所以他们总是越来越自我。 2013-04-02 14:06:03 在那些孩子的心目中,他们的愿望就是法律,自己无须争取便可达到一切。他们还认为自己天生就具有某种权力,无人能及。然而,一旦他们不再成为众人的焦点,他们的位置被人取代时,便会无法忍受,他觉得周围的人都对他有所亏欠。在他们的生活中,已经习惯了只索取而不付出,他们根本不懂得如何面对生活中的问题。因为一直生活在别人的关照之中,他们已经没有了自立能力,也从不知道自己能做什么。他们的脑海中除了自己别无他物,根本不懂得与人相处、合作的益处。当有困难出现,他们唯一想到的便是求助于人。 2013-04-02 14:11:34 无论是对别人公然反抗还是将别人的善意当成恶意,都表明他们对人生的理解是错误的。 2013-04-02 14:12:13 …more

    Permanent link to “书摘:自卑与超越”

June 2022

  • Quickest fix:…

    Press Alt + Ctrl + Del => choose Task Manager find the Windows explorer process, Restart it. PS: If you use a remote desktop, Press Alt + Ctrl + End instead. It's actually not a fix; it's only a workaround. Anyway, we cannot expect there to be a perfect fix for that. Microsft just sucks.

    Permanent link to “Quickest fix: Windows - Taskbar Has Disappeared from the Desktop”
  • Permanent link to “Movie "2010 The Year We Make Contact"”

April 2022

  • Permanent link to “Movie "Awakenings" (無語問蒼天)”

March 2022

  • git diff/difftool

    set meld as an external diff tool, it is the Old way, which is no longer preferred First you will need to create a simple wrapper script for meld $ cat ~/bin/git-meld #!/usr/bin/bash exec Meld "$2" "$5" Please don't forget to add the directory containes Meld.exe to your PATH environment variable. if you are using a real Linux system instead of MSYS2, you will normally need to change Meld to meld and /usr/bin/bash to /bin/bash After that, run git config --global diff.external git-meld. Ok, you have done. Every time you run git diff, meld will be called. In case you want to temporarily disable the behaviour, run git diff --no-ext-diff Normally it is enough for your daily diff job. However, there is also another approach that you can always keep the default text diff behaviour for git diff while you use git difftool for a gui diff. Another way / Preferred way Regarding this approach, don't set the diff.external config, so we will not change the default diff behaviour…

    Permanent link to “git diff/difftool”

February 2022

  • Permanent link to “Set bash terminal integration with Visual Studio 2019”
  • Solution for Slow…

    Recently, I found it became very slow when I am logging onto my development VM, a windows server 2012R2 instance through Remote Desktop. There are many kinds of solutions in Google's search results. I tried many of them and found only this one suits me. On the Windows Server 2012 machine, disable the Large Send Offload via the following steps: Open Network Connections. Click Change adapter settings Right-click the icon of the Network card and select Properties. In Networking tab, click Configure… button. In the next window, switch to Advanced tab. Click the Large Send Offload Version 2 (IPv4) and change the value to Disabled. Click the Large Send Offload Version 2 (IPv6) and change the value to Disabled. Your RDP connection will disconnect right away after you apply the change. Don't worry, connect it back and you will find the annoying delay disappears! Reference

    Permanent link to “Solution for Slow logon via Remote Desktop to Server 2012: Disable the Large Send Offload”
  • CTE 101

    Today I first learnt the concept of CTE (Common Table Expression) from my colleague Rod. Basically, CTE can be used to improve the readability of your long and complex SQL statement. for example, without CTE, you might write the following SQL: CREATE OR REPLACE VIEW dfx.test_vw123 AS SELECT a.FIELD_A, a.FIELD_B, b.FIELD_C b.FIELD_D FROM ( SELECT MAX(FIELD_A) AS FIELD_A, COUNT(*) AS FIELD_B FROM TABLE_A ta WHERE ta.FIELD_E = 'General' GROUP BY ta.FIELD_F ) a LEFT JOIN TABLE_A b ON a.FIELD_A = b.FIELD_A with CTE, you could write the following one with better readability. CREATE OR REPLACE VIEW dfx.test_vw123 AS WITH TABLE_A_STATS AS ( SELECT MAX(FIELD_A) AS FIELD_A, COUNT(*) AS FIELD_B FROM TABLE_A ta WHERE ta.FIELD_E = 'General' GROUP BY ta.FIELD_F ) SELECT a.FIELD_A, a.FIELD_B, b.FIELD_C b.FIELD_D FROM TABLE_A_STATS a LEFT JOIN TABLE_A b ON a.FIELD_A = b.FIELD_A; For further information about CTE, click Reference I also found another article about CTE in Chinese.

    Permanent link to “CTE 101”

January 2022

  • 读书笔记:也许你该找个人聊聊

    也许你该找个人聊聊 洛莉·戈特利布 序:當痛苦可以被言説 2022-01-07 23:23:04 你沒法逃避痛苦,只能承認。 2022-01-07 23:24:15 但最根本的辦法,説來説去只有一個,就是誠實。誠實地承擔來訪者遭遇的無常,也誠實接受自己哪怕有此覺悟,仍會有無法負擔之重。 2022-01-08 23:20:49 我們改變不了問題,但我們可以改變對問題的態度。或者説,只要能夠看到問題的存在,就已經改變了面對問題的態度 2022-01-08 23:21:30 洛莉的故事,所有人的故事,説到底都是同一件事——我們無法逃避痛苦,只能承認。 2022-01-08 23:41:35 不要心存幻想。這個世界沒有奇跡。你無法逃避你所遇到的痛苦,心理學也不能提供任何幻想,但不要忘了,世界上也有這樣的地方,有這樣一些人,可以直面這個無處可逃的、困惑的、痛苦的你。你們坐在一起,隨便談談。你可以言説真實的你,而這就是心理咨詢的奇跡所在。 …more

    Permanent link to “读书笔记:也许你该找个人聊聊”
  • Permanent link to “Don't look up”
Archive of 2021