搜尋此網誌

2025年9月30日星期二

Using classes

Inventory myInventory(5);

Inventory → the name of a class (or struct) you’ve defined earlier.

myInventory → the name of the object (an instance of the class).

(5) → this calls a constructor of the class Inventory that takes an int parameter.

So this line means:

“Create an object called myInventory of type Inventory, and initialize it using the constructor that accepts the integer 5.”

myInventory.addItem("Arrow");

myInventory is an object of some class, say Inventory.
addItem() is a member function of that class.
"Arrow" is a string literal being passed as an argument.
So in C++, you’d typically define a class Inventory that stores items (maybe in a std::vector<std::string>), and then implement addItem() to push new items into that container.

The dot (.) operator is one of the most fundamental symbols in many programming languages, including C, C++, Java, and C#. Its main purpose is to access members (variables, methods, or properties) of an object, structure, or namespace.

When you create an object of a class, you use the dot operator to call its methods or access its fields.

In programming, when we say “call a method”, we mean asking the computer to run the block of code defined inside that method.

A method (or function) is a reusable block of code that performs a specific task.

To call a method is to execute it: the program jumps to that method, runs its instructions, and then comes back to continue where it left off.

Microsoft Copilot

The power of quiet

rant: to speak or complain about something in a loud and/or angry way

what the heck: (informal) used to say that you are going to do something that you know you should not do

struck: strike past tense

unjust: not deserved or fair

ire: anger

stern: serious and often showing that you do not approve of somebody/something; expecting somebody to obey you

affiliate: a company, an organization, etc. that is connected with or controlled by another, larger one

accuse: to say that somebody has done something wrong or is guilty of something

larceny: the crime of stealing something from somebody; an occasion when this takes place

renege: to break a promise, an agreement, etc.

implicit (in something) suggested without being directly expressed

stipulate: to state clearly and definitely that something must be done, or how it must be done

tiff: a slight argument between close friends or two people who love each other

rack up: to collect something, such as profits or losses in a business, or points in a competition

dive in: (informal) to start doing something without hesitating or with enthusiasm

paycheck: the cheque that you are given when your salary or wages are paid to you

pitch: to aim or direct a product or service at a particular group of people

tedious: lasting or taking too long and not interesting

balk (at something) to be unwilling to do something or become involved in something because it is difficult, dangerous, etc.

slot: to put something into a space that is available or designed for it; to fit into such a space

underway: having started

overwhelm: DJ[͵əuvəˋhwelm]

if something happens several times in a row, it happens in exactly the same way each time, and nothing different happens in the time between

bastion: (formal) a group of people or a system that protects a way of life or a belief when it seems that it may disappear

insular: (disapproving) only interested in your own country, ideas, etc. and not in those from outside

coed: a female student at a co-educational school or college

bemoan: bemoan something to complain or say that you are not happy about something

insinuate: to slowly move yourself or a part of your body into a particular position or place

draw up: to make or write something that needs careful thought or planning

geeky: very knowledgeable about and interested in a particular subject, especially one that is technical or of specialist or niche interest; unfashionable and lacking social skills or boringly studious

squeaky: making a short, high sound

antihero: the main character in a story, but one who does not have the qualities of a typical hero, and is either more like an ordinary person or morally bad

wannabe: a person who behaves, dresses, etc. like somebody famous because they want to be like them

Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年9月28日星期日

Constructors and Destructors

A constructor is a special member function of a class that is automatically called when an object is created. Its purpose is to initialize the object.

A destructor is a special member function that is automatically called when an object goes out of scope or is deleted. Its purpose is to clean up resources.

In programming, overloaded refers to a feature where multiple functions or operators share the same name but differ in their parameters or behavior.

Function Overloading
This allows you to define multiple versions of a function with the same name but different:
- Number of parameters
- Types of parameters
- Order of parameters

Operator Overloading
This lets you redefine how operators (like +, -, ==) behave for user-defined types (classes).

An implicit constructor in C++ refers to a constructor that the compiler automatically provides or uses without you explicitly defining it.

explicit: (of a statement or piece of writing) clear and easy to understand, so that you have no doubt what is meant

Heap memory is a region of memory used for dynamic allocation—you manually request and release memory during runtime using pointers.

void greet(string name) {
    cout << "Hello, " << name << "!" << endl;
}

Here, name is a parameter of the greet function.

void greet(string name) {  // 'name' is a parameter
    cout << "Hello, " << name << "!" << endl;
}

int main() {
    greet("Alice");        // "Alice" is the argument
}

Object instantiation in C++ refers to the process of creating an instance of a class—in other words, making an actual object that you can use in your program.

A default constructor in C++ is a constructor that takes no parameters (or all parameters have default values). It's automatically called when an object is created without any arguments.

In C++, new and delete are operators used for dynamic memory management—they allow you to allocate and deallocate memory on the heap manually.

In C++, this is a keyword that refers to the pointer to the current object—the instance of the class where the member function is being executed.

class Person {
private:
    string name;

public:
    void setName(string name) {
        this->name = name;  // Resolves ambiguity between parameter and member
    }

    void greet() {
        cout << "Hello, " << this->name << "!" << endl;
    }
};

Parameter is a variable passed into a function or constructor to provide input.
Member is a variable declared inside a class to represent the state of an object.

In C++, a member initializer list is a special syntax used in constructors to directly initialize class members before the constructor body runs. It's more efficient and often necessary for certain types of members.

In C++, an overloaded constructor means defining multiple constructors within the same class, each with different parameter lists. This allows objects to be created in various ways depending on the arguments provided.

// overloaded constructor 
Inventory(int capacity_i) : capacity(capacity_i) {
    items = new std::vector<std::string>();
}

