搜尋此網誌

2026年2月3日星期二

Final Quiz

In C++, the term insertion operation usually refers to adding elements into data structures (like arrays, vectors, lists, sets, or maps) or inserting output into streams.

concatenate: to put things together as a connected series

#include <iostream>

#include <fstream>

#include <string>

using namespace std;


int main() {

    ifstream inputFile("example.txt"); // open file for reading


    if (!inputFile) {

        cerr << "Error opening file!" << endl;

        return 1;

    }


    string line;

    while (getline(inputFile, line)) { // read line by line

        cout << line << endl;          // print each line

    }


    inputFile.close(); // close the file

    return 0;

}


Microsoft Copilot

Poker

lottery: a way of raising money for a government, charity, etc. by selling tickets that have different numbers on them that people have chosen. Numbers are then chosen by chance and the people who have those numbers on their tickets win prizes.

slob: a person who is lazy and dirty or untidy

stake: something that you risk losing, especially money, when you try to predict the result of a race, game, etc., or when you are involved in an activity that can succeed or fail

grungy: dirty in an unpleasant way

Seven-card stud, also known as Seven-Toed Pete or Down-The-River, is a variant of stud poker.

khakis: a strong yellow-brown cloth, used especially for making military uniforms

stow: to put something in a safe place


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

Anubis, ancient Egyptian god

Anubis, ancient Egyptian god of funerary practices and care of the dead, represented by a jackal or the figure of a man with the head of a jackal. In the Early Dynastic period and the Old Kingdom, he enjoyed a preeminent (though not exclusive) position as lord of the dead, but he was later overshadowed by Osiris. His role is reflected in such epithets as “He Who Is upon His Mountain” (i.e., the necropolis), “Lord of the Sacred Land,” “Foremost of the Westerners,” and “He Who Is in the Place of Embalming.”

阿努比斯,古埃及掌管葬禮儀式與亡者照護的神祇,以豺狼或人身豺狼頭的形象呈現。在早王朝時期與古王國時期,他享有至高(雖非唯一)的地位,為亡者之主,但後來逐漸被歐西里斯所取代。他的角色反映在一些尊號中,如「山上之神」(即墓地)、「聖地之主」、「西方人之首」以及「在防腐之所者」。

His particular concern was with the funerary cult and the care of the dead; hence, he was reputed to be the inventor of embalming, an art he first employed on the corpse of Osiris. In his later role as the “conductor of souls,” he was sometimes identified by the Greco-Roman world with the Greek Hermes in the composite deity Hermanubis.

他特別關注葬禮崇拜與亡者的照護;因此,他被傳說為防腐術的發明者,並首先將此技藝運用於歐西里斯的屍體。在他後來作為「靈魂引導者」的角色中,希臘羅馬世界有時將他與希臘神赫密斯相結合,形成合成神赫曼努比斯。

Source: https://www.britannica.com/topic/Anubis

Anubis is the guardian of mummies and cemeteries. He is responsible for weighing the heart during the judgement after death and guiding the deceased along the path to the afterlife.

阿努比斯是木乃伊與墓地的守護者。他負責在死後審判時秤量心臟,並引導亡者走向通往來世的道路。

Yan, H. Y. (2025). Ancient Egypt Unveiled: Treasures from Egyptian Museums. The Hong Kong Palace Museum.

The human heart was balanced on the scale against Ma’at’s feather of truth. If the heart weighed more than the feather, the person’s identity would essentially cease to exist: the hybrid deity Ammit would eat the heart, and the soul would be destroyed. But if the heart weighed the same as the feather, the deceased would pass through the underworld (Duat) and into the Afterlife.

人類的心臟在天秤上與瑪亞特的真理之羽相衡。如果心臟比羽毛更重,這個人的身份便會徹底消失:混合神阿米特會吞食心臟,靈魂也將被毀滅。但若心臟與羽毛重量相同,亡者便能通過冥界(杜阿特),進入來世。

