Sentence Structure (v2)

ref – https://7esl.com/adverb-placement/

  1. Action verbs (Transitive)

    Subject – Verb (action 行为/transitive 及物 动词) – Direct Object (直接宾语)

    如果动词边上的位子是一个宾语。。这个动词叫直接宾语。
    主语 –> 动词作用 –> 直接宾语

    EXAMPLES:

    Subject (主语)- who or what performs the action
    transitive verb (及物动词) – the action
    direct object (直接宾语) – whoever or whatever receives that action

    • Ricky plays volleyball.
      Subject (主语) – Ricky
      transitive verb (及物动词) – plays (we add ‘s’ because subj is 3rd singular)
      Object (直接宾语) – volleyball
    • He rides a bike.
      Subject (主语) – He
      transitive verb (及物动词) – rides (present tense: ride + ‘s’ because subj is 3rd singular)
      Object (直接宾语) – a bike
    • They fly a kite.
      Subject (主语) – They
      transitive verb (及物动词) – fly
      Object (直接宾语) – a kite
  2. Action verbs (intransitive)

    Subject (主语) – Verb (action 行为/intransitive 不及物 动词) – Preposition (介词) – Prepositional Obj (宾语)

    The rabbit laughed me. X

    You cannot laugh something, you need to use preposition (at).

    The rabbit laughed [at] me. √

    (主语) – The rabbit
    verb (不及物 动词) – laughed
    preposition (介词) – at
    object (宾语) – me

    The turtle lives forest. (X 不对)
    A turtle lives [in] a forest. √

    Subject (主语) – The turtle
    Verb (不及物 动词) – lives
    preposition (介词) – in
    Object (宾语) – a forest

    更多的例子

    • The birds fly in the sky.
      Subject (主语) – The birds
      Verb (不及物 动词) – fly
      preposition (介词) – in
      Object (宾语) – the sky
    • The girl sits [on] the couch.

      Subject (主语) – The girl
      Verb (不及物 动词) – sits
      preposition (介词) – on
      Object (宾语) – the couch

    • Tom jumps box. (X 不对)
      Tom jumps [onto] the box. √
    • 加个副词在宾语后面:
      Tom jumps [onto] the box (excitedly).
      加个副词在动词后面:

    • Tom jumps (excitedly) [onto] the box.
    • The dog ran around the corner. (The corner is the prepositional object)
    • We walk towards the airport. (The airport is the prepositional object)
    • The car sits in the garage. (The garage is the prepositional object)
    • The teacher wrote on the blackboard. (The blackboard is the prepositional object)
    • The kids play in the backyard. (The backyard is the prepositional object)
  3. Indirect Object – recepient of direct object

    Subj – Verb – Indirect Obj (receiver) – Object (direct object)

    • Step 1 – I(subj) give(verb) some cake (obj).
    • Step 2 – I(subj) gave (verb) Christine (indirect object) some cake (obj).

    • Step 1
      I(subj) give(verb) some cake (obj).
    • Step 2 – I(subj) gave (verb) Christine (indirect object) some cake (obj).
    • Simon(subj) gave (v) his uncle (ind obj) a dirty look (obj).
    • James Bond(subj) told (v) Mother (ind obj) the news (obj).
    • He (subj) bought (v) a present (obj) for his girlfriend (ind obj).
    • John (subj) asked (v) Mary (ind obj) a question (obj).
    • Ella (subj) baked (v) [a cake and cookies] (obj) for Marias (ind obj).
  4. Linking Verb (is)

    Subject (主语) + linking verb (“is/am/are/was/were/will be”) (链接动词”识别”) + Subject Complement (noun/adjective/phrase) (主语补语)

    Ricky is a teacher.
    Subject – Ricky, linking verb – is, sub complement (noun) – teacher

    You are a monster!
    subject – You, linking verb – are, sub complement (noun) – a monster

    I am pretty.
    subject – I, linking verb – am, sub complement (adj) – pretty

    She was a boy.
    subject – She, linking verb – was, sub complement (noun) – a boy

    She will be a doctor.
    subject – She, linking verb – will be, sub complement (noun) – a doctor

    You are terrible!
    subject – You, linking verb – are, sub complement (adj) – terrible

  5. Linking verbs – sense

    Subject(主语) +
    linking verb (‘sense’ – look/feel/smell/sound/taste/remain/become) (链接动词”感觉/五官”) +
    subj complement (noun/adjective/phrase) (主语补语)

    linking verb
    subject complement (noun or adjective)

    • Fried chicken smells delicious
    • The sweater feels soft.
    • I look happy.
    • Water tastes great.
    • My neighbor’s cat looks aggressive.
  6. Adverbs

    End position

    Subject (主语) + verb (action 行为动词) + (optional可用/可不用: object 宾语) + adverbs (副词)

    Mid position

    Subject (主语) + adverbs (副词) + verb (action 行为动词) + (optional可用/可不用: object 宾语)

    I played terribly
    subj – I, verb – played, adverb – terribly

    with object:
    I played the piano [terribly].

    He sang beautifully.
    subj – He, verb – sang, adverb – beautifully

    with object:
    He sang the song [beautifully].

    She stood motionlessly.
    subj – She, verb – stood, adverb – motionlessly

    with object:
    She stood outside [motionlessly].

    She undressed quickly.
    subj – She, verb – undressed, adverb – quickly

    with object:
    She [quickly] undressed in the bathroom.

    I performed remarkably.
    subj – I verb – stay adv – remarkably

    with object:
    I performed the routine [remarkably].

    The girl shouted excitedly.
    subj – The girl verb – shouted adverb – excitedly

    with object:
    The girl shouted at the animals [excitedly].

  7. Infinitive as Objects

    Purpose: express wishes, plans, intentions, or needs

    Subject (主语) + [is, am, are, like, love, want, hope, prefer, wish, hope, desire, need, plan, hate, ask, seem, refuse, try] + (to verb)

    I desire [to win] her heart.
    subj – I, verb – desire, object – to win, object complement – her heart

    I prefer [to be] the boss.
    subj – I, verb – prefer, object – to be, object complement – the boxx

    I want [to play] that game.

    subj – I, verb – want, object – to play, object complement – that game

    She wants [to eat] my dinner.

    subj – She, verb – want, object – to eat, object complement – my dinner

    I hope [to win] the race.

    subj – I, verb – hope, object – to win, object complement – the race

    The elders need [to rest].

    subj – elders, verb – need, object – to rest

  8. Infinitive as Adjective (used as Object Complement)

    Subject + [am/is/are/was/were/have/has/get/find/found/buy/borrow/rent] + (object) + [to verb]

    I am the person (obj) [to ask].
    subject – I, verb – am, obj – the person,
    infinitive (acting as adjective to describe ‘person’. ) – to ask

    She is the girl (obj) [to marry].
    subject – She, verb – is, obj – girl,
    infinitive (acting as adjective to describe ‘girl’. ) – to marry

    English 101 is the class (obj) [to take].
    subject – English 101, verb – is, obj – class,
    infinitive (acting as adjective to describe ‘class’. ) – to take

    He has a joke (obj) [to tell].
    subject – He, verb – has, obj – joke,
    infinitive (acting as adjective to describe ‘joke’. ) – to tell

    We have a job (obj) [to do].

    subject – We, verb – have, obj – a job,
    infinitive (acting as adjective to describe ‘job’. ) – to do

    I have a wedding (obj) [to attend].

    subject – I, verb – have, obj – a wedding,
    infinitive (acting as adjective to describe ‘wedding’) – to attend

    That is the team(obj) [to beat].
    subject – That, verb – is, obj – team,
    infinitive (acting as adjective to describe ‘team’) – to beat

    Let’s get some food (obj) [to eat].
    subject – Let’s, verb – get, obj – some food,
    infinitive (acting as adjective to describe ‘food’. ) – to eat

    Let’s rent a movie (obj) [to watch].
    subject – Let’s, verb – rent, obj – a movie,
    infinitive (acting as adjective to describe ‘movie’. ) – to watch

  9. Infinitive as Adverb [‘in order’]

    Subject + (action verb) + object + [to verb]

    Do the ‘in order’ test.

    I (earn) money [to live].

    test: I earn money ‘in order’ [to live]. √

    I (bought) a book [to read].

    test: I bought a book ‘in order’ [to read]. √

    I (ordered) a burger [to eat].

    test: I ordered a burger ‘in order’ to eat. √

  10. Infinitive as Adverb [‘because he/she wants/is able/etc’]

    Subject + (action verb) + object + [to verb]

    Do the

    • because he/she wants
    • because he/she is able

    test.

    He (fights) [to gain] freedom.

    test: He fights [because he wants] to gain freedom. √

    She studied hard [to pass the exam].

    test: She studied hard [because she wants] to pass the exam. √

    He is happy to sleep on the mattress.

    test: He is happy [because he is able] to sleep on the mattress. √

    Ted is happy to race the rabbit.

    test: Ted is happy [because he is able] to race the rabbit. √

  11. Gerunds

    Gerunds (a verb ending in “-ing” that functions as a noun):

    1. Subject of a Sentence

    • [Swimming] is my favorite exercise.
    • [Resting] is important for productivity.
    • [Learning] can be challenging but rewarding.

    2. Direct Object

    • He enjoys [exercising]
    • She loves [reading].
    • They avoided [sleeping].

    3. Indirect Object

    1) direct object receives the main verb.
    2) Recipient of the direct object.

    I gave a chance. (direct obj)
    I gave [hiking] a chance. (recipient of direct obj)

    4. Subject Complement

    * Her passion is [dancing].
    * His hobby is [running].
    * The hardest part was [leaving].

    5. Object of a Preposition:

    * She is good [{at} eating].
    * He is interested [{in} learning].
    * They are tired [{of} waiting].

  12. Preposition and Prepositional Object

    at – location
    I cook at(prep) home(pre obj).
    I eat at(prep) home(pre obj).
    Let’s meet at(prep) Manners(pre obj).

    at – direction
    I look at(prep) you(prep obj).
    I smile at(prep) Sara(prep obj).
    The flashlight shines at(prep) us(prep obj).

    at – time
    I will meet you at(prep) midnight(prep obj).
    Let’s meet up at(prep) Terry’s(prep obj).
    Rebecca will meet us at(prep) 8pm sharp(prep obj).

    with
    I speak [with] anger.
    I play [with] Rover.
    I watch [with] awe.

    in – expressing the situation of something that is or appears to be

    I ponder [in] silence.
    I stare [in] awe.
    They rejoice [in] victory.

    in – inside a space

    I live [in] a cave.
    Let’s look [in] the box.
    The birds fly [in] the sky.

    in – time

    We visit [in] the summer.
    I’ll see you [in] five days.
    Let’s start [in] a few moments.

    in – expressing the situation of something that is or appears to be

    I ponder [in] silence.
    I stare [in] awe.
    They rejoice [in] victory.

    on – indicate a time frame during which something takes place

    My birthday is [on] August sixth.
    The meeting is [on] the tenth.
    The parade is [on] Sunday.

    on – surface

    I jump [on] the table.
    My pet sits [on] the ground.
    The plane lands [on] the tarmac.

  13. Adverbial Phrase

    • infinitive/infinitive phrase

      “to” + base form of verb + (objects or modifiers)

      • He studied hard [to pass the exam].” (purpose)

        主语 (subj) – He
        动词 (verb) – studied
        状语 (adverbial) – to pass the exam.

      • She was surprised [to see him there]. (result)
        主语 (subj) – She
        链接动词 (linking verb) – was
        形容词(adj) – surprised
        不定时短语 (adverbial) – to see him there.
      • The box is too heavy [to lift]. (degree)
        主语 (subj) – The box
        链接动词 (linking verb) – is
        副词 + 形容词(adv + adj) – too heavy
        不定时短语 (adverbial) – to lift

      • The pirates went to Krabi [to find gold].
        主语 (subj) – The pirates
        链接动词 (linking verb) – went
        介词短语 (prep phrase) – to Krabi
        不定时短语 (infinitive phrase) – to find gold
      • My parents scour for food [to feed their children].
        主语 (subj) – My parents
        动词 (verb) – scour
        介词短语 (prep phrase) – for food
        不定时短语 (infinitive phrase) – to feed their children
    • Preposition/Prepositional Phrase

      Preposition + Object (noun, pronoun, or gerund) + any modifiers

      • I played basketball [in the morning].
        主语 (subj) – I
        动词 (verb) – played
        宾语 (obj) – basketball
        介词短语 (prep phrase) – in the morning
      • You put the dirty dishes [in the washing machine].
        主语 (subj) – You
        动词 (verb) – put
        宾语 (obj) – the dirty dishes
        介词短语 (prep phrase) – in the washing machine
      • We throw trash [in the garbage bin].
        主语 (subj) – We
        动词 (verb) – throw
        副词 (adv) – trash
        介词短语 (prep phrase) – in the garbage bin
      • They fought [like lions].
        主语 (subj) – They
        动词 (verb) – fought
        介词短语 (prep phrase) – like lions
      • The elders spoke [with quiet voices].
        主语 (subj) – The elders
        动词 (verb) – spoke
        介词短语 (prep phrase) – with quiet voices
      • He sings everyday [at two o’clock].
        主语 (subj) – He
        动词 (verb) – sings
        副词 (adv) – everyday
        介词短语 (prep phrase) – at two o’clock.
    • Adverb Phrases

      Adverb phrases modifies verbs (standard usage)

      • I exercise [very regularly].
      • I ate [quite carefully].

      Adverb phrases modifies ‘am/is/are’

      • I am too smart.
      • He is very athletic.
      • It It is only math.

      Adverb phrases modifies adjectives/adverbs

      • I find it [extremely difficult].
      • He drives [really carefully].
      • The dinner was [especially nice].

      Adverb phrases modify noun

      • She leaned [over the railing].
      • There is [barely any food].
      • The dinner was [especially nice].
      • That is [quite a tree].

      Adverb phrases modify prepositional

      • I peer [over at the funny old man].
      • I run [daily at the park].
      • We climb [right over the sofa].
      • Our budget runs [well into six digits].
    • Participle/Participle Phrase

      Present participle (-ing form) or Past Participle (-ed or irregular form) + any objects or modifiers

        As Adjectives

      • [The running water] tastes fresh. (describes water)
      • I know a [pond teeming with fish]. (describes pond)

        As Nonessential Information (describes subject)

      • Delores, [walking along the shoreline], noticed her cousin. (describes Delores)
      • The old house, [creaking with every gust of wind], stood on the hilltop. (describes the old house)

        As Nonessential Information (describe a sentence)

      • The warrior jumps into battle, [swinging an ax].
      • I stood, [staring at the sunset]

        As Fronted phrase

      • [Finishing his homework], he went out to play.
      • [Smiling broadly], she accepted the award.
    • Gerund Phrases

      1. Subject of a Sentence

      • [Swimming in the lake] is my favorite exercise.
      • [Taking a break] is important for productivity.
      • [Learning a new language] can be challenging but rewarding.

      2. Direct Object

      • He enjoys [(playing) the guitar]
      • She loves [(reading) mystery novels].
      • They avoided [(making) eye contact].

      3. Indirect Object

      1) direct object receives the main verb.
      2) Recipient of the direct object.

      I gave a chance. (direct obj)
      I gave [hiking in the volcano] a chance. (recipient of direct obj)

      4. Subject Complement

      * Her passion is [dancing on rooftops].
      * His hobby is [(collecting) stamps].
      * The hardest part was [(saying) goodbye].

      5. Object of a Preposition:

      * She is good [{at} (solving) puzzles].
      * He is interested [{in} (learning) to code].
      * They are tired [{of} (waiting) in line].

  14. Subject + helping verb + main verb + object

    helping verb
    main verb

    Present Perfect – Subj + [have/has] + Past Participle

    I have eaten squid.
    The turtle has eaten bugs since he was little.
    My friend has bought a new car.
    I have lived in LA for most of my life.

    Present Continuous – Subj + [am/is/are/was/were] + [verb + ing]

    I am playing video games.
    Ricky is correcting homework.
    My mom is cooking dinner.
    We are fixing the car.

