Latest Tweets:

What if the Sun disappeared?

*67
*1

Where Did Earth’s Water Come From?

How Modern Light Bulbs Work

*2

The Homework Squabbles

photo credit: David Flaherty/NYTimes
Do my children need dedicated space for their homework, or is it O.K. to do it in the kitchen? What about listening to music, is that smart? Should I correct my children’s errors or let their teachers discover where they need help? Can I do anything to encourage self-reliance?

Bruce Feiler, the article’s author, reports the following recommendations from the experts:

  1. Location: Anywhere is fine as long as you, the parent, are available but not hovering too much to discourage self-reliance, and your child can stay engaged and focused—not falling asleep, cradling the phone, staring out a window.

  2. Multi-tasking: 99.999% of humans are horrible multi-taskers. doing other things, the longer the homework is taking, which makes children even less happy.

  3. Criticism: You don’t always have to be upbeat. You don’t want to deliver critical messages that imply things can’t be fixed. So you never want to say things like, ‘You’re stupid.’ But pointing out a mistakes or situations where they should try harder would certainly be justified.

A plain english introduction to CAP Theorem

You’ll often hear about the CAP theorem which specifies some kind of an upper limit when designing distributed systems. As with most of my other introduction tutorials, lets try understanding CAP by comparing it with a real world situation.

Chapter 1: “Remembrance Inc” Your new venture :

Last night when your spouse appreciated you on remembering her birthday and bringing her a gift, a strange Idea strikes you. People are so bad in remembering things. And you’re sooo good at it. So why not start a venture that will put your talent to use? The more you think about it, the more you like it. In fact you even come up with a news paper ad which explains your idea

Remembrance Inc! - Never forget,  even without remembering!
   Ever felt bad that you forget so much?  Don't worry. Help is just a phone away!
    When you need to remember something, just call 555--55-REMEM and tell us what you need to remember. For eg., call us and let us know of your boss's phone number, and forget to remember it. when you need to know it back.. call back the same number[(555)--55-REMEM ] and we'll tell you what's your boss's phone number.
   Charges : only $0.1 per request

So, your typical phone conversation will look like this:

  • Customer : Hey, Can you store my neighbor’s birthday?
  • You: Sure.. when is it?
  • Customer : 2nd of jan
  • You: (write it down against the customer’s page in your paper note book )Stored. Call us any time for knowing your neighbor’s birthday again!
  • Customer : Thank you!
  • You: No problem! We charged your credit card with $0.1
     

Chapter 2 : You scale up:

Your venture gets funded by YCombinator. Your Idea is so simple, needs nothing but a paper notebook and phone, yet so effective that it spreads like wild fire. You start getting hundreds of call every day.

And there starts the problem. You see that more and more of your customers have to wait in the queue to speak to you. Most of them even hang up tired of the waiting tone. Besides when you were sick the other day and could not come to work you lost a whole day of business. Not to mention all those dissatisfied customers who wanted information on that day.
You decide it’s time for you to scale up and bring in your wife to help you.

Your start with a simple plan:

  1. You and your wife both get an extension phone
  2. Customers still dial (555)–55-REMEM and need to remember only one number
  3. A pbx will route the a customers call to whoever is free and equally
     

Chapter 3 : You have your first “Bad Service” :

Two days after you implemented the new system, you get a call from you get a call from your trusted customer Jhon. This is how it goes:

  • Jhon: Hey
  • You: Glad you called “Remembrance Inc!”. What can I do for you?
  • Jhon: Can you tell me when is my flight to New Delhi?
  • You: Sure.. 1 sec sir
    (You look up your notebook)
    (wow! there is no entry for “flight date” in Jhon’s page)!!!!!
  • You: Sir, I think there is a mistake. You never told us about your flight to delhi
  • Jhon: What! I just called you guys yesterday!(cuts the call!)

How did that happen? Could Jhon be lying? You think about it for a second and the reason hits you! Could Jhon’s call yesterday reached your wife? You go to your wife’s desk and check her notebook. Sure enough it’s there. You tell this to your wife and she realizes the problem too.

What a terrible flaw in your distributed design! Your distributed system is not consistent! There could always be a chance that a customer updates something which goes to either you or your wife and when the next call from the customer is routed to another person there will not be a consistent reply from Remembrance Inc!
 