Inventory(int capacity_i) is a constructor for the Inventory class.

: capacity(capacity_i) is the member initializer list, which directly initializes the member capacity with the value of capacity_i.

Inside the constructor body, items is dynamically allocated as a new std::vector on the heap.

In C++, the ~ symbol is used to define a destructor, which is a special member function that is automatically called when an object is destroyed.

Microsoft Copilot

2025年9月24日星期三

scandal

rift: ​a serious break in the relationship between people or organizations

in retrospect: thinking about a past event or situation, often with a different opinion of it from the one you had at the time

ebb: a point or condition of decline

absorbed: very interested in something/somebody so that you are not paying attention to anything else

spool: a round object around which you wind such things as thread, wire or film; a reel together with the film, wire, thread, etc. that is wound around it

canister: a flat, round metal container used for storing film

fire sale: a sale at low prices of things that a company or person owns, usually in order to pay debts

scour: ​to search a place or thing carefully and completely in order to find

Dumpster: a large open container for putting old bricks, rubbish, etc. in. The Dumpster is then loaded on a lorry and taken away.

grime: dirt that forms a layer on the surface of something

squabble: to argue noisily about something that is not very important

smear: to make something dirty or greasy

yank: to pull something/somebody hard, quickly and suddenly

stash: to store something in a safe or secret place

glee: a feeling of happiness, usually because something good has happened to you, or something bad has happened to somebody else

abscond with: to leave secretly and take with you something, especially money, that does not belong to you

go ballistic: ​(informal) to become very angry

a litany of: (formal) a long boring account of a series of events, reasons, etc.

grievance: something that you think is unfair and that you complain or protest about; a feeling that you have been badly treated

falsehood: the state of not being true; the act of telling a lie

head off: prevent, block

bequeath: to say in a will that you want somebody to have your property, money, etc. after you die

Treasury: (in the UK, the US and some other countries) the government department that controls public money


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

2025年9月23日星期二

腹式呼吸

Diaphragmatic breathing, often seen during NREM sleep, refers to the use of slow, deep breaths that engage the diaphragm. It's different from the shallow, chest-focused breathing often seen during REM sleep. Diaphragmatic breathing involves expanding the abdomen to fully utilize the lungs' capacity and can help to regulate the autonomic nervous system, potentially reducing stress and improving respiratory and cardiovascular function.

Google AI overview and edited

iOS 26

Is it a good idea to upgrade my iPhone SE2 to iOS 26? Is it a good idea to postpone the upgrade after Apple finding more bugs? Will the battery be used up faster when I upgrade my iPhone SE2 to iOS26?

Upgrading can be fine, but you should be prepared: expect a short-term battery and heat hit right after installing, some early users report bugs on day‑one builds, and many experts recommend waiting for the 26.0.1/26.1 patch if your iPhone is critical for work or travel.

Immediately after a major iOS update your iPhone will do background work (indexing, model downloads, app updates) that commonly causes higher battery drain and warmer operation for 24–72 hours; Apple says this is normal and usually temporary.

When Apple says your iPhone is “indexing,” it’s essentially re‑organizing and cataloging your data in the background so the system can find things quickly later. Think of it like a librarian going through every book in a library, tagging and shelving them so you can instantly find what you need

Over the longer term, new features that demand more resources can produce a measurable, ongoing battery impact for some users, depending on how heavily you use those features.

Microsoft Copilot

Act like a business man

blazer: a jacket, not worn with matching trousers, often showing the colors or badge of a club, school, team, etc.

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

pore over: to look at or read something very carefully

upscale: in a way that involves buying or selling goods and services that are expensive and of high quality

go belly up: (informal) to fail completely

scrawl: to write something in a careless untidy way, making it difficult to read

broach: to begin talking about a subject that is difficult to discuss, especially because it is embarrassing or because people disagree about it

hotshot: a person who is extremely successful in their career or at a particular sport

proponent: a person who supports an idea or course of action

addendum: ​a section of extra information that is added to something, especially to a book

obligation: something which you must do because you have promised, because of a law, etc.

stipulate: specify

giddily: dizzily

rehash: to arrange ideas, pieces of writing or pieces of film into a new form but without any great change or improvement

miffed: slightly angry or upset

scramble: to get or gather something with difficulty or in irregular ways


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

2025年9月22日星期一

Similarity of atomic world and solar system

Atom (Bohr model):
- Dense central nucleus (protons + neutrons).
- Electrons orbit around it in shells.

Solar System:
- Massive central Sun.
- Planets orbit around it in paths.

Atom: Held together by electromagnetic force (negative electrons attracted to positive nucleus).
Solar System: Held together by gravity (planets attracted to the Sun’s mass).
Both forces follow an inverse-square law (strength decreases with the square of distance).

However, electrons don’t move in neat circular orbits like planets. Instead, quantum mechanics tells us they exist in probability clouds, not fixed paths. If atoms really behaved like tiny solar systems, they would collapse quickly due to radiation loss. Quantum rules prevent that.

In classical electrodynamics, an electron orbiting a nucleus is an accelerating charge. Accelerating charges must emit electromagnetic radiation, losing energy continuously. That would make the electron spiral into the nucleus in about 10⁻¹¹ seconds --- atoms would collapse, and matter as we know it couldn’t exist.

Acceleration isn’t just about speeding up or slowing down. In physics, acceleration means any change in velocity, and velocity includes both speed and direction. So, even if an electron were moving at a constant speed around the nucleus, it would still be constantly changing direction. That change in direction means it has a centripetal acceleration toward the nucleus.