RACE writing strategy

  • The R means ‘R’estate the Question.
  • The A means ‘A’nswer the question.

Why did Sam choose the bird for a Pet?

Restate the Question

Sam chose the bird for a pet

Answer the Question

because he liked that it could talk.

Question: Why is it helpful for bats to eat bugs?

It is helpful for bats to eat bugs because then crops will grow better.

Restate the Question

It is helpful for bats to eat bugs

Answer the Question

because then crops will grow better.

What lesson can we learn from this story?

Restate the Question

A lesson we can learn from this story is

Answer the Question

to be a problem solver

The C in the RACE means Cite the text evidence. This means go into the text, find the content that supports what you’ve stated from in RA.

Cite text Evidence

Use something from the story to prove our answer

How are elephants clever animals?

Restate the Question

Elephants are clever animals

Answer the Question

because they know how to avoid a sunburn.

Cite the text evidence

The author states that elephants use sand or mud as sunscreen to protect themselves from sunburns. They do this by throwing sand and mud on themselves. They also protect their young from sunburns by standing over them.

Let’s look at the “Tag at the Park” story again:

Once we’ve “Restated the Question”, and “Answered the question”, we need to find the evidence that supports it.

So we explain in our words what we’ve found from the text. In the story, Kate came up with a good idea to solve the problem.

