搜尋此網誌

2026年6月24日星期三

While loops

innocuous: not intended or likely to offend or upset anyone

tame something to make an animal, bird, etc. not afraid of people and used to living with them

The datetime class in Python is part of the datetime module and is used to represent both date and time together, with optional time zone support. It allows you to create, manipulate, and format date-time objects with precision, making it essential for scheduling, logging, and time-based calculations.

In Python, the % symbol is the modulus operator. It returns the remainder when one number is divided by another.

In Python, pass is a placeholder statement that literally means “do nothing.”


from datetime import datetime

wait_until = (datetime.now().second + 2) % 60

  • datetime.now().second → gets the current second (0–59).

  • + 2 → adds 2 seconds to the current time.

  • % 60 → ensures the value wraps around correctly (e.g., if current second is 59, 59 + 2 = 61, and 61 % 60 = 1).

So wait_until is always two seconds ahead of the current second.

while datetime.now().second != wait_until: print('Still waiting!')

  • This loop keeps checking the current second.

  • As long as it’s not equal to wait_until, it prints "Still waiting!".

print(f'We are at {wait_until} seconds!')

    Once the current second matches wait_until, the loop ends.
    It prints a confirmation message showing the target second.

In Python, the f in print(f"...") is shorthand for an f‑string, also called a formatted string literal. It lets you embed variables or expressions directly inside a string using curly braces {}.

name = "Tsz"
age = 25
print(f"My name is {name} and I am {age} years old.")

Output:
My name is Tsz and I am 25 years old.

A literal in Python (and in programming generally) is a fixed value that you write directly into your code. It represents itself, not a variable or expression. Examples are integer, float, string, and boolean.

from datetime import datetime

wait_until = (datetime.now().second + 2) % 60

while True:
    if datetime.now().second == wait_until:
        print(f'We are at {wait_until} seconds!')
        break

wait_until is set to 2 seconds ahead of the current second (wrapped with % 60).

The while True: loop runs indefinitely.

while → starts a loop that repeats as long as its condition is True.
True → is a Boolean literal that always evaluates to true.
So while True: means “keep looping forever” because the condition never becomes false on its own.

Inside, you check if datetime.now().second == wait_until.

When the condition is true, it prints the message and break exits the loop.


from datetime import datetime

wait_until = (datetime.now().second + 2) % 60

while True:   # outer loop runs forever
    while datetime.now().second == wait_until:   # inner loop runs only when condition is true
        print(f'We are at {wait_until} seconds!')
        break

When the condition is true, it prints the message once and then break exits the inner loop.
But notice: break only stops the inner loop, not the outer while True: loop.
That means the outer loop will continue running forever, checking again and again.


from datetime import datetime wait_until = (datetime.now().second + 2) % 60 while datetime.now().second != wait_until: continue print('Still waiting!') print(f'We are at {wait_until} seconds!')

wait_until is set to 2 seconds ahead of the current second (wrapped with % 60).
The while loop runs until the current second equals wait_until.

Inside the loop you wrote:
continue print('Still waiting!')

continue immediately jumps back to the start of the loop, skipping everything after it.
That means the print('Still waiting!') line is never executed.


from datetime import datetime wait_until = (datetime.now().second + 2) % 60 while True: if datetime.now().second < wait_until: continue break print(f'We are at {wait_until} seconds!')

Target second
wait_until is set to 2 seconds ahead of the current second, wrapped with % 60.

Infinite loop (while True:)
The loop runs continuously until you explicitly break out.

Condition check
If the current second is less than wait_until, the loop executes continue.
continue skips the rest of the loop body and goes back to the top, so nothing else happens.

Break
As soon as the current second is not less than wait_until (i.e., equal or greater), the loop executes break.
This exits the loop completely.

Final print
After breaking, the program prints the message showing the target second.

Suppose the current second is 18.
wait_until = (18 + 2) % 60 = 20.
While the clock shows seconds less than 20 (18, 19), the loop keeps spinning.
As soon as the clock reaches 20 or higher, the loop breaks.

Microsoft Copilot

三分法

「三分法」(Rule of Thirds)又稱「井字構圖法」,是視覺藝術中最經典、最穩妥的基礎構圖原則。它能避免主體呆板,透過將畫面分為九宮格來引導視覺動線,創造平衡與空間感。

核心原理
  1. 劃分九宮格:將畫面的長與寬各畫兩條等距的直線,劃分出 9 個相等的格子和 4 條分割線。
  2. 視覺焦點(交叉點):將照片的主體或重要元素,放置在四條線的四個交叉點上。
常見應用方式
  • 人物攝影:將人物的眼睛或身體軀幹對齊在垂直的三分之一線上,並為視線方向保留適當的空間。
  • 風景攝影:將地平線對齊在上方或下方的水平線上。若想強調天空,地平線放在下方 1/3 處;若想強調地面或水面,地平線則放在上方 1/3 處。
  • 引導視線:利用線條或物體(如道路、河流、橋樑)從三分之一處延伸,引導觀眾進入畫面深處。
Google AI overview

自我實現預言

ditch: to get rid of something/somebody because you no longer want or need it/them

Creeping normality is the psychological and social process by which a major, often harmful change is accepted as the new standard because it happens gradually. Also called gradualism or "death by a thousand cuts," it occurs through small, barely noticeable increments that prevent widespread alarm.