Quantum mechanics says electrons can only occupy discrete energy states. They cannot radiate energy continuously; they can only “jump” between levels, emitting or absorbing photons of specific energies. In the lowest state (the ground state), there’s no lower level to fall into, so no radiation is emitted.

Microsoft Copilot

悶熱

為什麼颱風吹襲前通常會比較悶熱?

颱風中心附近有強烈的上升氣流,空氣被抽升到高空後,會在颱風外圍下沉。這些下沉氣流在壓縮過程中會升溫,使受影響地區天氣晴朗炎熱。下沉氣流會驅散雲層,使天空變得晴朗,陽光更容易直射地面,進一步推高氣溫。在颱風還沒靠近時,當地風勢通常不大,空氣流動減弱,熱氣和濕氣容易積聚,讓人感覺悶焗。在北半球,颱風環流是逆時針的。如果颱風在華南以東,香港常會吹偏北風,把內陸的熱空氣帶過來,加劇悶熱感。

Microsoft Copilot

2025年9月21日星期日

Function members

Keeping data as private as possible in C++ is a cornerstone of good object-oriented design.

Encapsulation means bundling data with the methods that operate on it.

By making data private, you ensure that it can only be accessed or modified through controlled interfaces (public methods).

This protects the internal state of an object from unintended interference.

Private members prevent external code from directly changing critical values.

In C++, setters and getters are public member functions used to access and modify private data members of a class. They’re essential for encapsulation, which protects internal data and provides controlled access

Getter (Accessor): Retrieves the value of a private member.
Setter (Mutator): Updates the value of a private member.

The concept of a vector spans across mathematics, physics, and computer science --- but each field gives it a slightly different flavor.

In Mathematics, a vector is a quantity with both magnitude and direction.

In Physics, vectors describe physical quantities that require direction and magnitude. Velocity, acceleration, force, momentum are common examples.

In computing, a vector often refers to a dynamic array --- a resizable list of elements.
Example in C++: std::vector<int> nums = {1, 2, 3};

The arrow operator (->) in C++ is used to access members of a structure or class through a pointer. It’s a shorthand for dereferencing a pointer and then accessing a member.

std::string&: passes the string by reference, avoiding a copy.

Together, const std::string& is the best practice for passing large objects efficiently and safely.

In C++, the std::find() function is part of the Standard Template Library (STL) and is used to search for a specific value within a range of elements. It’s defined in the <algorithm> header and works with containers like arrays, vectors, lists, and more.

std::find(start_iterator, end_iterator, value);

start_iterator: Beginning of the range.
end_iterator: One past the last element of the range.
value: The value to search for.

The != operator in C++ means "not equal to". It's a relational operator used to compare two values. If the values are not equal, it returns true; otherwise, it returns false.

items->end() returns an iterator that points one past the last element of the container. It does not point to a valid element. It’s a sentinel used to mark the end of a range.

In C++, the const qualifier is a powerful tool that tells the compiler: “This value should not be changed.” It’s all about protecting data and clarifying intent.

Constant correctness in C++ is the discipline of using the const keyword wherever possible to ensure that data which shouldn't be modified—isn't. It’s not just a style preference; it’s a powerful way to catch bugs early, clarify intent, and make your code safer and more maintainable.

It means, “Everything that isn’t supposed to change should be marked as const.”

In C++, && can be used as logical AND operator:

int a = 5, b = 10;
if (a > 0 && b > a) {
    std::cout << "Both conditions are true!" << std::endl;
}

tweak: to make slight changes to a machine, system, etc. to improve it

for (initialization; condition; update) {
    // code to execute
}

Microsoft Copilot

payroll system

demise: the end or failure of an institution, an idea, a company, etc.

poke around: to look for something, especially something that is hidden among other things that you have to move

miffed: slightly angry or upset

cursive: (of handwriting) with the letters joined together

slick: done or made in a way that is clever and efficient but often does not seem to be sincere or lacks important ideas

subterfuge: a secret, usually dishonest, way of behaving

payroll: a list of people employed by a company showing the amount of money to be paid to each of them

stipulate: to state clearly and definitely that something must be done, or how it must be done

pettiness: the fact of caring too much about small and unimportant matters, especially when this is unkind to other people

pecking order: ​(informal, often humorous) the order of importance in relation to one another among the members of a group

"Low stakes" refers to a situation with minimal risk, small potential consequences, or minor importance.

pull rank: to make use of your place or status in society or at work to make somebody do what you want

outrage: to make somebody very shocked and angry

slight: to treat somebody rudely or without respect

glean: to obtain information, knowledge, etc., sometimes with difficulty and often from various different places

reconcile: to check (a financial account) against another for accuracy

flag: to become tired, weaker or less enthusiastic

rabbit hole: a situation, often a confusing or strange one, from which it is difficult to escape

sole: only; single

devise: think up

insulting: causing or intending to cause somebody to feel offended

shrug: to raise your shoulders and then drop them to show that you do not know or care about something

An Orange Julius is a sweet, creamy, and frothy beverage made from frozen orange juice concentrate, milk, sugar, and vanilla extract, blended with ice to create a refreshing drink with a taste similar to a Creamsicle.

trespass: to enter land or a building that you do not have permission or the right to enter

bang out: to produce something quickly and often without taking much care

dub: to give somebody/something a particular name, often in a humorous or critical way

feign: to pretend that you have a particular feeling or that you are ill, tired, etc.

micromanage: to control every detail of an activity or project, especially your employees’ work

thrilled: ​very excited and pleased

"Wrap up" is a phrasal verb that means to finish or complete something, such as a meeting or project.

An acoustic coupler is a now-obsolete telecommunications device that allowed computers to transmit data over telephone lines by converting electrical signals into audible tones and vice versa.

enrage: ​to make somebody very angry