She asked the other kids if she and her friends could join their game of tag.

What we should NOT do is to use words/sentences that has no support from the text.

RACE

E stands for Explain

R – A lesson we can learn from this story is
A – to be a problem solver.
C – In the text…

From the “Tag at the Park” story, what do I know about problem solving?

Your “explain” can be something like:

I know that it is good to solve problems because it helps people to get out of predicaments and work things out. Working things out and resolving issues is always a better solution that being stuck and angry.

Practice: From the “Tag at the Park” story, what’s wrong with this picture?

No R
No E

Practice: apply all RACE for the elephant story.

Practice: From the “Elephant Sunburn” story, what’s wrong with this picture?

No A. No E

It only “restates the question”. It does not answer it. Elephants are clever animals because why?

The explanation is not good either because it simply restates the cited text. It does not give a detailed explanation about why being clever is a good thing and can help us overcome problems and predicaments.

The key is that we want to have an explanation of what we think (and feel) about how A answers R. In our opinion, how does using mud and sand as sunscreen make elephants smart?

You can write it in many different ways, for example:


Similar to humans, elephants are intelligent, and they use ingenious ways to solve problems in their lives.

Last Step – Sum It Up with a last sentence after you have written sentences for RACE

Keep it:

  • Short
  • Simple
  • Reviews Main Idea