Chapter 4: You fix the Consistency problem:

Well, your competitors may ignore a bad service, but not you. You think all night in the bed when your wife is sleeping and come up with a beautiful plan in the morning. You wake up your wife and tell her:

” Darling this is what we are going to do from now”

  • Whenever any one of us get a call for an update(when the customer wants us to remember something) before completing the call we tell the other person
  • This way both of us note down any updates
  • When there is call for search(When the customer wants information he has already stored) we don’t need to talk with the other person. Since both of us have the latest updated information in both of our note books we can just refer to it..

There is only one problem though, you say, and that is an “update” request has to involve both of us and we cannot work in parallel during that time. For eg. when you get an update request and telling me to update too, i cannot take other calls. But that’s okay because most calls we get anyway are “search” (a customer updates once and asks many times) . Besides, we cannot give wrong information at any cost.

“Neat” your wife says, “but there is one more flaw in this system that you haven’t thought of. What if one of us doesn’t report to work on a particular day? On that day, then, we won’t be able to take “any” Update calls, because the other person cannot be updated! We will have Availability problem , i.e, for eg., if an update request comes to me I will never be able to complete that call because even though I have written the update in my note book, I can never update you. So I can never complete the call!”
 

Chapter 5: You come up with the greatest solution Ever:

You being to realize a little bit on why distributed system might not be as easy as you thought at first. Is it that difficult to come up with a solution that could be both “Consistent and Available”? Could be difficult for others, but not for you!! Then next morning you come up with a solution that your competitors cannot think of in their dreams! You wake your wife up eagerly again..

” look” , you tell her.. “This is what we can do to be consistent and available” . The plan is mostly similar to what I told you yesterday:

  • i) Whenever any one of us get a call for an update(when the customer wants us to remember something) before completing the call, if the other person is available we tell the other person. This way both of us note down any updates
  • ii) But if the other person is not available(doesn’t report to work) we send the other person an email about the update.
  • iii) The next day when the other person comes to work after taking a day off, He first goes through all the emails, updates his note book accordingly.. before taking his first call.

Genius! You wife says! I can’t find any flaws in this systems. Let’s put it to use.. Remembrance Inc! is now both Consistent and available!
 

Chapter 6: Your wife gets angry :

Everything goes well for a while. Your system is consistent. Your system works well even when one of you doesn’t report to work. But what if Both of you report to work and one of you doesn’t update the other person? Remember all those days you’ve been waking your wife up early with your Greatest-idea-ever-bullshit? * What if your wife decides to take calls but is too angry with you and decides not to update you for a day? Your idea totally breaks! Your idea so far is good for consistency and availability but is not Partition Tolerant!*
You can decide to be partition tolerant by deciding not to take any calls until you patch up with your wife.. Then your system will not be “available” during that time…
 

Chapter 7: Conclusion :

So Let’s look at CAP Theorem now. Its states that, when you are designing a distributed system you can get cannot achieve all three of Consistency, Availability and Partition tolerance. You can pick only two of:

  • Consistency: You customers, once they have updated information with you, will always get the most updated information when they call subsequently. No matter how quickly they call back
  • Availability: Remembrance Inc will always be available for calls until any one of you(you or your wife) report to work.
  • Partition Tolerance: Remembrance Inc will work even if there is a communication loss between you and your wife!
     

Bonus : Eventual Consistency with a run around clerk :

Here is another food for thought. You can have a run around clerk, who will update other’s notebook when one of your’s or your wife’s note books is updated. The greatest benefit of this is that, he can work in background and one of your or your wife’s “update” doesn’t have to block, waiting for the other one to update. This is how many NoSql systems work, one node updates itself locally and a background process synchronizes all other nodes accordingly… The only problem is that you will lose consistency of some time. For eg., a customer’s call reaches your wife first and before the clerk has a chance to update your notebook , the customer’ calls back and it reaches you. Then he won’t get a consistent reply.. But that said, this is not at all a bad idea if such cases are limited. For eg., assuming a customer won’t forget things so quickly that he calls back in 5 minutes.

That’s CAP and eventual consistency for you in simple english :)

(Source: ksat.me)

Bobby McFerrin demonstrates the power of the pentatonic scale, using audience participation, at the event “Notes & Neurons: In Search of the Common Chorus”.