stoke: to make people feel something more strongly

chastise: (formal) to criticize somebody for doing something wrong


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are provided by Google AI Overview.

2025年9月20日星期六

Programming suitable for games

inventory: a written list of all the objects, furniture, etc. in a particular building; all the goods in a store

Object-oriented programming (OOP) is a powerful paradigm in C++ that helps you model real-world systems more intuitively. Instead of just writing functions and manipulating data, you create objects that bundle both data and behavior.

explicitly: clearly or directly, so that the meaning is easy to understand

Kids teaching kids

sabbatical: a period of time when somebody, especially a teacher at a university, is allowed to stop their normal work in order to study or travel

tumultuous: DJ[tju:ˋmʌltʃuəs] involving many difficulties and a lot of change and often violence

double down: to make a stronger commitment to a strategy or course of action, especially one that may be dangerous

radical: new, different and likely to have a great effect

modest: not very large, expensive, important, etc.

fall: autumn

decorum: polite behavior that is appropriate in a social situation

sorely: seriously; very much

ad hoc: arranged or happening when necessary and not planned in advance

conscript: to enroll into service by compulsion

assembler: (computing) the language in which a program is written before it is changed into machine code

liberally: generously


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

2025年9月19日星期五

焦距、視角與景深的關係

焦距的定義:焦距是鏡頭光學中心到感光元件的距離。焦距越長,鏡頭就像「望遠鏡」一樣,把遠方的景物放大。

Photo source: https://snapshot.canon-asia.com

視角變窄:因為放大了遠方的景物,能投射到感光元件上的範圍就變小,所以畫面看起來視角收窄。
- 廣角鏡頭(短焦距)→ 視角大,能容納更多場景。
- 長焦鏡頭(長焦距)→ 視角小,只能捕捉畫面中較窄的一部分。

長焦距 → 景深變淺:在相同光圈和拍攝距離下,焦距越長,景深就越淺。
- 主體清晰,但前後景物很快就脫離清晰範圍,變得模糊。


Photo source: www.bhphotovideo.com

Pottery and Porcelain

陶器:主要以黏土或陶土為原料,含雜質較多,不需額外添加高嶺土或長石。

瓷器:以高嶺土為主要原料,輔以長石、石英等白色礦物,質地更純淨。

在陶瓷鑑別中,我們所說的截面通常是將器物破片或切片後磨平,觀察胎體內部結構與氣孔分布。透過截面可看出陶器內部多孔粗糙,或瓷器內部致密無孔等關鍵差異。

胎體,簡單來說,就是陶瓷器去除釉層後,露出來的器物「本體」。它既是成型後、上釉前的坯土,也包含燒成後因燒結而形成、支撐釉層的那部分硬質陶瓷材料。

陶器:窯溫多在 900 至 1,200 ℃ 之間,溫度較低,燒結程度有限。
瓷器:必須在大於1,200 ℃ 的高溫中燒成,釉面會熔結,胎體致密且堅硬。

硬度與質感:
- 陶器胎體較鬆散、略顯粗糙,手感溫潤卻不光滑。
- 瓷器胎體細膩、堅硬,表面光潔或富有光澤。

敲擊聲:
- 陶器敲擊時發出「咚咚」渾厚鈍聲。
- 瓷器敲擊時發出「丁零」清脆悅耳。

陶器:整體不透明,即使胎體非常薄也無法透光。
瓷器:具有半透明特性,薄處可見光線穿透。

燈光透射測試︰
陶器杯側放小手電,不透光
瓷器薄壁處可見微光透出

陶器:胎體含多孔隙,能蓄熱保溫,茶杯或砂鍋等日常器皿可保持食物和飲品溫度更久。
瓷器:胎體致密、導熱快,不易長期保溫。

Microsoft Copilot

ambitious

nursery: a place where young plants and trees are grown for sale or for planting somewhere else

monstrosity: something that is very large and very ugly, especially a building

plow through: to make slow progress through something difficult or boring, especially a book, a report, etc.

proxy: a person who has been given the authority to represent somebody else

A stock option gives an investor the right — but not the obligation — to buy or sell a stock at an agreed-upon price and date.

blurt out: to say something suddenly and without thinking carefully enough

boom: to have a period of rapid growth; to become bigger, more successful, etc.

A tape drive is a data storage device that reads and writes data on a magnetic tape.

lawn: DJ[lɔ:n]

akin: similar to something

deliberately: done in a way that was planned, not by chance

betray: to tell somebody or make them aware of a piece of information, a feeling, etc., usually without meaning to

entity: something that exists separately from other things and has its own identity

proto-: original; from which others develop

kernel: ​the inner part of a nut or seed


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

2025年9月18日星期四

Classes and Objects in C++

In C++, classes and objects are the foundation of object-oriented programming. They help you model real-world entities by bundling data and behavior together.

A class is a blueprint or template for creating objects. It defines data members member functions.

An object is an instance of a class. It has actual values and can perform actions defined by the class.

Operator overloading in C++ lets you redefine how operators behave for user-defined types like classes and structs. It’s a powerful feature that makes your custom types feel more natural to use—like built-in types.

- To make code involving custom types more intuitive.

- To enable operations like +, -, ==, etc., on objects of your class.

Operator overloading is the process of giving special meaning to an existing operator (like +, -, ==, etc.) when used with objects of a class. For example, if you have a Complex class, you can define how + works between two Complex objects.

Inheritance and polymorphism are the keys to writing flexible, reusable, and scalable code.

Inheritance allows a class (called a derived class) to inherit properties and behaviors from another class (called a base class). It promotes code reuse and establishes a hierarchical relationship.

Polymorphism: One Interface, Many Forms