Let’s use “Tag at the Park” story as an example:

What is the question about?

It is about the lesson we’ve (Kate) learned from this story.

What is the answer about?

The answer is about Kate being a problem solver

To sum it up, Kate shows us that being a problem solver helps us have a better time.

Elephant Story

What is the question about?

How are elephants clever?

What is the answer about?

They are clear because they can avoid sunburns.

–> Being clever pays off for elephants.

–> I’m glad elephants are clever so they don’t get sunburned!

Add these phrases in front of what you have written for the Sum:

  • In summary…
  • All in all…
  • To sum up…

To sum up + [being clever pays off for elephants].

All in all + [I’m glad elephants are clever so they don’t get sunburned].

Conjunction ‘and’

ref – https://dictionary.cambridge.org/us/grammar/british-grammar/and

And is a coordinating conjunction. We use and to connect two words, phrases, clauses or prefixes together:

[Televisions] and [computers] are dominating our daily life. (noun + noun)

I have to [shower] and [change]. (verb + verb)

The photos are [black] and [white]. (adjective + adjective)

[My best friend] and [my father’s father] both come from Wales. (phrase + phrase)

[She got to the door] and [put the key in the latch]. (clause + clause)

[The houses were a mix of pre-] and [post-war build]. (prefix + prefix)