The pentatonic scale is essentially all the black keys on a piano. These notes sound good in any order because there are no dissonant intervals between any of them.

*1

How to Catch and Correct Run-on Sentences

A “run-on” sentence contains two (or more) independent clauses that are incorrectly joined together. (An independent clause is a word group that can stand alone as a sentence.)

To catch or to correct run-on sentences, follow these common guidelines:

  1. Join the two clauses with a comma and a coordinating conjunction*
  2. Break the run-on sentence into two separate sentences
  3. Join the clauses with a semi-colon and a conjunctive adverb** followed by a comma; however,
  4. Join the clauses with a semi-colon

*Use this mnemonic for remembering the coordinating conjunctions: FANBOYS = For, And, Nor, But, Or, Yet, So

**conjunctive adverbs include therefore, nevertheless, however, as a result, in any case, consequently, and thus

Incorrect

  • Body language is non-verbal everyone uses it to communicate.
  • Tom enjoys playing hockey, he plays it as much as he can.
  • Many people believe that violence on television has a negative effect on our youth, however, this topic continues to be debated.
  • Increased pollution in the environment threatens the health of millions this is an indisputable fact.

Correct

  • Body language is non-verbal, and everyone uses it to communicate. (coordinating conjunction preceded by a comma)
  • Tom enjoys playing hockey. He plays it as much as he can. (two sentences)
  • Many people believe that violence on television has a negative effect on our youth; however, this topic continues to be debated. (semi-colon + conjunctive adverb + comma)
  • Increased pollution in the environment threatens the health of millions; this is an indisputable fact. (semi-colon)

(Source: webster.edu)

*2

Topic Sentences

Here is another way to think about how a topic sentence can lend order to a paragraph. In the following example, the topic sentence is labeled with a “1.” Sentences that directly support the topic sentence are labeled with a “2.” Sentences that support the level 2 sentences – by providing additional detail – are designated as level “3.” By breaking the paragraph down in this manner, the relationships between the sentences – and the ideas they convey – become obvious. Using this technique to examine your own paragraphs can help you determine whether or not they are well-organized and adequately developed.

The weeks until graduation were filled with heady activities. A group of small children were to be presented in a play about buttercups and daisies and bunny rabbits. They could be heard throughout the building practicing their hops and their little songs that sounded like silver bells. The older girls (non-graduates, of course) were assigned the task of making refreshments for the night’s festivities. A tangy scent of ginger, cinnamon, nutmeg and chocolate wafted around the home economics building as the budding cooks made samples for themselves and their teachers. (From Graduation, by Maya Angelou)

Using Topic Sentences

Most paragraphs have a topic sentence that states the main point of the paragraph. Exceptions include introductory paragraphs, transitional paragraphs, and concluding paragraphs. Note also that some paragraphs are so well-structured that a reader can readily identify the topic—in other words, the topic sentence is implied rather than stated. This last technique is hard to master, so as a rule you should use a topic sentence.

Additional Examples

(Examples are from Diana Hacker. The Bedford Handbook. 5th ed. Boston: Bedford Books, 1998.)

Sample Paragraph, Topic Sentence first:

Nearly all living creatures manage some form of communication. The dance patterns of bees in their hive help to point the way to distant flower fields or announce successful foraging. Male stickleback fish regularly swim upside-down to indicate outrage in a courtship contest. Male deer and lemurs mark territorial ownership by rubbing their own body secretions on boundary stones or trees. Everyone has seen a frightened dog put his tail between his legs and run in panic. We, too, use gestures, expressions, postures, and movement to give our words point. [Italics added by Hacker.]

-Olivia Vlahos, Human Beginning (qtd. in Hacker 78).

Topic sentence introduced by transitional sentence linking it to earlier material:

But flowers are not the only source of spectacle in the wilderness. An opportunity for late color is provided by the berries of wildflowers, shrubs, and trees. Baneberry presents its tiny white flowers in spring but in late summer bursts forth with clusters of red berries. Bunchberry, a ground-cover plant, puts out red berries in the fall, and the red berries of wintergreen last from autumn well into winter. In California, the bright red, fist-sized clusters of Christmas berries can be seen growing beside highways for up to six months of the year. [Italics added by Hacker.]