Polymorphism means “many forms.” It allows you to use a single interface to represent different underlying forms (data types or behaviors).

Inheritance gives you structure. Polymorphism gives you flexibility.

Encapsulation is one of the pillars of object-oriented programming in C++, and it’s all about bundling data and the methods that operate on that data into a single unit—usually a class. Think of it like putting valuables in a safe: you control who gets access and how.

Constructors and destructors are the backbone of object lifecycle management in C++.

A constructor is a special member function that’s automatically called when an object is created. Its job? Initialize the object.

A destructor is called automatically when an object goes out of scope or is deleted. It’s used to release resources like memory or file handles.

A memory leak in C++ happens when your program allocates memory on the heap but fails to release it after it's no longer needed. This leftover memory remains occupied, even though your program can't use it anymore—leading to wasted resources and potentially serious performance issues over time.

In C++, a parameter is a variable used in a function definition to accept values passed during a function call. These values are called arguments. Parameters allow functions to operate on different data without rewriting the function itself.

// C++ example

void greet(std::string name) {  // 'name' is a parameter

    std::cout << "Hello, " << name << "!\n";

}

greet("Alice");  // "Alice" is the argument

In C++, stack and heap are two distinct areas of memory used for different purposes, and understanding them is key to writing efficient and safe code

int* ptr = new int(10);  // Allocated on the heap
delete ptr;              // Must be manually freed

Microsoft Copilot

Activities other than computing

adventure: an unusual, exciting or dangerous experience, journey or series of events

cram: to push or force somebody/something into a small space; to move into a small space with the result that it is full

The Volkswagen Beetle is a small family car produced by the German company Volkswagen from 1938 to 2003.

lash: to fasten something tightly to something else with ropes

best: to defeat or be more successful than somebody

scarf down: to eat (something) quickly

giggle: to laugh in a silly way because you are embarrassed or nervous or you think that something is funny

peek: to look at something quickly and secretly because you should not be looking at it

hitch:  to get a free ride in a person’s car; to travel around in this way, by standing at the side of the road and trying to get passing cars to stop

barge: a large boat with a flat bottom, used for carrying goods and people on canals and rivers

agape: if a person’s mouth is agape, it is wide open, especially because they are surprised or shocked

strikingly: in a way that is interesting and unusual enough to attract attention

hospitalize: to send somebody to a hospital for treatment

sanatorium: a place like a hospital where patients who have a long-term illness or who are getting better after an illness are treated

A stock split is when a corporation splits its outstanding stocks to increase the number of shares on the market, which boosts liquidity and decreases its stock price.

liquidity: ​the state of owning things of value that can easily be exchanged for cash

In the financial markets, such as stocks, when prices have generally been increasing or are expected to increase, a bull market exists. Bull markets commonly refer to the stock market but can be applied to anything that is traded, such as bonds, real estate, currencies, and commodities.

commodity: a product or a raw material that can be bought and sold

The P/E ratio (price-to-earnings ratio) is a stock valuation tool that compares a company's stock price to its earnings per share (EPS), indicating the amount investors are willing to pay for each dollar of earnings.

A bond yield is the annual return an investor expects to receive from a bond, expressed as a percentage of its current market price. It is influenced by the bond's price, coupon rate, time to maturity, and broader market conditions like interest rate changes.

streak: a part of a person’s character, especially an unpleasant part

Unitarian: a member of a Christian Church that does not believe in the Trinity and has no formal teachings

minister: a trained religious leader in some Christian churches

lavish on: to give a lot of something, often too much, to somebody/something

cock: to raise a part of your body so that it is pointing upwards or at an angle

A Southern drawl is a feature of a Southern American accent characterized by a slower pace of speech, where pure vowel sounds are lengthened, broken into diphthongs, or prolonged, creating a sliding effect.

diphthong: a combination of two vowel sounds or vowel letters, for example the sounds /aɪ/ in pipe /paɪp/ or the letters ou in doubt

disfigure: to damage the appearance of a person, thing or place

ostracize: to refuse to let somebody be a member of a social group; to refuse to meet or talk to somebody

qualm: a feeling of doubt or worry about whether what you are doing is right

depiction: the act of showing somebody/something in a particular way in words or pictures, especially in a work of art

heel: to lean over to one side

cork: a light, soft material that is the thick bark of a type of Mediterranean oak tree

sloop: a small sailing ship with one mast (= a post to support the sails)

plywood: ​board made by sticking thin layers of wood on top of each other

To "get hooked on" something means to become addicted to a drug or, more commonly, to become very interested, enthusiastic, or obsessed with an activity, hobby, or interest to the point where you can't stop doing it.

relish: to get great pleasure from something; to want very much to do or have something

slack: characterized by slowness, sluggishness, or lack of energy

depth sounder (echo sounder): a device that measures the depth of the sea, or that finds objects underwater, by measuring how quickly sound waves are reflected

dead reckoning: the process of calculating one's position, especially at sea, by estimating the direction and distance travelled rather than by using landmarks or astronomical observations.


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are provided by Google AI Overview.

2025年9月16日星期二

Just Kids?

banishment: the punishment of being sent away from a place, especially from a country

hone: to develop and improve something, especially a skill, over a period of time

coup: a brilliant, sudden, and usually highly successful stroke or act

thaw: to become more friendly and less formal

hiatus: a break in activity when nothing happens

mark up: to mark or correct a text, etc., for example for printing

venture: a business project or activity, especially one that involves taking risks

lay off: to stop employing somebody because there is not enough work for them to do

nail down: to fasten something in place with a nail or nails

repo man: a person whose job is to repossess (= take back) goods from people who still owe money for them and cannot pay

the New Testament: the second part of the Bible, that describes the life and teachings of Jesus Christ