There are two common questions related to coordinating conjunctions:

(Question 1) Do you put a comma before “and”?

Mostly no but sometimes yes. Unfortunately, the answer to this question isn’t short.

Here is a summary of the rules:

The Rule for Two Items

When “and” (or any coordinating conjunction) joins two items, don’t use a comma.

Lee has eaten all the cheese and biscuits. √
The whole world agrees on this point. So far so good. However, if you think it helps your reader, you can use a comma.

The Bakerloo line runs between Elephant and Castle, and Harrow and Wealdstone. √
(Using a comma with two list items is fairly common. It happens when the list items themselves contain commas. In this example, the comma before “and” helps readers to spot the list items faster. They could work it out, but the comma helps.)

I used to watch Colombo, and Cagney and Lacey. √
(This example also has two list items: “Colombo” and “Cagney and Lacey.” This time, the comma is more important because the list items could feasibly be “Colombo and Cagney” and “Lacey”.)

So, in summary, don’t use a comma when “and” (or any other coordinating conjunction) joins two items unless it helps your readers.

There’s an important exception to this rule though. It’s important because it’s common.

The Exception to the Rule for Two Items

When your coordinate conjunction joins two (or more) independent clauses (i.e., ones that could stand alone as individual sentences), then use a comma. Remember clause means it has a subj and verb:

I like sweet things, but I prefer savory dishes. √

(Here, the clauses being joined (shown in bold) could stand alone as sentences. They are independent clauses. That’s why there is a comma before “but.”)

Compare that with this:
I like sweet things but prefer savory dishes. √

(This is similar, but “prefer savory dishes” is not an independent clause. It’s not a sentence. That’s why there’s no comma before “but.”)

Here are some real-life examples:

The lion and the calf (subj) shall lie (verb) down together, but the calf (subj) won’t get (verb) much sleep. √

  • The first coordinating conjunction (“and”) joins two nouns, so no comma is required.
  • The second (“but”) joins two independent clauses, so a comma is required.

I’d (subj) be (verb) at home in my bath, and she’d (subj) come (verb) in and sink (verb) my boats. √

  • The first coordinating conjunction (“and”) joins two independent clauses, so a comma is required.
  • The second (“and”) joins two verbs, so no comma is required.

Hopefully, that’s all clear.

But, there’s a quirk: If the two “sentences” (i.e., the independent clauses) are both short, it is acceptable – for style purposes – to omit the comma.

Craig caught a bass and Lee caught a goby. √
Craig caught a bass, and Lee caught a goby. √
(Both versions are acceptable.)

Look at this though:

The man caught the boy and the girl caught the dog. X
(For a fleeting moment, your readers will think that the man caught “the boy and the girl”. You should try to write in a way that doesn’t cause your readers to stutter.)

The man caught the boy, and the girl caught the dog. √
(Your readers will not need to re-adjust now. This example captures why we need a comma before a coordinating conjunction that joins two independent clauses.)

The Rule for Three or More Items

When there are three or more list items, life starts getting a little more complicated because there is no unified position on whether to use a comma with the coordinating conjunction.

Some people will write this:
Bacon, eggs, and tomatoes
(The comma before the “and” is called an Oxford Comma. This is the convention followed by most (but not all) Americans.)
Some people will write this:
Bacon, eggs and tomatoes
(This is the convention followed by most (but not all) Brits. The most notable exception is the Oxford University Press, after which the Oxford Comma is named.)
There are plenty of people out there who would happily start a fight with you for not using an Oxford Comma, but there are also plenty of others who consider the Oxford Comma a waste of printer ink. In essence, it’s a battle of clarity versus economy.

Advocates of the Oxford Comma claim it eliminates ambiguity. They have a point. The Oxford Comma is certainly useful for showing the separations between the list items.
It’s a good price for a mug of tea, bacon and eggs and toast
(Without an Oxford Comma, this could mean (1) a mug of tea, (2) bacon, and (3) eggs and toast.)
It’s a good price for a mug of tea, bacon and eggs, and toast
(With an Oxford Comma, the list items are clear.)
Protestors to the Oxford Comma claim it introduces ambiguity because commas can be used like parentheses (brackets). Look at these two sentences:
Jack left the pub with John (a policeman) and Simon.
Jack left the pub with John, a policeman, and Simon.
(With an Oxford Comma, this could feasibly refer to two people (like in the top example) or three people.)
Advocates claim that the Oxford Comma actually eliminates, not creates, such ambiguity, and they routinely cite this probably apocryphal book dedication:
This book is dedicated to my parents, Ayn Rand and God.
(This could feasibly be read as “…my parents (Ayn Rand and God)”. The same “ambiguity” wouldn’t exist with an Oxford Comma before “and.”)
So, there are arguments for and against the Oxford Comma. As it happens, you probably don’t have a choice whether to adopt the Oxford Comma or not. If you live in the UK, you probably shouldn’t adopt it (unless you’re at Oxford). If you live in the US, you probably should. Whatever convention you go for, be consistent.

Well, actually, be flexibly consistent. If your chosen convention creates ambiguity, break the convention. There’s only one 100% rule when it comes to the Oxford Comma: clarity trumps convention.

In other words, everyone (regardless of what convention they follow) should write this when they mean four people:
I have the twins, Joe, and Callum. correct tick (for four people)
Remember that clarity comes first. Loyalty to, or hatred of, the Oxford Comma comes second.