-James Crockett et al., Wildflower Gardening (qtd. in Hacker 79)

Topic Sentence Last:

Tobacco chewing starts as soon as people begin stirring. Those who have fresh supplies soak the new leaves in water and add ashes from the hearth to the wad. Men, women, and children chew tobacco and all are addicted to it. Once there was a shortage of tobacco in Kaobawa’s village and I was plagued for a week by early morning visitors who requested permission to collect my cigarette butts in order to make a wad of chewing tobacco. Normally, if anyone is short of tobacco, he can request a share of someone else’s already chewed wad, or simply borrow the entire wad when its owner puts it down somewhere. Tobacco is so important to them that their word for “poverty” translates as “being without tobacco.” [Italics added by Hacker.]

-Napolean A. Chagnon, Yanomamo: The Fierce People (qtd. in Hacker 79)

(Source: webster.edu)

Paragraph Types

¶ Writing Paragraphs

A paragraph is a group of sentences about one topic. Most paragraphs have a topic sentence that states the main point and several sentences that explain, illustrate, or prove it. The five most common paragraph structures can be seen as shapes in which the widest part is the topic sentence.

Type 1: The Upside Down Triangle

Topic Sentence first (most common)

  1. Just as the triangle tapers off to a point, the paragraph tapers from the main idea to supporting details.
  2. This is most often used in informative writing. The author states a general idea and then develops it with detailed information.

Example:

Niagara Falls has an irresistible lure for daredevils. A motley procession of foolhardy men have dared death by dancing above the chasm on a tightrope or plunging over the cataract in a barrel. Others have tried to swim the current and to shoot the rapids in boats.

Type 2: The Triangle

Topic Sentence last (second-most common)

  1. In this paragraph structure, authors present details first and then make the more general statement about the topic.
  2. Authors most often use this paragraph structure for one of three purposes:
    • To organize the details into a summary statement,
    • To present convincing details that lead readers to accept a more general claim than they might otherwise, or
    • To create suspense as they build to a climax.

Example:

Costs were low that year and output was high. There was a good man for every job and the market remained firm. There were no losses by fire. All in all, it was the best year in the company’s history.

Type 3: The Diamond

The second sentence is the topic sentence

  1. The first sentence most often serves as a transition. All other sentences develop the general idea expressed in the second sentence.
  2. Authors use this structure for one of three reasons:
    • To vary their style,
    • To provide a smooth transition from the last paragraph, or
    • To point out the relationship between ideas presented previously and those presented in this paragraph.

Example:

There are deer in abundance here. The whole area is great country for hunters and fishermen. There are bear, occasional mountain lions and coyotes. To the east the streams are full of trout and there are ducks, geese and a few pheasants.

Type 4: The Hourglass

First and last sentences are topic sentences

Authors use this paragraph structure for one of two purposes:

  • To emphasize or clarify an important idea, in which case the two topic sentences make similar statements, or
  • To present two opinions, to point out advantages and disadvantages or to show how two things are similar and/or different, in which case there is usually a signal word that alerts the reader to a change in perspective.

Example of First Purpose:

Glaciers change the surface of the earth. They grind heavily as they move slowly along, much like fresh cement creeping down a gentle slope. They dig great holes in the sides of mountains and rub away the faces of rocks. A glacier pushes masses of loose soil and rock ahead of it. The loose soil and rocks form ridges when the ice melts or stops moving. A moving glacier also makes a valley wider as it pushes down through it. The earth looks quite different after a glacier has passed by.

Example of Second Purpose:

Penicillin is one of the greatest wonder drugs. It has saved thousands of lives already and will save many more in the future. But it has no effect whatever on the bulk of the ills of man and beast. Good as penicillin is, it is certainly not a cure-all.

Type 5: The Square

There is no topic sentence

  1. All sentences contribute to the main idea which the author expects the reader to provide.
  2. This type of paragraph structure is used most often to describe, to list, or to show the sequence of events.

Example:

The range of the Mule Deer is usually east of the Sierra Nevadas. It is the largest of the North American deer, sometimes weighing almost 400 pounds. The name has been given to the species because of the long ears and the mule-like tail. Owing to its rather large antlers, it is a valuable game animal.

(Source: webster.edu)