hypervigilant: extremely alert, careful, or cautious; overly aware of one's environment and the potential dangers it presents

procrastination: the act of delaying something that you should do, usually because you do not want to do it

be in a rut: to not have changed what you do or how you do it for a very long time so that it is not interesting any longer

I need to change jobs - after 15 years here I feel I'm (stuck) in a rut.

unsolicited: not asked for and sometimes not wanted

culprit: a person or thing responsible for causing a problem

connotation: an idea suggested by a word in addition to its main meaning

detrimental: harmful

attribute: to say or believe that something is the result of a particular thing

perpetuate: to make something such as a bad situation, a belief, etc. continue for a long time

A self-fulfilling prophecy is a psychological and sociological phenomenon where a prediction or belief unconsciously influences a person's behavior, causing the expectation to come true. Essentially, your thoughts and actions shape reality to match your initial assumption.

自我實現的預言(Self-fulfilling prophecy)指的是一個人或群體對某件事情的信念或期待,會影響他們的行為,而這些行為最終導致原本的信念或期待成真。換言之,因為相信某件事會發生,行為就不自覺地推動了它的發生。例子︰

  • 教育情境:老師若認為某位學生很聰明,便會給予更多鼓勵與資源,結果該學生真的表現優異。

  • 社會互動:若一個人相信自己不受歡迎,他可能會避免與人互動,導致他真的被孤立。

  • 經濟市場:投資者若普遍相信某公司會倒閉,便會拋售股票,結果公司因資金不足而真的倒閉。

Explained by Microsoft Copilot

adaptive: connected with changing; able to change when necessary in order to deal with different situations

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

dictionary.cambridge.org

Google AI overview

Trajectory of Microsoft

Kirtland is a city in Lake County, Ohio, United States. The population was 6,937 at the 2020 census.

opt: to choose to take or not to take a particular course of action

rampant: (of something bad) existing or spreading everywhere in a way that cannot be controlled

juggle: to try to deal with two or more important jobs or activities at the same time so that you can fit all of them into your life

ambivalent: having or showing both positive and negative feelings about somebody/something

trajectory: a path, progression, or line of development resembling a physical trajectory

frenetic: ​involving a lot of energy and activity in a way that is not organized

play out: enact

a veiled threat, warning, etc. is not expressed directly or clearly because you do not want your meaning to be too obvious

corny: mawkishly old-fashioned : tiresomely simple and sentimental

trey: a card numbered three or having three main pips

murky: (of people’s actions or character) not clearly known and suspected of not being honest

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

en.wikipedia.org

2026年6月23日星期二

天水圍公園的睡蓮

 

光圈先決︰f/6.3

ISO 200

快門︰1/500 秒

因相片等效焦距為 216mm,怕不夠光,所以將 ISO 調至 200。雖然 ISO 200 Noise 絕對不明顯,但相機將快門設定為 1/500 秒,根本沒有需要這麼快,下次可嘗試用 ISO 100.

2026年6月22日星期一

心理捷思法

malicious: having or showing a desire to harm somebody or hurt their feelings, caused by a feeling of hate

cascade: a number of things happening, in which each one leads to another

intrusive: too direct, easy to notice, etc. in a way that is annoying or upsetting

dwelling: a house, flat, etc. where a person lives

heuristics: a method of solving problems by finding practical ways of dealing with them, learning from past experience

心理捷思法(mental heuristics)在心理學中指的是一種快速、簡化的思考方式,用來幫助我們在有限時間與資訊下做決策。它能節省心力與時間,但也可能導致偏差或錯誤判斷。

Microsoft Copilot

revert: to come or go back (as to a former condition, period, or subject)

compelled: having to do something, because you are forced to or feel it is necessary

ingrained (in somebody/something) (of a habit, an attitude, etc.) that has existed for a long time and is therefore difficult to change

panoramic: with a view of a wide area of land

demoralizing: making somebody lose confidence or hope

huff: to say something or make a noise in a way that shows you are offended or annoyed

ditch: to get rid of something/somebody because you no longer want or need it/them

groundwork: work that is done as preparation for other work that will be done later

delve: to reach inside a bag, container, etc. to search for something

Nicole Vignola "Rewire"

hk.dictionary.search.yahoo.com

oxfordlearnersdictionaries.com

merriam-webster.com

dictionary.cambridge.org

2026年6月21日星期日

Shaping a child

mannerism: a particular habit or way of speaking or behaving that somebody has but is not aware of

Venezuela: country (a republic) bordering the Caribbean Sea in northern South America; capital Caracas area 352,144 square miles (912,050 square kilometers), population 31,869,000

tribe: a social group in a traditional society consisting of people with the same language, culture, religion, etc., living in a particular area and often having one leader known as a chief

Ye'kuana: a Cariban-speaking tropical rain-forest tribe

weird: very strange or unusual and difficult to explain

sentiment: a feeling or an opinion, especially one based on emotions

What a weird sentiment it is to think that as adults we have the ability to mould and shape a child to become who they will be in their adulthood, and most of the time we do not even realize we are doing it.

Nicole Vignola "Rewire"

孩子不是被動接受者,而是透過與成人的互動建構內在模式(internal working model),這會影響他們未來的人際關係與自我認知。

Microsoft Copilot