Help by Ricky Tsao

Listening to Beethoven with my Bose headphones, I sat comfortably in first-class. I stared at a help button right below the overhead compartment. It was labeled “Press button for Help”. Suddenly, the cabin siren blared. The flight attendant motioned for everyone to keep their head down and brace for impact. With perfect timing, the beginning of Beethoven’s 5th symphony accompanied the twin engines catching fire.

It created an aerial diving sound that I still hate to this day. From my fetal position, I watched in horror as the skies outside the window view rotated ninety degrees clockwise, and the sound of the plane diving became deafening. The 5th Symphony’s familiar exposition hammered out again, and the Captain screamed into the intercom to brace for impact. My biggest fear was about to come true. The plane suddenly lurched forward, and I saw my family disappear into the seats in front of them. I felt a lump in my throat, and then nothing.

The chemical smell of fumes gently nudged me awake. I quickly sat up and saw that I was in the uneven embrace of a beige colored beach. I squinted and covered my eyes from the warm sun rays, and stared into the wide blue yonder. I looked around and saw some seashells, the breeze combed my hair gently. About twenty meters from me, I saw the wreckage of the plane. A trail of smoke from the still hot remnants floated up. I slowly shuffled towards what was left of the plane.

The wrecked plane was an ostrich. The tail end pointed straight up into the air. Its nose and cockpit was stuck several meters into the sand. When I got close enough, I plopped down onto the soft white sand and grieved. The tears tiptoed down my chubby cheeks and plunged down into the sea of white sand. They choreographed a good bye performance for my family, to express what my school grade vocabulary couldn’t. When they were done, my natural instincts took over. I had to survive. It was amazing how my body and adrenaline complemented each other. My feet moved and my arms pumped back and forth. I searched the wreckage. I found one food ration, two bottles of water, and a few charcoaled human body parts. They were scattered on a burning black pit like a barbecue that no one wanted to attend. Right next to it was the cockpit.

My initial thought was to use the radio transmitter. But the machine was smashed beyond recognition. The flips and switches were scrunched together so tightly that you would have thought they just ate a lemon. I found the help button lodged in the sand right besides my feet. It took me back to a previous life.

I snapped out of it and gave up. I was hungry so I quickly devoured my one and only food ration. As dusk turned to night, the temperature dropped and the island became a refrigerator. I woke up the next morning and saw a plane buzzing overhead. I yelled my lungs out but to no avail. I didn’t find any flare guns, nor any SOS pyrophoric signal materials. The only thing I thought of was to write the word ‘Help’ on the sand. I was a meerkat of the highest order. My legs carried me as far as they could and I started to dig sand. With every push, the letter H became more visible. With every dig, its bevel became deeper. The next thing that floated over the horizon will have no problem seeing ‘Help’ on the beach. I ran to the nearest cliff and rolled boulders onto the letters’ font space. That way the waves could not take away my hard work.

After two days, there were still no signs of any planes. I was famished, and I started to hallucinate. I stumbled around the wreckage like a drunken shaman, waving his magic arms, and trying to summon hallucinated gods. Then, I smelled it. It was meaty, with a smoky afterthought. I rubbed my eyes and couldn’t believe my eyes. Sitting perfectly scattered on a blackened barbecue pit were shanks of aromatic barbecued meats. The crispy skin glistened underneath the hot afternoon sun. Sirloin, chuck, rib, round, they were all there. Some even wrapped in cloth to keep in the moisture. The red hue of the fire hiding in the charcoals emanated ever so often, gently massaging and spit roasting the flesh. Intact blood within the meat slowly cooked, and became streaks of blurred, dimmed red running from the bone to the trotter. A deep sensation from my stomach whispered, and I felt my animal instincts pry my jaws open. I sprinted over, grabbed a trotter, and ripped into its flesh. Like the cartoons that we love on Saturday mornings, I dunked the meats into my mouth and pulled out the bone, savoring every morsel.

When I had my fill, I laid down exhausted on the pristine white sand. My brain was alive again, and I stared into the beautiful blue skies. The cotton clouds shifted from one animal to the next. Then I heard a whisper. The voice forgiving, and paternal. It whispered that life was ordained by God, and whatever we did to sustain life will be forgiven. I sat up and scanned the skies quickly but saw no trace of a higher being. As if on cue, I heard the all too familiar sound of Beethoven. The piano notes that haunted me the last few days suddenly sounded different. The music got louder, and I heard the staccato of a plane’s rotor as it landed behind the wreckage.