Source: https://egyptianmuseum.org/deities-Anubis

Translated with Microsoft Copilot and Edited

2026年1月27日星期二

Exception handling in C++

Exception handling in C++ is a structured way to detect and manage runtime errors using try, catch, and throw keywords, allowing programs to recover gracefully instead of crashing. It helps deal with issues like division by zero, invalid memory access, or file (input and output) I/O failures.

try block

    Contains code that might generate an exception.

    Example: risky operations like division or file handling.

throw keyword

    Used to signal that an error has occurred.

    Example: throw "File not found";

catch block

    Defines how to handle the exception.

    Example: catch (const char* msg) { cout << msg; }


#include <iostream>

using namespace std;


int main() {

    try {

        int x = 10, y = 0;

        if (y == 0) {

            throw runtime_error("Division by zero error!");

        }

        cout << x / y;

    }

    catch (runtime_error &e) {

        cout << "Exception caught: " << e.what() << endl;

    }

    return 0;

}


Output:
Exception caught: Division by zero error!


In C++, the e.what() method is used with exceptions that are derived from the standard exception class std::exception.

What it does

  • std::exception defines a virtual function what() that returns a C-style string (const char*) describing the error.
  • When you catch an exception object (like std::runtime_error, std::out_of_range, etc.), calling e.what() gives you a human-readable message about what went wrong.


In C++, array index out-of-bounds occurs when you try to access an element outside the valid range of an array.

In C++, the symbol || is the logical OR operator.

    It evaluates two boolean expressions (conditions).

    The result is true if at least one of the conditions is true.

    The result is false only if both conditions are false.


Always catch exceptions by reference (usually const &) to:

    Avoid object slicing.

    Preserve polymorphic behavior (what() works correctly for derived classes).

    Improve performance (no extra copy).


Microsoft Copilot

Threatening Dream

dread: causing fear

gambit: a thing that somebody does, or something that somebody says at the beginning of a situation or conversation, that is intended to give them some advantage

Monomaniacal is an adjective describing an obsessive, fanatical, or extreme preoccupation with one single subject, idea, or cause to the exclusion of all others.

cram (for something) (North American English, informal or British English, old-fashioned) to learn a lot of things in a short time, in preparation for an exam

perilous: very dangerous

Combinatorial refers to the branch of mathematics (combinatorics) concerned with counting, arranging, and selecting discrete, finite elements.

nerd: ​a person who is boring, stupid and not fashionable

revert: to reply

nonchalance: ​a calm and relaxed way of behaving; behavior that gives the impression you are not feeling worried

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

Google AI overview

Osiris, God of Afterlife

Who Osiris Was

  • Osiris started as a local fertility god in Lower Egypt (Busiris).
  • By around 2400 BCE, he became both:
    • God of fertility (life, crops, growth).
    • God of the dead (embodiment of the deceased king).
  • Egyptian kingship tied into this:
    • The dead king became Osiris.
    • The living king was Horus, Osiris’s son.
    • Isis was Osiris’s wife and Horus’s mother.
    • Seth was Osiris’s brother and murderer.

歐西里斯是誰

  • 歐西里斯最初是下埃及布西里斯的地方生育神。
  • 約在西元前2400年,他同時成為:
    • 生育之神(掌管生命、農作物、成長)。
    • 死亡之神(象徵已逝的國王)。
  • 埃及王權與此結合:
    • 已逝的國王化為歐西里斯。
    • 在世的國王是荷魯斯,歐西里斯之子。
    • 伊西斯是歐西里斯的妻子,也是荷魯斯的母親。
    • 賽特是歐西里斯的兄弟與殺害者。

The Myth of Osiris

  • According to Plutarch, Seth killed Osiris, cut his body into 14 pieces, and scattered them across Egypt.
  • Isis and Nephthys found and buried the pieces (except the phallus), reviving Osiris.
  • Osiris then ruled the underworld as judge of the dead.
  • Horus fought Seth, avenged his father, and became king of Egypt.