Confirmation: a ceremony at which a person becomes a full member of the Christian Church

aptly: in a way that is suitable or appropriate in the circumstances

decipher: to succeed in finding the meaning of something that is difficult to read or understand


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

攝影常識

合焦︰透過對焦過程,使被攝主體在相機感光元件上形成清晰成像的狀態。

泛焦︰泛焦是一種透過調整光圈與焦點距離,使畫面特定範圍內的景物全部清晰成像的攝影技術。焦距越短,即使光圈較大,亦很容易將泛焦的相片拍攝出來。

曝光補償(Exposure Compensation)︰這個詞指的是在攝影中,當相機的自動測光值無法準確滿足拍攝者意圖時,使用者手動調整影像亮度(增加或降低曝光量)的一種功能。

A classic pointer example in C++

#include <iostream>

using namespace std;


int main() {

    int x = 10;          // a normal integer variable

    int* ptr = &x;       // pointer to int, storing the address of x


    cout << "Value of x: " << x << endl;

    cout << "Address of x: " << &x << endl;

    cout << "Value stored in ptr (address of x): " << ptr << endl;

    cout << "Value pointed to by ptr: " << *ptr << endl; // dereferencing


    // Modify x through the pointer

    *ptr = 20;

    cout << "New value of x after modification via pointer: " << x << endl;


    return 0;

}


int* ptr = &x;ptr stores the address of x.

*ptr → dereferences the pointer, giving access to the value stored at that address.

Changing *ptr actually changes x, since they refer to the same memory location.


Value of x: 10

Address of x: 0x7ffee7b8c9ac

Value stored in ptr (address of x): 0x7ffee7b8c9ac

Value pointed to by ptr: 10

New value of x after modification via pointer: 20


In C++, dereferencing a pointer means accessing the value stored at the memory address the pointer is holding. The operator that does this is the asterisk (*), but only when it’s used outside of a declaration.


Microsoft Copilot

Exercise solution and quiz

std::abs is a standard C++ function used to compute the absolute value of a number. It’s part of the or header, depending on the type of input.

static_cast<int> is a C++ type conversion operator that explicitly converts a value to an int type at compile time.

In C++, a function declaration tells the compiler about a function's name, return type, and parameters—without specifying its actual body. It's like saying, “Hey compiler, this function exists, and here’s what it looks like,” but not yet saying what it does.

In C++, an argument refers to the actual value or variable passed to a function when it is called. It’s what you give to the function so it can do its job.

In C++, a function prototype is a declaration that tells the compiler about a function's name, return type, and parameters—before the function is actually defined. It’s like giving the compiler a heads-up: “This function exists, and here’s how it should be called.”

const my_array& a: It takes a constant reference to a my_array object

Microsoft Copilot

2025年9月15日星期一

科學家的思維模式

    Science grabbed me in part because if fit my need for order and organization and offered the kind of reassuring, satisfying framework I'd already found in math. It also appealed to my hyper-rational sense of the world. At its core, science requires a wildly curious mind that can tame itself with discipline and skepticism. I liked how scientists think, constantly asking themselves, "How do I know?" and "How might I be wrong?"

    科學吸引了我,部分原因是它符合我對秩序與組織的需求,並提供了一種我在數學中早已找到的、令人安心且滿足的框架。它也迎合了我對世界極度理性的看法。從本質上說,科學需要一顆極度好奇的心,同時能以紀律與懷疑精神來約束自己。我喜歡科學家的思維方式——他們不斷問自己:「我怎麼知道的?」以及「我可能錯在哪裡?」

nightwatchman: a man whose job is to guard a building such as a factory at night

German shepherd: a large dog, often trained to help the police, to guard buildings or (especially in the US) to help blind people find their way

smart-aleck: a person who thinks they are very clever and likes to show people this in an annoying way

devil-may-care: cheerful and not worried about the future

facade: the way that somebody/something appears to be, which is different from the way somebody/something really is

groan: DJ[grəun] to make a long deep sound because you are annoyed, upset or in pain, or with pleasure

conspicuously: ​in a way that is easy to see or notice, or that is likely to attract attention

declension: a set of nouns, adjectives or pronouns that change in the same way to show case, number and gender

Latin declension is the set of patterns according to which Latin words are declined—that is, have their endings altered to show grammatical case, number and gender.

lingering: slow to end or disappear

harness: to control and use the force or strength of something to produce power or to achieve something

theorem: DJ[ˋθiərəm] a rule or principle, especially in mathematics, that can be proved to be true

if something complicated or difficult to understand falls or slots into place, it becomes organized or clear in your mind

scaffolding: a system or framework of support provided by an instructor to help a student reach the next level of learning

goofy: silly; stupid

revelation: a fact that people are made aware of, especially one that has been secret and is surprising

"To put off reading" can mean delaying reading for a later time,

planarian: any of various dark-colored freshwater triclad flatworms (family Planariidae) with two eyespots and a triangular head

notion: an idea, a belief or an understanding of something

head first: ​without thinking carefully about something before acting

engaging: interesting or pleasant in a way that attracts your attention

blot out: to deliberately try to forget an unpleasant memory or thought

payoff: an advantage or a reward from something you have done

blossom: DJ[ˋblɔsəm]

intuit: to know that something is true based on your feelings rather than on facts, what somebody tells you, etc.

pounce on: to quickly notice something that somebody has said or done, especially in order to criticize it

frantic: done quickly and with a lot of activity, but in a way that is not very well organized

notion: ​an idea, a belief or an understanding of something

rote: the process of learning something by repeating it until you remember it rather than by understanding the meaning of it

decent: of a good enough standard or quality

upend: overcome