My biggest fear is to be stuck on an island. And I now know the repercussions. I lost my prized possessions. I lost my beloved family. But most of all I lost my human innocence. It is something I can never get back, and I have to live with the consequences. Losing my family pains my heart. Losing my possessions pain my body. But losing my human dignity and having to sustain myself with the flesh of fellow men have morally decayed my spirit. It removed me of my human senses, and I now dwell in the dark abyss of hell.

Help.

Pagination using React and Mongodb

ref – https://www.freecodecamp.org/news/reveal-on-scroll-in-react-using-the-intersection-observer-api/

HomePage

We have a HomePage that calls getAllPhotos for the initial data retrieval.
We get the photos and next_cursor, but they are not rendered. Rather, we let a child component PageOne render these data.

notice here getAllPhotos’s parameter is empty.

But first, let us analyze getAllPhotos and how it retrieves data.

getAllPhotos

The function has a parameter searchParams. The searchParams indicates what next is. Next is the initial element that we are starting at when we grab the next ten elements from mongodb.

On the 1st pass, next is null because in HomePage getAllPhotos was called with empty param.

Which means if next exists do this:

if next is null (which it is here on the 1st pass) then we just use { $exists: true }, which means we match documents that contains the field ‘_id’.

Therefore, on the 1st pass, PhotosoModel model would return ten documents in mongodb.

Then we look at the 9th doc. We get the id for it. This is so that we know the location of where to start grabbing data for the next time around. If next_cursor is null, then we are done.

We return the next_cursor so that child rendering components know how to proceed like so:

So now, let’s take a look at how PageOne rendering comonent processes this:

PageOne

This is a component that renders data.

First thing’s first. Let’s save the param data to state.

Its basically renders photos like this:

In Inspect window, you will see that we are observing a reference’s current to see if its true or false.

So let me explain why.

Observing when a button appears in our ViewPort

First, we need to create a custom hook. Hooks are reusable functions.

We need to implement a useInView in order to put it in our PageOne and observe if a button appears in our viewport.

In order to do this, we create a reference and point it to the button.

So we first create a custom hook.

As you can see, we use a useRef to persist value of a button between renders. It can be used to store a mutable value that does not cause a re-render when updated.

Specifically, we return the ref from useInView and store a button in it:

We reference this button because we need to observe the ref’s current property. ref’s current is now button.btn_loadmore

Then create an observer and observe ref.current.

We use an IntersectionObserver to observe for if our button has appeared in our viewport. In other words, the Intersection Observer API allows you to configure a callback that is called when a target element intersects either the device’s viewport or a specified element. That specified element is called the root element or root for the purposes of the Intersection Observer API.

So in our case, our useInView custom hook observes to see if the referenced button has appeared on our viewport. If it has, then it update inView state in our custom hook useInView.

This variable (inView) is being monitored by useEffect in PageOne, and when it changes to a ‘true’, we would load more data. (as shown in the image above)

If it changes to a false (when the button is not in viewport), then inView is false, and the evaluation would in PageOne would see that inView is false, we don’t do anything.

So in other words, inView is returned from custom hook useInView. When we have not scrolled down to make button appear in viewport, isIntersecting is ‘false’. So we don’t load more.

When we’ve scrolled so that the button appears in viewport, IntersectionObserver’s entries[0] isIntersecting is true. So we would call this function handleLoadMore().

2nd Pass

Now we have to ask ourselves, so the BUTTON appears and we handleLoadMore. But what is handleLoadMore ?

It stops loading if next becomes null, or is loading. It locks the function from being called multiple times by setLoading to true.
That way, other calls will return.

Then it goes and getAllPost with the marker next (which should be fef)

when getAllPhotos returns, next_cursor has gone down the next 10 items ($lt: next) and put it in photos. next_cursor has been updated to the next 9th element.

But this time around since next !== null, we run:

We’re sorting by sort ‘-_id’ so it comes to $lt: next, which means get less than from the next initial marker.

We keep scrolling down to make the button appear, which will do more loading data, until we come to the end. The end is where when we grab the last few items in our mongdo that is less than 10. At that point next is null, and we don’t load anymore.