书摘:隐谷路 : 一个精神分裂症家族的绝望与希望

2022年12月在多看阅读上读了这本书,这是导出来的读书笔记

2022-12-30 09:07:52
由于缺乏对自身疾病状态的认识,他们常常会被非自愿地送进精神专科医院接受治疗,继而被社会慢慢疏离。受幻觉、妄想等精神病性症状的影响,患有精神分裂症的个体往往是无法被人理解但又极其渴望被理解的,他们有着丰富的内心世界,丰富到会将他们困住,丰富到会变成一堵阻止他们与他人交流的高墙。

2022-12-30 12:17:12
他们会声称自己总是听到某种声音,会说这些声音给了他们某种指示,让他们去做某些特定的事情。这些事情在外人看来或许显得不可理喻,但对精神分裂症患者来说却是可以真切“感受”到的。

2022-12-28 09:19:41
唐纳德现在服用的是氯氮平,这是精神病治疗中最后的选择,效果极佳,伴随的风险也极高。这些极端的副作用包括心肌炎、白细胞数量降低,甚至癫痫。与精神分裂症斗争50年的结局之一是,治疗迟早会变得和疾病本身一样摧残健康。

2022-12-28 11:45:30
精神分裂症导致病人过于情绪化,使病人的个性更为突出。而此时,病人根本无法觉察自己的激烈表现。对于病人的亲朋来说,这种疾病是难于理性地去面对的,而这会引来恐惧。精神分裂病人对家庭的影响主要体现在感情的转移上,仿佛家庭的重心永远地倾向了病人。哪怕只有一个孩子患有精神分裂症,这个家庭内部的秩序也会彻底发生改变。

…more

Keep the the same order as input data when using `WHERE fieldName IN(fieldVal1, fieldVal2)`

Don't waste time; here's the sample code with the Oracle database.

SELECT * FROM SampleTable WHERE sample_field in (7,3,4,6) ORDER BY INSTR(',7,3,4,6,',  ',' || sample_field || ',');

Two useful links from google photos you might not know

Unsaved creations

https://photos.google.com/unsaved

Possibly all creations?

https://photos.google.com/foryou

.NET Core/6: Prevent .NET runtime from logging errors that are already handled in ExceptionFilter

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

PL/SQL: Local function definition in a public procedure / function

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 REGEXP_REPLACE(full_name, pattern, '', 1, 0, 'i');
		ELSE
			RETURN full_name;
		END IF;
	END;
	FUNCTION FETCH_MIDDLE_NAME(full_name IN VARCHAR) RETURN VARCHAR AS
		middle_name VARCHAR2(100);
	BEGIN
		middle_name := SUBSTR(full_name, INSTR(full_name, ' ') + 1, INSTR(full_name, ' ', 1, 2) - INSTR(full_name, ' ') - 1);
		IF (LENGTH(middle_name) > 10) THEN
			-- return initial instead
			RETURN SUBSTR(middle_name, 1, 1);
		ELSE
			RETURN middle_name;
		END IF;
	END;
	-- local functions definitaions end ---
BEGIN
	-- main logic here
	localv := v_full_name;
	DBMS_OUTPUT.PUT_LINE(localv);
	DBMS_OUTPUT.PUT_LINE(FETCH_MIDDLE_NAME(FETCH_REAL_NAME(v_full_name)));
END;
/