sip: ​to drink something, taking a very small amount each time

devise: to invent something new or a new way of doing something

fizzy: ​(of a drink) having bubbles of gas in it

slog: a period of hard work or effort

plodding: working or doing something slowly and steadily, especially in a way that other people think is boring

strip away: to remove (something that covers a surface) : to pull pieces of a covering away from a surface

monomania: too much interest in or enthusiasm for just one thing so that it is not healthy

esoteric: ​likely to be understood or enjoyed by only a few people with a special knowledge or interest

clarinet: a musical instrument of the woodwind group. It is like a pipe in shape and has a reed and a mouthpiece at the top that you blow into.

delight: a feeling of great pleasure

pyrotechnician: an expert in working with fireworks

concoct: to prepare by combining raw materials

tame: to make an emotion, an organization, a situation, etc., less powerful or easier to control

skepticism: an attitude of doubting that claims or statements are true or that something will happen

impressionable: (of a person, especially a young one) easily influenced or affected by somebody/something


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are provided by Google AI Overview.

Translated by Microsoft Copilot

2025年9月9日星期二

Returning values from a function

Returning values from a function in C++ is a fundamental concept that allows a function to send data back to the part of the program that called it.

Here’s a simple function that returns an int:

int add(int a, int b) {

    return a + b;  // returns the sum of a and b

}


int main() {

    int result = add(5, 3);

    cout << "Result: " << result << endl;  // Output: 8

}


int add(int a, int b) → declares a function that returns an int.

return a + b; → sends the result back to the caller.


Microsoft Copilot

vector and range-based for loop

A vector in C++ is a dynamic array provided by the Standard Template Library (STL). Unlike regular arrays, vectors can resize automatically when elements are added or removed, making them incredibly flexible and widely used.

#include <iostream>

#include <vector>

using namespace std;


int main() {

    vector<int> numbers;           // Declare an empty vector of ints

    numbers.push_back(10);         // Add elements

    numbers.push_back(20);

    numbers.push_back(30);


    cout << "Size: " << numbers.size() << endl;  // Output: 3


    // Access elements

    cout << "First element: " << numbers[0] << endl;  // Output: 10


    // Update element

    numbers[1] = 25;


    // Traverse using range-based for loop

    for (int num : numbers) {

        cout << num << " ";

    }

    return 0;

}


numbers is a vector<int> — a dynamic array of integers.

for (int num : numbers) means:

👉 “For each element in the numbers vector, assign its value to num, and then execute the loop body.”

Inside the loop:

cout << num << " "; prints the current number followed by a space


Microsoft Copilot

A typical example of function overloading

#include <iostream>

using namespace std;


// Overloaded print function for int

void print(int i) {

    cout << "Printing int: " << i << endl;

}


// Overloaded print function for double

void print(double d) {

    cout << "Printing double: " << d << endl;

}


// Overloaded print function for string

void print(const string& s) {

    cout << "Printing string: " << s << endl;

}


int main() {

    print(42);           // Calls print(int)

    print(3.14);         // Calls print(double)

    print("Hello C++");  // Calls print(string)

    return 0;

}


Microsoft Copilot

求學時期的 Bill Gates

In my emerging worldwide, the logic and rational thinking demanded by mathematics were skills that could be used to master any subject. There was a hierarchy of intelligence: however good you were at mathematics, that's how good you could be at other subjects --- biology, chemistry, history, even languages.

在他嶄新的世界觀中,數學所要求的邏輯與理性思維是一種技能,可以用來掌握任何學科。智慧存在一個等級體系:你的數學有多好,你在其他學科——生物、化學、歷史,甚至語言——就能有多出色。

Hood Canal is a natural fjord, not a canal, that sits between the Puget Sound and Olympic Mountains in Mason County, Washington.

fjord: a long narrow area of sea between high cliffs

lug: to carry or drag something heavy with a lot of effort

lodge: a small house in the country where people stay when they want to take part in some types of outdoor sport

leap: to jump high or a long way

distinctly: in a way that shows a quality that is easy to recognize

also-ran: a person who is not successful, especially in a competition or an election

camaraderie: a feeling of friendship and trust among people who work or spend a lot of time together

cheerio: goodbye

dub: to give somebody/something a particular name, often in a humorous or critical way

spearhead: a person or group that begins an activity or leads an attack against somebody/something

relish: to get great pleasure from something; to want very much to do or have something

infallible: that never fails; always doing what it is supposed to do

elicit: to get information or a reaction from somebody, often with difficulty

chuckle: an act of laughing quietly

gall: rude behavior showing a lack of respect that is surprising because the person behaving badly is not embarrassed

gratuitously: DJ[græˋtju:itəsli] ​without any good reason or purpose, in a way that may have harmful effects

betray: to hurt somebody who trusts you, especially by lying to or about them or telling their secrets to other people

auditorium: DJ[͵ɔ:diˋtɔ:riəm] the part of a theatre, concert hall, etc. in which the audience sits

mediocre: DJ[ˋmi:diəukə] not very good; of only average standard

exempt:  if somebody/something is exempt from something, they are not affected by it, do not have to do it, pay it, etc.

slumped: sitting with your body leaning forward, for example because you are asleep or unconscious

feed your ego: engage in actions or receive experiences, such as praise, success, or validation, that make you feel important, better about yourself, and boost your self-esteem.

weirdo: DJ[ˋwiədəu] a person who looks strange and/or behaves in a strange way

up-and-coming: likely to be successful and popular in the future

outscore: to score more points than

"To be borne out" means to be confirmed, substantiated, or proven true by evidence or facts.


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com

www.merriam-webster.com

Some explanations are provided by Google AI Overview.

Translated with the help of Microsoft Copilot and edited.