歐西里斯的神話

  • 根據希臘作家普魯塔克的記載,賽特殺害歐西里斯,將其屍體切成十四塊並散佈埃及各地。
  • 伊西斯與其姊妹奈芙蒂斯找回並埋葬了所有部分(除了陽具),使歐西里斯復生。
  • 從此歐西里斯成為冥界的統治者與審判者。
  • 荷魯斯擊敗賽特,為父報仇,並成為埃及的新王。

Osiris’s Role in Life and Death

  • Osiris wasn’t just ruler of the dead—he symbolized life itself:
    • Fertility of crops.
    • The Nile’s annual flood.
  • Around 2000 BCE, Egyptians believed all people became linked with Osiris at death, not just kings.
  • This didn’t mean resurrection, but renewal of life in the afterlife and through descendants.

歐西里斯在生命與死亡中的角色

  • 歐西里斯不僅是死後的統治者,他象徵著生命本身
    • 農作物的肥沃。
    • 尼羅河的年度氾濫。
  • 約在西元前2000年,埃及人相信所有人死後都與歐西里斯相連,而不僅僅是國王。
  • 這並不意味著復活,而是生命的更新,在來世與後代中延續。

Worship and Festivals

  • Osiris’s cult spread widely, merging with other fertility and underworld gods.
  • Festivals in the Middle Kingdom (1938–1630 BCE) included:
    • Processions and night rituals at Abydos.
    • Public participation and burials along the processional road.
  • Annual festivals reenacted Osiris’s fate:
    • “Osiris gardens” were made—molds shaped like Osiris, filled with Nile soil and grain.
    • Sprouting plants symbolized Osiris’s strength and renewal.

崇拜與祭典

  • 歐西里斯的信仰廣泛傳播,並與其他生育與冥界神明融合。
  • 中王國時期(西元前1938–1630年)的祭典包括:
    • 在阿拜多斯舉行的遊行與夜間儀式。
    • 民眾可參與,並在遊行道路旁埋葬或立紀念碑。
  • 每年祭典重演歐西里斯的命運:
    • 建造「歐西里斯花園」—— 歐西里斯形狀的模具,填入尼羅河水與穀物。
    • 穀物萌芽象徵歐西里斯的力量與更新。

Later Connections

  • At Memphis, Osiris was linked with the sacred bull Apis → Osiris-Apis, later becoming Serapis in Hellenistic times.
  • Greeks and Romans connected him with Dionysus.
  • He was also identified with Soker, another god of the dead.

後期的聯繫

  • 在孟菲斯,歐西里斯與神聖公牛阿比斯結合 → 奧西里斯-阿比斯,後來演變為希臘化時期的塞拉比斯
  • 希臘與羅馬人將歐西里斯與酒神狄奧尼索斯相連。
  • 歐西里斯也與孟菲斯的死神索克同化。

Depictions

  • Oldest images date to ~2300 BCE.
  • In the New Kingdom (1539–1075 BCE), Osiris was shown as:
    • A mummy with arms crossed.
    • Holding a crook and flail (symbols of kingship).
    • Wearing the atef crown (white crown of Upper Egypt + two ostrich feathers).

歐西里斯的形象

  • 最早的形象約在西元前2300年。
  • 新王國時期(西元前1539–1075年),歐西里斯被描繪為:
    • 木乃伊,雙臂交叉於胸前。
    • 一手持牧杖,一手持鞭。
    • 頭戴阿特夫冠(上埃及白冠加兩根鴕鳥羽毛)。


Original Information: https://www.britannica.com/topic/Osiris-Egyptian-god

Summarized, simplified and translated with Microsoft Copilot and edited

2026年1月22日星期四

Exposure

在手動模式 (Manual Mode) 下,曝光補償 (Exposure Compensation) 功能通常不會直接使用,因為您完全控制光圈、快門和 ISO。