2025年9月4日星期四

Default arguments

When defining a function, default arguments must be specified from right to left.

// ✅ Valid

void greet(string name, string greeting = "Hello");


// ❌ Invalid

void greet(string name = "User", string greeting);

If you try to set a default for a parameter on the left while leaving one on the right without a default, the compiler (or interpreter) won’t know how to match arguments during a function call. It creates ambiguity.


Correct example

#include <iostream>

using namespace std;


// Default argument is on the right

void greet(string name, string greeting = "Hello") {

    cout << greeting << ", " << name << "!" << endl;

}


int main() {

    greet("Alice");              // Uses default greeting: "Hello"

    greet("Bob", "Good morning"); // Uses custom greeting

    return 0;

}


Incorrect example

#include <iostream>

using namespace std;


// ❌ Invalid: default argument on the left

// This will cause a compilation error

void greet(string name = "User", string greeting);


int main() {

    greet("Alice", "Hi");

    return 0;

}

The compiler doesn’t know how to interpret greet("Alice")—is "Alice" the name or the greeting?


Function Declaration

  • What it is: A promise to the compiler that a function exists.
  • Purpose: Tells the compiler the function’s name, return type, and parameters—so it can be called before it’s defined.
  • No implementation: It doesn’t contain the actual code.
int add(int a, int b);  // Declaration only

Function Definition
  • What it is: The actual implementation of the function.
  • Purpose: Contains the code that runs when the function is called.
  • Includes body: Has the logic, statements, and return value.
int add(int a, int b) {
    return a + b;
}

Microsoft Copilot

2025年9月2日星期二

快速鍵

To delete words one by one, first move the cursor to the end of the word you want to remove. Then, press and hold the Ctrl key, and then press the Backspace key.

Overloading functions

Function overloading in C++ is a powerful feature that allows you to define multiple functions with the same name, as long as they differ in their parameter list—either by number, type, or order of parameters. It’s a form of compile-time polymorphism, meaning the compiler decides which version of the function to call based on the arguments provided.

In C++, both float and double are used to represent floating-point numbers, but they differ significantly in precision, memory usage, and range.

double has a higher precision

In C++, the return statement is used inside a function to send a value back to the caller and to terminate the function’s execution. It’s a fundamental part of how functions communicate results.

In programming, the caller is the part of the code that invokes or calls a function.

invoke something (computing) to begin to run a program, etc.

#include <iostream>
using namespace std;

int add(int a, int b) {
    return a + b;  // 'add' is the callee
}

int main() {
    int result = add(5, 3);  // 'main' is the caller
    cout << "Result: " << result << endl;
    return 0;
}

In programming, a parameter is a variable used in a function or method definition to represent the input that the function expects when it's called. It's like a placeholder that gets filled with actual data—called an argument—during execution

// C++ example

void greet(std::string name) {  // 'name' is a parameter

    std::cout << "Hello, " << name << "!\n";

}

greet("Alice");  // "Alice" is the argument

static_cast in C++ is a type conversion operator used to explicitly convert one data type into another at compile time

std::to_string is a handy function in C++ used to convert numeric values into strings.


Microsoft Copilot

Hiking

cruise: DJ[kru:z] a journey by ship or boat, visiting different places, especially as a holiday

indulge something: to satisfy a particular desire, interest, etc.

pursue: DJ[pəˋsu:]

carpool: if a group of people carpool, they travel to work together in one car and divide the cost between them

awkward: difficult to deal with

mecca: a place that many people like to visit, especially for a particular reason

summit: the highest point of something, especially the top of a mountain

Surf-soaked is a term describing something completely covered or saturated with water from the ocean

wilderness: a large area of land that has never been developed or used for growing crops because it is difficult to live there

trek: DJ[trek] a long, hard walk lasting several days or weeks, especially in the mountains

push on: to continue with a journey or an activity

if skin chafes, or if something chafes it, it becomes painful because the thing is rubbing against it

raw: red and painful because the skin has been damaged

limp: to walk slowly or with difficulty because one leg is injured

humiliate: to make somebody feel ashamed or stupid and lose the respect of other people

wimp: a person who is not strong, brave or confident

unmitigated: ​used to mean ‘complete’, usually when describing something bad

gung ho: ​too enthusiastic about something, without thinking seriously about it, especially about fighting and war

Vancouver Island: a large island off the Pacific coast of Canada, in southwestern British Columbia. Its capital, Victoria, is the capital of British Columbia. It became a British Crown Colony in 1849, later uniting with British Columbia to join the Dominion of Canada.

graveyard: ​an area of land, often near a church, where people are buried

shipwrecked: ​having been sailing in a ship that was then lost or destroyed at sea

wash up: (of water) to carry something onto land

a building, road, etc. that is in a state of disrepair has not been taken care of and is broken or in bad condition

seaplane: a plane that can take off from and land on water

ford: to walk or drive across a river or stream

cove: a small bay

bog: (an area of) wet soft ground, formed of decayed (= destroyed by natural processes) plants

overgrown: ​(of gardens, etc.) covered with plants that have been allowed to grow wild and have not been controlled

slither: to move smoothly over a surface, like a snake

runoff: rain, water or other liquid that runs off land into streams and rivers

driftwood: wood that the sea carries up onto land, or that floats on the water

An avalanche cord is an old form of person locating device designed to enable people who have been buried by an avalanche to be rapidly located and rescued.

raft: a flat structure made of pieces of wood tied together and used as a boat or floating platform

relay: to receive and send on information, news, etc. to somebody


Bill Gates "Source Code"

Online Dictionaries Used:

hk.dictionary.search.yahoo.com

www.oxfordlearnersdictionaries.com